ooxml-core 0.9.0 → 0.11.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/README.md +14 -13
- package/dist/automation/docx.d.ts +13 -0
- package/dist/automation/docx.d.ts.map +1 -0
- package/dist/automation/index.cjs +36838 -0
- package/dist/automation/index.d.ts +6 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.mjs +36824 -0
- package/dist/automation/node.cjs +103 -0
- package/dist/automation/node.d.ts +16 -0
- package/dist/automation/node.d.ts.map +1 -0
- package/dist/automation/node.mjs +101 -0
- package/dist/automation/visio.d.ts +30 -0
- package/dist/automation/visio.d.ts.map +1 -0
- package/dist/automation/xlsx.d.ts +25 -0
- package/dist/automation/xlsx.d.ts.map +1 -0
- package/dist/crypto/aes-ecb.d.ts +13 -0
- package/dist/crypto/aes-ecb.d.ts.map +1 -0
- package/dist/crypto/decrypt.d.ts +63 -0
- package/dist/crypto/decrypt.d.ts.map +1 -0
- package/dist/crypto/detect.d.ts +56 -0
- package/dist/crypto/detect.d.ts.map +1 -0
- package/dist/crypto/encrypt.d.ts +27 -0
- package/dist/crypto/encrypt.d.ts.map +1 -0
- package/dist/crypto/encryption-info-write.d.ts +46 -0
- package/dist/crypto/encryption-info-write.d.ts.map +1 -0
- package/dist/crypto/encryption-info.d.ts +22 -0
- package/dist/crypto/encryption-info.d.ts.map +1 -0
- package/dist/crypto/errors.d.ts +39 -0
- package/dist/crypto/errors.d.ts.map +1 -0
- package/dist/crypto/index.cjs +1805 -0
- package/dist/crypto/index.d.ts +26 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.mjs +1774 -0
- package/dist/crypto/key-derivation.d.ts +73 -0
- package/dist/crypto/key-derivation.d.ts.map +1 -0
- package/dist/crypto/types.d.ts +104 -0
- package/dist/crypto/types.d.ts.map +1 -0
- package/dist/docx/embedded.cjs +2 -0
- package/dist/docx/embedded.mjs +2 -0
- package/dist/docx/index.cjs +2 -0
- package/dist/docx/index.mjs +2 -0
- package/dist/docx/load/detect.d.ts +14 -2
- package/dist/docx/load/detect.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +8995 -7728
- package/dist/docx/load/index.d.ts +3 -1
- package/dist/docx/load/index.d.ts.map +1 -1
- package/dist/docx/load/index.mjs +8990 -7729
- package/dist/docx/load/legacy-doc.d.ts.map +1 -1
- package/dist/index.cjs +749 -19
- package/dist/index.mjs +749 -19
- package/dist/opc/index.cjs +797 -1
- package/dist/opc/index.d.ts +2 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +784 -3
- package/dist/opc/properties/app.d.ts +10 -0
- package/dist/opc/properties/app.d.ts.map +1 -0
- package/dist/opc/properties/core.d.ts +13 -0
- package/dist/opc/properties/core.d.ts.map +1 -0
- package/dist/opc/properties/custom.d.ts +15 -0
- package/dist/opc/properties/custom.d.ts.map +1 -0
- package/dist/opc/properties/index.d.ts +5 -0
- package/dist/opc/properties/index.d.ts.map +1 -0
- package/dist/opc/properties/types.d.ts +114 -0
- package/dist/opc/properties/types.d.ts.map +1 -0
- package/dist/opc/relationship-types.d.ts +1 -0
- package/dist/opc/relationship-types.d.ts.map +1 -1
- package/dist/opc/safe-href.d.ts +34 -0
- package/dist/opc/safe-href.d.ts.map +1 -1
- package/dist/opc/signature/constants.d.ts +42 -0
- package/dist/opc/signature/constants.d.ts.map +1 -0
- package/dist/opc/signature/detection.d.ts +97 -0
- package/dist/opc/signature/detection.d.ts.map +1 -0
- package/dist/opc/signature/digest.d.ts +16 -0
- package/dist/opc/signature/digest.d.ts.map +1 -0
- package/dist/opc/signature/index.d.ts +8 -0
- package/dist/opc/signature/index.d.ts.map +1 -0
- package/dist/opc/signature/inspection-status.d.ts +24 -0
- package/dist/opc/signature/inspection-status.d.ts.map +1 -0
- package/dist/opc/signature/reference-utils.d.ts +12 -0
- package/dist/opc/signature/reference-utils.d.ts.map +1 -0
- package/dist/opc/signature/types.d.ts +90 -0
- package/dist/opc/signature/types.d.ts.map +1 -0
- package/dist/opc/signature/xml-utils.d.ts +35 -0
- package/dist/opc/signature/xml-utils.d.ts.map +1 -0
- package/dist/pptx/automation/index.cjs +149047 -0
- package/dist/pptx/automation/index.d.ts +1474 -0
- package/dist/pptx/automation/index.d.ts.map +1 -0
- package/dist/pptx/automation/index.mjs +148926 -0
- package/dist/pptx/chunks/{index-CojJtI77.d.ts → index-BWRd8p4y.d.ts} +10 -12
- package/dist/pptx/chunks/index-BWRd8p4y.d.ts.map +1 -0
- package/dist/pptx/chunks/index-LoCVDu8Z.d.ts +9644 -0
- package/dist/pptx/chunks/index-LoCVDu8Z.d.ts.map +1 -0
- package/dist/pptx/chunks/{signature-inspection-status-Bh2oap7B.d.ts → inspection-status-B2E-jSpG.d.ts} +8 -8
- package/dist/pptx/chunks/inspection-status-B2E-jSpG.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-IlJiffp7.d.ts → text-operations-2tKzrY5o.d.ts} +7381 -7381
- package/dist/pptx/chunks/text-operations-2tKzrY5o.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +1409 -895
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +1409 -895
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/index.cjs +1933 -1391
- package/dist/pptx/index.d.ts +5 -9692
- package/dist/pptx/index.mjs +1933 -1391
- package/dist/pptx/signature-node/index.cjs +5 -5
- package/dist/pptx/signature-node/index.d.ts +1 -1
- package/dist/pptx/signature-node/index.mjs +5 -5
- package/dist/visio/edit-geometry-admission.d.ts +1 -1
- package/dist/visio/edit-geometry-admission.d.ts.map +1 -1
- package/dist/visio/edit-geometry.d.ts +1 -1
- package/dist/visio/edit-geometry.d.ts.map +1 -1
- package/dist/visio/edit-master-index.d.ts +10 -0
- package/dist/visio/edit-master-index.d.ts.map +1 -0
- package/dist/visio/edit-master-move.d.ts +12 -0
- package/dist/visio/edit-master-move.d.ts.map +1 -0
- package/dist/visio/edit-master-scope.d.ts +7 -0
- package/dist/visio/edit-master-scope.d.ts.map +1 -0
- package/dist/visio/edit-recalculate-index.d.ts +2 -0
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-scope.d.ts +1 -1
- package/dist/visio/edit-scope.d.ts.map +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/formula-arithmetic.d.ts +8 -0
- package/dist/visio/formula-arithmetic.d.ts.map +1 -0
- package/dist/visio/formula-evaluate.d.ts.map +1 -1
- package/dist/visio/formula-master.d.ts +13 -0
- package/dist/visio/formula-master.d.ts.map +1 -0
- package/dist/visio/formula-numeric-functions.d.ts +8 -0
- package/dist/visio/formula-numeric-functions.d.ts.map +1 -0
- package/dist/visio/formula.d.ts +1 -1
- package/dist/visio/formula.d.ts.map +1 -1
- package/dist/visio/index.cjs +687 -71
- package/dist/visio/index.mjs +687 -71
- package/dist/xlsx/edit/annotations.d.ts +5 -1
- package/dist/xlsx/edit/annotations.d.ts.map +1 -1
- package/dist/xlsx/edit/cell-values.d.ts +7 -2
- package/dist/xlsx/edit/cell-values.d.ts.map +1 -1
- package/dist/xlsx/edit/clipboard.d.ts.map +1 -1
- package/dist/xlsx/edit/doc-properties.d.ts +14 -0
- package/dist/xlsx/edit/doc-properties.d.ts.map +1 -0
- package/dist/xlsx/edit/fill-series.d.ts.map +1 -1
- package/dist/xlsx/edit/find.d.ts +2 -1
- package/dist/xlsx/edit/find.d.ts.map +1 -1
- package/dist/xlsx/edit/format-lines.d.ts +22 -0
- package/dist/xlsx/edit/format-lines.d.ts.map +1 -0
- package/dist/xlsx/edit/format.d.ts +2 -1
- package/dist/xlsx/edit/format.d.ts.map +1 -1
- package/dist/xlsx/edit/history-refs.d.ts +51 -0
- package/dist/xlsx/edit/history-refs.d.ts.map +1 -0
- package/dist/xlsx/edit/history.d.ts +40 -5
- package/dist/xlsx/edit/history.d.ts.map +1 -1
- package/dist/xlsx/edit/index.d.ts +3 -0
- package/dist/xlsx/edit/index.d.ts.map +1 -1
- package/dist/xlsx/edit/input-text.d.ts +13 -0
- package/dist/xlsx/edit/input-text.d.ts.map +1 -0
- package/dist/xlsx/edit/merge.d.ts +10 -2
- package/dist/xlsx/edit/merge.d.ts.map +1 -1
- package/dist/xlsx/edit/session.d.ts.map +1 -1
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-formulas.d.ts +2 -1
- package/dist/xlsx/edit/shift-formulas.d.ts.map +1 -1
- package/dist/xlsx/edit/shift-preserved.d.ts +17 -0
- package/dist/xlsx/edit/shift-preserved.d.ts.map +1 -0
- package/dist/xlsx/edit/shift-sheet.d.ts +2 -2
- package/dist/xlsx/edit/shift-sheet.d.ts.map +1 -1
- package/dist/xlsx/edit/structure.d.ts.map +1 -1
- package/dist/xlsx/edit/types.d.ts +7 -0
- package/dist/xlsx/edit/types.d.ts.map +1 -1
- package/dist/xlsx/edit/validation-list.d.ts +24 -0
- package/dist/xlsx/edit/validation-list.d.ts.map +1 -0
- package/dist/xlsx/edit/validation.d.ts +2 -1
- package/dist/xlsx/edit/validation.d.ts.map +1 -1
- package/dist/xlsx/formula/area-index.d.ts +18 -0
- package/dist/xlsx/formula/area-index.d.ts.map +1 -0
- package/dist/xlsx/formula/array-context.d.ts.map +1 -1
- package/dist/xlsx/formula/ast.d.ts +5 -1
- package/dist/xlsx/formula/ast.d.ts.map +1 -1
- package/dist/xlsx/formula/call.d.ts.map +1 -1
- package/dist/xlsx/formula/coerce.d.ts.map +1 -1
- package/dist/xlsx/formula/context.d.ts +5 -0
- package/dist/xlsx/formula/context.d.ts.map +1 -1
- package/dist/xlsx/formula/date-serial.d.ts +11 -4
- package/dist/xlsx/formula/date-serial.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-core.d.ts +6 -0
- package/dist/xlsx/formula/engine-core.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-host.d.ts +35 -3
- package/dist/xlsx/formula/engine-host.d.ts.map +1 -1
- package/dist/xlsx/formula/engine-util.d.ts.map +1 -1
- package/dist/xlsx/formula/engine.d.ts.map +1 -1
- package/dist/xlsx/formula/evaluator.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/array-shape.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/array.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/criteria-index.d.ts +12 -0
- package/dist/xlsx/formula/functions/criteria-index.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/criteria.d.ts +24 -16
- package/dist/xlsx/formula/functions/criteria.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/date-calc.d.ts +4 -0
- package/dist/xlsx/formula/functions/date-calc.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/depreciation.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/financial.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/helpers.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/logical.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/lookup-core.d.ts +14 -2
- package/dist/xlsx/formula/functions/lookup-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/lookup.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/math-mod.d.ts +8 -0
- package/dist/xlsx/formula/functions/math-mod.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/math-sum.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/math.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/statistical-count.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/statistical.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/stats-core.d.ts +6 -0
- package/dist/xlsx/formula/functions/stats-core.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/text-case.d.ts +14 -0
- package/dist/xlsx/formula/functions/text-case.d.ts.map +1 -0
- package/dist/xlsx/formula/functions/text.d.ts.map +1 -1
- package/dist/xlsx/formula/functions/workdays.d.ts.map +1 -1
- package/dist/xlsx/formula/graph-index.d.ts +15 -0
- package/dist/xlsx/formula/graph-index.d.ts.map +1 -0
- package/dist/xlsx/formula/graph.d.ts +13 -18
- package/dist/xlsx/formula/graph.d.ts.map +1 -1
- package/dist/xlsx/formula/operators.d.ts +9 -0
- package/dist/xlsx/formula/operators.d.ts.map +1 -1
- package/dist/xlsx/formula/parser.d.ts +2 -0
- package/dist/xlsx/formula/parser.d.ts.map +1 -1
- package/dist/xlsx/formula/references.d.ts +4 -1
- package/dist/xlsx/formula/references.d.ts.map +1 -1
- package/dist/xlsx/formula/text-number.d.ts.map +1 -1
- package/dist/xlsx/formula/transform.d.ts.map +1 -1
- package/dist/xlsx/formula/values.d.ts +44 -3
- package/dist/xlsx/formula/values.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +4698 -1322
- package/dist/xlsx/index.mjs +4688 -1323
- package/dist/xlsx/layout/anchors.d.ts +47 -0
- package/dist/xlsx/layout/anchors.d.ts.map +1 -0
- package/dist/xlsx/layout/cf-evaluator.d.ts +1 -2
- package/dist/xlsx/layout/cf-evaluator.d.ts.map +1 -1
- package/dist/xlsx/layout/cf-helpers.d.ts +8 -1
- package/dist/xlsx/layout/cf-helpers.d.ts.map +1 -1
- package/dist/xlsx/layout/index.d.ts +1 -0
- package/dist/xlsx/layout/index.d.ts.map +1 -1
- package/dist/xlsx/load/csv.d.ts +24 -3
- package/dist/xlsx/load/csv.d.ts.map +1 -1
- package/dist/xlsx/load/detect.d.ts +39 -7
- package/dist/xlsx/load/detect.d.ts.map +1 -1
- package/dist/xlsx/load/errors.d.ts +10 -0
- package/dist/xlsx/load/errors.d.ts.map +1 -0
- package/dist/xlsx/load/index.cjs +16220 -12163
- package/dist/xlsx/load/index.d.ts +5 -2
- package/dist/xlsx/load/index.d.ts.map +1 -1
- package/dist/xlsx/load/index.mjs +16213 -12164
- package/dist/xlsx/load/text-decode.d.ts +7 -0
- package/dist/xlsx/load/text-decode.d.ts.map +1 -0
- package/dist/xlsx/model.d.ts +121 -17
- package/dist/xlsx/model.d.ts.map +1 -1
- package/dist/xlsx/numfmt/date.d.ts +7 -0
- package/dist/xlsx/numfmt/date.d.ts.map +1 -1
- package/dist/xlsx/numfmt/format.d.ts.map +1 -1
- package/dist/xlsx/numfmt/fraction.d.ts +5 -1
- package/dist/xlsx/numfmt/fraction.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input-date.d.ts.map +1 -1
- package/dist/xlsx/numfmt/input.d.ts.map +1 -1
- package/dist/xlsx/numfmt/number.d.ts.map +1 -1
- package/dist/xlsx/read/conditional.d.ts.map +1 -1
- package/dist/xlsx/read/drawing.d.ts +2 -2
- package/dist/xlsx/read/drawing.d.ts.map +1 -1
- package/dist/xlsx/read/load.d.ts.map +1 -1
- package/dist/xlsx/read/package.d.ts +18 -2
- package/dist/xlsx/read/package.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/read/sheet-props.d.ts +15 -1
- package/dist/xlsx/read/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/read/smart-art.d.ts +12 -0
- package/dist/xlsx/read/smart-art.d.ts.map +1 -0
- package/dist/xlsx/read/styles.d.ts.map +1 -1
- package/dist/xlsx/read/workbook-part.d.ts +5 -2
- package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/read/worksheet.d.ts.map +1 -1
- package/dist/xlsx/write/attr-merge.d.ts +10 -0
- package/dist/xlsx/write/attr-merge.d.ts.map +1 -0
- package/dist/xlsx/write/carried-refs.d.ts +61 -0
- package/dist/xlsx/write/carried-refs.d.ts.map +1 -0
- package/dist/xlsx/write/comments.d.ts +12 -2
- package/dist/xlsx/write/comments.d.ts.map +1 -1
- package/dist/xlsx/write/conditional.d.ts.map +1 -1
- package/dist/xlsx/write/doc-props.d.ts +30 -0
- package/dist/xlsx/write/doc-props.d.ts.map +1 -0
- package/dist/xlsx/write/drawing.d.ts +5 -0
- package/dist/xlsx/write/drawing.d.ts.map +1 -1
- package/dist/xlsx/write/metadata.d.ts +23 -0
- package/dist/xlsx/write/metadata.d.ts.map +1 -0
- package/dist/xlsx/write/package-writer.d.ts +6 -0
- package/dist/xlsx/write/package-writer.d.ts.map +1 -1
- package/dist/xlsx/write/page-setup.d.ts +8 -0
- package/dist/xlsx/write/page-setup.d.ts.map +1 -0
- package/dist/xlsx/write/save.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-data.d.ts +8 -0
- package/dist/xlsx/write/sheet-data.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-parts.d.ts +6 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/dist/xlsx/write/sheet-props.d.ts +0 -6
- package/dist/xlsx/write/sheet-props.d.ts.map +1 -1
- package/dist/xlsx/write/styles.d.ts.map +1 -1
- package/dist/xlsx/write/table-patch.d.ts +12 -0
- package/dist/xlsx/write/table-patch.d.ts.map +1 -0
- package/dist/xlsx/write/tables.d.ts +9 -0
- package/dist/xlsx/write/tables.d.ts.map +1 -1
- package/dist/xlsx/write/vml-ids.d.ts +29 -0
- package/dist/xlsx/write/vml-ids.d.ts.map +1 -0
- package/dist/xlsx/write/workbook-part.d.ts +1 -4
- package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
- package/dist/xlsx/write/worksheet.d.ts.map +1 -1
- package/dist/xml/index.cjs +4 -0
- package/dist/xml/index.mjs +4 -0
- package/dist/xml/namespaces.d.ts +4 -0
- package/dist/xml/namespaces.d.ts.map +1 -1
- package/package.json +26 -3
- package/dist/pptx/chunks/index-CojJtI77.d.ts.map +0 -1
- package/dist/pptx/chunks/signature-inspection-status-Bh2oap7B.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-IlJiffp7.d.ts.map +0 -1
- package/dist/pptx/index.d.ts.map +0 -1
package/dist/pptx/cli/index.cjs
CHANGED
|
@@ -14133,12 +14133,12 @@ var init_ole2_parser_write_serialize = __esm({
|
|
|
14133
14133
|
});
|
|
14134
14134
|
|
|
14135
14135
|
// node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
14136
|
-
function buildOle2(
|
|
14136
|
+
function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
14137
14137
|
const sectorSize = 512;
|
|
14138
14138
|
const miniSectorSize = 64;
|
|
14139
14139
|
const regularStreams = [];
|
|
14140
14140
|
const miniStreams = [];
|
|
14141
|
-
for (const [name, data] of
|
|
14141
|
+
for (const [name, data] of streams2) {
|
|
14142
14142
|
if (data.length < miniStreamCutoff) {
|
|
14143
14143
|
miniStreams.push({ name, data });
|
|
14144
14144
|
} else {
|
|
@@ -14362,32 +14362,32 @@ function replaceOleEmbedding(originalBytes, newPayloadBytes, options = {}) {
|
|
|
14362
14362
|
const existing = ole.getStream(nativeStreamName);
|
|
14363
14363
|
const decoded = decodeOle10Native(existing);
|
|
14364
14364
|
const fileName = options.fileName ?? decoded?.fileName ?? "file.bin";
|
|
14365
|
-
const
|
|
14365
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
14366
14366
|
for (const entry of ole.entries) {
|
|
14367
14367
|
if (entry.name === "Root Entry" || entry.name === nativeStreamName) {
|
|
14368
14368
|
continue;
|
|
14369
14369
|
}
|
|
14370
14370
|
const data = ole.getStream(entry.name);
|
|
14371
14371
|
if (data) {
|
|
14372
|
-
|
|
14372
|
+
streams2.set(entry.name, data);
|
|
14373
14373
|
}
|
|
14374
14374
|
}
|
|
14375
|
-
|
|
14376
|
-
return new Uint8Array(buildOle2(
|
|
14375
|
+
streams2.set(nativeStreamName, encodeOle10Native(fileName, newPayloadBytes));
|
|
14376
|
+
return new Uint8Array(buildOle2(streams2));
|
|
14377
14377
|
}
|
|
14378
14378
|
if (ole.getStream(CONTENTS_STREAM2)) {
|
|
14379
|
-
const
|
|
14379
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
14380
14380
|
for (const entry of ole.entries) {
|
|
14381
14381
|
if (entry.name === "Root Entry" || entry.name === CONTENTS_STREAM2) {
|
|
14382
14382
|
continue;
|
|
14383
14383
|
}
|
|
14384
14384
|
const data = ole.getStream(entry.name);
|
|
14385
14385
|
if (data) {
|
|
14386
|
-
|
|
14386
|
+
streams2.set(entry.name, data);
|
|
14387
14387
|
}
|
|
14388
14388
|
}
|
|
14389
|
-
|
|
14390
|
-
return new Uint8Array(buildOle2(
|
|
14389
|
+
streams2.set(CONTENTS_STREAM2, newPayloadBytes);
|
|
14390
|
+
return new Uint8Array(buildOle2(streams2));
|
|
14391
14391
|
}
|
|
14392
14392
|
return newPayloadBytes;
|
|
14393
14393
|
} catch {
|
|
@@ -27172,16 +27172,16 @@ var init_smartart_layout_interpreter_composite_slots = __esm({
|
|
|
27172
27172
|
|
|
27173
27173
|
// src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts
|
|
27174
27174
|
function resolveIterationRect(dims, box, iteration, iterationCount) {
|
|
27175
|
-
const
|
|
27175
|
+
const container2 = resolveSlot(dims, box, 1, 1);
|
|
27176
27176
|
if (iterationCount <= 1) {
|
|
27177
|
-
return
|
|
27177
|
+
return container2;
|
|
27178
27178
|
}
|
|
27179
|
-
if (
|
|
27180
|
-
const width =
|
|
27181
|
-
return { x:
|
|
27179
|
+
if (container2.width >= container2.height) {
|
|
27180
|
+
const width = container2.width / iterationCount;
|
|
27181
|
+
return { x: container2.x + width * iteration, y: container2.y, width, height: container2.height };
|
|
27182
27182
|
}
|
|
27183
|
-
const height =
|
|
27184
|
-
return { x:
|
|
27183
|
+
const height = container2.height / iterationCount;
|
|
27184
|
+
return { x: container2.x, y: container2.y + height * iteration, width: container2.width, height };
|
|
27185
27185
|
}
|
|
27186
27186
|
var init_smartart_layout_interpreter_composite_iteration = __esm({
|
|
27187
27187
|
"src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts"() {
|
|
@@ -32121,9 +32121,9 @@ function findVarsContainer(node) {
|
|
|
32121
32121
|
continue;
|
|
32122
32122
|
}
|
|
32123
32123
|
if (CONTAINER_LOCAL_NAMES.has(localNameOf3(key2))) {
|
|
32124
|
-
const
|
|
32125
|
-
if (
|
|
32126
|
-
return
|
|
32124
|
+
const container2 = Array.isArray(value) ? value[0] : value;
|
|
32125
|
+
if (container2 && typeof container2 === "object") {
|
|
32126
|
+
return container2;
|
|
32127
32127
|
}
|
|
32128
32128
|
}
|
|
32129
32129
|
const nested = findVarsContainer(value);
|
|
@@ -32180,8 +32180,8 @@ function findNamedPresVars(node, presName) {
|
|
|
32180
32180
|
}
|
|
32181
32181
|
return void 0;
|
|
32182
32182
|
}
|
|
32183
|
-
function varValue(
|
|
32184
|
-
for (const [key2, value] of Object.entries(
|
|
32183
|
+
function varValue(container2, name) {
|
|
32184
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
32185
32185
|
if (key2.startsWith("@_") || localNameOf3(key2) !== name) {
|
|
32186
32186
|
continue;
|
|
32187
32187
|
}
|
|
@@ -32194,27 +32194,27 @@ function varValue(container, name) {
|
|
|
32194
32194
|
}
|
|
32195
32195
|
return void 0;
|
|
32196
32196
|
}
|
|
32197
|
-
function boolValue(
|
|
32198
|
-
const raw = varValue(
|
|
32197
|
+
function boolValue(container2, name) {
|
|
32198
|
+
const raw = varValue(container2, name);
|
|
32199
32199
|
if (raw === void 0) {
|
|
32200
32200
|
return void 0;
|
|
32201
32201
|
}
|
|
32202
32202
|
const lower = raw.toLowerCase();
|
|
32203
32203
|
return lower === "1" || lower === "true" || lower === "on";
|
|
32204
32204
|
}
|
|
32205
|
-
function intValue(
|
|
32206
|
-
const raw = varValue(
|
|
32205
|
+
function intValue(container2, name) {
|
|
32206
|
+
const raw = varValue(container2, name);
|
|
32207
32207
|
if (raw === void 0) {
|
|
32208
32208
|
return void 0;
|
|
32209
32209
|
}
|
|
32210
32210
|
const parsed = Number.parseInt(raw, 10);
|
|
32211
32211
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
32212
32212
|
}
|
|
32213
|
-
function parseSmartArtPresLayoutVars(
|
|
32214
|
-
if (!
|
|
32213
|
+
function parseSmartArtPresLayoutVars(container2) {
|
|
32214
|
+
if (!container2) {
|
|
32215
32215
|
return void 0;
|
|
32216
32216
|
}
|
|
32217
|
-
const vars = findVarsContainer(
|
|
32217
|
+
const vars = findVarsContainer(container2);
|
|
32218
32218
|
if (!vars) {
|
|
32219
32219
|
return void 0;
|
|
32220
32220
|
}
|
|
@@ -32255,7 +32255,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
32255
32255
|
if (resizeHandles !== void 0) {
|
|
32256
32256
|
result.resizeHandles = resizeHandles;
|
|
32257
32257
|
}
|
|
32258
|
-
const hierRootVars = findNamedPresVars(
|
|
32258
|
+
const hierRootVars = findNamedPresVars(container2, "hierRoot1");
|
|
32259
32259
|
if (hierRootVars) {
|
|
32260
32260
|
const rootHierBranch = varValue(hierRootVars, "hierBranch");
|
|
32261
32261
|
if (rootHierBranch && HIER_BRANCHES.has(rootHierBranch)) {
|
|
@@ -32264,7 +32264,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
32264
32264
|
result.hierarchyBranch = "init";
|
|
32265
32265
|
}
|
|
32266
32266
|
}
|
|
32267
|
-
const rootTextVars = findNamedPresVars(
|
|
32267
|
+
const rootTextVars = findNamedPresVars(container2, "rootText1");
|
|
32268
32268
|
if (rootTextVars) {
|
|
32269
32269
|
const rootChMax = intValue(rootTextVars, "chMax");
|
|
32270
32270
|
if (rootChMax !== void 0) {
|
|
@@ -32550,6 +32550,7 @@ var init_relationship_types = __esm({
|
|
|
32550
32550
|
diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing",
|
|
32551
32551
|
coreProperties: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
|
|
32552
32552
|
extendedProperties: `${BASE}/extended-properties`,
|
|
32553
|
+
customProperties: `${BASE}/custom-properties`,
|
|
32553
32554
|
customXml: `${BASE}/customXml`,
|
|
32554
32555
|
worksheet: `${BASE}/worksheet`,
|
|
32555
32556
|
chartsheet: `${BASE}/chartsheet`,
|
|
@@ -32589,8 +32590,60 @@ var init_package = __esm({
|
|
|
32589
32590
|
});
|
|
32590
32591
|
|
|
32591
32592
|
// src/opc/safe-href.ts
|
|
32593
|
+
var OPEN_SCHEMES;
|
|
32592
32594
|
var init_safe_href = __esm({
|
|
32593
32595
|
"src/opc/safe-href.ts"() {
|
|
32596
|
+
OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
32597
|
+
/* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
32598
|
+
}
|
|
32599
|
+
});
|
|
32600
|
+
|
|
32601
|
+
// src/opc/properties/types.ts
|
|
32602
|
+
var init_types3 = __esm({
|
|
32603
|
+
"src/opc/properties/types.ts"() {
|
|
32604
|
+
}
|
|
32605
|
+
});
|
|
32606
|
+
|
|
32607
|
+
// src/opc/properties/index.ts
|
|
32608
|
+
var init_properties = __esm({
|
|
32609
|
+
"src/opc/properties/index.ts"() {
|
|
32610
|
+
init_types3();
|
|
32611
|
+
}
|
|
32612
|
+
});
|
|
32613
|
+
|
|
32614
|
+
// src/opc/signature/detection.ts
|
|
32615
|
+
function detectDigitalSignatures(zipEntryPaths) {
|
|
32616
|
+
const sigPaths = zipEntryPaths.filter(
|
|
32617
|
+
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
32618
|
+
);
|
|
32619
|
+
return {
|
|
32620
|
+
hasSignatures: sigPaths.length > 0,
|
|
32621
|
+
signatureCount: sigPaths.length,
|
|
32622
|
+
signaturePaths: sigPaths
|
|
32623
|
+
};
|
|
32624
|
+
}
|
|
32625
|
+
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
32626
|
+
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
32627
|
+
}
|
|
32628
|
+
var SIGNATURE_PART_PREFIX, SIGNATURE_PREFIX;
|
|
32629
|
+
var init_detection = __esm({
|
|
32630
|
+
"src/opc/signature/detection.ts"() {
|
|
32631
|
+
SIGNATURE_PART_PREFIX = "_xmlsignatures/";
|
|
32632
|
+
SIGNATURE_PREFIX = SIGNATURE_PART_PREFIX;
|
|
32633
|
+
}
|
|
32634
|
+
});
|
|
32635
|
+
|
|
32636
|
+
// src/opc/signature/constants.ts
|
|
32637
|
+
var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE;
|
|
32638
|
+
var init_constants3 = __esm({
|
|
32639
|
+
"src/opc/signature/constants.ts"() {
|
|
32640
|
+
DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
|
|
32641
|
+
}
|
|
32642
|
+
});
|
|
32643
|
+
|
|
32644
|
+
// src/opc/signature/index.ts
|
|
32645
|
+
var init_signature = __esm({
|
|
32646
|
+
"src/opc/signature/index.ts"() {
|
|
32594
32647
|
}
|
|
32595
32648
|
});
|
|
32596
32649
|
|
|
@@ -32602,6 +32655,8 @@ var init_opc = __esm({
|
|
|
32602
32655
|
init_content_types();
|
|
32603
32656
|
init_package();
|
|
32604
32657
|
init_safe_href();
|
|
32658
|
+
init_properties();
|
|
32659
|
+
init_signature();
|
|
32605
32660
|
}
|
|
32606
32661
|
});
|
|
32607
32662
|
|
|
@@ -33234,25 +33289,43 @@ var init_theme_override_utils = __esm({
|
|
|
33234
33289
|
}
|
|
33235
33290
|
});
|
|
33236
33291
|
|
|
33237
|
-
// src/
|
|
33238
|
-
function
|
|
33239
|
-
if (
|
|
33240
|
-
return
|
|
33292
|
+
// src/crypto/detect.ts
|
|
33293
|
+
function toArrayBuffer(bytes) {
|
|
33294
|
+
if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
|
|
33295
|
+
return bytes.buffer;
|
|
33241
33296
|
}
|
|
33242
|
-
|
|
33243
|
-
|
|
33244
|
-
|
|
33245
|
-
|
|
33246
|
-
|
|
33247
|
-
|
|
33297
|
+
return bytes.slice().buffer;
|
|
33298
|
+
}
|
|
33299
|
+
function isCompoundFile(input) {
|
|
33300
|
+
const bytes = toBytes(input);
|
|
33301
|
+
return bytes.length >= 8 && OLE_MAGIC2.every((value, index) => bytes[index] === value);
|
|
33302
|
+
}
|
|
33303
|
+
function openEncryptedPackage(input) {
|
|
33304
|
+
const bytes = toBytes(input);
|
|
33305
|
+
if (!isCompoundFile(bytes)) return void 0;
|
|
33306
|
+
try {
|
|
33307
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
33308
|
+
if (!file.entries.some((entry) => entry.name === "EncryptedPackage")) return void 0;
|
|
33309
|
+
const encryptionInfo = file.getStream("EncryptionInfo");
|
|
33310
|
+
const encryptedPackage = encryptionInfo && file.getStream("EncryptedPackage");
|
|
33311
|
+
return encryptionInfo && encryptedPackage ? { encryptionInfo, encryptedPackage } : void 0;
|
|
33312
|
+
} catch {
|
|
33313
|
+
return void 0;
|
|
33248
33314
|
}
|
|
33315
|
+
}
|
|
33316
|
+
function detectFileFormat(data) {
|
|
33317
|
+
const bytes = toBytes(data);
|
|
33318
|
+
if (bytes.length < 8) return { format: "unknown", encrypted: false };
|
|
33319
|
+
if (isCompoundFile(bytes)) return { format: "ole", encrypted: true };
|
|
33320
|
+
if (bytes[0] === 80 && bytes[1] === 75) return { format: "zip", encrypted: false };
|
|
33249
33321
|
return { format: "unknown", encrypted: false };
|
|
33250
33322
|
}
|
|
33251
|
-
var OLE_MAGIC2,
|
|
33252
|
-
var
|
|
33253
|
-
"src/
|
|
33254
|
-
|
|
33255
|
-
|
|
33323
|
+
var OLE_MAGIC2, toBytes, EncryptedFileError;
|
|
33324
|
+
var init_detect = __esm({
|
|
33325
|
+
"src/crypto/detect.ts"() {
|
|
33326
|
+
init_ole2_parser_read();
|
|
33327
|
+
OLE_MAGIC2 = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
33328
|
+
toBytes = (input) => input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
33256
33329
|
EncryptedFileError = class extends Error {
|
|
33257
33330
|
isEncrypted = true;
|
|
33258
33331
|
constructor(message) {
|
|
@@ -33263,31 +33336,10 @@ var init_encryption_detection = __esm({
|
|
|
33263
33336
|
}
|
|
33264
33337
|
});
|
|
33265
33338
|
|
|
33266
|
-
// src/pptx/core/utils/
|
|
33267
|
-
var
|
|
33268
|
-
"src/pptx/core/utils/
|
|
33269
|
-
|
|
33270
|
-
init_ole2_parser_read2();
|
|
33271
|
-
init_ole2_parser_write2();
|
|
33272
|
-
}
|
|
33273
|
-
});
|
|
33274
|
-
|
|
33275
|
-
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
33276
|
-
var IncorrectPasswordError, DataIntegrityError;
|
|
33277
|
-
var init_ooxml_crypto_errors = __esm({
|
|
33278
|
-
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
33279
|
-
IncorrectPasswordError = class extends Error {
|
|
33280
|
-
constructor(message = "The password is incorrect.") {
|
|
33281
|
-
super(message);
|
|
33282
|
-
this.name = "IncorrectPasswordError";
|
|
33283
|
-
}
|
|
33284
|
-
};
|
|
33285
|
-
DataIntegrityError = class extends Error {
|
|
33286
|
-
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
33287
|
-
super(message);
|
|
33288
|
-
this.name = "DataIntegrityError";
|
|
33289
|
-
}
|
|
33290
|
-
};
|
|
33339
|
+
// src/pptx/core/utils/encryption-detection.ts
|
|
33340
|
+
var init_encryption_detection = __esm({
|
|
33341
|
+
"src/pptx/core/utils/encryption-detection.ts"() {
|
|
33342
|
+
init_detect();
|
|
33291
33343
|
}
|
|
33292
33344
|
});
|
|
33293
33345
|
|
|
@@ -33413,71 +33465,644 @@ var init_ooxml_crypto_primitives = __esm({
|
|
|
33413
33465
|
}
|
|
33414
33466
|
});
|
|
33415
33467
|
|
|
33416
|
-
// src/
|
|
33417
|
-
|
|
33418
|
-
|
|
33468
|
+
// src/crypto/aes-ecb.ts
|
|
33469
|
+
async function aesEcbDecrypt(key2, data) {
|
|
33470
|
+
const plain = await aesCbcDecryptRaw(key2, new Uint8Array(BLOCK), data);
|
|
33471
|
+
for (let at2 = BLOCK; at2 < plain.length && at2 < data.length; at2++) {
|
|
33472
|
+
plain[at2] = plain[at2] ^ data[at2 - BLOCK];
|
|
33473
|
+
}
|
|
33474
|
+
return plain;
|
|
33475
|
+
}
|
|
33476
|
+
async function aesEcbEncrypt(key2, data) {
|
|
33477
|
+
const padded = new Uint8Array(Math.ceil(data.length / BLOCK) * BLOCK);
|
|
33478
|
+
padded.set(data);
|
|
33479
|
+
const subtle = getSubtle();
|
|
33480
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, [
|
|
33481
|
+
"encrypt"
|
|
33482
|
+
]);
|
|
33483
|
+
const iv = new Uint8Array(BLOCK);
|
|
33484
|
+
const out = new Uint8Array(padded.length);
|
|
33485
|
+
for (let start = 0; start < padded.length; start += BLOCK * BATCH) {
|
|
33486
|
+
const end = Math.min(padded.length, start + BLOCK * BATCH);
|
|
33487
|
+
const jobs = [];
|
|
33488
|
+
for (let at2 = start; at2 < end; at2 += BLOCK) {
|
|
33489
|
+
const block = padded.slice(at2, at2 + BLOCK);
|
|
33490
|
+
jobs.push(
|
|
33491
|
+
subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, block).then((result) => {
|
|
33492
|
+
out.set(new Uint8Array(result, 0, BLOCK), at2);
|
|
33493
|
+
})
|
|
33494
|
+
);
|
|
33495
|
+
}
|
|
33496
|
+
await Promise.all(jobs);
|
|
33497
|
+
}
|
|
33498
|
+
return out;
|
|
33499
|
+
}
|
|
33500
|
+
var BLOCK, BATCH;
|
|
33501
|
+
var init_aes_ecb = __esm({
|
|
33502
|
+
"src/crypto/aes-ecb.ts"() {
|
|
33419
33503
|
init_ooxml_crypto_primitives();
|
|
33504
|
+
BLOCK = 16;
|
|
33505
|
+
BATCH = 4096;
|
|
33420
33506
|
}
|
|
33421
33507
|
});
|
|
33422
33508
|
|
|
33423
|
-
// src/
|
|
33424
|
-
|
|
33509
|
+
// src/crypto/errors.ts
|
|
33510
|
+
var IncorrectPasswordError, DataIntegrityError;
|
|
33511
|
+
var init_errors = __esm({
|
|
33512
|
+
"src/crypto/errors.ts"() {
|
|
33513
|
+
IncorrectPasswordError = class extends Error {
|
|
33514
|
+
code = "incorrect-password";
|
|
33515
|
+
constructor(message = "The password is incorrect.") {
|
|
33516
|
+
super(message);
|
|
33517
|
+
this.name = "IncorrectPasswordError";
|
|
33518
|
+
}
|
|
33519
|
+
};
|
|
33520
|
+
DataIntegrityError = class extends Error {
|
|
33521
|
+
code = "data-integrity";
|
|
33522
|
+
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
33523
|
+
super(message);
|
|
33524
|
+
this.name = "DataIntegrityError";
|
|
33525
|
+
}
|
|
33526
|
+
};
|
|
33527
|
+
}
|
|
33528
|
+
});
|
|
33529
|
+
|
|
33530
|
+
// src/digest/algorithm-names.ts
|
|
33531
|
+
function normalizeDigestAlgorithmName(name) {
|
|
33532
|
+
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
33533
|
+
return Object.hasOwn(CANONICAL_BY_LOOKUP_KEY, key2) ? CANONICAL_BY_LOOKUP_KEY[key2] : void 0;
|
|
33534
|
+
}
|
|
33535
|
+
var CANONICAL_BY_LOOKUP_KEY;
|
|
33536
|
+
var init_algorithm_names = __esm({
|
|
33537
|
+
"src/digest/algorithm-names.ts"() {
|
|
33538
|
+
CANONICAL_BY_LOOKUP_KEY = {
|
|
33539
|
+
SHA1: "SHA-1",
|
|
33540
|
+
SHA256: "SHA-256",
|
|
33541
|
+
SHA384: "SHA-384",
|
|
33542
|
+
SHA512: "SHA-512",
|
|
33543
|
+
MD2: "MD2",
|
|
33544
|
+
MD4: "MD4",
|
|
33545
|
+
MD5: "MD5",
|
|
33546
|
+
RIPEMD128: "RIPEMD-128",
|
|
33547
|
+
RIPEMD160: "RIPEMD-160",
|
|
33548
|
+
WHIRLPOOL: "WHIRLPOOL"
|
|
33549
|
+
};
|
|
33550
|
+
}
|
|
33551
|
+
});
|
|
33552
|
+
|
|
33553
|
+
// src/digest/sha256.ts
|
|
33554
|
+
function compress(h, view, offset) {
|
|
33555
|
+
for (let i = 0; i < 16; i++) W[i] = view.getUint32(offset + i * 4);
|
|
33556
|
+
for (let i = 16; i < 64; i++) {
|
|
33557
|
+
const a2 = W[i - 15];
|
|
33558
|
+
const b2 = W[i - 2];
|
|
33559
|
+
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
33560
|
+
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
33561
|
+
W[i] = W[i - 16] + s0 + W[i - 7] + s1 >>> 0;
|
|
33562
|
+
}
|
|
33563
|
+
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], k = h[7];
|
|
33564
|
+
for (let i = 0; i < 64; i++) {
|
|
33565
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
33566
|
+
const ch = e & f ^ ~e & g;
|
|
33567
|
+
const t1 = k + S1 + ch + K[i] + W[i] >>> 0;
|
|
33568
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
33569
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
33570
|
+
const t2 = S0 + maj >>> 0;
|
|
33571
|
+
k = g;
|
|
33572
|
+
g = f;
|
|
33573
|
+
f = e;
|
|
33574
|
+
e = d + t1 >>> 0;
|
|
33575
|
+
d = c;
|
|
33576
|
+
c = b;
|
|
33577
|
+
b = a;
|
|
33578
|
+
a = t1 + t2 >>> 0;
|
|
33579
|
+
}
|
|
33580
|
+
h[0] = h[0] + a >>> 0;
|
|
33581
|
+
h[1] = h[1] + b >>> 0;
|
|
33582
|
+
h[2] = h[2] + c >>> 0;
|
|
33583
|
+
h[3] = h[3] + d >>> 0;
|
|
33584
|
+
h[4] = h[4] + e >>> 0;
|
|
33585
|
+
h[5] = h[5] + f >>> 0;
|
|
33586
|
+
h[6] = h[6] + g >>> 0;
|
|
33587
|
+
h[7] = h[7] + k >>> 0;
|
|
33588
|
+
}
|
|
33589
|
+
function pad64(data) {
|
|
33590
|
+
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
33591
|
+
padded.set(data);
|
|
33592
|
+
padded[data.length] = 128;
|
|
33593
|
+
const bits = data.length * 8;
|
|
33594
|
+
const view = new DataView(padded.buffer);
|
|
33595
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
33596
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
33597
|
+
return view;
|
|
33598
|
+
}
|
|
33599
|
+
function wordsOut(h) {
|
|
33600
|
+
const out = new Uint8Array(h.length * 4);
|
|
33601
|
+
const view = new DataView(out.buffer);
|
|
33602
|
+
for (let i = 0; i < h.length; i++) view.setUint32(i * 4, h[i]);
|
|
33603
|
+
return out;
|
|
33604
|
+
}
|
|
33605
|
+
function sha256(data) {
|
|
33606
|
+
const h = new Uint32Array(IV);
|
|
33607
|
+
const view = pad64(data);
|
|
33608
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h, view, offset);
|
|
33609
|
+
return wordsOut(h);
|
|
33610
|
+
}
|
|
33611
|
+
var K, IV, W, rotr;
|
|
33612
|
+
var init_sha256 = __esm({
|
|
33613
|
+
"src/digest/sha256.ts"() {
|
|
33614
|
+
K = new Uint32Array([
|
|
33615
|
+
1116352408,
|
|
33616
|
+
1899447441,
|
|
33617
|
+
3049323471,
|
|
33618
|
+
3921009573,
|
|
33619
|
+
961987163,
|
|
33620
|
+
1508970993,
|
|
33621
|
+
2453635748,
|
|
33622
|
+
2870763221,
|
|
33623
|
+
3624381080,
|
|
33624
|
+
310598401,
|
|
33625
|
+
607225278,
|
|
33626
|
+
1426881987,
|
|
33627
|
+
1925078388,
|
|
33628
|
+
2162078206,
|
|
33629
|
+
2614888103,
|
|
33630
|
+
3248222580,
|
|
33631
|
+
3835390401,
|
|
33632
|
+
4022224774,
|
|
33633
|
+
264347078,
|
|
33634
|
+
604807628,
|
|
33635
|
+
770255983,
|
|
33636
|
+
1249150122,
|
|
33637
|
+
1555081692,
|
|
33638
|
+
1996064986,
|
|
33639
|
+
2554220882,
|
|
33640
|
+
2821834349,
|
|
33641
|
+
2952996808,
|
|
33642
|
+
3210313671,
|
|
33643
|
+
3336571891,
|
|
33644
|
+
3584528711,
|
|
33645
|
+
113926993,
|
|
33646
|
+
338241895,
|
|
33647
|
+
666307205,
|
|
33648
|
+
773529912,
|
|
33649
|
+
1294757372,
|
|
33650
|
+
1396182291,
|
|
33651
|
+
1695183700,
|
|
33652
|
+
1986661051,
|
|
33653
|
+
2177026350,
|
|
33654
|
+
2456956037,
|
|
33655
|
+
2730485921,
|
|
33656
|
+
2820302411,
|
|
33657
|
+
3259730800,
|
|
33658
|
+
3345764771,
|
|
33659
|
+
3516065817,
|
|
33660
|
+
3600352804,
|
|
33661
|
+
4094571909,
|
|
33662
|
+
275423344,
|
|
33663
|
+
430227734,
|
|
33664
|
+
506948616,
|
|
33665
|
+
659060556,
|
|
33666
|
+
883997877,
|
|
33667
|
+
958139571,
|
|
33668
|
+
1322822218,
|
|
33669
|
+
1537002063,
|
|
33670
|
+
1747873779,
|
|
33671
|
+
1955562222,
|
|
33672
|
+
2024104815,
|
|
33673
|
+
2227730452,
|
|
33674
|
+
2361852424,
|
|
33675
|
+
2428436474,
|
|
33676
|
+
2756734187,
|
|
33677
|
+
3204031479,
|
|
33678
|
+
3329325298
|
|
33679
|
+
]);
|
|
33680
|
+
IV = [
|
|
33681
|
+
1779033703,
|
|
33682
|
+
3144134277,
|
|
33683
|
+
1013904242,
|
|
33684
|
+
2773480762,
|
|
33685
|
+
1359893119,
|
|
33686
|
+
2600822924,
|
|
33687
|
+
528734635,
|
|
33688
|
+
1541459225
|
|
33689
|
+
];
|
|
33690
|
+
W = new Uint32Array(64);
|
|
33691
|
+
rotr = (x, n) => x >>> n | x << 32 - n;
|
|
33692
|
+
}
|
|
33693
|
+
});
|
|
33694
|
+
|
|
33695
|
+
// src/digest/sha1.ts
|
|
33696
|
+
function compress2(h, view, offset) {
|
|
33697
|
+
for (let i = 0; i < 16; i++) W2[i] = view.getUint32(offset + i * 4);
|
|
33698
|
+
for (let i = 16; i < 80; i++) W2[i] = rotl(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16], 1);
|
|
33699
|
+
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4];
|
|
33700
|
+
for (let i = 0; i < 80; i++) {
|
|
33701
|
+
let f;
|
|
33702
|
+
let k;
|
|
33703
|
+
if (i < 20) {
|
|
33704
|
+
f = b & c | ~b & d;
|
|
33705
|
+
k = 1518500249;
|
|
33706
|
+
} else if (i < 40) {
|
|
33707
|
+
f = b ^ c ^ d;
|
|
33708
|
+
k = 1859775393;
|
|
33709
|
+
} else if (i < 60) {
|
|
33710
|
+
f = b & c | b & d | c & d;
|
|
33711
|
+
k = 2400959708;
|
|
33712
|
+
} else {
|
|
33713
|
+
f = b ^ c ^ d;
|
|
33714
|
+
k = 3395469782;
|
|
33715
|
+
}
|
|
33716
|
+
const t = rotl(a, 5) + f + e + k + W2[i] >>> 0;
|
|
33717
|
+
e = d;
|
|
33718
|
+
d = c;
|
|
33719
|
+
c = rotl(b, 30) >>> 0;
|
|
33720
|
+
b = a;
|
|
33721
|
+
a = t;
|
|
33722
|
+
}
|
|
33723
|
+
h[0] = h[0] + a >>> 0;
|
|
33724
|
+
h[1] = h[1] + b >>> 0;
|
|
33725
|
+
h[2] = h[2] + c >>> 0;
|
|
33726
|
+
h[3] = h[3] + d >>> 0;
|
|
33727
|
+
h[4] = h[4] + e >>> 0;
|
|
33728
|
+
}
|
|
33729
|
+
function sha1(data) {
|
|
33730
|
+
const h = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
33731
|
+
const view = pad64(data);
|
|
33732
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h, view, offset);
|
|
33733
|
+
return wordsOut(h);
|
|
33734
|
+
}
|
|
33735
|
+
var W2, rotl;
|
|
33736
|
+
var init_sha1 = __esm({
|
|
33737
|
+
"src/digest/sha1.ts"() {
|
|
33738
|
+
init_sha256();
|
|
33739
|
+
W2 = new Uint32Array(80);
|
|
33740
|
+
rotl = (x, n) => x << n | x >>> 32 - n;
|
|
33741
|
+
}
|
|
33742
|
+
});
|
|
33743
|
+
|
|
33744
|
+
// src/digest/sha512.ts
|
|
33745
|
+
function compress3(h, data, offset) {
|
|
33746
|
+
for (let i = 0; i < 32; i++) {
|
|
33747
|
+
const o = offset + i * 4;
|
|
33748
|
+
W3[i] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
33749
|
+
}
|
|
33750
|
+
for (let i = 16; i < 80; i++) {
|
|
33751
|
+
const xh = W3[(i - 15) * 2];
|
|
33752
|
+
const xl = W3[(i - 15) * 2 + 1];
|
|
33753
|
+
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
33754
|
+
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
33755
|
+
const yh = W3[(i - 2) * 2];
|
|
33756
|
+
const yl = W3[(i - 2) * 2 + 1];
|
|
33757
|
+
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
33758
|
+
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
33759
|
+
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i - 7) * 2 + 1] + W3[(i - 16) * 2 + 1];
|
|
33760
|
+
const hi = s0h + s1h + W3[(i - 7) * 2] + W3[(i - 16) * 2] + Math.floor(lo / 4294967296);
|
|
33761
|
+
lo >>>= 0;
|
|
33762
|
+
W3[i * 2] = hi >>> 0;
|
|
33763
|
+
W3[i * 2 + 1] = lo;
|
|
33764
|
+
}
|
|
33765
|
+
let ah = h[0], al = h[1], bh = h[2], bl = h[3], ch = h[4], cl = h[5], dh = h[6], dl = h[7];
|
|
33766
|
+
let eh = h[8], el = h[9], fh = h[10], fl = h[11], gh = h[12], gl = h[13], hh = h[14], hl = h[15];
|
|
33767
|
+
for (let i = 0; i < 80; i++) {
|
|
33768
|
+
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
33769
|
+
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
33770
|
+
const chh = eh & fh ^ ~eh & gh;
|
|
33771
|
+
const chl = el & fl ^ ~el & gl;
|
|
33772
|
+
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i * 2 + 1] + W3[i * 2 + 1];
|
|
33773
|
+
const t1h = hh + S1h + chh + K2[i * 2] + W3[i * 2] + Math.floor(t1l / 4294967296);
|
|
33774
|
+
t1l >>>= 0;
|
|
33775
|
+
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
33776
|
+
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
33777
|
+
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
33778
|
+
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
33779
|
+
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
33780
|
+
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
33781
|
+
t2l >>>= 0;
|
|
33782
|
+
hh = gh;
|
|
33783
|
+
hl = gl;
|
|
33784
|
+
gh = fh;
|
|
33785
|
+
gl = fl;
|
|
33786
|
+
fh = eh;
|
|
33787
|
+
fl = el;
|
|
33788
|
+
let nl = (dl >>> 0) + t1l;
|
|
33789
|
+
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
33790
|
+
el = nl >>> 0;
|
|
33791
|
+
dh = ch;
|
|
33792
|
+
dl = cl;
|
|
33793
|
+
ch = bh;
|
|
33794
|
+
cl = bl;
|
|
33795
|
+
bh = ah;
|
|
33796
|
+
bl = al;
|
|
33797
|
+
nl = t1l + t2l;
|
|
33798
|
+
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
33799
|
+
al = nl >>> 0;
|
|
33800
|
+
}
|
|
33801
|
+
const add = (i, xh, xl) => {
|
|
33802
|
+
const lo = (h[i + 1] >>> 0) + (xl >>> 0);
|
|
33803
|
+
h[i] = h[i] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
33804
|
+
h[i + 1] = lo >>> 0;
|
|
33805
|
+
};
|
|
33806
|
+
add(0, ah, al);
|
|
33807
|
+
add(2, bh, bl);
|
|
33808
|
+
add(4, ch, cl);
|
|
33809
|
+
add(6, dh, dl);
|
|
33810
|
+
add(8, eh, el);
|
|
33811
|
+
add(10, fh, fl);
|
|
33812
|
+
add(12, gh, gl);
|
|
33813
|
+
add(14, hh, hl);
|
|
33814
|
+
}
|
|
33815
|
+
function digest64(data, iv, bytes) {
|
|
33816
|
+
const h = new Uint32Array(iv);
|
|
33817
|
+
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
33818
|
+
padded.set(data);
|
|
33819
|
+
padded[data.length] = 128;
|
|
33820
|
+
const bits = data.length * 8;
|
|
33821
|
+
const view = new DataView(padded.buffer);
|
|
33822
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
33823
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
33824
|
+
for (let offset = 0; offset < padded.length; offset += 128) compress3(h, padded, offset);
|
|
33825
|
+
const out = new Uint8Array(bytes);
|
|
33826
|
+
const outView = new DataView(out.buffer);
|
|
33827
|
+
for (let i = 0; i < bytes / 4; i++) outView.setUint32(i * 4, h[i]);
|
|
33828
|
+
return out;
|
|
33829
|
+
}
|
|
33830
|
+
var K2, IV_512, IV_384, W3, sha512, sha384;
|
|
33831
|
+
var init_sha512 = __esm({
|
|
33832
|
+
"src/digest/sha512.ts"() {
|
|
33833
|
+
K2 = new Uint32Array([
|
|
33834
|
+
1116352408,
|
|
33835
|
+
3609767458,
|
|
33836
|
+
1899447441,
|
|
33837
|
+
602891725,
|
|
33838
|
+
3049323471,
|
|
33839
|
+
3964484399,
|
|
33840
|
+
3921009573,
|
|
33841
|
+
2173295548,
|
|
33842
|
+
961987163,
|
|
33843
|
+
4081628472,
|
|
33844
|
+
1508970993,
|
|
33845
|
+
3053834265,
|
|
33846
|
+
2453635748,
|
|
33847
|
+
2937671579,
|
|
33848
|
+
2870763221,
|
|
33849
|
+
3664609560,
|
|
33850
|
+
3624381080,
|
|
33851
|
+
2734883394,
|
|
33852
|
+
310598401,
|
|
33853
|
+
1164996542,
|
|
33854
|
+
607225278,
|
|
33855
|
+
1323610764,
|
|
33856
|
+
1426881987,
|
|
33857
|
+
3590304994,
|
|
33858
|
+
1925078388,
|
|
33859
|
+
4068182383,
|
|
33860
|
+
2162078206,
|
|
33861
|
+
991336113,
|
|
33862
|
+
2614888103,
|
|
33863
|
+
633803317,
|
|
33864
|
+
3248222580,
|
|
33865
|
+
3479774868,
|
|
33866
|
+
3835390401,
|
|
33867
|
+
2666613458,
|
|
33868
|
+
4022224774,
|
|
33869
|
+
944711139,
|
|
33870
|
+
264347078,
|
|
33871
|
+
2341262773,
|
|
33872
|
+
604807628,
|
|
33873
|
+
2007800933,
|
|
33874
|
+
770255983,
|
|
33875
|
+
1495990901,
|
|
33876
|
+
1249150122,
|
|
33877
|
+
1856431235,
|
|
33878
|
+
1555081692,
|
|
33879
|
+
3175218132,
|
|
33880
|
+
1996064986,
|
|
33881
|
+
2198950837,
|
|
33882
|
+
2554220882,
|
|
33883
|
+
3999719339,
|
|
33884
|
+
2821834349,
|
|
33885
|
+
766784016,
|
|
33886
|
+
2952996808,
|
|
33887
|
+
2566594879,
|
|
33888
|
+
3210313671,
|
|
33889
|
+
3203337956,
|
|
33890
|
+
3336571891,
|
|
33891
|
+
1034457026,
|
|
33892
|
+
3584528711,
|
|
33893
|
+
2466948901,
|
|
33894
|
+
113926993,
|
|
33895
|
+
3758326383,
|
|
33896
|
+
338241895,
|
|
33897
|
+
168717936,
|
|
33898
|
+
666307205,
|
|
33899
|
+
1188179964,
|
|
33900
|
+
773529912,
|
|
33901
|
+
1546045734,
|
|
33902
|
+
1294757372,
|
|
33903
|
+
1522805485,
|
|
33904
|
+
1396182291,
|
|
33905
|
+
2643833823,
|
|
33906
|
+
1695183700,
|
|
33907
|
+
2343527390,
|
|
33908
|
+
1986661051,
|
|
33909
|
+
1014477480,
|
|
33910
|
+
2177026350,
|
|
33911
|
+
1206759142,
|
|
33912
|
+
2456956037,
|
|
33913
|
+
344077627,
|
|
33914
|
+
2730485921,
|
|
33915
|
+
1290863460,
|
|
33916
|
+
2820302411,
|
|
33917
|
+
3158454273,
|
|
33918
|
+
3259730800,
|
|
33919
|
+
3505952657,
|
|
33920
|
+
3345764771,
|
|
33921
|
+
106217008,
|
|
33922
|
+
3516065817,
|
|
33923
|
+
3606008344,
|
|
33924
|
+
3600352804,
|
|
33925
|
+
1432725776,
|
|
33926
|
+
4094571909,
|
|
33927
|
+
1467031594,
|
|
33928
|
+
275423344,
|
|
33929
|
+
851169720,
|
|
33930
|
+
430227734,
|
|
33931
|
+
3100823752,
|
|
33932
|
+
506948616,
|
|
33933
|
+
1363258195,
|
|
33934
|
+
659060556,
|
|
33935
|
+
3750685593,
|
|
33936
|
+
883997877,
|
|
33937
|
+
3785050280,
|
|
33938
|
+
958139571,
|
|
33939
|
+
3318307427,
|
|
33940
|
+
1322822218,
|
|
33941
|
+
3812723403,
|
|
33942
|
+
1537002063,
|
|
33943
|
+
2003034995,
|
|
33944
|
+
1747873779,
|
|
33945
|
+
3602036899,
|
|
33946
|
+
1955562222,
|
|
33947
|
+
1575990012,
|
|
33948
|
+
2024104815,
|
|
33949
|
+
1125592928,
|
|
33950
|
+
2227730452,
|
|
33951
|
+
2716904306,
|
|
33952
|
+
2361852424,
|
|
33953
|
+
442776044,
|
|
33954
|
+
2428436474,
|
|
33955
|
+
593698344,
|
|
33956
|
+
2756734187,
|
|
33957
|
+
3733110249,
|
|
33958
|
+
3204031479,
|
|
33959
|
+
2999351573,
|
|
33960
|
+
3329325298,
|
|
33961
|
+
3815920427,
|
|
33962
|
+
3391569614,
|
|
33963
|
+
3928383900,
|
|
33964
|
+
3515267271,
|
|
33965
|
+
566280711,
|
|
33966
|
+
3940187606,
|
|
33967
|
+
3454069534,
|
|
33968
|
+
4118630271,
|
|
33969
|
+
4000239992,
|
|
33970
|
+
116418474,
|
|
33971
|
+
1914138554,
|
|
33972
|
+
174292421,
|
|
33973
|
+
2731055270,
|
|
33974
|
+
289380356,
|
|
33975
|
+
3203993006,
|
|
33976
|
+
460393269,
|
|
33977
|
+
320620315,
|
|
33978
|
+
685471733,
|
|
33979
|
+
587496836,
|
|
33980
|
+
852142971,
|
|
33981
|
+
1086792851,
|
|
33982
|
+
1017036298,
|
|
33983
|
+
365543100,
|
|
33984
|
+
1126000580,
|
|
33985
|
+
2618297676,
|
|
33986
|
+
1288033470,
|
|
33987
|
+
3409855158,
|
|
33988
|
+
1501505948,
|
|
33989
|
+
4234509866,
|
|
33990
|
+
1607167915,
|
|
33991
|
+
987167468,
|
|
33992
|
+
1816402316,
|
|
33993
|
+
1246189591
|
|
33994
|
+
]);
|
|
33995
|
+
IV_512 = [
|
|
33996
|
+
1779033703,
|
|
33997
|
+
4089235720,
|
|
33998
|
+
3144134277,
|
|
33999
|
+
2227873595,
|
|
34000
|
+
1013904242,
|
|
34001
|
+
4271175723,
|
|
34002
|
+
2773480762,
|
|
34003
|
+
1595750129,
|
|
34004
|
+
1359893119,
|
|
34005
|
+
2917565137,
|
|
34006
|
+
2600822924,
|
|
34007
|
+
725511199,
|
|
34008
|
+
528734635,
|
|
34009
|
+
4215389547,
|
|
34010
|
+
1541459225,
|
|
34011
|
+
327033209
|
|
34012
|
+
];
|
|
34013
|
+
IV_384 = [
|
|
34014
|
+
3418070365,
|
|
34015
|
+
3238371032,
|
|
34016
|
+
1654270250,
|
|
34017
|
+
914150663,
|
|
34018
|
+
2438529370,
|
|
34019
|
+
812702999,
|
|
34020
|
+
355462360,
|
|
34021
|
+
4144912697,
|
|
34022
|
+
1731405415,
|
|
34023
|
+
4290775857,
|
|
34024
|
+
2394180231,
|
|
34025
|
+
1750603025,
|
|
34026
|
+
3675008525,
|
|
34027
|
+
1694076839,
|
|
34028
|
+
1203062813,
|
|
34029
|
+
3204075428
|
|
34030
|
+
];
|
|
34031
|
+
W3 = new Uint32Array(160);
|
|
34032
|
+
sha512 = (data) => digest64(data, IV_512, 64);
|
|
34033
|
+
sha384 = (data) => digest64(data, IV_384, 48);
|
|
34034
|
+
}
|
|
34035
|
+
});
|
|
34036
|
+
|
|
34037
|
+
// src/digest/digest.ts
|
|
34038
|
+
function digestFunction(name) {
|
|
34039
|
+
const canonical = normalizeDigestAlgorithmName(name);
|
|
34040
|
+
return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
|
|
34041
|
+
}
|
|
34042
|
+
var DIGESTS;
|
|
34043
|
+
var init_digest = __esm({
|
|
34044
|
+
"src/digest/digest.ts"() {
|
|
34045
|
+
init_algorithm_names();
|
|
34046
|
+
init_sha1();
|
|
34047
|
+
init_sha256();
|
|
34048
|
+
init_sha512();
|
|
34049
|
+
DIGESTS = {
|
|
34050
|
+
"SHA-1": sha1,
|
|
34051
|
+
"SHA-256": sha256,
|
|
34052
|
+
"SHA-384": sha384,
|
|
34053
|
+
"SHA-512": sha512
|
|
34054
|
+
};
|
|
34055
|
+
}
|
|
34056
|
+
});
|
|
34057
|
+
|
|
34058
|
+
// src/crypto/key-derivation.ts
|
|
34059
|
+
async function spinPassword(password, salt, spinCount, hashAlgorithm) {
|
|
34060
|
+
if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
|
|
34061
|
+
throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
|
|
34062
|
+
}
|
|
33425
34063
|
const passwordBytes = encodePasswordUtf16LE(password);
|
|
34064
|
+
const digest = digestFunction(hashAlgorithm);
|
|
34065
|
+
if (digest) {
|
|
34066
|
+
let h2 = digest(concatArrays(salt, passwordBytes));
|
|
34067
|
+
const buffer = new Uint8Array(4 + h2.length);
|
|
34068
|
+
const view = new DataView(buffer.buffer);
|
|
34069
|
+
for (let i = 0; i < spinCount; i++) {
|
|
34070
|
+
view.setUint32(0, i, true);
|
|
34071
|
+
buffer.set(h2, 4);
|
|
34072
|
+
h2 = digest(buffer);
|
|
34073
|
+
}
|
|
34074
|
+
return h2;
|
|
34075
|
+
}
|
|
33426
34076
|
let h = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
|
|
33427
34077
|
for (let i = 0; i < spinCount; i++) {
|
|
33428
34078
|
h = await hash(hashAlgorithm, concatArrays(uint32LE(i), h));
|
|
33429
34079
|
}
|
|
33430
|
-
h = await hash(hashAlgorithm, concatArrays(h, blockKey));
|
|
33431
|
-
const cbRequiredKeyLength = keyBits / 8;
|
|
33432
|
-
const cbHash = hashSize;
|
|
33433
|
-
const ipad = 54;
|
|
33434
|
-
const opad = 92;
|
|
33435
|
-
if (cbHash >= cbRequiredKeyLength) {
|
|
33436
|
-
return h.subarray(0, cbRequiredKeyLength);
|
|
33437
|
-
}
|
|
33438
|
-
const x1Input = new Uint8Array(64);
|
|
33439
|
-
x1Input.fill(ipad);
|
|
33440
|
-
for (let i = 0; i < h.length && i < 64; i++) {
|
|
33441
|
-
x1Input[i] = h[i] ^ ipad;
|
|
33442
|
-
}
|
|
33443
|
-
const x1 = await hash(hashAlgorithm, x1Input);
|
|
33444
|
-
const x2Input = new Uint8Array(64);
|
|
33445
|
-
x2Input.fill(opad);
|
|
33446
|
-
for (let i = 0; i < h.length && i < 64; i++) {
|
|
33447
|
-
x2Input[i] = h[i] ^ opad;
|
|
33448
|
-
}
|
|
33449
|
-
const x2 = await hash(hashAlgorithm, x2Input);
|
|
33450
|
-
const x3 = concatArrays(x1, x2);
|
|
33451
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
33452
|
-
}
|
|
33453
|
-
async function computeStandardKeyBase(password, salt) {
|
|
33454
|
-
const passwordBytes = encodePasswordUtf16LE(password);
|
|
33455
|
-
let h = await hash("SHA-1", concatArrays(salt, passwordBytes));
|
|
33456
|
-
for (let i = 0; i < 5e4; i++) {
|
|
33457
|
-
h = await hash("SHA-1", concatArrays(uint32LE(i), h));
|
|
33458
|
-
}
|
|
33459
34080
|
return h;
|
|
33460
34081
|
}
|
|
34082
|
+
async function extendKey(h, hashAlgorithm, keyLength) {
|
|
34083
|
+
const pad = async (value) => {
|
|
34084
|
+
const input = new Uint8Array(64).fill(value);
|
|
34085
|
+
for (let i = 0; i < h.length && i < 64; i++) input[i] = h[i] ^ value;
|
|
34086
|
+
return hash(hashAlgorithm, input);
|
|
34087
|
+
};
|
|
34088
|
+
const x3 = concatArrays(await pad(54), await pad(92));
|
|
34089
|
+
return x3.subarray(0, keyLength);
|
|
34090
|
+
}
|
|
34091
|
+
function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
|
|
34092
|
+
return spinPassword(password, salt, spinCount, hashAlgorithm);
|
|
34093
|
+
}
|
|
34094
|
+
async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
34095
|
+
const h = await hash(hashAlgorithm, concatArrays(base, blockKey));
|
|
34096
|
+
const keyLength = keyBits / 8;
|
|
34097
|
+
if (hashSize >= keyLength) return h.subarray(0, keyLength);
|
|
34098
|
+
return extendKey(h, hashAlgorithm, keyLength);
|
|
34099
|
+
}
|
|
34100
|
+
function computeStandardKeyBase(password, salt) {
|
|
34101
|
+
return spinPassword(password, salt, 5e4, "SHA-1");
|
|
34102
|
+
}
|
|
33461
34103
|
async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
|
|
33462
34104
|
const h = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
|
|
33463
|
-
|
|
33464
|
-
if (h.length >= cbRequiredKeyLength) {
|
|
33465
|
-
return h.subarray(0, cbRequiredKeyLength);
|
|
33466
|
-
}
|
|
33467
|
-
const x1Input = new Uint8Array(64);
|
|
33468
|
-
x1Input.fill(54);
|
|
33469
|
-
for (let i = 0; i < h.length && i < 64; i++) {
|
|
33470
|
-
x1Input[i] = h[i] ^ 54;
|
|
33471
|
-
}
|
|
33472
|
-
const x1 = await hash("SHA-1", x1Input);
|
|
33473
|
-
const x2Input = new Uint8Array(64);
|
|
33474
|
-
x2Input.fill(92);
|
|
33475
|
-
for (let i = 0; i < h.length && i < 64; i++) {
|
|
33476
|
-
x2Input[i] = h[i] ^ 92;
|
|
33477
|
-
}
|
|
33478
|
-
const x2 = await hash("SHA-1", x2Input);
|
|
33479
|
-
const x3 = concatArrays(x1, x2);
|
|
33480
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
34105
|
+
return extendKey(h, "SHA-1", keySize / 8);
|
|
33481
34106
|
}
|
|
33482
34107
|
async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
|
|
33483
34108
|
const base = await computeStandardKeyBase(password, salt);
|
|
@@ -33485,164 +34110,16 @@ async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumbe
|
|
|
33485
34110
|
}
|
|
33486
34111
|
async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
|
|
33487
34112
|
const h = await hash(hashAlgorithm, concatArrays(salt, blockKey));
|
|
33488
|
-
if (h.length >= blockSize)
|
|
33489
|
-
|
|
33490
|
-
}
|
|
33491
|
-
const padded = new Uint8Array(blockSize);
|
|
33492
|
-
padded.fill(54);
|
|
34113
|
+
if (h.length >= blockSize) return h.subarray(0, blockSize);
|
|
34114
|
+
const padded = new Uint8Array(blockSize).fill(54);
|
|
33493
34115
|
padded.set(h);
|
|
33494
34116
|
return padded;
|
|
33495
34117
|
}
|
|
33496
|
-
|
|
33497
|
-
|
|
33498
|
-
|
|
33499
|
-
|
|
33500
|
-
|
|
33501
|
-
return parseAgileEncryptionInfo(data);
|
|
33502
|
-
}
|
|
33503
|
-
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
33504
|
-
return parseStandardEncryptionInfo(data);
|
|
33505
|
-
}
|
|
33506
|
-
throw new Error(
|
|
33507
|
-
`Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
|
|
33508
|
-
);
|
|
33509
|
-
}
|
|
33510
|
-
function parseStandardEncryptionInfo(data) {
|
|
33511
|
-
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
33512
|
-
const versionMajor = view.getUint16(0, true);
|
|
33513
|
-
const versionMinor = view.getUint16(2, true);
|
|
33514
|
-
const flags = view.getUint32(4, true);
|
|
33515
|
-
const headerSize = view.getUint32(8, true);
|
|
33516
|
-
const headerOffset = 12;
|
|
33517
|
-
const hFlags = view.getUint32(headerOffset, true);
|
|
33518
|
-
view.getUint32(headerOffset + 4, true);
|
|
33519
|
-
const algId = view.getUint32(headerOffset + 8, true);
|
|
33520
|
-
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
33521
|
-
const keySize = view.getUint32(headerOffset + 16, true);
|
|
33522
|
-
const providerType = view.getUint32(headerOffset + 20, true);
|
|
33523
|
-
let cspName = "";
|
|
33524
|
-
const cspOffset = headerOffset + 32;
|
|
33525
|
-
const cspEnd = headerOffset + headerSize;
|
|
33526
|
-
for (let i = cspOffset; i < cspEnd - 1; i += 2) {
|
|
33527
|
-
const ch = view.getUint16(i, true);
|
|
33528
|
-
if (ch === 0) {
|
|
33529
|
-
break;
|
|
33530
|
-
}
|
|
33531
|
-
cspName += String.fromCharCode(ch);
|
|
33532
|
-
}
|
|
33533
|
-
const verifierOffset = 12 + headerSize;
|
|
33534
|
-
const saltSize = view.getUint32(verifierOffset, true);
|
|
33535
|
-
const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
|
|
33536
|
-
const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
|
|
33537
|
-
const verifierHashSize = view.getUint32(verifierOffset + 36, true);
|
|
33538
|
-
const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
|
|
33539
|
-
const encryptedVerifierHash = new Uint8Array(
|
|
33540
|
-
data.buffer,
|
|
33541
|
-
data.byteOffset + verifierOffset + 40,
|
|
33542
|
-
encryptedVerifierHashLength
|
|
33543
|
-
);
|
|
33544
|
-
return {
|
|
33545
|
-
version: { major: versionMajor, minor: versionMinor },
|
|
33546
|
-
isAgile: false,
|
|
33547
|
-
isStandard: true,
|
|
33548
|
-
flags,
|
|
33549
|
-
headerSize,
|
|
33550
|
-
header: {
|
|
33551
|
-
flags: hFlags,
|
|
33552
|
-
algId,
|
|
33553
|
-
algIdHash,
|
|
33554
|
-
keySize,
|
|
33555
|
-
providerType,
|
|
33556
|
-
cspName
|
|
33557
|
-
},
|
|
33558
|
-
verifier: {
|
|
33559
|
-
saltSize,
|
|
33560
|
-
salt: new Uint8Array(salt),
|
|
33561
|
-
encryptedVerifier: new Uint8Array(encryptedVerifier),
|
|
33562
|
-
verifierHashSize,
|
|
33563
|
-
encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
|
|
33564
|
-
}
|
|
33565
|
-
};
|
|
33566
|
-
}
|
|
33567
|
-
function parseAgileEncryptionInfo(data) {
|
|
33568
|
-
const xmlBytes = data.subarray(8);
|
|
33569
|
-
const xmlStr = new TextDecoder("utf-8").decode(xmlBytes);
|
|
33570
|
-
const getAttr = (xml, tag, attr4) => {
|
|
33571
|
-
const tagRegex = new RegExp(`<[^>]*${tag}[^>]*>`, "i");
|
|
33572
|
-
const tagMatch = xml.match(tagRegex);
|
|
33573
|
-
if (!tagMatch) {
|
|
33574
|
-
return "";
|
|
33575
|
-
}
|
|
33576
|
-
const attrRegex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
33577
|
-
const attrMatch = tagMatch[0].match(attrRegex);
|
|
33578
|
-
return attrMatch ? attrMatch[1] : "";
|
|
33579
|
-
};
|
|
33580
|
-
const keyDataSaltSize = parseInt(getAttr(xmlStr, "keyData", "saltSize"), 10);
|
|
33581
|
-
const keyDataBlockSize = parseInt(getAttr(xmlStr, "keyData", "blockSize"), 10);
|
|
33582
|
-
const keyDataKeyBits = parseInt(getAttr(xmlStr, "keyData", "keyBits"), 10);
|
|
33583
|
-
const keyDataHashSize = parseInt(getAttr(xmlStr, "keyData", "hashSize"), 10);
|
|
33584
|
-
const keyDataCipherAlgorithm = getAttr(xmlStr, "keyData", "cipherAlgorithm");
|
|
33585
|
-
const keyDataCipherChaining = getAttr(xmlStr, "keyData", "cipherChaining");
|
|
33586
|
-
const keyDataHashAlgorithm = getAttr(xmlStr, "keyData", "hashAlgorithm");
|
|
33587
|
-
const keyDataSaltValue = getAttr(xmlStr, "keyData", "saltValue");
|
|
33588
|
-
const encryptedHmacKey = getAttr(xmlStr, "dataIntegrity", "encryptedHmacKey");
|
|
33589
|
-
const encryptedHmacValue = getAttr(xmlStr, "dataIntegrity", "encryptedHmacValue");
|
|
33590
|
-
const encKeyTag = xmlStr.match(/<[^>]*encryptedKey[^>]*>/i);
|
|
33591
|
-
const encKeyStr = encKeyTag ? encKeyTag[0] : "";
|
|
33592
|
-
const getEncKeyAttr = (attr4) => {
|
|
33593
|
-
const regex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
33594
|
-
const match = encKeyStr.match(regex);
|
|
33595
|
-
return match ? match[1] : "";
|
|
33596
|
-
};
|
|
33597
|
-
const pkeSaltSize = parseInt(getEncKeyAttr("saltSize"), 10);
|
|
33598
|
-
const pkeBlockSize = parseInt(getEncKeyAttr("blockSize"), 10);
|
|
33599
|
-
const pkeKeyBits = parseInt(getEncKeyAttr("keyBits"), 10);
|
|
33600
|
-
const pkeHashSize = parseInt(getEncKeyAttr("hashSize"), 10);
|
|
33601
|
-
const pkeCipherAlgorithm = getEncKeyAttr("cipherAlgorithm");
|
|
33602
|
-
const pkeCipherChaining = getEncKeyAttr("cipherChaining");
|
|
33603
|
-
const pkeHashAlgorithm = getEncKeyAttr("hashAlgorithm");
|
|
33604
|
-
const pkeSaltValue = getEncKeyAttr("saltValue");
|
|
33605
|
-
const pkeSpinCount = parseInt(getEncKeyAttr("spinCount"), 10);
|
|
33606
|
-
const pkeEncryptedVerifierHashInput = getEncKeyAttr("encryptedVerifierHashInput");
|
|
33607
|
-
const pkeEncryptedVerifierHashValue = getEncKeyAttr("encryptedVerifierHashValue");
|
|
33608
|
-
const pkeEncryptedKeyValue = getEncKeyAttr("encryptedKeyValue");
|
|
33609
|
-
return {
|
|
33610
|
-
version: { major: 4, minor: 4 },
|
|
33611
|
-
isAgile: true,
|
|
33612
|
-
keyData: {
|
|
33613
|
-
saltSize: keyDataSaltSize,
|
|
33614
|
-
blockSize: keyDataBlockSize,
|
|
33615
|
-
keyBits: keyDataKeyBits,
|
|
33616
|
-
hashSize: keyDataHashSize,
|
|
33617
|
-
cipherAlgorithm: keyDataCipherAlgorithm,
|
|
33618
|
-
cipherChaining: keyDataCipherChaining,
|
|
33619
|
-
hashAlgorithm: keyDataHashAlgorithm,
|
|
33620
|
-
saltValue: base64Decode(keyDataSaltValue)
|
|
33621
|
-
},
|
|
33622
|
-
dataIntegrity: encryptedHmacKey ? {
|
|
33623
|
-
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
33624
|
-
encryptedHmacValue: base64Decode(encryptedHmacValue)
|
|
33625
|
-
} : void 0,
|
|
33626
|
-
passwordKeyEncryptor: {
|
|
33627
|
-
saltSize: pkeSaltSize,
|
|
33628
|
-
blockSize: pkeBlockSize,
|
|
33629
|
-
keyBits: pkeKeyBits,
|
|
33630
|
-
hashSize: pkeHashSize,
|
|
33631
|
-
cipherAlgorithm: pkeCipherAlgorithm,
|
|
33632
|
-
cipherChaining: pkeCipherChaining,
|
|
33633
|
-
hashAlgorithm: pkeHashAlgorithm,
|
|
33634
|
-
saltValue: base64Decode(pkeSaltValue),
|
|
33635
|
-
spinCount: pkeSpinCount,
|
|
33636
|
-
encryptedVerifierHashInput: base64Decode(pkeEncryptedVerifierHashInput),
|
|
33637
|
-
encryptedVerifierHashValue: base64Decode(pkeEncryptedVerifierHashValue),
|
|
33638
|
-
encryptedKeyValue: base64Decode(pkeEncryptedKeyValue)
|
|
33639
|
-
}
|
|
33640
|
-
};
|
|
33641
|
-
}
|
|
33642
|
-
var BLOCK_KEYS, RC4_ALG_ID;
|
|
33643
|
-
var init_ooxml_crypto_key_derivation = __esm({
|
|
33644
|
-
"src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
|
|
33645
|
-
init_ooxml_crypto_primitives2();
|
|
34118
|
+
var BLOCK_KEYS, MAX_SPIN_COUNT;
|
|
34119
|
+
var init_key_derivation = __esm({
|
|
34120
|
+
"src/crypto/key-derivation.ts"() {
|
|
34121
|
+
init_ooxml_crypto_primitives();
|
|
34122
|
+
init_digest();
|
|
33646
34123
|
BLOCK_KEYS = {
|
|
33647
34124
|
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
33648
34125
|
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
@@ -33650,64 +34127,35 @@ var init_ooxml_crypto_key_derivation = __esm({
|
|
|
33650
34127
|
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
33651
34128
|
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
33652
34129
|
};
|
|
33653
|
-
|
|
34130
|
+
MAX_SPIN_COUNT = 1e7;
|
|
33654
34131
|
}
|
|
33655
34132
|
});
|
|
33656
34133
|
|
|
33657
|
-
// src/
|
|
34134
|
+
// src/crypto/decrypt.ts
|
|
33658
34135
|
async function verifyAgilePassword(info, password) {
|
|
33659
34136
|
const pke = info.passwordKeyEncryptor;
|
|
33660
|
-
const
|
|
33661
|
-
|
|
33662
|
-
pke.saltValue,
|
|
33663
|
-
pke.spinCount,
|
|
33664
|
-
pke.hashAlgorithm,
|
|
33665
|
-
BLOCK_KEYS.verifierHashInput,
|
|
33666
|
-
pke.keyBits,
|
|
33667
|
-
pke.hashSize
|
|
33668
|
-
);
|
|
34137
|
+
const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
|
|
34138
|
+
const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
|
|
33669
34139
|
const verifierHashInput = await aesCbcDecryptRaw(
|
|
33670
|
-
|
|
34140
|
+
await blockKey(BLOCK_KEYS.verifierHashInput),
|
|
33671
34141
|
pke.saltValue,
|
|
33672
34142
|
pke.encryptedVerifierHashInput
|
|
33673
34143
|
);
|
|
33674
|
-
const verifierHashKey = await deriveAgileKey(
|
|
33675
|
-
password,
|
|
33676
|
-
pke.saltValue,
|
|
33677
|
-
pke.spinCount,
|
|
33678
|
-
pke.hashAlgorithm,
|
|
33679
|
-
BLOCK_KEYS.verifierHashValue,
|
|
33680
|
-
pke.keyBits,
|
|
33681
|
-
pke.hashSize
|
|
33682
|
-
);
|
|
33683
34144
|
const verifierHashValue = await aesCbcDecryptRaw(
|
|
33684
|
-
|
|
34145
|
+
await blockKey(BLOCK_KEYS.verifierHashValue),
|
|
33685
34146
|
pke.saltValue,
|
|
33686
34147
|
pke.encryptedVerifierHashValue
|
|
33687
34148
|
);
|
|
33688
34149
|
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
33689
|
-
|
|
33690
|
-
|
|
33691
|
-
let
|
|
33692
|
-
|
|
33693
|
-
|
|
33694
|
-
|
|
33695
|
-
break;
|
|
33696
|
-
}
|
|
33697
|
-
}
|
|
33698
|
-
if (!match) {
|
|
33699
|
-
return null;
|
|
33700
|
-
}
|
|
33701
|
-
const encKeyKey = await deriveAgileKey(
|
|
33702
|
-
password,
|
|
34150
|
+
if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
|
|
34151
|
+
let difference = 0;
|
|
34152
|
+
for (let i = 0; i < pke.hashSize; i++) difference |= verifierHashValue[i] ^ computedHash[i];
|
|
34153
|
+
if (difference !== 0) return null;
|
|
34154
|
+
const decryptedKey = await aesCbcDecryptRaw(
|
|
34155
|
+
await blockKey(BLOCK_KEYS.encryptedKeyValue),
|
|
33703
34156
|
pke.saltValue,
|
|
33704
|
-
pke.
|
|
33705
|
-
pke.hashAlgorithm,
|
|
33706
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
33707
|
-
pke.keyBits,
|
|
33708
|
-
pke.hashSize
|
|
34157
|
+
pke.encryptedKeyValue
|
|
33709
34158
|
);
|
|
33710
|
-
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
|
|
33711
34159
|
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
33712
34160
|
}
|
|
33713
34161
|
async function verifyStandardPassword(info, password) {
|
|
@@ -33717,9 +34165,8 @@ async function verifyStandardPassword(info, password) {
|
|
|
33717
34165
|
info.header.keySize,
|
|
33718
34166
|
info.header.algIdHash
|
|
33719
34167
|
);
|
|
33720
|
-
const
|
|
33721
|
-
const
|
|
33722
|
-
const decryptedHash = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifierHash);
|
|
34168
|
+
const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
|
|
34169
|
+
const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
|
|
33723
34170
|
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
33724
34171
|
const hashSize = info.verifier.verifierHashSize;
|
|
33725
34172
|
let match = true;
|
|
@@ -33809,46 +34256,19 @@ async function decryptStandardPackage(encryptedPackage, key2) {
|
|
|
33809
34256
|
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
33810
34257
|
const originalSize = sizeView.getUint32(0, true);
|
|
33811
34258
|
const encryptedData = encryptedPackage.subarray(8);
|
|
33812
|
-
const
|
|
33813
|
-
const decrypted = await aesCbcDecryptRaw(key2, iv, encryptedData);
|
|
34259
|
+
const decrypted = await aesEcbDecrypt(key2, encryptedData);
|
|
33814
34260
|
return decrypted.slice(0, originalSize).buffer;
|
|
33815
34261
|
}
|
|
33816
|
-
var
|
|
33817
|
-
"src/
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
|
|
34262
|
+
var init_decrypt = __esm({
|
|
34263
|
+
"src/crypto/decrypt.ts"() {
|
|
34264
|
+
init_ooxml_crypto_primitives();
|
|
34265
|
+
init_aes_ecb();
|
|
34266
|
+
init_errors();
|
|
34267
|
+
init_key_derivation();
|
|
33821
34268
|
}
|
|
33822
34269
|
});
|
|
33823
34270
|
|
|
33824
|
-
// src/
|
|
33825
|
-
async function encryptAgilePackage(packageData, key2, info) {
|
|
33826
|
-
const keyData = info.keyData;
|
|
33827
|
-
const segmentSize = 4096;
|
|
33828
|
-
const paddedSize = Math.ceil(packageData.length / segmentSize) * segmentSize;
|
|
33829
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
33830
|
-
paddedData.set(packageData);
|
|
33831
|
-
const encrypted = new Uint8Array(8 + paddedSize);
|
|
33832
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
33833
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
33834
|
-
sizeView.setUint32(4, 0, true);
|
|
33835
|
-
const numSegments = Math.ceil(paddedSize / segmentSize);
|
|
33836
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
33837
|
-
const segmentStart = segment * segmentSize;
|
|
33838
|
-
const segmentEnd = segmentStart + segmentSize;
|
|
33839
|
-
const segmentData = paddedData.subarray(segmentStart, segmentEnd);
|
|
33840
|
-
const blockKeyBytes = uint32LE(segment);
|
|
33841
|
-
const segmentIV = await generateIV(
|
|
33842
|
-
keyData.hashAlgorithm,
|
|
33843
|
-
keyData.saltValue,
|
|
33844
|
-
blockKeyBytes,
|
|
33845
|
-
keyData.blockSize
|
|
33846
|
-
);
|
|
33847
|
-
const encryptedSegment = await aesCbcEncryptNoPad(key2, segmentIV, segmentData);
|
|
33848
|
-
encrypted.set(encryptedSegment, 8 + segmentStart);
|
|
33849
|
-
}
|
|
33850
|
-
return encrypted;
|
|
33851
|
-
}
|
|
34271
|
+
// src/crypto/encryption-info-write.ts
|
|
33852
34272
|
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
33853
34273
|
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
33854
34274
|
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
@@ -33865,20 +34285,6 @@ function buildEncryptionInfoStream(xmlString) {
|
|
|
33865
34285
|
result.set(xmlBytes, 8);
|
|
33866
34286
|
return result;
|
|
33867
34287
|
}
|
|
33868
|
-
async function encryptStandardPackage(packageData, key2) {
|
|
33869
|
-
const blockSize = 16;
|
|
33870
|
-
const paddedSize = Math.ceil(packageData.length / blockSize) * blockSize;
|
|
33871
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
33872
|
-
paddedData.set(packageData);
|
|
33873
|
-
const iv = new Uint8Array(blockSize);
|
|
33874
|
-
const encryptedData = await aesCbcEncryptNoPad(key2, iv, paddedData);
|
|
33875
|
-
const encrypted = new Uint8Array(8 + encryptedData.length);
|
|
33876
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
33877
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
33878
|
-
sizeView.setUint32(4, 0, true);
|
|
33879
|
-
encrypted.set(encryptedData, 8);
|
|
33880
|
-
return encrypted;
|
|
33881
|
-
}
|
|
33882
34288
|
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
33883
34289
|
const algId = STANDARD_ALG_IDS[keyBits];
|
|
33884
34290
|
if (!algId) {
|
|
@@ -33920,40 +34326,10 @@ function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, enc
|
|
|
33920
34326
|
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
33921
34327
|
return data;
|
|
33922
34328
|
}
|
|
33923
|
-
async function encryptPptxStandard(pptxBuffer, password, options) {
|
|
33924
|
-
const algorithm = options?.algorithm ?? "AES256";
|
|
33925
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
33926
|
-
const crypto2 = getCrypto();
|
|
33927
|
-
const salt = new Uint8Array(16);
|
|
33928
|
-
crypto2.getRandomValues(salt);
|
|
33929
|
-
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
33930
|
-
const verifier = new Uint8Array(16);
|
|
33931
|
-
crypto2.getRandomValues(verifier);
|
|
33932
|
-
const verifierHash = await hash("SHA-1", verifier);
|
|
33933
|
-
const paddedVerifierHash = new Uint8Array(32);
|
|
33934
|
-
paddedVerifierHash.set(verifierHash.subarray(0, 20));
|
|
33935
|
-
const zeroIv = new Uint8Array(16);
|
|
33936
|
-
const encryptedVerifier = await aesCbcEncryptNoPad(key2, zeroIv, verifier);
|
|
33937
|
-
const encryptedVerifierHash = await aesCbcEncryptNoPad(key2, zeroIv, paddedVerifierHash);
|
|
33938
|
-
const encryptionInfoBytes = buildStandardEncryptionInfoStream(
|
|
33939
|
-
keyBits,
|
|
33940
|
-
salt,
|
|
33941
|
-
encryptedVerifier,
|
|
33942
|
-
encryptedVerifierHash
|
|
33943
|
-
);
|
|
33944
|
-
const packageData = new Uint8Array(pptxBuffer);
|
|
33945
|
-
const encryptedPackage = await encryptStandardPackage(packageData, key2);
|
|
33946
|
-
const ole2Streams = /* @__PURE__ */ new Map();
|
|
33947
|
-
ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
|
|
33948
|
-
ole2Streams.set("EncryptedPackage", encryptedPackage);
|
|
33949
|
-
return buildOle2(ole2Streams);
|
|
33950
|
-
}
|
|
33951
34329
|
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
33952
|
-
var
|
|
33953
|
-
"src/
|
|
33954
|
-
|
|
33955
|
-
init_ooxml_crypto_key_derivation();
|
|
33956
|
-
init_ooxml_crypto_primitives2();
|
|
34330
|
+
var init_encryption_info_write = __esm({
|
|
34331
|
+
"src/crypto/encryption-info-write.ts"() {
|
|
34332
|
+
init_ooxml_crypto_primitives();
|
|
33957
34333
|
STANDARD_ALG_IDS = {
|
|
33958
34334
|
128: 26126,
|
|
33959
34335
|
// CALG_AES_128
|
|
@@ -33969,178 +34345,317 @@ var init_ooxml_crypto_encrypt = __esm({
|
|
|
33969
34345
|
}
|
|
33970
34346
|
});
|
|
33971
34347
|
|
|
33972
|
-
// src/
|
|
33973
|
-
|
|
33974
|
-
const
|
|
33975
|
-
|
|
33976
|
-
|
|
33977
|
-
|
|
33978
|
-
|
|
34348
|
+
// src/crypto/encrypt.ts
|
|
34349
|
+
function container(encryptionInfo, encryptedPackage) {
|
|
34350
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
34351
|
+
streams2.set("EncryptionInfo", encryptionInfo);
|
|
34352
|
+
streams2.set("EncryptedPackage", encryptedPackage);
|
|
34353
|
+
return new Uint8Array(buildOle2(streams2));
|
|
34354
|
+
}
|
|
34355
|
+
function randomBytes(size) {
|
|
34356
|
+
const bytes = new Uint8Array(size);
|
|
34357
|
+
getCrypto().getRandomValues(bytes);
|
|
34358
|
+
return bytes;
|
|
34359
|
+
}
|
|
34360
|
+
function padTo(data, blockSize) {
|
|
34361
|
+
const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
|
|
34362
|
+
padded.set(data);
|
|
34363
|
+
return padded;
|
|
34364
|
+
}
|
|
34365
|
+
function withSizePrefix(size, body) {
|
|
34366
|
+
const out = new Uint8Array(8 + body.length);
|
|
34367
|
+
const view = new DataView(out.buffer, 0, 8);
|
|
34368
|
+
view.setUint32(0, size % 4294967296, true);
|
|
34369
|
+
view.setUint32(4, Math.floor(size / 4294967296), true);
|
|
34370
|
+
out.set(body, 8);
|
|
34371
|
+
return out;
|
|
34372
|
+
}
|
|
34373
|
+
async function encryptAgilePackage(packageData, key2, info) {
|
|
34374
|
+
const { hashAlgorithm, saltValue, blockSize } = info.keyData;
|
|
34375
|
+
const padded = padTo(packageData, SEGMENT_SIZE);
|
|
34376
|
+
const encrypted = withSizePrefix(packageData.length, padded);
|
|
34377
|
+
for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
|
|
34378
|
+
const iv = await generateIV(
|
|
34379
|
+
hashAlgorithm,
|
|
34380
|
+
saltValue,
|
|
34381
|
+
uint32LE(start / SEGMENT_SIZE),
|
|
34382
|
+
blockSize
|
|
33979
34383
|
);
|
|
34384
|
+
const segment = padded.subarray(start, start + SEGMENT_SIZE);
|
|
34385
|
+
encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
|
|
33980
34386
|
}
|
|
33981
|
-
|
|
33982
|
-
if (!encryptedPackage) {
|
|
33983
|
-
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
33984
|
-
}
|
|
33985
|
-
const info = parseEncryptionInfo(encryptionInfoStream);
|
|
33986
|
-
if ("isStandard" in info && info.isStandard) {
|
|
33987
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
33988
|
-
if (!key3) {
|
|
33989
|
-
throw new IncorrectPasswordError();
|
|
33990
|
-
}
|
|
33991
|
-
return decryptStandardPackage(encryptedPackage, key3);
|
|
33992
|
-
}
|
|
33993
|
-
const agileInfo = info;
|
|
33994
|
-
const key2 = await verifyAgilePassword(agileInfo, password);
|
|
33995
|
-
if (!key2) {
|
|
33996
|
-
throw new IncorrectPasswordError();
|
|
33997
|
-
}
|
|
33998
|
-
await verifyAgileDataIntegrity(agileInfo, key2, encryptedPackage);
|
|
33999
|
-
return decryptAgilePackage(encryptedPackage, key2, agileInfo);
|
|
34387
|
+
return encrypted;
|
|
34000
34388
|
}
|
|
34001
|
-
async function
|
|
34002
|
-
|
|
34003
|
-
|
|
34004
|
-
|
|
34005
|
-
|
|
34006
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
34007
|
-
const crypto2 = getCrypto();
|
|
34008
|
-
const keyDataSalt = new Uint8Array(16);
|
|
34009
|
-
crypto2.getRandomValues(keyDataSalt);
|
|
34010
|
-
const pkeSalt = new Uint8Array(16);
|
|
34011
|
-
crypto2.getRandomValues(pkeSalt);
|
|
34012
|
-
const documentKey = new Uint8Array(keyBits / 8);
|
|
34013
|
-
crypto2.getRandomValues(documentKey);
|
|
34389
|
+
async function encryptStandardPackage(packageData, key2) {
|
|
34390
|
+
const encryptedData = await aesEcbEncrypt(key2, packageData);
|
|
34391
|
+
return withSizePrefix(packageData.length, encryptedData);
|
|
34392
|
+
}
|
|
34393
|
+
async function encryptAgile(packageData, password, options = {}) {
|
|
34394
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
34014
34395
|
const hashAlgorithm = "SHA-512";
|
|
34015
34396
|
const hashSize = 64;
|
|
34016
34397
|
const blockSize = 16;
|
|
34017
|
-
const spinCount = options
|
|
34018
|
-
const
|
|
34019
|
-
|
|
34398
|
+
const spinCount = options.spinCount ?? 1e5;
|
|
34399
|
+
const keyDataSalt = randomBytes(16);
|
|
34400
|
+
const pkeSalt = randomBytes(16);
|
|
34401
|
+
const documentKey = randomBytes(keyBits / 8);
|
|
34402
|
+
const verifierHashInput = randomBytes(16);
|
|
34020
34403
|
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
34021
|
-
const
|
|
34022
|
-
|
|
34023
|
-
|
|
34024
|
-
|
|
34025
|
-
|
|
34026
|
-
|
|
34404
|
+
const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
|
|
34405
|
+
const encryptUnder = async (block, data) => {
|
|
34406
|
+
const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
|
|
34407
|
+
return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
|
|
34408
|
+
};
|
|
34409
|
+
const passwordKeyEncryptor = {
|
|
34410
|
+
saltSize: 16,
|
|
34411
|
+
blockSize,
|
|
34027
34412
|
keyBits,
|
|
34028
|
-
hashSize
|
|
34029
|
-
|
|
34030
|
-
|
|
34031
|
-
|
|
34032
|
-
|
|
34033
|
-
paddedVerifierInput.set(verifierHashInput);
|
|
34034
|
-
const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
|
|
34035
|
-
verifierInputKey,
|
|
34036
|
-
pkeSalt,
|
|
34037
|
-
paddedVerifierInput
|
|
34038
|
-
);
|
|
34039
|
-
const verifierHashKey = await deriveAgileKey(
|
|
34040
|
-
password,
|
|
34041
|
-
pkeSalt,
|
|
34413
|
+
hashSize,
|
|
34414
|
+
cipherAlgorithm: "AES",
|
|
34415
|
+
cipherChaining: "ChainingModeCBC",
|
|
34416
|
+
hashAlgorithm,
|
|
34417
|
+
saltValue: pkeSalt,
|
|
34042
34418
|
spinCount,
|
|
34419
|
+
encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
|
|
34420
|
+
encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
|
|
34421
|
+
encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
|
|
34422
|
+
};
|
|
34423
|
+
const keyData = {
|
|
34424
|
+
saltSize: 16,
|
|
34425
|
+
blockSize,
|
|
34426
|
+
keyBits,
|
|
34427
|
+
hashSize,
|
|
34428
|
+
cipherAlgorithm: "AES",
|
|
34429
|
+
cipherChaining: "ChainingModeCBC",
|
|
34043
34430
|
hashAlgorithm,
|
|
34044
|
-
|
|
34431
|
+
saltValue: keyDataSalt
|
|
34432
|
+
};
|
|
34433
|
+
const info = {
|
|
34434
|
+
keyData};
|
|
34435
|
+
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
|
|
34436
|
+
const hmacKey = randomBytes(hashSize);
|
|
34437
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
|
|
34438
|
+
const encryptIntegrity = async (block, data) => {
|
|
34439
|
+
const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
|
|
34440
|
+
return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
|
|
34441
|
+
};
|
|
34442
|
+
const dataIntegrity = {
|
|
34443
|
+
encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
|
|
34444
|
+
encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
|
|
34445
|
+
};
|
|
34446
|
+
const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
|
|
34447
|
+
return container(buildEncryptionInfoStream(xml), encryptedPackage);
|
|
34448
|
+
}
|
|
34449
|
+
async function encryptStandard(packageData, password, options = {}) {
|
|
34450
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
34451
|
+
const salt = randomBytes(16);
|
|
34452
|
+
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
34453
|
+
const verifier = randomBytes(16);
|
|
34454
|
+
const paddedVerifierHash = new Uint8Array(32);
|
|
34455
|
+
paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
|
|
34456
|
+
const encryptionInfo = buildStandardEncryptionInfoStream(
|
|
34045
34457
|
keyBits,
|
|
34046
|
-
|
|
34458
|
+
salt,
|
|
34459
|
+
await aesEcbEncrypt(key2, verifier),
|
|
34460
|
+
await aesEcbEncrypt(key2, paddedVerifierHash)
|
|
34047
34461
|
);
|
|
34048
|
-
|
|
34049
|
-
|
|
34050
|
-
|
|
34051
|
-
|
|
34052
|
-
|
|
34053
|
-
|
|
34462
|
+
return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
|
|
34463
|
+
}
|
|
34464
|
+
var SEGMENT_SIZE;
|
|
34465
|
+
var init_encrypt = __esm({
|
|
34466
|
+
"src/crypto/encrypt.ts"() {
|
|
34467
|
+
init_ole2_parser_write();
|
|
34468
|
+
init_ooxml_crypto_primitives();
|
|
34469
|
+
init_aes_ecb();
|
|
34470
|
+
init_encryption_info_write();
|
|
34471
|
+
init_key_derivation();
|
|
34472
|
+
SEGMENT_SIZE = 4096;
|
|
34473
|
+
}
|
|
34474
|
+
});
|
|
34475
|
+
|
|
34476
|
+
// src/crypto/encryption-info.ts
|
|
34477
|
+
function parseEncryptionInfo(data) {
|
|
34478
|
+
if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
|
|
34479
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
34480
|
+
const versionMajor = view.getUint16(0, true);
|
|
34481
|
+
const versionMinor = view.getUint16(2, true);
|
|
34482
|
+
if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
|
|
34483
|
+
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
34484
|
+
return parseStandardEncryptionInfo(data);
|
|
34485
|
+
}
|
|
34486
|
+
throw new Error(
|
|
34487
|
+
`Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
|
|
34054
34488
|
);
|
|
34055
|
-
|
|
34056
|
-
|
|
34057
|
-
|
|
34058
|
-
|
|
34059
|
-
|
|
34060
|
-
|
|
34061
|
-
|
|
34062
|
-
|
|
34489
|
+
}
|
|
34490
|
+
function parseStandardEncryptionInfo(data) {
|
|
34491
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
34492
|
+
const versionMajor = view.getUint16(0, true);
|
|
34493
|
+
const versionMinor = view.getUint16(2, true);
|
|
34494
|
+
const flags = view.getUint32(4, true);
|
|
34495
|
+
const headerSize = view.getUint32(8, true);
|
|
34496
|
+
const headerOffset = 12;
|
|
34497
|
+
const hFlags = view.getUint32(headerOffset, true);
|
|
34498
|
+
const algId = view.getUint32(headerOffset + 8, true);
|
|
34499
|
+
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
34500
|
+
const keySize = view.getUint32(headerOffset + 16, true);
|
|
34501
|
+
const providerType = view.getUint32(headerOffset + 20, true);
|
|
34502
|
+
let cspName = "";
|
|
34503
|
+
const cspEnd = headerOffset + headerSize;
|
|
34504
|
+
for (let i = headerOffset + 32; i < cspEnd - 1; i += 2) {
|
|
34505
|
+
const ch = view.getUint16(i, true);
|
|
34506
|
+
if (ch === 0) break;
|
|
34507
|
+
cspName += String.fromCharCode(ch);
|
|
34508
|
+
}
|
|
34509
|
+
const verifierOffset = 12 + headerSize;
|
|
34510
|
+
const saltSize = view.getUint32(verifierOffset, true);
|
|
34511
|
+
const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
|
|
34512
|
+
const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
|
|
34513
|
+
const verifierHashSize = view.getUint32(verifierOffset + 36, true);
|
|
34514
|
+
const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
|
|
34515
|
+
const encryptedVerifierHash = new Uint8Array(
|
|
34516
|
+
data.buffer,
|
|
34517
|
+
data.byteOffset + verifierOffset + 40,
|
|
34518
|
+
encryptedVerifierHashLength
|
|
34063
34519
|
);
|
|
34064
|
-
|
|
34065
|
-
|
|
34066
|
-
|
|
34067
|
-
|
|
34520
|
+
return {
|
|
34521
|
+
version: { major: versionMajor, minor: versionMinor },
|
|
34522
|
+
isAgile: false,
|
|
34523
|
+
isStandard: true,
|
|
34524
|
+
flags,
|
|
34525
|
+
headerSize,
|
|
34526
|
+
header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
|
|
34527
|
+
verifier: {
|
|
34528
|
+
saltSize,
|
|
34529
|
+
salt: new Uint8Array(salt),
|
|
34530
|
+
encryptedVerifier: new Uint8Array(encryptedVerifier),
|
|
34531
|
+
verifierHashSize,
|
|
34532
|
+
encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
|
|
34533
|
+
}
|
|
34534
|
+
};
|
|
34535
|
+
}
|
|
34536
|
+
function tagAttribute(xml, tag, attr4) {
|
|
34537
|
+
const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
|
|
34538
|
+
if (!tagMatch) return "";
|
|
34539
|
+
const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr4}="([^"]*)"`, "i"));
|
|
34540
|
+
return attrMatch?.[1] ?? "";
|
|
34541
|
+
}
|
|
34542
|
+
function parseAgileEncryptionInfo(data) {
|
|
34543
|
+
const xml = new TextDecoder("utf-8").decode(data.subarray(8));
|
|
34544
|
+
const keyData = (attr4) => tagAttribute(xml, "keyData", attr4);
|
|
34545
|
+
const integrity = (attr4) => tagAttribute(xml, "dataIntegrity", attr4);
|
|
34546
|
+
const pke = (attr4) => tagAttribute(xml, "encryptedKey", attr4);
|
|
34547
|
+
const int = (value) => parseInt(value, 10);
|
|
34548
|
+
const encryptedHmacKey = integrity("encryptedHmacKey");
|
|
34549
|
+
return {
|
|
34550
|
+
version: { major: 4, minor: 4 },
|
|
34551
|
+
isAgile: true,
|
|
34068
34552
|
keyData: {
|
|
34069
|
-
saltSize:
|
|
34070
|
-
blockSize,
|
|
34071
|
-
keyBits,
|
|
34072
|
-
hashSize,
|
|
34073
|
-
cipherAlgorithm: "
|
|
34074
|
-
cipherChaining: "
|
|
34075
|
-
hashAlgorithm,
|
|
34076
|
-
saltValue:
|
|
34077
|
-
},
|
|
34078
|
-
dataIntegrity: {
|
|
34079
|
-
encryptedHmacKey: new Uint8Array(0),
|
|
34080
|
-
// Will be filled after encryption
|
|
34081
|
-
encryptedHmacValue: new Uint8Array(0)
|
|
34553
|
+
saltSize: int(keyData("saltSize")),
|
|
34554
|
+
blockSize: int(keyData("blockSize")),
|
|
34555
|
+
keyBits: int(keyData("keyBits")),
|
|
34556
|
+
hashSize: int(keyData("hashSize")),
|
|
34557
|
+
cipherAlgorithm: keyData("cipherAlgorithm"),
|
|
34558
|
+
cipherChaining: keyData("cipherChaining"),
|
|
34559
|
+
hashAlgorithm: keyData("hashAlgorithm"),
|
|
34560
|
+
saltValue: base64Decode(keyData("saltValue"))
|
|
34082
34561
|
},
|
|
34562
|
+
...encryptedHmacKey ? {
|
|
34563
|
+
dataIntegrity: {
|
|
34564
|
+
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
34565
|
+
encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
|
|
34566
|
+
}
|
|
34567
|
+
} : {},
|
|
34083
34568
|
passwordKeyEncryptor: {
|
|
34084
|
-
saltSize:
|
|
34085
|
-
blockSize,
|
|
34086
|
-
keyBits,
|
|
34087
|
-
hashSize,
|
|
34088
|
-
cipherAlgorithm: "
|
|
34089
|
-
cipherChaining: "
|
|
34090
|
-
hashAlgorithm,
|
|
34091
|
-
saltValue:
|
|
34092
|
-
spinCount,
|
|
34093
|
-
encryptedVerifierHashInput,
|
|
34094
|
-
encryptedVerifierHashValue,
|
|
34095
|
-
encryptedKeyValue
|
|
34569
|
+
saltSize: int(pke("saltSize")),
|
|
34570
|
+
blockSize: int(pke("blockSize")),
|
|
34571
|
+
keyBits: int(pke("keyBits")),
|
|
34572
|
+
hashSize: int(pke("hashSize")),
|
|
34573
|
+
cipherAlgorithm: pke("cipherAlgorithm"),
|
|
34574
|
+
cipherChaining: pke("cipherChaining"),
|
|
34575
|
+
hashAlgorithm: pke("hashAlgorithm"),
|
|
34576
|
+
saltValue: base64Decode(pke("saltValue")),
|
|
34577
|
+
spinCount: int(pke("spinCount")),
|
|
34578
|
+
encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
|
|
34579
|
+
encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
|
|
34580
|
+
encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
|
|
34096
34581
|
}
|
|
34097
34582
|
};
|
|
34098
|
-
|
|
34099
|
-
|
|
34100
|
-
|
|
34101
|
-
|
|
34102
|
-
|
|
34103
|
-
|
|
34104
|
-
|
|
34105
|
-
|
|
34106
|
-
|
|
34107
|
-
|
|
34108
|
-
|
|
34109
|
-
const
|
|
34110
|
-
|
|
34111
|
-
const
|
|
34112
|
-
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
|
|
34116
|
-
|
|
34117
|
-
);
|
|
34118
|
-
|
|
34119
|
-
|
|
34120
|
-
const
|
|
34121
|
-
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34125
|
-
|
|
34126
|
-
|
|
34127
|
-
|
|
34128
|
-
|
|
34129
|
-
);
|
|
34130
|
-
|
|
34131
|
-
|
|
34132
|
-
|
|
34133
|
-
|
|
34134
|
-
return
|
|
34583
|
+
}
|
|
34584
|
+
var RC4_ALG_ID;
|
|
34585
|
+
var init_encryption_info = __esm({
|
|
34586
|
+
"src/crypto/encryption-info.ts"() {
|
|
34587
|
+
init_ooxml_crypto_primitives();
|
|
34588
|
+
RC4_ALG_ID = 26625;
|
|
34589
|
+
}
|
|
34590
|
+
});
|
|
34591
|
+
|
|
34592
|
+
// src/crypto/index.ts
|
|
34593
|
+
function streams(bytes) {
|
|
34594
|
+
const opened = openEncryptedPackage(bytes);
|
|
34595
|
+
if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
|
|
34596
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
34597
|
+
if (!file.getStream("EncryptionInfo")) {
|
|
34598
|
+
throw new Error(
|
|
34599
|
+
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
34600
|
+
);
|
|
34601
|
+
}
|
|
34602
|
+
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
34603
|
+
}
|
|
34604
|
+
async function decryptOoxmlPackage(input, password) {
|
|
34605
|
+
const { info: infoStream, data } = streams(toBytes(input));
|
|
34606
|
+
const info = parseEncryptionInfo(infoStream);
|
|
34607
|
+
if (isStandard(info)) {
|
|
34608
|
+
const key3 = await verifyStandardPassword(info, password);
|
|
34609
|
+
if (!key3) throw new IncorrectPasswordError();
|
|
34610
|
+
return new Uint8Array(await decryptStandardPackage(data, key3));
|
|
34611
|
+
}
|
|
34612
|
+
const key2 = await verifyAgilePassword(info, password);
|
|
34613
|
+
if (!key2) throw new IncorrectPasswordError();
|
|
34614
|
+
await verifyAgileDataIntegrity(info, key2, data);
|
|
34615
|
+
return new Uint8Array(await decryptAgilePackage(data, key2, info));
|
|
34616
|
+
}
|
|
34617
|
+
function encryptOoxmlPackage(input, password, options = {}) {
|
|
34618
|
+
const bytes = toBytes(input);
|
|
34619
|
+
return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
|
|
34620
|
+
}
|
|
34621
|
+
var isStandard;
|
|
34622
|
+
var init_crypto = __esm({
|
|
34623
|
+
"src/crypto/index.ts"() {
|
|
34624
|
+
init_ole2_parser_read();
|
|
34625
|
+
init_decrypt();
|
|
34626
|
+
init_detect();
|
|
34627
|
+
init_encrypt();
|
|
34628
|
+
init_encryption_info();
|
|
34629
|
+
init_errors();
|
|
34630
|
+
isStandard = (info) => "isStandard" in info && info.isStandard;
|
|
34631
|
+
}
|
|
34632
|
+
});
|
|
34633
|
+
|
|
34634
|
+
// src/pptx/core/utils/ooxml-crypto-primitives.ts
|
|
34635
|
+
var init_ooxml_crypto_primitives2 = __esm({
|
|
34636
|
+
"src/pptx/core/utils/ooxml-crypto-primitives.ts"() {
|
|
34637
|
+
init_ooxml_crypto_primitives();
|
|
34638
|
+
}
|
|
34639
|
+
});
|
|
34640
|
+
|
|
34641
|
+
// src/pptx/core/utils/ooxml-crypto.ts
|
|
34642
|
+
async function decryptPptx(encryptedBuffer, password) {
|
|
34643
|
+
return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
|
|
34644
|
+
}
|
|
34645
|
+
async function encryptPptx(pptxBuffer, password, options) {
|
|
34646
|
+
return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
|
|
34135
34647
|
}
|
|
34136
34648
|
var init_ooxml_crypto = __esm({
|
|
34137
34649
|
"src/pptx/core/utils/ooxml-crypto.ts"() {
|
|
34138
|
-
|
|
34139
|
-
|
|
34140
|
-
|
|
34141
|
-
|
|
34142
|
-
|
|
34143
|
-
|
|
34650
|
+
init_crypto();
|
|
34651
|
+
}
|
|
34652
|
+
});
|
|
34653
|
+
|
|
34654
|
+
// src/pptx/core/utils/ole2-parser.ts
|
|
34655
|
+
var init_ole2_parser = __esm({
|
|
34656
|
+
"src/pptx/core/utils/ole2-parser.ts"() {
|
|
34657
|
+
init_ole2_parser_types2();
|
|
34658
|
+
init_ole2_parser_read2();
|
|
34144
34659
|
}
|
|
34145
34660
|
});
|
|
34146
34661
|
|
|
@@ -34219,12 +34734,12 @@ function transform(state, x) {
|
|
|
34219
34734
|
function md4(message) {
|
|
34220
34735
|
return mdStyleDigest(message, INITIAL_STATE, transform);
|
|
34221
34736
|
}
|
|
34222
|
-
var INITIAL_STATE,
|
|
34737
|
+
var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
|
|
34223
34738
|
var init_md4 = __esm({
|
|
34224
34739
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
34225
34740
|
init_bit_ops();
|
|
34226
34741
|
INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
|
|
34227
|
-
|
|
34742
|
+
K22 = 1518500249;
|
|
34228
34743
|
K3 = 1859775393;
|
|
34229
34744
|
ROUND1 = [
|
|
34230
34745
|
[0, 3, 0],
|
|
@@ -34245,22 +34760,22 @@ var init_md4 = __esm({
|
|
|
34245
34760
|
[15, 19, 0]
|
|
34246
34761
|
];
|
|
34247
34762
|
ROUND2 = [
|
|
34248
|
-
[0, 3,
|
|
34249
|
-
[4, 5,
|
|
34250
|
-
[8, 9,
|
|
34251
|
-
[12, 13,
|
|
34252
|
-
[1, 3,
|
|
34253
|
-
[5, 5,
|
|
34254
|
-
[9, 9,
|
|
34255
|
-
[13, 13,
|
|
34256
|
-
[2, 3,
|
|
34257
|
-
[6, 5,
|
|
34258
|
-
[10, 9,
|
|
34259
|
-
[14, 13,
|
|
34260
|
-
[3, 3,
|
|
34261
|
-
[7, 5,
|
|
34262
|
-
[11, 9,
|
|
34263
|
-
[15, 13,
|
|
34763
|
+
[0, 3, K22],
|
|
34764
|
+
[4, 5, K22],
|
|
34765
|
+
[8, 9, K22],
|
|
34766
|
+
[12, 13, K22],
|
|
34767
|
+
[1, 3, K22],
|
|
34768
|
+
[5, 5, K22],
|
|
34769
|
+
[9, 9, K22],
|
|
34770
|
+
[13, 13, K22],
|
|
34771
|
+
[2, 3, K22],
|
|
34772
|
+
[6, 5, K22],
|
|
34773
|
+
[10, 9, K22],
|
|
34774
|
+
[14, 13, K22],
|
|
34775
|
+
[3, 3, K22],
|
|
34776
|
+
[7, 5, K22],
|
|
34777
|
+
[11, 9, K22],
|
|
34778
|
+
[15, 13, K22]
|
|
34264
34779
|
];
|
|
34265
34780
|
ROUND3 = [
|
|
34266
34781
|
[0, 3, K3],
|
|
@@ -34284,31 +34799,16 @@ var init_md4 = __esm({
|
|
|
34284
34799
|
});
|
|
34285
34800
|
|
|
34286
34801
|
// src/pptx/core/utils/signature-detection.ts
|
|
34287
|
-
function detectDigitalSignatures(zipEntryPaths) {
|
|
34288
|
-
const sigPaths = zipEntryPaths.filter(
|
|
34289
|
-
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
34290
|
-
);
|
|
34291
|
-
return {
|
|
34292
|
-
hasSignatures: sigPaths.length > 0,
|
|
34293
|
-
signatureCount: sigPaths.length,
|
|
34294
|
-
signaturePaths: sigPaths
|
|
34295
|
-
};
|
|
34296
|
-
}
|
|
34297
|
-
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
34298
|
-
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
34299
|
-
}
|
|
34300
|
-
var SIGNATURE_PREFIX;
|
|
34301
34802
|
var init_signature_detection = __esm({
|
|
34302
34803
|
"src/pptx/core/utils/signature-detection.ts"() {
|
|
34303
|
-
|
|
34804
|
+
init_detection();
|
|
34304
34805
|
}
|
|
34305
34806
|
});
|
|
34306
34807
|
|
|
34307
34808
|
// src/pptx/core/utils/signature-constants.ts
|
|
34308
|
-
var DIGITAL_SIGNATURE_ORIGIN_REL_TYPE;
|
|
34309
34809
|
var init_signature_constants = __esm({
|
|
34310
34810
|
"src/pptx/core/utils/signature-constants.ts"() {
|
|
34311
|
-
|
|
34811
|
+
init_constants3();
|
|
34312
34812
|
}
|
|
34313
34813
|
});
|
|
34314
34814
|
|
|
@@ -34698,11 +35198,11 @@ function parseSeriesErrBars(seriesNode, xmlLookup, extractPointValues, colorPars
|
|
|
34698
35198
|
return result;
|
|
34699
35199
|
}).filter((e) => e !== void 0);
|
|
34700
35200
|
}
|
|
34701
|
-
function parseLineStyle(
|
|
34702
|
-
if (!
|
|
35201
|
+
function parseLineStyle(container2, elementName, xmlLookup, colorParser) {
|
|
35202
|
+
if (!container2) {
|
|
34703
35203
|
return void 0;
|
|
34704
35204
|
}
|
|
34705
|
-
const lineNode = xmlLookup.getChildByLocalName(
|
|
35205
|
+
const lineNode = xmlLookup.getChildByLocalName(container2, elementName);
|
|
34706
35206
|
if (!lineNode) {
|
|
34707
35207
|
return void 0;
|
|
34708
35208
|
}
|
|
@@ -34767,9 +35267,9 @@ function chartColorChoiceValue(authored, color2, resolveColor2, opacity2) {
|
|
|
34767
35267
|
opacity2
|
|
34768
35268
|
);
|
|
34769
35269
|
}
|
|
34770
|
-
function writeChartColorChoice(
|
|
34771
|
-
|
|
34772
|
-
|
|
35270
|
+
function writeChartColorChoice(container2, key2, color2, resolveColor2, opacity2) {
|
|
35271
|
+
container2[key2] = chartColorChoiceValue(
|
|
35272
|
+
container2[key2],
|
|
34773
35273
|
color2,
|
|
34774
35274
|
resolveColor2,
|
|
34775
35275
|
opacity2
|
|
@@ -35553,7 +36053,7 @@ function parseChartUniqueId(node, localName28) {
|
|
|
35553
36053
|
const val = uniqueIdNode?.["@_val"];
|
|
35554
36054
|
return typeof val === "string" && val.length > 0 ? val : void 0;
|
|
35555
36055
|
}
|
|
35556
|
-
function
|
|
36056
|
+
function randomBytes2(length) {
|
|
35557
36057
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
35558
36058
|
if (cryptoObj && typeof cryptoObj.getRandomValues === "function") {
|
|
35559
36059
|
return cryptoObj.getRandomValues(new Uint8Array(length));
|
|
@@ -35565,7 +36065,7 @@ function randomBytes(length) {
|
|
|
35565
36065
|
return bytes;
|
|
35566
36066
|
}
|
|
35567
36067
|
function randomHex(length) {
|
|
35568
|
-
const bytes =
|
|
36068
|
+
const bytes = randomBytes2(Math.ceil(length / 2));
|
|
35569
36069
|
let out = "";
|
|
35570
36070
|
for (const b of bytes) {
|
|
35571
36071
|
out += b.toString(16).padStart(2, "0");
|
|
@@ -35574,7 +36074,7 @@ function randomHex(length) {
|
|
|
35574
36074
|
}
|
|
35575
36075
|
function generateChartUniqueId() {
|
|
35576
36076
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
35577
|
-
const variantNibble = (8 +
|
|
36077
|
+
const variantNibble = (8 + randomBytes2(1)[0] % 4).toString(16);
|
|
35578
36078
|
const uuid = cryptoObj && typeof cryptoObj.randomUUID === "function" ? cryptoObj.randomUUID() : `${randomHex(8)}-${randomHex(4)}-4${randomHex(3)}-${variantNibble}${randomHex(3)}-${randomHex(12)}`;
|
|
35579
36079
|
return `{${uuid.toUpperCase()}}`;
|
|
35580
36080
|
}
|
|
@@ -39643,10 +40143,10 @@ function parseVmlGroup(node, idPrefix, index) {
|
|
|
39643
40143
|
return null;
|
|
39644
40144
|
}
|
|
39645
40145
|
}
|
|
39646
|
-
function parseVmlElements(
|
|
40146
|
+
function parseVmlElements(container2, idPrefix = "") {
|
|
39647
40147
|
const elements = [];
|
|
39648
40148
|
for (const tag of VML_SHAPE_TAGS) {
|
|
39649
|
-
const nodes =
|
|
40149
|
+
const nodes = container2[tag];
|
|
39650
40150
|
if (!nodes) {
|
|
39651
40151
|
continue;
|
|
39652
40152
|
}
|
|
@@ -39746,8 +40246,8 @@ function diagnoseSelection(ac) {
|
|
|
39746
40246
|
}
|
|
39747
40247
|
return void 0;
|
|
39748
40248
|
}
|
|
39749
|
-
function unwrapAlternateContent(
|
|
39750
|
-
const altContents = ensureArray3(
|
|
40249
|
+
function unwrapAlternateContent(container2) {
|
|
40250
|
+
const altContents = ensureArray3(container2["mc:AlternateContent"]);
|
|
39751
40251
|
if (altContents.length === 0) {
|
|
39752
40252
|
return [];
|
|
39753
40253
|
}
|
|
@@ -39767,7 +40267,7 @@ function unwrapAlternateContent(container) {
|
|
|
39767
40267
|
for (const tag of SHAPE_TREE_ELEMENT_TAGS) {
|
|
39768
40268
|
const children14 = ensureArray3(branch[tag]);
|
|
39769
40269
|
if (children14.length > 0) {
|
|
39770
|
-
|
|
40270
|
+
container2[tag] = [...ensureArray3(container2[tag]), ...children14];
|
|
39771
40271
|
for (const child27 of children14) {
|
|
39772
40272
|
block.childRefs.push({ tag, node: child27 });
|
|
39773
40273
|
}
|
|
@@ -39777,11 +40277,11 @@ function unwrapAlternateContent(container) {
|
|
|
39777
40277
|
blocks.push(block);
|
|
39778
40278
|
}
|
|
39779
40279
|
}
|
|
39780
|
-
delete
|
|
40280
|
+
delete container2["mc:AlternateContent"];
|
|
39781
40281
|
return blocks;
|
|
39782
40282
|
}
|
|
39783
|
-
function reapplyAlternateContentToTree(
|
|
39784
|
-
let working =
|
|
40283
|
+
function reapplyAlternateContentToTree(container2, blockByNode) {
|
|
40284
|
+
let working = container2;
|
|
39785
40285
|
const groups = ensureArray3(working["p:grpSp"]);
|
|
39786
40286
|
if (groups.length > 0) {
|
|
39787
40287
|
let groupsChanged = false;
|
|
@@ -40642,16 +41142,16 @@ function applyActiveXControlsToSlide(slideXml3, controls) {
|
|
|
40642
41142
|
return;
|
|
40643
41143
|
}
|
|
40644
41144
|
const nodes = controls.map(buildActiveXControlNode);
|
|
40645
|
-
const
|
|
41145
|
+
const container2 = cSld["p:controls"] ?? {};
|
|
40646
41146
|
const isNewContainer = cSld["p:controls"] === void 0;
|
|
40647
|
-
|
|
41147
|
+
container2["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
|
|
40648
41148
|
if (isNewContainer && cSld["p:extLst"] !== void 0) {
|
|
40649
41149
|
const extLst = cSld["p:extLst"];
|
|
40650
41150
|
delete cSld["p:extLst"];
|
|
40651
|
-
cSld["p:controls"] =
|
|
41151
|
+
cSld["p:controls"] = container2;
|
|
40652
41152
|
cSld["p:extLst"] = extLst;
|
|
40653
41153
|
} else {
|
|
40654
|
-
cSld["p:controls"] =
|
|
41154
|
+
cSld["p:controls"] = container2;
|
|
40655
41155
|
}
|
|
40656
41156
|
}
|
|
40657
41157
|
var init_activex_serializer = __esm({
|
|
@@ -42922,12 +43422,12 @@ var init_effect_dag_primitives = __esm({
|
|
|
42922
43422
|
});
|
|
42923
43423
|
|
|
42924
43424
|
// src/pptx/core/core/builders/effect-dag-serializer.ts
|
|
42925
|
-
function serializeEffectDagContainerNode(
|
|
42926
|
-
const xml = { "@_type":
|
|
42927
|
-
if (
|
|
42928
|
-
xml["@_name"] =
|
|
43425
|
+
function serializeEffectDagContainerNode(container2) {
|
|
43426
|
+
const xml = { "@_type": container2.type };
|
|
43427
|
+
if (container2.name) {
|
|
43428
|
+
xml["@_name"] = container2.name;
|
|
42929
43429
|
}
|
|
42930
|
-
for (const child27 of
|
|
43430
|
+
for (const child27 of container2.children) {
|
|
42931
43431
|
appendChild2(xml, child27);
|
|
42932
43432
|
}
|
|
42933
43433
|
return xml;
|
|
@@ -42993,24 +43493,24 @@ function parseEffectDagContainer(node) {
|
|
|
42993
43493
|
const type = VALID_CONTAINER_TYPES.has(typeAttr) ? typeAttr : "sib";
|
|
42994
43494
|
const nameAttr = String(xml["@_name"] ?? "").trim();
|
|
42995
43495
|
const children14 = parseChildren(xml);
|
|
42996
|
-
const
|
|
43496
|
+
const container2 = {
|
|
42997
43497
|
kind: "cont",
|
|
42998
43498
|
type,
|
|
42999
43499
|
children: children14
|
|
43000
43500
|
};
|
|
43001
43501
|
if (nameAttr) {
|
|
43002
|
-
|
|
43502
|
+
container2.name = nameAttr;
|
|
43003
43503
|
}
|
|
43004
|
-
return
|
|
43504
|
+
return container2;
|
|
43005
43505
|
}
|
|
43006
43506
|
function buildEffectDagTreeFromXml(effectDagXml) {
|
|
43007
43507
|
return parseEffectDagContainer(effectDagXml);
|
|
43008
43508
|
}
|
|
43009
|
-
function serializeEffectDagContainer(
|
|
43010
|
-
if (!
|
|
43509
|
+
function serializeEffectDagContainer(container2) {
|
|
43510
|
+
if (!container2) {
|
|
43011
43511
|
return void 0;
|
|
43012
43512
|
}
|
|
43013
|
-
return serializeEffectDagContainerNode(
|
|
43513
|
+
return serializeEffectDagContainerNode(container2);
|
|
43014
43514
|
}
|
|
43015
43515
|
function parseChildren(xml) {
|
|
43016
43516
|
const children14 = [];
|
|
@@ -43076,7 +43576,7 @@ function parseBlend(value) {
|
|
|
43076
43576
|
const modeAttr = String(xml["@_blend"] ?? "").trim().toLowerCase();
|
|
43077
43577
|
const mode = VALID_BLEND_MODES.has(modeAttr) ? modeAttr : "over";
|
|
43078
43578
|
const contNode = childByLocalName2(xml, "cont");
|
|
43079
|
-
const
|
|
43579
|
+
const container2 = parseEffectDagContainer(Array.isArray(contNode) ? contNode[0] : contNode) ?? {
|
|
43080
43580
|
kind: "cont",
|
|
43081
43581
|
type: "sib",
|
|
43082
43582
|
children: []
|
|
@@ -43084,7 +43584,7 @@ function parseBlend(value) {
|
|
|
43084
43584
|
return {
|
|
43085
43585
|
kind: "blend",
|
|
43086
43586
|
mode,
|
|
43087
|
-
container
|
|
43587
|
+
container: container2
|
|
43088
43588
|
};
|
|
43089
43589
|
}
|
|
43090
43590
|
function parseXfrm(value) {
|
|
@@ -44881,13 +45381,13 @@ function boolValue2(node) {
|
|
|
44881
45381
|
const value = node["@_val"];
|
|
44882
45382
|
return value !== "0" && value !== "false";
|
|
44883
45383
|
}
|
|
44884
|
-
function parseBubbleChartOptions(
|
|
44885
|
-
if (!
|
|
45384
|
+
function parseBubbleChartOptions(container2, localName28) {
|
|
45385
|
+
if (!container2) {
|
|
44886
45386
|
return void 0;
|
|
44887
45387
|
}
|
|
44888
45388
|
const node = (name) => {
|
|
44889
|
-
const key2 = findKey11(
|
|
44890
|
-
return key2 ?
|
|
45389
|
+
const key2 = findKey11(container2, name, localName28);
|
|
45390
|
+
return key2 ? container2[key2] : void 0;
|
|
44891
45391
|
};
|
|
44892
45392
|
const options = {};
|
|
44893
45393
|
const bubble3D = boolValue2(node("bubble3D"));
|
|
@@ -44914,33 +45414,33 @@ function parseBubbleChartOptions(container, localName28) {
|
|
|
44914
45414
|
}
|
|
44915
45415
|
return Object.keys(options).length > 0 ? options : void 0;
|
|
44916
45416
|
}
|
|
44917
|
-
function insertOrdered2(
|
|
44918
|
-
const existingKey = findKey11(
|
|
45417
|
+
function insertOrdered2(container2, name, value, localName28) {
|
|
45418
|
+
const existingKey = findKey11(container2, name, localName28);
|
|
44919
45419
|
if (existingKey) {
|
|
44920
|
-
|
|
45420
|
+
container2[existingKey] = { ...container2[existingKey], ...value };
|
|
44921
45421
|
return;
|
|
44922
45422
|
}
|
|
44923
|
-
const entries = Object.entries(
|
|
45423
|
+
const entries = Object.entries(container2);
|
|
44924
45424
|
const targetRank = ORDER2.indexOf(name);
|
|
44925
45425
|
const index = entries.findIndex(([key2]) => {
|
|
44926
45426
|
const rank = ORDER2.indexOf(localName28(key2));
|
|
44927
45427
|
return rank >= 0 && rank > targetRank;
|
|
44928
45428
|
});
|
|
44929
45429
|
entries.splice(index < 0 ? entries.length : index, 0, [`c:${name}`, value]);
|
|
44930
|
-
for (const key2 of Object.keys(
|
|
44931
|
-
delete
|
|
45430
|
+
for (const key2 of Object.keys(container2)) {
|
|
45431
|
+
delete container2[key2];
|
|
44932
45432
|
}
|
|
44933
45433
|
for (const [key2, child27] of entries) {
|
|
44934
|
-
|
|
45434
|
+
container2[key2] = child27;
|
|
44935
45435
|
}
|
|
44936
45436
|
}
|
|
44937
|
-
function applyBubbleChartOptions(
|
|
45437
|
+
function applyBubbleChartOptions(container2, options, localName28) {
|
|
44938
45438
|
if (options.bubble3D !== void 0) {
|
|
44939
|
-
insertOrdered2(
|
|
45439
|
+
insertOrdered2(container2, "bubble3D", { "@_val": options.bubble3D ? "1" : "0" }, localName28);
|
|
44940
45440
|
}
|
|
44941
45441
|
if (options.bubbleScale !== void 0) {
|
|
44942
45442
|
insertOrdered2(
|
|
44943
|
-
|
|
45443
|
+
container2,
|
|
44944
45444
|
"bubbleScale",
|
|
44945
45445
|
{
|
|
44946
45446
|
"@_val": chartPercentUnionValue(options.bubbleScale, {
|
|
@@ -44954,14 +45454,14 @@ function applyBubbleChartOptions(container, options, localName28) {
|
|
|
44954
45454
|
}
|
|
44955
45455
|
if (options.showNegativeBubbles !== void 0) {
|
|
44956
45456
|
insertOrdered2(
|
|
44957
|
-
|
|
45457
|
+
container2,
|
|
44958
45458
|
"showNegBubbles",
|
|
44959
45459
|
{ "@_val": options.showNegativeBubbles ? "1" : "0" },
|
|
44960
45460
|
localName28
|
|
44961
45461
|
);
|
|
44962
45462
|
}
|
|
44963
45463
|
if (options.sizeRepresents !== void 0) {
|
|
44964
|
-
insertOrdered2(
|
|
45464
|
+
insertOrdered2(container2, "sizeRepresents", { "@_val": options.sizeRepresents }, localName28);
|
|
44965
45465
|
}
|
|
44966
45466
|
}
|
|
44967
45467
|
var ORDER2;
|
|
@@ -45129,12 +45629,12 @@ var init_chart_up_down_bars = __esm({
|
|
|
45129
45629
|
});
|
|
45130
45630
|
|
|
45131
45631
|
// src/pptx/core/utils/drawing-media-reference.ts
|
|
45132
|
-
function parseDrawingMediaReference(
|
|
45133
|
-
if (!
|
|
45632
|
+
function parseDrawingMediaReference(container2, externalRelIds) {
|
|
45633
|
+
if (!container2) {
|
|
45134
45634
|
return void 0;
|
|
45135
45635
|
}
|
|
45136
45636
|
for (const kind of MEDIA_REFERENCE_NAMES) {
|
|
45137
|
-
const node = child15(
|
|
45637
|
+
const node = child15(container2, kind);
|
|
45138
45638
|
if (!node) {
|
|
45139
45639
|
continue;
|
|
45140
45640
|
}
|
|
@@ -45158,15 +45658,15 @@ function parseDrawingMediaReference(container, externalRelIds) {
|
|
|
45158
45658
|
}
|
|
45159
45659
|
return void 0;
|
|
45160
45660
|
}
|
|
45161
|
-
function applyDrawingMediaReference(
|
|
45661
|
+
function applyDrawingMediaReference(container2, element, relationshipId2) {
|
|
45162
45662
|
const kind = element.mediaReferenceKind;
|
|
45163
45663
|
if (!kind) {
|
|
45164
45664
|
return;
|
|
45165
45665
|
}
|
|
45166
|
-
const targetKey = Object.keys(
|
|
45167
|
-
for (const key2 of Object.keys(
|
|
45666
|
+
const targetKey = Object.keys(container2).find((key2) => localName13(key2) === kind);
|
|
45667
|
+
for (const key2 of Object.keys(container2)) {
|
|
45168
45668
|
if (MEDIA_REFERENCE_NAMES.includes(localName13(key2))) {
|
|
45169
|
-
delete
|
|
45669
|
+
delete container2[key2];
|
|
45170
45670
|
}
|
|
45171
45671
|
}
|
|
45172
45672
|
const original = element.rawMediaReferenceXml ? { ...element.rawMediaReferenceXml } : {};
|
|
@@ -45183,7 +45683,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
45183
45683
|
if (extKey) {
|
|
45184
45684
|
original[extKey] = extension;
|
|
45185
45685
|
}
|
|
45186
|
-
|
|
45686
|
+
container2[targetKey ?? "a:audioCd"] = original;
|
|
45187
45687
|
return;
|
|
45188
45688
|
}
|
|
45189
45689
|
if (kind === "wavAudioFile") {
|
|
@@ -45203,7 +45703,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
45203
45703
|
setAttribute4(original, "contentType", element.mediaReferenceContentType);
|
|
45204
45704
|
}
|
|
45205
45705
|
}
|
|
45206
|
-
|
|
45706
|
+
container2[targetKey ?? `a:${kind}`] = original;
|
|
45207
45707
|
}
|
|
45208
45708
|
function parseAudioCdPosition(value) {
|
|
45209
45709
|
if (!value || typeof value !== "object") {
|
|
@@ -50132,10 +50632,10 @@ function applyPresentationDefaultTextStyle(presentation, levels) {
|
|
|
50132
50632
|
PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE
|
|
50133
50633
|
);
|
|
50134
50634
|
}
|
|
50135
|
-
function insertBeforeKeys(
|
|
50635
|
+
function insertBeforeKeys(container2, key2, value, before) {
|
|
50136
50636
|
const rebuilt = {};
|
|
50137
50637
|
let inserted = false;
|
|
50138
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
50638
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
50139
50639
|
if (childKey3 === key2) {
|
|
50140
50640
|
continue;
|
|
50141
50641
|
}
|
|
@@ -50148,10 +50648,10 @@ function insertBeforeKeys(container, key2, value, before) {
|
|
|
50148
50648
|
if (!inserted) {
|
|
50149
50649
|
rebuilt[key2] = value;
|
|
50150
50650
|
}
|
|
50151
|
-
for (const existingKey of Object.keys(
|
|
50152
|
-
delete
|
|
50651
|
+
for (const existingKey of Object.keys(container2)) {
|
|
50652
|
+
delete container2[existingKey];
|
|
50153
50653
|
}
|
|
50154
|
-
Object.assign(
|
|
50654
|
+
Object.assign(container2, rebuilt);
|
|
50155
50655
|
}
|
|
50156
50656
|
var LEVEL_KEY_ORDER, SLDMASTER_BEFORE_TXSTYLES, TX_STYLES_CATEGORY_ORDER, PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE;
|
|
50157
50657
|
var init_master_text_style_writer = __esm({
|
|
@@ -56178,8 +56678,8 @@ function asNode(value) {
|
|
|
56178
56678
|
}
|
|
56179
56679
|
function parseShapeLocksFromNode(shape, spec) {
|
|
56180
56680
|
const nv = asNode(shape?.[spec.nvKey]);
|
|
56181
|
-
const
|
|
56182
|
-
return parseShapeLockNode(asNode(
|
|
56681
|
+
const container2 = asNode(nv?.[spec.cNvKey]);
|
|
56682
|
+
return parseShapeLockNode(asNode(container2?.[spec.lockTag]), spec);
|
|
56183
56683
|
}
|
|
56184
56684
|
function resolveLockContainerNode(shape, spec, create) {
|
|
56185
56685
|
const nv = asNode(shape[spec.nvKey]);
|
|
@@ -59111,8 +59611,8 @@ function findCNvPr(shape) {
|
|
|
59111
59611
|
return void 0;
|
|
59112
59612
|
}
|
|
59113
59613
|
for (const key2 of NV_CONTAINERS) {
|
|
59114
|
-
const
|
|
59115
|
-
const cNvPr =
|
|
59614
|
+
const container2 = shape[key2];
|
|
59615
|
+
const cNvPr = container2?.["p:cNvPr"];
|
|
59116
59616
|
if (cNvPr) {
|
|
59117
59617
|
return cNvPr;
|
|
59118
59618
|
}
|
|
@@ -59358,8 +59858,8 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
|
59358
59858
|
continue;
|
|
59359
59859
|
}
|
|
59360
59860
|
const parsed = parser.parse(vmlXml);
|
|
59361
|
-
const
|
|
59362
|
-
const shapes = parseVmlElements(
|
|
59861
|
+
const container2 = parsed["xml"] ?? parsed;
|
|
59862
|
+
const shapes = parseVmlElements(container2, `vml-${drawingIndex}-`);
|
|
59363
59863
|
results.push(...shapes);
|
|
59364
59864
|
drawingIndex++;
|
|
59365
59865
|
}
|
|
@@ -62570,12 +63070,12 @@ function collectInteractiveSequences(node, found) {
|
|
|
62570
63070
|
);
|
|
62571
63071
|
}
|
|
62572
63072
|
containers.push(...ensureArray10(node["p:par"]), ...ensureArray10(node["p:seq"]));
|
|
62573
|
-
for (const
|
|
62574
|
-
if (isInteractiveSequence(
|
|
62575
|
-
found.push(
|
|
63073
|
+
for (const container2 of containers) {
|
|
63074
|
+
if (isInteractiveSequence(container2)) {
|
|
63075
|
+
found.push(container2);
|
|
62576
63076
|
continue;
|
|
62577
63077
|
}
|
|
62578
|
-
collectInteractiveSequences(
|
|
63078
|
+
collectInteractiveSequences(container2, found);
|
|
62579
63079
|
}
|
|
62580
63080
|
}
|
|
62581
63081
|
function parseInteractiveSequences(rootPar, animations, walk3) {
|
|
@@ -62676,16 +63176,16 @@ function collectMediaNodes(node, animations) {
|
|
|
62676
63176
|
const cTn = node["p:cTn"];
|
|
62677
63177
|
const childTnList = cTn?.["p:childTnLst"];
|
|
62678
63178
|
if (childTnList) {
|
|
62679
|
-
for (const
|
|
62680
|
-
const children14 = ensureArray10(childTnList[
|
|
63179
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
63180
|
+
const children14 = ensureArray10(childTnList[container2]);
|
|
62681
63181
|
for (const child27 of children14) {
|
|
62682
63182
|
collectMediaNodes(child27, animations);
|
|
62683
63183
|
}
|
|
62684
63184
|
}
|
|
62685
63185
|
collectMediaNodes(childTnList, animations);
|
|
62686
63186
|
}
|
|
62687
|
-
for (const
|
|
62688
|
-
const children14 = ensureArray10(node[
|
|
63187
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
63188
|
+
const children14 = ensureArray10(node[container2]);
|
|
62689
63189
|
for (const child27 of children14) {
|
|
62690
63190
|
collectMediaNodes(child27, animations);
|
|
62691
63191
|
}
|
|
@@ -83696,7 +84196,7 @@ var init_layout_switch_placeholder_prompts = __esm({
|
|
|
83696
84196
|
|
|
83697
84197
|
// src/pptx/core/core/types.ts
|
|
83698
84198
|
var DEFAULT_MAX_UNCOMPRESSED_BYTES, MAX_ZIP_ENTRY_COUNT, ZipBombError;
|
|
83699
|
-
var
|
|
84199
|
+
var init_types4 = __esm({
|
|
83700
84200
|
"src/pptx/core/core/types.ts"() {
|
|
83701
84201
|
DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
83702
84202
|
MAX_ZIP_ENTRY_COUNT = 65536;
|
|
@@ -84503,12 +85003,12 @@ function readCachedValues(refContainer, xmlLookup) {
|
|
|
84503
85003
|
}
|
|
84504
85004
|
return out;
|
|
84505
85005
|
}
|
|
84506
|
-
function readRefOrLiteral(
|
|
84507
|
-
const ref = xmlLookup.getChildByLocalName(
|
|
85006
|
+
function readRefOrLiteral(container2, xmlLookup) {
|
|
85007
|
+
const ref = xmlLookup.getChildByLocalName(container2, "strRef") ?? xmlLookup.getChildByLocalName(container2, "numRef");
|
|
84508
85008
|
if (ref) {
|
|
84509
85009
|
return readCachedValues(ref, xmlLookup);
|
|
84510
85010
|
}
|
|
84511
|
-
const literal2 = xmlLookup.getChildByLocalName(
|
|
85011
|
+
const literal2 = xmlLookup.getChildByLocalName(container2, "strLit") ?? xmlLookup.getChildByLocalName(container2, "numLit");
|
|
84512
85012
|
return literal2 ? readCachedValues({ "c:strCache": literal2 }, xmlLookup) : [];
|
|
84513
85013
|
}
|
|
84514
85014
|
function parseOneFilteredSeries(node, xmlLookup) {
|
|
@@ -84543,15 +85043,15 @@ function parseOneFilteredSeries(node, xmlLookup) {
|
|
|
84543
85043
|
}
|
|
84544
85044
|
return result;
|
|
84545
85045
|
}
|
|
84546
|
-
function findFilterExt(
|
|
84547
|
-
const extLst = xmlLookup.getChildByLocalName(
|
|
85046
|
+
function findFilterExt(container2, xmlLookup) {
|
|
85047
|
+
const extLst = xmlLookup.getChildByLocalName(container2, "extLst");
|
|
84548
85048
|
if (!extLst) {
|
|
84549
85049
|
return void 0;
|
|
84550
85050
|
}
|
|
84551
85051
|
return xmlLookup.getChildrenArrayByLocalName(extLst, "ext").find((ext) => ext["@_uri"] === CHART_FILTERED_SERIES_EXT_URI);
|
|
84552
85052
|
}
|
|
84553
|
-
function parseFilteredSeries(
|
|
84554
|
-
const ext = findFilterExt(
|
|
85053
|
+
function parseFilteredSeries(container2, xmlLookup) {
|
|
85054
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
84555
85055
|
if (!ext) {
|
|
84556
85056
|
return void 0;
|
|
84557
85057
|
}
|
|
@@ -84572,9 +85072,9 @@ function parseFilteredSeries(container, xmlLookup) {
|
|
|
84572
85072
|
}
|
|
84573
85073
|
return results.length > 0 ? results : void 0;
|
|
84574
85074
|
}
|
|
84575
|
-
function collectFilteredSeriesIndices(
|
|
85075
|
+
function collectFilteredSeriesIndices(container2, xmlLookup) {
|
|
84576
85076
|
const reserved = /* @__PURE__ */ new Set();
|
|
84577
|
-
for (const filtered of parseFilteredSeries(
|
|
85077
|
+
for (const filtered of parseFilteredSeries(container2, xmlLookup) ?? []) {
|
|
84578
85078
|
reserved.add(filtered.idx);
|
|
84579
85079
|
}
|
|
84580
85080
|
return reserved;
|
|
@@ -84619,8 +85119,8 @@ function readAxDataSource(cat, xmlLookup) {
|
|
|
84619
85119
|
const ref = xmlLookup.getChildByLocalName(cat, "strRef") ?? xmlLookup.getChildByLocalName(cat, "numRef");
|
|
84620
85120
|
return readCachedValues(ref, xmlLookup);
|
|
84621
85121
|
}
|
|
84622
|
-
function parseFilteredTitles(
|
|
84623
|
-
const ext = findFilterExt(
|
|
85122
|
+
function parseFilteredTitles(container2, xmlLookup) {
|
|
85123
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
84624
85124
|
if (!ext) {
|
|
84625
85125
|
return void 0;
|
|
84626
85126
|
}
|
|
@@ -85535,8 +86035,8 @@ var init_chart_protection2 = __esm({
|
|
|
85535
86035
|
});
|
|
85536
86036
|
|
|
85537
86037
|
// src/pptx/core/utils/chart-series-axis.ts
|
|
85538
|
-
function resolveChartContainerValueAxisId(
|
|
85539
|
-
const referencedIds = xmlLookup.getChildrenArrayByLocalName(
|
|
86038
|
+
function resolveChartContainerValueAxisId(container2, axes, xmlLookup) {
|
|
86039
|
+
const referencedIds = xmlLookup.getChildrenArrayByLocalName(container2, "axId").map((node) => Number.parseInt(String(node["@_val"]), 10)).filter(Number.isFinite);
|
|
85540
86040
|
for (let index = referencedIds.length - 1; index >= 0; index--) {
|
|
85541
86041
|
const id = referencedIds[index];
|
|
85542
86042
|
if (axes.some((axis) => axis.axisType === "valAx" && axis.axisId === id)) {
|
|
@@ -91089,10 +91589,10 @@ function buildOle10Native(label, sourcePath, data) {
|
|
|
91089
91589
|
return new ByteWriter().u32(body.length).bytes(body).toBytes();
|
|
91090
91590
|
}
|
|
91091
91591
|
function buildPackageStorage(label, sourcePath, data) {
|
|
91092
|
-
const
|
|
91093
|
-
|
|
91094
|
-
|
|
91095
|
-
return new Uint8Array(buildOle2(
|
|
91592
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
91593
|
+
streams2.set("CompObj", hexToBytes(COMP_OBJ_HEX));
|
|
91594
|
+
streams2.set("Ole10Native", buildOle10Native(label, sourcePath, data));
|
|
91595
|
+
return new Uint8Array(buildOle2(streams2, PACKAGE_ROOT_CLSID));
|
|
91096
91596
|
}
|
|
91097
91597
|
function buildExOleObjStg(storage) {
|
|
91098
91598
|
return record(RT.ExternalOleObjectStg, storage, 0, false, 0);
|
|
@@ -91979,8 +92479,8 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
|
|
|
91979
92479
|
const spgrData = new ByteWriter().bytes(buildCanvasPatriarch(allocator));
|
|
91980
92480
|
const background = backgroundRgb ? buildBackgroundShape(backgroundRgb, allocator) : void 0;
|
|
91981
92481
|
const prebuilt = prebuiltShapes?.(allocator) ?? [];
|
|
91982
|
-
for (const
|
|
91983
|
-
spgrData.bytes(
|
|
92482
|
+
for (const container2 of prebuilt) {
|
|
92483
|
+
spgrData.bytes(container2);
|
|
91984
92484
|
}
|
|
91985
92485
|
for (const shape of shapes) {
|
|
91986
92486
|
spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
|
|
@@ -92075,19 +92575,19 @@ function* iterateRecords(view, start, end) {
|
|
|
92075
92575
|
offset = rec.dataOffset + rec.recLen;
|
|
92076
92576
|
}
|
|
92077
92577
|
}
|
|
92078
|
-
function* iterateChildren(view,
|
|
92079
|
-
yield* iterateRecords(view,
|
|
92578
|
+
function* iterateChildren(view, container2) {
|
|
92579
|
+
yield* iterateRecords(view, container2.dataOffset, container2.dataOffset + container2.recLen);
|
|
92080
92580
|
}
|
|
92081
|
-
function findChild4(view,
|
|
92082
|
-
for (const child27 of iterateChildren(view,
|
|
92581
|
+
function findChild4(view, container2, recType, recInstance) {
|
|
92582
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
92083
92583
|
if (child27.recType === recType && (recInstance === void 0 || child27.recInstance === recInstance)) {
|
|
92084
92584
|
return child27;
|
|
92085
92585
|
}
|
|
92086
92586
|
}
|
|
92087
92587
|
return void 0;
|
|
92088
92588
|
}
|
|
92089
|
-
function findDescendant(view,
|
|
92090
|
-
for (const child27 of iterateChildren(view,
|
|
92589
|
+
function findDescendant(view, container2, recType, recInstance) {
|
|
92590
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
92091
92591
|
if (child27.recType === recType && (recInstance === void 0)) {
|
|
92092
92592
|
return child27;
|
|
92093
92593
|
}
|
|
@@ -92138,8 +92638,8 @@ function parseColorSchemeAtom(view, rec) {
|
|
|
92138
92638
|
}
|
|
92139
92639
|
return colors;
|
|
92140
92640
|
}
|
|
92141
|
-
function findSchemeColors(view,
|
|
92142
|
-
for (const child27 of iterateChildren(view,
|
|
92641
|
+
function findSchemeColors(view, container2) {
|
|
92642
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
92143
92643
|
if (child27.recType === RT.ColorSchemeAtom && child27.recInstance === 1) {
|
|
92144
92644
|
return parseColorSchemeAtom(view, child27);
|
|
92145
92645
|
}
|
|
@@ -92803,13 +93303,13 @@ async function buildPptFile(deck, options = {}) {
|
|
|
92803
93303
|
const encrypted = Boolean(options.password);
|
|
92804
93304
|
const finished = encrypted ? await finishEncrypted(layout, lastSlideId, options.password) : await finishUnencrypted(layout, lastSlideId);
|
|
92805
93305
|
const currentUser = buildCurrentUserStream(finished.offsetToCurrentEdit, encrypted);
|
|
92806
|
-
const
|
|
92807
|
-
|
|
92808
|
-
|
|
93306
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
93307
|
+
streams2.set("Current User", currentUser);
|
|
93308
|
+
streams2.set("PowerPoint Document", finished.documentBytes);
|
|
92809
93309
|
if (finished.picturesBytes && finished.picturesBytes.length > 0) {
|
|
92810
|
-
|
|
93310
|
+
streams2.set("Pictures", finished.picturesBytes);
|
|
92811
93311
|
}
|
|
92812
|
-
return new Uint8Array(buildOle2(
|
|
93312
|
+
return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
|
|
92813
93313
|
}
|
|
92814
93314
|
var init_write_ppt = __esm({
|
|
92815
93315
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
|
|
@@ -93708,20 +94208,20 @@ function buildRestoredRegionXml(region) {
|
|
|
93708
94208
|
}
|
|
93709
94209
|
function applyCommonSlideContainer(root, name, props) {
|
|
93710
94210
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
93711
|
-
const
|
|
93712
|
-
const commonKey = findViewKey(
|
|
93713
|
-
|
|
93714
|
-
root[key2] =
|
|
94211
|
+
const container2 = { ...root[key2] ?? {} };
|
|
94212
|
+
const commonKey = findViewKey(container2, "cSldViewPr") ?? "p:cSldViewPr";
|
|
94213
|
+
container2[commonKey] = buildCommonSlideView(props, viewChild(container2, "cSldViewPr"));
|
|
94214
|
+
root[key2] = container2;
|
|
93715
94215
|
}
|
|
93716
94216
|
function applyCommonViewContainer(root, name, props) {
|
|
93717
94217
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
93718
|
-
const
|
|
93719
|
-
const commonKey = findViewKey(
|
|
94218
|
+
const container2 = { ...root[key2] ?? {} };
|
|
94219
|
+
const commonKey = findViewKey(container2, "cViewPr") ?? "p:cViewPr";
|
|
93720
94220
|
const wrapper = buildCommonSlideView(props, {
|
|
93721
|
-
"p:cViewPr": viewChild(
|
|
94221
|
+
"p:cViewPr": viewChild(container2, "cViewPr") ?? {}
|
|
93722
94222
|
});
|
|
93723
|
-
|
|
93724
|
-
root[key2] =
|
|
94223
|
+
container2[commonKey] = viewChild(wrapper, "cViewPr");
|
|
94224
|
+
root[key2] = container2;
|
|
93725
94225
|
}
|
|
93726
94226
|
var init_pptx_view_props_helpers = __esm({
|
|
93727
94227
|
"src/pptx/core/core/runtime/pptx-view-props-helpers.ts"() {
|
|
@@ -94044,22 +94544,22 @@ function ordered3(existing, modeled, getLocalName2) {
|
|
|
94044
94544
|
});
|
|
94045
94545
|
return Object.fromEntries(entries);
|
|
94046
94546
|
}
|
|
94047
|
-
function insertAfterLastSeries(
|
|
94048
|
-
const keys = Object.keys(
|
|
94547
|
+
function insertAfterLastSeries(container2, dLbls, getLocalName2) {
|
|
94548
|
+
const keys = Object.keys(container2);
|
|
94049
94549
|
let lastSer = -1;
|
|
94050
94550
|
keys.forEach((k, i) => {
|
|
94051
94551
|
if (getLocalName2(k) === "ser") {
|
|
94052
94552
|
lastSer = i;
|
|
94053
94553
|
}
|
|
94054
94554
|
});
|
|
94055
|
-
const entries = keys.map((k) => [k,
|
|
94555
|
+
const entries = keys.map((k) => [k, container2[k]]);
|
|
94056
94556
|
const at2 = lastSer === -1 ? entries.length : lastSer + 1;
|
|
94057
94557
|
entries.splice(at2, 0, ["c:dLbls", dLbls]);
|
|
94058
94558
|
for (const k of keys) {
|
|
94059
|
-
delete
|
|
94559
|
+
delete container2[k];
|
|
94060
94560
|
}
|
|
94061
94561
|
for (const [k, v] of entries) {
|
|
94062
|
-
|
|
94562
|
+
container2[k] = v;
|
|
94063
94563
|
}
|
|
94064
94564
|
}
|
|
94065
94565
|
function buildDLbls(existing, opts, getLocalName2) {
|
|
@@ -94096,25 +94596,25 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
94096
94596
|
}
|
|
94097
94597
|
const chartTypeKeys = Object.keys(plotArea).filter((k) => getLocalName2(k).endsWith("Chart"));
|
|
94098
94598
|
for (const ctKey of chartTypeKeys) {
|
|
94099
|
-
const
|
|
94100
|
-
if (!
|
|
94599
|
+
const container2 = plotArea[ctKey];
|
|
94600
|
+
if (!container2 || typeof container2 !== "object") {
|
|
94101
94601
|
continue;
|
|
94102
94602
|
}
|
|
94103
|
-
const existingKey = findKey16(
|
|
94603
|
+
const existingKey = findKey16(container2, "dLbls", getLocalName2);
|
|
94104
94604
|
if (style.hasDataLabels === false) {
|
|
94105
|
-
const existing2 = existingKey ?
|
|
94605
|
+
const existing2 = existingKey ? container2[existingKey] : void 0;
|
|
94106
94606
|
const off = ordered3(existing2, { "c:delete": { "@_val": "1" } }, getLocalName2);
|
|
94107
94607
|
if (existingKey) {
|
|
94108
|
-
|
|
94608
|
+
container2[existingKey] = off;
|
|
94109
94609
|
} else {
|
|
94110
|
-
insertAfterLastSeries(
|
|
94610
|
+
insertAfterLastSeries(container2, off, getLocalName2);
|
|
94111
94611
|
}
|
|
94112
94612
|
continue;
|
|
94113
94613
|
}
|
|
94114
94614
|
const opts = style.dataLabels ?? {};
|
|
94115
94615
|
const anyFlag = opts.showValue || opts.showCategory || opts.showSeriesName || opts.showPercent || opts.showLegendKey || opts.showBubbleSize;
|
|
94116
94616
|
const effective = anyFlag ? opts : { ...opts, showValue: true };
|
|
94117
|
-
const existing = existingKey ?
|
|
94617
|
+
const existing = existingKey ? container2[existingKey] : void 0;
|
|
94118
94618
|
const built = buildDLbls(existing, effective, getLocalName2);
|
|
94119
94619
|
applyDataLabelsRangeToDLbls(
|
|
94120
94620
|
built,
|
|
@@ -94123,9 +94623,9 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
94123
94623
|
getLocalName2
|
|
94124
94624
|
);
|
|
94125
94625
|
if (existingKey) {
|
|
94126
|
-
|
|
94626
|
+
container2[existingKey] = built;
|
|
94127
94627
|
} else {
|
|
94128
|
-
insertAfterLastSeries(
|
|
94628
|
+
insertAfterLastSeries(container2, built, getLocalName2);
|
|
94129
94629
|
}
|
|
94130
94630
|
}
|
|
94131
94631
|
}
|
|
@@ -95120,54 +95620,54 @@ function axisFormatting(chartData, type, id, index = 0) {
|
|
|
95120
95620
|
return chartData.axes?.find((axis) => axis.axisId === id) ?? chartData.axes?.filter((axis) => axis.axisType === type)[index];
|
|
95121
95621
|
}
|
|
95122
95622
|
function buildChartTypeContainer(chartData, family) {
|
|
95123
|
-
const
|
|
95623
|
+
const container2 = {};
|
|
95124
95624
|
if (family === "bar") {
|
|
95125
|
-
|
|
95126
|
-
|
|
95625
|
+
container2["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
|
|
95626
|
+
container2["c:grouping"] = {
|
|
95127
95627
|
"@_val": chartData.groupingStandard && (chartData.grouping ?? "clustered") === "clustered" ? "standard" : chartData.grouping ?? "clustered"
|
|
95128
95628
|
};
|
|
95129
|
-
|
|
95629
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
95130
95630
|
} else if (family === "line" || family === "area") {
|
|
95131
|
-
|
|
95132
|
-
|
|
95631
|
+
container2["c:grouping"] = { "@_val": chartData.grouping ?? "standard" };
|
|
95632
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
95133
95633
|
} else if (family === "radar") {
|
|
95134
|
-
|
|
95135
|
-
|
|
95634
|
+
container2["c:radarStyle"] = { "@_val": chartData.radarStyle ?? "marker" };
|
|
95635
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
95136
95636
|
} else if (family === "scatter") {
|
|
95137
|
-
|
|
95138
|
-
|
|
95637
|
+
container2["c:scatterStyle"] = { "@_val": "lineMarker" };
|
|
95638
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
95139
95639
|
} else if (family === "ofPie") {
|
|
95140
|
-
|
|
95141
|
-
|
|
95640
|
+
container2["c:ofPieType"] = { "@_val": "pie" };
|
|
95641
|
+
container2["c:varyColors"] = { "@_val": "1" };
|
|
95142
95642
|
} else if (family === "stock") ; else if (family === "surface") {
|
|
95143
|
-
|
|
95643
|
+
container2["c:wireframe"] = { "@_val": chartData.wireframe === false ? "0" : "1" };
|
|
95144
95644
|
} else {
|
|
95145
|
-
|
|
95645
|
+
container2["c:varyColors"] = { "@_val": family === "bubble" ? "0" : "1" };
|
|
95146
95646
|
}
|
|
95147
|
-
|
|
95647
|
+
container2["c:ser"] = chartData.series.map(
|
|
95148
95648
|
(s, i) => buildSeries(family, s, i, chartData.categories, chartData.dateCategories)
|
|
95149
95649
|
);
|
|
95150
95650
|
if (family === "bubble" && chartData.bubbleOptions) {
|
|
95151
|
-
applyBubbleChartOptions(
|
|
95651
|
+
applyBubbleChartOptions(container2, chartData.bubbleOptions, (key2) => key2.replace(/^.*:/u, ""));
|
|
95152
95652
|
}
|
|
95153
95653
|
if (family === "line" && chartData.upDownBars !== void 0) {
|
|
95154
|
-
applyChartUpDownBars(
|
|
95654
|
+
applyChartUpDownBars(container2, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
|
|
95155
95655
|
}
|
|
95156
95656
|
if (family === "bar" || family === "ofPie") {
|
|
95157
|
-
|
|
95657
|
+
container2["c:gapWidth"] = { "@_val": "150" };
|
|
95158
95658
|
}
|
|
95159
95659
|
if (family === "bar" && chartData.chartType === "bar3D" && chartData.barShape) {
|
|
95160
|
-
|
|
95660
|
+
container2["c:shape"] = { "@_val": chartData.barShape };
|
|
95161
95661
|
}
|
|
95162
95662
|
if (family === "stock") {
|
|
95163
|
-
|
|
95663
|
+
container2["c:hiLowLines"] = {};
|
|
95164
95664
|
}
|
|
95165
95665
|
if (family === "bar" || family === "line" || family === "area" || family === "radar" || family === "scatter" || family === "bubble" || family === "stock" || family === "surface") {
|
|
95166
|
-
|
|
95666
|
+
container2["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
|
|
95167
95667
|
} else if (family === "doughnut") {
|
|
95168
|
-
|
|
95668
|
+
container2["c:holeSize"] = { "@_val": "50" };
|
|
95169
95669
|
}
|
|
95170
|
-
return
|
|
95670
|
+
return container2;
|
|
95171
95671
|
}
|
|
95172
95672
|
function buildPlotArea(chartData, tag, family) {
|
|
95173
95673
|
const plotArea = { "c:layout": {} };
|
|
@@ -95521,8 +96021,8 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
95521
96021
|
continue;
|
|
95522
96022
|
}
|
|
95523
96023
|
const sourceData = codec.parse(sourceXml);
|
|
95524
|
-
const
|
|
95525
|
-
if (!
|
|
96024
|
+
const container2 = getContainer(sourceData, scope.location);
|
|
96025
|
+
if (!container2) {
|
|
95526
96026
|
continue;
|
|
95527
96027
|
}
|
|
95528
96028
|
const relsPath2 = relsForSourcePart(scope.sourcePartPath);
|
|
@@ -95557,9 +96057,9 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
95557
96057
|
authoredEntries.push(rawEntry);
|
|
95558
96058
|
contentTypes2.set(path2, entry.contentType);
|
|
95559
96059
|
}
|
|
95560
|
-
const existingList =
|
|
96060
|
+
const existingList = container2["p:custDataLst"] ?? {};
|
|
95561
96061
|
existingList["p:custData"] = authoredEntries;
|
|
95562
|
-
placeCustomerDataList(
|
|
96062
|
+
placeCustomerDataList(container2, existingList, scope.location);
|
|
95563
96063
|
relsRoot["Relationship"] = relationships2;
|
|
95564
96064
|
zip.file(relsPath2, codec.build(relsData));
|
|
95565
96065
|
zip.file(scope.sourcePartPath, codec.build(sourceData));
|
|
@@ -95609,11 +96109,11 @@ function upsertRelationship(relationships2, entry, target) {
|
|
|
95609
96109
|
function isCustomXmlRelationship(value) {
|
|
95610
96110
|
return String(value ?? "").endsWith("/relationships/customXml");
|
|
95611
96111
|
}
|
|
95612
|
-
function placeCustomerDataList(
|
|
96112
|
+
function placeCustomerDataList(container2, list2, location) {
|
|
95613
96113
|
const insertBefore3 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
|
|
95614
96114
|
const rebuilt = {};
|
|
95615
96115
|
let inserted = false;
|
|
95616
|
-
for (const [key2, value] of Object.entries(
|
|
96116
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
95617
96117
|
if (key2 === "p:custDataLst") {
|
|
95618
96118
|
continue;
|
|
95619
96119
|
}
|
|
@@ -95626,10 +96126,10 @@ function placeCustomerDataList(container, list2, location) {
|
|
|
95626
96126
|
if (!inserted) {
|
|
95627
96127
|
rebuilt["p:custDataLst"] = list2;
|
|
95628
96128
|
}
|
|
95629
|
-
for (const key2 of Object.keys(
|
|
95630
|
-
delete
|
|
96129
|
+
for (const key2 of Object.keys(container2)) {
|
|
96130
|
+
delete container2[key2];
|
|
95631
96131
|
}
|
|
95632
|
-
Object.assign(
|
|
96132
|
+
Object.assign(container2, rebuilt);
|
|
95633
96133
|
}
|
|
95634
96134
|
async function upsertContentTypes(zip, codec, contentTypes2) {
|
|
95635
96135
|
const xml = await zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -95705,10 +96205,10 @@ function resolveTagsContainer(data) {
|
|
|
95705
96205
|
}
|
|
95706
96206
|
return void 0;
|
|
95707
96207
|
}
|
|
95708
|
-
function placeAtKey(
|
|
96208
|
+
function placeAtKey(container2, key2, value, insertBefore3) {
|
|
95709
96209
|
const rebuilt = {};
|
|
95710
96210
|
let inserted = false;
|
|
95711
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
96211
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
95712
96212
|
if (childKey3 === key2) {
|
|
95713
96213
|
continue;
|
|
95714
96214
|
}
|
|
@@ -95721,10 +96221,10 @@ function placeAtKey(container, key2, value, insertBefore3) {
|
|
|
95721
96221
|
if (!inserted) {
|
|
95722
96222
|
rebuilt[key2] = value;
|
|
95723
96223
|
}
|
|
95724
|
-
for (const existingKey of Object.keys(
|
|
95725
|
-
delete
|
|
96224
|
+
for (const existingKey of Object.keys(container2)) {
|
|
96225
|
+
delete container2[existingKey];
|
|
95726
96226
|
}
|
|
95727
|
-
Object.assign(
|
|
96227
|
+
Object.assign(container2, rebuilt);
|
|
95728
96228
|
}
|
|
95729
96229
|
async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipId2) {
|
|
95730
96230
|
const xml = await zip.file(sourcePartPath)?.async("string");
|
|
@@ -95736,10 +96236,10 @@ async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipI
|
|
|
95736
96236
|
if (!resolved) {
|
|
95737
96237
|
return;
|
|
95738
96238
|
}
|
|
95739
|
-
const { container, insertBefore: insertBefore3 } = resolved;
|
|
95740
|
-
const list2 = { ...
|
|
96239
|
+
const { container: container2, insertBefore: insertBefore3 } = resolved;
|
|
96240
|
+
const list2 = { ...container2["p:custDataLst"] ?? {} };
|
|
95741
96241
|
list2["p:tags"] = { "@_r:id": relationshipId2 };
|
|
95742
|
-
placeAtKey(
|
|
96242
|
+
placeAtKey(container2, "p:custDataLst", list2, insertBefore3);
|
|
95743
96243
|
zip.file(sourcePartPath, codec.build(data));
|
|
95744
96244
|
}
|
|
95745
96245
|
async function removeTagsOwningElement(zip, codec, sourcePartPath) {
|
|
@@ -96256,21 +96756,21 @@ function normalizeGroupingNode(containerLocal, node) {
|
|
|
96256
96756
|
node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
|
|
96257
96757
|
}
|
|
96258
96758
|
}
|
|
96259
|
-
function normalizeChartContainerChildren(
|
|
96759
|
+
function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
96260
96760
|
if (!isKnownChartContainer(containerLocal)) {
|
|
96261
96761
|
return;
|
|
96262
96762
|
}
|
|
96263
|
-
for (const key2 of Object.keys(
|
|
96763
|
+
for (const key2 of Object.keys(container2)) {
|
|
96264
96764
|
if (key2.startsWith("@_") || key2 === "#text") {
|
|
96265
96765
|
continue;
|
|
96266
96766
|
}
|
|
96267
96767
|
const local = getLocalName2(key2);
|
|
96268
96768
|
if (!chartContainerAllows(containerLocal, local)) {
|
|
96269
|
-
delete
|
|
96769
|
+
delete container2[key2];
|
|
96270
96770
|
continue;
|
|
96271
96771
|
}
|
|
96272
96772
|
if (local === "grouping") {
|
|
96273
|
-
const node =
|
|
96773
|
+
const node = container2[key2];
|
|
96274
96774
|
if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
96275
96775
|
normalizeGroupingNode(containerLocal, node);
|
|
96276
96776
|
}
|
|
@@ -96278,18 +96778,18 @@ function normalizeChartContainerChildren(container, containerLocal, getLocalName
|
|
|
96278
96778
|
}
|
|
96279
96779
|
const required = REQUIRED_LEADING_CHILD[containerLocal];
|
|
96280
96780
|
if (required) {
|
|
96281
|
-
const present = Object.keys(
|
|
96781
|
+
const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
|
|
96282
96782
|
if (!present) {
|
|
96283
|
-
|
|
96783
|
+
container2[`c:${required.local}`] = { "@_val": required.val };
|
|
96284
96784
|
}
|
|
96285
96785
|
}
|
|
96286
96786
|
}
|
|
96287
|
-
function orderChartContainerChildren(
|
|
96787
|
+
function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
96288
96788
|
const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
|
|
96289
96789
|
if (!order) {
|
|
96290
96790
|
return;
|
|
96291
96791
|
}
|
|
96292
|
-
const keys = Object.keys(
|
|
96792
|
+
const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
|
|
96293
96793
|
if (keys.some((k) => !order.includes(getLocalName2(k)))) {
|
|
96294
96794
|
return;
|
|
96295
96795
|
}
|
|
@@ -96299,12 +96799,12 @@ function orderChartContainerChildren(container, containerLocal, getLocalName2) {
|
|
|
96299
96799
|
if (sorted.every((k, i) => k === keys[i])) {
|
|
96300
96800
|
return;
|
|
96301
96801
|
}
|
|
96302
|
-
const saved = sorted.map((k) => [k,
|
|
96802
|
+
const saved = sorted.map((k) => [k, container2[k]]);
|
|
96303
96803
|
for (const k of keys) {
|
|
96304
|
-
delete
|
|
96804
|
+
delete container2[k];
|
|
96305
96805
|
}
|
|
96306
96806
|
for (const [k, v] of saved) {
|
|
96307
|
-
|
|
96807
|
+
container2[k] = v;
|
|
96308
96808
|
}
|
|
96309
96809
|
}
|
|
96310
96810
|
function renameXmlKeyInPlace(obj, oldKey, newKey) {
|
|
@@ -96325,12 +96825,12 @@ function referencedAxisIds(plotArea, getLocalName2) {
|
|
|
96325
96825
|
if (!getLocalName2(key2).endsWith("Chart")) {
|
|
96326
96826
|
continue;
|
|
96327
96827
|
}
|
|
96328
|
-
for (const
|
|
96329
|
-
for (const childKey3 of Object.keys(
|
|
96828
|
+
for (const container2 of toArray2(plotArea[key2])) {
|
|
96829
|
+
for (const childKey3 of Object.keys(container2)) {
|
|
96330
96830
|
if (getLocalName2(childKey3) !== "axId") {
|
|
96331
96831
|
continue;
|
|
96332
96832
|
}
|
|
96333
|
-
for (const axId of toArray2(
|
|
96833
|
+
for (const axId of toArray2(container2[childKey3])) {
|
|
96334
96834
|
const val = axId["@_val"];
|
|
96335
96835
|
if (val !== void 0) {
|
|
96336
96836
|
ids.add(String(val));
|
|
@@ -96381,8 +96881,8 @@ var init_chart_container_schema = __esm({
|
|
|
96381
96881
|
function findKey22(obj, local, getLocalName2) {
|
|
96382
96882
|
return Object.keys(obj).find((k) => getLocalName2(k) === local);
|
|
96383
96883
|
}
|
|
96384
|
-
function nonSeriesEntries(
|
|
96385
|
-
return Object.keys(
|
|
96884
|
+
function nonSeriesEntries(container2, getLocalName2) {
|
|
96885
|
+
return Object.keys(container2).filter((k) => getLocalName2(k) !== "ser").map((k) => [k, container2[k]]);
|
|
96386
96886
|
}
|
|
96387
96887
|
function ensureArray17(v) {
|
|
96388
96888
|
if (v === void 0) {
|
|
@@ -96398,9 +96898,9 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
96398
96898
|
const primaryKey = containerKeys[0];
|
|
96399
96899
|
const containerChildren = /* @__PURE__ */ new Map();
|
|
96400
96900
|
for (const key2 of containerKeys) {
|
|
96401
|
-
const
|
|
96402
|
-
if (
|
|
96403
|
-
containerChildren.set(getLocalName2(key2), nonSeriesEntries(
|
|
96901
|
+
const container2 = plotArea[key2];
|
|
96902
|
+
if (container2) {
|
|
96903
|
+
containerChildren.set(getLocalName2(key2), nonSeriesEntries(container2, getLocalName2));
|
|
96404
96904
|
}
|
|
96405
96905
|
}
|
|
96406
96906
|
if (containerKeys.length === 1) {
|
|
@@ -96413,13 +96913,13 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
96413
96913
|
const serKey = findKey22(primary, "ser", getLocalName2) ?? "c:ser";
|
|
96414
96914
|
const allSeries = [];
|
|
96415
96915
|
for (const key2 of containerKeys) {
|
|
96416
|
-
const
|
|
96417
|
-
if (!
|
|
96916
|
+
const container2 = plotArea[key2];
|
|
96917
|
+
if (!container2) {
|
|
96418
96918
|
continue;
|
|
96419
96919
|
}
|
|
96420
|
-
const containerSerKey = findKey22(
|
|
96920
|
+
const containerSerKey = findKey22(container2, "ser", getLocalName2);
|
|
96421
96921
|
if (containerSerKey) {
|
|
96422
|
-
allSeries.push(...ensureArray17(
|
|
96922
|
+
allSeries.push(...ensureArray17(container2[containerSerKey]));
|
|
96423
96923
|
}
|
|
96424
96924
|
if (key2 !== primaryKey) {
|
|
96425
96925
|
delete plotArea[key2];
|
|
@@ -96466,21 +96966,21 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
96466
96966
|
const at2 = keys.indexOf(originalKey);
|
|
96467
96967
|
const newEntries = [];
|
|
96468
96968
|
for (const local of groupOrder) {
|
|
96469
|
-
const
|
|
96969
|
+
const container2 = {};
|
|
96470
96970
|
for (const [k, v] of originalChildren?.get(local) ?? fallbackEntries) {
|
|
96471
|
-
|
|
96971
|
+
container2[k] = JSON.parse(JSON.stringify(v));
|
|
96472
96972
|
}
|
|
96473
96973
|
const grouped = groups.get(local);
|
|
96474
|
-
|
|
96974
|
+
container2[serKey] = grouped.length === 1 ? grouped[0] : grouped;
|
|
96475
96975
|
applyGroupAxisReferences(
|
|
96476
|
-
|
|
96976
|
+
container2,
|
|
96477
96977
|
series.filter((_item, index) => resolved[index] === local),
|
|
96478
96978
|
axes,
|
|
96479
96979
|
getLocalName2
|
|
96480
96980
|
);
|
|
96481
|
-
normalizeChartContainerChildren(
|
|
96482
|
-
orderChartContainerChildren(
|
|
96483
|
-
newEntries.push([`c:${local}`,
|
|
96981
|
+
normalizeChartContainerChildren(container2, local, getLocalName2);
|
|
96982
|
+
orderChartContainerChildren(container2, local, getLocalName2);
|
|
96983
|
+
newEntries.push([`c:${local}`, container2]);
|
|
96484
96984
|
}
|
|
96485
96985
|
entries.splice(at2, 1, ...newEntries);
|
|
96486
96986
|
for (const k of keys) {
|
|
@@ -96491,7 +96991,7 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
96491
96991
|
}
|
|
96492
96992
|
return true;
|
|
96493
96993
|
}
|
|
96494
|
-
function applyGroupAxisReferences(
|
|
96994
|
+
function applyGroupAxisReferences(container2, series, axes, getLocalName2) {
|
|
96495
96995
|
const axisIds = new Set(series.map((item) => item.axisId).filter((id) => id !== void 0));
|
|
96496
96996
|
if (axisIds.size !== 1) {
|
|
96497
96997
|
return;
|
|
@@ -96502,8 +97002,8 @@ function applyGroupAxisReferences(container, series, axes, getLocalName2) {
|
|
|
96502
97002
|
if (valueAxisId === void 0 || categoryAxisId === void 0) {
|
|
96503
97003
|
return;
|
|
96504
97004
|
}
|
|
96505
|
-
const key2 = findKey22(
|
|
96506
|
-
|
|
97005
|
+
const key2 = findKey22(container2, "axId", getLocalName2) ?? "c:axId";
|
|
97006
|
+
container2[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
|
|
96507
97007
|
}
|
|
96508
97008
|
var init_chart_combo_serializer = __esm({
|
|
96509
97009
|
"src/pptx/core/utils/chart-combo-serializer.ts"() {
|
|
@@ -96556,8 +97056,8 @@ function buildFilteredSerNode(entry, categories) {
|
|
|
96556
97056
|
}
|
|
96557
97057
|
return node;
|
|
96558
97058
|
}
|
|
96559
|
-
function filteredSeriesUnchanged(
|
|
96560
|
-
const existing = parseFilteredSeries(
|
|
97059
|
+
function filteredSeriesUnchanged(container2, filteredSeries, xmlLookup) {
|
|
97060
|
+
const existing = parseFilteredSeries(container2, xmlLookup);
|
|
96561
97061
|
if (!filteredSeries || filteredSeries.length === 0) {
|
|
96562
97062
|
return !existing || existing.length === 0;
|
|
96563
97063
|
}
|
|
@@ -96569,9 +97069,9 @@ function filteredSeriesUnchanged(container, filteredSeries, xmlLookup) {
|
|
|
96569
97069
|
return entry.idx === other.idx && entry.order === other.order && entry.name === other.name && entry.uniqueId === other.uniqueId && JSON.stringify(entry.values ?? null) === JSON.stringify(other.values ?? null) && JSON.stringify(entry.categories ?? null) === JSON.stringify(other.categories ?? null);
|
|
96570
97070
|
});
|
|
96571
97071
|
}
|
|
96572
|
-
function applyFilteredSeriesToXml(
|
|
96573
|
-
const extLstKey = findKey23(
|
|
96574
|
-
const extLst = { ...
|
|
97072
|
+
function applyFilteredSeriesToXml(container2, filteredSeries, categories, containerLocalName, getLocalName2) {
|
|
97073
|
+
const extLstKey = findKey23(container2, "extLst", getLocalName2) ?? "c:extLst";
|
|
97074
|
+
const extLst = { ...container2[extLstKey] ?? {} };
|
|
96575
97075
|
const extKey = findKey23(extLst, "ext", getLocalName2);
|
|
96576
97076
|
const exts = extKey ? Array.isArray(extLst[extKey]) ? [...extLst[extKey]] : [extLst[extKey]] : [];
|
|
96577
97077
|
const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART_FILTERED_SERIES_EXT_URI);
|
|
@@ -96596,11 +97096,11 @@ function applyFilteredSeriesToXml(container, filteredSeries, categories, contain
|
|
|
96596
97096
|
);
|
|
96597
97097
|
const newExts = ownExtHasContent ? [...otherExts, ownExt] : otherExts;
|
|
96598
97098
|
if (newExts.length === 0) {
|
|
96599
|
-
delete
|
|
97099
|
+
delete container2[extLstKey];
|
|
96600
97100
|
return;
|
|
96601
97101
|
}
|
|
96602
97102
|
extLst[extKey ?? "c:ext"] = newExts.length === 1 ? newExts[0] : newExts;
|
|
96603
|
-
|
|
97103
|
+
container2[extLstKey] = extLst;
|
|
96604
97104
|
}
|
|
96605
97105
|
var init_chart_filtered_series_writer = __esm({
|
|
96606
97106
|
"src/pptx/core/utils/chart-filtered-series-writer.ts"() {
|
|
@@ -97402,11 +97902,11 @@ var init_chart_title_style_serializer = __esm({
|
|
|
97402
97902
|
};
|
|
97403
97903
|
}
|
|
97404
97904
|
});
|
|
97405
|
-
function collectChartWorkbookWrite(xmlLookupService,
|
|
97406
|
-
if (!
|
|
97905
|
+
function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric, values) {
|
|
97906
|
+
if (!container2) {
|
|
97407
97907
|
return void 0;
|
|
97408
97908
|
}
|
|
97409
|
-
const refNode = xmlLookupService.getChildByLocalName(
|
|
97909
|
+
const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric ? "numRef" : "strRef");
|
|
97410
97910
|
const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
|
|
97411
97911
|
return formula ? { formula, isNumeric, values } : void 0;
|
|
97412
97912
|
}
|
|
@@ -98169,12 +98669,12 @@ function applyPicAltText(node, altText) {
|
|
|
98169
98669
|
}
|
|
98170
98670
|
function applyChildXfrmToRawNode(node, off, ext) {
|
|
98171
98671
|
const spPrKey = findChildKey2(node, "spPr");
|
|
98172
|
-
const
|
|
98173
|
-
const xfrmKey = findChildKey2(
|
|
98672
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
98673
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
98174
98674
|
if (!xfrmKey) {
|
|
98175
98675
|
return;
|
|
98176
98676
|
}
|
|
98177
|
-
const xfrm =
|
|
98677
|
+
const xfrm = container2[xfrmKey];
|
|
98178
98678
|
const offKey = findChildKey2(xfrm, "off") ?? "a:off";
|
|
98179
98679
|
const extKey = findChildKey2(xfrm, "ext") ?? "a:ext";
|
|
98180
98680
|
xfrm[offKey] = { "@_x": String(Math.round(off.x)), "@_y": String(Math.round(off.y)) };
|
|
@@ -98182,13 +98682,13 @@ function applyChildXfrmToRawNode(node, off, ext) {
|
|
|
98182
98682
|
}
|
|
98183
98683
|
function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
98184
98684
|
const spPrKey = findChildKey2(node, "spPr");
|
|
98185
|
-
const
|
|
98186
|
-
const xfrmKey = findChildKey2(
|
|
98685
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
98686
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
98187
98687
|
const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
98188
98688
|
if (!xfrmKey && !hasAny) {
|
|
98189
98689
|
return;
|
|
98190
98690
|
}
|
|
98191
|
-
const xfrm = xfrmKey ?
|
|
98691
|
+
const xfrm = xfrmKey ? container2[xfrmKey] : {};
|
|
98192
98692
|
if (rotation) {
|
|
98193
98693
|
xfrm["@_rot"] = String(Math.round(rotation * 6e4));
|
|
98194
98694
|
} else {
|
|
@@ -98204,9 +98704,9 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
|
98204
98704
|
} else {
|
|
98205
98705
|
delete xfrm["@_flipV"];
|
|
98206
98706
|
}
|
|
98207
|
-
|
|
98707
|
+
container2[xfrmKey ?? "a:xfrm"] = xfrm;
|
|
98208
98708
|
if (spPrKey) {
|
|
98209
|
-
node[spPrKey] =
|
|
98709
|
+
node[spPrKey] = container2;
|
|
98210
98710
|
}
|
|
98211
98711
|
}
|
|
98212
98712
|
var init_chart_user_shapes_raw_patch = __esm({
|
|
@@ -98556,8 +99056,8 @@ var init_placeholder_remap = __esm({
|
|
|
98556
99056
|
|
|
98557
99057
|
// src/pptx/core/utils/placeholder-xml.ts
|
|
98558
99058
|
function findNonVisualProps(rawXml) {
|
|
98559
|
-
for (const
|
|
98560
|
-
const parent = rawXml[
|
|
99059
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
99060
|
+
const parent = rawXml[container2];
|
|
98561
99061
|
const nvPr = parent?.["p:nvPr"];
|
|
98562
99062
|
if (nvPr) {
|
|
98563
99063
|
return nvPr;
|
|
@@ -101448,9 +101948,9 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
101448
101948
|
}
|
|
101449
101949
|
return;
|
|
101450
101950
|
}
|
|
101451
|
-
const
|
|
101452
|
-
if (
|
|
101453
|
-
|
|
101951
|
+
const container2 = existing ?? resolveLockContainerNode(shape, spec, true);
|
|
101952
|
+
if (container2) {
|
|
101953
|
+
container2[spec.lockTag] = next;
|
|
101454
101954
|
}
|
|
101455
101955
|
}
|
|
101456
101956
|
};
|
|
@@ -101957,8 +102457,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
101957
102457
|
if (cTn) {
|
|
101958
102458
|
const childTnLst = cTn["p:childTnLst"];
|
|
101959
102459
|
if (childTnLst) {
|
|
101960
|
-
for (const
|
|
101961
|
-
const children14 = this.ensureArray(childTnLst[
|
|
102460
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
102461
|
+
const children14 = this.ensureArray(childTnLst[container2]);
|
|
101962
102462
|
for (const child27 of children14) {
|
|
101963
102463
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
101964
102464
|
}
|
|
@@ -101966,8 +102466,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
101966
102466
|
this.walkMediaTimingTree(childTnLst, result, slidePath);
|
|
101967
102467
|
}
|
|
101968
102468
|
}
|
|
101969
|
-
for (const
|
|
101970
|
-
const children14 = this.ensureArray(node[
|
|
102469
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
102470
|
+
const children14 = this.ensureArray(node[container2]);
|
|
101971
102471
|
for (const child27 of children14) {
|
|
101972
102472
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
101973
102473
|
}
|
|
@@ -103132,8 +103632,8 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
|
|
|
103132
103632
|
* `<a:noFill/>` parses to the empty STRING, so presence - not truthiness -
|
|
103133
103633
|
* has to decide.
|
|
103134
103634
|
*/
|
|
103135
|
-
parseChartContainerFill(
|
|
103136
|
-
const shapeProperties = this.xmlLookupService.getChildByLocalName(
|
|
103635
|
+
parseChartContainerFill(container2) {
|
|
103636
|
+
const shapeProperties = this.xmlLookupService.getChildByLocalName(container2, "spPr");
|
|
103137
103637
|
if (!shapeProperties) {
|
|
103138
103638
|
return void 0;
|
|
103139
103639
|
}
|
|
@@ -109057,10 +109557,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
109057
109557
|
if (!local.endsWith("Chart")) {
|
|
109058
109558
|
continue;
|
|
109059
109559
|
}
|
|
109060
|
-
const
|
|
109061
|
-
if (
|
|
109560
|
+
const container2 = plotArea[key2];
|
|
109561
|
+
if (container2) {
|
|
109062
109562
|
orderChartContainerChildren(
|
|
109063
|
-
|
|
109563
|
+
container2,
|
|
109064
109564
|
local,
|
|
109065
109565
|
(k) => this.compatibilityService.getXmlLocalName(k)
|
|
109066
109566
|
);
|
|
@@ -109139,8 +109639,8 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
109139
109639
|
* when the container has no formula reference (e.g. a brand-new series
|
|
109140
109640
|
* built without one), so it is always safe to call.
|
|
109141
109641
|
*/
|
|
109142
|
-
pushChartWorkbookWrite(workbookWrites,
|
|
109143
|
-
const write = collectChartWorkbookWrite(this.xmlLookupService,
|
|
109642
|
+
pushChartWorkbookWrite(workbookWrites, container2, isNumeric, values) {
|
|
109643
|
+
const write = collectChartWorkbookWrite(this.xmlLookupService, container2, isNumeric, values);
|
|
109144
109644
|
if (write) {
|
|
109145
109645
|
workbookWrites.push(write);
|
|
109146
109646
|
}
|
|
@@ -109149,17 +109649,17 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
109149
109649
|
* Update the cached point values in a chart reference node
|
|
109150
109650
|
* (numRef/strRef or numLit/strLit).
|
|
109151
109651
|
*/
|
|
109152
|
-
updateChartCacheValues(
|
|
109652
|
+
updateChartCacheValues(container2, isNumeric, values) {
|
|
109153
109653
|
const refName = isNumeric ? "numRef" : "strRef";
|
|
109154
109654
|
const litName = isNumeric ? "numLit" : "strLit";
|
|
109155
109655
|
const cacheName = isNumeric ? "numCache" : "strCache";
|
|
109156
|
-
const refNode = this.xmlLookupService.getChildByLocalName(
|
|
109656
|
+
const refNode = this.xmlLookupService.getChildByLocalName(container2, refName) || this.xmlLookupService.getChildByLocalName(container2, litName);
|
|
109157
109657
|
if (!refNode) {
|
|
109158
|
-
const literalKey = Object.keys(
|
|
109658
|
+
const literalKey = Object.keys(container2).find(
|
|
109159
109659
|
(key2) => this.compatibilityService.getXmlLocalName(key2) === "v"
|
|
109160
109660
|
);
|
|
109161
109661
|
if (literalKey && values.length === 1) {
|
|
109162
|
-
|
|
109662
|
+
container2[literalKey] = values[0];
|
|
109163
109663
|
}
|
|
109164
109664
|
return;
|
|
109165
109665
|
}
|
|
@@ -116411,9 +116911,9 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
|
|
|
116411
116911
|
}
|
|
116412
116912
|
byPart.set(partPath, positions);
|
|
116413
116913
|
}
|
|
116414
|
-
function withReplacedChild(
|
|
116415
|
-
const existing =
|
|
116416
|
-
const next = { ...
|
|
116914
|
+
function withReplacedChild(container2, tag, indexInType, replacement) {
|
|
116915
|
+
const existing = container2[tag];
|
|
116916
|
+
const next = { ...container2 };
|
|
116417
116917
|
if (Array.isArray(existing)) {
|
|
116418
116918
|
const siblings = [...existing];
|
|
116419
116919
|
siblings[indexInType] = replacement;
|
|
@@ -116423,8 +116923,8 @@ function withReplacedChild(container, tag, indexInType, replacement) {
|
|
|
116423
116923
|
}
|
|
116424
116924
|
return next;
|
|
116425
116925
|
}
|
|
116426
|
-
function orderContainer(
|
|
116427
|
-
let working =
|
|
116926
|
+
function orderContainer(container2, plan, getLocalName2) {
|
|
116927
|
+
let working = container2;
|
|
116428
116928
|
for (const entry of plan) {
|
|
116429
116929
|
if (entry.children.length === 0) {
|
|
116430
116930
|
continue;
|
|
@@ -120640,8 +121140,8 @@ function asRuns(value) {
|
|
|
120640
121140
|
function withSplit(authored, inherited) {
|
|
120641
121141
|
return { ...inherited, ...authored, authoredRunStyle: authored, inheritedRunStyle: inherited };
|
|
120642
121142
|
}
|
|
120643
|
-
function readRuns(
|
|
120644
|
-
const runs = asRuns(
|
|
121143
|
+
function readRuns(container2, extract) {
|
|
121144
|
+
const runs = asRuns(container2?.["a:r"]);
|
|
120645
121145
|
const text2 = runs.map((run) => run["a:t"] !== void 0 ? xmlText(run["a:t"]) ?? "" : "").join("");
|
|
120646
121146
|
const first = runs[0];
|
|
120647
121147
|
return {
|
|
@@ -122138,8 +122638,8 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
122138
122638
|
* so the save layer can re-emit the original `<mc:Choice>` /
|
|
122139
122639
|
* `<mc:Fallback>` shape on dirty save (CC-4).
|
|
122140
122640
|
*/
|
|
122141
|
-
unwrapAlternateContent(
|
|
122142
|
-
const blocks = unwrapAlternateContent(
|
|
122641
|
+
unwrapAlternateContent(container2) {
|
|
122642
|
+
const blocks = unwrapAlternateContent(container2);
|
|
122143
122643
|
for (const block of blocks) {
|
|
122144
122644
|
for (const ref of block.childRefs) {
|
|
122145
122645
|
this.alternateContentBlockByRawXml.set(ref.node, block);
|
|
@@ -127224,17 +127724,17 @@ var init_PptxHandlerRuntimeSmartArtParsing = __esm({
|
|
|
127224
127724
|
// src/pptx/core/core/runtime/smartart-drawing-blip.ts
|
|
127225
127725
|
function collectDrawingShapeNodes(root, getChildren) {
|
|
127226
127726
|
const out = [];
|
|
127227
|
-
const walk3 = (
|
|
127228
|
-
if (!
|
|
127727
|
+
const walk3 = (container2) => {
|
|
127728
|
+
if (!container2) {
|
|
127229
127729
|
return;
|
|
127230
127730
|
}
|
|
127231
|
-
for (const sp of getChildren(
|
|
127731
|
+
for (const sp of getChildren(container2, "sp")) {
|
|
127232
127732
|
out.push({ node: sp, isPic: false });
|
|
127233
127733
|
}
|
|
127234
|
-
for (const pic of getChildren(
|
|
127734
|
+
for (const pic of getChildren(container2, "pic")) {
|
|
127235
127735
|
out.push({ node: pic, isPic: true });
|
|
127236
127736
|
}
|
|
127237
|
-
for (const grp of getChildren(
|
|
127737
|
+
for (const grp of getChildren(container2, "grpSp")) {
|
|
127238
127738
|
walk3(grp);
|
|
127239
127739
|
}
|
|
127240
127740
|
};
|
|
@@ -128743,13 +129243,13 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
128743
129243
|
let filteredSeriesTitle;
|
|
128744
129244
|
let filteredCategoryTitle;
|
|
128745
129245
|
for (const containerKey of containerKeys) {
|
|
128746
|
-
const
|
|
128747
|
-
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(
|
|
128748
|
-
const containerFilteredSeries = parseFilteredSeries(
|
|
129246
|
+
const container2 = plotArea[containerKey];
|
|
129247
|
+
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(container2, "ser");
|
|
129248
|
+
const containerFilteredSeries = parseFilteredSeries(container2, this.xmlLookupService);
|
|
128749
129249
|
if (containerFilteredSeries) {
|
|
128750
129250
|
filteredSeries = [...filteredSeries ?? [], ...containerFilteredSeries];
|
|
128751
129251
|
}
|
|
128752
|
-
const containerFilteredTitles = parseFilteredTitles(
|
|
129252
|
+
const containerFilteredTitles = parseFilteredTitles(container2, this.xmlLookupService);
|
|
128753
129253
|
if (containerFilteredTitles?.seriesTitle && filteredSeriesTitle === void 0) {
|
|
128754
129254
|
filteredSeriesTitle = containerFilteredTitles.seriesTitle;
|
|
128755
129255
|
}
|
|
@@ -128776,7 +129276,7 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
128776
129276
|
this.compatibilityService.getXmlLocalName(containerKey)
|
|
128777
129277
|
);
|
|
128778
129278
|
const containerType = isCombo ? resolvedContainerType : void 0;
|
|
128779
|
-
const axisId = resolveChartContainerValueAxisId(
|
|
129279
|
+
const axisId = resolveChartContainerValueAxisId(container2, axes ?? [], this.xmlLookupService);
|
|
128780
129280
|
series.push(
|
|
128781
129281
|
...this.buildChartSeries(
|
|
128782
129282
|
seriesList,
|
|
@@ -128814,8 +129314,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
128814
129314
|
* Read a numeric `@val` from a named child of a chart-type container.
|
|
128815
129315
|
* Returns `undefined` when the child or its `@val` is absent/non-finite.
|
|
128816
129316
|
*/
|
|
128817
|
-
parseChartNumberVal(
|
|
128818
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
129317
|
+
parseChartNumberVal(container2, localName28) {
|
|
129318
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName28);
|
|
128819
129319
|
const raw = node?.["@_val"];
|
|
128820
129320
|
if (raw === void 0 || raw === null || raw === "") {
|
|
128821
129321
|
return void 0;
|
|
@@ -128828,8 +129328,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
128828
129328
|
* A present element with no `@val` follows the OOXML `CT_Boolean` default
|
|
128829
129329
|
* of `true`; `undefined` when the child is absent.
|
|
128830
129330
|
*/
|
|
128831
|
-
parseChartBoolVal(
|
|
128832
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
129331
|
+
parseChartBoolVal(container2, localName28) {
|
|
129332
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName28);
|
|
128833
129333
|
if (!node) {
|
|
128834
129334
|
return void 0;
|
|
128835
129335
|
}
|
|
@@ -129499,7 +129999,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
129499
129999
|
init_ole_embedded_extract();
|
|
129500
130000
|
init_ole_utils();
|
|
129501
130001
|
init_signature_detection();
|
|
129502
|
-
|
|
130002
|
+
init_types4();
|
|
129503
130003
|
init_authored_slide_background();
|
|
129504
130004
|
init_bullet_picture_image_enrichment();
|
|
129505
130005
|
init_PptxHandlerRuntimeEmbeddedFonts();
|
|
@@ -131011,14 +131511,14 @@ var init_text_atoms = __esm({
|
|
|
131011
131511
|
function readCString(view, rec) {
|
|
131012
131512
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
131013
131513
|
}
|
|
131014
|
-
function parseExHyperlinkContainer(view,
|
|
131015
|
-
const atom2 = findChild4(view,
|
|
131514
|
+
function parseExHyperlinkContainer(view, container2) {
|
|
131515
|
+
const atom2 = findChild4(view, container2, RT.ExternalHyperlinkAtom);
|
|
131016
131516
|
if (!atom2 || atom2.recLen < 4) {
|
|
131017
131517
|
return void 0;
|
|
131018
131518
|
}
|
|
131019
131519
|
const id = view.getUint32(atom2.dataOffset, true);
|
|
131020
131520
|
const strings2 = {};
|
|
131021
|
-
for (const child27 of iterateChildren(view,
|
|
131521
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
131022
131522
|
if (child27.recType !== RT.CString) {
|
|
131023
131523
|
continue;
|
|
131024
131524
|
}
|
|
@@ -131278,14 +131778,14 @@ var init_persist_directory2 = __esm({
|
|
|
131278
131778
|
function readCString2(view, rec) {
|
|
131279
131779
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
131280
131780
|
}
|
|
131281
|
-
function parseOleEmbedContainer(view,
|
|
131282
|
-
const atom2 = findChild4(view,
|
|
131781
|
+
function parseOleEmbedContainer(view, container2) {
|
|
131782
|
+
const atom2 = findChild4(view, container2, RT.ExternalOleObjectAtom);
|
|
131283
131783
|
if (!atom2 || atom2.recLen < 24) {
|
|
131284
131784
|
return void 0;
|
|
131285
131785
|
}
|
|
131286
131786
|
const exObjId = view.getUint32(atom2.dataOffset + 8, true);
|
|
131287
131787
|
const persistIdRef = view.getUint32(atom2.dataOffset + 16, true);
|
|
131288
|
-
const progIdRec = findChild4(view,
|
|
131788
|
+
const progIdRec = findChild4(view, container2, RT.CString, 2);
|
|
131289
131789
|
const progId = progIdRec ? readCString2(view, progIdRec) : void 0;
|
|
131290
131790
|
return { exObjId, ref: { persistIdRef, progId } };
|
|
131291
131791
|
}
|
|
@@ -131947,7 +132447,7 @@ function arrowType(value) {
|
|
|
131947
132447
|
return ARROW_MAP[value] ?? "triangle";
|
|
131948
132448
|
}
|
|
131949
132449
|
var OPT2, DASH_MAP, ARROW_MAP;
|
|
131950
|
-
var
|
|
132450
|
+
var init_properties2 = __esm({
|
|
131951
132451
|
"src/pptx/core/ppt/escher/properties.ts"() {
|
|
131952
132452
|
OPT2 = {
|
|
131953
132453
|
rotation: 4,
|
|
@@ -132106,14 +132606,14 @@ var init_shape_props = __esm({
|
|
|
132106
132606
|
init_color_scheme2();
|
|
132107
132607
|
init_record_types2();
|
|
132108
132608
|
init_geometry_map();
|
|
132109
|
-
|
|
132609
|
+
init_properties2();
|
|
132110
132610
|
GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
|
|
132111
132611
|
}
|
|
132112
132612
|
});
|
|
132113
132613
|
|
|
132114
132614
|
// src/pptx/core/ppt/escher/sp-container.ts
|
|
132115
|
-
function parseShape2(ctx,
|
|
132116
|
-
const fsp = findChild4(ctx.view,
|
|
132615
|
+
function parseShape2(ctx, container2) {
|
|
132616
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
132117
132617
|
if (!fsp || fsp.recLen < 8) {
|
|
132118
132618
|
return void 0;
|
|
132119
132619
|
}
|
|
@@ -132122,10 +132622,10 @@ function parseShape2(ctx, container) {
|
|
|
132122
132622
|
if (flags & FSP_FLAG_DELETED) {
|
|
132123
132623
|
return void 0;
|
|
132124
132624
|
}
|
|
132125
|
-
const optRec = findChild4(ctx.view,
|
|
132625
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
132126
132626
|
const props = optRec ? parseProperties(ctx.view, ctx.data, optRec) : { values: /* @__PURE__ */ new Map(), complex: /* @__PURE__ */ new Map() };
|
|
132127
|
-
const anchorRec = findChild4(ctx.view,
|
|
132128
|
-
const childAnchorRec = findChild4(ctx.view,
|
|
132627
|
+
const anchorRec = findChild4(ctx.view, container2, OA.ClientAnchor);
|
|
132628
|
+
const childAnchorRec = findChild4(ctx.view, container2, OA.ChildAnchor);
|
|
132129
132629
|
const anchor = anchorRec ? readClientAnchor(ctx.view, anchorRec) : childAnchorRec ? readChildAnchor(ctx.view, childAnchorRec) : void 0;
|
|
132130
132630
|
const namePayload = props.complex.get(OPT2.wzName);
|
|
132131
132631
|
const name = namePayload ? decodeComplexString(namePayload) : void 0;
|
|
@@ -132133,7 +132633,7 @@ function parseShape2(ctx, container) {
|
|
|
132133
132633
|
const rotationDeg = rotationRaw !== void 0 ? rotationToDegrees(rotationRaw) : void 0;
|
|
132134
132634
|
const flipH = (flags & FSP_FLAG_FLIPH2) !== 0 ? true : void 0;
|
|
132135
132635
|
const flipV = (flags & FSP_FLAG_FLIPV2) !== 0 ? true : void 0;
|
|
132136
|
-
const clientData = findChild4(ctx.view,
|
|
132636
|
+
const clientData = findChild4(ctx.view, container2, OA.ClientData);
|
|
132137
132637
|
const actionClick = clientData ? resolveShapeInteractiveInfo(ctx.view, clientData, ctx.hyperlinkStrings) : void 0;
|
|
132138
132638
|
const pib = props.values.get(OPT2.pib);
|
|
132139
132639
|
if (pib !== void 0 && pib > 0) {
|
|
@@ -132187,7 +132687,7 @@ function parseShape2(ctx, container) {
|
|
|
132187
132687
|
shape.placeholderType = placeholderType;
|
|
132188
132688
|
}
|
|
132189
132689
|
}
|
|
132190
|
-
const clientTextbox2 = findChild4(ctx.view,
|
|
132690
|
+
const clientTextbox2 = findChild4(ctx.view, container2, OA.ClientTextbox);
|
|
132191
132691
|
if (clientTextbox2) {
|
|
132192
132692
|
const text2 = extractText(ctx, clientTextbox2);
|
|
132193
132693
|
if (text2 && text2.paragraphs.some((p) => p.runs.length > 0)) {
|
|
@@ -132199,11 +132699,11 @@ function parseShape2(ctx, container) {
|
|
|
132199
132699
|
}
|
|
132200
132700
|
return shape;
|
|
132201
132701
|
}
|
|
132202
|
-
function parseGroup(ctx,
|
|
132702
|
+
function parseGroup(ctx, container2) {
|
|
132203
132703
|
const children14 = [];
|
|
132204
132704
|
let groupShape;
|
|
132205
132705
|
let first = true;
|
|
132206
|
-
for (const child27 of iterateChildren(ctx.view,
|
|
132706
|
+
for (const child27 of iterateChildren(ctx.view, container2)) {
|
|
132207
132707
|
if (child27.recType === OA.SpContainer && first) {
|
|
132208
132708
|
groupShape = child27;
|
|
132209
132709
|
first = false;
|
|
@@ -132273,8 +132773,8 @@ function parseDrawing(ctx, dgContainer) {
|
|
|
132273
132773
|
}
|
|
132274
132774
|
return result;
|
|
132275
132775
|
}
|
|
132276
|
-
function extractBackground(ctx,
|
|
132277
|
-
const fsp = findChild4(ctx.view,
|
|
132776
|
+
function extractBackground(ctx, container2) {
|
|
132777
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
132278
132778
|
if (!fsp || fsp.recLen < 8) {
|
|
132279
132779
|
return void 0;
|
|
132280
132780
|
}
|
|
@@ -132282,7 +132782,7 @@ function extractBackground(ctx, container) {
|
|
|
132282
132782
|
if ((flags & FSP_FLAG_BACKGROUND2) === 0 || (flags & FSP_FLAG_GROUP2) !== 0) {
|
|
132283
132783
|
return void 0;
|
|
132284
132784
|
}
|
|
132285
|
-
const optRec = findChild4(ctx.view,
|
|
132785
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
132286
132786
|
if (!optRec) {
|
|
132287
132787
|
return ctx.scheme[0];
|
|
132288
132788
|
}
|
|
@@ -132299,7 +132799,7 @@ var init_sp_container = __esm({
|
|
|
132299
132799
|
init_record_types2();
|
|
132300
132800
|
init_client_data_extract();
|
|
132301
132801
|
init_geometry_map();
|
|
132302
|
-
|
|
132802
|
+
init_properties2();
|
|
132303
132803
|
init_shape_props();
|
|
132304
132804
|
FSP_FLAG_GROUP2 = 1;
|
|
132305
132805
|
FSP_FLAG_DELETED = 8;
|
|
@@ -132310,22 +132810,22 @@ var init_sp_container = __esm({
|
|
|
132310
132810
|
});
|
|
132311
132811
|
|
|
132312
132812
|
// src/pptx/core/ppt/slide-parser.ts
|
|
132313
|
-
function parseSlideContainer(inputs,
|
|
132813
|
+
function parseSlideContainer(inputs, container2) {
|
|
132314
132814
|
const { view, data, fonts } = inputs;
|
|
132315
132815
|
let followMasterBackground = true;
|
|
132316
132816
|
let followMasterScheme = true;
|
|
132317
132817
|
let followMasterObjects = true;
|
|
132318
|
-
const slideAtom = findChild4(view,
|
|
132818
|
+
const slideAtom = findChild4(view, container2, RT.SlideAtom);
|
|
132319
132819
|
if (slideAtom && slideAtom.recLen >= 24) {
|
|
132320
132820
|
const flags = view.getUint16(slideAtom.dataOffset + 20, true);
|
|
132321
132821
|
followMasterObjects = (flags & SLIDE_FLAG_MASTER_OBJECTS2) !== 0;
|
|
132322
132822
|
followMasterScheme = (flags & SLIDE_FLAG_MASTER_SCHEME2) !== 0;
|
|
132323
132823
|
followMasterBackground = (flags & SLIDE_FLAG_MASTER_BACKGROUND2) !== 0;
|
|
132324
132824
|
}
|
|
132325
|
-
const ownScheme = findSchemeColors(view,
|
|
132825
|
+
const ownScheme = findSchemeColors(view, container2);
|
|
132326
132826
|
const scheme = followMasterScheme ? inputs.masterScheme : ownScheme ?? inputs.masterScheme;
|
|
132327
132827
|
const slide = { followMasterBackground, followMasterObjects, shapes: [] };
|
|
132328
|
-
const drawing = findChild4(view,
|
|
132828
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
132329
132829
|
if (drawing) {
|
|
132330
132830
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
132331
132831
|
if (dgContainer) {
|
|
@@ -132348,12 +132848,12 @@ function parseSlideContainer(inputs, container) {
|
|
|
132348
132848
|
}
|
|
132349
132849
|
return slide;
|
|
132350
132850
|
}
|
|
132351
|
-
function parseMasterContainer(view, data, fonts, fallbackScheme,
|
|
132352
|
-
const scheme = findSchemeColors(view,
|
|
132851
|
+
function parseMasterContainer(view, data, fonts, fallbackScheme, container2, hyperlinkStrings, oleExObjIds) {
|
|
132852
|
+
const scheme = findSchemeColors(view, container2);
|
|
132353
132853
|
const active = scheme ?? fallbackScheme;
|
|
132354
132854
|
let backgroundRgb;
|
|
132355
132855
|
let shapes = [];
|
|
132356
|
-
const drawing = findChild4(view,
|
|
132856
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
132357
132857
|
if (drawing) {
|
|
132358
132858
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
132359
132859
|
if (dgContainer) {
|
|
@@ -132373,7 +132873,7 @@ function parseMasterContainer(view, data, fonts, fallbackScheme, container, hype
|
|
|
132373
132873
|
);
|
|
132374
132874
|
}
|
|
132375
132875
|
}
|
|
132376
|
-
return { scheme, backgroundRgb, shapes, container };
|
|
132876
|
+
return { scheme, backgroundRgb, shapes, container: container2 };
|
|
132377
132877
|
}
|
|
132378
132878
|
var SLIDE_FLAG_MASTER_OBJECTS2, SLIDE_FLAG_MASTER_SCHEME2, SLIDE_FLAG_MASTER_BACKGROUND2;
|
|
132379
132879
|
var init_slide_parser = __esm({
|
|
@@ -132524,11 +133024,11 @@ function findBStore(view, docContainer) {
|
|
|
132524
133024
|
}
|
|
132525
133025
|
return findDescendant(view, drawingGroup, OA.BStoreContainer);
|
|
132526
133026
|
}
|
|
132527
|
-
async function parseDeck(
|
|
132528
|
-
const data =
|
|
133027
|
+
async function parseDeck(streams2) {
|
|
133028
|
+
const data = streams2.powerPointDocument;
|
|
132529
133029
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
132530
|
-
const { currentEdit, directory } = buildPersistDirectory(view,
|
|
132531
|
-
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !
|
|
133030
|
+
const { currentEdit, directory } = buildPersistDirectory(view, streams2.offsetToCurrentEdit);
|
|
133031
|
+
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !streams2.decrypted) {
|
|
132532
133032
|
throw new EncryptedPptError();
|
|
132533
133033
|
}
|
|
132534
133034
|
const docOffset = directory.get(currentEdit.docPersistIdRef);
|
|
@@ -132615,7 +133115,7 @@ async function parseDeck(streams) {
|
|
|
132615
133115
|
}
|
|
132616
133116
|
const bstoreRec = findBStore(view, docContainer);
|
|
132617
133117
|
const pictures = await parsePictures(
|
|
132618
|
-
|
|
133118
|
+
streams2.pictures,
|
|
132619
133119
|
bstoreRec ? { view, rec: bstoreRec } : void 0
|
|
132620
133120
|
);
|
|
132621
133121
|
const usedExObjIds = /* @__PURE__ */ new Set();
|
|
@@ -132664,6 +133164,20 @@ var init_document_parser = __esm({
|
|
|
132664
133164
|
}
|
|
132665
133165
|
});
|
|
132666
133166
|
|
|
133167
|
+
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
133168
|
+
var init_ooxml_crypto_errors = __esm({
|
|
133169
|
+
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
133170
|
+
init_errors();
|
|
133171
|
+
}
|
|
133172
|
+
});
|
|
133173
|
+
|
|
133174
|
+
// src/pptx/core/utils/ooxml-crypto-key-derivation.ts
|
|
133175
|
+
var init_ooxml_crypto_key_derivation = __esm({
|
|
133176
|
+
"src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
|
|
133177
|
+
init_encryption_info();
|
|
133178
|
+
}
|
|
133179
|
+
});
|
|
133180
|
+
|
|
132667
133181
|
// src/pptx/core/ppt/rc4-cryptoapi-key.ts
|
|
132668
133182
|
var init_rc4_cryptoapi_key2 = __esm({
|
|
132669
133183
|
"src/pptx/core/ppt/rc4-cryptoapi-key.ts"() {
|
|
@@ -136411,12 +136925,12 @@ var SlideProcessor = class {
|
|
|
136411
136925
|
if (positionedCells.length === 0) {
|
|
136412
136926
|
return [];
|
|
136413
136927
|
}
|
|
136414
|
-
const
|
|
136928
|
+
const container2 = [
|
|
136415
136929
|
`<div style="position:relative;width:${displayW}px;height:${displayH}px;border:1px solid #e5e7eb;overflow:hidden;margin:0.5em 0">`,
|
|
136416
136930
|
...positionedCells,
|
|
136417
136931
|
"</div>"
|
|
136418
136932
|
].join("\n");
|
|
136419
|
-
return [
|
|
136933
|
+
return [container2];
|
|
136420
136934
|
}
|
|
136421
136935
|
/** Sorts elements into natural reading order (top-to-bottom, left-to-right). */
|
|
136422
136936
|
sortElementsByReadingOrder(elements) {
|