@web-ppt/edit-core 0.5.0-beta.2 → 0.5.0-beta.7
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 +171 -0
- package/README.md +164 -21
- package/dist/alt-text.d.ts +5 -0
- package/dist/appearance/index.d.ts +12 -0
- package/dist/appearance/materialize.d.ts +4 -0
- package/dist/appearance/types.d.ts +26 -0
- package/dist/appearance/values.d.ts +9 -0
- package/dist/appearance.js +301 -0
- package/dist/cfb/index.d.ts +5 -0
- package/dist/cfb/read.d.ts +16 -0
- package/dist/cfb/write.d.ts +3 -0
- package/dist/cfb.js +208 -0
- package/dist/change-classification.d.ts +3 -3
- package/dist/chart/category-binding.d.ts +4 -0
- package/dist/chart/category-commands.d.ts +23 -0
- package/dist/chart/category-levels.d.ts +14 -0
- package/dist/chart/category-matrix.d.ts +2 -0
- package/dist/chart/category-value.d.ts +2 -0
- package/dist/chart/category-workbook.d.ts +13 -0
- package/dist/chart/commands.d.ts +28 -0
- package/dist/chart/context.d.ts +12 -0
- package/dist/chart/dataset-merge.d.ts +5 -0
- package/dist/chart/formula.d.ts +13 -0
- package/dist/chart/identity-frames.d.ts +4 -0
- package/dist/chart/identity-scopes.d.ts +6 -0
- package/dist/chart/identity.d.ts +24 -0
- package/dist/chart/index.d.ts +8 -0
- package/dist/chart/limits.d.ts +6 -0
- package/dist/chart/locator.d.ts +4 -0
- package/dist/chart/materialize.d.ts +7 -0
- package/dist/chart/ordering.d.ts +9 -0
- package/dist/chart/part-graph.d.ts +5 -0
- package/dist/chart/patch-validation.d.ts +3 -0
- package/dist/chart/plot-kinds.d.ts +2 -0
- package/dist/chart/projection.d.ts +8 -0
- package/dist/chart/save.d.ts +4 -0
- package/dist/chart/shared-added-plan.d.ts +19 -0
- package/dist/chart/shared-added-records.d.ts +8 -0
- package/dist/chart/shared-address.d.ts +5 -0
- package/dist/chart/shared-allocate.d.ts +7 -0
- package/dist/chart/shared-cache-codec.d.ts +5 -0
- package/dist/chart/shared-cache-identities.d.ts +3 -0
- package/dist/chart/shared-cache-migration.d.ts +7 -0
- package/dist/chart/shared-cache-save.d.ts +3 -0
- package/dist/chart/shared-cache-scopes.d.ts +13 -0
- package/dist/chart/shared-cache.d.ts +11 -0
- package/dist/chart/shared-category.d.ts +4 -0
- package/dist/chart/shared-cell.d.ts +9 -0
- package/dist/chart/shared-family.d.ts +26 -0
- package/dist/chart/shared-fields.d.ts +18 -0
- package/dist/chart/shared-graph.d.ts +19 -0
- package/dist/chart/shared-growth-space.d.ts +5 -0
- package/dist/chart/shared-inserted-cells.d.ts +14 -0
- package/dist/chart/shared-inserted-command.d.ts +7 -0
- package/dist/chart/shared-inserted-layout.d.ts +16 -0
- package/dist/chart/shared-inserted-project.d.ts +14 -0
- package/dist/chart/shared-inserted-records.d.ts +16 -0
- package/dist/chart/shared-inserted-save.d.ts +6 -0
- package/dist/chart/shared-joint-command.d.ts +9 -0
- package/dist/chart/shared-joint-records.d.ts +9 -0
- package/dist/chart/shared-record-axis.d.ts +25 -0
- package/dist/chart/shared-record-remove.d.ts +13 -0
- package/dist/chart/shared-record-stage.d.ts +2 -0
- package/dist/chart/shared-records.d.ts +2 -0
- package/dist/chart/shared-rows.d.ts +17 -0
- package/dist/chart/shared-runtime.d.ts +19 -0
- package/dist/chart/shared-save-plan.d.ts +4 -0
- package/dist/chart/shared-save.d.ts +3 -0
- package/dist/chart/shared-series.d.ts +6 -0
- package/dist/chart/shared-source-cache.d.ts +4 -0
- package/dist/chart/shared-topology.d.ts +9 -0
- package/dist/chart/shared-unresolved.d.ts +3 -0
- package/dist/chart/shared-validation.d.ts +6 -0
- package/dist/chart/shared-workbook-source.d.ts +6 -0
- package/dist/chart/shared-xy-command.d.ts +7 -0
- package/dist/chart/shared-xy-family.d.ts +16 -0
- package/dist/chart/shared-xy-project.d.ts +6 -0
- package/dist/chart/shared-xy-records.d.ts +23 -0
- package/dist/chart/shared-xy-save.d.ts +5 -0
- package/dist/chart/shared-xy-source.d.ts +39 -0
- package/dist/chart/shared.d.ts +13 -0
- package/dist/chart/source.d.ts +11 -0
- package/dist/chart/types.d.ts +86 -0
- package/dist/chart/validation.d.ts +24 -0
- package/dist/chart/workbook-range.d.ts +16 -0
- package/dist/chart/workbook-read.d.ts +7 -0
- package/dist/chart/workbook-write.d.ts +9 -0
- package/dist/chart/workbook.d.ts +25 -0
- package/dist/chart/xml-data.d.ts +14 -0
- package/dist/chart/xml-namespaces.d.ts +16 -0
- package/dist/chart-design/index.d.ts +10 -0
- package/dist/chart-design/types.d.ts +11 -0
- package/dist/chart-design/xml.d.ts +2 -0
- package/dist/chart-design.js +361 -0
- package/dist/chart-ex/index.d.ts +15 -0
- package/dist/chart-ex/workbook.d.ts +6 -0
- package/dist/chart-ex/xml.d.ts +14 -0
- package/dist/chart-ex.js +457 -0
- package/dist/chart-shared/index.d.ts +12 -0
- package/dist/chart-shared.js +1 -0
- package/dist/chart.js +1 -0
- package/dist/clipboard-links-GuPtqr1z.js +778 -0
- package/dist/clipboard-package.d.ts +4 -0
- package/dist/clipboard-source.d.ts +6 -2
- package/dist/clipboard-trees.d.ts +9 -0
- package/dist/commands/add-slide-identity.d.ts +2 -0
- package/dist/commands/bullet-image-resource.d.ts +11 -0
- package/dist/commands/clear-format.d.ts +4 -0
- package/dist/commands/common-object-slide-patch.d.ts +4 -0
- package/dist/commands/common-object-slide-types.d.ts +68 -0
- package/dist/commands/direct-format-patches.d.ts +11 -5
- package/dist/commands/distribute-elements.d.ts +4 -0
- package/dist/commands/edit-table-grid.d.ts +10 -0
- package/dist/commands/element-alt-text.d.ts +8 -0
- package/dist/commands/element-arrangement.d.ts +17 -0
- package/dist/commands/element-effects.d.ts +1 -1
- package/dist/commands/element-fill.d.ts +1 -1
- package/dist/commands/element-geometry.d.ts +5 -2
- package/dist/commands/element-image-content.d.ts +2 -2
- package/dist/commands/element-link.d.ts +1 -1
- package/dist/commands/element-name.d.ts +1 -1
- package/dist/commands/element-stroke.d.ts +1 -1
- package/dist/commands/element-text.d.ts +1 -1
- package/dist/commands/element-transform.d.ts +2 -2
- package/dist/commands/geometry-types.d.ts +23 -1
- package/dist/commands/hierarchy-record.d.ts +5 -0
- package/dist/commands/image-resource.d.ts +8 -1
- package/dist/commands/insertion-host.d.ts +14 -1
- package/dist/commands/layout-property.d.ts +7 -0
- package/dist/commands/master-property.d.ts +5 -0
- package/dist/commands/master-text-style-types.d.ts +27 -0
- package/dist/commands/master-text-style.d.ts +7 -0
- package/dist/commands/paste-resources.d.ts +9 -5
- package/dist/commands/patch-apply.d.ts +3 -0
- package/dist/commands/patch-count.d.ts +1 -0
- package/dist/commands/patch-invalidation.d.ts +1 -1
- package/dist/commands/patch-stage.d.ts +4 -0
- package/dist/commands/record-override.d.ts +5 -0
- package/dist/commands/replace-image.d.ts +6 -1
- package/dist/commands/sections.d.ts +10 -0
- package/dist/commands/set-preset.d.ts +5 -0
- package/dist/commands/slide-property-types.d.ts +55 -5
- package/dist/commands/slide-size.d.ts +7 -0
- package/dist/commands/spid.d.ts +1 -1
- package/dist/commands/table-grid-patch.d.ts +12 -0
- package/dist/commands/text-target.d.ts +2 -2
- package/dist/commands/theme-types.d.ts +47 -0
- package/dist/commands/theme.d.ts +9 -0
- package/dist/commands/types.d.ts +194 -17
- package/dist/commands/ungroup-source.d.ts +3 -0
- package/dist/comments/index.d.ts +35 -0
- package/dist/comments/save.d.ts +3 -0
- package/dist/comments/state.d.ts +10 -0
- package/dist/comments/xml.d.ts +12 -0
- package/dist/comments.js +782 -0
- package/dist/common-object-slide-types.d.ts +34 -0
- package/dist/data-validation.d.ts +1 -1
- package/dist/describe/budget.d.ts +3 -0
- package/dist/describe/index.d.ts +5 -0
- package/dist/describe/read.d.ts +4 -0
- package/dist/describe/types.d.ts +103 -0
- package/dist/describe.js +192 -0
- package/dist/design-dependencies.d.ts +8 -0
- package/dist/design-projection-package.d.ts +10 -0
- package/dist/design-target.d.ts +10 -0
- package/dist/design.d.ts +3 -0
- package/dist/document-extensions.d.ts +9 -0
- package/dist/document.d.ts +1 -1
- package/dist/dynamic-projection.d.ts +6 -0
- package/dist/edit-core.js +5420 -4111
- package/dist/editor.d.ts +15 -3
- package/dist/element-source.d.ts +11 -0
- package/dist/element-spids.d.ts +4 -0
- package/dist/extension-address-journal.d.ts +9 -0
- package/dist/extension-address-remap.d.ts +14 -0
- package/dist/extension-addresses.d.ts +20 -0
- package/dist/extension-copy-history.d.ts +7 -0
- package/dist/extension-copy.d.ts +16 -0
- package/dist/extension-migration-receipt.d.ts +34 -0
- package/dist/extension-recovery-context.d.ts +5 -0
- package/dist/extension-runtime.d.ts +64 -0
- package/dist/generate/comments.d.ts +3 -0
- package/dist/generate/compatibility-parts.d.ts +14 -0
- package/dist/generate/compatibility-references.d.ts +3 -0
- package/dist/generate/compatibility.d.ts +4 -0
- package/dist/generate/index.d.ts +1 -0
- package/dist/generate/master-defaults.d.ts +4 -0
- package/dist/generate/materialize.d.ts +2 -2
- package/dist/generate/math.d.ts +3 -0
- package/dist/generate/portable-clipboard.d.ts +4 -0
- package/dist/generate/projection-tree.d.ts +8 -0
- package/dist/generate/template.d.ts +68 -1
- package/dist/generate/text-body.d.ts +2 -0
- package/dist/generate/text-effects.d.ts +5 -0
- package/dist/generate/text-override.d.ts +8 -0
- package/dist/generate/validation.d.ts +3 -0
- package/dist/generate/warp.d.ts +2 -0
- package/dist/generate.js +1232 -512
- package/dist/history.d.ts +11 -1
- package/dist/identities.d.ts +4 -0
- package/dist/image-content.d.ts +5 -2
- package/dist/image-resource-history.d.ts +2 -0
- package/dist/index-C2r7c6G6.js +714 -0
- package/dist/index-CYDvbiwF.js +1 -0
- package/dist/index.d.ts +35 -7
- package/dist/ink/index.d.ts +27 -0
- package/dist/ink/model.d.ts +4 -0
- package/dist/ink/save.d.ts +3 -0
- package/dist/ink/source.d.ts +7 -0
- package/dist/ink.js +324 -0
- package/dist/layout-assets.d.ts +3 -1
- package/dist/layout-projection.d.ts +17 -5
- package/dist/layout-state.d.ts +2 -0
- package/dist/layout-types.d.ts +42 -0
- package/dist/layout.d.ts +5 -0
- package/dist/lint/color.d.ts +5 -0
- package/dist/lint/index.d.ts +7 -0
- package/dist/lint/prompts.d.ts +3 -0
- package/dist/lint/report.d.ts +21 -0
- package/dist/lint/sampler-batch.d.ts +4 -0
- package/dist/lint/sampler-images.d.ts +2 -0
- package/dist/lint/sampler.d.ts +9 -0
- package/dist/lint/snapshot.d.ts +34 -0
- package/dist/lint/types.d.ts +67 -0
- package/dist/lint-sampler.js +187 -0
- package/dist/lint.js +659 -0
- package/dist/master-state.d.ts +3 -0
- package/dist/master-text-style-state.d.ts +3 -0
- package/dist/master-types.d.ts +55 -0
- package/dist/master.d.ts +5 -0
- package/dist/media/audio-icon.d.ts +2 -0
- package/dist/media/commands.d.ts +3 -0
- package/dist/media/index.d.ts +10 -0
- package/dist/media/markup.d.ts +10 -0
- package/dist/media/mp4-boxes.d.ts +12 -0
- package/dist/media/mp4-fragments.d.ts +8 -0
- package/dist/media/mp4-samples.d.ts +4 -0
- package/dist/media/mp4.d.ts +2 -0
- package/dist/media/poster.d.ts +2 -0
- package/dist/media/replace-poster.d.ts +3 -0
- package/dist/media/resource.d.ts +4 -0
- package/dist/media/source.d.ts +14 -0
- package/dist/media/types.d.ts +33 -0
- package/dist/media-properties.d.ts +4 -0
- package/dist/media.js +1630 -0
- package/dist/model-invariants-BM19JVxy.js +8980 -0
- package/dist/object-source.d.ts +11 -0
- package/dist/ole/container.d.ts +14 -0
- package/dist/ole/content.d.ts +94 -0
- package/dist/ole/index.d.ts +20 -0
- package/dist/ole/preview.d.ts +3 -0
- package/dist/ole/save.d.ts +2 -0
- package/dist/ole/state.d.ts +16 -0
- package/dist/ole.js +870 -0
- package/dist/opc.js +1 -1
- package/dist/paragraph-level.d.ts +2 -2
- package/dist/paragraph-property-schema.d.ts +4 -1
- package/dist/{patch-D7lZelRa.js → patch-BwhfBbYE.js} +10 -10
- package/dist/patch-events.d.ts +5 -1
- package/dist/ppt/appearance.d.ts +11 -0
- package/dist/ppt/binary.d.ts +20 -0
- package/dist/ppt/drawing.d.ts +18 -0
- package/dist/ppt/geometry.d.ts +4 -0
- package/dist/ppt/index.d.ts +12 -0
- package/dist/ppt/pictures.d.ts +11 -0
- package/dist/ppt/text.d.ts +9 -0
- package/dist/ppt.js +774 -0
- package/dist/preset-geometry.d.ts +6 -0
- package/dist/projection.d.ts +2 -0
- package/dist/query-BHLjWjnu.js +903 -0
- package/dist/recovery-identity.d.ts +1 -0
- package/dist/recovery-migrations.d.ts +3 -0
- package/dist/recovery.d.ts +3 -0
- package/dist/resize/index.d.ts +6 -0
- package/dist/resize/text.d.ts +4 -0
- package/dist/resize.js +5090 -0
- package/dist/retained-element-origins.d.ts +6 -0
- package/dist/run-property-fields.d.ts +12 -0
- package/dist/run-property-schema.d.ts +3 -1
- package/dist/run-style.d.ts +15 -0
- package/dist/save/alt-text.d.ts +4 -0
- package/dist/save/comments.d.ts +3 -0
- package/dist/save/effects.d.ts +2 -1
- package/dist/save/extension-availability.d.ts +3 -0
- package/dist/save/extension-elements.d.ts +26 -0
- package/dist/save/index.d.ts +6 -1
- package/dist/save/insertion.d.ts +6 -5
- package/dist/save/layout-properties.d.ts +4 -0
- package/dist/save/master-properties.d.ts +5 -0
- package/dist/save/paragraph-overrides.d.ts +3 -0
- package/dist/save/slide-parts.d.ts +1 -0
- package/dist/save/table.d.ts +2 -0
- package/dist/save/xfrm.d.ts +8 -2
- package/dist/save.js +493 -498
- package/dist/sections.d.ts +8 -0
- package/dist/session-assets.d.ts +4 -0
- package/dist/slide-parts-D0o_DDhi.js +1331 -0
- package/dist/slide-size.d.ts +6 -0
- package/dist/smartart/drawing.d.ts +3 -0
- package/dist/smartart/index.d.ts +16 -0
- package/dist/smartart/model.d.ts +18 -0
- package/dist/smartart/save.d.ts +3 -0
- package/dist/smartart.js +604 -0
- package/dist/source-retention.d.ts +7 -0
- package/dist/space.d.ts +37 -0
- package/dist/table-cell.d.ts +7 -1
- package/dist/table-grid-projection.d.ts +6 -0
- package/dist/table-grid.d.ts +45 -0
- package/dist/table-invariants.d.ts +4 -0
- package/dist/table-rows.d.ts +2 -1
- package/dist/table-scale.d.ts +4 -0
- package/dist/table-style.d.ts +5 -4
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/recipes.d.ts +5 -0
- package/dist/templates/types.d.ts +17 -0
- package/dist/templates.js +543 -0
- package/dist/text-flatten.d.ts +6 -0
- package/dist/text-fragment.d.ts +5 -0
- package/dist/text-model.d.ts +8 -8
- package/dist/text-override-validation.d.ts +6 -2
- package/dist/text-selection.d.ts +4 -0
- package/dist/theme-projection.d.ts +8 -0
- package/dist/theme-xml.d.ts +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/types.d.ts +174 -8
- package/dist/xml/index.d.ts +1 -1
- package/dist/xml/nodes.d.ts +2 -2
- package/dist/xml/shape-ids.d.ts +3 -0
- package/dist/xml.js +19 -16
- package/package.json +73 -5
- package/schemas/describe.schema.json +479 -0
- package/schemas/lint.schema.json +145 -0
- package/dist/document-B1jjN-QB.js +0 -274
- package/dist/image-resource-DbgJS9n-.js +0 -24
- package/dist/index-D2JizcOQ.js +0 -706
- package/dist/insertion-CGpb504L.js +0 -6152
- package/dist/table-style-part-DBtpxmuo.js +0 -1042
|
@@ -0,0 +1,1331 @@
|
|
|
1
|
+
import { S as Oe, a as J, T as $e, r as X, o as R, b as _, n as x, U as Ae, V as Be, W as _e, f as Fe, X as De, g as Xe, h as qe, Y as je, Z as Ee, _ as ze } from "./model-invariants-BM19JVxy.js";
|
|
2
|
+
import { p as b, x as p, b as P, i as T, c as I, a as k, r as w, s as v, h as Q, f as re, g as U, j as ue, k as ie, P as d, D as A, l as j, d as Y, e as H, m as S, M as $, n as Z, o as Ge, X as Ye, q as He } from "./index-C2r7c6G6.js";
|
|
3
|
+
const Ve = "http://schemas.openxmlformats.org/package/2006/relationships", We = "http://schemas.openxmlformats.org/package/2006/content-types";
|
|
4
|
+
function on(e) {
|
|
5
|
+
var o, r, s;
|
|
6
|
+
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), a = (c, i, l) => {
|
|
7
|
+
const m = (i.relationships ?? []).filter((f) => f.targetId !== l), g = t.get(c) ?? [];
|
|
8
|
+
g.push(...m), t.set(c, g);
|
|
9
|
+
for (const f of i.resources ?? []) {
|
|
10
|
+
if (!m.some((N) => !N.targetMode && J(c, N.target) === f.targetPart)) continue;
|
|
11
|
+
const u = n.get(f.targetPart);
|
|
12
|
+
if (u && (u.hash !== f.hash || u.bytes !== f.bytes))
|
|
13
|
+
throw new Error(`多个媒体资源争用目标 part:${f.targetPart}`);
|
|
14
|
+
n.set(f.targetPart, f);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
for (const c of Object.values(e.elements)) {
|
|
18
|
+
const i = (o = c.meta.origin) == null ? void 0 : o.part;
|
|
19
|
+
if (!i) continue;
|
|
20
|
+
const l = c.meta.imageReplacement, m = [c.meta.insertion, l ? {
|
|
21
|
+
relationships: l.relationships,
|
|
22
|
+
resources: [e.imageResources[l.resourceHash]]
|
|
23
|
+
} : void 0];
|
|
24
|
+
for (const f of m)
|
|
25
|
+
f && a(i, f, (r = c.meta.imageReplacement) == null ? void 0 : r.suppressedRelationshipId);
|
|
26
|
+
const g = [
|
|
27
|
+
c.ovr.text,
|
|
28
|
+
...Object.values(c.ovr.tableCells ?? {}).map((f) => f.text)
|
|
29
|
+
];
|
|
30
|
+
for (const f of g)
|
|
31
|
+
if ((f == null ? void 0 : f.kind) === "flat")
|
|
32
|
+
for (const h of f.paragraphs) {
|
|
33
|
+
const u = h.bulletImageOverride;
|
|
34
|
+
if (!u) continue;
|
|
35
|
+
const N = e.imageResources[u.resourceHash];
|
|
36
|
+
if (!N) throw new Error(`元素 ${c.id} 的图片项目符号资源不存在`);
|
|
37
|
+
a(i, { relationships: u.relationships, resources: [N] });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const c of Object.values(e.slides)) {
|
|
41
|
+
const i = (s = c.origin) == null ? void 0 : s.part, l = c.backgroundImage;
|
|
42
|
+
if (!i || !l) continue;
|
|
43
|
+
const m = l.resourceHashes.map((g) => e.imageResources[g]);
|
|
44
|
+
if (m.some((g) => !g))
|
|
45
|
+
throw new Error(`幻灯片 ${c.id} 的图片背景资源不存在`);
|
|
46
|
+
a(i, { relationships: l.relationships, resources: m });
|
|
47
|
+
}
|
|
48
|
+
return { relationships: t, resources: n };
|
|
49
|
+
}
|
|
50
|
+
function D(e, t) {
|
|
51
|
+
const n = e ? b(e) : b(`<Relationships xmlns="${Ve}"/>`), a = new Map(p(n.root, { localName: "Relationship" }).flatMap((o) => {
|
|
52
|
+
var l, m, g, f;
|
|
53
|
+
const r = (l = P(o, { localName: "Id", namespaceUri: null })) == null ? void 0 : l.value, s = (m = P(o, { localName: "Type", namespaceUri: null })) == null ? void 0 : m.value, c = (g = P(o, { localName: "Target", namespaceUri: null })) == null ? void 0 : g.value, i = (f = P(o, { localName: "TargetMode", namespaceUri: null })) == null ? void 0 : f.value;
|
|
54
|
+
return r && s && c ? [[r, { type: s, target: c, mode: i }]] : [];
|
|
55
|
+
}));
|
|
56
|
+
for (const o of t) {
|
|
57
|
+
const r = a.get(o.targetId);
|
|
58
|
+
if (r) {
|
|
59
|
+
if (r.type === o.type && r.target === o.target && r.mode === o.targetMode) continue;
|
|
60
|
+
throw new Error(`目标关系 id 冲突:${o.targetId}`);
|
|
61
|
+
}
|
|
62
|
+
a.set(o.targetId, {
|
|
63
|
+
type: o.type,
|
|
64
|
+
target: o.target,
|
|
65
|
+
mode: o.targetMode
|
|
66
|
+
}), T(n.root, I("Relationship", {
|
|
67
|
+
attributes: [
|
|
68
|
+
["Id", o.targetId],
|
|
69
|
+
["Type", o.type],
|
|
70
|
+
["Target", o.target],
|
|
71
|
+
...o.targetMode ? [["TargetMode", o.targetMode]] : []
|
|
72
|
+
]
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
return k(n);
|
|
76
|
+
}
|
|
77
|
+
function Ke(e, t) {
|
|
78
|
+
var r, s;
|
|
79
|
+
const n = e ? b(e) : b(`<Types xmlns="${We}"/>`), a = p(n.root, { localName: "Default" }), o = p(n.root, { localName: "Override" });
|
|
80
|
+
for (const c of t) {
|
|
81
|
+
const i = a.find((h) => {
|
|
82
|
+
var u;
|
|
83
|
+
return ((u = P(h, { localName: "Extension", namespaceUri: null })) == null ? void 0 : u.value.toLowerCase()) === c.extension.toLowerCase();
|
|
84
|
+
});
|
|
85
|
+
if ((i && ((r = P(i, { localName: "ContentType", namespaceUri: null })) == null ? void 0 : r.value)) === c.mime) continue;
|
|
86
|
+
const m = `/${c.targetPart}`, g = o.find((h) => {
|
|
87
|
+
var u;
|
|
88
|
+
return ((u = P(h, { localName: "PartName", namespaceUri: null })) == null ? void 0 : u.value) === m;
|
|
89
|
+
});
|
|
90
|
+
if (g) {
|
|
91
|
+
if (((s = P(g, {
|
|
92
|
+
localName: "ContentType",
|
|
93
|
+
namespaceUri: null
|
|
94
|
+
})) == null ? void 0 : s.value) !== c.mime)
|
|
95
|
+
throw new Error(`媒体资源与既有 Content-Type Override 冲突:${c.targetPart}`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const f = I(i ? "Override" : "Default", {
|
|
99
|
+
attributes: i ? [["PartName", m], ["ContentType", c.mime]] : [["Extension", c.extension], ["ContentType", c.mime]]
|
|
100
|
+
});
|
|
101
|
+
T(n.root, f), i ? o.push(f) : a.push(f);
|
|
102
|
+
}
|
|
103
|
+
return k(n);
|
|
104
|
+
}
|
|
105
|
+
function an(e) {
|
|
106
|
+
return Oe(e.bytes);
|
|
107
|
+
}
|
|
108
|
+
const he = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", V = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
109
|
+
function Ze(e) {
|
|
110
|
+
var n;
|
|
111
|
+
const t = re(e, {
|
|
112
|
+
localName: "spTree",
|
|
113
|
+
namespaceUri: d
|
|
114
|
+
});
|
|
115
|
+
for (const a of t ? p(t, {
|
|
116
|
+
localName: "sp",
|
|
117
|
+
namespaceUri: d
|
|
118
|
+
}) : []) {
|
|
119
|
+
const o = U(a, {
|
|
120
|
+
localName: "nvSpPr",
|
|
121
|
+
namespaceUri: d
|
|
122
|
+
}), r = o && U(o, {
|
|
123
|
+
localName: "nvPr",
|
|
124
|
+
namespaceUri: d
|
|
125
|
+
}), s = r && U(r, {
|
|
126
|
+
localName: "ph",
|
|
127
|
+
namespaceUri: d
|
|
128
|
+
}), c = (n = s == null ? void 0 : s.attributes.find((l) => l.namespaceUri === null && l.localName === "type")) == null ? void 0 : n.value, i = U(a, {
|
|
129
|
+
localName: "txBody",
|
|
130
|
+
namespaceUri: d
|
|
131
|
+
});
|
|
132
|
+
if (c === "body" && i) return i;
|
|
133
|
+
}
|
|
134
|
+
throw new Error("notesSlide 缺少可编辑的 body 占位符");
|
|
135
|
+
}
|
|
136
|
+
function ge(e, t) {
|
|
137
|
+
for (const n of [...e.children]) w(e, n);
|
|
138
|
+
T(e, ie(t));
|
|
139
|
+
}
|
|
140
|
+
function Je(e, t) {
|
|
141
|
+
const n = e ? ue(e) : I("a:p", { selfClosing: !1 });
|
|
142
|
+
let a = re(n, { localName: "t" });
|
|
143
|
+
if (!a) {
|
|
144
|
+
const s = n.prefix ? `${n.prefix}:` : "", c = I(`${s}r`, { selfClosing: !1 }), i = p(n).find((l) => l.localName === "endParaRPr");
|
|
145
|
+
if (i) {
|
|
146
|
+
const l = I(`${s}rPr`);
|
|
147
|
+
for (const m of i.attributes)
|
|
148
|
+
v(l, m.name, m.value, m.quote);
|
|
149
|
+
for (const m of i.children)
|
|
150
|
+
T(l, ue(m));
|
|
151
|
+
T(c, l);
|
|
152
|
+
}
|
|
153
|
+
a = I(`${s}t`, { selfClosing: !1 }), T(c, a), T(n, c, i ?? null);
|
|
154
|
+
}
|
|
155
|
+
ge(a, t);
|
|
156
|
+
let o = !1;
|
|
157
|
+
const r = (s) => {
|
|
158
|
+
for (const c of p(s))
|
|
159
|
+
c.localName === "t" ? o ? ge(c, "") : o = !0 : r(c);
|
|
160
|
+
};
|
|
161
|
+
return r(n), n;
|
|
162
|
+
}
|
|
163
|
+
function le(e, t) {
|
|
164
|
+
const n = b(e), a = Ze(n.root), o = p(a, {
|
|
165
|
+
localName: "p",
|
|
166
|
+
namespaceUri: A
|
|
167
|
+
});
|
|
168
|
+
for (const r of o) w(a, r);
|
|
169
|
+
for (const [r, s] of t.split(`
|
|
170
|
+
`).entries()) {
|
|
171
|
+
const c = o[r] ?? o[o.length - 1] ?? null;
|
|
172
|
+
T(a, Je(c, s));
|
|
173
|
+
}
|
|
174
|
+
return k(n);
|
|
175
|
+
}
|
|
176
|
+
function Ue() {
|
|
177
|
+
return new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
178
|
+
<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
|
179
|
+
<p:cSld><p:spTree>
|
|
180
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
181
|
+
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
182
|
+
<p:sp><p:nvSpPr><p:cNvPr id="2" name="备注正文"/><p:cNvSpPr/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr/><p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:r><a:t></a:t></a:r></a:p></p:txBody></p:sp>
|
|
183
|
+
</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
184
|
+
</p:notes>`);
|
|
185
|
+
}
|
|
186
|
+
function rn(e) {
|
|
187
|
+
return le(Ue(), e);
|
|
188
|
+
}
|
|
189
|
+
const C = (e, t) => {
|
|
190
|
+
var n;
|
|
191
|
+
return (n = e.attributes.find((a) => a.localName === t && a.namespaceUri === null)) == null ? void 0 : n.value;
|
|
192
|
+
};
|
|
193
|
+
function Qe(e, t, n) {
|
|
194
|
+
const a = b(e);
|
|
195
|
+
let o = !1;
|
|
196
|
+
for (const r of p(a.root, { localName: "Relationship" }))
|
|
197
|
+
C(r, "Type") !== t || C(r, "TargetMode") === "External" || (v(r, "Target", n), Q(r, "TargetMode"), o = !0);
|
|
198
|
+
return { bytes: o ? k(a) : e, found: o };
|
|
199
|
+
}
|
|
200
|
+
function et(e) {
|
|
201
|
+
const t = new Set(e ? p(
|
|
202
|
+
b(e).root,
|
|
203
|
+
{ localName: "Relationship" }
|
|
204
|
+
).flatMap((n) => C(n, "Id") ?? []) : []);
|
|
205
|
+
for (let n = 1; Number.isSafeInteger(n); n++) {
|
|
206
|
+
const a = `rId${n}`;
|
|
207
|
+
if (!t.has(a)) return a;
|
|
208
|
+
}
|
|
209
|
+
throw new Error("备注页的页面回指关系身份已耗尽");
|
|
210
|
+
}
|
|
211
|
+
function tt(e, t, n) {
|
|
212
|
+
const a = _(t, n);
|
|
213
|
+
if (e) {
|
|
214
|
+
const r = Qe(e, he, a);
|
|
215
|
+
if (r.found) return r.bytes;
|
|
216
|
+
}
|
|
217
|
+
const o = et(e);
|
|
218
|
+
return D(e, [{
|
|
219
|
+
sourceId: o,
|
|
220
|
+
targetId: o,
|
|
221
|
+
type: he,
|
|
222
|
+
target: a
|
|
223
|
+
}]);
|
|
224
|
+
}
|
|
225
|
+
function sn(e, t) {
|
|
226
|
+
if (!e.origin) throw new Error(`页面 ${e.id} 缺少 notes 关系宿主`);
|
|
227
|
+
if (!t)
|
|
228
|
+
return e.notes ? D(void 0, [{
|
|
229
|
+
sourceId: e.notes.relationshipId,
|
|
230
|
+
targetId: e.notes.relationshipId,
|
|
231
|
+
type: V,
|
|
232
|
+
target: _(e.origin.part, e.notes.targetPart)
|
|
233
|
+
}]) : D(void 0, []);
|
|
234
|
+
const n = b(t), a = p(n.root, { localName: "Relationship" });
|
|
235
|
+
if (!e.notes) {
|
|
236
|
+
let s = !1;
|
|
237
|
+
for (const c of a)
|
|
238
|
+
C(c, "Type") === V && C(c, "TargetMode") !== "External" && (w(n.root, c), s = !0);
|
|
239
|
+
return s ? k(n) : t;
|
|
240
|
+
}
|
|
241
|
+
const o = a.find((s) => C(s, "Id") === e.notes.relationshipId);
|
|
242
|
+
if (!o) return D(t, [{
|
|
243
|
+
sourceId: e.notes.relationshipId,
|
|
244
|
+
targetId: e.notes.relationshipId,
|
|
245
|
+
type: V,
|
|
246
|
+
target: _(e.origin.part, e.notes.targetPart)
|
|
247
|
+
}]);
|
|
248
|
+
if (C(o, "Type") !== V)
|
|
249
|
+
throw new Error(`页面 ${e.id} 的 notes 关系 id 与其它关系冲突`);
|
|
250
|
+
const r = _(e.origin.part, e.notes.targetPart);
|
|
251
|
+
return C(o, "Target") === r && C(o, "TargetMode") === void 0 ? t : (v(o, "Target", r), Q(o, "TargetMode"), k(n));
|
|
252
|
+
}
|
|
253
|
+
function nt(e, t, n) {
|
|
254
|
+
var r;
|
|
255
|
+
const a = t.origin && X(t.origin.part), o = a && ((r = e.package) == null ? void 0 : r.parts[a]);
|
|
256
|
+
return !o || !t.origin ? !1 : p(b(o).root, { localName: "Relationship" }).some((s) => {
|
|
257
|
+
const c = C(s, "Target");
|
|
258
|
+
return C(s, "Type") === V && C(s, "TargetMode") !== "External" && !!c && n.has(J(t.origin.part, c));
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function cn(e, t, n) {
|
|
262
|
+
var r, s, c;
|
|
263
|
+
const a = new Set([...n].filter($e));
|
|
264
|
+
for (const i of Object.values(e.slides)) {
|
|
265
|
+
const l = i.notes;
|
|
266
|
+
if (l) {
|
|
267
|
+
if (a.has(l.targetPart) || !((r = e.package) != null && r.parts[l.targetPart]) && !t[l.targetPart])
|
|
268
|
+
a.add(l.targetPart), n.add(l.targetPart), n.add(X(l.targetPart));
|
|
269
|
+
else if (R(i.ovr, "notes") && !t[l.targetPart]) {
|
|
270
|
+
const m = l.sourcePart ?? l.targetPart, g = (s = e.package) == null ? void 0 : s.parts[m];
|
|
271
|
+
if (!g) throw new Error(`找不到备注保存基线:${m}`);
|
|
272
|
+
t[l.targetPart] = g.slice();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const o = /* @__PURE__ */ new Map();
|
|
277
|
+
for (const i of Object.values(e.slides)) {
|
|
278
|
+
if (!i.origin || !(!!i.notes && a.has(i.notes.targetPart) || nt(e, i, a)) || (o.set(i.origin.part, i), i.creation)) continue;
|
|
279
|
+
const m = X(i.origin.part);
|
|
280
|
+
if (t[m] || n.has(m)) continue;
|
|
281
|
+
const g = (c = e.package) == null ? void 0 : c.parts[m];
|
|
282
|
+
g ? t[m] = g.slice() : n.add(m);
|
|
283
|
+
}
|
|
284
|
+
return { relationshipSlides: o, trackedParts: a };
|
|
285
|
+
}
|
|
286
|
+
function ln(e, t, n, a) {
|
|
287
|
+
var o, r, s;
|
|
288
|
+
for (const c of Object.values(e.slides)) {
|
|
289
|
+
const i = c.notes;
|
|
290
|
+
if (!i) continue;
|
|
291
|
+
if (n.trackedParts.has(i.targetPart)) {
|
|
292
|
+
const f = i.sourcePart ? t[i.sourcePart] ?? ((o = e.package) == null ? void 0 : o.parts[i.sourcePart]) : void 0;
|
|
293
|
+
if (i.sourcePart && !f) throw new Error(`找不到备注克隆来源:${i.sourcePart}`);
|
|
294
|
+
const h = R(c.ovr, "notes") ? c.ovr.notes : c.src.notes ?? "";
|
|
295
|
+
a[i.targetPart] = le(f ?? Ue(), h);
|
|
296
|
+
const u = i.sourcePart ? t[X(i.sourcePart)] ?? ((r = e.package) == null ? void 0 : r.parts[X(i.sourcePart)]) : void 0;
|
|
297
|
+
a[X(i.targetPart)] = tt(
|
|
298
|
+
u,
|
|
299
|
+
i.targetPart,
|
|
300
|
+
c.origin.part
|
|
301
|
+
);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const l = t[i.targetPart];
|
|
305
|
+
if (!l) continue;
|
|
306
|
+
const m = (s = e.package) == null ? void 0 : s.parts[i.targetPart];
|
|
307
|
+
(R(c.ovr, "notes") || m && (m.length !== l.length || m.some((f, h) => f !== l[h]))) && (a[i.targetPart] = R(c.ovr, "notes") ? le(l, c.ovr.notes) : l);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const ee = "http://schemas.microsoft.com/office/powerpoint/2015/09/main", pe = /* @__PURE__ */ new Set([
|
|
311
|
+
"vortex",
|
|
312
|
+
"switch",
|
|
313
|
+
"flip",
|
|
314
|
+
"ripple",
|
|
315
|
+
"honeycomb",
|
|
316
|
+
"glitter",
|
|
317
|
+
"warp",
|
|
318
|
+
"flythrough",
|
|
319
|
+
"flash",
|
|
320
|
+
"shred",
|
|
321
|
+
"reveal",
|
|
322
|
+
"wheelReverse",
|
|
323
|
+
"ferris",
|
|
324
|
+
"gallery",
|
|
325
|
+
"conveyor",
|
|
326
|
+
"pan",
|
|
327
|
+
"doors",
|
|
328
|
+
"window",
|
|
329
|
+
"prism"
|
|
330
|
+
]), ot = /* @__PURE__ */ new Set([
|
|
331
|
+
"fade",
|
|
332
|
+
"cut",
|
|
333
|
+
"push",
|
|
334
|
+
"pull",
|
|
335
|
+
"cover",
|
|
336
|
+
"wipe",
|
|
337
|
+
"split",
|
|
338
|
+
"zoom",
|
|
339
|
+
"dissolve",
|
|
340
|
+
"checker",
|
|
341
|
+
"blinds",
|
|
342
|
+
"comb",
|
|
343
|
+
"wheel",
|
|
344
|
+
"circle",
|
|
345
|
+
"diamond",
|
|
346
|
+
"plus",
|
|
347
|
+
"wedge",
|
|
348
|
+
"newsflash",
|
|
349
|
+
"randomBar",
|
|
350
|
+
"strips",
|
|
351
|
+
"random",
|
|
352
|
+
"fadeThroughBlack"
|
|
353
|
+
]), at = /* @__PURE__ */ new Set([S, ee]);
|
|
354
|
+
function rt(e) {
|
|
355
|
+
return e <= 625 ? "fast" : e <= 875 ? "med" : "slow";
|
|
356
|
+
}
|
|
357
|
+
function ne(e, t) {
|
|
358
|
+
for (const n of [...e.attributes])
|
|
359
|
+
t(n) && Q(e, n.name);
|
|
360
|
+
}
|
|
361
|
+
function Ie(e) {
|
|
362
|
+
return e === "p" ? d : e === "p14" ? S : ee;
|
|
363
|
+
}
|
|
364
|
+
function it(e, t, n) {
|
|
365
|
+
const a = Ie(n);
|
|
366
|
+
return e && p(e).find((o) => o.namespaceUri === a && Me(o) === t);
|
|
367
|
+
}
|
|
368
|
+
function Me(e) {
|
|
369
|
+
if (e.namespaceUri === d)
|
|
370
|
+
return e.localName === "random" ? "dissolve" : e.localName === "fadeThroughBlack" ? "fade" : ot.has(e.localName) ? e.localName : void 0;
|
|
371
|
+
if (e.namespaceUri === S && pe.has(e.localName)) return e.localName;
|
|
372
|
+
if (e.namespaceUri === ee && e.localName === "morph") return "morph";
|
|
373
|
+
}
|
|
374
|
+
function ke(e) {
|
|
375
|
+
return Me(e) !== void 0;
|
|
376
|
+
}
|
|
377
|
+
function st(e, t, n, a) {
|
|
378
|
+
const o = it(a, e.type, t), r = o ? H(o) : x(n, Ie(t), e.type);
|
|
379
|
+
if (ne(r, (s) => s.namespaceUri === null && ["dir", "orient", "option"].includes(s.localName)), e.type === "split" && e.dir) {
|
|
380
|
+
const [s, c] = e.dir.split("-");
|
|
381
|
+
v(r, "orient", s), v(r, "dir", c);
|
|
382
|
+
} else e.dir && v(r, "dir", e.dir);
|
|
383
|
+
return e.type === "morph" && v(r, "option", e.morphBy ?? "byObject"), r;
|
|
384
|
+
}
|
|
385
|
+
function Ne(e, t, n, a, o) {
|
|
386
|
+
const r = o ? H(o) : x(a, d, "transition"), s = p(r).filter(ke);
|
|
387
|
+
for (const i of s.slice(1)) w(r, i);
|
|
388
|
+
ne(r, (i) => i.namespaceUri === null && ["spd", "advTm", "dur"].includes(i.localName) || i.namespaceUri === S && i.localName === "dur"), n || ne(r, (i) => i.namespaceUri === S || i.namespaceUri === ee), v(r, "spd", rt(e.durationMs)), n && (v(r, "xmlns:p14", S), v(r, "p14:dur", String(e.durationMs))), e.advanceAfterMs !== void 0 && v(r, "advTm", String(e.advanceAfterMs));
|
|
389
|
+
const c = st(e, t, r, o);
|
|
390
|
+
if (s[0]) j(r, s[0], [c]);
|
|
391
|
+
else {
|
|
392
|
+
const i = r.children.find((l) => l.type === "element") ?? null;
|
|
393
|
+
T(r, c, i);
|
|
394
|
+
}
|
|
395
|
+
return r;
|
|
396
|
+
}
|
|
397
|
+
function ct(e) {
|
|
398
|
+
if (!pe.has(e.type) && e.type !== "morph") return e;
|
|
399
|
+
const t = ["gallery", "conveyor", "pan", "reveal"].includes(e.type) ? "push" : "fade";
|
|
400
|
+
return {
|
|
401
|
+
type: t,
|
|
402
|
+
durationMs: e.durationMs,
|
|
403
|
+
...t === "push" && e.dir && ["l", "r", "u", "d"].includes(e.dir) ? { dir: e.dir } : {},
|
|
404
|
+
...e.advanceAfterMs !== void 0 ? { advanceAfterMs: e.advanceAfterMs } : {}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function B(e) {
|
|
408
|
+
return e && p(e).find((t) => t.namespaceUri === d && t.localName === "transition");
|
|
409
|
+
}
|
|
410
|
+
function lt(e) {
|
|
411
|
+
var a;
|
|
412
|
+
const t = ((a = e.attributes.find((o) => o.namespaceUri === null && o.localName === "Requires")) == null ? void 0 : a.value.trim().split(/\s+/).filter(Boolean)) ?? [], n = Ge(e).namespaces;
|
|
413
|
+
return t.length > 0 && t.every((o) => at.has(n.get(o) ?? ""));
|
|
414
|
+
}
|
|
415
|
+
function fe(e) {
|
|
416
|
+
const t = p(e);
|
|
417
|
+
return {
|
|
418
|
+
choice: t.find((n) => n.namespaceUri === $ && n.localName === "Choice" && lt(n)),
|
|
419
|
+
fallback: t.find((n) => n.namespaceUri === $ && n.localName === "Fallback")
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function W(e, t) {
|
|
423
|
+
const n = B(e);
|
|
424
|
+
if (n) j(e, n, [t]);
|
|
425
|
+
else {
|
|
426
|
+
const a = e.children.find((o) => o.type === "element") ?? null;
|
|
427
|
+
T(e, t, a);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function Ce(e, t) {
|
|
431
|
+
const n = p(e), a = n.findIndex((s) => s.namespaceUri === $ && s.localName === "Choice"), o = n.indexOf(t);
|
|
432
|
+
if (a < 0 || o <= a) return;
|
|
433
|
+
const r = [...n];
|
|
434
|
+
r.splice(o, 1), r.splice(a, 0, t), Z(e, r);
|
|
435
|
+
}
|
|
436
|
+
function ft(e, t) {
|
|
437
|
+
const n = (t == null ? void 0 : t.namespaceUri) === d ? t : void 0, a = (t == null ? void 0 : t.namespaceUri) === $ ? H(t) : I("mc:AlternateContent", { selfClosing: !1 });
|
|
438
|
+
v(a, "xmlns:mc", $);
|
|
439
|
+
const o = e.type === "morph";
|
|
440
|
+
let { choice: r, fallback: s } = fe(a);
|
|
441
|
+
if (!r || !B(r)) {
|
|
442
|
+
r = I("mc:Choice", { selfClosing: !1 });
|
|
443
|
+
const m = a.children.find((g) => g.type === "element") ?? null;
|
|
444
|
+
T(a, r, m);
|
|
445
|
+
}
|
|
446
|
+
const c = B(r) ?? n;
|
|
447
|
+
v(r, "xmlns:p14", S), o && v(r, "xmlns:p159", ee), v(r, "Requires", o ? "p159" : "p14"), Ce(a, r), W(r, Ne(
|
|
448
|
+
e,
|
|
449
|
+
o ? "p159" : pe.has(e.type) ? "p14" : "p",
|
|
450
|
+
!0,
|
|
451
|
+
r,
|
|
452
|
+
c
|
|
453
|
+
)), s || (s = I("mc:Fallback", { selfClosing: !1 }), T(a, s));
|
|
454
|
+
const i = B(s) ?? n, l = ct(e);
|
|
455
|
+
return W(s, Ne(
|
|
456
|
+
l,
|
|
457
|
+
"p",
|
|
458
|
+
!1,
|
|
459
|
+
s,
|
|
460
|
+
i
|
|
461
|
+
)), a;
|
|
462
|
+
}
|
|
463
|
+
function pt(e) {
|
|
464
|
+
return e.namespaceUri !== $ || e.localName !== "AlternateContent" ? !1 : p(e).some((t) => t.namespaceUri === $ && (t.localName === "Choice" || t.localName === "Fallback") && B(t) !== void 0);
|
|
465
|
+
}
|
|
466
|
+
function mt(e) {
|
|
467
|
+
return p(e).filter((t) => t.namespaceUri === d && t.localName === "transition" || pt(t));
|
|
468
|
+
}
|
|
469
|
+
function ce(e, t) {
|
|
470
|
+
const n = H(e);
|
|
471
|
+
for (const a of p(n).filter(ke))
|
|
472
|
+
w(n, a);
|
|
473
|
+
return ne(n, (a) => a.namespaceUri === null && ["spd", "dur", "advTm"].includes(a.localName) || a.namespaceUri === S && a.localName === "dur"), t.advanceAfterMs !== void 0 && v(n, "advTm", String(t.advanceAfterMs)), n;
|
|
474
|
+
}
|
|
475
|
+
function dt(e, t) {
|
|
476
|
+
if (e.namespaceUri === d) return ce(e, t);
|
|
477
|
+
const n = H(e);
|
|
478
|
+
let a = fe(n), o = a.choice;
|
|
479
|
+
if (!o || !B(o)) {
|
|
480
|
+
o = I("mc:Choice", { selfClosing: !1 });
|
|
481
|
+
const i = n.children.find((l) => l.type === "element") ?? null;
|
|
482
|
+
T(n, o, i);
|
|
483
|
+
}
|
|
484
|
+
v(o, "xmlns:p14", S), v(o, "Requires", "p14");
|
|
485
|
+
const r = B(o), s = B(a.fallback), c = r ?? s;
|
|
486
|
+
if (c ? W(o, ce(c, t)) : W(o, x(o, d, "transition")), Ce(n, o), a = fe(n), a.fallback) {
|
|
487
|
+
const i = B(a.fallback);
|
|
488
|
+
i ? j(a.fallback, i, [ce(i, t)]) : W(
|
|
489
|
+
a.fallback,
|
|
490
|
+
x(a.fallback, d, "transition")
|
|
491
|
+
);
|
|
492
|
+
} else {
|
|
493
|
+
const i = I("mc:Fallback", { selfClosing: !1 });
|
|
494
|
+
T(n, i), T(i, x(i, d, "transition"));
|
|
495
|
+
}
|
|
496
|
+
return n;
|
|
497
|
+
}
|
|
498
|
+
function ut(e) {
|
|
499
|
+
const t = (a, o = []) => a.attributes.some((r) => r.name !== "xmlns" && r.prefix !== "xmlns" && !(r.namespaceUri === null && o.includes(r.localName))), n = (a) => t(a) || a.children.some((o) => o.type === "element" || o.type === "text" && o.value.trim() || o.type !== "text");
|
|
500
|
+
return e.namespaceUri === d ? n(e) : t(e) || p(e).some((a) => t(a, ["Requires"]) || a.children.some((o) => o.type !== "element" ? o.type !== "text" || !!o.value.trim() : o.namespaceUri === d && o.localName === "transition" ? n(o) : !0));
|
|
501
|
+
}
|
|
502
|
+
function ht(e, t, n = !1) {
|
|
503
|
+
const a = mt(e.root);
|
|
504
|
+
if (t.type === "none") {
|
|
505
|
+
if (a[0]) {
|
|
506
|
+
const s = dt(a[0], t), c = n || t.advanceAfterMs !== void 0 || ut(s) ? [s] : [];
|
|
507
|
+
j(e.root, a[0], c);
|
|
508
|
+
for (const i of a.slice(1)) w(e.root, i);
|
|
509
|
+
} else if (n || t.advanceAfterMs !== void 0) {
|
|
510
|
+
const s = x(e.root, d, "transition");
|
|
511
|
+
t.advanceAfterMs !== void 0 && v(s, "advTm", String(t.advanceAfterMs)), Y(e.root, s);
|
|
512
|
+
}
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
const o = ft(t, a[0]);
|
|
516
|
+
if (a[0]) {
|
|
517
|
+
j(e.root, a[0], [o]);
|
|
518
|
+
for (const s of a.slice(1)) w(e.root, s);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const r = x(e.root, d, "transition");
|
|
522
|
+
Y(e.root, r), j(e.root, r, [o]);
|
|
523
|
+
}
|
|
524
|
+
const gt = Object.freeze({
|
|
525
|
+
u: 1,
|
|
526
|
+
r: 2,
|
|
527
|
+
d: 4,
|
|
528
|
+
l: 8,
|
|
529
|
+
rd: 3,
|
|
530
|
+
ru: 6,
|
|
531
|
+
lu: 9,
|
|
532
|
+
ld: 12,
|
|
533
|
+
horz: 5,
|
|
534
|
+
vert: 10,
|
|
535
|
+
in: 16,
|
|
536
|
+
out: 32
|
|
537
|
+
});
|
|
538
|
+
function y(e, t, n = {}) {
|
|
539
|
+
const a = x(e, d, t);
|
|
540
|
+
for (const [o, r] of Object.entries(n)) v(a, o, String(r));
|
|
541
|
+
return T(e, a), a;
|
|
542
|
+
}
|
|
543
|
+
function z(e, t, n = {}) {
|
|
544
|
+
return y(e, "cTn", { id: t(), ...n });
|
|
545
|
+
}
|
|
546
|
+
function me(e, t) {
|
|
547
|
+
const n = y(e, "stCondLst");
|
|
548
|
+
y(n, "cond", { delay: t });
|
|
549
|
+
}
|
|
550
|
+
function te(e, t, n, a, o = []) {
|
|
551
|
+
const r = y(e, "cBhvr");
|
|
552
|
+
z(r, a, { dur: n, fill: "hold" });
|
|
553
|
+
const s = y(r, "tgtEl");
|
|
554
|
+
if (y(s, "spTgt", { spid: t }), o.length) {
|
|
555
|
+
const c = y(r, "attrNameLst");
|
|
556
|
+
for (const i of o) {
|
|
557
|
+
const l = y(c, "attrName");
|
|
558
|
+
T(l, ie(i));
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function ve(e, t, n, a, o) {
|
|
563
|
+
const r = y(e, "set"), s = y(r, "cBhvr"), c = z(s, o, { dur: 1, fill: "hold" });
|
|
564
|
+
me(c, a);
|
|
565
|
+
const i = y(s, "tgtEl");
|
|
566
|
+
y(i, "spTgt", { spid: t });
|
|
567
|
+
const l = y(s, "attrNameLst"), m = y(l, "attrName");
|
|
568
|
+
T(m, ie("style.visibility"));
|
|
569
|
+
const g = y(r, "to");
|
|
570
|
+
y(g, "strVal", { val: n });
|
|
571
|
+
}
|
|
572
|
+
function Nt(e, t, n, a) {
|
|
573
|
+
if (t.kind === "emphasis" && t.effect === "spin") {
|
|
574
|
+
const s = y(e, "animRot", { by: 216e5 });
|
|
575
|
+
te(s, n, t.durationMs, a, ["r"]);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (t.kind === "emphasis" && t.effect === "grow") {
|
|
579
|
+
const s = y(e, "animScale");
|
|
580
|
+
te(s, n, t.durationMs, a, ["ppt_w", "ppt_h"]), y(s, "by", { x: 125e3, y: 125e3 });
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (t.effect === "appear") return;
|
|
584
|
+
const o = Be(t.effect, t.dir);
|
|
585
|
+
if (!o) throw new Error(`动画 ${t.effect} 缺少可保存 filter`);
|
|
586
|
+
const r = y(e, "animEffect", {
|
|
587
|
+
transition: t.kind === "exit" ? "out" : "in",
|
|
588
|
+
filter: o
|
|
589
|
+
});
|
|
590
|
+
te(r, n, t.durationMs, a);
|
|
591
|
+
}
|
|
592
|
+
function ye(e) {
|
|
593
|
+
const t = Math.abs(e) < 5e-10 ? 0 : Math.round(e * 1e9) / 1e9;
|
|
594
|
+
return String(t);
|
|
595
|
+
}
|
|
596
|
+
function vt(e, t, n, a, o) {
|
|
597
|
+
const r = t.motionPath.map(([c, i], l) => `${l ? "L" : "M"} ${ye(c / a.meta.width)} ${ye(i / a.meta.height)}`).join(" "), s = y(e, "animMotion", {
|
|
598
|
+
origin: "layout",
|
|
599
|
+
path: `${r} E`,
|
|
600
|
+
pathEditMode: "relative"
|
|
601
|
+
});
|
|
602
|
+
te(s, n, t.durationMs, o, ["ppt_x", "ppt_y"]);
|
|
603
|
+
}
|
|
604
|
+
function yt(e, t, n, a) {
|
|
605
|
+
var l;
|
|
606
|
+
const o = n.elements[t.target], r = ((l = o == null ? void 0 : o.meta.origin) == null ? void 0 : l.spid) ?? (o == null ? void 0 : o.src.id);
|
|
607
|
+
if (r === void 0) throw new Error(`动画目标缺少 OOXML spid:${t.target}`);
|
|
608
|
+
const s = y(e, "par"), c = z(s, a, {
|
|
609
|
+
presetID: t.kind === "motion" ? 0 : Ae(t.effect).preset,
|
|
610
|
+
presetClass: t.kind === "motion" ? "path" : t.kind === "entrance" ? "entr" : t.kind === "exit" ? "exit" : "emph",
|
|
611
|
+
...t.kind !== "motion" && t.dir !== void 0 ? { presetSubtype: gt[t.dir] ?? 0 } : {},
|
|
612
|
+
dur: t.durationMs,
|
|
613
|
+
fill: "hold",
|
|
614
|
+
nodeType: t.trigger === "click" ? "clickEffect" : t.trigger === "withPrev" ? "withEffect" : "afterEffect"
|
|
615
|
+
});
|
|
616
|
+
me(c, t.delayMs);
|
|
617
|
+
const i = y(c, "childTnLst");
|
|
618
|
+
t.kind === "entrance" && ve(i, r, "visible", 0, a), t.kind === "motion" ? vt(i, t, r, n, a) : Nt(i, t, r, a), t.kind === "exit" && ve(i, r, "hidden", t.durationMs, a);
|
|
619
|
+
}
|
|
620
|
+
function Tt(e, t, n) {
|
|
621
|
+
let a = 0;
|
|
622
|
+
const o = () => ++a, r = y(e, "par"), s = z(r, o, {
|
|
623
|
+
dur: "indefinite",
|
|
624
|
+
restart: "never",
|
|
625
|
+
nodeType: "tmRoot"
|
|
626
|
+
}), c = y(s, "childTnLst"), i = y(c, "seq", { concurrent: 1, nextAc: "seek" }), l = z(i, o, { dur: "indefinite", nodeType: "mainSeq" }), m = y(l, "childTnLst");
|
|
627
|
+
let g = null;
|
|
628
|
+
for (const f of t) {
|
|
629
|
+
if (!g || f.trigger === "click") {
|
|
630
|
+
const h = y(m, "par"), u = z(h, o, { fill: "hold", nodeType: "clickEffect" });
|
|
631
|
+
me(u, "indefinite"), g = y(u, "childTnLst");
|
|
632
|
+
}
|
|
633
|
+
yt(g, f, n, o);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function se(e) {
|
|
637
|
+
return e.attributes.some((t) => t.namespaceUri !== Ye);
|
|
638
|
+
}
|
|
639
|
+
function oe(e) {
|
|
640
|
+
return p(e).filter((t) => t.namespaceUri === d && t.localName === "timing");
|
|
641
|
+
}
|
|
642
|
+
function St(e) {
|
|
643
|
+
if (e.namespaceUri !== $ || e.localName !== "AlternateContent") return [];
|
|
644
|
+
const n = p(e).filter((a) => a.namespaceUri === $ && (a.localName === "Choice" || a.localName === "Fallback")).map((a) => ({ parent: a, timings: oe(a) }));
|
|
645
|
+
if (n.some(({ timings: a }) => a.length > 1))
|
|
646
|
+
throw new Error("mc:AlternateContent 分支包含多个 p:timing");
|
|
647
|
+
return n.some(({ timings: a }) => a.length) ? n.map(({ parent: a, timings: o }) => ({ parent: a, timing: o[0] })) : [];
|
|
648
|
+
}
|
|
649
|
+
function wt(e) {
|
|
650
|
+
const t = oe(e), n = p(e).map(St).filter((a) => a.length);
|
|
651
|
+
if (t.length > 1 || n.length > 1 || t.length && n.length)
|
|
652
|
+
throw new Error("幻灯片包含多个 p:timing 载体");
|
|
653
|
+
return t.length ? [{ parent: e, timing: t[0] }] : n[0] ?? [];
|
|
654
|
+
}
|
|
655
|
+
const bt = /* @__PURE__ */ new Set([
|
|
656
|
+
"set",
|
|
657
|
+
"anim",
|
|
658
|
+
"animClr",
|
|
659
|
+
"animEffect",
|
|
660
|
+
"animMotion",
|
|
661
|
+
"animRot",
|
|
662
|
+
"animScale",
|
|
663
|
+
"audio",
|
|
664
|
+
"video",
|
|
665
|
+
"cmd"
|
|
666
|
+
]);
|
|
667
|
+
function M(e) {
|
|
668
|
+
const t = He(e).parent;
|
|
669
|
+
return (t == null ? void 0 : t.type) === "element" ? t : null;
|
|
670
|
+
}
|
|
671
|
+
function G(e, t) {
|
|
672
|
+
var n;
|
|
673
|
+
return (n = e.attributes.find((a) => a.namespaceUri === null && a.localName === t)) == null ? void 0 : n.value;
|
|
674
|
+
}
|
|
675
|
+
function F(e) {
|
|
676
|
+
const t = [], n = [e];
|
|
677
|
+
for (; n.length; ) {
|
|
678
|
+
const a = n.pop();
|
|
679
|
+
if (t.push(a), t.length > 1e5) throw new Error("动画时间树节点超过保存安全上限");
|
|
680
|
+
const o = p(a);
|
|
681
|
+
for (let r = o.length - 1; r >= 0; r--) n.push(o[r]);
|
|
682
|
+
}
|
|
683
|
+
return t;
|
|
684
|
+
}
|
|
685
|
+
function xt(e, t) {
|
|
686
|
+
return F(e).some((n) => {
|
|
687
|
+
const a = G(n, "spid");
|
|
688
|
+
return a !== void 0 && t.has(Number(a));
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
function Pt(e) {
|
|
692
|
+
let t = M(e), n = (t == null ? void 0 : t.localName) === "tgtEl" ? t : e;
|
|
693
|
+
for (; t; ) {
|
|
694
|
+
if (t.namespaceUri === d && (t.localName === "cBhvr" || t.localName === "cond") || bt.has(t.localName)) return t;
|
|
695
|
+
t = M(t);
|
|
696
|
+
}
|
|
697
|
+
return n;
|
|
698
|
+
}
|
|
699
|
+
function K(e) {
|
|
700
|
+
if (!(e.namespaceUri !== d || e.localName !== "par"))
|
|
701
|
+
return p(e).find((t) => t.namespaceUri === d && t.localName === "cTn" && !!G(t, "presetClass"));
|
|
702
|
+
}
|
|
703
|
+
function Et(e, t) {
|
|
704
|
+
const n = F(e).filter((o) => !!K(o));
|
|
705
|
+
let a = null;
|
|
706
|
+
for (let o = n.length - 1; o >= 0; o--) {
|
|
707
|
+
const r = n[o], s = K(r);
|
|
708
|
+
if (!t.has(r)) {
|
|
709
|
+
a = r;
|
|
710
|
+
continue;
|
|
711
|
+
}
|
|
712
|
+
G(s, "nodeType") === "clickEffect" && a && v(K(a), "nodeType", "clickEffect");
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
function Ut(e) {
|
|
716
|
+
for (let t = 0; t < 64; t++) {
|
|
717
|
+
let n = !1;
|
|
718
|
+
const a = F(e).reverse();
|
|
719
|
+
for (const o of a) {
|
|
720
|
+
if (o.namespaceUri !== d || o.localName !== "par" && o.localName !== "seq") continue;
|
|
721
|
+
const r = p(o).find((i) => i.namespaceUri === d && i.localName === "cTn"), s = r && p(r).find((i) => i.namespaceUri === d && i.localName === "childTnLst"), c = M(o);
|
|
722
|
+
s && p(s).length === 0 && c && (w(c, o), n = !0);
|
|
723
|
+
}
|
|
724
|
+
if (!n) break;
|
|
725
|
+
}
|
|
726
|
+
for (const t of F(e).reverse()) {
|
|
727
|
+
if (t.namespaceUri !== d || t.localName !== "tnLst" && t.localName !== "bldLst" || p(t).length !== 0 || se(t)) continue;
|
|
728
|
+
const n = M(t);
|
|
729
|
+
n && w(n, t);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
function Te(e) {
|
|
733
|
+
return F(e).filter((t) => t.namespaceUri === d && t.localName === "spTgt");
|
|
734
|
+
}
|
|
735
|
+
function It(e) {
|
|
736
|
+
const t = M(e);
|
|
737
|
+
if (t && (w(t, e), t.localName === "tgtEl" && p(t).length === 0 && !se(t))) {
|
|
738
|
+
const n = M(t);
|
|
739
|
+
n && w(n, t);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
const Mt = /* @__PURE__ */ new Set([
|
|
743
|
+
"timing",
|
|
744
|
+
"tnLst",
|
|
745
|
+
"childTnLst",
|
|
746
|
+
"subTnLst",
|
|
747
|
+
"par",
|
|
748
|
+
"seq",
|
|
749
|
+
"cTn"
|
|
750
|
+
]);
|
|
751
|
+
function kt(e) {
|
|
752
|
+
const t = /* @__PURE__ */ new Set();
|
|
753
|
+
for (const a of e) {
|
|
754
|
+
if (a.namespaceUri !== d || a.localName !== "cBhvr") continue;
|
|
755
|
+
const o = M(a);
|
|
756
|
+
o && !Mt.has(o.localName) && t.add(o);
|
|
757
|
+
}
|
|
758
|
+
const n = /* @__PURE__ */ new Set();
|
|
759
|
+
for (const a of t) {
|
|
760
|
+
const o = p(a).filter((r) => r.namespaceUri === d && r.localName === "cBhvr");
|
|
761
|
+
o.length && o.every((r) => e.has(r)) && n.add(a);
|
|
762
|
+
}
|
|
763
|
+
return n;
|
|
764
|
+
}
|
|
765
|
+
function Ct(e) {
|
|
766
|
+
const t = /* @__PURE__ */ new Set();
|
|
767
|
+
for (const a of e) {
|
|
768
|
+
if (a.namespaceUri !== d || a.localName !== "cond") continue;
|
|
769
|
+
const o = M(a);
|
|
770
|
+
o && (o.localName === "stCondLst" || o.localName === "endCondLst") && t.add(o);
|
|
771
|
+
}
|
|
772
|
+
const n = /* @__PURE__ */ new Set();
|
|
773
|
+
for (const a of t) {
|
|
774
|
+
const o = p(a).filter((c) => c.namespaceUri === d && c.localName === "cond");
|
|
775
|
+
if (!o.length || !o.every((c) => e.has(c))) continue;
|
|
776
|
+
const r = M(a), s = r && M(r);
|
|
777
|
+
s && s.namespaceUri === d && (s.localName === "par" || s.localName === "seq") && n.add(s);
|
|
778
|
+
}
|
|
779
|
+
return n;
|
|
780
|
+
}
|
|
781
|
+
function Rt(e, t) {
|
|
782
|
+
for (let n = M(e); n; n = M(n))
|
|
783
|
+
if (t.has(n)) return !0;
|
|
784
|
+
return !1;
|
|
785
|
+
}
|
|
786
|
+
function Lt(e) {
|
|
787
|
+
return F(e).filter((t) => {
|
|
788
|
+
const n = K(t), a = n && p(n).find((o) => o.namespaceUri === d && o.localName === "childTnLst");
|
|
789
|
+
return !!a && p(a).length === 0;
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
function Se(e) {
|
|
793
|
+
for (const t of e) {
|
|
794
|
+
const n = M(t);
|
|
795
|
+
n && w(n, t);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
function Ot(e) {
|
|
799
|
+
const t = oe(e).map((n) => ({ parent: e, timing: n }));
|
|
800
|
+
for (const n of p(e))
|
|
801
|
+
if (!(n.namespaceUri !== $ || n.localName !== "AlternateContent")) {
|
|
802
|
+
for (const a of p(n))
|
|
803
|
+
if (!(a.namespaceUri !== $ || a.localName !== "Choice" && a.localName !== "Fallback"))
|
|
804
|
+
for (const o of oe(a)) t.push({ parent: a, timing: o });
|
|
805
|
+
}
|
|
806
|
+
return t;
|
|
807
|
+
}
|
|
808
|
+
function fn(e, t) {
|
|
809
|
+
if (!t.length) return;
|
|
810
|
+
const n = new Set(t);
|
|
811
|
+
for (const a of Ot(e.root)) {
|
|
812
|
+
const o = a.timing, r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
813
|
+
for (const f of F(o))
|
|
814
|
+
if (f.namespaceUri === d && f.localName === "spTgt" && n.has(Number(G(f, "spid")))) {
|
|
815
|
+
const h = Pt(f);
|
|
816
|
+
h && c.set(h, [...c.get(h) ?? [], f]);
|
|
817
|
+
}
|
|
818
|
+
for (const [f, h] of c)
|
|
819
|
+
Te(f).some((N) => !n.has(Number(G(N, "spid")))) ? h.forEach((N) => s.add(N)) : r.add(f);
|
|
820
|
+
s.forEach(It);
|
|
821
|
+
const i = kt(r), l = Ct(r);
|
|
822
|
+
i.forEach((f) => r.add(f));
|
|
823
|
+
const m = new Set([...r].filter((f) => !l.has(f)));
|
|
824
|
+
Se(m);
|
|
825
|
+
const g = new Set(Lt(o));
|
|
826
|
+
for (const f of F(o).filter((h) => !!K(h)))
|
|
827
|
+
(l.has(f) || Rt(f, l)) && g.add(f);
|
|
828
|
+
Et(o, g), Se(l);
|
|
829
|
+
for (const f of F(o).filter((h) => h.namespaceUri === d && h.localName === "bldLst"))
|
|
830
|
+
for (const h of [...p(f)])
|
|
831
|
+
xt(h, n) && w(f, h);
|
|
832
|
+
if (Ut(o), Te(o).some((f) => n.has(Number(G(f, "spid")))))
|
|
833
|
+
throw new Error("删除动画目标后仍存在悬空 spTgt");
|
|
834
|
+
!se(o) && p(o).length === 0 && w(a.parent, o);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function $t(e, t, n, a) {
|
|
838
|
+
for (const o of [...p(t)])
|
|
839
|
+
o.namespaceUri === d && o.localName === "tnLst" && w(t, o);
|
|
840
|
+
if (n.length) {
|
|
841
|
+
const o = x(t, d, "tnLst"), r = p(t).find((s) => s.namespaceUri === d && (s.localName === "bldLst" || s.localName === "extLst")) ?? null;
|
|
842
|
+
T(t, o, r), Tt(o, n, a);
|
|
843
|
+
} else !se(t) && p(t).length === 0 && w(e, t);
|
|
844
|
+
}
|
|
845
|
+
function At(e, t, n, a) {
|
|
846
|
+
let o = wt(e.root);
|
|
847
|
+
if (!o.length && a.length) {
|
|
848
|
+
const r = x(e.root, d, "timing");
|
|
849
|
+
Y(e.root, r), o = [{ parent: e.root, timing: r }];
|
|
850
|
+
}
|
|
851
|
+
for (const r of o) {
|
|
852
|
+
let s = r.timing;
|
|
853
|
+
!s && a.length && (s = x(r.parent, d, "timing"), Y(r.parent, s)), s && $t(r.parent, s, a, t);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
const Bt = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
857
|
+
function _t(e, t) {
|
|
858
|
+
var o;
|
|
859
|
+
const n = new Map(((o = t.backgroundImage) == null ? void 0 : o.relationships.map((r) => [r.sourceId, r.targetId])) ?? []), a = (r) => {
|
|
860
|
+
for (const s of r.attributes) {
|
|
861
|
+
const c = s.namespaceUri === Bt ? n.get(s.value) : null;
|
|
862
|
+
c && v(r, s.name, c, s.quote);
|
|
863
|
+
}
|
|
864
|
+
for (const s of p(r)) a(s);
|
|
865
|
+
};
|
|
866
|
+
a(e);
|
|
867
|
+
}
|
|
868
|
+
function Ft(e) {
|
|
869
|
+
return R(e.ovr, "background") || R(e.ovr, "hidden") || R(e.ovr, "transition") || R(e.ovr, "animations");
|
|
870
|
+
}
|
|
871
|
+
function Dt(e, t) {
|
|
872
|
+
const n = U(e.root, {
|
|
873
|
+
localName: "cSld",
|
|
874
|
+
namespaceUri: d
|
|
875
|
+
});
|
|
876
|
+
if (!n) throw new Error(`幻灯片 ${t.id} 缺少 p:cSld`);
|
|
877
|
+
return n;
|
|
878
|
+
}
|
|
879
|
+
function Xt(e, t, n) {
|
|
880
|
+
var s, c;
|
|
881
|
+
const a = (s = e.package) == null ? void 0 : s.parts[X(t)];
|
|
882
|
+
if (!a) return null;
|
|
883
|
+
const o = p(b(a).root, { localName: "Relationship" }).find((i) => {
|
|
884
|
+
var l;
|
|
885
|
+
return (l = P(i, { localName: "Type", namespaceUri: null })) == null ? void 0 : l.value.endsWith(n);
|
|
886
|
+
}), r = o && ((c = P(o, { localName: "Target", namespaceUri: null })) == null ? void 0 : c.value);
|
|
887
|
+
return r ? J(t, r) : null;
|
|
888
|
+
}
|
|
889
|
+
function qt(e, t) {
|
|
890
|
+
var c;
|
|
891
|
+
const n = (c = e.package) == null ? void 0 : c.parts[t];
|
|
892
|
+
if (!n) return { found: !1, image: null };
|
|
893
|
+
const a = U(b(n).root, {
|
|
894
|
+
localName: "cSld",
|
|
895
|
+
namespaceUri: d
|
|
896
|
+
}), o = a && U(a, {
|
|
897
|
+
localName: "bg",
|
|
898
|
+
namespaceUri: d
|
|
899
|
+
});
|
|
900
|
+
if (!o) return { found: !1, image: null };
|
|
901
|
+
const r = U(o, {
|
|
902
|
+
localName: "bgPr",
|
|
903
|
+
namespaceUri: d
|
|
904
|
+
});
|
|
905
|
+
return { found: !0, image: r && U(r, {
|
|
906
|
+
localName: "blipFill",
|
|
907
|
+
namespaceUri: A
|
|
908
|
+
}) ? o : null };
|
|
909
|
+
}
|
|
910
|
+
function jt(e, t) {
|
|
911
|
+
var a;
|
|
912
|
+
if (((a = t.src.background) == null ? void 0 : a.type) !== "image" || !t.layoutId) return null;
|
|
913
|
+
const n = Xt(e, t.layoutId, "/slideMaster");
|
|
914
|
+
for (const o of [t.layoutId, n]) {
|
|
915
|
+
if (!o) continue;
|
|
916
|
+
const r = qt(e, o);
|
|
917
|
+
if (r.found) return r.image;
|
|
918
|
+
}
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
function zt(e, t, n) {
|
|
922
|
+
if (!R(n.ovr, "background")) return;
|
|
923
|
+
const a = n.ovr.background;
|
|
924
|
+
(a == null ? void 0 : a.type) === "image" ? _e(a, `幻灯片 ${n.id} 的背景覆盖`) : Fe(a, `幻灯片 ${n.id} 的背景覆盖`);
|
|
925
|
+
const o = Dt(e, n);
|
|
926
|
+
let r = U(o, {
|
|
927
|
+
localName: "bg",
|
|
928
|
+
namespaceUri: d
|
|
929
|
+
});
|
|
930
|
+
if (!r) {
|
|
931
|
+
const c = a.type === "image" ? jt(t, n) : null;
|
|
932
|
+
r = c ? H(c) : x(o, d, "bg"), c && _t(r, n), Y(o, r);
|
|
933
|
+
}
|
|
934
|
+
let s = U(r, {
|
|
935
|
+
localName: "bgPr",
|
|
936
|
+
namespaceUri: d
|
|
937
|
+
});
|
|
938
|
+
for (const c of [...p(r)])
|
|
939
|
+
c.namespaceUri === d && c.localName === "bgRef" && w(r, c);
|
|
940
|
+
if (s || (s = x(r, d, "bgPr"), Y(r, s)), a.type === "image") {
|
|
941
|
+
const c = n.backgroundImage;
|
|
942
|
+
if (!c) throw new Error(`幻灯片 ${n.id} 的图片背景缺少关系`);
|
|
943
|
+
De(
|
|
944
|
+
s,
|
|
945
|
+
a,
|
|
946
|
+
c.imageRelationshipId,
|
|
947
|
+
c.sourcePart !== void 0
|
|
948
|
+
);
|
|
949
|
+
} else
|
|
950
|
+
Xe(s), qe(s, a);
|
|
951
|
+
}
|
|
952
|
+
function pn(e, t, n) {
|
|
953
|
+
var a;
|
|
954
|
+
if (Ft(n)) {
|
|
955
|
+
if (R(n.ovr, "hidden") && (n.ovr.hidden ? v(e.root, "show", "0") : Q(e.root, "show")), R(n.ovr, "transition")) {
|
|
956
|
+
const o = n.layoutId ? (a = t.layouts[n.layoutId]) == null ? void 0 : a.transition : void 0;
|
|
957
|
+
ht(
|
|
958
|
+
e,
|
|
959
|
+
n.ovr.transition,
|
|
960
|
+
o !== void 0
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
R(n.ovr, "animations") && At(e, t, n, n.ovr.animations), zt(e, t, n);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
const Gt = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>', Yt = "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml", we = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles";
|
|
967
|
+
function mn(e) {
|
|
968
|
+
const t = /* @__PURE__ */ new Map();
|
|
969
|
+
for (const a of Object.values(e.elements)) {
|
|
970
|
+
const o = a.ovr.tableStyle;
|
|
971
|
+
if (!o) continue;
|
|
972
|
+
const r = je(e, a.id, o.styleId);
|
|
973
|
+
if (!r) throw new Error(`表格 ${a.id} 的样式定义不存在:${o.styleId}`);
|
|
974
|
+
t.set(r.styleId.toUpperCase(), r);
|
|
975
|
+
}
|
|
976
|
+
const n = e.meta.tableStylesPart ?? e.saveState.createdParts.find((a) => /(?:^|\/)tableStyles\.xml$/.test(a));
|
|
977
|
+
return !t.size && !n ? null : { part: n ?? "ppt/tableStyles.xml", definitions: [...t.values()] };
|
|
978
|
+
}
|
|
979
|
+
function dn(e, t) {
|
|
980
|
+
return Ke(e, [{
|
|
981
|
+
targetPart: t,
|
|
982
|
+
hash: "table-style-part",
|
|
983
|
+
mime: Yt,
|
|
984
|
+
extension: "xml",
|
|
985
|
+
bytes: "",
|
|
986
|
+
created: !0
|
|
987
|
+
}]);
|
|
988
|
+
}
|
|
989
|
+
function un(e, t) {
|
|
990
|
+
const n = b(e), a = p(n.root, { localName: "Relationship" });
|
|
991
|
+
if (a.find((i) => {
|
|
992
|
+
var l;
|
|
993
|
+
return ((l = P(i, { localName: "Type", namespaceUri: null })) == null ? void 0 : l.value) === we;
|
|
994
|
+
})) return e;
|
|
995
|
+
const r = new Set(a.flatMap((i) => {
|
|
996
|
+
var m;
|
|
997
|
+
const l = (m = P(i, { localName: "Id", namespaceUri: null })) == null ? void 0 : m.value;
|
|
998
|
+
return l ? [l] : [];
|
|
999
|
+
}));
|
|
1000
|
+
let s = 1;
|
|
1001
|
+
for (; r.has(`rId${s}`); ) s++;
|
|
1002
|
+
const c = `rId${s}`;
|
|
1003
|
+
return D(e, [{
|
|
1004
|
+
sourceId: c,
|
|
1005
|
+
targetId: c,
|
|
1006
|
+
type: we,
|
|
1007
|
+
target: _("ppt/presentation.xml", t)
|
|
1008
|
+
}]);
|
|
1009
|
+
}
|
|
1010
|
+
function Ht(e) {
|
|
1011
|
+
const t = b(e);
|
|
1012
|
+
if (t.root.localName !== "tblStyleLst" || t.root.namespaceUri !== A)
|
|
1013
|
+
throw new Error("tableStyles.xml 根节点不是 a:tblStyleLst");
|
|
1014
|
+
return new Set(p(t.root, { localName: "tblStyle", namespaceUri: A }).flatMap((n) => {
|
|
1015
|
+
var o;
|
|
1016
|
+
const a = (o = P(n, { localName: "styleId", namespaceUri: null })) == null ? void 0 : o.value;
|
|
1017
|
+
return a ? [a.toUpperCase()] : [];
|
|
1018
|
+
}));
|
|
1019
|
+
}
|
|
1020
|
+
function Vt(e, t) {
|
|
1021
|
+
const n = e ? Ht(e) : /* @__PURE__ */ new Set();
|
|
1022
|
+
return t.filter((a) => !n.has(a.styleId.toUpperCase()));
|
|
1023
|
+
}
|
|
1024
|
+
function hn(e, t) {
|
|
1025
|
+
var s;
|
|
1026
|
+
const n = Vt(e, t);
|
|
1027
|
+
if (e && !n.length) return e;
|
|
1028
|
+
const a = e ?? new TextEncoder().encode(
|
|
1029
|
+
`${Gt}<a:tblStyleLst xmlns:a="${A}" def="${((s = t[0]) == null ? void 0 : s.styleId) ?? ""}"></a:tblStyleLst>`
|
|
1030
|
+
), o = b(a), r = p(o.root, { localName: "extLst", namespaceUri: A })[0] ?? null;
|
|
1031
|
+
for (const c of n) {
|
|
1032
|
+
const i = b(`<root xmlns:a="${A}">${c.markup}</root>`), l = p(i.root, { localName: "tblStyle", namespaceUri: A })[0];
|
|
1033
|
+
if (!l || !w(i.root, l))
|
|
1034
|
+
throw new Error(`无法物化表样式:${c.styleId}`);
|
|
1035
|
+
T(o.root, l, r);
|
|
1036
|
+
}
|
|
1037
|
+
return k(o);
|
|
1038
|
+
}
|
|
1039
|
+
const Wt = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml", Kt = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml", be = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", xe = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
1040
|
+
function de(e) {
|
|
1041
|
+
return e.slideOrder.map((t) => e.slides[t]).filter((t) => !!t.creation);
|
|
1042
|
+
}
|
|
1043
|
+
function gn() {
|
|
1044
|
+
return new TextEncoder().encode(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1045
|
+
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
|
1046
|
+
<p:cSld><p:spTree>
|
|
1047
|
+
<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>
|
|
1048
|
+
<p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>
|
|
1049
|
+
</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>
|
|
1050
|
+
</p:sld>`);
|
|
1051
|
+
}
|
|
1052
|
+
function Nn(e, t) {
|
|
1053
|
+
if (!e.creation || !e.origin) throw new Error(`页面 ${e.id} 不是可物化的新页`);
|
|
1054
|
+
return Zt(e, t);
|
|
1055
|
+
}
|
|
1056
|
+
function Pe(e) {
|
|
1057
|
+
const t = new Set(e ? p(b(e).root, { localName: "Relationship" }).flatMap((n) => E(n, "Id") ?? []) : []);
|
|
1058
|
+
for (let n = 1; ; n++) if (!t.has(`rId${n}`)) return `rId${n}`;
|
|
1059
|
+
}
|
|
1060
|
+
function Zt(e, t) {
|
|
1061
|
+
var s, c;
|
|
1062
|
+
if (!e.origin || !e.layoutId) throw new Error(`页面 ${e.id} 缺少版式写回身份`);
|
|
1063
|
+
if (!t) {
|
|
1064
|
+
const i = ((s = e.creation) == null ? void 0 : s.layoutRelationshipId) ?? Pe();
|
|
1065
|
+
return D(void 0, [{
|
|
1066
|
+
sourceId: i,
|
|
1067
|
+
targetId: i,
|
|
1068
|
+
type: xe,
|
|
1069
|
+
target: _(e.origin.part, e.layoutId)
|
|
1070
|
+
}]);
|
|
1071
|
+
}
|
|
1072
|
+
const n = b(t), o = p(n.root, { localName: "Relationship" }).find((i) => {
|
|
1073
|
+
var l;
|
|
1074
|
+
return ((l = E(i, "Type")) == null ? void 0 : l.endsWith("/slideLayout")) && E(i, "TargetMode") !== "External" && (e.creation === void 0 || E(i, "Id") === e.creation.layoutRelationshipId);
|
|
1075
|
+
});
|
|
1076
|
+
if (!o) {
|
|
1077
|
+
const i = ((c = e.creation) == null ? void 0 : c.layoutRelationshipId) ?? Pe(t);
|
|
1078
|
+
return D(t, [{
|
|
1079
|
+
sourceId: i,
|
|
1080
|
+
targetId: i,
|
|
1081
|
+
type: xe,
|
|
1082
|
+
target: _(e.origin.part, e.layoutId)
|
|
1083
|
+
}]);
|
|
1084
|
+
}
|
|
1085
|
+
const r = _(e.origin.part, e.layoutId);
|
|
1086
|
+
return E(o, "Target") === r && E(o, "TargetMode") === void 0 ? t : (v(o, "Target", r), Q(o, "TargetMode"), k(n));
|
|
1087
|
+
}
|
|
1088
|
+
function vn(e, t) {
|
|
1089
|
+
const n = b(e), a = String(t);
|
|
1090
|
+
let o = !1;
|
|
1091
|
+
const r = (s) => {
|
|
1092
|
+
var c, i;
|
|
1093
|
+
for (const l of p(s)) {
|
|
1094
|
+
if (l.namespaceUri === A && l.localName === "fld" && ((c = E(l, "type")) == null ? void 0 : c.toLowerCase()) === "slidenum") {
|
|
1095
|
+
const m = U(l, { localName: "t", namespaceUri: A });
|
|
1096
|
+
if (m && !(m.children.length === 1 && ((i = m.children[0]) == null ? void 0 : i.type) === "text" && m.children[0].value === a)) {
|
|
1097
|
+
for (const g of [...m.children]) w(m, g);
|
|
1098
|
+
T(m, ie(a)), o = !0;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
r(l);
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
return r(n.root), o ? k(n) : e;
|
|
1105
|
+
}
|
|
1106
|
+
function Jt(e) {
|
|
1107
|
+
var n, a, o;
|
|
1108
|
+
const t = /* @__PURE__ */ new Map();
|
|
1109
|
+
for (const r of p(b(e).root, { localName: "Relationship" })) {
|
|
1110
|
+
const s = (n = P(r, { localName: "Id", namespaceUri: null })) == null ? void 0 : n.value, c = (a = P(r, { localName: "Target", namespaceUri: null })) == null ? void 0 : a.value, i = (o = P(r, { localName: "TargetMode", namespaceUri: null })) == null ? void 0 : o.value;
|
|
1111
|
+
s && c && i !== "External" && t.set(s, J("ppt/presentation.xml", c));
|
|
1112
|
+
}
|
|
1113
|
+
return t;
|
|
1114
|
+
}
|
|
1115
|
+
function E(e, t) {
|
|
1116
|
+
var n;
|
|
1117
|
+
return (n = P(e, { localName: t, namespaceUri: null })) == null ? void 0 : n.value;
|
|
1118
|
+
}
|
|
1119
|
+
function ae(e, t, n, a) {
|
|
1120
|
+
const o = p(e).find((r) => r.localName !== n || r.namespaceUri !== a) ?? null;
|
|
1121
|
+
T(e, t, o);
|
|
1122
|
+
}
|
|
1123
|
+
function Qt(e, t) {
|
|
1124
|
+
let n = re(e, {
|
|
1125
|
+
localName: "sectionLst",
|
|
1126
|
+
namespaceUri: S
|
|
1127
|
+
});
|
|
1128
|
+
if (n || !t) return n;
|
|
1129
|
+
let a = U(e, { localName: "extLst", namespaceUri: d });
|
|
1130
|
+
a || (a = x(e, d, "extLst"), T(e, a));
|
|
1131
|
+
const o = x(a, d, "ext");
|
|
1132
|
+
return v(o, "uri", "{521415D9-36F7-43E2-AB2F-B90AF26B5E84}"), T(a, o), n = x(o, S, "sectionLst"), T(o, n), n;
|
|
1133
|
+
}
|
|
1134
|
+
function Re(e, t, n) {
|
|
1135
|
+
const a = ze(t), o = Qt(e, a.order.length > 0);
|
|
1136
|
+
if (!o) return;
|
|
1137
|
+
const r = p(o, {
|
|
1138
|
+
localName: "section",
|
|
1139
|
+
namespaceUri: S
|
|
1140
|
+
}), s = new Map(r.flatMap((i) => {
|
|
1141
|
+
const l = E(i, "id");
|
|
1142
|
+
return l ? [[l, i]] : [];
|
|
1143
|
+
})), c = a.order.map((i) => {
|
|
1144
|
+
const l = a.records[i], m = s.get(l.presentationId) ?? x(o, S, "section");
|
|
1145
|
+
v(m, "name", l.name), v(m, "id", l.presentationId);
|
|
1146
|
+
let g = U(m, {
|
|
1147
|
+
localName: "sldIdLst",
|
|
1148
|
+
namespaceUri: S
|
|
1149
|
+
});
|
|
1150
|
+
g || (g = x(m, S, "sldIdLst"), T(m, g));
|
|
1151
|
+
const f = p(g, {
|
|
1152
|
+
localName: "sldId",
|
|
1153
|
+
namespaceUri: S
|
|
1154
|
+
}), h = new Map(f.map((N) => [Number(E(N, "id")), N])), u = l.slideIds.map((N) => {
|
|
1155
|
+
const L = n.get(N);
|
|
1156
|
+
if (L === void 0) throw new Error(`节 ${l.id} 的页面无法映射 presentation id:${N}`);
|
|
1157
|
+
const O = h.get(L);
|
|
1158
|
+
if (O) return [O];
|
|
1159
|
+
const q = x(g, S, "sldId");
|
|
1160
|
+
return v(q, "id", String(L)), [q];
|
|
1161
|
+
}).flat();
|
|
1162
|
+
for (const N of f)
|
|
1163
|
+
u.includes(N) || w(g, N);
|
|
1164
|
+
for (const N of u)
|
|
1165
|
+
p(g).includes(N) || ae(g, N, "sldId", S);
|
|
1166
|
+
return Z(g, u), m;
|
|
1167
|
+
});
|
|
1168
|
+
for (const i of r)
|
|
1169
|
+
c.includes(i) || w(o, i);
|
|
1170
|
+
for (const i of c)
|
|
1171
|
+
p(o).includes(i) || ae(o, i, "section", S);
|
|
1172
|
+
Z(o, c);
|
|
1173
|
+
}
|
|
1174
|
+
function en(e, t, n, a) {
|
|
1175
|
+
const o = re(e, {
|
|
1176
|
+
localName: "sectionLst",
|
|
1177
|
+
namespaceUri: S
|
|
1178
|
+
});
|
|
1179
|
+
if (o)
|
|
1180
|
+
for (const r of p(o, {
|
|
1181
|
+
localName: "section",
|
|
1182
|
+
namespaceUri: S
|
|
1183
|
+
})) {
|
|
1184
|
+
const s = U(r, {
|
|
1185
|
+
localName: "sldIdLst",
|
|
1186
|
+
namespaceUri: S
|
|
1187
|
+
});
|
|
1188
|
+
if (!s) continue;
|
|
1189
|
+
const c = p(s, {
|
|
1190
|
+
localName: "sldId",
|
|
1191
|
+
namespaceUri: S
|
|
1192
|
+
}), i = new Set(c.flatMap((h) => {
|
|
1193
|
+
const u = E(h, "id");
|
|
1194
|
+
return u ? [Number(u)] : [];
|
|
1195
|
+
}));
|
|
1196
|
+
for (const h of c) {
|
|
1197
|
+
const u = Number(E(h, "id"));
|
|
1198
|
+
a.has(u) && w(s, h);
|
|
1199
|
+
}
|
|
1200
|
+
const l = c.filter((h) => !a.has(Number(E(h, "id"))));
|
|
1201
|
+
let m = !0;
|
|
1202
|
+
for (; m; ) {
|
|
1203
|
+
m = !1;
|
|
1204
|
+
for (const h of t) {
|
|
1205
|
+
const u = h.creation;
|
|
1206
|
+
!u || i.has(u.presentationSlideId) || u.sectionAfterSlideId === void 0 || !i.has(u.sectionAfterSlideId) || (i.add(u.presentationSlideId), m = !0);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
const g = new Map(l.map((h) => [Number(E(h, "id")), h])), f = n.flatMap((h) => {
|
|
1210
|
+
if (!i.has(h)) return [];
|
|
1211
|
+
const u = g.get(h);
|
|
1212
|
+
if (u) return [u];
|
|
1213
|
+
const N = x(s, S, "sldId");
|
|
1214
|
+
return v(N, "id", String(h)), g.set(h, N), [N];
|
|
1215
|
+
});
|
|
1216
|
+
for (const h of f)
|
|
1217
|
+
p(s).includes(h) || ae(s, h, "sldId", S);
|
|
1218
|
+
Z(s, f);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
function Le(e, t) {
|
|
1222
|
+
let n = U(e, { localName: "sldSz", namespaceUri: d });
|
|
1223
|
+
if (!n) {
|
|
1224
|
+
n = x(e, d, "sldSz");
|
|
1225
|
+
const a = U(e, { localName: "notesSz", namespaceUri: d });
|
|
1226
|
+
T(e, n, a);
|
|
1227
|
+
}
|
|
1228
|
+
v(n, "cx", String(Math.round(t.meta.width * 9525))), v(n, "cy", String(Math.round(t.meta.height * 9525)));
|
|
1229
|
+
}
|
|
1230
|
+
function yn(e, t) {
|
|
1231
|
+
const n = b(e), a = new Map(t.slideOrder.map((o, r) => [o, 256 + r]));
|
|
1232
|
+
return Re(n.root, t, a), Le(n.root, t), k(n);
|
|
1233
|
+
}
|
|
1234
|
+
function Tn(e, t, n) {
|
|
1235
|
+
var h;
|
|
1236
|
+
const a = b(e), o = U(a.root, { localName: "sldIdLst", namespaceUri: d });
|
|
1237
|
+
if (!o) throw new Error("presentation.xml 缺少 p:sldIdLst");
|
|
1238
|
+
const r = Jt(t), s = /* @__PURE__ */ new Map(), c = Ee(n), i = /* @__PURE__ */ new Set();
|
|
1239
|
+
for (const u of p(o, { localName: "sldId", namespaceUri: d })) {
|
|
1240
|
+
const N = (h = P(u, {
|
|
1241
|
+
localName: "id",
|
|
1242
|
+
namespaceUri: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
1243
|
+
})) == null ? void 0 : h.value, L = N ? r.get(N) : void 0;
|
|
1244
|
+
if (L && c.has(L)) {
|
|
1245
|
+
const O = Number(E(u, "id"));
|
|
1246
|
+
Number.isFinite(O) && i.add(O), w(o, u);
|
|
1247
|
+
} else L && s.set(L, u);
|
|
1248
|
+
}
|
|
1249
|
+
const l = de(n), m = new Map(l.map((u) => [u.id, u])), g = n.slideOrder.map((u) => {
|
|
1250
|
+
const N = n.slides[u], L = N.origin ? s.get(N.origin.part) : void 0;
|
|
1251
|
+
if (L) return L;
|
|
1252
|
+
const O = m.get(u);
|
|
1253
|
+
if (!(O != null && O.creation)) throw new Error(`页面 ${u} 无法映射到 presentation.xml`);
|
|
1254
|
+
const q = x(o, d, "sldId");
|
|
1255
|
+
return v(q, "id", String(O.creation.presentationSlideId)), v(q, "r:id", O.creation.presentationRelationshipId), q;
|
|
1256
|
+
});
|
|
1257
|
+
for (const u of g)
|
|
1258
|
+
p(o).includes(u) || ae(o, u, "sldId", d);
|
|
1259
|
+
Z(o, g);
|
|
1260
|
+
const f = g.map((u) => Number(E(u, "id")));
|
|
1261
|
+
return n.sections.edited ? Re(a.root, n, new Map(n.slideOrder.map((u, N) => [
|
|
1262
|
+
u,
|
|
1263
|
+
f[N]
|
|
1264
|
+
]))) : en(a.root, l, f, i), (n.meta.width !== n.meta.sourceWidth || n.meta.height !== n.meta.sourceHeight) && Le(a.root, n), k(a);
|
|
1265
|
+
}
|
|
1266
|
+
function Sn(e, t) {
|
|
1267
|
+
const n = b(e), a = Ee(t);
|
|
1268
|
+
for (const o of p(n.root, { localName: "Relationship" })) {
|
|
1269
|
+
const r = E(o, "Type"), s = E(o, "Target"), c = E(o, "TargetMode");
|
|
1270
|
+
r !== be || !s || c === "External" || a.has(J("ppt/presentation.xml", s)) && w(n.root, o);
|
|
1271
|
+
}
|
|
1272
|
+
return D(k(n), de(t).map((o) => ({
|
|
1273
|
+
sourceId: o.creation.presentationRelationshipId,
|
|
1274
|
+
targetId: o.creation.presentationRelationshipId,
|
|
1275
|
+
type: be,
|
|
1276
|
+
target: _("ppt/presentation.xml", o.origin.part)
|
|
1277
|
+
})));
|
|
1278
|
+
}
|
|
1279
|
+
function wn(e, t, n = /* @__PURE__ */ new Set()) {
|
|
1280
|
+
var r, s;
|
|
1281
|
+
const a = b(e);
|
|
1282
|
+
for (const c of p(a.root, { localName: "Override" })) {
|
|
1283
|
+
const i = (r = P(c, { localName: "PartName", namespaceUri: null })) == null ? void 0 : r.value;
|
|
1284
|
+
i && n.has(i.replace(/^\//, "")) && w(a.root, c);
|
|
1285
|
+
}
|
|
1286
|
+
const o = new Set(p(a.root, { localName: "Override" }).flatMap((c) => {
|
|
1287
|
+
var l;
|
|
1288
|
+
const i = (l = P(c, { localName: "PartName", namespaceUri: null })) == null ? void 0 : l.value;
|
|
1289
|
+
return i ? [i] : [];
|
|
1290
|
+
}));
|
|
1291
|
+
for (const c of de(t)) {
|
|
1292
|
+
const i = `/${c.origin.part}`;
|
|
1293
|
+
o.has(i) || (T(a.root, I("Override", {
|
|
1294
|
+
attributes: [["PartName", i], ["ContentType", Wt]]
|
|
1295
|
+
})), o.add(i));
|
|
1296
|
+
}
|
|
1297
|
+
for (const c of Object.values(t.slides)) {
|
|
1298
|
+
const i = (s = c.notes) == null ? void 0 : s.targetPart;
|
|
1299
|
+
!i || o.has(`/${i}`) || (T(a.root, I("Override", {
|
|
1300
|
+
attributes: [["PartName", `/${i}`], ["ContentType", Kt]]
|
|
1301
|
+
})), o.add(`/${i}`));
|
|
1302
|
+
}
|
|
1303
|
+
return k(a);
|
|
1304
|
+
}
|
|
1305
|
+
export {
|
|
1306
|
+
cn as a,
|
|
1307
|
+
pn as b,
|
|
1308
|
+
de as c,
|
|
1309
|
+
vn as d,
|
|
1310
|
+
gn as e,
|
|
1311
|
+
D as f,
|
|
1312
|
+
Zt as g,
|
|
1313
|
+
sn as h,
|
|
1314
|
+
an as i,
|
|
1315
|
+
ln as j,
|
|
1316
|
+
Ke as k,
|
|
1317
|
+
wn as l,
|
|
1318
|
+
on as m,
|
|
1319
|
+
Nn as n,
|
|
1320
|
+
Tn as o,
|
|
1321
|
+
ht as p,
|
|
1322
|
+
Sn as q,
|
|
1323
|
+
fn as r,
|
|
1324
|
+
dn as s,
|
|
1325
|
+
mn as t,
|
|
1326
|
+
un as u,
|
|
1327
|
+
hn as v,
|
|
1328
|
+
Ft as w,
|
|
1329
|
+
rn as x,
|
|
1330
|
+
yn as y
|
|
1331
|
+
};
|