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/index.cjs
CHANGED
|
@@ -3166,9 +3166,9 @@ function chartColorChoiceValue(authored, color2, resolveColor2, opacity2) {
|
|
|
3166
3166
|
opacity2
|
|
3167
3167
|
);
|
|
3168
3168
|
}
|
|
3169
|
-
function writeChartColorChoice(
|
|
3170
|
-
|
|
3171
|
-
|
|
3169
|
+
function writeChartColorChoice(container2, key2, color2, resolveColor2, opacity2) {
|
|
3170
|
+
container2[key2] = chartColorChoiceValue(
|
|
3171
|
+
container2[key2],
|
|
3172
3172
|
color2,
|
|
3173
3173
|
resolveColor2,
|
|
3174
3174
|
opacity2
|
|
@@ -21432,12 +21432,12 @@ var init_ole2_parser_write_serialize = __esm({
|
|
|
21432
21432
|
});
|
|
21433
21433
|
|
|
21434
21434
|
// node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
21435
|
-
function buildOle2(
|
|
21435
|
+
function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
|
|
21436
21436
|
const sectorSize = 512;
|
|
21437
21437
|
const miniSectorSize = 64;
|
|
21438
21438
|
const regularStreams = [];
|
|
21439
21439
|
const miniStreams = [];
|
|
21440
|
-
for (const [name, data] of
|
|
21440
|
+
for (const [name, data] of streams2) {
|
|
21441
21441
|
if (data.length < miniStreamCutoff) {
|
|
21442
21442
|
miniStreams.push({ name, data });
|
|
21443
21443
|
} else {
|
|
@@ -21661,32 +21661,32 @@ function replaceOleEmbedding(originalBytes, newPayloadBytes, options = {}) {
|
|
|
21661
21661
|
const existing = ole.getStream(nativeStreamName);
|
|
21662
21662
|
const decoded = decodeOle10Native(existing);
|
|
21663
21663
|
const fileName = options.fileName ?? decoded?.fileName ?? "file.bin";
|
|
21664
|
-
const
|
|
21664
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
21665
21665
|
for (const entry of ole.entries) {
|
|
21666
21666
|
if (entry.name === "Root Entry" || entry.name === nativeStreamName) {
|
|
21667
21667
|
continue;
|
|
21668
21668
|
}
|
|
21669
21669
|
const data = ole.getStream(entry.name);
|
|
21670
21670
|
if (data) {
|
|
21671
|
-
|
|
21671
|
+
streams2.set(entry.name, data);
|
|
21672
21672
|
}
|
|
21673
21673
|
}
|
|
21674
|
-
|
|
21675
|
-
return new Uint8Array(buildOle2(
|
|
21674
|
+
streams2.set(nativeStreamName, encodeOle10Native(fileName, newPayloadBytes));
|
|
21675
|
+
return new Uint8Array(buildOle2(streams2));
|
|
21676
21676
|
}
|
|
21677
21677
|
if (ole.getStream(CONTENTS_STREAM2)) {
|
|
21678
|
-
const
|
|
21678
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
21679
21679
|
for (const entry of ole.entries) {
|
|
21680
21680
|
if (entry.name === "Root Entry" || entry.name === CONTENTS_STREAM2) {
|
|
21681
21681
|
continue;
|
|
21682
21682
|
}
|
|
21683
21683
|
const data = ole.getStream(entry.name);
|
|
21684
21684
|
if (data) {
|
|
21685
|
-
|
|
21685
|
+
streams2.set(entry.name, data);
|
|
21686
21686
|
}
|
|
21687
21687
|
}
|
|
21688
|
-
|
|
21689
|
-
return new Uint8Array(buildOle2(
|
|
21688
|
+
streams2.set(CONTENTS_STREAM2, newPayloadBytes);
|
|
21689
|
+
return new Uint8Array(buildOle2(streams2));
|
|
21690
21690
|
}
|
|
21691
21691
|
return newPayloadBytes;
|
|
21692
21692
|
} catch {
|
|
@@ -22622,17 +22622,17 @@ function unwrapXlsBytes(bytes) {
|
|
|
22622
22622
|
}
|
|
22623
22623
|
if (!canRebuild)
|
|
22624
22624
|
return originalBytes;
|
|
22625
|
-
const
|
|
22625
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
22626
22626
|
for (const entry of ole.entries) {
|
|
22627
22627
|
if (entry.type !== ENTRY_TYPE_STREAM) {
|
|
22628
22628
|
continue;
|
|
22629
22629
|
}
|
|
22630
22630
|
const data = entry.name.toLowerCase() === streamEntry.name.toLowerCase() ? editedWorkbookBytes : ole.getStream(entry.name);
|
|
22631
22631
|
if (data) {
|
|
22632
|
-
|
|
22632
|
+
streams2.set(entry.name, data);
|
|
22633
22633
|
}
|
|
22634
22634
|
}
|
|
22635
|
-
return new Uint8Array(buildOle2(
|
|
22635
|
+
return new Uint8Array(buildOle2(streams2, rootClsid));
|
|
22636
22636
|
}
|
|
22637
22637
|
};
|
|
22638
22638
|
} catch {
|
|
@@ -23344,17 +23344,17 @@ function unwrapDocBytes(bytes) {
|
|
|
23344
23344
|
tableStreamName: fib.tableStreamName,
|
|
23345
23345
|
tableBytes,
|
|
23346
23346
|
rewrap: (editedWordDocBytes, editedTableBytes) => {
|
|
23347
|
-
const
|
|
23347
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
23348
23348
|
for (const entry of ole.entries) {
|
|
23349
23349
|
if (entry.type !== ENTRY_TYPE_STREAM) {
|
|
23350
23350
|
continue;
|
|
23351
23351
|
}
|
|
23352
23352
|
const data = entry.name === "WordDocument" ? editedWordDocBytes : entry.name === fib.tableStreamName ? editedTableBytes : ole.getStream(entry.name);
|
|
23353
23353
|
if (data) {
|
|
23354
|
-
|
|
23354
|
+
streams2.set(entry.name, data);
|
|
23355
23355
|
}
|
|
23356
23356
|
}
|
|
23357
|
-
return new Uint8Array(buildOle2(
|
|
23357
|
+
return new Uint8Array(buildOle2(streams2, rootClsid));
|
|
23358
23358
|
}
|
|
23359
23359
|
};
|
|
23360
23360
|
} catch {
|
|
@@ -37126,16 +37126,16 @@ var init_smartart_layout_interpreter_composite_slots = __esm({
|
|
|
37126
37126
|
|
|
37127
37127
|
// src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts
|
|
37128
37128
|
function resolveIterationRect(dims, box, iteration, iterationCount) {
|
|
37129
|
-
const
|
|
37129
|
+
const container2 = resolveSlot(dims, box, 1, 1);
|
|
37130
37130
|
if (iterationCount <= 1) {
|
|
37131
|
-
return
|
|
37131
|
+
return container2;
|
|
37132
37132
|
}
|
|
37133
|
-
if (
|
|
37134
|
-
const width =
|
|
37135
|
-
return { x:
|
|
37133
|
+
if (container2.width >= container2.height) {
|
|
37134
|
+
const width = container2.width / iterationCount;
|
|
37135
|
+
return { x: container2.x + width * iteration, y: container2.y, width, height: container2.height };
|
|
37136
37136
|
}
|
|
37137
|
-
const height =
|
|
37138
|
-
return { x:
|
|
37137
|
+
const height = container2.height / iterationCount;
|
|
37138
|
+
return { x: container2.x, y: container2.y + height * iteration, width: container2.width, height };
|
|
37139
37139
|
}
|
|
37140
37140
|
var init_smartart_layout_interpreter_composite_iteration = __esm({
|
|
37141
37141
|
"src/pptx/core/utils/smartart-layout-interpreter-composite-iteration.ts"() {
|
|
@@ -42075,9 +42075,9 @@ function findVarsContainer(node) {
|
|
|
42075
42075
|
continue;
|
|
42076
42076
|
}
|
|
42077
42077
|
if (CONTAINER_LOCAL_NAMES.has(localNameOf4(key2))) {
|
|
42078
|
-
const
|
|
42079
|
-
if (
|
|
42080
|
-
return
|
|
42078
|
+
const container2 = Array.isArray(value) ? value[0] : value;
|
|
42079
|
+
if (container2 && typeof container2 === "object") {
|
|
42080
|
+
return container2;
|
|
42081
42081
|
}
|
|
42082
42082
|
}
|
|
42083
42083
|
const nested = findVarsContainer(value);
|
|
@@ -42134,8 +42134,8 @@ function findNamedPresVars(node, presName) {
|
|
|
42134
42134
|
}
|
|
42135
42135
|
return void 0;
|
|
42136
42136
|
}
|
|
42137
|
-
function varValue(
|
|
42138
|
-
for (const [key2, value] of Object.entries(
|
|
42137
|
+
function varValue(container2, name) {
|
|
42138
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
42139
42139
|
if (key2.startsWith("@_") || localNameOf4(key2) !== name) {
|
|
42140
42140
|
continue;
|
|
42141
42141
|
}
|
|
@@ -42148,27 +42148,27 @@ function varValue(container, name) {
|
|
|
42148
42148
|
}
|
|
42149
42149
|
return void 0;
|
|
42150
42150
|
}
|
|
42151
|
-
function boolValue(
|
|
42152
|
-
const raw = varValue(
|
|
42151
|
+
function boolValue(container2, name) {
|
|
42152
|
+
const raw = varValue(container2, name);
|
|
42153
42153
|
if (raw === void 0) {
|
|
42154
42154
|
return void 0;
|
|
42155
42155
|
}
|
|
42156
42156
|
const lower = raw.toLowerCase();
|
|
42157
42157
|
return lower === "1" || lower === "true" || lower === "on";
|
|
42158
42158
|
}
|
|
42159
|
-
function intValue(
|
|
42160
|
-
const raw = varValue(
|
|
42159
|
+
function intValue(container2, name) {
|
|
42160
|
+
const raw = varValue(container2, name);
|
|
42161
42161
|
if (raw === void 0) {
|
|
42162
42162
|
return void 0;
|
|
42163
42163
|
}
|
|
42164
42164
|
const parsed = Number.parseInt(raw, 10);
|
|
42165
42165
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
42166
42166
|
}
|
|
42167
|
-
function parseSmartArtPresLayoutVars(
|
|
42168
|
-
if (!
|
|
42167
|
+
function parseSmartArtPresLayoutVars(container2) {
|
|
42168
|
+
if (!container2) {
|
|
42169
42169
|
return void 0;
|
|
42170
42170
|
}
|
|
42171
|
-
const vars = findVarsContainer(
|
|
42171
|
+
const vars = findVarsContainer(container2);
|
|
42172
42172
|
if (!vars) {
|
|
42173
42173
|
return void 0;
|
|
42174
42174
|
}
|
|
@@ -42209,7 +42209,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
42209
42209
|
if (resizeHandles !== void 0) {
|
|
42210
42210
|
result.resizeHandles = resizeHandles;
|
|
42211
42211
|
}
|
|
42212
|
-
const hierRootVars = findNamedPresVars(
|
|
42212
|
+
const hierRootVars = findNamedPresVars(container2, "hierRoot1");
|
|
42213
42213
|
if (hierRootVars) {
|
|
42214
42214
|
const rootHierBranch = varValue(hierRootVars, "hierBranch");
|
|
42215
42215
|
if (rootHierBranch && HIER_BRANCHES.has(rootHierBranch)) {
|
|
@@ -42218,7 +42218,7 @@ function parseSmartArtPresLayoutVars(container) {
|
|
|
42218
42218
|
result.hierarchyBranch = "init";
|
|
42219
42219
|
}
|
|
42220
42220
|
}
|
|
42221
|
-
const rootTextVars = findNamedPresVars(
|
|
42221
|
+
const rootTextVars = findNamedPresVars(container2, "rootText1");
|
|
42222
42222
|
if (rootTextVars) {
|
|
42223
42223
|
const rootChMax = intValue(rootTextVars, "chMax");
|
|
42224
42224
|
if (rootChMax !== void 0) {
|
|
@@ -42548,6 +42548,7 @@ var init_relationship_types = __esm({
|
|
|
42548
42548
|
diagramDrawing: "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing",
|
|
42549
42549
|
coreProperties: "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",
|
|
42550
42550
|
extendedProperties: `${BASE}/extended-properties`,
|
|
42551
|
+
customProperties: `${BASE}/custom-properties`,
|
|
42551
42552
|
customXml: `${BASE}/customXml`,
|
|
42552
42553
|
worksheet: `${BASE}/worksheet`,
|
|
42553
42554
|
chartsheet: `${BASE}/chartsheet`,
|
|
@@ -42587,8 +42588,406 @@ var init_package = __esm({
|
|
|
42587
42588
|
});
|
|
42588
42589
|
|
|
42589
42590
|
// src/opc/safe-href.ts
|
|
42591
|
+
var OPEN_SCHEMES;
|
|
42590
42592
|
var init_safe_href = __esm({
|
|
42591
42593
|
"src/opc/safe-href.ts"() {
|
|
42594
|
+
OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
|
|
42595
|
+
/* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
|
|
42596
|
+
}
|
|
42597
|
+
});
|
|
42598
|
+
|
|
42599
|
+
// src/opc/properties/types.ts
|
|
42600
|
+
var init_types3 = __esm({
|
|
42601
|
+
"src/opc/properties/types.ts"() {
|
|
42602
|
+
}
|
|
42603
|
+
});
|
|
42604
|
+
|
|
42605
|
+
// src/opc/properties/index.ts
|
|
42606
|
+
var init_properties = __esm({
|
|
42607
|
+
"src/opc/properties/index.ts"() {
|
|
42608
|
+
init_types3();
|
|
42609
|
+
}
|
|
42610
|
+
});
|
|
42611
|
+
|
|
42612
|
+
// src/opc/signature/detection.ts
|
|
42613
|
+
function detectDigitalSignatures(zipEntryPaths) {
|
|
42614
|
+
const sigPaths = zipEntryPaths.filter(
|
|
42615
|
+
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
42616
|
+
);
|
|
42617
|
+
return {
|
|
42618
|
+
hasSignatures: sigPaths.length > 0,
|
|
42619
|
+
signatureCount: sigPaths.length,
|
|
42620
|
+
signaturePaths: sigPaths
|
|
42621
|
+
};
|
|
42622
|
+
}
|
|
42623
|
+
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
42624
|
+
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
42625
|
+
}
|
|
42626
|
+
function findByLocalName(parent, localName29) {
|
|
42627
|
+
if (!parent) {
|
|
42628
|
+
return void 0;
|
|
42629
|
+
}
|
|
42630
|
+
if (parent[localName29] !== void 0 && typeof parent[localName29] === "object") {
|
|
42631
|
+
return parent[localName29];
|
|
42632
|
+
}
|
|
42633
|
+
for (const key2 of Object.keys(parent)) {
|
|
42634
|
+
const parts = key2.split(":");
|
|
42635
|
+
if (parts[parts.length - 1] === localName29 && typeof parent[key2] === "object") {
|
|
42636
|
+
return parent[key2];
|
|
42637
|
+
}
|
|
42638
|
+
}
|
|
42639
|
+
return void 0;
|
|
42640
|
+
}
|
|
42641
|
+
function findScalarByLocalName(parent, localName29) {
|
|
42642
|
+
if (!parent) {
|
|
42643
|
+
return void 0;
|
|
42644
|
+
}
|
|
42645
|
+
if (parent[localName29] !== void 0) {
|
|
42646
|
+
const v = parent[localName29];
|
|
42647
|
+
if (typeof v === "string") {
|
|
42648
|
+
return v;
|
|
42649
|
+
}
|
|
42650
|
+
if (typeof v === "number" || typeof v === "boolean") {
|
|
42651
|
+
return String(v);
|
|
42652
|
+
}
|
|
42653
|
+
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
42654
|
+
return String(v["#text"]);
|
|
42655
|
+
}
|
|
42656
|
+
}
|
|
42657
|
+
for (const key2 of Object.keys(parent)) {
|
|
42658
|
+
const parts = key2.split(":");
|
|
42659
|
+
if (parts[parts.length - 1] === localName29) {
|
|
42660
|
+
const v = parent[key2];
|
|
42661
|
+
if (typeof v === "string") {
|
|
42662
|
+
return v;
|
|
42663
|
+
}
|
|
42664
|
+
if (typeof v === "number" || typeof v === "boolean") {
|
|
42665
|
+
return String(v);
|
|
42666
|
+
}
|
|
42667
|
+
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
42668
|
+
return String(v["#text"]);
|
|
42669
|
+
}
|
|
42670
|
+
}
|
|
42671
|
+
}
|
|
42672
|
+
return void 0;
|
|
42673
|
+
}
|
|
42674
|
+
function findAllByLocalName(parent, localName29) {
|
|
42675
|
+
if (!parent) {
|
|
42676
|
+
return [];
|
|
42677
|
+
}
|
|
42678
|
+
for (const key2 of Object.keys(parent)) {
|
|
42679
|
+
const parts = key2.split(":");
|
|
42680
|
+
if (parts[parts.length - 1] === localName29) {
|
|
42681
|
+
const v = parent[key2];
|
|
42682
|
+
if (Array.isArray(v)) {
|
|
42683
|
+
return v;
|
|
42684
|
+
}
|
|
42685
|
+
if (typeof v === "object" && v !== null) {
|
|
42686
|
+
return [v];
|
|
42687
|
+
}
|
|
42688
|
+
}
|
|
42689
|
+
}
|
|
42690
|
+
return [];
|
|
42691
|
+
}
|
|
42692
|
+
function parseSignatureXml(signatureXml, signaturePath) {
|
|
42693
|
+
const signature = findByLocalName(signatureXml, "Signature");
|
|
42694
|
+
const signedInfo = findByLocalName(signature, "SignedInfo");
|
|
42695
|
+
const sigMethodNode = findByLocalName(signedInfo, "SignatureMethod");
|
|
42696
|
+
const signatureMethod = sigMethodNode?.["@_Algorithm"];
|
|
42697
|
+
const signatureValue = findScalarByLocalName(signature, "SignatureValue")?.replace(/\s+/g, "");
|
|
42698
|
+
const references = [];
|
|
42699
|
+
const refNodes = findAllByLocalName(signedInfo, "Reference");
|
|
42700
|
+
for (const ref of refNodes) {
|
|
42701
|
+
const uri = String(ref["@_URI"] || "");
|
|
42702
|
+
const dmNode = findByLocalName(ref, "DigestMethod");
|
|
42703
|
+
const digestMethod2 = dmNode?.["@_Algorithm"];
|
|
42704
|
+
const digestValue = findScalarByLocalName(ref, "DigestValue")?.replace(/\s+/g, "");
|
|
42705
|
+
references.push({
|
|
42706
|
+
uri,
|
|
42707
|
+
...digestMethod2 === void 0 ? {} : { digestMethod: digestMethod2 },
|
|
42708
|
+
...digestValue === void 0 ? {} : { digestValue }
|
|
42709
|
+
});
|
|
42710
|
+
}
|
|
42711
|
+
const digestMethod = references[0]?.digestMethod;
|
|
42712
|
+
const keyInfo = findByLocalName(signature, "KeyInfo");
|
|
42713
|
+
const x509Data = findByLocalName(keyInfo, "X509Data");
|
|
42714
|
+
let certificate;
|
|
42715
|
+
if (x509Data) {
|
|
42716
|
+
const certBase64 = findScalarByLocalName(x509Data, "X509Certificate")?.replace(/\s+/g, "");
|
|
42717
|
+
if (certBase64) {
|
|
42718
|
+
const issuerSerial = findByLocalName(x509Data, "X509IssuerSerial");
|
|
42719
|
+
const issuer = findScalarByLocalName(issuerSerial, "X509IssuerName");
|
|
42720
|
+
const serialNumber = findScalarByLocalName(issuerSerial, "X509SerialNumber");
|
|
42721
|
+
const subject = findScalarByLocalName(x509Data, "X509SubjectName");
|
|
42722
|
+
certificate = {
|
|
42723
|
+
certificateBase64: certBase64,
|
|
42724
|
+
...issuer ? { issuer } : {},
|
|
42725
|
+
...subject ? { subject } : {},
|
|
42726
|
+
...serialNumber ? { serialNumber } : {}
|
|
42727
|
+
};
|
|
42728
|
+
}
|
|
42729
|
+
}
|
|
42730
|
+
let status = "unverified";
|
|
42731
|
+
if (certificate?.validTo) {
|
|
42732
|
+
const expiry = new Date(certificate.validTo);
|
|
42733
|
+
if (expiry < /* @__PURE__ */ new Date()) {
|
|
42734
|
+
status = "expired";
|
|
42735
|
+
}
|
|
42736
|
+
}
|
|
42737
|
+
return {
|
|
42738
|
+
signaturePath,
|
|
42739
|
+
...signatureMethod === void 0 ? {} : { signatureMethod },
|
|
42740
|
+
...digestMethod === void 0 ? {} : { digestMethod },
|
|
42741
|
+
...signatureValue === void 0 ? {} : { signatureValue },
|
|
42742
|
+
...certificate === void 0 ? {} : { certificate },
|
|
42743
|
+
status,
|
|
42744
|
+
references
|
|
42745
|
+
};
|
|
42746
|
+
}
|
|
42747
|
+
async function verifySignatureDigests(signature, getPartContent) {
|
|
42748
|
+
if (!signature.references.length) {
|
|
42749
|
+
return "unverified";
|
|
42750
|
+
}
|
|
42751
|
+
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
42752
|
+
return "unverified";
|
|
42753
|
+
}
|
|
42754
|
+
for (const ref of signature.references) {
|
|
42755
|
+
if (!ref.digestValue || !ref.uri) {
|
|
42756
|
+
continue;
|
|
42757
|
+
}
|
|
42758
|
+
const algo = ref.digestMethod?.toLowerCase() || "";
|
|
42759
|
+
let hashAlgo;
|
|
42760
|
+
if (algo.includes("sha256") || algo.includes("sha-256")) {
|
|
42761
|
+
hashAlgo = "SHA-256";
|
|
42762
|
+
} else if (algo.includes("sha512") || algo.includes("sha-512")) {
|
|
42763
|
+
hashAlgo = "SHA-512";
|
|
42764
|
+
} else if (algo.includes("sha1") || algo.includes("sha-1")) {
|
|
42765
|
+
hashAlgo = "SHA-1";
|
|
42766
|
+
} else {
|
|
42767
|
+
continue;
|
|
42768
|
+
}
|
|
42769
|
+
const content = await getPartContent(ref.uri);
|
|
42770
|
+
if (!content) {
|
|
42771
|
+
continue;
|
|
42772
|
+
}
|
|
42773
|
+
try {
|
|
42774
|
+
const digest2 = await crypto.subtle.digest(hashAlgo, content);
|
|
42775
|
+
const digestBase64 = arrayBufferToBase64(digest2);
|
|
42776
|
+
if (digestBase64 !== ref.digestValue) {
|
|
42777
|
+
return "invalid";
|
|
42778
|
+
}
|
|
42779
|
+
} catch {
|
|
42780
|
+
return "unverified";
|
|
42781
|
+
}
|
|
42782
|
+
}
|
|
42783
|
+
return signature.certificate ? "valid" : "unknownCA";
|
|
42784
|
+
}
|
|
42785
|
+
function arrayBufferToBase64(buffer) {
|
|
42786
|
+
const bytes = new Uint8Array(buffer);
|
|
42787
|
+
let binary = "";
|
|
42788
|
+
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
42789
|
+
binary += String.fromCharCode(bytes[i2]);
|
|
42790
|
+
}
|
|
42791
|
+
return btoa(binary);
|
|
42792
|
+
}
|
|
42793
|
+
var SIGNATURE_PART_PREFIX, SIGNATURE_PREFIX;
|
|
42794
|
+
var init_detection = __esm({
|
|
42795
|
+
"src/opc/signature/detection.ts"() {
|
|
42796
|
+
SIGNATURE_PART_PREFIX = "_xmlsignatures/";
|
|
42797
|
+
SIGNATURE_PREFIX = SIGNATURE_PART_PREFIX;
|
|
42798
|
+
}
|
|
42799
|
+
});
|
|
42800
|
+
|
|
42801
|
+
// src/opc/signature/constants.ts
|
|
42802
|
+
exports.DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = void 0; exports.DIGITAL_SIGNATURE_REL_TYPE = void 0; exports.PPTX_VIEWER_MANIFEST_NS = void 0; exports.XMLDSIG_NS = void 0; exports.OPC_RELATIONSHIP_TRANSFORM = void 0; exports.XML_TRANSFORM_ENVELOPED_SIGNATURE = void 0; exports.SUPPORTED_XML_CANON_TRANSFORMS = void 0; exports.ENTERPRISE_TRUST_ROOTS_FILE_ENV = void 0; exports.ENTERPRISE_TRUST_ROOTS_PEM_ENV = void 0; exports.ENTERPRISE_REQUIRE_REVOCATION_ENV = void 0; exports.ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = void 0; exports.ENTERPRISE_REQUIRE_TIMESTAMP_ENV = void 0; exports.DIGEST_ALGORITHM_TO_HASH = void 0; exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO = void 0;
|
|
42803
|
+
var init_constants3 = __esm({
|
|
42804
|
+
"src/opc/signature/constants.ts"() {
|
|
42805
|
+
exports.DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin";
|
|
42806
|
+
exports.DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
|
|
42807
|
+
exports.PPTX_VIEWER_MANIFEST_NS = "urn:pptx-viewer:ooxml-signature:v1";
|
|
42808
|
+
exports.XMLDSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
|
|
42809
|
+
exports.OPC_RELATIONSHIP_TRANSFORM = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
|
42810
|
+
exports.XML_TRANSFORM_ENVELOPED_SIGNATURE = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
|
|
42811
|
+
exports.SUPPORTED_XML_CANON_TRANSFORMS = /* @__PURE__ */ new Set([
|
|
42812
|
+
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
|
|
42813
|
+
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",
|
|
42814
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
42815
|
+
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
|
|
42816
|
+
exports.XML_TRANSFORM_ENVELOPED_SIGNATURE
|
|
42817
|
+
]);
|
|
42818
|
+
exports.ENTERPRISE_TRUST_ROOTS_FILE_ENV = "PPTX_VIEWER_TRUST_ROOTS_FILE";
|
|
42819
|
+
exports.ENTERPRISE_TRUST_ROOTS_PEM_ENV = "PPTX_VIEWER_TRUST_ROOTS_PEM";
|
|
42820
|
+
exports.ENTERPRISE_REQUIRE_REVOCATION_ENV = "PPTX_VIEWER_REQUIRE_REVOCATION_CHECK";
|
|
42821
|
+
exports.ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = "PPTX_VIEWER_FAIL_ON_REVOCATION_UNKNOWN";
|
|
42822
|
+
exports.ENTERPRISE_REQUIRE_TIMESTAMP_ENV = "PPTX_VIEWER_REQUIRE_TIMESTAMP";
|
|
42823
|
+
exports.DIGEST_ALGORITHM_TO_HASH = {
|
|
42824
|
+
"http://www.w3.org/2000/09/xmldsig#sha1": "sha1",
|
|
42825
|
+
"http://www.w3.org/2001/04/xmlenc#sha256": "sha256",
|
|
42826
|
+
"http://www.w3.org/2001/04/xmlenc#sha384": "sha384",
|
|
42827
|
+
"http://www.w3.org/2001/04/xmlenc#sha512": "sha512"
|
|
42828
|
+
};
|
|
42829
|
+
exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO = {
|
|
42830
|
+
"http://www.w3.org/2000/09/xmldsig#sha1": "SHA-1",
|
|
42831
|
+
"http://www.w3.org/2001/04/xmlenc#sha256": "SHA-256",
|
|
42832
|
+
"http://www.w3.org/2001/04/xmlenc#sha384": "SHA-384",
|
|
42833
|
+
"http://www.w3.org/2001/04/xmlenc#sha512": "SHA-512"
|
|
42834
|
+
};
|
|
42835
|
+
}
|
|
42836
|
+
});
|
|
42837
|
+
|
|
42838
|
+
// src/opc/signature/xml-utils.ts
|
|
42839
|
+
function escapeXmlAttr(value) {
|
|
42840
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
42841
|
+
}
|
|
42842
|
+
function escapeXmlText(value) {
|
|
42843
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
42844
|
+
}
|
|
42845
|
+
function isValidBase64(value) {
|
|
42846
|
+
return typeof value === "string" && value.length > 0 && /^[A-Za-z0-9+/=\s]+$/.test(value);
|
|
42847
|
+
}
|
|
42848
|
+
function extractTagAttribute(xml, tagName, attributeName) {
|
|
42849
|
+
const pattern = new RegExp(
|
|
42850
|
+
`<${tagName}\\b[^>]*\\b${attributeName}="(?<attributeValue>[^"]+)"`,
|
|
42851
|
+
"i"
|
|
42852
|
+
);
|
|
42853
|
+
const match = xml.match(pattern);
|
|
42854
|
+
return match?.groups?.["attributeValue"]?.trim();
|
|
42855
|
+
}
|
|
42856
|
+
function extractFirstTagText(xml, localName29) {
|
|
42857
|
+
const pattern = new RegExp(
|
|
42858
|
+
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
42859
|
+
"i"
|
|
42860
|
+
);
|
|
42861
|
+
const match = xml.match(pattern);
|
|
42862
|
+
return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
|
|
42863
|
+
}
|
|
42864
|
+
function extractAllTagText(xml, localName29) {
|
|
42865
|
+
const result = [];
|
|
42866
|
+
const regex = new RegExp(
|
|
42867
|
+
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
42868
|
+
"gi"
|
|
42869
|
+
);
|
|
42870
|
+
let match = regex.exec(xml);
|
|
42871
|
+
while (match) {
|
|
42872
|
+
const value = match[2]?.replace(/\s+/g, "").trim();
|
|
42873
|
+
if (value) {
|
|
42874
|
+
result.push(value);
|
|
42875
|
+
}
|
|
42876
|
+
match = regex.exec(xml);
|
|
42877
|
+
}
|
|
42878
|
+
return result;
|
|
42879
|
+
}
|
|
42880
|
+
var init_xml_utils2 = __esm({
|
|
42881
|
+
"src/opc/signature/xml-utils.ts"() {
|
|
42882
|
+
}
|
|
42883
|
+
});
|
|
42884
|
+
|
|
42885
|
+
// src/opc/signature/reference-utils.ts
|
|
42886
|
+
function normalizePartPath(partPath) {
|
|
42887
|
+
return partPath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
42888
|
+
}
|
|
42889
|
+
function resolveReferenceUriToPart(uri) {
|
|
42890
|
+
const trimmed = uri.trim();
|
|
42891
|
+
if (trimmed.length === 0 || trimmed.startsWith("#")) {
|
|
42892
|
+
return void 0;
|
|
42893
|
+
}
|
|
42894
|
+
const decoded = decodeURIComponent(trimmed);
|
|
42895
|
+
return normalizePartPath(decoded.startsWith("/") ? decoded.slice(1) : decoded);
|
|
42896
|
+
}
|
|
42897
|
+
var init_reference_utils = __esm({
|
|
42898
|
+
"src/opc/signature/reference-utils.ts"() {
|
|
42899
|
+
}
|
|
42900
|
+
});
|
|
42901
|
+
|
|
42902
|
+
// src/opc/signature/digest.ts
|
|
42903
|
+
async function computeDigestBase64(content, digestAlgorithmUri) {
|
|
42904
|
+
const webCryptoAlgo = exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO[digestAlgorithmUri];
|
|
42905
|
+
if (!webCryptoAlgo) {
|
|
42906
|
+
return void 0;
|
|
42907
|
+
}
|
|
42908
|
+
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
42909
|
+
return void 0;
|
|
42910
|
+
}
|
|
42911
|
+
const buf = new ArrayBuffer(content.byteLength);
|
|
42912
|
+
new Uint8Array(buf).set(content);
|
|
42913
|
+
const digest2 = await globalThis.crypto.subtle.digest(webCryptoAlgo, buf);
|
|
42914
|
+
return uint8ArrayToBase64(new Uint8Array(digest2));
|
|
42915
|
+
}
|
|
42916
|
+
function uint8ArrayToBase64(bytes) {
|
|
42917
|
+
let binary = "";
|
|
42918
|
+
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
42919
|
+
binary += String.fromCharCode(bytes[i2]);
|
|
42920
|
+
}
|
|
42921
|
+
return btoa(binary);
|
|
42922
|
+
}
|
|
42923
|
+
var init_digest = __esm({
|
|
42924
|
+
"src/opc/signature/digest.ts"() {
|
|
42925
|
+
init_constants3();
|
|
42926
|
+
}
|
|
42927
|
+
});
|
|
42928
|
+
|
|
42929
|
+
// src/opc/signature/inspection-status.ts
|
|
42930
|
+
function computeDetailStatus(detail, policy) {
|
|
42931
|
+
const hasDigestMismatch = detail.referenceChecks.some(
|
|
42932
|
+
(check) => check.digestStatus === "mismatch"
|
|
42933
|
+
);
|
|
42934
|
+
const hasMissingPart = detail.missingPartReferences.length > 0;
|
|
42935
|
+
const hasVerifiedDigest = detail.referenceChecks.some(
|
|
42936
|
+
(check) => check.digestStatus === "verified"
|
|
42937
|
+
);
|
|
42938
|
+
const revocationUnknown = detail.certificateRevocationStatus === "unknown" || detail.certificateRevocationStatus === "not-checked" || detail.certificateRevocationStatus === "error";
|
|
42939
|
+
const timestampMissingOrUntrusted = detail.timestampAuthorityStatus === "not-present" || detail.timestampAuthorityStatus === "not-checked" || detail.timestampAuthorityStatus === "error" || detail.timestampAuthorityStatus === "untrusted";
|
|
42940
|
+
if (detail.signatureValueStatus === "invalid") {
|
|
42941
|
+
return "signature-invalid";
|
|
42942
|
+
}
|
|
42943
|
+
if (hasMissingPart) {
|
|
42944
|
+
return "reference-missing";
|
|
42945
|
+
}
|
|
42946
|
+
if (hasDigestMismatch) {
|
|
42947
|
+
return "digest-mismatch";
|
|
42948
|
+
}
|
|
42949
|
+
if (detail.certificateRevocationStatus === "revoked") {
|
|
42950
|
+
return "certificate-revoked";
|
|
42951
|
+
}
|
|
42952
|
+
if (policy.requireRevocationCheck && (policy.failOnRevocationUnknown ? revocationUnknown : detail.certificateRevocationStatus !== "good")) {
|
|
42953
|
+
return "certificate-untrusted";
|
|
42954
|
+
}
|
|
42955
|
+
if (detail.timestampAuthorityStatus === "invalid") {
|
|
42956
|
+
return "timestamp-invalid";
|
|
42957
|
+
}
|
|
42958
|
+
if (policy.requireTimestamp && timestampMissingOrUntrusted) {
|
|
42959
|
+
return "timestamp-untrusted";
|
|
42960
|
+
}
|
|
42961
|
+
if (detail.timestampAuthorityStatus === "untrusted") {
|
|
42962
|
+
return "timestamp-untrusted";
|
|
42963
|
+
}
|
|
42964
|
+
if (detail.certificateTrustStatus === "untrusted" && detail.signatureValueStatus === "verified") {
|
|
42965
|
+
return "certificate-untrusted";
|
|
42966
|
+
}
|
|
42967
|
+
if (hasVerifiedDigest && detail.signatureValueStatus === "verified") {
|
|
42968
|
+
return "verified";
|
|
42969
|
+
}
|
|
42970
|
+
return "structural-only";
|
|
42971
|
+
}
|
|
42972
|
+
function computeVerificationStatus(details) {
|
|
42973
|
+
const hasInvalidSignature = details.some((detail) => detail.status === "signature-invalid");
|
|
42974
|
+
const hasMissing = details.some((detail) => detail.status === "reference-missing");
|
|
42975
|
+
const hasMismatch = details.some((detail) => detail.status === "digest-mismatch");
|
|
42976
|
+
const hasUntrusted = details.some((detail) => detail.status === "certificate-untrusted");
|
|
42977
|
+
const hasRevoked = details.some((detail) => detail.status === "certificate-revoked");
|
|
42978
|
+
const hasTimestampInvalid = details.some((detail) => detail.status === "timestamp-invalid");
|
|
42979
|
+
const hasTimestampUntrusted = details.some((detail) => detail.status === "timestamp-untrusted");
|
|
42980
|
+
const allVerified = details.every((detail) => detail.status === "verified");
|
|
42981
|
+
return hasInvalidSignature ? "signature-invalid" : hasRevoked ? "certificate-revoked" : hasTimestampInvalid ? "timestamp-invalid" : hasTimestampUntrusted ? "timestamp-untrusted" : hasMissing ? "reference-missing" : hasMismatch ? "digest-mismatch" : allVerified ? "verified-trusted" : hasUntrusted ? "verified-untrusted" : "present-not-verified";
|
|
42982
|
+
}
|
|
42983
|
+
var init_inspection_status = __esm({
|
|
42984
|
+
"src/opc/signature/inspection-status.ts"() {
|
|
42985
|
+
}
|
|
42986
|
+
});
|
|
42987
|
+
|
|
42988
|
+
// src/opc/signature/index.ts
|
|
42989
|
+
var init_signature = __esm({
|
|
42990
|
+
"src/opc/signature/index.ts"() {
|
|
42592
42991
|
}
|
|
42593
42992
|
});
|
|
42594
42993
|
|
|
@@ -42600,6 +42999,8 @@ var init_opc = __esm({
|
|
|
42600
42999
|
init_content_types();
|
|
42601
43000
|
init_package();
|
|
42602
43001
|
init_safe_href();
|
|
43002
|
+
init_properties();
|
|
43003
|
+
init_signature();
|
|
42603
43004
|
}
|
|
42604
43005
|
});
|
|
42605
43006
|
|
|
@@ -44291,25 +44692,43 @@ var init_theme_override_utils = __esm({
|
|
|
44291
44692
|
}
|
|
44292
44693
|
});
|
|
44293
44694
|
|
|
44294
|
-
// src/
|
|
44295
|
-
function
|
|
44296
|
-
if (
|
|
44297
|
-
return
|
|
44298
|
-
}
|
|
44299
|
-
const header = new Uint8Array(data, 0, 8);
|
|
44300
|
-
if (OLE_MAGIC2.every((byte, i2) => header[i2] === byte)) {
|
|
44301
|
-
return { format: "ole", encrypted: true };
|
|
44695
|
+
// src/crypto/detect.ts
|
|
44696
|
+
function toArrayBuffer(bytes) {
|
|
44697
|
+
if (bytes.byteOffset === 0 && bytes.byteLength === bytes.buffer.byteLength) {
|
|
44698
|
+
return bytes.buffer;
|
|
44302
44699
|
}
|
|
44303
|
-
|
|
44304
|
-
|
|
44700
|
+
return bytes.slice().buffer;
|
|
44701
|
+
}
|
|
44702
|
+
function isCompoundFile(input) {
|
|
44703
|
+
const bytes = toBytes(input);
|
|
44704
|
+
return bytes.length >= 8 && OLE_MAGIC2.every((value, index) => bytes[index] === value);
|
|
44705
|
+
}
|
|
44706
|
+
function openEncryptedPackage(input) {
|
|
44707
|
+
const bytes = toBytes(input);
|
|
44708
|
+
if (!isCompoundFile(bytes)) return void 0;
|
|
44709
|
+
try {
|
|
44710
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
44711
|
+
if (!file.entries.some((entry) => entry.name === "EncryptedPackage")) return void 0;
|
|
44712
|
+
const encryptionInfo = file.getStream("EncryptionInfo");
|
|
44713
|
+
const encryptedPackage = encryptionInfo && file.getStream("EncryptedPackage");
|
|
44714
|
+
return encryptionInfo && encryptedPackage ? { encryptionInfo, encryptedPackage } : void 0;
|
|
44715
|
+
} catch {
|
|
44716
|
+
return void 0;
|
|
44305
44717
|
}
|
|
44718
|
+
}
|
|
44719
|
+
function detectFileFormat(data) {
|
|
44720
|
+
const bytes = toBytes(data);
|
|
44721
|
+
if (bytes.length < 8) return { format: "unknown", encrypted: false };
|
|
44722
|
+
if (isCompoundFile(bytes)) return { format: "ole", encrypted: true };
|
|
44723
|
+
if (bytes[0] === 80 && bytes[1] === 75) return { format: "zip", encrypted: false };
|
|
44306
44724
|
return { format: "unknown", encrypted: false };
|
|
44307
44725
|
}
|
|
44308
|
-
var OLE_MAGIC2,
|
|
44309
|
-
var
|
|
44310
|
-
"src/
|
|
44311
|
-
|
|
44312
|
-
|
|
44726
|
+
var OLE_MAGIC2, toBytes; exports.EncryptedFileError = void 0;
|
|
44727
|
+
var init_detect = __esm({
|
|
44728
|
+
"src/crypto/detect.ts"() {
|
|
44729
|
+
init_ole2_parser_read();
|
|
44730
|
+
OLE_MAGIC2 = [208, 207, 17, 224, 161, 177, 26, 225];
|
|
44731
|
+
toBytes = (input) => input instanceof Uint8Array ? input : new Uint8Array(input);
|
|
44313
44732
|
exports.EncryptedFileError = class extends Error {
|
|
44314
44733
|
isEncrypted = true;
|
|
44315
44734
|
constructor(message) {
|
|
@@ -44320,31 +44739,10 @@ var init_encryption_detection = __esm({
|
|
|
44320
44739
|
}
|
|
44321
44740
|
});
|
|
44322
44741
|
|
|
44323
|
-
// src/pptx/core/utils/
|
|
44324
|
-
var
|
|
44325
|
-
"src/pptx/core/utils/
|
|
44326
|
-
|
|
44327
|
-
init_ole2_parser_read2();
|
|
44328
|
-
init_ole2_parser_write2();
|
|
44329
|
-
}
|
|
44330
|
-
});
|
|
44331
|
-
|
|
44332
|
-
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
44333
|
-
exports.IncorrectPasswordError = void 0; exports.DataIntegrityError = void 0;
|
|
44334
|
-
var init_ooxml_crypto_errors = __esm({
|
|
44335
|
-
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
44336
|
-
exports.IncorrectPasswordError = class extends Error {
|
|
44337
|
-
constructor(message = "The password is incorrect.") {
|
|
44338
|
-
super(message);
|
|
44339
|
-
this.name = "IncorrectPasswordError";
|
|
44340
|
-
}
|
|
44341
|
-
};
|
|
44342
|
-
exports.DataIntegrityError = class extends Error {
|
|
44343
|
-
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
44344
|
-
super(message);
|
|
44345
|
-
this.name = "DataIntegrityError";
|
|
44346
|
-
}
|
|
44347
|
-
};
|
|
44742
|
+
// src/pptx/core/utils/encryption-detection.ts
|
|
44743
|
+
var init_encryption_detection = __esm({
|
|
44744
|
+
"src/pptx/core/utils/encryption-detection.ts"() {
|
|
44745
|
+
init_detect();
|
|
44348
44746
|
}
|
|
44349
44747
|
});
|
|
44350
44748
|
|
|
@@ -44470,71 +44868,644 @@ var init_ooxml_crypto_primitives = __esm({
|
|
|
44470
44868
|
}
|
|
44471
44869
|
});
|
|
44472
44870
|
|
|
44473
|
-
// src/
|
|
44474
|
-
|
|
44475
|
-
|
|
44871
|
+
// src/crypto/aes-ecb.ts
|
|
44872
|
+
async function aesEcbDecrypt(key2, data) {
|
|
44873
|
+
const plain = await aesCbcDecryptRaw(key2, new Uint8Array(BLOCK), data);
|
|
44874
|
+
for (let at2 = BLOCK; at2 < plain.length && at2 < data.length; at2++) {
|
|
44875
|
+
plain[at2] = plain[at2] ^ data[at2 - BLOCK];
|
|
44876
|
+
}
|
|
44877
|
+
return plain;
|
|
44878
|
+
}
|
|
44879
|
+
async function aesEcbEncrypt(key2, data) {
|
|
44880
|
+
const padded = new Uint8Array(Math.ceil(data.length / BLOCK) * BLOCK);
|
|
44881
|
+
padded.set(data);
|
|
44882
|
+
const subtle = getSubtle();
|
|
44883
|
+
const cryptoKey = await subtle.importKey("raw", key2, { name: "AES-CBC" }, false, [
|
|
44884
|
+
"encrypt"
|
|
44885
|
+
]);
|
|
44886
|
+
const iv = new Uint8Array(BLOCK);
|
|
44887
|
+
const out = new Uint8Array(padded.length);
|
|
44888
|
+
for (let start = 0; start < padded.length; start += BLOCK * BATCH) {
|
|
44889
|
+
const end = Math.min(padded.length, start + BLOCK * BATCH);
|
|
44890
|
+
const jobs = [];
|
|
44891
|
+
for (let at2 = start; at2 < end; at2 += BLOCK) {
|
|
44892
|
+
const block = padded.slice(at2, at2 + BLOCK);
|
|
44893
|
+
jobs.push(
|
|
44894
|
+
subtle.encrypt({ name: "AES-CBC", iv }, cryptoKey, block).then((result) => {
|
|
44895
|
+
out.set(new Uint8Array(result, 0, BLOCK), at2);
|
|
44896
|
+
})
|
|
44897
|
+
);
|
|
44898
|
+
}
|
|
44899
|
+
await Promise.all(jobs);
|
|
44900
|
+
}
|
|
44901
|
+
return out;
|
|
44902
|
+
}
|
|
44903
|
+
var BLOCK, BATCH;
|
|
44904
|
+
var init_aes_ecb = __esm({
|
|
44905
|
+
"src/crypto/aes-ecb.ts"() {
|
|
44476
44906
|
init_ooxml_crypto_primitives();
|
|
44907
|
+
BLOCK = 16;
|
|
44908
|
+
BATCH = 4096;
|
|
44477
44909
|
}
|
|
44478
44910
|
});
|
|
44479
44911
|
|
|
44480
|
-
// src/
|
|
44481
|
-
|
|
44912
|
+
// src/crypto/errors.ts
|
|
44913
|
+
exports.IncorrectPasswordError = void 0; exports.DataIntegrityError = void 0;
|
|
44914
|
+
var init_errors = __esm({
|
|
44915
|
+
"src/crypto/errors.ts"() {
|
|
44916
|
+
exports.IncorrectPasswordError = class extends Error {
|
|
44917
|
+
code = "incorrect-password";
|
|
44918
|
+
constructor(message = "The password is incorrect.") {
|
|
44919
|
+
super(message);
|
|
44920
|
+
this.name = "IncorrectPasswordError";
|
|
44921
|
+
}
|
|
44922
|
+
};
|
|
44923
|
+
exports.DataIntegrityError = class extends Error {
|
|
44924
|
+
code = "data-integrity";
|
|
44925
|
+
constructor(message = "Data integrity check failed. The encrypted file may be corrupted or tampered with.") {
|
|
44926
|
+
super(message);
|
|
44927
|
+
this.name = "DataIntegrityError";
|
|
44928
|
+
}
|
|
44929
|
+
};
|
|
44930
|
+
}
|
|
44931
|
+
});
|
|
44932
|
+
|
|
44933
|
+
// src/digest/algorithm-names.ts
|
|
44934
|
+
function normalizeDigestAlgorithmName(name) {
|
|
44935
|
+
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
44936
|
+
return Object.hasOwn(CANONICAL_BY_LOOKUP_KEY, key2) ? CANONICAL_BY_LOOKUP_KEY[key2] : void 0;
|
|
44937
|
+
}
|
|
44938
|
+
var CANONICAL_BY_LOOKUP_KEY;
|
|
44939
|
+
var init_algorithm_names = __esm({
|
|
44940
|
+
"src/digest/algorithm-names.ts"() {
|
|
44941
|
+
CANONICAL_BY_LOOKUP_KEY = {
|
|
44942
|
+
SHA1: "SHA-1",
|
|
44943
|
+
SHA256: "SHA-256",
|
|
44944
|
+
SHA384: "SHA-384",
|
|
44945
|
+
SHA512: "SHA-512",
|
|
44946
|
+
MD2: "MD2",
|
|
44947
|
+
MD4: "MD4",
|
|
44948
|
+
MD5: "MD5",
|
|
44949
|
+
RIPEMD128: "RIPEMD-128",
|
|
44950
|
+
RIPEMD160: "RIPEMD-160",
|
|
44951
|
+
WHIRLPOOL: "WHIRLPOOL"
|
|
44952
|
+
};
|
|
44953
|
+
}
|
|
44954
|
+
});
|
|
44955
|
+
|
|
44956
|
+
// src/digest/sha256.ts
|
|
44957
|
+
function compress(h2, view, offset) {
|
|
44958
|
+
for (let i2 = 0; i2 < 16; i2++) W[i2] = view.getUint32(offset + i2 * 4);
|
|
44959
|
+
for (let i2 = 16; i2 < 64; i2++) {
|
|
44960
|
+
const a2 = W[i2 - 15];
|
|
44961
|
+
const b2 = W[i2 - 2];
|
|
44962
|
+
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
44963
|
+
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
44964
|
+
W[i2] = W[i2 - 16] + s0 + W[i2 - 7] + s1 >>> 0;
|
|
44965
|
+
}
|
|
44966
|
+
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4], f6 = h2[5], g2 = h2[6], k = h2[7];
|
|
44967
|
+
for (let i2 = 0; i2 < 64; i2++) {
|
|
44968
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
44969
|
+
const ch = e & f6 ^ ~e & g2;
|
|
44970
|
+
const t1 = k + S1 + ch + K[i2] + W[i2] >>> 0;
|
|
44971
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
44972
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
44973
|
+
const t2 = S0 + maj >>> 0;
|
|
44974
|
+
k = g2;
|
|
44975
|
+
g2 = f6;
|
|
44976
|
+
f6 = e;
|
|
44977
|
+
e = d + t1 >>> 0;
|
|
44978
|
+
d = c;
|
|
44979
|
+
c = b;
|
|
44980
|
+
b = a;
|
|
44981
|
+
a = t1 + t2 >>> 0;
|
|
44982
|
+
}
|
|
44983
|
+
h2[0] = h2[0] + a >>> 0;
|
|
44984
|
+
h2[1] = h2[1] + b >>> 0;
|
|
44985
|
+
h2[2] = h2[2] + c >>> 0;
|
|
44986
|
+
h2[3] = h2[3] + d >>> 0;
|
|
44987
|
+
h2[4] = h2[4] + e >>> 0;
|
|
44988
|
+
h2[5] = h2[5] + f6 >>> 0;
|
|
44989
|
+
h2[6] = h2[6] + g2 >>> 0;
|
|
44990
|
+
h2[7] = h2[7] + k >>> 0;
|
|
44991
|
+
}
|
|
44992
|
+
function pad64(data) {
|
|
44993
|
+
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
44994
|
+
padded.set(data);
|
|
44995
|
+
padded[data.length] = 128;
|
|
44996
|
+
const bits = data.length * 8;
|
|
44997
|
+
const view = new DataView(padded.buffer);
|
|
44998
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
44999
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
45000
|
+
return view;
|
|
45001
|
+
}
|
|
45002
|
+
function wordsOut(h2) {
|
|
45003
|
+
const out = new Uint8Array(h2.length * 4);
|
|
45004
|
+
const view = new DataView(out.buffer);
|
|
45005
|
+
for (let i2 = 0; i2 < h2.length; i2++) view.setUint32(i2 * 4, h2[i2]);
|
|
45006
|
+
return out;
|
|
45007
|
+
}
|
|
45008
|
+
function sha256(data) {
|
|
45009
|
+
const h2 = new Uint32Array(IV);
|
|
45010
|
+
const view = pad64(data);
|
|
45011
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h2, view, offset);
|
|
45012
|
+
return wordsOut(h2);
|
|
45013
|
+
}
|
|
45014
|
+
var K, IV, W, rotr;
|
|
45015
|
+
var init_sha256 = __esm({
|
|
45016
|
+
"src/digest/sha256.ts"() {
|
|
45017
|
+
K = new Uint32Array([
|
|
45018
|
+
1116352408,
|
|
45019
|
+
1899447441,
|
|
45020
|
+
3049323471,
|
|
45021
|
+
3921009573,
|
|
45022
|
+
961987163,
|
|
45023
|
+
1508970993,
|
|
45024
|
+
2453635748,
|
|
45025
|
+
2870763221,
|
|
45026
|
+
3624381080,
|
|
45027
|
+
310598401,
|
|
45028
|
+
607225278,
|
|
45029
|
+
1426881987,
|
|
45030
|
+
1925078388,
|
|
45031
|
+
2162078206,
|
|
45032
|
+
2614888103,
|
|
45033
|
+
3248222580,
|
|
45034
|
+
3835390401,
|
|
45035
|
+
4022224774,
|
|
45036
|
+
264347078,
|
|
45037
|
+
604807628,
|
|
45038
|
+
770255983,
|
|
45039
|
+
1249150122,
|
|
45040
|
+
1555081692,
|
|
45041
|
+
1996064986,
|
|
45042
|
+
2554220882,
|
|
45043
|
+
2821834349,
|
|
45044
|
+
2952996808,
|
|
45045
|
+
3210313671,
|
|
45046
|
+
3336571891,
|
|
45047
|
+
3584528711,
|
|
45048
|
+
113926993,
|
|
45049
|
+
338241895,
|
|
45050
|
+
666307205,
|
|
45051
|
+
773529912,
|
|
45052
|
+
1294757372,
|
|
45053
|
+
1396182291,
|
|
45054
|
+
1695183700,
|
|
45055
|
+
1986661051,
|
|
45056
|
+
2177026350,
|
|
45057
|
+
2456956037,
|
|
45058
|
+
2730485921,
|
|
45059
|
+
2820302411,
|
|
45060
|
+
3259730800,
|
|
45061
|
+
3345764771,
|
|
45062
|
+
3516065817,
|
|
45063
|
+
3600352804,
|
|
45064
|
+
4094571909,
|
|
45065
|
+
275423344,
|
|
45066
|
+
430227734,
|
|
45067
|
+
506948616,
|
|
45068
|
+
659060556,
|
|
45069
|
+
883997877,
|
|
45070
|
+
958139571,
|
|
45071
|
+
1322822218,
|
|
45072
|
+
1537002063,
|
|
45073
|
+
1747873779,
|
|
45074
|
+
1955562222,
|
|
45075
|
+
2024104815,
|
|
45076
|
+
2227730452,
|
|
45077
|
+
2361852424,
|
|
45078
|
+
2428436474,
|
|
45079
|
+
2756734187,
|
|
45080
|
+
3204031479,
|
|
45081
|
+
3329325298
|
|
45082
|
+
]);
|
|
45083
|
+
IV = [
|
|
45084
|
+
1779033703,
|
|
45085
|
+
3144134277,
|
|
45086
|
+
1013904242,
|
|
45087
|
+
2773480762,
|
|
45088
|
+
1359893119,
|
|
45089
|
+
2600822924,
|
|
45090
|
+
528734635,
|
|
45091
|
+
1541459225
|
|
45092
|
+
];
|
|
45093
|
+
W = new Uint32Array(64);
|
|
45094
|
+
rotr = (x, n) => x >>> n | x << 32 - n;
|
|
45095
|
+
}
|
|
45096
|
+
});
|
|
45097
|
+
|
|
45098
|
+
// src/digest/sha1.ts
|
|
45099
|
+
function compress2(h2, view, offset) {
|
|
45100
|
+
for (let i2 = 0; i2 < 16; i2++) W2[i2] = view.getUint32(offset + i2 * 4);
|
|
45101
|
+
for (let i2 = 16; i2 < 80; i2++) W2[i2] = rotl(W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16], 1);
|
|
45102
|
+
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4];
|
|
45103
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
45104
|
+
let f6;
|
|
45105
|
+
let k;
|
|
45106
|
+
if (i2 < 20) {
|
|
45107
|
+
f6 = b & c | ~b & d;
|
|
45108
|
+
k = 1518500249;
|
|
45109
|
+
} else if (i2 < 40) {
|
|
45110
|
+
f6 = b ^ c ^ d;
|
|
45111
|
+
k = 1859775393;
|
|
45112
|
+
} else if (i2 < 60) {
|
|
45113
|
+
f6 = b & c | b & d | c & d;
|
|
45114
|
+
k = 2400959708;
|
|
45115
|
+
} else {
|
|
45116
|
+
f6 = b ^ c ^ d;
|
|
45117
|
+
k = 3395469782;
|
|
45118
|
+
}
|
|
45119
|
+
const t = rotl(a, 5) + f6 + e + k + W2[i2] >>> 0;
|
|
45120
|
+
e = d;
|
|
45121
|
+
d = c;
|
|
45122
|
+
c = rotl(b, 30) >>> 0;
|
|
45123
|
+
b = a;
|
|
45124
|
+
a = t;
|
|
45125
|
+
}
|
|
45126
|
+
h2[0] = h2[0] + a >>> 0;
|
|
45127
|
+
h2[1] = h2[1] + b >>> 0;
|
|
45128
|
+
h2[2] = h2[2] + c >>> 0;
|
|
45129
|
+
h2[3] = h2[3] + d >>> 0;
|
|
45130
|
+
h2[4] = h2[4] + e >>> 0;
|
|
45131
|
+
}
|
|
45132
|
+
function sha1(data) {
|
|
45133
|
+
const h2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
45134
|
+
const view = pad64(data);
|
|
45135
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h2, view, offset);
|
|
45136
|
+
return wordsOut(h2);
|
|
45137
|
+
}
|
|
45138
|
+
var W2, rotl;
|
|
45139
|
+
var init_sha1 = __esm({
|
|
45140
|
+
"src/digest/sha1.ts"() {
|
|
45141
|
+
init_sha256();
|
|
45142
|
+
W2 = new Uint32Array(80);
|
|
45143
|
+
rotl = (x, n) => x << n | x >>> 32 - n;
|
|
45144
|
+
}
|
|
45145
|
+
});
|
|
45146
|
+
|
|
45147
|
+
// src/digest/sha512.ts
|
|
45148
|
+
function compress3(h2, data, offset) {
|
|
45149
|
+
for (let i2 = 0; i2 < 32; i2++) {
|
|
45150
|
+
const o = offset + i2 * 4;
|
|
45151
|
+
W3[i2] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
45152
|
+
}
|
|
45153
|
+
for (let i2 = 16; i2 < 80; i2++) {
|
|
45154
|
+
const xh = W3[(i2 - 15) * 2];
|
|
45155
|
+
const xl = W3[(i2 - 15) * 2 + 1];
|
|
45156
|
+
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
45157
|
+
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
45158
|
+
const yh = W3[(i2 - 2) * 2];
|
|
45159
|
+
const yl = W3[(i2 - 2) * 2 + 1];
|
|
45160
|
+
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
45161
|
+
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
45162
|
+
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i2 - 7) * 2 + 1] + W3[(i2 - 16) * 2 + 1];
|
|
45163
|
+
const hi = s0h + s1h + W3[(i2 - 7) * 2] + W3[(i2 - 16) * 2] + Math.floor(lo / 4294967296);
|
|
45164
|
+
lo >>>= 0;
|
|
45165
|
+
W3[i2 * 2] = hi >>> 0;
|
|
45166
|
+
W3[i2 * 2 + 1] = lo;
|
|
45167
|
+
}
|
|
45168
|
+
let ah = h2[0], al = h2[1], bh = h2[2], bl = h2[3], ch = h2[4], cl = h2[5], dh = h2[6], dl = h2[7];
|
|
45169
|
+
let eh = h2[8], el = h2[9], fh = h2[10], fl = h2[11], gh = h2[12], gl = h2[13], hh = h2[14], hl = h2[15];
|
|
45170
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
45171
|
+
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
45172
|
+
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
45173
|
+
const chh = eh & fh ^ ~eh & gh;
|
|
45174
|
+
const chl = el & fl ^ ~el & gl;
|
|
45175
|
+
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i2 * 2 + 1] + W3[i2 * 2 + 1];
|
|
45176
|
+
const t1h = hh + S1h + chh + K2[i2 * 2] + W3[i2 * 2] + Math.floor(t1l / 4294967296);
|
|
45177
|
+
t1l >>>= 0;
|
|
45178
|
+
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
45179
|
+
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
45180
|
+
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
45181
|
+
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
45182
|
+
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
45183
|
+
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
45184
|
+
t2l >>>= 0;
|
|
45185
|
+
hh = gh;
|
|
45186
|
+
hl = gl;
|
|
45187
|
+
gh = fh;
|
|
45188
|
+
gl = fl;
|
|
45189
|
+
fh = eh;
|
|
45190
|
+
fl = el;
|
|
45191
|
+
let nl = (dl >>> 0) + t1l;
|
|
45192
|
+
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
45193
|
+
el = nl >>> 0;
|
|
45194
|
+
dh = ch;
|
|
45195
|
+
dl = cl;
|
|
45196
|
+
ch = bh;
|
|
45197
|
+
cl = bl;
|
|
45198
|
+
bh = ah;
|
|
45199
|
+
bl = al;
|
|
45200
|
+
nl = t1l + t2l;
|
|
45201
|
+
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
45202
|
+
al = nl >>> 0;
|
|
45203
|
+
}
|
|
45204
|
+
const add7 = (i2, xh, xl) => {
|
|
45205
|
+
const lo = (h2[i2 + 1] >>> 0) + (xl >>> 0);
|
|
45206
|
+
h2[i2] = h2[i2] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
45207
|
+
h2[i2 + 1] = lo >>> 0;
|
|
45208
|
+
};
|
|
45209
|
+
add7(0, ah, al);
|
|
45210
|
+
add7(2, bh, bl);
|
|
45211
|
+
add7(4, ch, cl);
|
|
45212
|
+
add7(6, dh, dl);
|
|
45213
|
+
add7(8, eh, el);
|
|
45214
|
+
add7(10, fh, fl);
|
|
45215
|
+
add7(12, gh, gl);
|
|
45216
|
+
add7(14, hh, hl);
|
|
45217
|
+
}
|
|
45218
|
+
function digest64(data, iv, bytes) {
|
|
45219
|
+
const h2 = new Uint32Array(iv);
|
|
45220
|
+
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
45221
|
+
padded.set(data);
|
|
45222
|
+
padded[data.length] = 128;
|
|
45223
|
+
const bits = data.length * 8;
|
|
45224
|
+
const view = new DataView(padded.buffer);
|
|
45225
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
45226
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
45227
|
+
for (let offset = 0; offset < padded.length; offset += 128) compress3(h2, padded, offset);
|
|
45228
|
+
const out = new Uint8Array(bytes);
|
|
45229
|
+
const outView = new DataView(out.buffer);
|
|
45230
|
+
for (let i2 = 0; i2 < bytes / 4; i2++) outView.setUint32(i2 * 4, h2[i2]);
|
|
45231
|
+
return out;
|
|
45232
|
+
}
|
|
45233
|
+
var K2, IV_512, IV_384, W3, sha512, sha384;
|
|
45234
|
+
var init_sha512 = __esm({
|
|
45235
|
+
"src/digest/sha512.ts"() {
|
|
45236
|
+
K2 = new Uint32Array([
|
|
45237
|
+
1116352408,
|
|
45238
|
+
3609767458,
|
|
45239
|
+
1899447441,
|
|
45240
|
+
602891725,
|
|
45241
|
+
3049323471,
|
|
45242
|
+
3964484399,
|
|
45243
|
+
3921009573,
|
|
45244
|
+
2173295548,
|
|
45245
|
+
961987163,
|
|
45246
|
+
4081628472,
|
|
45247
|
+
1508970993,
|
|
45248
|
+
3053834265,
|
|
45249
|
+
2453635748,
|
|
45250
|
+
2937671579,
|
|
45251
|
+
2870763221,
|
|
45252
|
+
3664609560,
|
|
45253
|
+
3624381080,
|
|
45254
|
+
2734883394,
|
|
45255
|
+
310598401,
|
|
45256
|
+
1164996542,
|
|
45257
|
+
607225278,
|
|
45258
|
+
1323610764,
|
|
45259
|
+
1426881987,
|
|
45260
|
+
3590304994,
|
|
45261
|
+
1925078388,
|
|
45262
|
+
4068182383,
|
|
45263
|
+
2162078206,
|
|
45264
|
+
991336113,
|
|
45265
|
+
2614888103,
|
|
45266
|
+
633803317,
|
|
45267
|
+
3248222580,
|
|
45268
|
+
3479774868,
|
|
45269
|
+
3835390401,
|
|
45270
|
+
2666613458,
|
|
45271
|
+
4022224774,
|
|
45272
|
+
944711139,
|
|
45273
|
+
264347078,
|
|
45274
|
+
2341262773,
|
|
45275
|
+
604807628,
|
|
45276
|
+
2007800933,
|
|
45277
|
+
770255983,
|
|
45278
|
+
1495990901,
|
|
45279
|
+
1249150122,
|
|
45280
|
+
1856431235,
|
|
45281
|
+
1555081692,
|
|
45282
|
+
3175218132,
|
|
45283
|
+
1996064986,
|
|
45284
|
+
2198950837,
|
|
45285
|
+
2554220882,
|
|
45286
|
+
3999719339,
|
|
45287
|
+
2821834349,
|
|
45288
|
+
766784016,
|
|
45289
|
+
2952996808,
|
|
45290
|
+
2566594879,
|
|
45291
|
+
3210313671,
|
|
45292
|
+
3203337956,
|
|
45293
|
+
3336571891,
|
|
45294
|
+
1034457026,
|
|
45295
|
+
3584528711,
|
|
45296
|
+
2466948901,
|
|
45297
|
+
113926993,
|
|
45298
|
+
3758326383,
|
|
45299
|
+
338241895,
|
|
45300
|
+
168717936,
|
|
45301
|
+
666307205,
|
|
45302
|
+
1188179964,
|
|
45303
|
+
773529912,
|
|
45304
|
+
1546045734,
|
|
45305
|
+
1294757372,
|
|
45306
|
+
1522805485,
|
|
45307
|
+
1396182291,
|
|
45308
|
+
2643833823,
|
|
45309
|
+
1695183700,
|
|
45310
|
+
2343527390,
|
|
45311
|
+
1986661051,
|
|
45312
|
+
1014477480,
|
|
45313
|
+
2177026350,
|
|
45314
|
+
1206759142,
|
|
45315
|
+
2456956037,
|
|
45316
|
+
344077627,
|
|
45317
|
+
2730485921,
|
|
45318
|
+
1290863460,
|
|
45319
|
+
2820302411,
|
|
45320
|
+
3158454273,
|
|
45321
|
+
3259730800,
|
|
45322
|
+
3505952657,
|
|
45323
|
+
3345764771,
|
|
45324
|
+
106217008,
|
|
45325
|
+
3516065817,
|
|
45326
|
+
3606008344,
|
|
45327
|
+
3600352804,
|
|
45328
|
+
1432725776,
|
|
45329
|
+
4094571909,
|
|
45330
|
+
1467031594,
|
|
45331
|
+
275423344,
|
|
45332
|
+
851169720,
|
|
45333
|
+
430227734,
|
|
45334
|
+
3100823752,
|
|
45335
|
+
506948616,
|
|
45336
|
+
1363258195,
|
|
45337
|
+
659060556,
|
|
45338
|
+
3750685593,
|
|
45339
|
+
883997877,
|
|
45340
|
+
3785050280,
|
|
45341
|
+
958139571,
|
|
45342
|
+
3318307427,
|
|
45343
|
+
1322822218,
|
|
45344
|
+
3812723403,
|
|
45345
|
+
1537002063,
|
|
45346
|
+
2003034995,
|
|
45347
|
+
1747873779,
|
|
45348
|
+
3602036899,
|
|
45349
|
+
1955562222,
|
|
45350
|
+
1575990012,
|
|
45351
|
+
2024104815,
|
|
45352
|
+
1125592928,
|
|
45353
|
+
2227730452,
|
|
45354
|
+
2716904306,
|
|
45355
|
+
2361852424,
|
|
45356
|
+
442776044,
|
|
45357
|
+
2428436474,
|
|
45358
|
+
593698344,
|
|
45359
|
+
2756734187,
|
|
45360
|
+
3733110249,
|
|
45361
|
+
3204031479,
|
|
45362
|
+
2999351573,
|
|
45363
|
+
3329325298,
|
|
45364
|
+
3815920427,
|
|
45365
|
+
3391569614,
|
|
45366
|
+
3928383900,
|
|
45367
|
+
3515267271,
|
|
45368
|
+
566280711,
|
|
45369
|
+
3940187606,
|
|
45370
|
+
3454069534,
|
|
45371
|
+
4118630271,
|
|
45372
|
+
4000239992,
|
|
45373
|
+
116418474,
|
|
45374
|
+
1914138554,
|
|
45375
|
+
174292421,
|
|
45376
|
+
2731055270,
|
|
45377
|
+
289380356,
|
|
45378
|
+
3203993006,
|
|
45379
|
+
460393269,
|
|
45380
|
+
320620315,
|
|
45381
|
+
685471733,
|
|
45382
|
+
587496836,
|
|
45383
|
+
852142971,
|
|
45384
|
+
1086792851,
|
|
45385
|
+
1017036298,
|
|
45386
|
+
365543100,
|
|
45387
|
+
1126000580,
|
|
45388
|
+
2618297676,
|
|
45389
|
+
1288033470,
|
|
45390
|
+
3409855158,
|
|
45391
|
+
1501505948,
|
|
45392
|
+
4234509866,
|
|
45393
|
+
1607167915,
|
|
45394
|
+
987167468,
|
|
45395
|
+
1816402316,
|
|
45396
|
+
1246189591
|
|
45397
|
+
]);
|
|
45398
|
+
IV_512 = [
|
|
45399
|
+
1779033703,
|
|
45400
|
+
4089235720,
|
|
45401
|
+
3144134277,
|
|
45402
|
+
2227873595,
|
|
45403
|
+
1013904242,
|
|
45404
|
+
4271175723,
|
|
45405
|
+
2773480762,
|
|
45406
|
+
1595750129,
|
|
45407
|
+
1359893119,
|
|
45408
|
+
2917565137,
|
|
45409
|
+
2600822924,
|
|
45410
|
+
725511199,
|
|
45411
|
+
528734635,
|
|
45412
|
+
4215389547,
|
|
45413
|
+
1541459225,
|
|
45414
|
+
327033209
|
|
45415
|
+
];
|
|
45416
|
+
IV_384 = [
|
|
45417
|
+
3418070365,
|
|
45418
|
+
3238371032,
|
|
45419
|
+
1654270250,
|
|
45420
|
+
914150663,
|
|
45421
|
+
2438529370,
|
|
45422
|
+
812702999,
|
|
45423
|
+
355462360,
|
|
45424
|
+
4144912697,
|
|
45425
|
+
1731405415,
|
|
45426
|
+
4290775857,
|
|
45427
|
+
2394180231,
|
|
45428
|
+
1750603025,
|
|
45429
|
+
3675008525,
|
|
45430
|
+
1694076839,
|
|
45431
|
+
1203062813,
|
|
45432
|
+
3204075428
|
|
45433
|
+
];
|
|
45434
|
+
W3 = new Uint32Array(160);
|
|
45435
|
+
sha512 = (data) => digest64(data, IV_512, 64);
|
|
45436
|
+
sha384 = (data) => digest64(data, IV_384, 48);
|
|
45437
|
+
}
|
|
45438
|
+
});
|
|
45439
|
+
|
|
45440
|
+
// src/digest/digest.ts
|
|
45441
|
+
function digestFunction(name) {
|
|
45442
|
+
const canonical = normalizeDigestAlgorithmName(name);
|
|
45443
|
+
return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
|
|
45444
|
+
}
|
|
45445
|
+
var DIGESTS;
|
|
45446
|
+
var init_digest2 = __esm({
|
|
45447
|
+
"src/digest/digest.ts"() {
|
|
45448
|
+
init_algorithm_names();
|
|
45449
|
+
init_sha1();
|
|
45450
|
+
init_sha256();
|
|
45451
|
+
init_sha512();
|
|
45452
|
+
DIGESTS = {
|
|
45453
|
+
"SHA-1": sha1,
|
|
45454
|
+
"SHA-256": sha256,
|
|
45455
|
+
"SHA-384": sha384,
|
|
45456
|
+
"SHA-512": sha512
|
|
45457
|
+
};
|
|
45458
|
+
}
|
|
45459
|
+
});
|
|
45460
|
+
|
|
45461
|
+
// src/crypto/key-derivation.ts
|
|
45462
|
+
async function spinPassword(password, salt, spinCount, hashAlgorithm) {
|
|
45463
|
+
if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
|
|
45464
|
+
throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
|
|
45465
|
+
}
|
|
44482
45466
|
const passwordBytes = encodePasswordUtf16LE(password);
|
|
45467
|
+
const digest2 = digestFunction(hashAlgorithm);
|
|
45468
|
+
if (digest2) {
|
|
45469
|
+
let h3 = digest2(concatArrays(salt, passwordBytes));
|
|
45470
|
+
const buffer = new Uint8Array(4 + h3.length);
|
|
45471
|
+
const view = new DataView(buffer.buffer);
|
|
45472
|
+
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
45473
|
+
view.setUint32(0, i2, true);
|
|
45474
|
+
buffer.set(h3, 4);
|
|
45475
|
+
h3 = digest2(buffer);
|
|
45476
|
+
}
|
|
45477
|
+
return h3;
|
|
45478
|
+
}
|
|
44483
45479
|
let h2 = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
|
|
44484
45480
|
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
44485
45481
|
h2 = await hash(hashAlgorithm, concatArrays(uint32LE(i2), h2));
|
|
44486
45482
|
}
|
|
44487
|
-
h2 = await hash(hashAlgorithm, concatArrays(h2, blockKey));
|
|
44488
|
-
const cbRequiredKeyLength = keyBits / 8;
|
|
44489
|
-
const cbHash = hashSize;
|
|
44490
|
-
const ipad = 54;
|
|
44491
|
-
const opad = 92;
|
|
44492
|
-
if (cbHash >= cbRequiredKeyLength) {
|
|
44493
|
-
return h2.subarray(0, cbRequiredKeyLength);
|
|
44494
|
-
}
|
|
44495
|
-
const x1Input = new Uint8Array(64);
|
|
44496
|
-
x1Input.fill(ipad);
|
|
44497
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44498
|
-
x1Input[i2] = h2[i2] ^ ipad;
|
|
44499
|
-
}
|
|
44500
|
-
const x1 = await hash(hashAlgorithm, x1Input);
|
|
44501
|
-
const x2Input = new Uint8Array(64);
|
|
44502
|
-
x2Input.fill(opad);
|
|
44503
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44504
|
-
x2Input[i2] = h2[i2] ^ opad;
|
|
44505
|
-
}
|
|
44506
|
-
const x2 = await hash(hashAlgorithm, x2Input);
|
|
44507
|
-
const x3 = concatArrays(x1, x2);
|
|
44508
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
44509
|
-
}
|
|
44510
|
-
async function computeStandardKeyBase(password, salt) {
|
|
44511
|
-
const passwordBytes = encodePasswordUtf16LE(password);
|
|
44512
|
-
let h2 = await hash("SHA-1", concatArrays(salt, passwordBytes));
|
|
44513
|
-
for (let i2 = 0; i2 < 5e4; i2++) {
|
|
44514
|
-
h2 = await hash("SHA-1", concatArrays(uint32LE(i2), h2));
|
|
44515
|
-
}
|
|
44516
45483
|
return h2;
|
|
44517
45484
|
}
|
|
45485
|
+
async function extendKey(h2, hashAlgorithm, keyLength) {
|
|
45486
|
+
const pad2 = async (value) => {
|
|
45487
|
+
const input = new Uint8Array(64).fill(value);
|
|
45488
|
+
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) input[i2] = h2[i2] ^ value;
|
|
45489
|
+
return hash(hashAlgorithm, input);
|
|
45490
|
+
};
|
|
45491
|
+
const x3 = concatArrays(await pad2(54), await pad2(92));
|
|
45492
|
+
return x3.subarray(0, keyLength);
|
|
45493
|
+
}
|
|
45494
|
+
function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
|
|
45495
|
+
return spinPassword(password, salt, spinCount, hashAlgorithm);
|
|
45496
|
+
}
|
|
45497
|
+
async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
45498
|
+
const h2 = await hash(hashAlgorithm, concatArrays(base, blockKey));
|
|
45499
|
+
const keyLength = keyBits / 8;
|
|
45500
|
+
if (hashSize >= keyLength) return h2.subarray(0, keyLength);
|
|
45501
|
+
return extendKey(h2, hashAlgorithm, keyLength);
|
|
45502
|
+
}
|
|
45503
|
+
function computeStandardKeyBase(password, salt) {
|
|
45504
|
+
return spinPassword(password, salt, 5e4, "SHA-1");
|
|
45505
|
+
}
|
|
44518
45506
|
async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
|
|
44519
45507
|
const h2 = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
|
|
44520
|
-
|
|
44521
|
-
if (h2.length >= cbRequiredKeyLength) {
|
|
44522
|
-
return h2.subarray(0, cbRequiredKeyLength);
|
|
44523
|
-
}
|
|
44524
|
-
const x1Input = new Uint8Array(64);
|
|
44525
|
-
x1Input.fill(54);
|
|
44526
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44527
|
-
x1Input[i2] = h2[i2] ^ 54;
|
|
44528
|
-
}
|
|
44529
|
-
const x1 = await hash("SHA-1", x1Input);
|
|
44530
|
-
const x2Input = new Uint8Array(64);
|
|
44531
|
-
x2Input.fill(92);
|
|
44532
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) {
|
|
44533
|
-
x2Input[i2] = h2[i2] ^ 92;
|
|
44534
|
-
}
|
|
44535
|
-
const x2 = await hash("SHA-1", x2Input);
|
|
44536
|
-
const x3 = concatArrays(x1, x2);
|
|
44537
|
-
return x3.subarray(0, cbRequiredKeyLength);
|
|
45508
|
+
return extendKey(h2, "SHA-1", keySize / 8);
|
|
44538
45509
|
}
|
|
44539
45510
|
async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
|
|
44540
45511
|
const base = await computeStandardKeyBase(password, salt);
|
|
@@ -44542,21 +45513,376 @@ async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumbe
|
|
|
44542
45513
|
}
|
|
44543
45514
|
async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
|
|
44544
45515
|
const h2 = await hash(hashAlgorithm, concatArrays(salt, blockKey));
|
|
44545
|
-
if (h2.length >= blockSize)
|
|
44546
|
-
|
|
44547
|
-
}
|
|
44548
|
-
const padded = new Uint8Array(blockSize);
|
|
44549
|
-
padded.fill(54);
|
|
45516
|
+
if (h2.length >= blockSize) return h2.subarray(0, blockSize);
|
|
45517
|
+
const padded = new Uint8Array(blockSize).fill(54);
|
|
44550
45518
|
padded.set(h2);
|
|
44551
45519
|
return padded;
|
|
44552
45520
|
}
|
|
45521
|
+
var BLOCK_KEYS, MAX_SPIN_COUNT;
|
|
45522
|
+
var init_key_derivation = __esm({
|
|
45523
|
+
"src/crypto/key-derivation.ts"() {
|
|
45524
|
+
init_ooxml_crypto_primitives();
|
|
45525
|
+
init_digest2();
|
|
45526
|
+
BLOCK_KEYS = {
|
|
45527
|
+
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
45528
|
+
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
45529
|
+
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
45530
|
+
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
45531
|
+
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
45532
|
+
};
|
|
45533
|
+
MAX_SPIN_COUNT = 1e7;
|
|
45534
|
+
}
|
|
45535
|
+
});
|
|
45536
|
+
|
|
45537
|
+
// src/crypto/decrypt.ts
|
|
45538
|
+
async function verifyAgilePassword(info, password) {
|
|
45539
|
+
const pke = info.passwordKeyEncryptor;
|
|
45540
|
+
const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
|
|
45541
|
+
const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
|
|
45542
|
+
const verifierHashInput = await aesCbcDecryptRaw(
|
|
45543
|
+
await blockKey(BLOCK_KEYS.verifierHashInput),
|
|
45544
|
+
pke.saltValue,
|
|
45545
|
+
pke.encryptedVerifierHashInput
|
|
45546
|
+
);
|
|
45547
|
+
const verifierHashValue = await aesCbcDecryptRaw(
|
|
45548
|
+
await blockKey(BLOCK_KEYS.verifierHashValue),
|
|
45549
|
+
pke.saltValue,
|
|
45550
|
+
pke.encryptedVerifierHashValue
|
|
45551
|
+
);
|
|
45552
|
+
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
45553
|
+
if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
|
|
45554
|
+
let difference = 0;
|
|
45555
|
+
for (let i2 = 0; i2 < pke.hashSize; i2++) difference |= verifierHashValue[i2] ^ computedHash[i2];
|
|
45556
|
+
if (difference !== 0) return null;
|
|
45557
|
+
const decryptedKey = await aesCbcDecryptRaw(
|
|
45558
|
+
await blockKey(BLOCK_KEYS.encryptedKeyValue),
|
|
45559
|
+
pke.saltValue,
|
|
45560
|
+
pke.encryptedKeyValue
|
|
45561
|
+
);
|
|
45562
|
+
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
45563
|
+
}
|
|
45564
|
+
async function verifyStandardPassword(info, password) {
|
|
45565
|
+
const key2 = await deriveStandardKey(
|
|
45566
|
+
password,
|
|
45567
|
+
info.verifier.salt,
|
|
45568
|
+
info.header.keySize,
|
|
45569
|
+
info.header.algIdHash
|
|
45570
|
+
);
|
|
45571
|
+
const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
|
|
45572
|
+
const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
|
|
45573
|
+
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
45574
|
+
const hashSize = info.verifier.verifierHashSize;
|
|
45575
|
+
let match = true;
|
|
45576
|
+
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
45577
|
+
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
45578
|
+
match = false;
|
|
45579
|
+
break;
|
|
45580
|
+
}
|
|
45581
|
+
}
|
|
45582
|
+
return match ? key2 : null;
|
|
45583
|
+
}
|
|
45584
|
+
async function verifyAgileDataIntegrity(info, key2, encryptedPackage) {
|
|
45585
|
+
const keyData = info.keyData;
|
|
45586
|
+
if (!info.dataIntegrity) {
|
|
45587
|
+
return;
|
|
45588
|
+
}
|
|
45589
|
+
const hmacKeyIV = await generateIV(
|
|
45590
|
+
keyData.hashAlgorithm,
|
|
45591
|
+
keyData.saltValue,
|
|
45592
|
+
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
45593
|
+
keyData.blockSize
|
|
45594
|
+
);
|
|
45595
|
+
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
45596
|
+
key2,
|
|
45597
|
+
hmacKeyIV,
|
|
45598
|
+
info.dataIntegrity.encryptedHmacKey
|
|
45599
|
+
);
|
|
45600
|
+
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
45601
|
+
const hmacValueIV = await generateIV(
|
|
45602
|
+
keyData.hashAlgorithm,
|
|
45603
|
+
keyData.saltValue,
|
|
45604
|
+
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
45605
|
+
keyData.blockSize
|
|
45606
|
+
);
|
|
45607
|
+
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
45608
|
+
key2,
|
|
45609
|
+
hmacValueIV,
|
|
45610
|
+
info.dataIntegrity.encryptedHmacValue
|
|
45611
|
+
);
|
|
45612
|
+
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
45613
|
+
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
45614
|
+
let match = true;
|
|
45615
|
+
if (computedHmac.length < keyData.hashSize) {
|
|
45616
|
+
match = false;
|
|
45617
|
+
} else {
|
|
45618
|
+
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
45619
|
+
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
45620
|
+
match = false;
|
|
45621
|
+
break;
|
|
45622
|
+
}
|
|
45623
|
+
}
|
|
45624
|
+
}
|
|
45625
|
+
if (!match) {
|
|
45626
|
+
throw new exports.DataIntegrityError(
|
|
45627
|
+
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
45628
|
+
);
|
|
45629
|
+
}
|
|
45630
|
+
}
|
|
45631
|
+
async function decryptAgilePackage(encryptedPackage, key2, info) {
|
|
45632
|
+
const keyData = info.keyData;
|
|
45633
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
45634
|
+
const originalSize = sizeView.getUint32(0, true) + sizeView.getUint32(4, true) * 4294967296;
|
|
45635
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
45636
|
+
const segmentSize = 4096;
|
|
45637
|
+
const result = new Uint8Array(originalSize);
|
|
45638
|
+
let resultOffset = 0;
|
|
45639
|
+
const numSegments = Math.ceil(encryptedData.length / segmentSize);
|
|
45640
|
+
for (let segment = 0; segment < numSegments; segment++) {
|
|
45641
|
+
const segmentStart = segment * segmentSize;
|
|
45642
|
+
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
45643
|
+
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
45644
|
+
const blockKeyBytes = uint32LE(segment);
|
|
45645
|
+
const segmentIV = await generateIV(
|
|
45646
|
+
keyData.hashAlgorithm,
|
|
45647
|
+
keyData.saltValue,
|
|
45648
|
+
blockKeyBytes,
|
|
45649
|
+
keyData.blockSize
|
|
45650
|
+
);
|
|
45651
|
+
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
45652
|
+
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
45653
|
+
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
45654
|
+
resultOffset += bytesToCopy;
|
|
45655
|
+
}
|
|
45656
|
+
return result.buffer;
|
|
45657
|
+
}
|
|
45658
|
+
async function decryptStandardPackage(encryptedPackage, key2) {
|
|
45659
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
45660
|
+
const originalSize = sizeView.getUint32(0, true);
|
|
45661
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
45662
|
+
const decrypted = await aesEcbDecrypt(key2, encryptedData);
|
|
45663
|
+
return decrypted.slice(0, originalSize).buffer;
|
|
45664
|
+
}
|
|
45665
|
+
var init_decrypt = __esm({
|
|
45666
|
+
"src/crypto/decrypt.ts"() {
|
|
45667
|
+
init_ooxml_crypto_primitives();
|
|
45668
|
+
init_aes_ecb();
|
|
45669
|
+
init_errors();
|
|
45670
|
+
init_key_derivation();
|
|
45671
|
+
}
|
|
45672
|
+
});
|
|
45673
|
+
|
|
45674
|
+
// src/crypto/encryption-info-write.ts
|
|
45675
|
+
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
45676
|
+
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
45677
|
+
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
45678
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
45679
|
+
<encryption xmlns="${xmlNs}" xmlns:p="${pNs}"><keyData saltSize="${keyData.saltSize}" blockSize="${keyData.blockSize}" keyBits="${keyData.keyBits}" hashSize="${keyData.hashSize}" cipherAlgorithm="${keyData.cipherAlgorithm}" cipherChaining="${keyData.cipherChaining}" hashAlgorithm="${keyData.hashAlgorithm}" saltValue="${base64Encode(keyData.saltValue)}"/><dataIntegrity encryptedHmacKey="${base64Encode(dataIntegrity.encryptedHmacKey)}" encryptedHmacValue="${base64Encode(dataIntegrity.encryptedHmacValue)}"/><keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password"><p:encryptedKey spinCount="${pke.spinCount}" saltSize="${pke.saltSize}" blockSize="${pke.blockSize}" keyBits="${pke.keyBits}" hashSize="${pke.hashSize}" cipherAlgorithm="${pke.cipherAlgorithm}" cipherChaining="${pke.cipherChaining}" hashAlgorithm="${pke.hashAlgorithm}" saltValue="${base64Encode(pke.saltValue)}" encryptedVerifierHashInput="${base64Encode(pke.encryptedVerifierHashInput)}" encryptedVerifierHashValue="${base64Encode(pke.encryptedVerifierHashValue)}" encryptedKeyValue="${base64Encode(pke.encryptedKeyValue)}"/></keyEncryptor></keyEncryptors></encryption>`;
|
|
45680
|
+
}
|
|
45681
|
+
function buildEncryptionInfoStream(xmlString) {
|
|
45682
|
+
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
45683
|
+
const result = new Uint8Array(8 + xmlBytes.length);
|
|
45684
|
+
const view = new DataView(result.buffer);
|
|
45685
|
+
view.setUint16(0, 4, true);
|
|
45686
|
+
view.setUint16(2, 4, true);
|
|
45687
|
+
view.setUint32(4, 64, true);
|
|
45688
|
+
result.set(xmlBytes, 8);
|
|
45689
|
+
return result;
|
|
45690
|
+
}
|
|
45691
|
+
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
45692
|
+
const algId = STANDARD_ALG_IDS[keyBits];
|
|
45693
|
+
if (!algId) {
|
|
45694
|
+
throw new Error(
|
|
45695
|
+
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
45696
|
+
);
|
|
45697
|
+
}
|
|
45698
|
+
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
45699
|
+
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
45700
|
+
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
45701
|
+
cspNameBytes[i2 * 2] = code & 255;
|
|
45702
|
+
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
45703
|
+
}
|
|
45704
|
+
const headerFixedSize = 32;
|
|
45705
|
+
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
45706
|
+
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
45707
|
+
const totalSize = 12 + headerSize + verifierSize;
|
|
45708
|
+
const data = new Uint8Array(totalSize);
|
|
45709
|
+
const view = new DataView(data.buffer);
|
|
45710
|
+
view.setUint16(0, 4, true);
|
|
45711
|
+
view.setUint16(2, 2, true);
|
|
45712
|
+
view.setUint32(4, STANDARD_FLAGS, true);
|
|
45713
|
+
view.setUint32(8, headerSize, true);
|
|
45714
|
+
const h2 = 12;
|
|
45715
|
+
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
45716
|
+
view.setUint32(h2 + 4, 0, true);
|
|
45717
|
+
view.setUint32(h2 + 8, algId, true);
|
|
45718
|
+
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
45719
|
+
view.setUint32(h2 + 16, keyBits, true);
|
|
45720
|
+
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
45721
|
+
view.setUint32(h2 + 24, 0, true);
|
|
45722
|
+
view.setUint32(h2 + 28, 0, true);
|
|
45723
|
+
data.set(cspNameBytes, h2 + 32);
|
|
45724
|
+
const v = 12 + headerSize;
|
|
45725
|
+
view.setUint32(v, 16, true);
|
|
45726
|
+
data.set(salt.subarray(0, 16), v + 4);
|
|
45727
|
+
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
45728
|
+
view.setUint32(v + 36, 20, true);
|
|
45729
|
+
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
45730
|
+
return data;
|
|
45731
|
+
}
|
|
45732
|
+
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
45733
|
+
var init_encryption_info_write = __esm({
|
|
45734
|
+
"src/crypto/encryption-info-write.ts"() {
|
|
45735
|
+
init_ooxml_crypto_primitives();
|
|
45736
|
+
STANDARD_ALG_IDS = {
|
|
45737
|
+
128: 26126,
|
|
45738
|
+
// CALG_AES_128
|
|
45739
|
+
192: 26127,
|
|
45740
|
+
// CALG_AES_192
|
|
45741
|
+
256: 26128
|
|
45742
|
+
// CALG_AES_256
|
|
45743
|
+
};
|
|
45744
|
+
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
45745
|
+
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
45746
|
+
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
45747
|
+
STANDARD_FLAGS = 36;
|
|
45748
|
+
}
|
|
45749
|
+
});
|
|
45750
|
+
|
|
45751
|
+
// src/crypto/encrypt.ts
|
|
45752
|
+
function container(encryptionInfo, encryptedPackage) {
|
|
45753
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
45754
|
+
streams2.set("EncryptionInfo", encryptionInfo);
|
|
45755
|
+
streams2.set("EncryptedPackage", encryptedPackage);
|
|
45756
|
+
return new Uint8Array(buildOle2(streams2));
|
|
45757
|
+
}
|
|
45758
|
+
function randomBytes(size) {
|
|
45759
|
+
const bytes = new Uint8Array(size);
|
|
45760
|
+
getCrypto().getRandomValues(bytes);
|
|
45761
|
+
return bytes;
|
|
45762
|
+
}
|
|
45763
|
+
function padTo(data, blockSize) {
|
|
45764
|
+
const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
|
|
45765
|
+
padded.set(data);
|
|
45766
|
+
return padded;
|
|
45767
|
+
}
|
|
45768
|
+
function withSizePrefix(size, body) {
|
|
45769
|
+
const out = new Uint8Array(8 + body.length);
|
|
45770
|
+
const view = new DataView(out.buffer, 0, 8);
|
|
45771
|
+
view.setUint32(0, size % 4294967296, true);
|
|
45772
|
+
view.setUint32(4, Math.floor(size / 4294967296), true);
|
|
45773
|
+
out.set(body, 8);
|
|
45774
|
+
return out;
|
|
45775
|
+
}
|
|
45776
|
+
async function encryptAgilePackage(packageData, key2, info) {
|
|
45777
|
+
const { hashAlgorithm, saltValue, blockSize } = info.keyData;
|
|
45778
|
+
const padded = padTo(packageData, SEGMENT_SIZE);
|
|
45779
|
+
const encrypted = withSizePrefix(packageData.length, padded);
|
|
45780
|
+
for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
|
|
45781
|
+
const iv = await generateIV(
|
|
45782
|
+
hashAlgorithm,
|
|
45783
|
+
saltValue,
|
|
45784
|
+
uint32LE(start / SEGMENT_SIZE),
|
|
45785
|
+
blockSize
|
|
45786
|
+
);
|
|
45787
|
+
const segment = padded.subarray(start, start + SEGMENT_SIZE);
|
|
45788
|
+
encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
|
|
45789
|
+
}
|
|
45790
|
+
return encrypted;
|
|
45791
|
+
}
|
|
45792
|
+
async function encryptStandardPackage(packageData, key2) {
|
|
45793
|
+
const encryptedData = await aesEcbEncrypt(key2, packageData);
|
|
45794
|
+
return withSizePrefix(packageData.length, encryptedData);
|
|
45795
|
+
}
|
|
45796
|
+
async function encryptAgile(packageData, password, options = {}) {
|
|
45797
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
45798
|
+
const hashAlgorithm = "SHA-512";
|
|
45799
|
+
const hashSize = 64;
|
|
45800
|
+
const blockSize = 16;
|
|
45801
|
+
const spinCount = options.spinCount ?? 1e5;
|
|
45802
|
+
const keyDataSalt = randomBytes(16);
|
|
45803
|
+
const pkeSalt = randomBytes(16);
|
|
45804
|
+
const documentKey = randomBytes(keyBits / 8);
|
|
45805
|
+
const verifierHashInput = randomBytes(16);
|
|
45806
|
+
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
45807
|
+
const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
|
|
45808
|
+
const encryptUnder = async (block, data) => {
|
|
45809
|
+
const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
|
|
45810
|
+
return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
|
|
45811
|
+
};
|
|
45812
|
+
const passwordKeyEncryptor = {
|
|
45813
|
+
saltSize: 16,
|
|
45814
|
+
blockSize,
|
|
45815
|
+
keyBits,
|
|
45816
|
+
hashSize,
|
|
45817
|
+
cipherAlgorithm: "AES",
|
|
45818
|
+
cipherChaining: "ChainingModeCBC",
|
|
45819
|
+
hashAlgorithm,
|
|
45820
|
+
saltValue: pkeSalt,
|
|
45821
|
+
spinCount,
|
|
45822
|
+
encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
|
|
45823
|
+
encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
|
|
45824
|
+
encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
|
|
45825
|
+
};
|
|
45826
|
+
const keyData = {
|
|
45827
|
+
saltSize: 16,
|
|
45828
|
+
blockSize,
|
|
45829
|
+
keyBits,
|
|
45830
|
+
hashSize,
|
|
45831
|
+
cipherAlgorithm: "AES",
|
|
45832
|
+
cipherChaining: "ChainingModeCBC",
|
|
45833
|
+
hashAlgorithm,
|
|
45834
|
+
saltValue: keyDataSalt
|
|
45835
|
+
};
|
|
45836
|
+
const info = {
|
|
45837
|
+
keyData};
|
|
45838
|
+
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
|
|
45839
|
+
const hmacKey = randomBytes(hashSize);
|
|
45840
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
|
|
45841
|
+
const encryptIntegrity = async (block, data) => {
|
|
45842
|
+
const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
|
|
45843
|
+
return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
|
|
45844
|
+
};
|
|
45845
|
+
const dataIntegrity = {
|
|
45846
|
+
encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
|
|
45847
|
+
encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
|
|
45848
|
+
};
|
|
45849
|
+
const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
|
|
45850
|
+
return container(buildEncryptionInfoStream(xml), encryptedPackage);
|
|
45851
|
+
}
|
|
45852
|
+
async function encryptStandard(packageData, password, options = {}) {
|
|
45853
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
45854
|
+
const salt = randomBytes(16);
|
|
45855
|
+
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
45856
|
+
const verifier = randomBytes(16);
|
|
45857
|
+
const paddedVerifierHash = new Uint8Array(32);
|
|
45858
|
+
paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
|
|
45859
|
+
const encryptionInfo = buildStandardEncryptionInfoStream(
|
|
45860
|
+
keyBits,
|
|
45861
|
+
salt,
|
|
45862
|
+
await aesEcbEncrypt(key2, verifier),
|
|
45863
|
+
await aesEcbEncrypt(key2, paddedVerifierHash)
|
|
45864
|
+
);
|
|
45865
|
+
return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
|
|
45866
|
+
}
|
|
45867
|
+
var SEGMENT_SIZE;
|
|
45868
|
+
var init_encrypt = __esm({
|
|
45869
|
+
"src/crypto/encrypt.ts"() {
|
|
45870
|
+
init_ole2_parser_write();
|
|
45871
|
+
init_ooxml_crypto_primitives();
|
|
45872
|
+
init_aes_ecb();
|
|
45873
|
+
init_encryption_info_write();
|
|
45874
|
+
init_key_derivation();
|
|
45875
|
+
SEGMENT_SIZE = 4096;
|
|
45876
|
+
}
|
|
45877
|
+
});
|
|
45878
|
+
|
|
45879
|
+
// src/crypto/encryption-info.ts
|
|
44553
45880
|
function parseEncryptionInfo(data) {
|
|
45881
|
+
if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
|
|
44554
45882
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
44555
45883
|
const versionMajor = view.getUint16(0, true);
|
|
44556
45884
|
const versionMinor = view.getUint16(2, true);
|
|
44557
|
-
if (versionMajor === 4 && versionMinor === 4)
|
|
44558
|
-
return parseAgileEncryptionInfo(data);
|
|
44559
|
-
}
|
|
45885
|
+
if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
|
|
44560
45886
|
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
44561
45887
|
return parseStandardEncryptionInfo(data);
|
|
44562
45888
|
}
|
|
@@ -44572,19 +45898,15 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44572
45898
|
const headerSize = view.getUint32(8, true);
|
|
44573
45899
|
const headerOffset = 12;
|
|
44574
45900
|
const hFlags = view.getUint32(headerOffset, true);
|
|
44575
|
-
view.getUint32(headerOffset + 4, true);
|
|
44576
45901
|
const algId = view.getUint32(headerOffset + 8, true);
|
|
44577
45902
|
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
44578
45903
|
const keySize = view.getUint32(headerOffset + 16, true);
|
|
44579
45904
|
const providerType = view.getUint32(headerOffset + 20, true);
|
|
44580
45905
|
let cspName = "";
|
|
44581
|
-
const cspOffset = headerOffset + 32;
|
|
44582
45906
|
const cspEnd = headerOffset + headerSize;
|
|
44583
|
-
for (let i2 =
|
|
45907
|
+
for (let i2 = headerOffset + 32; i2 < cspEnd - 1; i2 += 2) {
|
|
44584
45908
|
const ch = view.getUint16(i2, true);
|
|
44585
|
-
if (ch === 0)
|
|
44586
|
-
break;
|
|
44587
|
-
}
|
|
45909
|
+
if (ch === 0) break;
|
|
44588
45910
|
cspName += String.fromCharCode(ch);
|
|
44589
45911
|
}
|
|
44590
45912
|
const verifierOffset = 12 + headerSize;
|
|
@@ -44604,14 +45926,7 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44604
45926
|
isStandard: true,
|
|
44605
45927
|
flags,
|
|
44606
45928
|
headerSize,
|
|
44607
|
-
header: {
|
|
44608
|
-
flags: hFlags,
|
|
44609
|
-
algId,
|
|
44610
|
-
algIdHash,
|
|
44611
|
-
keySize,
|
|
44612
|
-
providerType,
|
|
44613
|
-
cspName
|
|
44614
|
-
},
|
|
45929
|
+
header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
|
|
44615
45930
|
verifier: {
|
|
44616
45931
|
saltSize,
|
|
44617
45932
|
salt: new Uint8Array(salt),
|
|
@@ -44621,615 +45936,157 @@ function parseStandardEncryptionInfo(data) {
|
|
|
44621
45936
|
}
|
|
44622
45937
|
};
|
|
44623
45938
|
}
|
|
45939
|
+
function tagAttribute(xml, tag, attr4) {
|
|
45940
|
+
const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
|
|
45941
|
+
if (!tagMatch) return "";
|
|
45942
|
+
const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr4}="([^"]*)"`, "i"));
|
|
45943
|
+
return attrMatch?.[1] ?? "";
|
|
45944
|
+
}
|
|
44624
45945
|
function parseAgileEncryptionInfo(data) {
|
|
44625
|
-
const
|
|
44626
|
-
const
|
|
44627
|
-
const
|
|
44628
|
-
|
|
44629
|
-
|
|
44630
|
-
|
|
44631
|
-
return "";
|
|
44632
|
-
}
|
|
44633
|
-
const attrRegex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
44634
|
-
const attrMatch = tagMatch[0].match(attrRegex);
|
|
44635
|
-
return attrMatch ? attrMatch[1] : "";
|
|
44636
|
-
};
|
|
44637
|
-
const keyDataSaltSize = parseInt(getAttr(xmlStr, "keyData", "saltSize"), 10);
|
|
44638
|
-
const keyDataBlockSize = parseInt(getAttr(xmlStr, "keyData", "blockSize"), 10);
|
|
44639
|
-
const keyDataKeyBits = parseInt(getAttr(xmlStr, "keyData", "keyBits"), 10);
|
|
44640
|
-
const keyDataHashSize = parseInt(getAttr(xmlStr, "keyData", "hashSize"), 10);
|
|
44641
|
-
const keyDataCipherAlgorithm = getAttr(xmlStr, "keyData", "cipherAlgorithm");
|
|
44642
|
-
const keyDataCipherChaining = getAttr(xmlStr, "keyData", "cipherChaining");
|
|
44643
|
-
const keyDataHashAlgorithm = getAttr(xmlStr, "keyData", "hashAlgorithm");
|
|
44644
|
-
const keyDataSaltValue = getAttr(xmlStr, "keyData", "saltValue");
|
|
44645
|
-
const encryptedHmacKey = getAttr(xmlStr, "dataIntegrity", "encryptedHmacKey");
|
|
44646
|
-
const encryptedHmacValue = getAttr(xmlStr, "dataIntegrity", "encryptedHmacValue");
|
|
44647
|
-
const encKeyTag = xmlStr.match(/<[^>]*encryptedKey[^>]*>/i);
|
|
44648
|
-
const encKeyStr = encKeyTag ? encKeyTag[0] : "";
|
|
44649
|
-
const getEncKeyAttr = (attr4) => {
|
|
44650
|
-
const regex = new RegExp(`${attr4}="([^"]*)"`, "i");
|
|
44651
|
-
const match = encKeyStr.match(regex);
|
|
44652
|
-
return match ? match[1] : "";
|
|
44653
|
-
};
|
|
44654
|
-
const pkeSaltSize = parseInt(getEncKeyAttr("saltSize"), 10);
|
|
44655
|
-
const pkeBlockSize = parseInt(getEncKeyAttr("blockSize"), 10);
|
|
44656
|
-
const pkeKeyBits = parseInt(getEncKeyAttr("keyBits"), 10);
|
|
44657
|
-
const pkeHashSize = parseInt(getEncKeyAttr("hashSize"), 10);
|
|
44658
|
-
const pkeCipherAlgorithm = getEncKeyAttr("cipherAlgorithm");
|
|
44659
|
-
const pkeCipherChaining = getEncKeyAttr("cipherChaining");
|
|
44660
|
-
const pkeHashAlgorithm = getEncKeyAttr("hashAlgorithm");
|
|
44661
|
-
const pkeSaltValue = getEncKeyAttr("saltValue");
|
|
44662
|
-
const pkeSpinCount = parseInt(getEncKeyAttr("spinCount"), 10);
|
|
44663
|
-
const pkeEncryptedVerifierHashInput = getEncKeyAttr("encryptedVerifierHashInput");
|
|
44664
|
-
const pkeEncryptedVerifierHashValue = getEncKeyAttr("encryptedVerifierHashValue");
|
|
44665
|
-
const pkeEncryptedKeyValue = getEncKeyAttr("encryptedKeyValue");
|
|
45946
|
+
const xml = new TextDecoder("utf-8").decode(data.subarray(8));
|
|
45947
|
+
const keyData = (attr4) => tagAttribute(xml, "keyData", attr4);
|
|
45948
|
+
const integrity = (attr4) => tagAttribute(xml, "dataIntegrity", attr4);
|
|
45949
|
+
const pke = (attr4) => tagAttribute(xml, "encryptedKey", attr4);
|
|
45950
|
+
const int = (value) => parseInt(value, 10);
|
|
45951
|
+
const encryptedHmacKey = integrity("encryptedHmacKey");
|
|
44666
45952
|
return {
|
|
44667
45953
|
version: { major: 4, minor: 4 },
|
|
44668
45954
|
isAgile: true,
|
|
44669
45955
|
keyData: {
|
|
44670
|
-
saltSize:
|
|
44671
|
-
blockSize:
|
|
44672
|
-
keyBits:
|
|
44673
|
-
hashSize:
|
|
44674
|
-
cipherAlgorithm:
|
|
44675
|
-
cipherChaining:
|
|
44676
|
-
hashAlgorithm:
|
|
44677
|
-
saltValue: base64Decode(
|
|
45956
|
+
saltSize: int(keyData("saltSize")),
|
|
45957
|
+
blockSize: int(keyData("blockSize")),
|
|
45958
|
+
keyBits: int(keyData("keyBits")),
|
|
45959
|
+
hashSize: int(keyData("hashSize")),
|
|
45960
|
+
cipherAlgorithm: keyData("cipherAlgorithm"),
|
|
45961
|
+
cipherChaining: keyData("cipherChaining"),
|
|
45962
|
+
hashAlgorithm: keyData("hashAlgorithm"),
|
|
45963
|
+
saltValue: base64Decode(keyData("saltValue"))
|
|
44678
45964
|
},
|
|
44679
|
-
|
|
44680
|
-
|
|
44681
|
-
|
|
44682
|
-
|
|
45965
|
+
...encryptedHmacKey ? {
|
|
45966
|
+
dataIntegrity: {
|
|
45967
|
+
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
45968
|
+
encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
|
|
45969
|
+
}
|
|
45970
|
+
} : {},
|
|
44683
45971
|
passwordKeyEncryptor: {
|
|
44684
|
-
saltSize:
|
|
44685
|
-
blockSize:
|
|
44686
|
-
keyBits:
|
|
44687
|
-
hashSize:
|
|
44688
|
-
cipherAlgorithm:
|
|
44689
|
-
cipherChaining:
|
|
44690
|
-
hashAlgorithm:
|
|
44691
|
-
saltValue: base64Decode(
|
|
44692
|
-
spinCount:
|
|
44693
|
-
encryptedVerifierHashInput: base64Decode(
|
|
44694
|
-
encryptedVerifierHashValue: base64Decode(
|
|
44695
|
-
encryptedKeyValue: base64Decode(
|
|
44696
|
-
}
|
|
44697
|
-
};
|
|
44698
|
-
}
|
|
44699
|
-
var
|
|
44700
|
-
var
|
|
44701
|
-
"src/
|
|
44702
|
-
|
|
44703
|
-
BLOCK_KEYS = {
|
|
44704
|
-
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
44705
|
-
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
44706
|
-
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
44707
|
-
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
44708
|
-
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
44709
|
-
};
|
|
45972
|
+
saltSize: int(pke("saltSize")),
|
|
45973
|
+
blockSize: int(pke("blockSize")),
|
|
45974
|
+
keyBits: int(pke("keyBits")),
|
|
45975
|
+
hashSize: int(pke("hashSize")),
|
|
45976
|
+
cipherAlgorithm: pke("cipherAlgorithm"),
|
|
45977
|
+
cipherChaining: pke("cipherChaining"),
|
|
45978
|
+
hashAlgorithm: pke("hashAlgorithm"),
|
|
45979
|
+
saltValue: base64Decode(pke("saltValue")),
|
|
45980
|
+
spinCount: int(pke("spinCount")),
|
|
45981
|
+
encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
|
|
45982
|
+
encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
|
|
45983
|
+
encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
|
|
45984
|
+
}
|
|
45985
|
+
};
|
|
45986
|
+
}
|
|
45987
|
+
var RC4_ALG_ID;
|
|
45988
|
+
var init_encryption_info = __esm({
|
|
45989
|
+
"src/crypto/encryption-info.ts"() {
|
|
45990
|
+
init_ooxml_crypto_primitives();
|
|
44710
45991
|
RC4_ALG_ID = 26625;
|
|
44711
45992
|
}
|
|
44712
45993
|
});
|
|
44713
45994
|
|
|
44714
|
-
// src/
|
|
44715
|
-
|
|
44716
|
-
const
|
|
44717
|
-
|
|
44718
|
-
|
|
44719
|
-
|
|
44720
|
-
|
|
44721
|
-
|
|
44722
|
-
|
|
44723
|
-
pke.keyBits,
|
|
44724
|
-
pke.hashSize
|
|
44725
|
-
);
|
|
44726
|
-
const verifierHashInput = await aesCbcDecryptRaw(
|
|
44727
|
-
verifierInputKey,
|
|
44728
|
-
pke.saltValue,
|
|
44729
|
-
pke.encryptedVerifierHashInput
|
|
44730
|
-
);
|
|
44731
|
-
const verifierHashKey = await deriveAgileKey(
|
|
44732
|
-
password,
|
|
44733
|
-
pke.saltValue,
|
|
44734
|
-
pke.spinCount,
|
|
44735
|
-
pke.hashAlgorithm,
|
|
44736
|
-
BLOCK_KEYS.verifierHashValue,
|
|
44737
|
-
pke.keyBits,
|
|
44738
|
-
pke.hashSize
|
|
44739
|
-
);
|
|
44740
|
-
const verifierHashValue = await aesCbcDecryptRaw(
|
|
44741
|
-
verifierHashKey,
|
|
44742
|
-
pke.saltValue,
|
|
44743
|
-
pke.encryptedVerifierHashValue
|
|
44744
|
-
);
|
|
44745
|
-
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
44746
|
-
const expectedHash = verifierHashValue.subarray(0, pke.hashSize);
|
|
44747
|
-
const actualHash = computedHash.subarray(0, pke.hashSize);
|
|
44748
|
-
let match = true;
|
|
44749
|
-
for (let i2 = 0; i2 < pke.hashSize; i2++) {
|
|
44750
|
-
if (expectedHash[i2] !== actualHash[i2]) {
|
|
44751
|
-
match = false;
|
|
44752
|
-
break;
|
|
44753
|
-
}
|
|
44754
|
-
}
|
|
44755
|
-
if (!match) {
|
|
44756
|
-
return null;
|
|
45995
|
+
// src/crypto/index.ts
|
|
45996
|
+
function streams(bytes) {
|
|
45997
|
+
const opened = openEncryptedPackage(bytes);
|
|
45998
|
+
if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
|
|
45999
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
46000
|
+
if (!file.getStream("EncryptionInfo")) {
|
|
46001
|
+
throw new Error(
|
|
46002
|
+
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
46003
|
+
);
|
|
44757
46004
|
}
|
|
44758
|
-
|
|
44759
|
-
password,
|
|
44760
|
-
pke.saltValue,
|
|
44761
|
-
pke.spinCount,
|
|
44762
|
-
pke.hashAlgorithm,
|
|
44763
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
44764
|
-
pke.keyBits,
|
|
44765
|
-
pke.hashSize
|
|
44766
|
-
);
|
|
44767
|
-
const decryptedKey = await aesCbcDecryptRaw(encKeyKey, pke.saltValue, pke.encryptedKeyValue);
|
|
44768
|
-
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
46005
|
+
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
44769
46006
|
}
|
|
44770
|
-
async function
|
|
44771
|
-
const
|
|
44772
|
-
|
|
44773
|
-
|
|
44774
|
-
info
|
|
44775
|
-
|
|
44776
|
-
|
|
44777
|
-
const iv = new Uint8Array(16);
|
|
44778
|
-
const decryptedVerifier = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifier);
|
|
44779
|
-
const decryptedHash = await aesCbcDecryptRaw(key2, iv, info.verifier.encryptedVerifierHash);
|
|
44780
|
-
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
44781
|
-
const hashSize = info.verifier.verifierHashSize;
|
|
44782
|
-
let match = true;
|
|
44783
|
-
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
44784
|
-
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
44785
|
-
match = false;
|
|
44786
|
-
break;
|
|
44787
|
-
}
|
|
46007
|
+
async function decryptOoxmlPackage(input, password) {
|
|
46008
|
+
const { info: infoStream, data } = streams(toBytes(input));
|
|
46009
|
+
const info = parseEncryptionInfo(infoStream);
|
|
46010
|
+
if (isStandard(info)) {
|
|
46011
|
+
const key3 = await verifyStandardPassword(info, password);
|
|
46012
|
+
if (!key3) throw new exports.IncorrectPasswordError();
|
|
46013
|
+
return new Uint8Array(await decryptStandardPackage(data, key3));
|
|
44788
46014
|
}
|
|
44789
|
-
|
|
46015
|
+
const key2 = await verifyAgilePassword(info, password);
|
|
46016
|
+
if (!key2) throw new exports.IncorrectPasswordError();
|
|
46017
|
+
await verifyAgileDataIntegrity(info, key2, data);
|
|
46018
|
+
return new Uint8Array(await decryptAgilePackage(data, key2, info));
|
|
44790
46019
|
}
|
|
44791
|
-
|
|
44792
|
-
const
|
|
44793
|
-
|
|
44794
|
-
return;
|
|
44795
|
-
}
|
|
44796
|
-
const hmacKeyIV = await generateIV(
|
|
44797
|
-
keyData.hashAlgorithm,
|
|
44798
|
-
keyData.saltValue,
|
|
44799
|
-
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
44800
|
-
keyData.blockSize
|
|
44801
|
-
);
|
|
44802
|
-
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
44803
|
-
key2,
|
|
44804
|
-
hmacKeyIV,
|
|
44805
|
-
info.dataIntegrity.encryptedHmacKey
|
|
44806
|
-
);
|
|
44807
|
-
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
44808
|
-
const hmacValueIV = await generateIV(
|
|
44809
|
-
keyData.hashAlgorithm,
|
|
44810
|
-
keyData.saltValue,
|
|
44811
|
-
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
44812
|
-
keyData.blockSize
|
|
44813
|
-
);
|
|
44814
|
-
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
44815
|
-
key2,
|
|
44816
|
-
hmacValueIV,
|
|
44817
|
-
info.dataIntegrity.encryptedHmacValue
|
|
44818
|
-
);
|
|
44819
|
-
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
44820
|
-
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
44821
|
-
let match = true;
|
|
44822
|
-
if (computedHmac.length < keyData.hashSize) {
|
|
44823
|
-
match = false;
|
|
44824
|
-
} else {
|
|
44825
|
-
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
44826
|
-
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
44827
|
-
match = false;
|
|
44828
|
-
break;
|
|
44829
|
-
}
|
|
44830
|
-
}
|
|
44831
|
-
}
|
|
44832
|
-
if (!match) {
|
|
44833
|
-
throw new exports.DataIntegrityError(
|
|
44834
|
-
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
44835
|
-
);
|
|
44836
|
-
}
|
|
46020
|
+
function encryptOoxmlPackage(input, password, options = {}) {
|
|
46021
|
+
const bytes = toBytes(input);
|
|
46022
|
+
return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
|
|
44837
46023
|
}
|
|
44838
|
-
async function
|
|
44839
|
-
|
|
44840
|
-
|
|
44841
|
-
|
|
44842
|
-
|
|
44843
|
-
|
|
44844
|
-
|
|
44845
|
-
|
|
44846
|
-
|
|
44847
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
44848
|
-
const segmentStart = segment * segmentSize;
|
|
44849
|
-
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
44850
|
-
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
44851
|
-
const blockKeyBytes = uint32LE(segment);
|
|
44852
|
-
const segmentIV = await generateIV(
|
|
44853
|
-
keyData.hashAlgorithm,
|
|
44854
|
-
keyData.saltValue,
|
|
44855
|
-
blockKeyBytes,
|
|
44856
|
-
keyData.blockSize
|
|
44857
|
-
);
|
|
44858
|
-
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
44859
|
-
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
44860
|
-
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
44861
|
-
resultOffset += bytesToCopy;
|
|
46024
|
+
async function verifyOoxmlPackagePassword(input, password) {
|
|
46025
|
+
try {
|
|
46026
|
+
const opened = openEncryptedPackage(input);
|
|
46027
|
+
if (!opened) return false;
|
|
46028
|
+
const info = parseEncryptionInfo(opened.encryptionInfo);
|
|
46029
|
+
const key2 = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password);
|
|
46030
|
+
return key2 !== null;
|
|
46031
|
+
} catch {
|
|
46032
|
+
return false;
|
|
44862
46033
|
}
|
|
44863
|
-
return result.buffer;
|
|
44864
46034
|
}
|
|
44865
|
-
|
|
44866
|
-
|
|
44867
|
-
|
|
44868
|
-
|
|
44869
|
-
|
|
44870
|
-
|
|
44871
|
-
|
|
44872
|
-
|
|
44873
|
-
|
|
44874
|
-
|
|
44875
|
-
init_ooxml_crypto_errors();
|
|
44876
|
-
init_ooxml_crypto_key_derivation();
|
|
44877
|
-
init_ooxml_crypto_primitives2();
|
|
46035
|
+
var isStandard;
|
|
46036
|
+
var init_crypto = __esm({
|
|
46037
|
+
"src/crypto/index.ts"() {
|
|
46038
|
+
init_ole2_parser_read();
|
|
46039
|
+
init_decrypt();
|
|
46040
|
+
init_detect();
|
|
46041
|
+
init_encrypt();
|
|
46042
|
+
init_encryption_info();
|
|
46043
|
+
init_errors();
|
|
46044
|
+
isStandard = (info) => "isStandard" in info && info.isStandard;
|
|
44878
46045
|
}
|
|
44879
46046
|
});
|
|
44880
46047
|
|
|
44881
|
-
// src/pptx/core/utils/ooxml-crypto-
|
|
44882
|
-
|
|
44883
|
-
|
|
44884
|
-
|
|
44885
|
-
const paddedSize = Math.ceil(packageData.length / segmentSize) * segmentSize;
|
|
44886
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
44887
|
-
paddedData.set(packageData);
|
|
44888
|
-
const encrypted = new Uint8Array(8 + paddedSize);
|
|
44889
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
44890
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
44891
|
-
sizeView.setUint32(4, 0, true);
|
|
44892
|
-
const numSegments = Math.ceil(paddedSize / segmentSize);
|
|
44893
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
44894
|
-
const segmentStart = segment * segmentSize;
|
|
44895
|
-
const segmentEnd = segmentStart + segmentSize;
|
|
44896
|
-
const segmentData = paddedData.subarray(segmentStart, segmentEnd);
|
|
44897
|
-
const blockKeyBytes = uint32LE(segment);
|
|
44898
|
-
const segmentIV = await generateIV(
|
|
44899
|
-
keyData.hashAlgorithm,
|
|
44900
|
-
keyData.saltValue,
|
|
44901
|
-
blockKeyBytes,
|
|
44902
|
-
keyData.blockSize
|
|
44903
|
-
);
|
|
44904
|
-
const encryptedSegment = await aesCbcEncryptNoPad(key2, segmentIV, segmentData);
|
|
44905
|
-
encrypted.set(encryptedSegment, 8 + segmentStart);
|
|
44906
|
-
}
|
|
44907
|
-
return encrypted;
|
|
44908
|
-
}
|
|
44909
|
-
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
44910
|
-
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
44911
|
-
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
44912
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
44913
|
-
<encryption xmlns="${xmlNs}" xmlns:p="${pNs}"><keyData saltSize="${keyData.saltSize}" blockSize="${keyData.blockSize}" keyBits="${keyData.keyBits}" hashSize="${keyData.hashSize}" cipherAlgorithm="${keyData.cipherAlgorithm}" cipherChaining="${keyData.cipherChaining}" hashAlgorithm="${keyData.hashAlgorithm}" saltValue="${base64Encode(keyData.saltValue)}"/><dataIntegrity encryptedHmacKey="${base64Encode(dataIntegrity.encryptedHmacKey)}" encryptedHmacValue="${base64Encode(dataIntegrity.encryptedHmacValue)}"/><keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password"><p:encryptedKey spinCount="${pke.spinCount}" saltSize="${pke.saltSize}" blockSize="${pke.blockSize}" keyBits="${pke.keyBits}" hashSize="${pke.hashSize}" cipherAlgorithm="${pke.cipherAlgorithm}" cipherChaining="${pke.cipherChaining}" hashAlgorithm="${pke.hashAlgorithm}" saltValue="${base64Encode(pke.saltValue)}" encryptedVerifierHashInput="${base64Encode(pke.encryptedVerifierHashInput)}" encryptedVerifierHashValue="${base64Encode(pke.encryptedVerifierHashValue)}" encryptedKeyValue="${base64Encode(pke.encryptedKeyValue)}"/></keyEncryptor></keyEncryptors></encryption>`;
|
|
44914
|
-
}
|
|
44915
|
-
function buildEncryptionInfoStream(xmlString) {
|
|
44916
|
-
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
44917
|
-
const result = new Uint8Array(8 + xmlBytes.length);
|
|
44918
|
-
const view = new DataView(result.buffer);
|
|
44919
|
-
view.setUint16(0, 4, true);
|
|
44920
|
-
view.setUint16(2, 4, true);
|
|
44921
|
-
view.setUint32(4, 64, true);
|
|
44922
|
-
result.set(xmlBytes, 8);
|
|
44923
|
-
return result;
|
|
44924
|
-
}
|
|
44925
|
-
async function encryptStandardPackage(packageData, key2) {
|
|
44926
|
-
const blockSize = 16;
|
|
44927
|
-
const paddedSize = Math.ceil(packageData.length / blockSize) * blockSize;
|
|
44928
|
-
const paddedData = new Uint8Array(paddedSize);
|
|
44929
|
-
paddedData.set(packageData);
|
|
44930
|
-
const iv = new Uint8Array(blockSize);
|
|
44931
|
-
const encryptedData = await aesCbcEncryptNoPad(key2, iv, paddedData);
|
|
44932
|
-
const encrypted = new Uint8Array(8 + encryptedData.length);
|
|
44933
|
-
const sizeView = new DataView(encrypted.buffer, 0, 8);
|
|
44934
|
-
sizeView.setUint32(0, packageData.length, true);
|
|
44935
|
-
sizeView.setUint32(4, 0, true);
|
|
44936
|
-
encrypted.set(encryptedData, 8);
|
|
44937
|
-
return encrypted;
|
|
44938
|
-
}
|
|
44939
|
-
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
44940
|
-
const algId = STANDARD_ALG_IDS[keyBits];
|
|
44941
|
-
if (!algId) {
|
|
44942
|
-
throw new Error(
|
|
44943
|
-
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
44944
|
-
);
|
|
44945
|
-
}
|
|
44946
|
-
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
44947
|
-
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
44948
|
-
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
44949
|
-
cspNameBytes[i2 * 2] = code & 255;
|
|
44950
|
-
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
44951
|
-
}
|
|
44952
|
-
const headerFixedSize = 32;
|
|
44953
|
-
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
44954
|
-
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
44955
|
-
const totalSize = 12 + headerSize + verifierSize;
|
|
44956
|
-
const data = new Uint8Array(totalSize);
|
|
44957
|
-
const view = new DataView(data.buffer);
|
|
44958
|
-
view.setUint16(0, 4, true);
|
|
44959
|
-
view.setUint16(2, 2, true);
|
|
44960
|
-
view.setUint32(4, STANDARD_FLAGS, true);
|
|
44961
|
-
view.setUint32(8, headerSize, true);
|
|
44962
|
-
const h2 = 12;
|
|
44963
|
-
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
44964
|
-
view.setUint32(h2 + 4, 0, true);
|
|
44965
|
-
view.setUint32(h2 + 8, algId, true);
|
|
44966
|
-
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
44967
|
-
view.setUint32(h2 + 16, keyBits, true);
|
|
44968
|
-
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
44969
|
-
view.setUint32(h2 + 24, 0, true);
|
|
44970
|
-
view.setUint32(h2 + 28, 0, true);
|
|
44971
|
-
data.set(cspNameBytes, h2 + 32);
|
|
44972
|
-
const v = 12 + headerSize;
|
|
44973
|
-
view.setUint32(v, 16, true);
|
|
44974
|
-
data.set(salt.subarray(0, 16), v + 4);
|
|
44975
|
-
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
44976
|
-
view.setUint32(v + 36, 20, true);
|
|
44977
|
-
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
44978
|
-
return data;
|
|
44979
|
-
}
|
|
44980
|
-
async function encryptPptxStandard(pptxBuffer, password, options) {
|
|
44981
|
-
const algorithm = options?.algorithm ?? "AES256";
|
|
44982
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
44983
|
-
const crypto2 = getCrypto();
|
|
44984
|
-
const salt = new Uint8Array(16);
|
|
44985
|
-
crypto2.getRandomValues(salt);
|
|
44986
|
-
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
44987
|
-
const verifier = new Uint8Array(16);
|
|
44988
|
-
crypto2.getRandomValues(verifier);
|
|
44989
|
-
const verifierHash = await hash("SHA-1", verifier);
|
|
44990
|
-
const paddedVerifierHash = new Uint8Array(32);
|
|
44991
|
-
paddedVerifierHash.set(verifierHash.subarray(0, 20));
|
|
44992
|
-
const zeroIv = new Uint8Array(16);
|
|
44993
|
-
const encryptedVerifier = await aesCbcEncryptNoPad(key2, zeroIv, verifier);
|
|
44994
|
-
const encryptedVerifierHash = await aesCbcEncryptNoPad(key2, zeroIv, paddedVerifierHash);
|
|
44995
|
-
const encryptionInfoBytes = buildStandardEncryptionInfoStream(
|
|
44996
|
-
keyBits,
|
|
44997
|
-
salt,
|
|
44998
|
-
encryptedVerifier,
|
|
44999
|
-
encryptedVerifierHash
|
|
45000
|
-
);
|
|
45001
|
-
const packageData = new Uint8Array(pptxBuffer);
|
|
45002
|
-
const encryptedPackage = await encryptStandardPackage(packageData, key2);
|
|
45003
|
-
const ole2Streams = /* @__PURE__ */ new Map();
|
|
45004
|
-
ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
|
|
45005
|
-
ole2Streams.set("EncryptedPackage", encryptedPackage);
|
|
45006
|
-
return buildOle2(ole2Streams);
|
|
45007
|
-
}
|
|
45008
|
-
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
45009
|
-
var init_ooxml_crypto_encrypt = __esm({
|
|
45010
|
-
"src/pptx/core/utils/ooxml-crypto-encrypt.ts"() {
|
|
45011
|
-
init_ole2_parser();
|
|
45012
|
-
init_ooxml_crypto_key_derivation();
|
|
45013
|
-
init_ooxml_crypto_primitives2();
|
|
45014
|
-
STANDARD_ALG_IDS = {
|
|
45015
|
-
128: 26126,
|
|
45016
|
-
// CALG_AES_128
|
|
45017
|
-
192: 26127,
|
|
45018
|
-
// CALG_AES_192
|
|
45019
|
-
256: 26128
|
|
45020
|
-
// CALG_AES_256
|
|
45021
|
-
};
|
|
45022
|
-
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
45023
|
-
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
45024
|
-
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
45025
|
-
STANDARD_FLAGS = 36;
|
|
46048
|
+
// src/pptx/core/utils/ooxml-crypto-primitives.ts
|
|
46049
|
+
var init_ooxml_crypto_primitives2 = __esm({
|
|
46050
|
+
"src/pptx/core/utils/ooxml-crypto-primitives.ts"() {
|
|
46051
|
+
init_ooxml_crypto_primitives();
|
|
45026
46052
|
}
|
|
45027
46053
|
});
|
|
45028
46054
|
|
|
45029
46055
|
// src/pptx/core/utils/ooxml-crypto.ts
|
|
45030
46056
|
async function decryptPptx(encryptedBuffer, password) {
|
|
45031
|
-
|
|
45032
|
-
const encryptionInfoStream = ole2.getStream("EncryptionInfo");
|
|
45033
|
-
if (!encryptionInfoStream) {
|
|
45034
|
-
throw new Error(
|
|
45035
|
-
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
45036
|
-
);
|
|
45037
|
-
}
|
|
45038
|
-
const encryptedPackage = ole2.getStream("EncryptedPackage");
|
|
45039
|
-
if (!encryptedPackage) {
|
|
45040
|
-
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
45041
|
-
}
|
|
45042
|
-
const info = parseEncryptionInfo(encryptionInfoStream);
|
|
45043
|
-
if ("isStandard" in info && info.isStandard) {
|
|
45044
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
45045
|
-
if (!key3) {
|
|
45046
|
-
throw new exports.IncorrectPasswordError();
|
|
45047
|
-
}
|
|
45048
|
-
return decryptStandardPackage(encryptedPackage, key3);
|
|
45049
|
-
}
|
|
45050
|
-
const agileInfo = info;
|
|
45051
|
-
const key2 = await verifyAgilePassword(agileInfo, password);
|
|
45052
|
-
if (!key2) {
|
|
45053
|
-
throw new exports.IncorrectPasswordError();
|
|
45054
|
-
}
|
|
45055
|
-
await verifyAgileDataIntegrity(agileInfo, key2, encryptedPackage);
|
|
45056
|
-
return decryptAgilePackage(encryptedPackage, key2, agileInfo);
|
|
46057
|
+
return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
|
|
45057
46058
|
}
|
|
45058
46059
|
async function encryptPptx(pptxBuffer, password, options) {
|
|
45059
|
-
|
|
45060
|
-
return encryptPptxStandard(pptxBuffer, password, options);
|
|
45061
|
-
}
|
|
45062
|
-
const algorithm = options?.algorithm ?? "AES256";
|
|
45063
|
-
const keyBits = algorithm === "AES128" ? 128 : 256;
|
|
45064
|
-
const crypto2 = getCrypto();
|
|
45065
|
-
const keyDataSalt = new Uint8Array(16);
|
|
45066
|
-
crypto2.getRandomValues(keyDataSalt);
|
|
45067
|
-
const pkeSalt = new Uint8Array(16);
|
|
45068
|
-
crypto2.getRandomValues(pkeSalt);
|
|
45069
|
-
const documentKey = new Uint8Array(keyBits / 8);
|
|
45070
|
-
crypto2.getRandomValues(documentKey);
|
|
45071
|
-
const hashAlgorithm = "SHA-512";
|
|
45072
|
-
const hashSize = 64;
|
|
45073
|
-
const blockSize = 16;
|
|
45074
|
-
const spinCount = options?.spinCount ?? 1e5;
|
|
45075
|
-
const verifierHashInput = new Uint8Array(16);
|
|
45076
|
-
crypto2.getRandomValues(verifierHashInput);
|
|
45077
|
-
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
45078
|
-
const verifierInputKey = await deriveAgileKey(
|
|
45079
|
-
password,
|
|
45080
|
-
pkeSalt,
|
|
45081
|
-
spinCount,
|
|
45082
|
-
hashAlgorithm,
|
|
45083
|
-
BLOCK_KEYS.verifierHashInput,
|
|
45084
|
-
keyBits,
|
|
45085
|
-
hashSize
|
|
45086
|
-
);
|
|
45087
|
-
const paddedVerifierInput = new Uint8Array(
|
|
45088
|
-
Math.ceil(verifierHashInput.length / blockSize) * blockSize
|
|
45089
|
-
);
|
|
45090
|
-
paddedVerifierInput.set(verifierHashInput);
|
|
45091
|
-
const encryptedVerifierHashInput = await aesCbcEncryptNoPad(
|
|
45092
|
-
verifierInputKey,
|
|
45093
|
-
pkeSalt,
|
|
45094
|
-
paddedVerifierInput
|
|
45095
|
-
);
|
|
45096
|
-
const verifierHashKey = await deriveAgileKey(
|
|
45097
|
-
password,
|
|
45098
|
-
pkeSalt,
|
|
45099
|
-
spinCount,
|
|
45100
|
-
hashAlgorithm,
|
|
45101
|
-
BLOCK_KEYS.verifierHashValue,
|
|
45102
|
-
keyBits,
|
|
45103
|
-
hashSize
|
|
45104
|
-
);
|
|
45105
|
-
const paddedVerifierHash = new Uint8Array(Math.ceil(verifierHash.length / blockSize) * blockSize);
|
|
45106
|
-
paddedVerifierHash.set(verifierHash);
|
|
45107
|
-
const encryptedVerifierHashValue = await aesCbcEncryptNoPad(
|
|
45108
|
-
verifierHashKey,
|
|
45109
|
-
pkeSalt,
|
|
45110
|
-
paddedVerifierHash
|
|
45111
|
-
);
|
|
45112
|
-
const encKeyKey = await deriveAgileKey(
|
|
45113
|
-
password,
|
|
45114
|
-
pkeSalt,
|
|
45115
|
-
spinCount,
|
|
45116
|
-
hashAlgorithm,
|
|
45117
|
-
BLOCK_KEYS.encryptedKeyValue,
|
|
45118
|
-
keyBits,
|
|
45119
|
-
hashSize
|
|
45120
|
-
);
|
|
45121
|
-
const paddedDocumentKey = new Uint8Array(Math.ceil(documentKey.length / blockSize) * blockSize);
|
|
45122
|
-
paddedDocumentKey.set(documentKey);
|
|
45123
|
-
const encryptedKeyValue = await aesCbcEncryptNoPad(encKeyKey, pkeSalt, paddedDocumentKey);
|
|
45124
|
-
const encInfo = {
|
|
45125
|
-
keyData: {
|
|
45126
|
-
saltSize: 16,
|
|
45127
|
-
blockSize,
|
|
45128
|
-
keyBits,
|
|
45129
|
-
hashSize,
|
|
45130
|
-
cipherAlgorithm: "AES",
|
|
45131
|
-
cipherChaining: "ChainingModeCBC",
|
|
45132
|
-
hashAlgorithm,
|
|
45133
|
-
saltValue: keyDataSalt
|
|
45134
|
-
},
|
|
45135
|
-
dataIntegrity: {
|
|
45136
|
-
encryptedHmacKey: new Uint8Array(0),
|
|
45137
|
-
// Will be filled after encryption
|
|
45138
|
-
encryptedHmacValue: new Uint8Array(0)
|
|
45139
|
-
},
|
|
45140
|
-
passwordKeyEncryptor: {
|
|
45141
|
-
saltSize: 16,
|
|
45142
|
-
blockSize,
|
|
45143
|
-
keyBits,
|
|
45144
|
-
hashSize,
|
|
45145
|
-
cipherAlgorithm: "AES",
|
|
45146
|
-
cipherChaining: "ChainingModeCBC",
|
|
45147
|
-
hashAlgorithm,
|
|
45148
|
-
saltValue: pkeSalt,
|
|
45149
|
-
spinCount,
|
|
45150
|
-
encryptedVerifierHashInput,
|
|
45151
|
-
encryptedVerifierHashValue,
|
|
45152
|
-
encryptedKeyValue
|
|
45153
|
-
}
|
|
45154
|
-
};
|
|
45155
|
-
const packageData = new Uint8Array(pptxBuffer);
|
|
45156
|
-
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, encInfo);
|
|
45157
|
-
const hmacKeyRandom = new Uint8Array(hashSize);
|
|
45158
|
-
crypto2.getRandomValues(hmacKeyRandom);
|
|
45159
|
-
const hmacValue = await hmac(hashAlgorithm, hmacKeyRandom, encryptedPackage);
|
|
45160
|
-
const hmacKeyIV = await generateIV(
|
|
45161
|
-
hashAlgorithm,
|
|
45162
|
-
keyDataSalt,
|
|
45163
|
-
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
45164
|
-
blockSize
|
|
45165
|
-
);
|
|
45166
|
-
const paddedHmacKey = new Uint8Array(Math.ceil(hmacKeyRandom.length / blockSize) * blockSize);
|
|
45167
|
-
paddedHmacKey.set(hmacKeyRandom);
|
|
45168
|
-
const encryptedHmacKey = await aesCbcEncryptNoPad(documentKey, hmacKeyIV, paddedHmacKey);
|
|
45169
|
-
const hmacValueIV = await generateIV(
|
|
45170
|
-
hashAlgorithm,
|
|
45171
|
-
keyDataSalt,
|
|
45172
|
-
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
45173
|
-
blockSize
|
|
45174
|
-
);
|
|
45175
|
-
const paddedHmacValue = new Uint8Array(Math.ceil(hmacValue.length / blockSize) * blockSize);
|
|
45176
|
-
paddedHmacValue.set(hmacValue);
|
|
45177
|
-
const encryptedHmacValue = await aesCbcEncryptNoPad(documentKey, hmacValueIV, paddedHmacValue);
|
|
45178
|
-
encInfo.dataIntegrity = {
|
|
45179
|
-
encryptedHmacKey,
|
|
45180
|
-
encryptedHmacValue
|
|
45181
|
-
};
|
|
45182
|
-
const xmlStr = buildAgileEncryptionInfoXml(
|
|
45183
|
-
encInfo.keyData,
|
|
45184
|
-
encInfo.passwordKeyEncryptor,
|
|
45185
|
-
encInfo.dataIntegrity
|
|
45186
|
-
);
|
|
45187
|
-
const encryptionInfoBytes = buildEncryptionInfoStream(xmlStr);
|
|
45188
|
-
const ole2Streams = /* @__PURE__ */ new Map();
|
|
45189
|
-
ole2Streams.set("EncryptionInfo", encryptionInfoBytes);
|
|
45190
|
-
ole2Streams.set("EncryptedPackage", encryptedPackage);
|
|
45191
|
-
return buildOle2(ole2Streams);
|
|
46060
|
+
return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
|
|
45192
46061
|
}
|
|
45193
|
-
|
|
45194
|
-
|
|
45195
|
-
const ole2 = parseOle2(encryptedBuffer);
|
|
45196
|
-
const encryptionInfoStream = ole2.getStream("EncryptionInfo");
|
|
45197
|
-
if (!encryptionInfoStream) {
|
|
45198
|
-
return false;
|
|
45199
|
-
}
|
|
45200
|
-
const info = parseEncryptionInfo(encryptionInfoStream);
|
|
45201
|
-
if ("isStandard" in info && info.isStandard) {
|
|
45202
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
45203
|
-
return key3 !== null;
|
|
45204
|
-
}
|
|
45205
|
-
const agileInfo = info;
|
|
45206
|
-
const key2 = await verifyAgilePassword(agileInfo, password);
|
|
45207
|
-
return key2 !== null;
|
|
45208
|
-
} catch {
|
|
45209
|
-
return false;
|
|
45210
|
-
}
|
|
46062
|
+
function verifyPassword(encryptedBuffer, password) {
|
|
46063
|
+
return verifyOoxmlPackagePassword(encryptedBuffer, password);
|
|
45211
46064
|
}
|
|
45212
46065
|
var init_ooxml_crypto = __esm({
|
|
45213
46066
|
"src/pptx/core/utils/ooxml-crypto.ts"() {
|
|
45214
|
-
|
|
45215
|
-
|
|
45216
|
-
|
|
45217
|
-
|
|
45218
|
-
|
|
45219
|
-
|
|
45220
|
-
|
|
46067
|
+
init_crypto();
|
|
46068
|
+
init_errors();
|
|
46069
|
+
}
|
|
46070
|
+
});
|
|
46071
|
+
|
|
46072
|
+
// src/pptx/core/utils/ole2-parser.ts
|
|
46073
|
+
var init_ole2_parser = __esm({
|
|
46074
|
+
"src/pptx/core/utils/ole2-parser.ts"() {
|
|
46075
|
+
init_ole2_parser_types2();
|
|
46076
|
+
init_ole2_parser_read2();
|
|
46077
|
+
init_ole2_parser_write2();
|
|
45221
46078
|
}
|
|
45222
46079
|
});
|
|
45223
46080
|
|
|
45224
46081
|
// src/pptx/core/utils/digests/algorithm-names.ts
|
|
45225
|
-
function
|
|
46082
|
+
function normalizeDigestAlgorithmName2(name) {
|
|
45226
46083
|
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
45227
|
-
return
|
|
46084
|
+
return CANONICAL_BY_LOOKUP_KEY2[key2];
|
|
45228
46085
|
}
|
|
45229
|
-
var
|
|
45230
|
-
var
|
|
46086
|
+
var CANONICAL_BY_LOOKUP_KEY2, WEB_CRYPTO_ALGORITHMS;
|
|
46087
|
+
var init_algorithm_names2 = __esm({
|
|
45231
46088
|
"src/pptx/core/utils/digests/algorithm-names.ts"() {
|
|
45232
|
-
|
|
46089
|
+
CANONICAL_BY_LOOKUP_KEY2 = {
|
|
45233
46090
|
SHA1: "SHA-1",
|
|
45234
46091
|
SHA256: "SHA-256",
|
|
45235
46092
|
SHA384: "SHA-384",
|
|
@@ -45636,12 +46493,12 @@ function transform2(state, x) {
|
|
|
45636
46493
|
function md4(message) {
|
|
45637
46494
|
return mdStyleDigest(message, INITIAL_STATE, transform2);
|
|
45638
46495
|
}
|
|
45639
|
-
var INITIAL_STATE,
|
|
46496
|
+
var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
|
|
45640
46497
|
var init_md4 = __esm({
|
|
45641
46498
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
45642
46499
|
init_bit_ops();
|
|
45643
46500
|
INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
|
|
45644
|
-
|
|
46501
|
+
K22 = 1518500249;
|
|
45645
46502
|
K3 = 1859775393;
|
|
45646
46503
|
ROUND1 = [
|
|
45647
46504
|
[0, 3, 0],
|
|
@@ -45662,22 +46519,22 @@ var init_md4 = __esm({
|
|
|
45662
46519
|
[15, 19, 0]
|
|
45663
46520
|
];
|
|
45664
46521
|
ROUND2 = [
|
|
45665
|
-
[0, 3,
|
|
45666
|
-
[4, 5,
|
|
45667
|
-
[8, 9,
|
|
45668
|
-
[12, 13,
|
|
45669
|
-
[1, 3,
|
|
45670
|
-
[5, 5,
|
|
45671
|
-
[9, 9,
|
|
45672
|
-
[13, 13,
|
|
45673
|
-
[2, 3,
|
|
45674
|
-
[6, 5,
|
|
45675
|
-
[10, 9,
|
|
45676
|
-
[14, 13,
|
|
45677
|
-
[3, 3,
|
|
45678
|
-
[7, 5,
|
|
45679
|
-
[11, 9,
|
|
45680
|
-
[15, 13,
|
|
46522
|
+
[0, 3, K22],
|
|
46523
|
+
[4, 5, K22],
|
|
46524
|
+
[8, 9, K22],
|
|
46525
|
+
[12, 13, K22],
|
|
46526
|
+
[1, 3, K22],
|
|
46527
|
+
[5, 5, K22],
|
|
46528
|
+
[9, 9, K22],
|
|
46529
|
+
[13, 13, K22],
|
|
46530
|
+
[2, 3, K22],
|
|
46531
|
+
[6, 5, K22],
|
|
46532
|
+
[10, 9, K22],
|
|
46533
|
+
[14, 13, K22],
|
|
46534
|
+
[3, 3, K22],
|
|
46535
|
+
[7, 5, K22],
|
|
46536
|
+
[11, 9, K22],
|
|
46537
|
+
[15, 13, K22]
|
|
45681
46538
|
];
|
|
45682
46539
|
ROUND3 = [
|
|
45683
46540
|
[0, 3, K3],
|
|
@@ -46597,9 +47454,9 @@ async function digest(algorithm, data) {
|
|
|
46597
47454
|
throw new Error(`Unsupported digest algorithm: ${algorithm}`);
|
|
46598
47455
|
}
|
|
46599
47456
|
var PURE_DIGESTS;
|
|
46600
|
-
var
|
|
47457
|
+
var init_digest3 = __esm({
|
|
46601
47458
|
"src/pptx/core/utils/digests/digest.ts"() {
|
|
46602
|
-
|
|
47459
|
+
init_algorithm_names2();
|
|
46603
47460
|
init_md2();
|
|
46604
47461
|
init_md42();
|
|
46605
47462
|
init_md5();
|
|
@@ -46620,8 +47477,8 @@ var init_digest = __esm({
|
|
|
46620
47477
|
// src/pptx/core/utils/digests/index.ts
|
|
46621
47478
|
var init_digests = __esm({
|
|
46622
47479
|
"src/pptx/core/utils/digests/index.ts"() {
|
|
46623
|
-
|
|
46624
|
-
|
|
47480
|
+
init_algorithm_names2();
|
|
47481
|
+
init_digest3();
|
|
46625
47482
|
}
|
|
46626
47483
|
});
|
|
46627
47484
|
|
|
@@ -46716,10 +47573,10 @@ var init_modify_verifier_codec = __esm({
|
|
|
46716
47573
|
// src/pptx/core/utils/modify-verifier.ts
|
|
46717
47574
|
function resolveModifyVerifierAlgorithmName(verifier) {
|
|
46718
47575
|
if (verifier.algorithmName) {
|
|
46719
|
-
return
|
|
47576
|
+
return normalizeDigestAlgorithmName2(verifier.algorithmName);
|
|
46720
47577
|
}
|
|
46721
47578
|
if (verifier.algIdExt) {
|
|
46722
|
-
return
|
|
47579
|
+
return normalizeDigestAlgorithmName2(verifier.algIdExt);
|
|
46723
47580
|
}
|
|
46724
47581
|
if (verifier.cryptAlgorithmSid !== void 0) {
|
|
46725
47582
|
return CRYPT_ALGORITHM_SID_NAMES[verifier.cryptAlgorithmSid];
|
|
@@ -46739,7 +47596,7 @@ async function verifyModifyPassword(verifier, password) {
|
|
|
46739
47596
|
}
|
|
46740
47597
|
async function createModifyVerifier(password, options) {
|
|
46741
47598
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
46742
|
-
const algorithm =
|
|
47599
|
+
const algorithm = normalizeDigestAlgorithmName2(requestedAlgorithm);
|
|
46743
47600
|
if (!algorithm) {
|
|
46744
47601
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
46745
47602
|
}
|
|
@@ -46757,7 +47614,7 @@ async function createModifyVerifier(password, options) {
|
|
|
46757
47614
|
}
|
|
46758
47615
|
async function createSaltlessModifyVerifierForTesting(password, options) {
|
|
46759
47616
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
46760
|
-
const algorithm =
|
|
47617
|
+
const algorithm = normalizeDigestAlgorithmName2(requestedAlgorithm);
|
|
46761
47618
|
if (!algorithm) {
|
|
46762
47619
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
46763
47620
|
}
|
|
@@ -46789,373 +47646,44 @@ var init_modify_verifier = __esm({
|
|
|
46789
47646
|
});
|
|
46790
47647
|
|
|
46791
47648
|
// src/pptx/core/utils/signature-detection.ts
|
|
46792
|
-
function detectDigitalSignatures(zipEntryPaths) {
|
|
46793
|
-
const sigPaths = zipEntryPaths.filter(
|
|
46794
|
-
(p) => p.startsWith(SIGNATURE_PREFIX) && p.endsWith(".xml")
|
|
46795
|
-
);
|
|
46796
|
-
return {
|
|
46797
|
-
hasSignatures: sigPaths.length > 0,
|
|
46798
|
-
signatureCount: sigPaths.length,
|
|
46799
|
-
signaturePaths: sigPaths
|
|
46800
|
-
};
|
|
46801
|
-
}
|
|
46802
|
-
function getSignaturePathsToStrip(zipEntryPaths) {
|
|
46803
|
-
return zipEntryPaths.filter((p) => p.startsWith(SIGNATURE_PREFIX));
|
|
46804
|
-
}
|
|
46805
|
-
function findByLocalName(parent, localName29) {
|
|
46806
|
-
if (!parent) {
|
|
46807
|
-
return void 0;
|
|
46808
|
-
}
|
|
46809
|
-
if (parent[localName29] !== void 0 && typeof parent[localName29] === "object") {
|
|
46810
|
-
return parent[localName29];
|
|
46811
|
-
}
|
|
46812
|
-
for (const key2 of Object.keys(parent)) {
|
|
46813
|
-
const parts = key2.split(":");
|
|
46814
|
-
if (parts[parts.length - 1] === localName29 && typeof parent[key2] === "object") {
|
|
46815
|
-
return parent[key2];
|
|
46816
|
-
}
|
|
46817
|
-
}
|
|
46818
|
-
return void 0;
|
|
46819
|
-
}
|
|
46820
|
-
function findScalarByLocalName(parent, localName29) {
|
|
46821
|
-
if (!parent) {
|
|
46822
|
-
return void 0;
|
|
46823
|
-
}
|
|
46824
|
-
if (parent[localName29] !== void 0) {
|
|
46825
|
-
const v = parent[localName29];
|
|
46826
|
-
if (typeof v === "string") {
|
|
46827
|
-
return v;
|
|
46828
|
-
}
|
|
46829
|
-
if (typeof v === "number" || typeof v === "boolean") {
|
|
46830
|
-
return String(v);
|
|
46831
|
-
}
|
|
46832
|
-
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
46833
|
-
return String(v["#text"]);
|
|
46834
|
-
}
|
|
46835
|
-
}
|
|
46836
|
-
for (const key2 of Object.keys(parent)) {
|
|
46837
|
-
const parts = key2.split(":");
|
|
46838
|
-
if (parts[parts.length - 1] === localName29) {
|
|
46839
|
-
const v = parent[key2];
|
|
46840
|
-
if (typeof v === "string") {
|
|
46841
|
-
return v;
|
|
46842
|
-
}
|
|
46843
|
-
if (typeof v === "number" || typeof v === "boolean") {
|
|
46844
|
-
return String(v);
|
|
46845
|
-
}
|
|
46846
|
-
if (typeof v === "object" && v !== null && "#text" in v) {
|
|
46847
|
-
return String(v["#text"]);
|
|
46848
|
-
}
|
|
46849
|
-
}
|
|
46850
|
-
}
|
|
46851
|
-
return void 0;
|
|
46852
|
-
}
|
|
46853
|
-
function findAllByLocalName(parent, localName29) {
|
|
46854
|
-
if (!parent) {
|
|
46855
|
-
return [];
|
|
46856
|
-
}
|
|
46857
|
-
for (const key2 of Object.keys(parent)) {
|
|
46858
|
-
const parts = key2.split(":");
|
|
46859
|
-
if (parts[parts.length - 1] === localName29) {
|
|
46860
|
-
const v = parent[key2];
|
|
46861
|
-
if (Array.isArray(v)) {
|
|
46862
|
-
return v;
|
|
46863
|
-
}
|
|
46864
|
-
if (typeof v === "object" && v !== null) {
|
|
46865
|
-
return [v];
|
|
46866
|
-
}
|
|
46867
|
-
}
|
|
46868
|
-
}
|
|
46869
|
-
return [];
|
|
46870
|
-
}
|
|
46871
|
-
function parseSignatureXml(signatureXml, signaturePath) {
|
|
46872
|
-
const signature = findByLocalName(signatureXml, "Signature");
|
|
46873
|
-
const signedInfo = findByLocalName(signature, "SignedInfo");
|
|
46874
|
-
const sigMethodNode = findByLocalName(signedInfo, "SignatureMethod");
|
|
46875
|
-
const signatureMethod = sigMethodNode?.["@_Algorithm"];
|
|
46876
|
-
const signatureValue = findScalarByLocalName(signature, "SignatureValue")?.replace(/\s+/g, "");
|
|
46877
|
-
const references = [];
|
|
46878
|
-
const refNodes = findAllByLocalName(signedInfo, "Reference");
|
|
46879
|
-
for (const ref of refNodes) {
|
|
46880
|
-
const uri = String(ref["@_URI"] || "");
|
|
46881
|
-
const dmNode = findByLocalName(ref, "DigestMethod");
|
|
46882
|
-
const digestMethod2 = dmNode?.["@_Algorithm"];
|
|
46883
|
-
const digestValue = findScalarByLocalName(ref, "DigestValue")?.replace(/\s+/g, "");
|
|
46884
|
-
references.push({ uri, digestMethod: digestMethod2, digestValue });
|
|
46885
|
-
}
|
|
46886
|
-
const digestMethod = references[0]?.digestMethod;
|
|
46887
|
-
const keyInfo = findByLocalName(signature, "KeyInfo");
|
|
46888
|
-
const x509Data = findByLocalName(keyInfo, "X509Data");
|
|
46889
|
-
let certificate;
|
|
46890
|
-
if (x509Data) {
|
|
46891
|
-
const certBase64 = findScalarByLocalName(x509Data, "X509Certificate")?.replace(/\s+/g, "");
|
|
46892
|
-
if (certBase64) {
|
|
46893
|
-
const issuerSerial = findByLocalName(x509Data, "X509IssuerSerial");
|
|
46894
|
-
const issuer = findScalarByLocalName(issuerSerial, "X509IssuerName");
|
|
46895
|
-
const serialNumber = findScalarByLocalName(issuerSerial, "X509SerialNumber");
|
|
46896
|
-
const subject = findScalarByLocalName(x509Data, "X509SubjectName");
|
|
46897
|
-
certificate = {
|
|
46898
|
-
certificateBase64: certBase64,
|
|
46899
|
-
...issuer ? { issuer } : {},
|
|
46900
|
-
...subject ? { subject } : {},
|
|
46901
|
-
...serialNumber ? { serialNumber } : {}
|
|
46902
|
-
};
|
|
46903
|
-
}
|
|
46904
|
-
}
|
|
46905
|
-
let status = "unverified";
|
|
46906
|
-
if (certificate?.validTo) {
|
|
46907
|
-
const expiry = new Date(certificate.validTo);
|
|
46908
|
-
if (expiry < /* @__PURE__ */ new Date()) {
|
|
46909
|
-
status = "expired";
|
|
46910
|
-
}
|
|
46911
|
-
}
|
|
46912
|
-
return {
|
|
46913
|
-
signaturePath,
|
|
46914
|
-
signatureMethod,
|
|
46915
|
-
digestMethod,
|
|
46916
|
-
signatureValue,
|
|
46917
|
-
certificate,
|
|
46918
|
-
status,
|
|
46919
|
-
references
|
|
46920
|
-
};
|
|
46921
|
-
}
|
|
46922
|
-
async function verifySignatureDigests(signature, getPartContent) {
|
|
46923
|
-
if (!signature.references.length) {
|
|
46924
|
-
return "unverified";
|
|
46925
|
-
}
|
|
46926
|
-
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
46927
|
-
return "unverified";
|
|
46928
|
-
}
|
|
46929
|
-
for (const ref of signature.references) {
|
|
46930
|
-
if (!ref.digestValue || !ref.uri) {
|
|
46931
|
-
continue;
|
|
46932
|
-
}
|
|
46933
|
-
const algo = ref.digestMethod?.toLowerCase() || "";
|
|
46934
|
-
let hashAlgo;
|
|
46935
|
-
if (algo.includes("sha256") || algo.includes("sha-256")) {
|
|
46936
|
-
hashAlgo = "SHA-256";
|
|
46937
|
-
} else if (algo.includes("sha512") || algo.includes("sha-512")) {
|
|
46938
|
-
hashAlgo = "SHA-512";
|
|
46939
|
-
} else if (algo.includes("sha1") || algo.includes("sha-1")) {
|
|
46940
|
-
hashAlgo = "SHA-1";
|
|
46941
|
-
} else {
|
|
46942
|
-
continue;
|
|
46943
|
-
}
|
|
46944
|
-
const content = await getPartContent(ref.uri);
|
|
46945
|
-
if (!content) {
|
|
46946
|
-
continue;
|
|
46947
|
-
}
|
|
46948
|
-
try {
|
|
46949
|
-
const digest2 = await crypto.subtle.digest(hashAlgo, content);
|
|
46950
|
-
const digestBase64 = arrayBufferToBase64(digest2);
|
|
46951
|
-
if (digestBase64 !== ref.digestValue) {
|
|
46952
|
-
return "invalid";
|
|
46953
|
-
}
|
|
46954
|
-
} catch {
|
|
46955
|
-
return "unverified";
|
|
46956
|
-
}
|
|
46957
|
-
}
|
|
46958
|
-
return signature.certificate ? "valid" : "unknownCA";
|
|
46959
|
-
}
|
|
46960
|
-
function arrayBufferToBase64(buffer) {
|
|
46961
|
-
const bytes = new Uint8Array(buffer);
|
|
46962
|
-
let binary = "";
|
|
46963
|
-
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
46964
|
-
binary += String.fromCharCode(bytes[i2]);
|
|
46965
|
-
}
|
|
46966
|
-
return btoa(binary);
|
|
46967
|
-
}
|
|
46968
|
-
var SIGNATURE_PREFIX;
|
|
46969
47649
|
var init_signature_detection = __esm({
|
|
46970
47650
|
"src/pptx/core/utils/signature-detection.ts"() {
|
|
46971
|
-
|
|
47651
|
+
init_detection();
|
|
46972
47652
|
}
|
|
46973
47653
|
});
|
|
46974
47654
|
|
|
46975
47655
|
// src/pptx/core/utils/signature-constants.ts
|
|
46976
|
-
exports.DIGITAL_SIGNATURE_ORIGIN_REL_TYPE = void 0; exports.DIGITAL_SIGNATURE_REL_TYPE = void 0; exports.PPTX_VIEWER_MANIFEST_NS = void 0; exports.XMLDSIG_NS = void 0; exports.OPC_RELATIONSHIP_TRANSFORM = void 0; exports.XML_TRANSFORM_ENVELOPED_SIGNATURE = void 0; exports.SUPPORTED_XML_CANON_TRANSFORMS = void 0; exports.ENTERPRISE_TRUST_ROOTS_FILE_ENV = void 0; exports.ENTERPRISE_TRUST_ROOTS_PEM_ENV = void 0; exports.ENTERPRISE_REQUIRE_REVOCATION_ENV = void 0; exports.ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = void 0; exports.ENTERPRISE_REQUIRE_TIMESTAMP_ENV = void 0; exports.DIGEST_ALGORITHM_TO_HASH = void 0; exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO = void 0;
|
|
46977
47656
|
var init_signature_constants = __esm({
|
|
46978
47657
|
"src/pptx/core/utils/signature-constants.ts"() {
|
|
46979
|
-
|
|
46980
|
-
exports.DIGITAL_SIGNATURE_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature";
|
|
46981
|
-
exports.PPTX_VIEWER_MANIFEST_NS = "urn:pptx-viewer:ooxml-signature:v1";
|
|
46982
|
-
exports.XMLDSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
|
|
46983
|
-
exports.OPC_RELATIONSHIP_TRANSFORM = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
|
|
46984
|
-
exports.XML_TRANSFORM_ENVELOPED_SIGNATURE = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
|
|
46985
|
-
exports.SUPPORTED_XML_CANON_TRANSFORMS = /* @__PURE__ */ new Set([
|
|
46986
|
-
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
|
|
46987
|
-
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments",
|
|
46988
|
-
"http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
46989
|
-
"http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
|
|
46990
|
-
exports.XML_TRANSFORM_ENVELOPED_SIGNATURE
|
|
46991
|
-
]);
|
|
46992
|
-
exports.ENTERPRISE_TRUST_ROOTS_FILE_ENV = "PPTX_VIEWER_TRUST_ROOTS_FILE";
|
|
46993
|
-
exports.ENTERPRISE_TRUST_ROOTS_PEM_ENV = "PPTX_VIEWER_TRUST_ROOTS_PEM";
|
|
46994
|
-
exports.ENTERPRISE_REQUIRE_REVOCATION_ENV = "PPTX_VIEWER_REQUIRE_REVOCATION_CHECK";
|
|
46995
|
-
exports.ENTERPRISE_FAIL_ON_REVOCATION_UNKNOWN_ENV = "PPTX_VIEWER_FAIL_ON_REVOCATION_UNKNOWN";
|
|
46996
|
-
exports.ENTERPRISE_REQUIRE_TIMESTAMP_ENV = "PPTX_VIEWER_REQUIRE_TIMESTAMP";
|
|
46997
|
-
exports.DIGEST_ALGORITHM_TO_HASH = {
|
|
46998
|
-
"http://www.w3.org/2000/09/xmldsig#sha1": "sha1",
|
|
46999
|
-
"http://www.w3.org/2001/04/xmlenc#sha256": "sha256",
|
|
47000
|
-
"http://www.w3.org/2001/04/xmlenc#sha384": "sha384",
|
|
47001
|
-
"http://www.w3.org/2001/04/xmlenc#sha512": "sha512"
|
|
47002
|
-
};
|
|
47003
|
-
exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO = {
|
|
47004
|
-
"http://www.w3.org/2000/09/xmldsig#sha1": "SHA-1",
|
|
47005
|
-
"http://www.w3.org/2001/04/xmlenc#sha256": "SHA-256",
|
|
47006
|
-
"http://www.w3.org/2001/04/xmlenc#sha384": "SHA-384",
|
|
47007
|
-
"http://www.w3.org/2001/04/xmlenc#sha512": "SHA-512"
|
|
47008
|
-
};
|
|
47658
|
+
init_constants3();
|
|
47009
47659
|
}
|
|
47010
47660
|
});
|
|
47011
47661
|
|
|
47012
47662
|
// src/pptx/core/utils/signature-xml-utils.ts
|
|
47013
|
-
function escapeXmlAttr(value) {
|
|
47014
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
47015
|
-
}
|
|
47016
|
-
function escapeXmlText(value) {
|
|
47017
|
-
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
47018
|
-
}
|
|
47019
|
-
function isValidBase64(value) {
|
|
47020
|
-
return typeof value === "string" && value.length > 0 && /^[A-Za-z0-9+/=\s]+$/.test(value);
|
|
47021
|
-
}
|
|
47022
|
-
function extractTagAttribute(xml, tagName, attributeName) {
|
|
47023
|
-
const pattern = new RegExp(
|
|
47024
|
-
`<${tagName}\\b[^>]*\\b${attributeName}="(?<attributeValue>[^"]+)"`,
|
|
47025
|
-
"i"
|
|
47026
|
-
);
|
|
47027
|
-
const match = xml.match(pattern);
|
|
47028
|
-
return match?.groups?.["attributeValue"]?.trim();
|
|
47029
|
-
}
|
|
47030
|
-
function extractFirstTagText(xml, localName29) {
|
|
47031
|
-
const pattern = new RegExp(
|
|
47032
|
-
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
47033
|
-
"i"
|
|
47034
|
-
);
|
|
47035
|
-
const match = xml.match(pattern);
|
|
47036
|
-
return match?.[2]?.replace(/\s+/g, "").trim() || void 0;
|
|
47037
|
-
}
|
|
47038
|
-
function extractAllTagText(xml, localName29) {
|
|
47039
|
-
const result = [];
|
|
47040
|
-
const regex = new RegExp(
|
|
47041
|
-
`<([\\w.-]+:)?${localName29}\\b[^>]*>([\\s\\S]*?)<\\/([\\w.-]+:)?${localName29}>`,
|
|
47042
|
-
"gi"
|
|
47043
|
-
);
|
|
47044
|
-
let match = regex.exec(xml);
|
|
47045
|
-
while (match) {
|
|
47046
|
-
const value = match[2]?.replace(/\s+/g, "").trim();
|
|
47047
|
-
if (value) {
|
|
47048
|
-
result.push(value);
|
|
47049
|
-
}
|
|
47050
|
-
match = regex.exec(xml);
|
|
47051
|
-
}
|
|
47052
|
-
return result;
|
|
47053
|
-
}
|
|
47054
47663
|
var init_signature_xml_utils = __esm({
|
|
47055
47664
|
"src/pptx/core/utils/signature-xml-utils.ts"() {
|
|
47665
|
+
init_xml_utils2();
|
|
47056
47666
|
}
|
|
47057
47667
|
});
|
|
47058
47668
|
|
|
47059
47669
|
// src/pptx/core/utils/signature-reference-utils.ts
|
|
47060
|
-
function normalizePartPath(partPath) {
|
|
47061
|
-
return partPath.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
47062
|
-
}
|
|
47063
|
-
function resolveReferenceUriToPart(uri) {
|
|
47064
|
-
const trimmed = uri.trim();
|
|
47065
|
-
if (trimmed.length === 0 || trimmed.startsWith("#")) {
|
|
47066
|
-
return void 0;
|
|
47067
|
-
}
|
|
47068
|
-
const decoded = decodeURIComponent(trimmed);
|
|
47069
|
-
return normalizePartPath(decoded.startsWith("/") ? decoded.slice(1) : decoded);
|
|
47070
|
-
}
|
|
47071
47670
|
var init_signature_reference_utils = __esm({
|
|
47072
47671
|
"src/pptx/core/utils/signature-reference-utils.ts"() {
|
|
47672
|
+
init_reference_utils();
|
|
47073
47673
|
}
|
|
47074
47674
|
});
|
|
47075
47675
|
|
|
47076
47676
|
// src/pptx/core/utils/signature-digest.ts
|
|
47077
|
-
async function computeDigestBase64(content, digestAlgorithmUri) {
|
|
47078
|
-
const webCryptoAlgo = exports.DIGEST_ALGORITHM_TO_WEB_CRYPTO[digestAlgorithmUri];
|
|
47079
|
-
if (!webCryptoAlgo) {
|
|
47080
|
-
return void 0;
|
|
47081
|
-
}
|
|
47082
|
-
if (typeof globalThis.crypto?.subtle === "undefined") {
|
|
47083
|
-
return void 0;
|
|
47084
|
-
}
|
|
47085
|
-
const buf = new ArrayBuffer(content.byteLength);
|
|
47086
|
-
new Uint8Array(buf).set(content);
|
|
47087
|
-
const digest2 = await globalThis.crypto.subtle.digest(webCryptoAlgo, buf);
|
|
47088
|
-
return uint8ArrayToBase64(new Uint8Array(digest2));
|
|
47089
|
-
}
|
|
47090
|
-
function uint8ArrayToBase64(bytes) {
|
|
47091
|
-
let binary = "";
|
|
47092
|
-
for (let i2 = 0; i2 < bytes.byteLength; i2++) {
|
|
47093
|
-
binary += String.fromCharCode(bytes[i2]);
|
|
47094
|
-
}
|
|
47095
|
-
return btoa(binary);
|
|
47096
|
-
}
|
|
47097
47677
|
var init_signature_digest = __esm({
|
|
47098
47678
|
"src/pptx/core/utils/signature-digest.ts"() {
|
|
47099
|
-
|
|
47679
|
+
init_digest();
|
|
47100
47680
|
}
|
|
47101
47681
|
});
|
|
47102
47682
|
|
|
47103
47683
|
// src/pptx/core/utils/signature-inspection-status.ts
|
|
47104
|
-
function computeDetailStatus(detail, policy) {
|
|
47105
|
-
const hasDigestMismatch = detail.referenceChecks.some(
|
|
47106
|
-
(check) => check.digestStatus === "mismatch"
|
|
47107
|
-
);
|
|
47108
|
-
const hasMissingPart = detail.missingPartReferences.length > 0;
|
|
47109
|
-
const hasVerifiedDigest = detail.referenceChecks.some(
|
|
47110
|
-
(check) => check.digestStatus === "verified"
|
|
47111
|
-
);
|
|
47112
|
-
const revocationUnknown = detail.certificateRevocationStatus === "unknown" || detail.certificateRevocationStatus === "not-checked" || detail.certificateRevocationStatus === "error";
|
|
47113
|
-
const timestampMissingOrUntrusted = detail.timestampAuthorityStatus === "not-present" || detail.timestampAuthorityStatus === "not-checked" || detail.timestampAuthorityStatus === "error" || detail.timestampAuthorityStatus === "untrusted";
|
|
47114
|
-
if (detail.signatureValueStatus === "invalid") {
|
|
47115
|
-
return "signature-invalid";
|
|
47116
|
-
}
|
|
47117
|
-
if (hasMissingPart) {
|
|
47118
|
-
return "reference-missing";
|
|
47119
|
-
}
|
|
47120
|
-
if (hasDigestMismatch) {
|
|
47121
|
-
return "digest-mismatch";
|
|
47122
|
-
}
|
|
47123
|
-
if (detail.certificateRevocationStatus === "revoked") {
|
|
47124
|
-
return "certificate-revoked";
|
|
47125
|
-
}
|
|
47126
|
-
if (policy.requireRevocationCheck && (policy.failOnRevocationUnknown ? revocationUnknown : detail.certificateRevocationStatus !== "good")) {
|
|
47127
|
-
return "certificate-untrusted";
|
|
47128
|
-
}
|
|
47129
|
-
if (detail.timestampAuthorityStatus === "invalid") {
|
|
47130
|
-
return "timestamp-invalid";
|
|
47131
|
-
}
|
|
47132
|
-
if (policy.requireTimestamp && timestampMissingOrUntrusted) {
|
|
47133
|
-
return "timestamp-untrusted";
|
|
47134
|
-
}
|
|
47135
|
-
if (detail.timestampAuthorityStatus === "untrusted") {
|
|
47136
|
-
return "timestamp-untrusted";
|
|
47137
|
-
}
|
|
47138
|
-
if (detail.certificateTrustStatus === "untrusted" && detail.signatureValueStatus === "verified") {
|
|
47139
|
-
return "certificate-untrusted";
|
|
47140
|
-
}
|
|
47141
|
-
if (hasVerifiedDigest && detail.signatureValueStatus === "verified") {
|
|
47142
|
-
return "verified";
|
|
47143
|
-
}
|
|
47144
|
-
return "structural-only";
|
|
47145
|
-
}
|
|
47146
|
-
function computeVerificationStatus(details) {
|
|
47147
|
-
const hasInvalidSignature = details.some((detail) => detail.status === "signature-invalid");
|
|
47148
|
-
const hasMissing = details.some((detail) => detail.status === "reference-missing");
|
|
47149
|
-
const hasMismatch = details.some((detail) => detail.status === "digest-mismatch");
|
|
47150
|
-
const hasUntrusted = details.some((detail) => detail.status === "certificate-untrusted");
|
|
47151
|
-
const hasRevoked = details.some((detail) => detail.status === "certificate-revoked");
|
|
47152
|
-
const hasTimestampInvalid = details.some((detail) => detail.status === "timestamp-invalid");
|
|
47153
|
-
const hasTimestampUntrusted = details.some((detail) => detail.status === "timestamp-untrusted");
|
|
47154
|
-
const allVerified = details.every((detail) => detail.status === "verified");
|
|
47155
|
-
return hasInvalidSignature ? "signature-invalid" : hasRevoked ? "certificate-revoked" : hasTimestampInvalid ? "timestamp-invalid" : hasTimestampUntrusted ? "timestamp-untrusted" : hasMissing ? "reference-missing" : hasMismatch ? "digest-mismatch" : allVerified ? "verified-trusted" : hasUntrusted ? "verified-untrusted" : "present-not-verified";
|
|
47156
|
-
}
|
|
47157
47684
|
var init_signature_inspection_status = __esm({
|
|
47158
47685
|
"src/pptx/core/utils/signature-inspection-status.ts"() {
|
|
47686
|
+
init_inspection_status();
|
|
47159
47687
|
}
|
|
47160
47688
|
});
|
|
47161
47689
|
|
|
@@ -47514,11 +48042,11 @@ function parseSeriesErrBars(seriesNode, xmlLookup, extractPointValues, colorPars
|
|
|
47514
48042
|
return result;
|
|
47515
48043
|
}).filter((e) => e !== void 0);
|
|
47516
48044
|
}
|
|
47517
|
-
function parseLineStyle(
|
|
47518
|
-
if (!
|
|
48045
|
+
function parseLineStyle(container2, elementName, xmlLookup, colorParser) {
|
|
48046
|
+
if (!container2) {
|
|
47519
48047
|
return void 0;
|
|
47520
48048
|
}
|
|
47521
|
-
const lineNode = xmlLookup.getChildByLocalName(
|
|
48049
|
+
const lineNode = xmlLookup.getChildByLocalName(container2, elementName);
|
|
47522
48050
|
if (!lineNode) {
|
|
47523
48051
|
return void 0;
|
|
47524
48052
|
}
|
|
@@ -48141,7 +48669,7 @@ function parseChartUniqueId(node, localName29) {
|
|
|
48141
48669
|
const val = uniqueIdNode?.["@_val"];
|
|
48142
48670
|
return typeof val === "string" && val.length > 0 ? val : void 0;
|
|
48143
48671
|
}
|
|
48144
|
-
function
|
|
48672
|
+
function randomBytes2(length) {
|
|
48145
48673
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
48146
48674
|
if (cryptoObj && typeof cryptoObj.getRandomValues === "function") {
|
|
48147
48675
|
return cryptoObj.getRandomValues(new Uint8Array(length));
|
|
@@ -48153,7 +48681,7 @@ function randomBytes(length) {
|
|
|
48153
48681
|
return bytes;
|
|
48154
48682
|
}
|
|
48155
48683
|
function randomHex(length) {
|
|
48156
|
-
const bytes =
|
|
48684
|
+
const bytes = randomBytes2(Math.ceil(length / 2));
|
|
48157
48685
|
let out = "";
|
|
48158
48686
|
for (const b of bytes) {
|
|
48159
48687
|
out += b.toString(16).padStart(2, "0");
|
|
@@ -48162,7 +48690,7 @@ function randomHex(length) {
|
|
|
48162
48690
|
}
|
|
48163
48691
|
function generateChartUniqueId() {
|
|
48164
48692
|
const cryptoObj = typeof crypto === "undefined" ? void 0 : crypto;
|
|
48165
|
-
const variantNibble = (8 +
|
|
48693
|
+
const variantNibble = (8 + randomBytes2(1)[0] % 4).toString(16);
|
|
48166
48694
|
const uuid = cryptoObj && typeof cryptoObj.randomUUID === "function" ? cryptoObj.randomUUID() : `${randomHex(8)}-${randomHex(4)}-4${randomHex(3)}-${variantNibble}${randomHex(3)}-${randomHex(12)}`;
|
|
48167
48695
|
return `{${uuid.toUpperCase()}}`;
|
|
48168
48696
|
}
|
|
@@ -52601,10 +53129,10 @@ function parseVmlGroup(node, idPrefix, index) {
|
|
|
52601
53129
|
return null;
|
|
52602
53130
|
}
|
|
52603
53131
|
}
|
|
52604
|
-
function parseVmlElements(
|
|
53132
|
+
function parseVmlElements(container2, idPrefix = "") {
|
|
52605
53133
|
const elements2 = [];
|
|
52606
53134
|
for (const tag of exports.VML_SHAPE_TAGS) {
|
|
52607
|
-
const nodes =
|
|
53135
|
+
const nodes = container2[tag];
|
|
52608
53136
|
if (!nodes) {
|
|
52609
53137
|
continue;
|
|
52610
53138
|
}
|
|
@@ -52704,8 +53232,8 @@ function diagnoseSelection(ac) {
|
|
|
52704
53232
|
}
|
|
52705
53233
|
return void 0;
|
|
52706
53234
|
}
|
|
52707
|
-
function unwrapAlternateContent(
|
|
52708
|
-
const altContents = ensureArray3(
|
|
53235
|
+
function unwrapAlternateContent(container2) {
|
|
53236
|
+
const altContents = ensureArray3(container2["mc:AlternateContent"]);
|
|
52709
53237
|
if (altContents.length === 0) {
|
|
52710
53238
|
return [];
|
|
52711
53239
|
}
|
|
@@ -52725,7 +53253,7 @@ function unwrapAlternateContent(container) {
|
|
|
52725
53253
|
for (const tag of exports.SHAPE_TREE_ELEMENT_TAGS) {
|
|
52726
53254
|
const children15 = ensureArray3(branch[tag]);
|
|
52727
53255
|
if (children15.length > 0) {
|
|
52728
|
-
|
|
53256
|
+
container2[tag] = [...ensureArray3(container2[tag]), ...children15];
|
|
52729
53257
|
for (const child27 of children15) {
|
|
52730
53258
|
block.childRefs.push({ tag, node: child27 });
|
|
52731
53259
|
}
|
|
@@ -52735,11 +53263,11 @@ function unwrapAlternateContent(container) {
|
|
|
52735
53263
|
blocks.push(block);
|
|
52736
53264
|
}
|
|
52737
53265
|
}
|
|
52738
|
-
delete
|
|
53266
|
+
delete container2["mc:AlternateContent"];
|
|
52739
53267
|
return blocks;
|
|
52740
53268
|
}
|
|
52741
|
-
function reapplyAlternateContentToTree(
|
|
52742
|
-
let working =
|
|
53269
|
+
function reapplyAlternateContentToTree(container2, blockByNode) {
|
|
53270
|
+
let working = container2;
|
|
52743
53271
|
const groups = ensureArray3(working["p:grpSp"]);
|
|
52744
53272
|
if (groups.length > 0) {
|
|
52745
53273
|
let groupsChanged = false;
|
|
@@ -53634,16 +54162,16 @@ function applyActiveXControlsToSlide(slideXml3, controls) {
|
|
|
53634
54162
|
return;
|
|
53635
54163
|
}
|
|
53636
54164
|
const nodes = controls.map(buildActiveXControlNode);
|
|
53637
|
-
const
|
|
54165
|
+
const container2 = cSld["p:controls"] ?? {};
|
|
53638
54166
|
const isNewContainer = cSld["p:controls"] === void 0;
|
|
53639
|
-
|
|
54167
|
+
container2["p:control"] = nodes.length === 1 ? nodes[0] : nodes;
|
|
53640
54168
|
if (isNewContainer && cSld["p:extLst"] !== void 0) {
|
|
53641
54169
|
const extLst = cSld["p:extLst"];
|
|
53642
54170
|
delete cSld["p:extLst"];
|
|
53643
|
-
cSld["p:controls"] =
|
|
54171
|
+
cSld["p:controls"] = container2;
|
|
53644
54172
|
cSld["p:extLst"] = extLst;
|
|
53645
54173
|
} else {
|
|
53646
|
-
cSld["p:controls"] =
|
|
54174
|
+
cSld["p:controls"] = container2;
|
|
53647
54175
|
}
|
|
53648
54176
|
}
|
|
53649
54177
|
var init_activex_serializer = __esm({
|
|
@@ -60161,12 +60689,12 @@ var init_effect_dag_primitives = __esm({
|
|
|
60161
60689
|
});
|
|
60162
60690
|
|
|
60163
60691
|
// src/pptx/core/core/builders/effect-dag-serializer.ts
|
|
60164
|
-
function serializeEffectDagContainerNode(
|
|
60165
|
-
const xml = { "@_type":
|
|
60166
|
-
if (
|
|
60167
|
-
xml["@_name"] =
|
|
60692
|
+
function serializeEffectDagContainerNode(container2) {
|
|
60693
|
+
const xml = { "@_type": container2.type };
|
|
60694
|
+
if (container2.name) {
|
|
60695
|
+
xml["@_name"] = container2.name;
|
|
60168
60696
|
}
|
|
60169
|
-
for (const child27 of
|
|
60697
|
+
for (const child27 of container2.children) {
|
|
60170
60698
|
appendChild2(xml, child27);
|
|
60171
60699
|
}
|
|
60172
60700
|
return xml;
|
|
@@ -60232,24 +60760,24 @@ function parseEffectDagContainer(node) {
|
|
|
60232
60760
|
const type = VALID_CONTAINER_TYPES.has(typeAttr) ? typeAttr : "sib";
|
|
60233
60761
|
const nameAttr = String(xml["@_name"] ?? "").trim();
|
|
60234
60762
|
const children15 = parseChildren(xml);
|
|
60235
|
-
const
|
|
60763
|
+
const container2 = {
|
|
60236
60764
|
kind: "cont",
|
|
60237
60765
|
type,
|
|
60238
60766
|
children: children15
|
|
60239
60767
|
};
|
|
60240
60768
|
if (nameAttr) {
|
|
60241
|
-
|
|
60769
|
+
container2.name = nameAttr;
|
|
60242
60770
|
}
|
|
60243
|
-
return
|
|
60771
|
+
return container2;
|
|
60244
60772
|
}
|
|
60245
60773
|
function buildEffectDagTreeFromXml(effectDagXml) {
|
|
60246
60774
|
return parseEffectDagContainer(effectDagXml);
|
|
60247
60775
|
}
|
|
60248
|
-
function serializeEffectDagContainer(
|
|
60249
|
-
if (!
|
|
60776
|
+
function serializeEffectDagContainer(container2) {
|
|
60777
|
+
if (!container2) {
|
|
60250
60778
|
return void 0;
|
|
60251
60779
|
}
|
|
60252
|
-
return serializeEffectDagContainerNode(
|
|
60780
|
+
return serializeEffectDagContainerNode(container2);
|
|
60253
60781
|
}
|
|
60254
60782
|
function parseChildren(xml) {
|
|
60255
60783
|
const children15 = [];
|
|
@@ -60315,7 +60843,7 @@ function parseBlend(value) {
|
|
|
60315
60843
|
const modeAttr = String(xml["@_blend"] ?? "").trim().toLowerCase();
|
|
60316
60844
|
const mode = VALID_BLEND_MODES.has(modeAttr) ? modeAttr : "over";
|
|
60317
60845
|
const contNode = childByLocalName2(xml, "cont");
|
|
60318
|
-
const
|
|
60846
|
+
const container2 = parseEffectDagContainer(Array.isArray(contNode) ? contNode[0] : contNode) ?? {
|
|
60319
60847
|
kind: "cont",
|
|
60320
60848
|
type: "sib",
|
|
60321
60849
|
children: []
|
|
@@ -60323,7 +60851,7 @@ function parseBlend(value) {
|
|
|
60323
60851
|
return {
|
|
60324
60852
|
kind: "blend",
|
|
60325
60853
|
mode,
|
|
60326
|
-
container
|
|
60854
|
+
container: container2
|
|
60327
60855
|
};
|
|
60328
60856
|
}
|
|
60329
60857
|
function parseXfrm(value) {
|
|
@@ -62120,13 +62648,13 @@ function boolValue2(node) {
|
|
|
62120
62648
|
const value = node["@_val"];
|
|
62121
62649
|
return value !== "0" && value !== "false";
|
|
62122
62650
|
}
|
|
62123
|
-
function parseBubbleChartOptions(
|
|
62124
|
-
if (!
|
|
62651
|
+
function parseBubbleChartOptions(container2, localName29) {
|
|
62652
|
+
if (!container2) {
|
|
62125
62653
|
return void 0;
|
|
62126
62654
|
}
|
|
62127
62655
|
const node = (name) => {
|
|
62128
|
-
const key2 = findKey11(
|
|
62129
|
-
return key2 ?
|
|
62656
|
+
const key2 = findKey11(container2, name, localName29);
|
|
62657
|
+
return key2 ? container2[key2] : void 0;
|
|
62130
62658
|
};
|
|
62131
62659
|
const options = {};
|
|
62132
62660
|
const bubble3D = boolValue2(node("bubble3D"));
|
|
@@ -62153,33 +62681,33 @@ function parseBubbleChartOptions(container, localName29) {
|
|
|
62153
62681
|
}
|
|
62154
62682
|
return Object.keys(options).length > 0 ? options : void 0;
|
|
62155
62683
|
}
|
|
62156
|
-
function insertOrdered2(
|
|
62157
|
-
const existingKey = findKey11(
|
|
62684
|
+
function insertOrdered2(container2, name, value, localName29) {
|
|
62685
|
+
const existingKey = findKey11(container2, name, localName29);
|
|
62158
62686
|
if (existingKey) {
|
|
62159
|
-
|
|
62687
|
+
container2[existingKey] = { ...container2[existingKey], ...value };
|
|
62160
62688
|
return;
|
|
62161
62689
|
}
|
|
62162
|
-
const entries = Object.entries(
|
|
62690
|
+
const entries = Object.entries(container2);
|
|
62163
62691
|
const targetRank = ORDER2.indexOf(name);
|
|
62164
62692
|
const index = entries.findIndex(([key2]) => {
|
|
62165
62693
|
const rank = ORDER2.indexOf(localName29(key2));
|
|
62166
62694
|
return rank >= 0 && rank > targetRank;
|
|
62167
62695
|
});
|
|
62168
62696
|
entries.splice(index < 0 ? entries.length : index, 0, [`c:${name}`, value]);
|
|
62169
|
-
for (const key2 of Object.keys(
|
|
62170
|
-
delete
|
|
62697
|
+
for (const key2 of Object.keys(container2)) {
|
|
62698
|
+
delete container2[key2];
|
|
62171
62699
|
}
|
|
62172
62700
|
for (const [key2, child27] of entries) {
|
|
62173
|
-
|
|
62701
|
+
container2[key2] = child27;
|
|
62174
62702
|
}
|
|
62175
62703
|
}
|
|
62176
|
-
function applyBubbleChartOptions(
|
|
62704
|
+
function applyBubbleChartOptions(container2, options, localName29) {
|
|
62177
62705
|
if (options.bubble3D !== void 0) {
|
|
62178
|
-
insertOrdered2(
|
|
62706
|
+
insertOrdered2(container2, "bubble3D", { "@_val": options.bubble3D ? "1" : "0" }, localName29);
|
|
62179
62707
|
}
|
|
62180
62708
|
if (options.bubbleScale !== void 0) {
|
|
62181
62709
|
insertOrdered2(
|
|
62182
|
-
|
|
62710
|
+
container2,
|
|
62183
62711
|
"bubbleScale",
|
|
62184
62712
|
{
|
|
62185
62713
|
"@_val": chartPercentUnionValue(options.bubbleScale, {
|
|
@@ -62193,14 +62721,14 @@ function applyBubbleChartOptions(container, options, localName29) {
|
|
|
62193
62721
|
}
|
|
62194
62722
|
if (options.showNegativeBubbles !== void 0) {
|
|
62195
62723
|
insertOrdered2(
|
|
62196
|
-
|
|
62724
|
+
container2,
|
|
62197
62725
|
"showNegBubbles",
|
|
62198
62726
|
{ "@_val": options.showNegativeBubbles ? "1" : "0" },
|
|
62199
62727
|
localName29
|
|
62200
62728
|
);
|
|
62201
62729
|
}
|
|
62202
62730
|
if (options.sizeRepresents !== void 0) {
|
|
62203
|
-
insertOrdered2(
|
|
62731
|
+
insertOrdered2(container2, "sizeRepresents", { "@_val": options.sizeRepresents }, localName29);
|
|
62204
62732
|
}
|
|
62205
62733
|
}
|
|
62206
62734
|
var ORDER2;
|
|
@@ -62566,12 +63094,12 @@ var init_chart_up_down_bars = __esm({
|
|
|
62566
63094
|
});
|
|
62567
63095
|
|
|
62568
63096
|
// src/pptx/core/utils/drawing-media-reference.ts
|
|
62569
|
-
function parseDrawingMediaReference(
|
|
62570
|
-
if (!
|
|
63097
|
+
function parseDrawingMediaReference(container2, externalRelIds) {
|
|
63098
|
+
if (!container2) {
|
|
62571
63099
|
return void 0;
|
|
62572
63100
|
}
|
|
62573
63101
|
for (const kind of MEDIA_REFERENCE_NAMES) {
|
|
62574
|
-
const node = child15(
|
|
63102
|
+
const node = child15(container2, kind);
|
|
62575
63103
|
if (!node) {
|
|
62576
63104
|
continue;
|
|
62577
63105
|
}
|
|
@@ -62595,15 +63123,15 @@ function parseDrawingMediaReference(container, externalRelIds) {
|
|
|
62595
63123
|
}
|
|
62596
63124
|
return void 0;
|
|
62597
63125
|
}
|
|
62598
|
-
function applyDrawingMediaReference(
|
|
63126
|
+
function applyDrawingMediaReference(container2, element, relationshipId2) {
|
|
62599
63127
|
const kind = element.mediaReferenceKind;
|
|
62600
63128
|
if (!kind) {
|
|
62601
63129
|
return;
|
|
62602
63130
|
}
|
|
62603
|
-
const targetKey = Object.keys(
|
|
62604
|
-
for (const key2 of Object.keys(
|
|
63131
|
+
const targetKey = Object.keys(container2).find((key2) => localName14(key2) === kind);
|
|
63132
|
+
for (const key2 of Object.keys(container2)) {
|
|
62605
63133
|
if (MEDIA_REFERENCE_NAMES.includes(localName14(key2))) {
|
|
62606
|
-
delete
|
|
63134
|
+
delete container2[key2];
|
|
62607
63135
|
}
|
|
62608
63136
|
}
|
|
62609
63137
|
const original = element.rawMediaReferenceXml ? { ...element.rawMediaReferenceXml } : {};
|
|
@@ -62620,7 +63148,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
62620
63148
|
if (extKey) {
|
|
62621
63149
|
original[extKey] = extension;
|
|
62622
63150
|
}
|
|
62623
|
-
|
|
63151
|
+
container2[targetKey ?? "a:audioCd"] = original;
|
|
62624
63152
|
return;
|
|
62625
63153
|
}
|
|
62626
63154
|
if (kind === "wavAudioFile") {
|
|
@@ -62640,7 +63168,7 @@ function applyDrawingMediaReference(container, element, relationshipId2) {
|
|
|
62640
63168
|
setAttribute4(original, "contentType", element.mediaReferenceContentType);
|
|
62641
63169
|
}
|
|
62642
63170
|
}
|
|
62643
|
-
|
|
63171
|
+
container2[targetKey ?? `a:${kind}`] = original;
|
|
62644
63172
|
}
|
|
62645
63173
|
function parseAudioCdPosition(value) {
|
|
62646
63174
|
if (!value || typeof value !== "object") {
|
|
@@ -67910,10 +68438,10 @@ function applyPresentationDefaultTextStyle(presentation, levels) {
|
|
|
67910
68438
|
PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE
|
|
67911
68439
|
);
|
|
67912
68440
|
}
|
|
67913
|
-
function insertBeforeKeys(
|
|
68441
|
+
function insertBeforeKeys(container2, key2, value, before) {
|
|
67914
68442
|
const rebuilt = {};
|
|
67915
68443
|
let inserted = false;
|
|
67916
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
68444
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
67917
68445
|
if (childKey3 === key2) {
|
|
67918
68446
|
continue;
|
|
67919
68447
|
}
|
|
@@ -67926,10 +68454,10 @@ function insertBeforeKeys(container, key2, value, before) {
|
|
|
67926
68454
|
if (!inserted) {
|
|
67927
68455
|
rebuilt[key2] = value;
|
|
67928
68456
|
}
|
|
67929
|
-
for (const existingKey of Object.keys(
|
|
67930
|
-
delete
|
|
68457
|
+
for (const existingKey of Object.keys(container2)) {
|
|
68458
|
+
delete container2[existingKey];
|
|
67931
68459
|
}
|
|
67932
|
-
Object.assign(
|
|
68460
|
+
Object.assign(container2, rebuilt);
|
|
67933
68461
|
}
|
|
67934
68462
|
var LEVEL_KEY_ORDER, SLDMASTER_BEFORE_TXSTYLES, TX_STYLES_CATEGORY_ORDER, PRESENTATION_BEFORE_DEFAULT_TEXT_STYLE;
|
|
67935
68463
|
var init_master_text_style_writer = __esm({
|
|
@@ -73956,8 +74484,8 @@ function asNode(value) {
|
|
|
73956
74484
|
}
|
|
73957
74485
|
function parseShapeLocksFromNode(shape, spec) {
|
|
73958
74486
|
const nv = asNode(shape?.[spec.nvKey]);
|
|
73959
|
-
const
|
|
73960
|
-
return parseShapeLockNode(asNode(
|
|
74487
|
+
const container2 = asNode(nv?.[spec.cNvKey]);
|
|
74488
|
+
return parseShapeLockNode(asNode(container2?.[spec.lockTag]), spec);
|
|
73961
74489
|
}
|
|
73962
74490
|
function resolveLockContainerNode(shape, spec, create) {
|
|
73963
74491
|
const nv = asNode(shape[spec.nvKey]);
|
|
@@ -76893,8 +77421,8 @@ function findCNvPr(shape) {
|
|
|
76893
77421
|
return void 0;
|
|
76894
77422
|
}
|
|
76895
77423
|
for (const key2 of NV_CONTAINERS) {
|
|
76896
|
-
const
|
|
76897
|
-
const cNvPr =
|
|
77424
|
+
const container2 = shape[key2];
|
|
77425
|
+
const cNvPr = container2?.["p:cNvPr"];
|
|
76898
77426
|
if (cNvPr) {
|
|
76899
77427
|
return cNvPr;
|
|
76900
77428
|
}
|
|
@@ -77140,8 +77668,8 @@ async function loadLegacyVmlDrawings(zip, parser, slidePath, relsPath2) {
|
|
|
77140
77668
|
continue;
|
|
77141
77669
|
}
|
|
77142
77670
|
const parsed = parser.parse(vmlXml);
|
|
77143
|
-
const
|
|
77144
|
-
const shapes = parseVmlElements(
|
|
77671
|
+
const container2 = parsed["xml"] ?? parsed;
|
|
77672
|
+
const shapes = parseVmlElements(container2, `vml-${drawingIndex}-`);
|
|
77145
77673
|
results.push(...shapes);
|
|
77146
77674
|
drawingIndex++;
|
|
77147
77675
|
}
|
|
@@ -80499,12 +81027,12 @@ function collectInteractiveSequences(node, found) {
|
|
|
80499
81027
|
);
|
|
80500
81028
|
}
|
|
80501
81029
|
containers.push(...ensureArray11(node["p:par"]), ...ensureArray11(node["p:seq"]));
|
|
80502
|
-
for (const
|
|
80503
|
-
if (isInteractiveSequence(
|
|
80504
|
-
found.push(
|
|
81030
|
+
for (const container2 of containers) {
|
|
81031
|
+
if (isInteractiveSequence(container2)) {
|
|
81032
|
+
found.push(container2);
|
|
80505
81033
|
continue;
|
|
80506
81034
|
}
|
|
80507
|
-
collectInteractiveSequences(
|
|
81035
|
+
collectInteractiveSequences(container2, found);
|
|
80508
81036
|
}
|
|
80509
81037
|
}
|
|
80510
81038
|
function parseInteractiveSequences(rootPar, animations, walk3) {
|
|
@@ -80605,16 +81133,16 @@ function collectMediaNodes(node, animations) {
|
|
|
80605
81133
|
const cTn = node["p:cTn"];
|
|
80606
81134
|
const childTnList = cTn?.["p:childTnLst"];
|
|
80607
81135
|
if (childTnList) {
|
|
80608
|
-
for (const
|
|
80609
|
-
const children15 = ensureArray11(childTnList[
|
|
81136
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
81137
|
+
const children15 = ensureArray11(childTnList[container2]);
|
|
80610
81138
|
for (const child27 of children15) {
|
|
80611
81139
|
collectMediaNodes(child27, animations);
|
|
80612
81140
|
}
|
|
80613
81141
|
}
|
|
80614
81142
|
collectMediaNodes(childTnList, animations);
|
|
80615
81143
|
}
|
|
80616
|
-
for (const
|
|
80617
|
-
const children15 = ensureArray11(node[
|
|
81144
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
81145
|
+
const children15 = ensureArray11(node[container2]);
|
|
80618
81146
|
for (const child27 of children15) {
|
|
80619
81147
|
collectMediaNodes(child27, animations);
|
|
80620
81148
|
}
|
|
@@ -101742,7 +102270,7 @@ var init_layout_switch_placeholder_prompts = __esm({
|
|
|
101742
102270
|
|
|
101743
102271
|
// src/pptx/core/core/types.ts
|
|
101744
102272
|
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = void 0; exports.MAX_ZIP_ENTRY_COUNT = void 0; exports.ZipBombError = void 0;
|
|
101745
|
-
var
|
|
102273
|
+
var init_types4 = __esm({
|
|
101746
102274
|
"src/pptx/core/core/types.ts"() {
|
|
101747
102275
|
exports.DEFAULT_MAX_UNCOMPRESSED_BYTES = 500 * 1024 * 1024;
|
|
101748
102276
|
exports.MAX_ZIP_ENTRY_COUNT = 65536;
|
|
@@ -102549,12 +103077,12 @@ function readCachedValues(refContainer, xmlLookup) {
|
|
|
102549
103077
|
}
|
|
102550
103078
|
return out;
|
|
102551
103079
|
}
|
|
102552
|
-
function readRefOrLiteral(
|
|
102553
|
-
const ref = xmlLookup.getChildByLocalName(
|
|
103080
|
+
function readRefOrLiteral(container2, xmlLookup) {
|
|
103081
|
+
const ref = xmlLookup.getChildByLocalName(container2, "strRef") ?? xmlLookup.getChildByLocalName(container2, "numRef");
|
|
102554
103082
|
if (ref) {
|
|
102555
103083
|
return readCachedValues(ref, xmlLookup);
|
|
102556
103084
|
}
|
|
102557
|
-
const literal2 = xmlLookup.getChildByLocalName(
|
|
103085
|
+
const literal2 = xmlLookup.getChildByLocalName(container2, "strLit") ?? xmlLookup.getChildByLocalName(container2, "numLit");
|
|
102558
103086
|
return literal2 ? readCachedValues({ "c:strCache": literal2 }, xmlLookup) : [];
|
|
102559
103087
|
}
|
|
102560
103088
|
function parseOneFilteredSeries(node, xmlLookup) {
|
|
@@ -102589,15 +103117,15 @@ function parseOneFilteredSeries(node, xmlLookup) {
|
|
|
102589
103117
|
}
|
|
102590
103118
|
return result;
|
|
102591
103119
|
}
|
|
102592
|
-
function findFilterExt(
|
|
102593
|
-
const extLst = xmlLookup.getChildByLocalName(
|
|
103120
|
+
function findFilterExt(container2, xmlLookup) {
|
|
103121
|
+
const extLst = xmlLookup.getChildByLocalName(container2, "extLst");
|
|
102594
103122
|
if (!extLst) {
|
|
102595
103123
|
return void 0;
|
|
102596
103124
|
}
|
|
102597
103125
|
return xmlLookup.getChildrenArrayByLocalName(extLst, "ext").find((ext) => ext["@_uri"] === CHART_FILTERED_SERIES_EXT_URI);
|
|
102598
103126
|
}
|
|
102599
|
-
function parseFilteredSeries(
|
|
102600
|
-
const ext = findFilterExt(
|
|
103127
|
+
function parseFilteredSeries(container2, xmlLookup) {
|
|
103128
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
102601
103129
|
if (!ext) {
|
|
102602
103130
|
return void 0;
|
|
102603
103131
|
}
|
|
@@ -102618,9 +103146,9 @@ function parseFilteredSeries(container, xmlLookup) {
|
|
|
102618
103146
|
}
|
|
102619
103147
|
return results.length > 0 ? results : void 0;
|
|
102620
103148
|
}
|
|
102621
|
-
function collectFilteredSeriesIndices(
|
|
103149
|
+
function collectFilteredSeriesIndices(container2, xmlLookup) {
|
|
102622
103150
|
const reserved = /* @__PURE__ */ new Set();
|
|
102623
|
-
for (const filtered of parseFilteredSeries(
|
|
103151
|
+
for (const filtered of parseFilteredSeries(container2, xmlLookup) ?? []) {
|
|
102624
103152
|
reserved.add(filtered.idx);
|
|
102625
103153
|
}
|
|
102626
103154
|
return reserved;
|
|
@@ -102665,8 +103193,8 @@ function readAxDataSource(cat, xmlLookup) {
|
|
|
102665
103193
|
const ref = xmlLookup.getChildByLocalName(cat, "strRef") ?? xmlLookup.getChildByLocalName(cat, "numRef");
|
|
102666
103194
|
return readCachedValues(ref, xmlLookup);
|
|
102667
103195
|
}
|
|
102668
|
-
function parseFilteredTitles(
|
|
102669
|
-
const ext = findFilterExt(
|
|
103196
|
+
function parseFilteredTitles(container2, xmlLookup) {
|
|
103197
|
+
const ext = findFilterExt(container2, xmlLookup);
|
|
102670
103198
|
if (!ext) {
|
|
102671
103199
|
return void 0;
|
|
102672
103200
|
}
|
|
@@ -103581,8 +104109,8 @@ var init_chart_protection2 = __esm({
|
|
|
103581
104109
|
});
|
|
103582
104110
|
|
|
103583
104111
|
// src/pptx/core/utils/chart-series-axis.ts
|
|
103584
|
-
function resolveChartContainerValueAxisId(
|
|
103585
|
-
const referencedIds2 = xmlLookup.getChildrenArrayByLocalName(
|
|
104112
|
+
function resolveChartContainerValueAxisId(container2, axes, xmlLookup) {
|
|
104113
|
+
const referencedIds2 = xmlLookup.getChildrenArrayByLocalName(container2, "axId").map((node) => Number.parseInt(String(node["@_val"]), 10)).filter(Number.isFinite);
|
|
103586
104114
|
for (let index = referencedIds2.length - 1; index >= 0; index--) {
|
|
103587
104115
|
const id = referencedIds2[index];
|
|
103588
104116
|
if (axes.some((axis) => axis.axisType === "valAx" && axis.axisId === id)) {
|
|
@@ -109135,10 +109663,10 @@ function buildOle10Native(label, sourcePath, data) {
|
|
|
109135
109663
|
return new ByteWriter().u32(body.length).bytes(body).toBytes();
|
|
109136
109664
|
}
|
|
109137
109665
|
function buildPackageStorage(label, sourcePath, data) {
|
|
109138
|
-
const
|
|
109139
|
-
|
|
109140
|
-
|
|
109141
|
-
return new Uint8Array(buildOle2(
|
|
109666
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
109667
|
+
streams2.set("CompObj", hexToBytes(COMP_OBJ_HEX));
|
|
109668
|
+
streams2.set("Ole10Native", buildOle10Native(label, sourcePath, data));
|
|
109669
|
+
return new Uint8Array(buildOle2(streams2, PACKAGE_ROOT_CLSID));
|
|
109142
109670
|
}
|
|
109143
109671
|
function buildExOleObjStg(storage) {
|
|
109144
109672
|
return record(RT.ExternalOleObjectStg, storage, 0, false, 0);
|
|
@@ -110025,8 +110553,8 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
|
|
|
110025
110553
|
const spgrData = new ByteWriter().bytes(buildCanvasPatriarch(allocator));
|
|
110026
110554
|
const background = backgroundRgb ? buildBackgroundShape(backgroundRgb, allocator) : void 0;
|
|
110027
110555
|
const prebuilt = prebuiltShapes?.(allocator) ?? [];
|
|
110028
|
-
for (const
|
|
110029
|
-
spgrData.bytes(
|
|
110556
|
+
for (const container2 of prebuilt) {
|
|
110557
|
+
spgrData.bytes(container2);
|
|
110030
110558
|
}
|
|
110031
110559
|
for (const shape of shapes) {
|
|
110032
110560
|
spgrData.bytes(buildAnyShapeContainer(shape, fonts, allocator, hyperlinks, oleEmbeds, mediaEmbeds));
|
|
@@ -110121,19 +110649,19 @@ function* iterateRecords(view, start, end) {
|
|
|
110121
110649
|
offset = rec.dataOffset + rec.recLen;
|
|
110122
110650
|
}
|
|
110123
110651
|
}
|
|
110124
|
-
function* iterateChildren(view,
|
|
110125
|
-
yield* iterateRecords(view,
|
|
110652
|
+
function* iterateChildren(view, container2) {
|
|
110653
|
+
yield* iterateRecords(view, container2.dataOffset, container2.dataOffset + container2.recLen);
|
|
110126
110654
|
}
|
|
110127
|
-
function findChild4(view,
|
|
110128
|
-
for (const child27 of iterateChildren(view,
|
|
110655
|
+
function findChild4(view, container2, recType, recInstance) {
|
|
110656
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110129
110657
|
if (child27.recType === recType && (recInstance === void 0 || child27.recInstance === recInstance)) {
|
|
110130
110658
|
return child27;
|
|
110131
110659
|
}
|
|
110132
110660
|
}
|
|
110133
110661
|
return void 0;
|
|
110134
110662
|
}
|
|
110135
|
-
function findDescendant(view,
|
|
110136
|
-
for (const child27 of iterateChildren(view,
|
|
110663
|
+
function findDescendant(view, container2, recType, recInstance) {
|
|
110664
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110137
110665
|
if (child27.recType === recType && (recInstance === void 0)) {
|
|
110138
110666
|
return child27;
|
|
110139
110667
|
}
|
|
@@ -110184,8 +110712,8 @@ function parseColorSchemeAtom(view, rec) {
|
|
|
110184
110712
|
}
|
|
110185
110713
|
return colors;
|
|
110186
110714
|
}
|
|
110187
|
-
function findSchemeColors(view,
|
|
110188
|
-
for (const child27 of iterateChildren(view,
|
|
110715
|
+
function findSchemeColors(view, container2) {
|
|
110716
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
110189
110717
|
if (child27.recType === RT.ColorSchemeAtom && child27.recInstance === 1) {
|
|
110190
110718
|
return parseColorSchemeAtom(view, child27);
|
|
110191
110719
|
}
|
|
@@ -110849,13 +111377,13 @@ async function buildPptFile(deck, options = {}) {
|
|
|
110849
111377
|
const encrypted = Boolean(options.password);
|
|
110850
111378
|
const finished = encrypted ? await finishEncrypted(layout, lastSlideId, options.password) : await finishUnencrypted(layout, lastSlideId);
|
|
110851
111379
|
const currentUser = buildCurrentUserStream(finished.offsetToCurrentEdit, encrypted);
|
|
110852
|
-
const
|
|
110853
|
-
|
|
110854
|
-
|
|
111380
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
111381
|
+
streams2.set("Current User", currentUser);
|
|
111382
|
+
streams2.set("PowerPoint Document", finished.documentBytes);
|
|
110855
111383
|
if (finished.picturesBytes && finished.picturesBytes.length > 0) {
|
|
110856
|
-
|
|
111384
|
+
streams2.set("Pictures", finished.picturesBytes);
|
|
110857
111385
|
}
|
|
110858
|
-
return new Uint8Array(buildOle2(
|
|
111386
|
+
return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
|
|
110859
111387
|
}
|
|
110860
111388
|
var init_write_ppt = __esm({
|
|
110861
111389
|
"node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
|
|
@@ -111754,20 +112282,20 @@ function buildRestoredRegionXml(region) {
|
|
|
111754
112282
|
}
|
|
111755
112283
|
function applyCommonSlideContainer(root, name, props) {
|
|
111756
112284
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
111757
|
-
const
|
|
111758
|
-
const commonKey = findViewKey(
|
|
111759
|
-
|
|
111760
|
-
root[key2] =
|
|
112285
|
+
const container2 = { ...root[key2] ?? {} };
|
|
112286
|
+
const commonKey = findViewKey(container2, "cSldViewPr") ?? "p:cSldViewPr";
|
|
112287
|
+
container2[commonKey] = buildCommonSlideView(props, viewChild(container2, "cSldViewPr"));
|
|
112288
|
+
root[key2] = container2;
|
|
111761
112289
|
}
|
|
111762
112290
|
function applyCommonViewContainer(root, name, props) {
|
|
111763
112291
|
const key2 = findViewKey(root, name) ?? `p:${name}`;
|
|
111764
|
-
const
|
|
111765
|
-
const commonKey = findViewKey(
|
|
112292
|
+
const container2 = { ...root[key2] ?? {} };
|
|
112293
|
+
const commonKey = findViewKey(container2, "cViewPr") ?? "p:cViewPr";
|
|
111766
112294
|
const wrapper = buildCommonSlideView(props, {
|
|
111767
|
-
"p:cViewPr": viewChild(
|
|
112295
|
+
"p:cViewPr": viewChild(container2, "cViewPr") ?? {}
|
|
111768
112296
|
});
|
|
111769
|
-
|
|
111770
|
-
root[key2] =
|
|
112297
|
+
container2[commonKey] = viewChild(wrapper, "cViewPr");
|
|
112298
|
+
root[key2] = container2;
|
|
111771
112299
|
}
|
|
111772
112300
|
var init_pptx_view_props_helpers = __esm({
|
|
111773
112301
|
"src/pptx/core/core/runtime/pptx-view-props-helpers.ts"() {
|
|
@@ -112090,22 +112618,22 @@ function ordered3(existing, modeled, getLocalName2) {
|
|
|
112090
112618
|
});
|
|
112091
112619
|
return Object.fromEntries(entries);
|
|
112092
112620
|
}
|
|
112093
|
-
function insertAfterLastSeries(
|
|
112094
|
-
const keys = Object.keys(
|
|
112621
|
+
function insertAfterLastSeries(container2, dLbls, getLocalName2) {
|
|
112622
|
+
const keys = Object.keys(container2);
|
|
112095
112623
|
let lastSer = -1;
|
|
112096
112624
|
keys.forEach((k, i2) => {
|
|
112097
112625
|
if (getLocalName2(k) === "ser") {
|
|
112098
112626
|
lastSer = i2;
|
|
112099
112627
|
}
|
|
112100
112628
|
});
|
|
112101
|
-
const entries = keys.map((k) => [k,
|
|
112629
|
+
const entries = keys.map((k) => [k, container2[k]]);
|
|
112102
112630
|
const at2 = lastSer === -1 ? entries.length : lastSer + 1;
|
|
112103
112631
|
entries.splice(at2, 0, ["c:dLbls", dLbls]);
|
|
112104
112632
|
for (const k of keys) {
|
|
112105
|
-
delete
|
|
112633
|
+
delete container2[k];
|
|
112106
112634
|
}
|
|
112107
112635
|
for (const [k, v] of entries) {
|
|
112108
|
-
|
|
112636
|
+
container2[k] = v;
|
|
112109
112637
|
}
|
|
112110
112638
|
}
|
|
112111
112639
|
function buildDLbls(existing, opts, getLocalName2) {
|
|
@@ -112142,25 +112670,25 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
112142
112670
|
}
|
|
112143
112671
|
const chartTypeKeys = Object.keys(plotArea).filter((k) => getLocalName2(k).endsWith("Chart"));
|
|
112144
112672
|
for (const ctKey of chartTypeKeys) {
|
|
112145
|
-
const
|
|
112146
|
-
if (!
|
|
112673
|
+
const container2 = plotArea[ctKey];
|
|
112674
|
+
if (!container2 || typeof container2 !== "object") {
|
|
112147
112675
|
continue;
|
|
112148
112676
|
}
|
|
112149
|
-
const existingKey = findKey16(
|
|
112677
|
+
const existingKey = findKey16(container2, "dLbls", getLocalName2);
|
|
112150
112678
|
if (style.hasDataLabels === false) {
|
|
112151
|
-
const existing2 = existingKey ?
|
|
112679
|
+
const existing2 = existingKey ? container2[existingKey] : void 0;
|
|
112152
112680
|
const off = ordered3(existing2, { "c:delete": { "@_val": "1" } }, getLocalName2);
|
|
112153
112681
|
if (existingKey) {
|
|
112154
|
-
|
|
112682
|
+
container2[existingKey] = off;
|
|
112155
112683
|
} else {
|
|
112156
|
-
insertAfterLastSeries(
|
|
112684
|
+
insertAfterLastSeries(container2, off, getLocalName2);
|
|
112157
112685
|
}
|
|
112158
112686
|
continue;
|
|
112159
112687
|
}
|
|
112160
112688
|
const opts = style.dataLabels ?? {};
|
|
112161
112689
|
const anyFlag = opts.showValue || opts.showCategory || opts.showSeriesName || opts.showPercent || opts.showLegendKey || opts.showBubbleSize;
|
|
112162
112690
|
const effective = anyFlag ? opts : { ...opts, showValue: true };
|
|
112163
|
-
const existing = existingKey ?
|
|
112691
|
+
const existing = existingKey ? container2[existingKey] : void 0;
|
|
112164
112692
|
const built = buildDLbls(existing, effective, getLocalName2);
|
|
112165
112693
|
applyDataLabelsRangeToDLbls(
|
|
112166
112694
|
built,
|
|
@@ -112169,9 +112697,9 @@ function applyChartDataLabelsToXml(plotArea, style, getLocalName2) {
|
|
|
112169
112697
|
getLocalName2
|
|
112170
112698
|
);
|
|
112171
112699
|
if (existingKey) {
|
|
112172
|
-
|
|
112700
|
+
container2[existingKey] = built;
|
|
112173
112701
|
} else {
|
|
112174
|
-
insertAfterLastSeries(
|
|
112702
|
+
insertAfterLastSeries(container2, built, getLocalName2);
|
|
112175
112703
|
}
|
|
112176
112704
|
}
|
|
112177
112705
|
}
|
|
@@ -113166,54 +113694,54 @@ function axisFormatting(chartData, type, id, index = 0) {
|
|
|
113166
113694
|
return chartData.axes?.find((axis) => axis.axisId === id) ?? chartData.axes?.filter((axis) => axis.axisType === type)[index];
|
|
113167
113695
|
}
|
|
113168
113696
|
function buildChartTypeContainer(chartData, family) {
|
|
113169
|
-
const
|
|
113697
|
+
const container2 = {};
|
|
113170
113698
|
if (family === "bar") {
|
|
113171
|
-
|
|
113172
|
-
|
|
113699
|
+
container2["c:barDir"] = { "@_val": chartData.barDirection === "bar" ? "bar" : "col" };
|
|
113700
|
+
container2["c:grouping"] = {
|
|
113173
113701
|
"@_val": chartData.groupingStandard && (chartData.grouping ?? "clustered") === "clustered" ? "standard" : chartData.grouping ?? "clustered"
|
|
113174
113702
|
};
|
|
113175
|
-
|
|
113703
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113176
113704
|
} else if (family === "line" || family === "area") {
|
|
113177
|
-
|
|
113178
|
-
|
|
113705
|
+
container2["c:grouping"] = { "@_val": chartData.grouping ?? "standard" };
|
|
113706
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113179
113707
|
} else if (family === "radar") {
|
|
113180
|
-
|
|
113181
|
-
|
|
113708
|
+
container2["c:radarStyle"] = { "@_val": chartData.radarStyle ?? "marker" };
|
|
113709
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113182
113710
|
} else if (family === "scatter") {
|
|
113183
|
-
|
|
113184
|
-
|
|
113711
|
+
container2["c:scatterStyle"] = { "@_val": "lineMarker" };
|
|
113712
|
+
container2["c:varyColors"] = { "@_val": "0" };
|
|
113185
113713
|
} else if (family === "ofPie") {
|
|
113186
|
-
|
|
113187
|
-
|
|
113714
|
+
container2["c:ofPieType"] = { "@_val": "pie" };
|
|
113715
|
+
container2["c:varyColors"] = { "@_val": "1" };
|
|
113188
113716
|
} else if (family === "stock") ; else if (family === "surface") {
|
|
113189
|
-
|
|
113717
|
+
container2["c:wireframe"] = { "@_val": chartData.wireframe === false ? "0" : "1" };
|
|
113190
113718
|
} else {
|
|
113191
|
-
|
|
113719
|
+
container2["c:varyColors"] = { "@_val": family === "bubble" ? "0" : "1" };
|
|
113192
113720
|
}
|
|
113193
|
-
|
|
113721
|
+
container2["c:ser"] = chartData.series.map(
|
|
113194
113722
|
(s, i2) => buildSeries(family, s, i2, chartData.categories, chartData.dateCategories)
|
|
113195
113723
|
);
|
|
113196
113724
|
if (family === "bubble" && chartData.bubbleOptions) {
|
|
113197
|
-
applyBubbleChartOptions(
|
|
113725
|
+
applyBubbleChartOptions(container2, chartData.bubbleOptions, (key2) => key2.replace(/^.*:/u, ""));
|
|
113198
113726
|
}
|
|
113199
113727
|
if (family === "line" && chartData.upDownBars !== void 0) {
|
|
113200
|
-
applyChartUpDownBars(
|
|
113728
|
+
applyChartUpDownBars(container2, chartData.upDownBars, (key2) => key2.replace(/^.*:/u, ""));
|
|
113201
113729
|
}
|
|
113202
113730
|
if (family === "bar" || family === "ofPie") {
|
|
113203
|
-
|
|
113731
|
+
container2["c:gapWidth"] = { "@_val": "150" };
|
|
113204
113732
|
}
|
|
113205
113733
|
if (family === "bar" && chartData.chartType === "bar3D" && chartData.barShape) {
|
|
113206
|
-
|
|
113734
|
+
container2["c:shape"] = { "@_val": chartData.barShape };
|
|
113207
113735
|
}
|
|
113208
113736
|
if (family === "stock") {
|
|
113209
|
-
|
|
113737
|
+
container2["c:hiLowLines"] = {};
|
|
113210
113738
|
}
|
|
113211
113739
|
if (family === "bar" || family === "line" || family === "area" || family === "radar" || family === "scatter" || family === "bubble" || family === "stock" || family === "surface") {
|
|
113212
|
-
|
|
113740
|
+
container2["c:axId"] = [{ "@_val": String(CAT_AX_ID) }, { "@_val": String(VAL_AX_ID) }];
|
|
113213
113741
|
} else if (family === "doughnut") {
|
|
113214
|
-
|
|
113742
|
+
container2["c:holeSize"] = { "@_val": "50" };
|
|
113215
113743
|
}
|
|
113216
|
-
return
|
|
113744
|
+
return container2;
|
|
113217
113745
|
}
|
|
113218
113746
|
function buildPlotArea(chartData, tag, family) {
|
|
113219
113747
|
const plotArea = { "c:layout": {} };
|
|
@@ -113567,8 +114095,8 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
113567
114095
|
continue;
|
|
113568
114096
|
}
|
|
113569
114097
|
const sourceData = codec.parse(sourceXml);
|
|
113570
|
-
const
|
|
113571
|
-
if (!
|
|
114098
|
+
const container2 = getContainer(sourceData, scope.location);
|
|
114099
|
+
if (!container2) {
|
|
113572
114100
|
continue;
|
|
113573
114101
|
}
|
|
113574
114102
|
const relsPath2 = relsForSourcePart(scope.sourcePartPath);
|
|
@@ -113603,9 +114131,9 @@ async function writeCustomerDataScopes(zip, scopes, codec) {
|
|
|
113603
114131
|
authoredEntries.push(rawEntry);
|
|
113604
114132
|
contentTypes2.set(path, entry.contentType);
|
|
113605
114133
|
}
|
|
113606
|
-
const existingList =
|
|
114134
|
+
const existingList = container2["p:custDataLst"] ?? {};
|
|
113607
114135
|
existingList["p:custData"] = authoredEntries;
|
|
113608
|
-
placeCustomerDataList(
|
|
114136
|
+
placeCustomerDataList(container2, existingList, scope.location);
|
|
113609
114137
|
relsRoot["Relationship"] = relationships2;
|
|
113610
114138
|
zip.file(relsPath2, codec.build(relsData));
|
|
113611
114139
|
zip.file(scope.sourcePartPath, codec.build(sourceData));
|
|
@@ -113655,11 +114183,11 @@ function upsertRelationship(relationships2, entry, target) {
|
|
|
113655
114183
|
function isCustomXmlRelationship(value) {
|
|
113656
114184
|
return String(value ?? "").endsWith("/relationships/customXml");
|
|
113657
114185
|
}
|
|
113658
|
-
function placeCustomerDataList(
|
|
114186
|
+
function placeCustomerDataList(container2, list2, location) {
|
|
113659
114187
|
const insertBefore3 = location === "presentation" ? /* @__PURE__ */ new Set(["p:kinsoku", "p:defaultTextStyle", "p:modifyVerifier", "p:extLst"]) : /* @__PURE__ */ new Set(["p:controls", "p:extLst"]);
|
|
113660
114188
|
const rebuilt = {};
|
|
113661
114189
|
let inserted = false;
|
|
113662
|
-
for (const [key2, value] of Object.entries(
|
|
114190
|
+
for (const [key2, value] of Object.entries(container2)) {
|
|
113663
114191
|
if (key2 === "p:custDataLst") {
|
|
113664
114192
|
continue;
|
|
113665
114193
|
}
|
|
@@ -113672,10 +114200,10 @@ function placeCustomerDataList(container, list2, location) {
|
|
|
113672
114200
|
if (!inserted) {
|
|
113673
114201
|
rebuilt["p:custDataLst"] = list2;
|
|
113674
114202
|
}
|
|
113675
|
-
for (const key2 of Object.keys(
|
|
113676
|
-
delete
|
|
114203
|
+
for (const key2 of Object.keys(container2)) {
|
|
114204
|
+
delete container2[key2];
|
|
113677
114205
|
}
|
|
113678
|
-
Object.assign(
|
|
114206
|
+
Object.assign(container2, rebuilt);
|
|
113679
114207
|
}
|
|
113680
114208
|
async function upsertContentTypes(zip, codec, contentTypes2) {
|
|
113681
114209
|
const xml = await zip.file("[Content_Types].xml")?.async("string");
|
|
@@ -113751,10 +114279,10 @@ function resolveTagsContainer(data) {
|
|
|
113751
114279
|
}
|
|
113752
114280
|
return void 0;
|
|
113753
114281
|
}
|
|
113754
|
-
function placeAtKey(
|
|
114282
|
+
function placeAtKey(container2, key2, value, insertBefore3) {
|
|
113755
114283
|
const rebuilt = {};
|
|
113756
114284
|
let inserted = false;
|
|
113757
|
-
for (const [childKey3, childValue] of Object.entries(
|
|
114285
|
+
for (const [childKey3, childValue] of Object.entries(container2)) {
|
|
113758
114286
|
if (childKey3 === key2) {
|
|
113759
114287
|
continue;
|
|
113760
114288
|
}
|
|
@@ -113767,10 +114295,10 @@ function placeAtKey(container, key2, value, insertBefore3) {
|
|
|
113767
114295
|
if (!inserted) {
|
|
113768
114296
|
rebuilt[key2] = value;
|
|
113769
114297
|
}
|
|
113770
|
-
for (const existingKey of Object.keys(
|
|
113771
|
-
delete
|
|
114298
|
+
for (const existingKey of Object.keys(container2)) {
|
|
114299
|
+
delete container2[existingKey];
|
|
113772
114300
|
}
|
|
113773
|
-
Object.assign(
|
|
114301
|
+
Object.assign(container2, rebuilt);
|
|
113774
114302
|
}
|
|
113775
114303
|
async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipId2) {
|
|
113776
114304
|
const xml = await zip.file(sourcePartPath)?.async("string");
|
|
@@ -113782,10 +114310,10 @@ async function upsertTagsOwningElement(zip, codec, sourcePartPath, relationshipI
|
|
|
113782
114310
|
if (!resolved) {
|
|
113783
114311
|
return;
|
|
113784
114312
|
}
|
|
113785
|
-
const { container, insertBefore: insertBefore3 } = resolved;
|
|
113786
|
-
const list2 = { ...
|
|
114313
|
+
const { container: container2, insertBefore: insertBefore3 } = resolved;
|
|
114314
|
+
const list2 = { ...container2["p:custDataLst"] ?? {} };
|
|
113787
114315
|
list2["p:tags"] = { "@_r:id": relationshipId2 };
|
|
113788
|
-
placeAtKey(
|
|
114316
|
+
placeAtKey(container2, "p:custDataLst", list2, insertBefore3);
|
|
113789
114317
|
zip.file(sourcePartPath, codec.build(data));
|
|
113790
114318
|
}
|
|
113791
114319
|
async function removeTagsOwningElement(zip, codec, sourcePartPath) {
|
|
@@ -114302,21 +114830,21 @@ function normalizeGroupingNode(containerLocal, node) {
|
|
|
114302
114830
|
node["@_val"] = normalizeChartGroupingValue(containerLocal, value);
|
|
114303
114831
|
}
|
|
114304
114832
|
}
|
|
114305
|
-
function normalizeChartContainerChildren(
|
|
114833
|
+
function normalizeChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
114306
114834
|
if (!isKnownChartContainer(containerLocal)) {
|
|
114307
114835
|
return;
|
|
114308
114836
|
}
|
|
114309
|
-
for (const key2 of Object.keys(
|
|
114837
|
+
for (const key2 of Object.keys(container2)) {
|
|
114310
114838
|
if (key2.startsWith("@_") || key2 === "#text") {
|
|
114311
114839
|
continue;
|
|
114312
114840
|
}
|
|
114313
114841
|
const local = getLocalName2(key2);
|
|
114314
114842
|
if (!chartContainerAllows(containerLocal, local)) {
|
|
114315
|
-
delete
|
|
114843
|
+
delete container2[key2];
|
|
114316
114844
|
continue;
|
|
114317
114845
|
}
|
|
114318
114846
|
if (local === "grouping") {
|
|
114319
|
-
const node =
|
|
114847
|
+
const node = container2[key2];
|
|
114320
114848
|
if (node && typeof node === "object" && !Array.isArray(node)) {
|
|
114321
114849
|
normalizeGroupingNode(containerLocal, node);
|
|
114322
114850
|
}
|
|
@@ -114324,18 +114852,18 @@ function normalizeChartContainerChildren(container, containerLocal, getLocalName
|
|
|
114324
114852
|
}
|
|
114325
114853
|
const required = REQUIRED_LEADING_CHILD[containerLocal];
|
|
114326
114854
|
if (required) {
|
|
114327
|
-
const present = Object.keys(
|
|
114855
|
+
const present = Object.keys(container2).some((k) => getLocalName2(k) === required.local);
|
|
114328
114856
|
if (!present) {
|
|
114329
|
-
|
|
114857
|
+
container2[`c:${required.local}`] = { "@_val": required.val };
|
|
114330
114858
|
}
|
|
114331
114859
|
}
|
|
114332
114860
|
}
|
|
114333
|
-
function orderChartContainerChildren(
|
|
114861
|
+
function orderChartContainerChildren(container2, containerLocal, getLocalName2) {
|
|
114334
114862
|
const order = CHART_CONTAINER_CHILD_ORDER[containerLocal];
|
|
114335
114863
|
if (!order) {
|
|
114336
114864
|
return;
|
|
114337
114865
|
}
|
|
114338
|
-
const keys = Object.keys(
|
|
114866
|
+
const keys = Object.keys(container2).filter((k) => !k.startsWith("@_") && k !== "#text");
|
|
114339
114867
|
if (keys.some((k) => !order.includes(getLocalName2(k)))) {
|
|
114340
114868
|
return;
|
|
114341
114869
|
}
|
|
@@ -114345,12 +114873,12 @@ function orderChartContainerChildren(container, containerLocal, getLocalName2) {
|
|
|
114345
114873
|
if (sorted.every((k, i2) => k === keys[i2])) {
|
|
114346
114874
|
return;
|
|
114347
114875
|
}
|
|
114348
|
-
const saved = sorted.map((k) => [k,
|
|
114876
|
+
const saved = sorted.map((k) => [k, container2[k]]);
|
|
114349
114877
|
for (const k of keys) {
|
|
114350
|
-
delete
|
|
114878
|
+
delete container2[k];
|
|
114351
114879
|
}
|
|
114352
114880
|
for (const [k, v] of saved) {
|
|
114353
|
-
|
|
114881
|
+
container2[k] = v;
|
|
114354
114882
|
}
|
|
114355
114883
|
}
|
|
114356
114884
|
function renameXmlKeyInPlace(obj, oldKey, newKey) {
|
|
@@ -114371,12 +114899,12 @@ function referencedAxisIds(plotArea, getLocalName2) {
|
|
|
114371
114899
|
if (!getLocalName2(key2).endsWith("Chart")) {
|
|
114372
114900
|
continue;
|
|
114373
114901
|
}
|
|
114374
|
-
for (const
|
|
114375
|
-
for (const childKey3 of Object.keys(
|
|
114902
|
+
for (const container2 of toArray2(plotArea[key2])) {
|
|
114903
|
+
for (const childKey3 of Object.keys(container2)) {
|
|
114376
114904
|
if (getLocalName2(childKey3) !== "axId") {
|
|
114377
114905
|
continue;
|
|
114378
114906
|
}
|
|
114379
|
-
for (const axId of toArray2(
|
|
114907
|
+
for (const axId of toArray2(container2[childKey3])) {
|
|
114380
114908
|
const val = axId["@_val"];
|
|
114381
114909
|
if (val !== void 0) {
|
|
114382
114910
|
ids.add(String(val));
|
|
@@ -114427,8 +114955,8 @@ var init_chart_container_schema = __esm({
|
|
|
114427
114955
|
function findKey22(obj, local, getLocalName2) {
|
|
114428
114956
|
return Object.keys(obj).find((k) => getLocalName2(k) === local);
|
|
114429
114957
|
}
|
|
114430
|
-
function nonSeriesEntries(
|
|
114431
|
-
return Object.keys(
|
|
114958
|
+
function nonSeriesEntries(container2, getLocalName2) {
|
|
114959
|
+
return Object.keys(container2).filter((k) => getLocalName2(k) !== "ser").map((k) => [k, container2[k]]);
|
|
114432
114960
|
}
|
|
114433
114961
|
function ensureArray18(v) {
|
|
114434
114962
|
if (v === void 0) {
|
|
@@ -114444,9 +114972,9 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
114444
114972
|
const primaryKey = containerKeys[0];
|
|
114445
114973
|
const containerChildren = /* @__PURE__ */ new Map();
|
|
114446
114974
|
for (const key2 of containerKeys) {
|
|
114447
|
-
const
|
|
114448
|
-
if (
|
|
114449
|
-
containerChildren.set(getLocalName2(key2), nonSeriesEntries(
|
|
114975
|
+
const container2 = plotArea[key2];
|
|
114976
|
+
if (container2) {
|
|
114977
|
+
containerChildren.set(getLocalName2(key2), nonSeriesEntries(container2, getLocalName2));
|
|
114450
114978
|
}
|
|
114451
114979
|
}
|
|
114452
114980
|
if (containerKeys.length === 1) {
|
|
@@ -114459,13 +114987,13 @@ function consolidateComboContainersInXml(plotArea, getLocalName2) {
|
|
|
114459
114987
|
const serKey = findKey22(primary, "ser", getLocalName2) ?? "c:ser";
|
|
114460
114988
|
const allSeries = [];
|
|
114461
114989
|
for (const key2 of containerKeys) {
|
|
114462
|
-
const
|
|
114463
|
-
if (!
|
|
114990
|
+
const container2 = plotArea[key2];
|
|
114991
|
+
if (!container2) {
|
|
114464
114992
|
continue;
|
|
114465
114993
|
}
|
|
114466
|
-
const containerSerKey = findKey22(
|
|
114994
|
+
const containerSerKey = findKey22(container2, "ser", getLocalName2);
|
|
114467
114995
|
if (containerSerKey) {
|
|
114468
|
-
allSeries.push(...ensureArray18(
|
|
114996
|
+
allSeries.push(...ensureArray18(container2[containerSerKey]));
|
|
114469
114997
|
}
|
|
114470
114998
|
if (key2 !== primaryKey) {
|
|
114471
114999
|
delete plotArea[key2];
|
|
@@ -114512,21 +115040,21 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
114512
115040
|
const at2 = keys.indexOf(originalKey);
|
|
114513
115041
|
const newEntries = [];
|
|
114514
115042
|
for (const local of groupOrder) {
|
|
114515
|
-
const
|
|
115043
|
+
const container2 = {};
|
|
114516
115044
|
for (const [k, v] of originalChildren?.get(local) ?? fallbackEntries) {
|
|
114517
|
-
|
|
115045
|
+
container2[k] = JSON.parse(JSON.stringify(v));
|
|
114518
115046
|
}
|
|
114519
115047
|
const grouped = groups.get(local);
|
|
114520
|
-
|
|
115048
|
+
container2[serKey] = grouped.length === 1 ? grouped[0] : grouped;
|
|
114521
115049
|
applyGroupAxisReferences(
|
|
114522
|
-
|
|
115050
|
+
container2,
|
|
114523
115051
|
series.filter((_item, index) => resolved[index] === local),
|
|
114524
115052
|
axes,
|
|
114525
115053
|
getLocalName2
|
|
114526
115054
|
);
|
|
114527
|
-
normalizeChartContainerChildren(
|
|
114528
|
-
orderChartContainerChildren(
|
|
114529
|
-
newEntries.push([`c:${local}`,
|
|
115055
|
+
normalizeChartContainerChildren(container2, local, getLocalName2);
|
|
115056
|
+
orderChartContainerChildren(container2, local, getLocalName2);
|
|
115057
|
+
newEntries.push([`c:${local}`, container2]);
|
|
114530
115058
|
}
|
|
114531
115059
|
entries.splice(at2, 1, ...newEntries);
|
|
114532
115060
|
for (const k of keys) {
|
|
@@ -114537,7 +115065,7 @@ function applyComboSeriesTypesToXml(plotArea, originalKey, series, chartLevelTyp
|
|
|
114537
115065
|
}
|
|
114538
115066
|
return true;
|
|
114539
115067
|
}
|
|
114540
|
-
function applyGroupAxisReferences(
|
|
115068
|
+
function applyGroupAxisReferences(container2, series, axes, getLocalName2) {
|
|
114541
115069
|
const axisIds = new Set(series.map((item) => item.axisId).filter((id) => id !== void 0));
|
|
114542
115070
|
if (axisIds.size !== 1) {
|
|
114543
115071
|
return;
|
|
@@ -114548,8 +115076,8 @@ function applyGroupAxisReferences(container, series, axes, getLocalName2) {
|
|
|
114548
115076
|
if (valueAxisId === void 0 || categoryAxisId === void 0) {
|
|
114549
115077
|
return;
|
|
114550
115078
|
}
|
|
114551
|
-
const key2 = findKey22(
|
|
114552
|
-
|
|
115079
|
+
const key2 = findKey22(container2, "axId", getLocalName2) ?? "c:axId";
|
|
115080
|
+
container2[key2] = [{ "@_val": String(categoryAxisId) }, { "@_val": String(valueAxisId) }];
|
|
114553
115081
|
}
|
|
114554
115082
|
var init_chart_combo_serializer = __esm({
|
|
114555
115083
|
"src/pptx/core/utils/chart-combo-serializer.ts"() {
|
|
@@ -114602,8 +115130,8 @@ function buildFilteredSerNode(entry, categories) {
|
|
|
114602
115130
|
}
|
|
114603
115131
|
return node;
|
|
114604
115132
|
}
|
|
114605
|
-
function filteredSeriesUnchanged(
|
|
114606
|
-
const existing = parseFilteredSeries(
|
|
115133
|
+
function filteredSeriesUnchanged(container2, filteredSeries, xmlLookup) {
|
|
115134
|
+
const existing = parseFilteredSeries(container2, xmlLookup);
|
|
114607
115135
|
if (!filteredSeries || filteredSeries.length === 0) {
|
|
114608
115136
|
return !existing || existing.length === 0;
|
|
114609
115137
|
}
|
|
@@ -114615,9 +115143,9 @@ function filteredSeriesUnchanged(container, filteredSeries, xmlLookup) {
|
|
|
114615
115143
|
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);
|
|
114616
115144
|
});
|
|
114617
115145
|
}
|
|
114618
|
-
function applyFilteredSeriesToXml(
|
|
114619
|
-
const extLstKey = findKey23(
|
|
114620
|
-
const extLst = { ...
|
|
115146
|
+
function applyFilteredSeriesToXml(container2, filteredSeries, categories, containerLocalName, getLocalName2) {
|
|
115147
|
+
const extLstKey = findKey23(container2, "extLst", getLocalName2) ?? "c:extLst";
|
|
115148
|
+
const extLst = { ...container2[extLstKey] ?? {} };
|
|
114621
115149
|
const extKey = findKey23(extLst, "ext", getLocalName2);
|
|
114622
115150
|
const exts = extKey ? Array.isArray(extLst[extKey]) ? [...extLst[extKey]] : [extLst[extKey]] : [];
|
|
114623
115151
|
const otherExts = exts.filter((ext) => ext["@_uri"] !== CHART_FILTERED_SERIES_EXT_URI);
|
|
@@ -114642,11 +115170,11 @@ function applyFilteredSeriesToXml(container, filteredSeries, categories, contain
|
|
|
114642
115170
|
);
|
|
114643
115171
|
const newExts = ownExtHasContent ? [...otherExts, ownExt] : otherExts;
|
|
114644
115172
|
if (newExts.length === 0) {
|
|
114645
|
-
delete
|
|
115173
|
+
delete container2[extLstKey];
|
|
114646
115174
|
return;
|
|
114647
115175
|
}
|
|
114648
115176
|
extLst[extKey ?? "c:ext"] = newExts.length === 1 ? newExts[0] : newExts;
|
|
114649
|
-
|
|
115177
|
+
container2[extLstKey] = extLst;
|
|
114650
115178
|
}
|
|
114651
115179
|
var init_chart_filtered_series_writer = __esm({
|
|
114652
115180
|
"src/pptx/core/utils/chart-filtered-series-writer.ts"() {
|
|
@@ -115448,11 +115976,11 @@ var init_chart_title_style_serializer = __esm({
|
|
|
115448
115976
|
};
|
|
115449
115977
|
}
|
|
115450
115978
|
});
|
|
115451
|
-
function collectChartWorkbookWrite(xmlLookupService,
|
|
115452
|
-
if (!
|
|
115979
|
+
function collectChartWorkbookWrite(xmlLookupService, container2, isNumeric, values) {
|
|
115980
|
+
if (!container2) {
|
|
115453
115981
|
return void 0;
|
|
115454
115982
|
}
|
|
115455
|
-
const refNode = xmlLookupService.getChildByLocalName(
|
|
115983
|
+
const refNode = xmlLookupService.getChildByLocalName(container2, isNumeric ? "numRef" : "strRef");
|
|
115456
115984
|
const formula = refNode ? xmlLookupService.getScalarChildByLocalName(refNode, "f") : void 0;
|
|
115457
115985
|
return formula ? { formula, isNumeric, values } : void 0;
|
|
115458
115986
|
}
|
|
@@ -116215,12 +116743,12 @@ function applyPicAltText(node, altText) {
|
|
|
116215
116743
|
}
|
|
116216
116744
|
function applyChildXfrmToRawNode(node, off, ext) {
|
|
116217
116745
|
const spPrKey = findChildKey2(node, "spPr");
|
|
116218
|
-
const
|
|
116219
|
-
const xfrmKey = findChildKey2(
|
|
116746
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
116747
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
116220
116748
|
if (!xfrmKey) {
|
|
116221
116749
|
return;
|
|
116222
116750
|
}
|
|
116223
|
-
const xfrm =
|
|
116751
|
+
const xfrm = container2[xfrmKey];
|
|
116224
116752
|
const offKey = findChildKey2(xfrm, "off") ?? "a:off";
|
|
116225
116753
|
const extKey = findChildKey2(xfrm, "ext") ?? "a:ext";
|
|
116226
116754
|
xfrm[offKey] = { "@_x": String(Math.round(off.x)), "@_y": String(Math.round(off.y)) };
|
|
@@ -116228,13 +116756,13 @@ function applyChildXfrmToRawNode(node, off, ext) {
|
|
|
116228
116756
|
}
|
|
116229
116757
|
function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
116230
116758
|
const spPrKey = findChildKey2(node, "spPr");
|
|
116231
|
-
const
|
|
116232
|
-
const xfrmKey = findChildKey2(
|
|
116759
|
+
const container2 = spPrKey ? node[spPrKey] ?? node : node;
|
|
116760
|
+
const xfrmKey = findChildKey2(container2, "xfrm");
|
|
116233
116761
|
const hasAny = Boolean(rotation) || Boolean(flipH) || Boolean(flipV);
|
|
116234
116762
|
if (!xfrmKey && !hasAny) {
|
|
116235
116763
|
return;
|
|
116236
116764
|
}
|
|
116237
|
-
const xfrm = xfrmKey ?
|
|
116765
|
+
const xfrm = xfrmKey ? container2[xfrmKey] : {};
|
|
116238
116766
|
if (rotation) {
|
|
116239
116767
|
xfrm["@_rot"] = String(Math.round(rotation * 6e4));
|
|
116240
116768
|
} else {
|
|
@@ -116250,9 +116778,9 @@ function applyRotationFlipToRawNode(node, rotation, flipH, flipV) {
|
|
|
116250
116778
|
} else {
|
|
116251
116779
|
delete xfrm["@_flipV"];
|
|
116252
116780
|
}
|
|
116253
|
-
|
|
116781
|
+
container2[xfrmKey ?? "a:xfrm"] = xfrm;
|
|
116254
116782
|
if (spPrKey) {
|
|
116255
|
-
node[spPrKey] =
|
|
116783
|
+
node[spPrKey] = container2;
|
|
116256
116784
|
}
|
|
116257
116785
|
}
|
|
116258
116786
|
var init_chart_user_shapes_raw_patch = __esm({
|
|
@@ -116602,8 +117130,8 @@ var init_placeholder_remap = __esm({
|
|
|
116602
117130
|
|
|
116603
117131
|
// src/pptx/core/utils/placeholder-xml.ts
|
|
116604
117132
|
function findNonVisualProps(rawXml) {
|
|
116605
|
-
for (const
|
|
116606
|
-
const parent = rawXml[
|
|
117133
|
+
for (const container2 of ["p:nvSpPr", "p:nvPicPr", "p:nvGraphicFramePr"]) {
|
|
117134
|
+
const parent = rawXml[container2];
|
|
116607
117135
|
const nvPr = parent?.["p:nvPr"];
|
|
116608
117136
|
if (nvPr) {
|
|
116609
117137
|
return nvPr;
|
|
@@ -120430,9 +120958,9 @@ var init_PptxHandlerRuntimeElementActions = __esm({
|
|
|
120430
120958
|
}
|
|
120431
120959
|
return;
|
|
120432
120960
|
}
|
|
120433
|
-
const
|
|
120434
|
-
if (
|
|
120435
|
-
|
|
120961
|
+
const container2 = existing ?? resolveLockContainerNode(shape, spec, true);
|
|
120962
|
+
if (container2) {
|
|
120963
|
+
container2[spec.lockTag] = next;
|
|
120436
120964
|
}
|
|
120437
120965
|
}
|
|
120438
120966
|
};
|
|
@@ -120939,8 +121467,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
120939
121467
|
if (cTn) {
|
|
120940
121468
|
const childTnLst = cTn["p:childTnLst"];
|
|
120941
121469
|
if (childTnLst) {
|
|
120942
|
-
for (const
|
|
120943
|
-
const children15 = this.ensureArray(childTnLst[
|
|
121470
|
+
for (const container2 of ["p:par", "p:seq", "p:excl"]) {
|
|
121471
|
+
const children15 = this.ensureArray(childTnLst[container2]);
|
|
120944
121472
|
for (const child27 of children15) {
|
|
120945
121473
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
120946
121474
|
}
|
|
@@ -120948,8 +121476,8 @@ var init_PptxHandlerRuntimeMediaTimingParsing = __esm({
|
|
|
120948
121476
|
this.walkMediaTimingTree(childTnLst, result, slidePath);
|
|
120949
121477
|
}
|
|
120950
121478
|
}
|
|
120951
|
-
for (const
|
|
120952
|
-
const children15 = this.ensureArray(node[
|
|
121479
|
+
for (const container2 of ["p:par", "p:seq", "p:excl", "p:tnLst"]) {
|
|
121480
|
+
const children15 = this.ensureArray(node[container2]);
|
|
120953
121481
|
for (const child27 of children15) {
|
|
120954
121482
|
this.walkMediaTimingTree(child27, result, slidePath);
|
|
120955
121483
|
}
|
|
@@ -122114,8 +122642,8 @@ var init_PptxHandlerRuntimePresentationProps = __esm({
|
|
|
122114
122642
|
* `<a:noFill/>` parses to the empty STRING, so presence - not truthiness -
|
|
122115
122643
|
* has to decide.
|
|
122116
122644
|
*/
|
|
122117
|
-
parseChartContainerFill(
|
|
122118
|
-
const shapeProperties = this.xmlLookupService.getChildByLocalName(
|
|
122645
|
+
parseChartContainerFill(container2) {
|
|
122646
|
+
const shapeProperties = this.xmlLookupService.getChildByLocalName(container2, "spPr");
|
|
122119
122647
|
if (!shapeProperties) {
|
|
122120
122648
|
return void 0;
|
|
122121
122649
|
}
|
|
@@ -128552,10 +129080,10 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128552
129080
|
if (!local.endsWith("Chart")) {
|
|
128553
129081
|
continue;
|
|
128554
129082
|
}
|
|
128555
|
-
const
|
|
128556
|
-
if (
|
|
129083
|
+
const container2 = plotArea[key2];
|
|
129084
|
+
if (container2) {
|
|
128557
129085
|
orderChartContainerChildren(
|
|
128558
|
-
|
|
129086
|
+
container2,
|
|
128559
129087
|
local,
|
|
128560
129088
|
(k) => this.compatibilityService.getXmlLocalName(k)
|
|
128561
129089
|
);
|
|
@@ -128634,8 +129162,8 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128634
129162
|
* when the container has no formula reference (e.g. a brand-new series
|
|
128635
129163
|
* built without one), so it is always safe to call.
|
|
128636
129164
|
*/
|
|
128637
|
-
pushChartWorkbookWrite(workbookWrites,
|
|
128638
|
-
const write = collectChartWorkbookWrite(this.xmlLookupService,
|
|
129165
|
+
pushChartWorkbookWrite(workbookWrites, container2, isNumeric, values) {
|
|
129166
|
+
const write = collectChartWorkbookWrite(this.xmlLookupService, container2, isNumeric, values);
|
|
128639
129167
|
if (write) {
|
|
128640
129168
|
workbookWrites.push(write);
|
|
128641
129169
|
}
|
|
@@ -128644,17 +129172,17 @@ var init_PptxHandlerRuntimeSaveDataSerialization = __esm({
|
|
|
128644
129172
|
* Update the cached point values in a chart reference node
|
|
128645
129173
|
* (numRef/strRef or numLit/strLit).
|
|
128646
129174
|
*/
|
|
128647
|
-
updateChartCacheValues(
|
|
129175
|
+
updateChartCacheValues(container2, isNumeric, values) {
|
|
128648
129176
|
const refName = isNumeric ? "numRef" : "strRef";
|
|
128649
129177
|
const litName = isNumeric ? "numLit" : "strLit";
|
|
128650
129178
|
const cacheName = isNumeric ? "numCache" : "strCache";
|
|
128651
|
-
const refNode = this.xmlLookupService.getChildByLocalName(
|
|
129179
|
+
const refNode = this.xmlLookupService.getChildByLocalName(container2, refName) || this.xmlLookupService.getChildByLocalName(container2, litName);
|
|
128652
129180
|
if (!refNode) {
|
|
128653
|
-
const literalKey = Object.keys(
|
|
129181
|
+
const literalKey = Object.keys(container2).find(
|
|
128654
129182
|
(key2) => this.compatibilityService.getXmlLocalName(key2) === "v"
|
|
128655
129183
|
);
|
|
128656
129184
|
if (literalKey && values.length === 1) {
|
|
128657
|
-
|
|
129185
|
+
container2[literalKey] = values[0];
|
|
128658
129186
|
}
|
|
128659
129187
|
return;
|
|
128660
129188
|
}
|
|
@@ -135906,9 +136434,9 @@ function rememberTemplateSpTreePositions(runtime, partPath, spTree, positionOf)
|
|
|
135906
136434
|
}
|
|
135907
136435
|
byPart.set(partPath, positions);
|
|
135908
136436
|
}
|
|
135909
|
-
function withReplacedChild(
|
|
135910
|
-
const existing =
|
|
135911
|
-
const next = { ...
|
|
136437
|
+
function withReplacedChild(container2, tag, indexInType, replacement) {
|
|
136438
|
+
const existing = container2[tag];
|
|
136439
|
+
const next = { ...container2 };
|
|
135912
136440
|
if (Array.isArray(existing)) {
|
|
135913
136441
|
const siblings = [...existing];
|
|
135914
136442
|
siblings[indexInType] = replacement;
|
|
@@ -135918,8 +136446,8 @@ function withReplacedChild(container, tag, indexInType, replacement) {
|
|
|
135918
136446
|
}
|
|
135919
136447
|
return next;
|
|
135920
136448
|
}
|
|
135921
|
-
function orderContainer(
|
|
135922
|
-
let working =
|
|
136449
|
+
function orderContainer(container2, plan, getLocalName2) {
|
|
136450
|
+
let working = container2;
|
|
135923
136451
|
for (const entry of plan) {
|
|
135924
136452
|
if (entry.children.length === 0) {
|
|
135925
136453
|
continue;
|
|
@@ -140135,8 +140663,8 @@ function asRuns(value) {
|
|
|
140135
140663
|
function withSplit(authored, inherited) {
|
|
140136
140664
|
return { ...inherited, ...authored, authoredRunStyle: authored, inheritedRunStyle: inherited };
|
|
140137
140665
|
}
|
|
140138
|
-
function readRuns(
|
|
140139
|
-
const runs = asRuns(
|
|
140666
|
+
function readRuns(container2, extract) {
|
|
140667
|
+
const runs = asRuns(container2?.["a:r"]);
|
|
140140
140668
|
const text2 = runs.map((run) => run["a:t"] !== void 0 ? xmlText(run["a:t"]) ?? "" : "").join("");
|
|
140141
140669
|
const first = runs[0];
|
|
140142
140670
|
return {
|
|
@@ -141633,8 +142161,8 @@ var init_PptxHandlerRuntimeSpTreeParsing = __esm({
|
|
|
141633
142161
|
* so the save layer can re-emit the original `<mc:Choice>` /
|
|
141634
142162
|
* `<mc:Fallback>` shape on dirty save (CC-4).
|
|
141635
142163
|
*/
|
|
141636
|
-
unwrapAlternateContent(
|
|
141637
|
-
const blocks = unwrapAlternateContent(
|
|
142164
|
+
unwrapAlternateContent(container2) {
|
|
142165
|
+
const blocks = unwrapAlternateContent(container2);
|
|
141638
142166
|
for (const block of blocks) {
|
|
141639
142167
|
for (const ref of block.childRefs) {
|
|
141640
142168
|
this.alternateContentBlockByRawXml.set(ref.node, block);
|
|
@@ -146719,17 +147247,17 @@ var init_PptxHandlerRuntimeSmartArtParsing = __esm({
|
|
|
146719
147247
|
// src/pptx/core/core/runtime/smartart-drawing-blip.ts
|
|
146720
147248
|
function collectDrawingShapeNodes(root, getChildren) {
|
|
146721
147249
|
const out = [];
|
|
146722
|
-
const walk3 = (
|
|
146723
|
-
if (!
|
|
147250
|
+
const walk3 = (container2) => {
|
|
147251
|
+
if (!container2) {
|
|
146724
147252
|
return;
|
|
146725
147253
|
}
|
|
146726
|
-
for (const sp of getChildren(
|
|
147254
|
+
for (const sp of getChildren(container2, "sp")) {
|
|
146727
147255
|
out.push({ node: sp, isPic: false });
|
|
146728
147256
|
}
|
|
146729
|
-
for (const pic of getChildren(
|
|
147257
|
+
for (const pic of getChildren(container2, "pic")) {
|
|
146730
147258
|
out.push({ node: pic, isPic: true });
|
|
146731
147259
|
}
|
|
146732
|
-
for (const grp of getChildren(
|
|
147260
|
+
for (const grp of getChildren(container2, "grpSp")) {
|
|
146733
147261
|
walk3(grp);
|
|
146734
147262
|
}
|
|
146735
147263
|
};
|
|
@@ -148238,13 +148766,13 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148238
148766
|
let filteredSeriesTitle;
|
|
148239
148767
|
let filteredCategoryTitle;
|
|
148240
148768
|
for (const containerKey of containerKeys) {
|
|
148241
|
-
const
|
|
148242
|
-
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(
|
|
148243
|
-
const containerFilteredSeries = parseFilteredSeries(
|
|
148769
|
+
const container2 = plotArea[containerKey];
|
|
148770
|
+
const seriesList = this.xmlLookupService.getChildrenArrayByLocalName(container2, "ser");
|
|
148771
|
+
const containerFilteredSeries = parseFilteredSeries(container2, this.xmlLookupService);
|
|
148244
148772
|
if (containerFilteredSeries) {
|
|
148245
148773
|
filteredSeries = [...filteredSeries ?? [], ...containerFilteredSeries];
|
|
148246
148774
|
}
|
|
148247
|
-
const containerFilteredTitles = parseFilteredTitles(
|
|
148775
|
+
const containerFilteredTitles = parseFilteredTitles(container2, this.xmlLookupService);
|
|
148248
148776
|
if (containerFilteredTitles?.seriesTitle && filteredSeriesTitle === void 0) {
|
|
148249
148777
|
filteredSeriesTitle = containerFilteredTitles.seriesTitle;
|
|
148250
148778
|
}
|
|
@@ -148271,7 +148799,7 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148271
148799
|
this.compatibilityService.getXmlLocalName(containerKey)
|
|
148272
148800
|
);
|
|
148273
148801
|
const containerType = isCombo ? resolvedContainerType : void 0;
|
|
148274
|
-
const axisId = resolveChartContainerValueAxisId(
|
|
148802
|
+
const axisId = resolveChartContainerValueAxisId(container2, axes ?? [], this.xmlLookupService);
|
|
148275
148803
|
series.push(
|
|
148276
148804
|
...this.buildChartSeries(
|
|
148277
148805
|
seriesList,
|
|
@@ -148309,8 +148837,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148309
148837
|
* Read a numeric `@val` from a named child of a chart-type container.
|
|
148310
148838
|
* Returns `undefined` when the child or its `@val` is absent/non-finite.
|
|
148311
148839
|
*/
|
|
148312
|
-
parseChartNumberVal(
|
|
148313
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
148840
|
+
parseChartNumberVal(container2, localName29) {
|
|
148841
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName29);
|
|
148314
148842
|
const raw = node?.["@_val"];
|
|
148315
148843
|
if (raw === void 0 || raw === null || raw === "") {
|
|
148316
148844
|
return void 0;
|
|
@@ -148323,8 +148851,8 @@ var init_PptxHandlerRuntimeChartParsing = __esm({
|
|
|
148323
148851
|
* A present element with no `@val` follows the OOXML `CT_Boolean` default
|
|
148324
148852
|
* of `true`; `undefined` when the child is absent.
|
|
148325
148853
|
*/
|
|
148326
|
-
parseChartBoolVal(
|
|
148327
|
-
const node = this.xmlLookupService.getChildByLocalName(
|
|
148854
|
+
parseChartBoolVal(container2, localName29) {
|
|
148855
|
+
const node = this.xmlLookupService.getChildByLocalName(container2, localName29);
|
|
148328
148856
|
if (!node) {
|
|
148329
148857
|
return void 0;
|
|
148330
148858
|
}
|
|
@@ -148994,7 +149522,7 @@ var init_PptxHandlerRuntimeLoadSession = __esm({
|
|
|
148994
149522
|
init_ole_embedded_extract();
|
|
148995
149523
|
init_ole_utils();
|
|
148996
149524
|
init_signature_detection();
|
|
148997
|
-
|
|
149525
|
+
init_types4();
|
|
148998
149526
|
init_authored_slide_background();
|
|
148999
149527
|
init_bullet_picture_image_enrichment();
|
|
149000
149528
|
init_PptxHandlerRuntimeEmbeddedFonts();
|
|
@@ -150165,7 +150693,7 @@ var init_core = __esm({
|
|
|
150165
150693
|
init_PptxHandlerRuntime();
|
|
150166
150694
|
init_builders();
|
|
150167
150695
|
init_factories();
|
|
150168
|
-
|
|
150696
|
+
init_types4();
|
|
150169
150697
|
init_table_structural_ops();
|
|
150170
150698
|
init_table_style_defaults();
|
|
150171
150699
|
init_auto_number_sequence();
|
|
@@ -150573,14 +151101,14 @@ var init_text_atoms = __esm({
|
|
|
150573
151101
|
function readCString(view, rec) {
|
|
150574
151102
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
150575
151103
|
}
|
|
150576
|
-
function parseExHyperlinkContainer(view,
|
|
150577
|
-
const atom2 = findChild4(view,
|
|
151104
|
+
function parseExHyperlinkContainer(view, container2) {
|
|
151105
|
+
const atom2 = findChild4(view, container2, RT.ExternalHyperlinkAtom);
|
|
150578
151106
|
if (!atom2 || atom2.recLen < 4) {
|
|
150579
151107
|
return void 0;
|
|
150580
151108
|
}
|
|
150581
151109
|
const id = view.getUint32(atom2.dataOffset, true);
|
|
150582
151110
|
const strings2 = {};
|
|
150583
|
-
for (const child27 of iterateChildren(view,
|
|
151111
|
+
for (const child27 of iterateChildren(view, container2)) {
|
|
150584
151112
|
if (child27.recType !== RT.CString) {
|
|
150585
151113
|
continue;
|
|
150586
151114
|
}
|
|
@@ -150840,14 +151368,14 @@ var init_persist_directory2 = __esm({
|
|
|
150840
151368
|
function readCString2(view, rec) {
|
|
150841
151369
|
return decodeTextChars(view, rec.dataOffset, rec.recLen);
|
|
150842
151370
|
}
|
|
150843
|
-
function parseOleEmbedContainer(view,
|
|
150844
|
-
const atom2 = findChild4(view,
|
|
151371
|
+
function parseOleEmbedContainer(view, container2) {
|
|
151372
|
+
const atom2 = findChild4(view, container2, RT.ExternalOleObjectAtom);
|
|
150845
151373
|
if (!atom2 || atom2.recLen < 24) {
|
|
150846
151374
|
return void 0;
|
|
150847
151375
|
}
|
|
150848
151376
|
const exObjId = view.getUint32(atom2.dataOffset + 8, true);
|
|
150849
151377
|
const persistIdRef = view.getUint32(atom2.dataOffset + 16, true);
|
|
150850
|
-
const progIdRec = findChild4(view,
|
|
151378
|
+
const progIdRec = findChild4(view, container2, RT.CString, 2);
|
|
150851
151379
|
const progId = progIdRec ? readCString2(view, progIdRec) : void 0;
|
|
150852
151380
|
return { exObjId, ref: { persistIdRef, progId } };
|
|
150853
151381
|
}
|
|
@@ -151509,7 +152037,7 @@ function arrowType(value) {
|
|
|
151509
152037
|
return ARROW_MAP[value] ?? "triangle";
|
|
151510
152038
|
}
|
|
151511
152039
|
var OPT2, DASH_MAP, ARROW_MAP;
|
|
151512
|
-
var
|
|
152040
|
+
var init_properties2 = __esm({
|
|
151513
152041
|
"src/pptx/core/ppt/escher/properties.ts"() {
|
|
151514
152042
|
OPT2 = {
|
|
151515
152043
|
rotation: 4,
|
|
@@ -151668,14 +152196,14 @@ var init_shape_props = __esm({
|
|
|
151668
152196
|
init_color_scheme2();
|
|
151669
152197
|
init_record_types2();
|
|
151670
152198
|
init_geometry_map();
|
|
151671
|
-
|
|
152199
|
+
init_properties2();
|
|
151672
152200
|
GRADIENT_FILL_TYPES = /* @__PURE__ */ new Set([4, 5, 6, 7, 8]);
|
|
151673
152201
|
}
|
|
151674
152202
|
});
|
|
151675
152203
|
|
|
151676
152204
|
// src/pptx/core/ppt/escher/sp-container.ts
|
|
151677
|
-
function parseShape2(ctx,
|
|
151678
|
-
const fsp = findChild4(ctx.view,
|
|
152205
|
+
function parseShape2(ctx, container2) {
|
|
152206
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
151679
152207
|
if (!fsp || fsp.recLen < 8) {
|
|
151680
152208
|
return void 0;
|
|
151681
152209
|
}
|
|
@@ -151684,10 +152212,10 @@ function parseShape2(ctx, container) {
|
|
|
151684
152212
|
if (flags & FSP_FLAG_DELETED) {
|
|
151685
152213
|
return void 0;
|
|
151686
152214
|
}
|
|
151687
|
-
const optRec = findChild4(ctx.view,
|
|
152215
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
151688
152216
|
const props = optRec ? parseProperties(ctx.view, ctx.data, optRec) : { values: /* @__PURE__ */ new Map(), complex: /* @__PURE__ */ new Map() };
|
|
151689
|
-
const anchorRec = findChild4(ctx.view,
|
|
151690
|
-
const childAnchorRec = findChild4(ctx.view,
|
|
152217
|
+
const anchorRec = findChild4(ctx.view, container2, OA.ClientAnchor);
|
|
152218
|
+
const childAnchorRec = findChild4(ctx.view, container2, OA.ChildAnchor);
|
|
151691
152219
|
const anchor = anchorRec ? readClientAnchor(ctx.view, anchorRec) : childAnchorRec ? readChildAnchor(ctx.view, childAnchorRec) : void 0;
|
|
151692
152220
|
const namePayload = props.complex.get(OPT2.wzName);
|
|
151693
152221
|
const name = namePayload ? decodeComplexString(namePayload) : void 0;
|
|
@@ -151695,7 +152223,7 @@ function parseShape2(ctx, container) {
|
|
|
151695
152223
|
const rotationDeg = rotationRaw !== void 0 ? rotationToDegrees(rotationRaw) : void 0;
|
|
151696
152224
|
const flipH = (flags & FSP_FLAG_FLIPH2) !== 0 ? true : void 0;
|
|
151697
152225
|
const flipV = (flags & FSP_FLAG_FLIPV2) !== 0 ? true : void 0;
|
|
151698
|
-
const clientData = findChild4(ctx.view,
|
|
152226
|
+
const clientData = findChild4(ctx.view, container2, OA.ClientData);
|
|
151699
152227
|
const actionClick = clientData ? resolveShapeInteractiveInfo(ctx.view, clientData, ctx.hyperlinkStrings) : void 0;
|
|
151700
152228
|
const pib = props.values.get(OPT2.pib);
|
|
151701
152229
|
if (pib !== void 0 && pib > 0) {
|
|
@@ -151749,7 +152277,7 @@ function parseShape2(ctx, container) {
|
|
|
151749
152277
|
shape.placeholderType = placeholderType;
|
|
151750
152278
|
}
|
|
151751
152279
|
}
|
|
151752
|
-
const clientTextbox2 = findChild4(ctx.view,
|
|
152280
|
+
const clientTextbox2 = findChild4(ctx.view, container2, OA.ClientTextbox);
|
|
151753
152281
|
if (clientTextbox2) {
|
|
151754
152282
|
const text2 = extractText(ctx, clientTextbox2);
|
|
151755
152283
|
if (text2 && text2.paragraphs.some((p) => p.runs.length > 0)) {
|
|
@@ -151761,11 +152289,11 @@ function parseShape2(ctx, container) {
|
|
|
151761
152289
|
}
|
|
151762
152290
|
return shape;
|
|
151763
152291
|
}
|
|
151764
|
-
function parseGroup(ctx,
|
|
152292
|
+
function parseGroup(ctx, container2) {
|
|
151765
152293
|
const children15 = [];
|
|
151766
152294
|
let groupShape;
|
|
151767
152295
|
let first = true;
|
|
151768
|
-
for (const child27 of iterateChildren(ctx.view,
|
|
152296
|
+
for (const child27 of iterateChildren(ctx.view, container2)) {
|
|
151769
152297
|
if (child27.recType === OA.SpContainer && first) {
|
|
151770
152298
|
groupShape = child27;
|
|
151771
152299
|
first = false;
|
|
@@ -151835,8 +152363,8 @@ function parseDrawing(ctx, dgContainer) {
|
|
|
151835
152363
|
}
|
|
151836
152364
|
return result;
|
|
151837
152365
|
}
|
|
151838
|
-
function extractBackground(ctx,
|
|
151839
|
-
const fsp = findChild4(ctx.view,
|
|
152366
|
+
function extractBackground(ctx, container2) {
|
|
152367
|
+
const fsp = findChild4(ctx.view, container2, OA.FSP);
|
|
151840
152368
|
if (!fsp || fsp.recLen < 8) {
|
|
151841
152369
|
return void 0;
|
|
151842
152370
|
}
|
|
@@ -151844,7 +152372,7 @@ function extractBackground(ctx, container) {
|
|
|
151844
152372
|
if ((flags & FSP_FLAG_BACKGROUND2) === 0 || (flags & FSP_FLAG_GROUP2) !== 0) {
|
|
151845
152373
|
return void 0;
|
|
151846
152374
|
}
|
|
151847
|
-
const optRec = findChild4(ctx.view,
|
|
152375
|
+
const optRec = findChild4(ctx.view, container2, OA.FOPT);
|
|
151848
152376
|
if (!optRec) {
|
|
151849
152377
|
return ctx.scheme[0];
|
|
151850
152378
|
}
|
|
@@ -151861,7 +152389,7 @@ var init_sp_container = __esm({
|
|
|
151861
152389
|
init_record_types2();
|
|
151862
152390
|
init_client_data_extract();
|
|
151863
152391
|
init_geometry_map();
|
|
151864
|
-
|
|
152392
|
+
init_properties2();
|
|
151865
152393
|
init_shape_props();
|
|
151866
152394
|
FSP_FLAG_GROUP2 = 1;
|
|
151867
152395
|
FSP_FLAG_DELETED = 8;
|
|
@@ -151872,22 +152400,22 @@ var init_sp_container = __esm({
|
|
|
151872
152400
|
});
|
|
151873
152401
|
|
|
151874
152402
|
// src/pptx/core/ppt/slide-parser.ts
|
|
151875
|
-
function parseSlideContainer(inputs,
|
|
152403
|
+
function parseSlideContainer(inputs, container2) {
|
|
151876
152404
|
const { view, data, fonts } = inputs;
|
|
151877
152405
|
let followMasterBackground = true;
|
|
151878
152406
|
let followMasterScheme = true;
|
|
151879
152407
|
let followMasterObjects = true;
|
|
151880
|
-
const slideAtom = findChild4(view,
|
|
152408
|
+
const slideAtom = findChild4(view, container2, RT.SlideAtom);
|
|
151881
152409
|
if (slideAtom && slideAtom.recLen >= 24) {
|
|
151882
152410
|
const flags = view.getUint16(slideAtom.dataOffset + 20, true);
|
|
151883
152411
|
followMasterObjects = (flags & SLIDE_FLAG_MASTER_OBJECTS2) !== 0;
|
|
151884
152412
|
followMasterScheme = (flags & SLIDE_FLAG_MASTER_SCHEME2) !== 0;
|
|
151885
152413
|
followMasterBackground = (flags & SLIDE_FLAG_MASTER_BACKGROUND2) !== 0;
|
|
151886
152414
|
}
|
|
151887
|
-
const ownScheme = findSchemeColors(view,
|
|
152415
|
+
const ownScheme = findSchemeColors(view, container2);
|
|
151888
152416
|
const scheme = followMasterScheme ? inputs.masterScheme : ownScheme ?? inputs.masterScheme;
|
|
151889
152417
|
const slide = { followMasterBackground, followMasterObjects, shapes: [] };
|
|
151890
|
-
const drawing = findChild4(view,
|
|
152418
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
151891
152419
|
if (drawing) {
|
|
151892
152420
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
151893
152421
|
if (dgContainer) {
|
|
@@ -151910,12 +152438,12 @@ function parseSlideContainer(inputs, container) {
|
|
|
151910
152438
|
}
|
|
151911
152439
|
return slide;
|
|
151912
152440
|
}
|
|
151913
|
-
function parseMasterContainer(view, data, fonts, fallbackScheme,
|
|
151914
|
-
const scheme = findSchemeColors(view,
|
|
152441
|
+
function parseMasterContainer(view, data, fonts, fallbackScheme, container2, hyperlinkStrings, oleExObjIds) {
|
|
152442
|
+
const scheme = findSchemeColors(view, container2);
|
|
151915
152443
|
const active = scheme ?? fallbackScheme;
|
|
151916
152444
|
let backgroundRgb;
|
|
151917
152445
|
let shapes = [];
|
|
151918
|
-
const drawing = findChild4(view,
|
|
152446
|
+
const drawing = findChild4(view, container2, RT.Drawing);
|
|
151919
152447
|
if (drawing) {
|
|
151920
152448
|
const dgContainer = findDescendant(view, drawing, OA.DgContainer);
|
|
151921
152449
|
if (dgContainer) {
|
|
@@ -151935,7 +152463,7 @@ function parseMasterContainer(view, data, fonts, fallbackScheme, container, hype
|
|
|
151935
152463
|
);
|
|
151936
152464
|
}
|
|
151937
152465
|
}
|
|
151938
|
-
return { scheme, backgroundRgb, shapes, container };
|
|
152466
|
+
return { scheme, backgroundRgb, shapes, container: container2 };
|
|
151939
152467
|
}
|
|
151940
152468
|
var SLIDE_FLAG_MASTER_OBJECTS2, SLIDE_FLAG_MASTER_SCHEME2, SLIDE_FLAG_MASTER_BACKGROUND2;
|
|
151941
152469
|
var init_slide_parser = __esm({
|
|
@@ -152086,11 +152614,11 @@ function findBStore(view, docContainer) {
|
|
|
152086
152614
|
}
|
|
152087
152615
|
return findDescendant(view, drawingGroup, OA.BStoreContainer);
|
|
152088
152616
|
}
|
|
152089
|
-
async function parseDeck(
|
|
152090
|
-
const data =
|
|
152617
|
+
async function parseDeck(streams2) {
|
|
152618
|
+
const data = streams2.powerPointDocument;
|
|
152091
152619
|
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
152092
|
-
const { currentEdit, directory } = buildPersistDirectory(view,
|
|
152093
|
-
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !
|
|
152620
|
+
const { currentEdit, directory } = buildPersistDirectory(view, streams2.offsetToCurrentEdit);
|
|
152621
|
+
if (currentEdit.encryptSessionPersistIdRef !== void 0 && currentEdit.encryptSessionPersistIdRef !== 0 && !streams2.decrypted) {
|
|
152094
152622
|
throw new exports.EncryptedPptError();
|
|
152095
152623
|
}
|
|
152096
152624
|
const docOffset = directory.get(currentEdit.docPersistIdRef);
|
|
@@ -152177,7 +152705,7 @@ async function parseDeck(streams) {
|
|
|
152177
152705
|
}
|
|
152178
152706
|
const bstoreRec = findBStore(view, docContainer);
|
|
152179
152707
|
const pictures = await parsePictures(
|
|
152180
|
-
|
|
152708
|
+
streams2.pictures,
|
|
152181
152709
|
bstoreRec ? { view, rec: bstoreRec } : void 0
|
|
152182
152710
|
);
|
|
152183
152711
|
const usedExObjIds = /* @__PURE__ */ new Set();
|
|
@@ -152226,6 +152754,20 @@ var init_document_parser = __esm({
|
|
|
152226
152754
|
}
|
|
152227
152755
|
});
|
|
152228
152756
|
|
|
152757
|
+
// src/pptx/core/utils/ooxml-crypto-errors.ts
|
|
152758
|
+
var init_ooxml_crypto_errors = __esm({
|
|
152759
|
+
"src/pptx/core/utils/ooxml-crypto-errors.ts"() {
|
|
152760
|
+
init_errors();
|
|
152761
|
+
}
|
|
152762
|
+
});
|
|
152763
|
+
|
|
152764
|
+
// src/pptx/core/utils/ooxml-crypto-key-derivation.ts
|
|
152765
|
+
var init_ooxml_crypto_key_derivation = __esm({
|
|
152766
|
+
"src/pptx/core/utils/ooxml-crypto-key-derivation.ts"() {
|
|
152767
|
+
init_encryption_info();
|
|
152768
|
+
}
|
|
152769
|
+
});
|
|
152770
|
+
|
|
152229
152771
|
// src/pptx/core/ppt/rc4-cryptoapi-key.ts
|
|
152230
152772
|
var init_rc4_cryptoapi_key2 = __esm({
|
|
152231
152773
|
"src/pptx/core/ppt/rc4-cryptoapi-key.ts"() {
|
|
@@ -156414,9 +156956,9 @@ var MASTER_XMLNS = 'xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/ma
|
|
|
156414
156956
|
var FALLBACK_CLR_MAP = '<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>';
|
|
156415
156957
|
var FALLBACK_TX_STYLES = '<p:txStyles><p:titleStyle><a:lvl1pPr algn="l"><a:defRPr sz="4400" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mj-lt"/></a:defRPr></a:lvl1pPr></p:titleStyle><p:bodyStyle><a:lvl1pPr algn="l"><a:defRPr sz="3200" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/></a:defRPr></a:lvl1pPr></p:bodyStyle><p:otherStyle><a:defPPr><a:defRPr lang="en-US"/></a:defPPr></p:otherStyle></p:txStyles>';
|
|
156416
156958
|
function extractTag(xml, tag) {
|
|
156417
|
-
const
|
|
156418
|
-
if (
|
|
156419
|
-
return
|
|
156959
|
+
const container2 = xml.match(new RegExp(`<${tag}(?:\\s[^>]*)?>[^]*?</${tag}>`));
|
|
156960
|
+
if (container2) {
|
|
156961
|
+
return container2[0];
|
|
156420
156962
|
}
|
|
156421
156963
|
const selfClosed = xml.match(new RegExp(`<${tag}(?:\\s[^>]*)?/>`));
|
|
156422
156964
|
return selfClosed ? selfClosed[0] : "";
|
|
@@ -170499,12 +171041,12 @@ var SlideProcessor = class {
|
|
|
170499
171041
|
if (positionedCells.length === 0) {
|
|
170500
171042
|
return [];
|
|
170501
171043
|
}
|
|
170502
|
-
const
|
|
171044
|
+
const container2 = [
|
|
170503
171045
|
`<div style="position:relative;width:${displayW}px;height:${displayH}px;border:1px solid #e5e7eb;overflow:hidden;margin:0.5em 0">`,
|
|
170504
171046
|
...positionedCells,
|
|
170505
171047
|
"</div>"
|
|
170506
171048
|
].join("\n");
|
|
170507
|
-
return [
|
|
171049
|
+
return [container2];
|
|
170508
171050
|
}
|
|
170509
171051
|
/** Sorts elements into natural reading order (top-to-bottom, left-to-right). */
|
|
170510
171052
|
sortElementsByReadingOrder(elements2) {
|