ooxml-core 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PptxHandler-G63S6YZU.mjs → PptxHandler-75LOVF7I.mjs} +2 -2
- package/dist/automation/index.cjs +2559 -1169
- package/dist/automation/index.mjs +2559 -1169
- package/dist/chart/gradient-definition.d.ts +2 -2
- package/dist/chart/gradient-definition.d.ts.map +1 -1
- package/dist/chart/index.cjs +7 -7
- package/dist/chart/index.mjs +7 -7
- package/dist/{chunk-BICQYRPW.mjs → chunk-75LA7H3F.mjs} +1339 -1435
- package/dist/{chunk-CKJSWE7N.mjs → chunk-LA7D6ZYQ.mjs} +244 -115
- package/dist/{chunk-ROM5MZ7O.mjs → chunk-OMGH6IKY.mjs} +3 -3
- package/dist/{chunk-RWXFQJVF.mjs → chunk-Q27H4HFS.mjs} +1 -1
- package/dist/{chunk-DDG5HTGX.mjs → chunk-RFX7AJDZ.mjs} +1 -1
- package/dist/crypto/index.cjs +1406 -184
- package/dist/crypto/index.mjs +1406 -184
- package/dist/diagram/dom.d.ts +1 -14
- package/dist/diagram/dom.d.ts.map +1 -1
- package/dist/diagram/index.cjs +15 -15
- package/dist/diagram/index.d.ts +12 -12
- package/dist/diagram/index.d.ts.map +1 -1
- package/dist/diagram/index.mjs +15 -15
- package/dist/diagram/types.d.ts +12 -148
- package/dist/diagram/types.d.ts.map +1 -1
- package/dist/digest/algorithm-names.d.ts +2 -2
- package/dist/digest/algorithm-names.d.ts.map +1 -1
- package/dist/digest/bit-ops.d.ts +30 -0
- package/dist/digest/bit-ops.d.ts.map +1 -0
- package/dist/digest/digest.d.ts +2 -2
- package/dist/digest/digest.d.ts.map +1 -1
- package/dist/digest/index.cjs +1319 -90
- package/dist/digest/index.d.ts +7 -1
- package/dist/digest/index.d.ts.map +1 -1
- package/dist/digest/index.mjs +1313 -91
- package/dist/digest/md2.d.ts +22 -0
- package/dist/digest/md2.d.ts.map +1 -0
- package/dist/digest/md4.d.ts +3 -0
- package/dist/digest/md4.d.ts.map +1 -0
- package/dist/digest/md5.d.ts +3 -0
- package/dist/digest/md5.d.ts.map +1 -0
- package/dist/digest/password-hash.d.ts +7 -0
- package/dist/digest/password-hash.d.ts.map +1 -1
- package/dist/digest/ripemd-functions.d.ts +18 -0
- package/dist/digest/ripemd-functions.d.ts.map +1 -0
- package/dist/digest/ripemd128.d.ts +3 -0
- package/dist/digest/ripemd128.d.ts.map +1 -0
- package/dist/digest/ripemd160.d.ts +3 -0
- package/dist/digest/ripemd160.d.ts.map +1 -0
- package/dist/digest/whirlpool-sbox.d.ts +15 -0
- package/dist/digest/whirlpool-sbox.d.ts.map +1 -0
- package/dist/digest/whirlpool-table.d.ts +12 -0
- package/dist/digest/whirlpool-table.d.ts.map +1 -0
- package/dist/digest/whirlpool.d.ts +3 -0
- package/dist/digest/whirlpool.d.ts.map +1 -0
- package/dist/docx/block-parser.d.ts.map +1 -1
- package/dist/docx/diagram-theme.d.ts +3 -3
- package/dist/docx/diagram-theme.d.ts.map +1 -1
- package/dist/docx/embedded.cjs +470 -276
- package/dist/docx/embedded.mjs +470 -276
- package/dist/docx/field-flags.d.ts +8 -0
- package/dist/docx/field-flags.d.ts.map +1 -0
- package/dist/docx/field-lock.d.ts +6 -0
- package/dist/docx/field-lock.d.ts.map +1 -0
- package/dist/docx/field-runs.d.ts +4 -1
- package/dist/docx/field-runs.d.ts.map +1 -1
- package/dist/docx/index.cjs +1029 -850
- package/dist/docx/index.d.ts +2 -0
- package/dist/docx/index.d.ts.map +1 -1
- package/dist/docx/index.mjs +1027 -850
- package/dist/docx/layout/adapter.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +61 -47
- package/dist/docx/layout/index.mjs +61 -47
- package/dist/docx/layout/page-fields.d.ts.map +1 -1
- package/dist/docx/load/index.cjs +1883 -467
- package/dist/docx/load/index.mjs +1883 -467
- package/dist/docx/model-run.d.ts +5 -0
- package/dist/docx/model-run.d.ts.map +1 -1
- package/dist/docx/numbering-model.d.ts +1 -1
- package/dist/docx/numbering-model.d.ts.map +1 -1
- package/dist/docx/numbering-package.d.ts +4 -4
- package/dist/docx/numbering-package.d.ts.map +1 -1
- package/dist/docx/numbering-start-edit.d.ts +8 -0
- package/dist/docx/numbering-start-edit.d.ts.map +1 -0
- package/dist/docx/numbering-start-patch.d.ts +13 -0
- package/dist/docx/numbering-start-patch.d.ts.map +1 -0
- package/dist/docx/theme-color.d.ts.map +1 -1
- package/dist/docx/theme-model.d.ts +3 -2
- package/dist/docx/theme-model.d.ts.map +1 -1
- package/dist/docx/theme.d.ts +5 -1
- package/dist/docx/theme.d.ts.map +1 -1
- package/dist/docx/ui/field-guard.d.ts +2 -0
- package/dist/docx/ui/field-guard.d.ts.map +1 -1
- package/dist/docx/ui/field-results.d.ts.map +1 -1
- package/dist/docx/ui/index.cjs +547 -375
- package/dist/docx/ui/index.mjs +547 -376
- package/dist/docx/ui/review-commands.d.ts.map +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts +1 -1
- package/dist/docx/ui/run-extra-mark.d.ts.map +1 -1
- package/dist/docx/ui/simple-field-input.d.ts +3 -0
- package/dist/docx/ui/simple-field-input.d.ts.map +1 -1
- package/dist/docx/ui/track-changes-mode.d.ts.map +1 -1
- package/dist/docx/ui/track-paragraph-boundaries.d.ts +5 -0
- package/dist/docx/ui/track-paragraph-boundaries.d.ts.map +1 -0
- package/dist/docx/write-inline.d.ts.map +1 -1
- package/dist/docx/write-run.d.ts.map +1 -1
- package/dist/drawingml/dom.d.ts +15 -0
- package/dist/drawingml/dom.d.ts.map +1 -0
- package/dist/drawingml/drawing-color-brightness.d.ts +6 -0
- package/dist/drawingml/drawing-color-brightness.d.ts.map +1 -0
- package/dist/drawingml/drawing-color-css.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/drawing-color.d.ts +5 -5
- package/dist/drawingml/drawing-color.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/drawing-fill.d.ts +3 -3
- package/dist/drawingml/drawing-fill.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/drawing-geometry.d.ts +4 -4
- package/dist/drawingml/drawing-geometry.d.ts.map +1 -0
- package/dist/drawingml/drawing-shadow.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/drawing-text.d.ts +2 -2
- package/dist/drawingml/drawing-text.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/gradient-geometry.d.ts +2 -2
- package/dist/drawingml/gradient-geometry.d.ts.map +1 -0
- package/dist/drawingml/gradient-preset-data.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/gradient-presets.d.ts +3 -3
- package/dist/drawingml/gradient-presets.d.ts.map +1 -0
- package/dist/drawingml/index.cjs +1545 -0
- package/dist/drawingml/index.d.ts +19 -0
- package/dist/drawingml/index.d.ts.map +1 -0
- package/dist/drawingml/index.mjs +1497 -0
- package/dist/{diagram → drawingml}/ordered-color-transforms.d.ts +2 -2
- package/dist/drawingml/ordered-color-transforms.d.ts.map +1 -0
- package/dist/drawingml/rect-path-gradient.d.ts.map +1 -0
- package/dist/drawingml/theme-color.d.ts +19 -0
- package/dist/drawingml/theme-color.d.ts.map +1 -0
- package/dist/drawingml/theme-model.d.ts +40 -0
- package/dist/drawingml/theme-model.d.ts.map +1 -0
- package/dist/drawingml/theme.d.ts +21 -0
- package/dist/drawingml/theme.d.ts.map +1 -0
- package/dist/drawingml/types.d.ts +152 -0
- package/dist/drawingml/types.d.ts.map +1 -0
- package/dist/drawingml/write-color.d.ts +4 -0
- package/dist/drawingml/write-color.d.ts.map +1 -0
- package/dist/{diagram → drawingml}/write-fill.d.ts +2 -2
- package/dist/drawingml/write-fill.d.ts.map +1 -0
- package/dist/geometry/connector-elbow-geometry.d.ts +14 -0
- package/dist/geometry/connector-elbow-geometry.d.ts.map +1 -1
- package/dist/geometry/index.cjs +43 -0
- package/dist/geometry/index.mjs +42 -1
- package/dist/i18n/dictionary.d.ts +13 -0
- package/dist/i18n/dictionary.d.ts.map +1 -0
- package/dist/i18n/index.cjs +68 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.mjs +60 -0
- package/dist/i18n/locale.d.ts +17 -0
- package/dist/i18n/locale.d.ts.map +1 -0
- package/dist/i18n/translator.d.ts +18 -0
- package/dist/i18n/translator.d.ts.map +1 -0
- package/dist/index.cjs +3712 -2178
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3711 -2179
- package/dist/pptx/automation/index.cjs +2852 -1568
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-C4mfzVoY.d.ts → index-BHqL5KXH.d.ts} +2 -2
- package/dist/pptx/chunks/{index-C4mfzVoY.d.ts.map → index-BHqL5KXH.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-lk7dyOPS.d.ts → index-BYkdcS8J.d.ts} +12 -16
- package/dist/pptx/chunks/index-BYkdcS8J.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-CO2jmJFf.d.ts.map +1 -1
- package/dist/pptx/chunks/{text-operations-CDLx4hD5.d.ts → text-operations-DEJ7alZR.d.ts} +2 -2
- package/dist/pptx/chunks/text-operations-DEJ7alZR.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +2680 -1396
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/index.cjs +1771 -1756
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/teams/index.cjs +144 -74
- package/dist/teams/index.mjs +144 -74
- package/dist/visio/ui/index.cjs +14 -3
- package/dist/visio/ui/index.mjs +14 -3
- package/dist/visio/ui/shape-rotation.d.ts +1 -1
- package/dist/visio/ui/shape-rotation.d.ts.map +1 -1
- package/dist/xlsx/edit/chart-series-gradient.d.ts +1 -1
- package/dist/xlsx/edit/chart-series-gradient.d.ts.map +1 -1
- package/dist/xlsx/edit/protection.d.ts +1 -1
- package/dist/xlsx/index.cjs +3222 -1886
- package/dist/xlsx/index.mjs +3222 -1886
- package/dist/xlsx/layout/chart-appearance.d.ts +1 -1
- package/dist/xlsx/layout/chart-appearance.d.ts.map +1 -1
- package/dist/xlsx/layout/chart-scale.d.ts +5 -1
- package/dist/xlsx/layout/chart-scale.d.ts.map +1 -1
- package/dist/xlsx/layout/chart-svg-legend.d.ts +13 -0
- package/dist/xlsx/layout/chart-svg-legend.d.ts.map +1 -0
- package/dist/xlsx/layout/chart-svg.d.ts.map +1 -1
- package/dist/xlsx/layout/chart-view.d.ts +3 -1
- package/dist/xlsx/layout/chart-view.d.ts.map +1 -1
- package/dist/xlsx/load/index.cjs +2110 -838
- package/dist/xlsx/load/index.mjs +2110 -838
- package/dist/xlsx/read/theme.d.ts +2 -4
- package/dist/xlsx/read/theme.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +2017 -771
- package/dist/xlsx/ui/index.mjs +2017 -771
- package/dist/xlsx/ui/locales/merge.d.ts +2 -1
- package/dist/xlsx/ui/locales/merge.d.ts.map +1 -1
- package/dist/xlsx/ui/localization.d.ts.map +1 -1
- package/dist/xlsx/write/theme.d.ts.map +1 -1
- package/package.json +11 -1
- package/dist/diagram/drawing-color-brightness.d.ts +0 -6
- package/dist/diagram/drawing-color-brightness.d.ts.map +0 -1
- package/dist/diagram/drawing-color-css.d.ts.map +0 -1
- package/dist/diagram/drawing-color.d.ts.map +0 -1
- package/dist/diagram/drawing-fill.d.ts.map +0 -1
- package/dist/diagram/drawing-geometry.d.ts.map +0 -1
- package/dist/diagram/drawing-shadow.d.ts.map +0 -1
- package/dist/diagram/drawing-text.d.ts.map +0 -1
- package/dist/diagram/gradient-geometry.d.ts.map +0 -1
- package/dist/diagram/gradient-preset-data.d.ts.map +0 -1
- package/dist/diagram/gradient-presets.d.ts.map +0 -1
- package/dist/diagram/ordered-color-transforms.d.ts.map +0 -1
- package/dist/diagram/rect-path-gradient.d.ts.map +0 -1
- package/dist/diagram/write-color.d.ts +0 -4
- package/dist/diagram/write-color.d.ts.map +0 -1
- package/dist/diagram/write-fill.d.ts.map +0 -1
- package/dist/pptx/chunks/index-lk7dyOPS.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-CDLx4hD5.d.ts.map +0 -1
- /package/dist/{diagram → drawingml}/drawing-color-css.d.ts +0 -0
- /package/dist/{diagram → drawingml}/drawing-shadow.d.ts +0 -0
- /package/dist/{diagram → drawingml}/gradient-preset-data.d.ts +0 -0
- /package/dist/{diagram → drawingml}/rect-path-gradient.d.ts +0 -0
package/dist/pptx/index.cjs
CHANGED
|
@@ -26808,9 +26808,9 @@ function renderOleDocumentPreviewPng(paragraphs) {
|
|
|
26808
26808
|
if (y > PREVIEW_HEIGHT - lineHeight) {
|
|
26809
26809
|
break;
|
|
26810
26810
|
}
|
|
26811
|
-
const
|
|
26811
|
+
const words2 = paragraph.split(/\s+/u).filter((w) => w.length > 0);
|
|
26812
26812
|
let line2 = "";
|
|
26813
|
-
for (const word of
|
|
26813
|
+
for (const word of words2) {
|
|
26814
26814
|
const candidate = line2.length > 0 ? `${line2} ${word}` : word;
|
|
26815
26815
|
if (candidate.length > maxCharsPerLine) {
|
|
26816
26816
|
if (line2.length > 0) {
|
|
@@ -30044,14 +30044,14 @@ function greedyWrap(text, maxWidth, fontSize, table) {
|
|
|
30044
30044
|
let lines = 0;
|
|
30045
30045
|
let widestLineWidth = 0;
|
|
30046
30046
|
for (const paragraph of text.split("\n")) {
|
|
30047
|
-
const
|
|
30048
|
-
if (
|
|
30047
|
+
const words2 = paragraph.split(/\s+/u).filter((word) => word.length > 0);
|
|
30048
|
+
if (words2.length === 0) {
|
|
30049
30049
|
lines += 1;
|
|
30050
30050
|
continue;
|
|
30051
30051
|
}
|
|
30052
30052
|
let lineWidth = 0;
|
|
30053
30053
|
let paragraphLines = 1;
|
|
30054
|
-
for (const word of
|
|
30054
|
+
for (const word of words2) {
|
|
30055
30055
|
const wordWidth = measureTextWidth(word, fontSize, table);
|
|
30056
30056
|
const extended = lineWidth === 0 ? wordWidth : lineWidth + spaceWidth + wordWidth;
|
|
30057
30057
|
if (extended > maxWidth && lineWidth > 0) {
|
|
@@ -32051,17 +32051,17 @@ function connectorPreset(node) {
|
|
|
32051
32051
|
}
|
|
32052
32052
|
function buildConnectorNode(node, index, connectorIndex, palette, roleColors) {
|
|
32053
32053
|
const preset2 = connectorPreset(node);
|
|
32054
|
-
const
|
|
32055
|
-
if (!preset2 || !
|
|
32054
|
+
const transform7 = preset2 ? shapeTransform(node) : void 0;
|
|
32055
|
+
if (!preset2 || !transform7 || !(transform7.w > 0) || !(transform7.h > 0)) {
|
|
32056
32056
|
return void 0;
|
|
32057
32057
|
}
|
|
32058
32058
|
const styleLabel = engineStyleLabel(node);
|
|
32059
32059
|
const fills = styleLabel ? roleColors?.[styleLabel]?.fill : void 0;
|
|
32060
32060
|
const fill = fills && fills.length > 0 ? fills[connectorIndex % fills.length] : colour(index, palette);
|
|
32061
|
-
const x =
|
|
32062
|
-
const y =
|
|
32063
|
-
const width =
|
|
32064
|
-
const height =
|
|
32061
|
+
const x = transform7.x * PX_PER_PT3;
|
|
32062
|
+
const y = transform7.y * PX_PER_PT3;
|
|
32063
|
+
const width = transform7.w * PX_PER_PT3;
|
|
32064
|
+
const height = transform7.h * PX_PER_PT3;
|
|
32065
32065
|
return {
|
|
32066
32066
|
kind: "rect",
|
|
32067
32067
|
key: `${node.name || "engine-conn"}-${index}`,
|
|
@@ -32078,7 +32078,7 @@ function buildConnectorNode(node, index, connectorIndex, palette, roleColors) {
|
|
|
32078
32078
|
fontSize: 0,
|
|
32079
32079
|
textX: x + width / 2,
|
|
32080
32080
|
textY: y + height / 2,
|
|
32081
|
-
rotation:
|
|
32081
|
+
rotation: transform7.rotation === 0 ? void 0 : transform7.rotation,
|
|
32082
32082
|
presetOverride: preset2,
|
|
32083
32083
|
...preset2 === "rect" ? {} : { shapeAdjustments: { ...ARROW_ADJUSTMENTS } },
|
|
32084
32084
|
...styleLabel ? { styleLabel } : {}
|
|
@@ -33818,7 +33818,7 @@ function resolveEngineFonts(entries, metrics) {
|
|
|
33818
33818
|
starts.set(entry2.node, nodeFontBounds2(entry2.node).start);
|
|
33819
33819
|
}
|
|
33820
33820
|
let resolved = /* @__PURE__ */ new Map();
|
|
33821
|
-
for (let
|
|
33821
|
+
for (let round3 = 0; round3 < 4; round3++) {
|
|
33822
33822
|
const previous = resolved;
|
|
33823
33823
|
const refSize = (ref) => previous.get(ref) ?? starts.get(ref);
|
|
33824
33824
|
const sizes = /* @__PURE__ */ new Map();
|
|
@@ -34074,8 +34074,8 @@ function isFullySupported(root) {
|
|
|
34074
34074
|
return ok;
|
|
34075
34075
|
}
|
|
34076
34076
|
function buildRenderedNode(node, index, nodeById, palette, style, mergedSourceIds) {
|
|
34077
|
-
const
|
|
34078
|
-
if (!
|
|
34077
|
+
const transform7 = shapeTransform(node);
|
|
34078
|
+
if (!transform7) {
|
|
34079
34079
|
return void 0;
|
|
34080
34080
|
}
|
|
34081
34081
|
const sourceIds = sourceIdsOf(node);
|
|
@@ -34088,10 +34088,10 @@ function buildRenderedNode(node, index, nodeById, palette, style, mergedSourceId
|
|
|
34088
34088
|
const hidden = Boolean(node.shape?.hideGeom);
|
|
34089
34089
|
const text = primary?.text ?? literalText ?? "";
|
|
34090
34090
|
const sw = hidden ? 0 : styleStroke(style);
|
|
34091
|
-
const x =
|
|
34092
|
-
const y =
|
|
34093
|
-
const width =
|
|
34094
|
-
const height =
|
|
34091
|
+
const x = transform7.x * PX_PER_PT5;
|
|
34092
|
+
const y = transform7.y * PX_PER_PT5;
|
|
34093
|
+
const width = transform7.w * PX_PER_PT5;
|
|
34094
|
+
const height = transform7.h * PX_PER_PT5;
|
|
34095
34095
|
const foldedNodeIds = [
|
|
34096
34096
|
...sourceIds.slice(1),
|
|
34097
34097
|
...(mergedSourceIds ?? []).filter((id) => !sourceIds.includes(id))
|
|
@@ -34115,7 +34115,7 @@ function buildRenderedNode(node, index, nodeById, palette, style, mergedSourceId
|
|
|
34115
34115
|
textX: x + width / 2,
|
|
34116
34116
|
textY: y + height / 2,
|
|
34117
34117
|
nodeId: primary?.id,
|
|
34118
|
-
rotation:
|
|
34118
|
+
rotation: transform7.rotation === 0 ? void 0 : transform7.rotation,
|
|
34119
34119
|
presetOverride: node.shape?.type ?? "roundRect",
|
|
34120
34120
|
foldedNodeIds: foldedNodeIds.length > 0 ? foldedNodeIds : void 0,
|
|
34121
34121
|
literalText,
|
|
@@ -45090,8 +45090,8 @@ async function verifySignatureDigests(signature, getPartContent) {
|
|
|
45090
45090
|
continue;
|
|
45091
45091
|
}
|
|
45092
45092
|
try {
|
|
45093
|
-
const
|
|
45094
|
-
const digestBase64 = arrayBufferToBase64(
|
|
45093
|
+
const digest = await crypto.subtle.digest(hashAlgo, content);
|
|
45094
|
+
const digestBase64 = arrayBufferToBase64(digest);
|
|
45095
45095
|
if (digestBase64 !== ref.digestValue) {
|
|
45096
45096
|
return "invalid";
|
|
45097
45097
|
}
|
|
@@ -45229,8 +45229,8 @@ async function computeDigestBase64(content, digestAlgorithmUri) {
|
|
|
45229
45229
|
}
|
|
45230
45230
|
const buf = new ArrayBuffer(content.byteLength);
|
|
45231
45231
|
new Uint8Array(buf).set(content);
|
|
45232
|
-
const
|
|
45233
|
-
return uint8ArrayToBase64(new Uint8Array(
|
|
45232
|
+
const digest = await globalThis.crypto.subtle.digest(webCryptoAlgo, buf);
|
|
45233
|
+
return uint8ArrayToBase64(new Uint8Array(digest));
|
|
45234
45234
|
}
|
|
45235
45235
|
function uint8ArrayToBase64(bytes) {
|
|
45236
45236
|
let binary = "";
|
|
@@ -45365,9 +45365,9 @@ var init_relationships2 = __esm({
|
|
|
45365
45365
|
}
|
|
45366
45366
|
});
|
|
45367
45367
|
|
|
45368
|
-
//
|
|
45368
|
+
// drawingml/dom.ts
|
|
45369
45369
|
var init_dom = __esm({
|
|
45370
|
-
"
|
|
45370
|
+
"drawingml/dom.ts"() {
|
|
45371
45371
|
init_xml2();
|
|
45372
45372
|
}
|
|
45373
45373
|
});
|
|
@@ -45397,7 +45397,7 @@ var init_data_model = __esm({
|
|
|
45397
45397
|
}
|
|
45398
45398
|
});
|
|
45399
45399
|
|
|
45400
|
-
//
|
|
45400
|
+
// drawingml/drawing-color.ts
|
|
45401
45401
|
function colorValue(kind, element) {
|
|
45402
45402
|
const attribute6 = (name) => element.getAttribute(name) ?? "";
|
|
45403
45403
|
if (kind === "scrgb") return `${attribute6("r")},${attribute6("g")},${attribute6("b")}`;
|
|
@@ -45430,7 +45430,7 @@ function parseDrawingColor2(element) {
|
|
|
45430
45430
|
}
|
|
45431
45431
|
var COLOR_ELEMENTS;
|
|
45432
45432
|
var init_drawing_color = __esm({
|
|
45433
|
-
"
|
|
45433
|
+
"drawingml/drawing-color.ts"() {
|
|
45434
45434
|
init_dom();
|
|
45435
45435
|
COLOR_ELEMENTS = {
|
|
45436
45436
|
srgbClr: "srgb",
|
|
@@ -45449,19 +45449,19 @@ var init_definitions = __esm({
|
|
|
45449
45449
|
}
|
|
45450
45450
|
});
|
|
45451
45451
|
|
|
45452
|
-
//
|
|
45452
|
+
// drawingml/drawing-color-css.ts
|
|
45453
45453
|
var init_drawing_color_css = __esm({
|
|
45454
|
-
"
|
|
45454
|
+
"drawingml/drawing-color-css.ts"() {
|
|
45455
45455
|
}
|
|
45456
45456
|
});
|
|
45457
45457
|
|
|
45458
|
-
//
|
|
45458
|
+
// drawingml/drawing-color-brightness.ts
|
|
45459
45459
|
var init_drawing_color_brightness = __esm({
|
|
45460
|
-
"
|
|
45460
|
+
"drawingml/drawing-color-brightness.ts"() {
|
|
45461
45461
|
}
|
|
45462
45462
|
});
|
|
45463
45463
|
|
|
45464
|
-
//
|
|
45464
|
+
// drawingml/drawing-fill.ts
|
|
45465
45465
|
function fillElementOf(properties) {
|
|
45466
45466
|
return properties ? elements(properties).find(
|
|
45467
45467
|
(element) => FILL_ELEMENTS.has(element.localName) && (!element.namespaceURI || element.namespaceURI === NS.a)
|
|
@@ -45546,7 +45546,7 @@ function parseDrawingLine(ln) {
|
|
|
45546
45546
|
}
|
|
45547
45547
|
var FILL_ELEMENTS;
|
|
45548
45548
|
var init_drawing_fill = __esm({
|
|
45549
|
-
"
|
|
45549
|
+
"drawingml/drawing-fill.ts"() {
|
|
45550
45550
|
init_drawing_color();
|
|
45551
45551
|
init_dom();
|
|
45552
45552
|
init_xml2();
|
|
@@ -45561,15 +45561,15 @@ var init_drawing_fill = __esm({
|
|
|
45561
45561
|
}
|
|
45562
45562
|
});
|
|
45563
45563
|
|
|
45564
|
-
//
|
|
45564
|
+
// drawingml/drawing-text.ts
|
|
45565
45565
|
var init_drawing_text = __esm({
|
|
45566
|
-
"
|
|
45566
|
+
"drawingml/drawing-text.ts"() {
|
|
45567
45567
|
}
|
|
45568
45568
|
});
|
|
45569
45569
|
|
|
45570
|
-
//
|
|
45570
|
+
// drawingml/drawing-geometry.ts
|
|
45571
45571
|
var init_drawing_geometry = __esm({
|
|
45572
|
-
"
|
|
45572
|
+
"drawingml/drawing-geometry.ts"() {
|
|
45573
45573
|
}
|
|
45574
45574
|
});
|
|
45575
45575
|
|
|
@@ -45591,7 +45591,7 @@ var init_load = __esm({
|
|
|
45591
45591
|
}
|
|
45592
45592
|
});
|
|
45593
45593
|
|
|
45594
|
-
//
|
|
45594
|
+
// drawingml/write-color.ts
|
|
45595
45595
|
function drawingColorXml(color2) {
|
|
45596
45596
|
const local = ELEMENTS[color2.kind];
|
|
45597
45597
|
const doc = parseXml(`<a:${local} xmlns:a="${NS.a}"/>`);
|
|
@@ -45603,18 +45603,18 @@ function drawingColorXml(color2) {
|
|
|
45603
45603
|
} else root.setAttribute("val", color2.value);
|
|
45604
45604
|
if (color2.fallback !== void 0 && color2.kind === "system")
|
|
45605
45605
|
root.setAttribute("lastClr", color2.fallback);
|
|
45606
|
-
for (const
|
|
45607
|
-
if (!/^[A-Za-z_][\w.-]*$/.test(
|
|
45608
|
-
throw new Error(`Invalid DrawingML transform ${
|
|
45609
|
-
const node = doc.createElementNS(NS.a, `a:${
|
|
45610
|
-
if (
|
|
45606
|
+
for (const transform7 of color2.transforms) {
|
|
45607
|
+
if (!/^[A-Za-z_][\w.-]*$/.test(transform7.name))
|
|
45608
|
+
throw new Error(`Invalid DrawingML transform ${transform7.name}`);
|
|
45609
|
+
const node = doc.createElementNS(NS.a, `a:${transform7.name}`);
|
|
45610
|
+
if (transform7.value !== "") node.setAttribute("val", transform7.value);
|
|
45611
45611
|
root.appendChild(node);
|
|
45612
45612
|
}
|
|
45613
45613
|
return buildXml(doc);
|
|
45614
45614
|
}
|
|
45615
45615
|
var ELEMENTS;
|
|
45616
45616
|
var init_write_color = __esm({
|
|
45617
|
-
"
|
|
45617
|
+
"drawingml/write-color.ts"() {
|
|
45618
45618
|
init_xml2();
|
|
45619
45619
|
ELEMENTS = {
|
|
45620
45620
|
srgb: "srgbClr",
|
|
@@ -45627,22 +45627,22 @@ var init_write_color = __esm({
|
|
|
45627
45627
|
}
|
|
45628
45628
|
});
|
|
45629
45629
|
|
|
45630
|
-
//
|
|
45630
|
+
// drawingml/write-fill.ts
|
|
45631
45631
|
var init_write_fill = __esm({
|
|
45632
|
-
"
|
|
45632
|
+
"drawingml/write-fill.ts"() {
|
|
45633
45633
|
}
|
|
45634
45634
|
});
|
|
45635
45635
|
|
|
45636
|
-
//
|
|
45636
|
+
// drawingml/drawing-shadow.ts
|
|
45637
45637
|
var init_drawing_shadow = __esm({
|
|
45638
|
-
"
|
|
45638
|
+
"drawingml/drawing-shadow.ts"() {
|
|
45639
45639
|
}
|
|
45640
45640
|
});
|
|
45641
45641
|
|
|
45642
|
-
//
|
|
45642
|
+
// drawingml/gradient-preset-data.ts
|
|
45643
45643
|
var OFFICE_GRADIENT_PRESET_DATA;
|
|
45644
45644
|
var init_gradient_preset_data = __esm({
|
|
45645
|
-
"
|
|
45645
|
+
"drawingml/gradient-preset-data.ts"() {
|
|
45646
45646
|
OFFICE_GRADIENT_PRESET_DATA = [
|
|
45647
45647
|
[
|
|
45648
45648
|
"Early Sunset",
|
|
@@ -45912,7 +45912,7 @@ var init_gradient_preset_data = __esm({
|
|
|
45912
45912
|
}
|
|
45913
45913
|
});
|
|
45914
45914
|
var init_gradient_presets = __esm({
|
|
45915
|
-
"
|
|
45915
|
+
"drawingml/gradient-presets.ts"() {
|
|
45916
45916
|
init_gradient_preset_data();
|
|
45917
45917
|
OFFICE_GRADIENT_PRESET_DATA.map(([label], index) => ({
|
|
45918
45918
|
id: index + 1,
|
|
@@ -45921,15 +45921,15 @@ var init_gradient_presets = __esm({
|
|
|
45921
45921
|
}
|
|
45922
45922
|
});
|
|
45923
45923
|
|
|
45924
|
-
//
|
|
45924
|
+
// drawingml/gradient-geometry.ts
|
|
45925
45925
|
var init_gradient_geometry = __esm({
|
|
45926
|
-
"
|
|
45926
|
+
"drawingml/gradient-geometry.ts"() {
|
|
45927
45927
|
}
|
|
45928
45928
|
});
|
|
45929
45929
|
|
|
45930
|
-
//
|
|
45930
|
+
// drawingml/rect-path-gradient.ts
|
|
45931
45931
|
var init_rect_path_gradient = __esm({
|
|
45932
|
-
"
|
|
45932
|
+
"drawingml/rect-path-gradient.ts"() {
|
|
45933
45933
|
}
|
|
45934
45934
|
});
|
|
45935
45935
|
|
|
@@ -47804,1161 +47804,7 @@ var init_algorithm_names = __esm({
|
|
|
47804
47804
|
}
|
|
47805
47805
|
});
|
|
47806
47806
|
|
|
47807
|
-
// digest/
|
|
47808
|
-
function compress(h2, view, offset) {
|
|
47809
|
-
for (let i2 = 0; i2 < 16; i2++) W[i2] = view.getUint32(offset + i2 * 4);
|
|
47810
|
-
for (let i2 = 16; i2 < 64; i2++) {
|
|
47811
|
-
const a2 = W[i2 - 15];
|
|
47812
|
-
const b2 = W[i2 - 2];
|
|
47813
|
-
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
47814
|
-
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
47815
|
-
W[i2] = W[i2 - 16] + s0 + W[i2 - 7] + s1 >>> 0;
|
|
47816
|
-
}
|
|
47817
|
-
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];
|
|
47818
|
-
for (let i2 = 0; i2 < 64; i2++) {
|
|
47819
|
-
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
47820
|
-
const ch = e & f6 ^ ~e & g2;
|
|
47821
|
-
const t1 = k + S1 + ch + K[i2] + W[i2] >>> 0;
|
|
47822
|
-
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
47823
|
-
const maj = a & b ^ a & c ^ b & c;
|
|
47824
|
-
const t2 = S0 + maj >>> 0;
|
|
47825
|
-
k = g2;
|
|
47826
|
-
g2 = f6;
|
|
47827
|
-
f6 = e;
|
|
47828
|
-
e = d + t1 >>> 0;
|
|
47829
|
-
d = c;
|
|
47830
|
-
c = b;
|
|
47831
|
-
b = a;
|
|
47832
|
-
a = t1 + t2 >>> 0;
|
|
47833
|
-
}
|
|
47834
|
-
h2[0] = h2[0] + a >>> 0;
|
|
47835
|
-
h2[1] = h2[1] + b >>> 0;
|
|
47836
|
-
h2[2] = h2[2] + c >>> 0;
|
|
47837
|
-
h2[3] = h2[3] + d >>> 0;
|
|
47838
|
-
h2[4] = h2[4] + e >>> 0;
|
|
47839
|
-
h2[5] = h2[5] + f6 >>> 0;
|
|
47840
|
-
h2[6] = h2[6] + g2 >>> 0;
|
|
47841
|
-
h2[7] = h2[7] + k >>> 0;
|
|
47842
|
-
}
|
|
47843
|
-
function pad64(data) {
|
|
47844
|
-
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
47845
|
-
padded.set(data);
|
|
47846
|
-
padded[data.length] = 128;
|
|
47847
|
-
const bits = data.length * 8;
|
|
47848
|
-
const view = new DataView(padded.buffer);
|
|
47849
|
-
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
47850
|
-
view.setUint32(padded.length - 4, bits >>> 0);
|
|
47851
|
-
return view;
|
|
47852
|
-
}
|
|
47853
|
-
function wordsOut(h2) {
|
|
47854
|
-
const out = new Uint8Array(h2.length * 4);
|
|
47855
|
-
const view = new DataView(out.buffer);
|
|
47856
|
-
for (let i2 = 0; i2 < h2.length; i2++) view.setUint32(i2 * 4, h2[i2]);
|
|
47857
|
-
return out;
|
|
47858
|
-
}
|
|
47859
|
-
function sha256(data) {
|
|
47860
|
-
const h2 = new Uint32Array(IV);
|
|
47861
|
-
const view = pad64(data);
|
|
47862
|
-
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h2, view, offset);
|
|
47863
|
-
return wordsOut(h2);
|
|
47864
|
-
}
|
|
47865
|
-
var K, IV, W, rotr;
|
|
47866
|
-
var init_sha256 = __esm({
|
|
47867
|
-
"digest/sha256.ts"() {
|
|
47868
|
-
K = new Uint32Array([
|
|
47869
|
-
1116352408,
|
|
47870
|
-
1899447441,
|
|
47871
|
-
3049323471,
|
|
47872
|
-
3921009573,
|
|
47873
|
-
961987163,
|
|
47874
|
-
1508970993,
|
|
47875
|
-
2453635748,
|
|
47876
|
-
2870763221,
|
|
47877
|
-
3624381080,
|
|
47878
|
-
310598401,
|
|
47879
|
-
607225278,
|
|
47880
|
-
1426881987,
|
|
47881
|
-
1925078388,
|
|
47882
|
-
2162078206,
|
|
47883
|
-
2614888103,
|
|
47884
|
-
3248222580,
|
|
47885
|
-
3835390401,
|
|
47886
|
-
4022224774,
|
|
47887
|
-
264347078,
|
|
47888
|
-
604807628,
|
|
47889
|
-
770255983,
|
|
47890
|
-
1249150122,
|
|
47891
|
-
1555081692,
|
|
47892
|
-
1996064986,
|
|
47893
|
-
2554220882,
|
|
47894
|
-
2821834349,
|
|
47895
|
-
2952996808,
|
|
47896
|
-
3210313671,
|
|
47897
|
-
3336571891,
|
|
47898
|
-
3584528711,
|
|
47899
|
-
113926993,
|
|
47900
|
-
338241895,
|
|
47901
|
-
666307205,
|
|
47902
|
-
773529912,
|
|
47903
|
-
1294757372,
|
|
47904
|
-
1396182291,
|
|
47905
|
-
1695183700,
|
|
47906
|
-
1986661051,
|
|
47907
|
-
2177026350,
|
|
47908
|
-
2456956037,
|
|
47909
|
-
2730485921,
|
|
47910
|
-
2820302411,
|
|
47911
|
-
3259730800,
|
|
47912
|
-
3345764771,
|
|
47913
|
-
3516065817,
|
|
47914
|
-
3600352804,
|
|
47915
|
-
4094571909,
|
|
47916
|
-
275423344,
|
|
47917
|
-
430227734,
|
|
47918
|
-
506948616,
|
|
47919
|
-
659060556,
|
|
47920
|
-
883997877,
|
|
47921
|
-
958139571,
|
|
47922
|
-
1322822218,
|
|
47923
|
-
1537002063,
|
|
47924
|
-
1747873779,
|
|
47925
|
-
1955562222,
|
|
47926
|
-
2024104815,
|
|
47927
|
-
2227730452,
|
|
47928
|
-
2361852424,
|
|
47929
|
-
2428436474,
|
|
47930
|
-
2756734187,
|
|
47931
|
-
3204031479,
|
|
47932
|
-
3329325298
|
|
47933
|
-
]);
|
|
47934
|
-
IV = [
|
|
47935
|
-
1779033703,
|
|
47936
|
-
3144134277,
|
|
47937
|
-
1013904242,
|
|
47938
|
-
2773480762,
|
|
47939
|
-
1359893119,
|
|
47940
|
-
2600822924,
|
|
47941
|
-
528734635,
|
|
47942
|
-
1541459225
|
|
47943
|
-
];
|
|
47944
|
-
W = new Uint32Array(64);
|
|
47945
|
-
rotr = (x, n) => x >>> n | x << 32 - n;
|
|
47946
|
-
}
|
|
47947
|
-
});
|
|
47948
|
-
|
|
47949
|
-
// digest/sha1.ts
|
|
47950
|
-
function compress2(h2, view, offset) {
|
|
47951
|
-
for (let i2 = 0; i2 < 16; i2++) W2[i2] = view.getUint32(offset + i2 * 4);
|
|
47952
|
-
for (let i2 = 16; i2 < 80; i2++) W2[i2] = rotl(W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16], 1);
|
|
47953
|
-
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4];
|
|
47954
|
-
for (let i2 = 0; i2 < 80; i2++) {
|
|
47955
|
-
let f6;
|
|
47956
|
-
let k;
|
|
47957
|
-
if (i2 < 20) {
|
|
47958
|
-
f6 = b & c | ~b & d;
|
|
47959
|
-
k = 1518500249;
|
|
47960
|
-
} else if (i2 < 40) {
|
|
47961
|
-
f6 = b ^ c ^ d;
|
|
47962
|
-
k = 1859775393;
|
|
47963
|
-
} else if (i2 < 60) {
|
|
47964
|
-
f6 = b & c | b & d | c & d;
|
|
47965
|
-
k = 2400959708;
|
|
47966
|
-
} else {
|
|
47967
|
-
f6 = b ^ c ^ d;
|
|
47968
|
-
k = 3395469782;
|
|
47969
|
-
}
|
|
47970
|
-
const t = rotl(a, 5) + f6 + e + k + W2[i2] >>> 0;
|
|
47971
|
-
e = d;
|
|
47972
|
-
d = c;
|
|
47973
|
-
c = rotl(b, 30) >>> 0;
|
|
47974
|
-
b = a;
|
|
47975
|
-
a = t;
|
|
47976
|
-
}
|
|
47977
|
-
h2[0] = h2[0] + a >>> 0;
|
|
47978
|
-
h2[1] = h2[1] + b >>> 0;
|
|
47979
|
-
h2[2] = h2[2] + c >>> 0;
|
|
47980
|
-
h2[3] = h2[3] + d >>> 0;
|
|
47981
|
-
h2[4] = h2[4] + e >>> 0;
|
|
47982
|
-
}
|
|
47983
|
-
function sha1(data) {
|
|
47984
|
-
const h2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
47985
|
-
const view = pad64(data);
|
|
47986
|
-
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h2, view, offset);
|
|
47987
|
-
return wordsOut(h2);
|
|
47988
|
-
}
|
|
47989
|
-
var W2, rotl;
|
|
47990
|
-
var init_sha1 = __esm({
|
|
47991
|
-
"digest/sha1.ts"() {
|
|
47992
|
-
init_sha256();
|
|
47993
|
-
W2 = new Uint32Array(80);
|
|
47994
|
-
rotl = (x, n) => x << n | x >>> 32 - n;
|
|
47995
|
-
}
|
|
47996
|
-
});
|
|
47997
|
-
|
|
47998
|
-
// digest/sha512.ts
|
|
47999
|
-
function compress3(h2, data, offset) {
|
|
48000
|
-
for (let i2 = 0; i2 < 32; i2++) {
|
|
48001
|
-
const o = offset + i2 * 4;
|
|
48002
|
-
W3[i2] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
48003
|
-
}
|
|
48004
|
-
for (let i2 = 16; i2 < 80; i2++) {
|
|
48005
|
-
const xh = W3[(i2 - 15) * 2];
|
|
48006
|
-
const xl = W3[(i2 - 15) * 2 + 1];
|
|
48007
|
-
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
48008
|
-
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
48009
|
-
const yh = W3[(i2 - 2) * 2];
|
|
48010
|
-
const yl = W3[(i2 - 2) * 2 + 1];
|
|
48011
|
-
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
48012
|
-
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
48013
|
-
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i2 - 7) * 2 + 1] + W3[(i2 - 16) * 2 + 1];
|
|
48014
|
-
const hi = s0h + s1h + W3[(i2 - 7) * 2] + W3[(i2 - 16) * 2] + Math.floor(lo / 4294967296);
|
|
48015
|
-
lo >>>= 0;
|
|
48016
|
-
W3[i2 * 2] = hi >>> 0;
|
|
48017
|
-
W3[i2 * 2 + 1] = lo;
|
|
48018
|
-
}
|
|
48019
|
-
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];
|
|
48020
|
-
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];
|
|
48021
|
-
for (let i2 = 0; i2 < 80; i2++) {
|
|
48022
|
-
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
48023
|
-
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
48024
|
-
const chh = eh & fh ^ ~eh & gh;
|
|
48025
|
-
const chl = el & fl ^ ~el & gl;
|
|
48026
|
-
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K2[i2 * 2 + 1] + W3[i2 * 2 + 1];
|
|
48027
|
-
const t1h = hh + S1h + chh + K2[i2 * 2] + W3[i2 * 2] + Math.floor(t1l / 4294967296);
|
|
48028
|
-
t1l >>>= 0;
|
|
48029
|
-
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
48030
|
-
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
48031
|
-
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
48032
|
-
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
48033
|
-
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
48034
|
-
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
48035
|
-
t2l >>>= 0;
|
|
48036
|
-
hh = gh;
|
|
48037
|
-
hl = gl;
|
|
48038
|
-
gh = fh;
|
|
48039
|
-
gl = fl;
|
|
48040
|
-
fh = eh;
|
|
48041
|
-
fl = el;
|
|
48042
|
-
let nl = (dl >>> 0) + t1l;
|
|
48043
|
-
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
48044
|
-
el = nl >>> 0;
|
|
48045
|
-
dh = ch;
|
|
48046
|
-
dl = cl;
|
|
48047
|
-
ch = bh;
|
|
48048
|
-
cl = bl;
|
|
48049
|
-
bh = ah;
|
|
48050
|
-
bl = al;
|
|
48051
|
-
nl = t1l + t2l;
|
|
48052
|
-
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
48053
|
-
al = nl >>> 0;
|
|
48054
|
-
}
|
|
48055
|
-
const add7 = (i2, xh, xl) => {
|
|
48056
|
-
const lo = (h2[i2 + 1] >>> 0) + (xl >>> 0);
|
|
48057
|
-
h2[i2] = h2[i2] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
48058
|
-
h2[i2 + 1] = lo >>> 0;
|
|
48059
|
-
};
|
|
48060
|
-
add7(0, ah, al);
|
|
48061
|
-
add7(2, bh, bl);
|
|
48062
|
-
add7(4, ch, cl);
|
|
48063
|
-
add7(6, dh, dl);
|
|
48064
|
-
add7(8, eh, el);
|
|
48065
|
-
add7(10, fh, fl);
|
|
48066
|
-
add7(12, gh, gl);
|
|
48067
|
-
add7(14, hh, hl);
|
|
48068
|
-
}
|
|
48069
|
-
function digest64(data, iv, bytes) {
|
|
48070
|
-
const h2 = new Uint32Array(iv);
|
|
48071
|
-
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
48072
|
-
padded.set(data);
|
|
48073
|
-
padded[data.length] = 128;
|
|
48074
|
-
const bits = data.length * 8;
|
|
48075
|
-
const view = new DataView(padded.buffer);
|
|
48076
|
-
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
48077
|
-
view.setUint32(padded.length - 4, bits >>> 0);
|
|
48078
|
-
for (let offset = 0; offset < padded.length; offset += 128) compress3(h2, padded, offset);
|
|
48079
|
-
const out = new Uint8Array(bytes);
|
|
48080
|
-
const outView = new DataView(out.buffer);
|
|
48081
|
-
for (let i2 = 0; i2 < bytes / 4; i2++) outView.setUint32(i2 * 4, h2[i2]);
|
|
48082
|
-
return out;
|
|
48083
|
-
}
|
|
48084
|
-
var K2, IV_512, IV_384, W3, sha512, sha384;
|
|
48085
|
-
var init_sha512 = __esm({
|
|
48086
|
-
"digest/sha512.ts"() {
|
|
48087
|
-
K2 = new Uint32Array([
|
|
48088
|
-
1116352408,
|
|
48089
|
-
3609767458,
|
|
48090
|
-
1899447441,
|
|
48091
|
-
602891725,
|
|
48092
|
-
3049323471,
|
|
48093
|
-
3964484399,
|
|
48094
|
-
3921009573,
|
|
48095
|
-
2173295548,
|
|
48096
|
-
961987163,
|
|
48097
|
-
4081628472,
|
|
48098
|
-
1508970993,
|
|
48099
|
-
3053834265,
|
|
48100
|
-
2453635748,
|
|
48101
|
-
2937671579,
|
|
48102
|
-
2870763221,
|
|
48103
|
-
3664609560,
|
|
48104
|
-
3624381080,
|
|
48105
|
-
2734883394,
|
|
48106
|
-
310598401,
|
|
48107
|
-
1164996542,
|
|
48108
|
-
607225278,
|
|
48109
|
-
1323610764,
|
|
48110
|
-
1426881987,
|
|
48111
|
-
3590304994,
|
|
48112
|
-
1925078388,
|
|
48113
|
-
4068182383,
|
|
48114
|
-
2162078206,
|
|
48115
|
-
991336113,
|
|
48116
|
-
2614888103,
|
|
48117
|
-
633803317,
|
|
48118
|
-
3248222580,
|
|
48119
|
-
3479774868,
|
|
48120
|
-
3835390401,
|
|
48121
|
-
2666613458,
|
|
48122
|
-
4022224774,
|
|
48123
|
-
944711139,
|
|
48124
|
-
264347078,
|
|
48125
|
-
2341262773,
|
|
48126
|
-
604807628,
|
|
48127
|
-
2007800933,
|
|
48128
|
-
770255983,
|
|
48129
|
-
1495990901,
|
|
48130
|
-
1249150122,
|
|
48131
|
-
1856431235,
|
|
48132
|
-
1555081692,
|
|
48133
|
-
3175218132,
|
|
48134
|
-
1996064986,
|
|
48135
|
-
2198950837,
|
|
48136
|
-
2554220882,
|
|
48137
|
-
3999719339,
|
|
48138
|
-
2821834349,
|
|
48139
|
-
766784016,
|
|
48140
|
-
2952996808,
|
|
48141
|
-
2566594879,
|
|
48142
|
-
3210313671,
|
|
48143
|
-
3203337956,
|
|
48144
|
-
3336571891,
|
|
48145
|
-
1034457026,
|
|
48146
|
-
3584528711,
|
|
48147
|
-
2466948901,
|
|
48148
|
-
113926993,
|
|
48149
|
-
3758326383,
|
|
48150
|
-
338241895,
|
|
48151
|
-
168717936,
|
|
48152
|
-
666307205,
|
|
48153
|
-
1188179964,
|
|
48154
|
-
773529912,
|
|
48155
|
-
1546045734,
|
|
48156
|
-
1294757372,
|
|
48157
|
-
1522805485,
|
|
48158
|
-
1396182291,
|
|
48159
|
-
2643833823,
|
|
48160
|
-
1695183700,
|
|
48161
|
-
2343527390,
|
|
48162
|
-
1986661051,
|
|
48163
|
-
1014477480,
|
|
48164
|
-
2177026350,
|
|
48165
|
-
1206759142,
|
|
48166
|
-
2456956037,
|
|
48167
|
-
344077627,
|
|
48168
|
-
2730485921,
|
|
48169
|
-
1290863460,
|
|
48170
|
-
2820302411,
|
|
48171
|
-
3158454273,
|
|
48172
|
-
3259730800,
|
|
48173
|
-
3505952657,
|
|
48174
|
-
3345764771,
|
|
48175
|
-
106217008,
|
|
48176
|
-
3516065817,
|
|
48177
|
-
3606008344,
|
|
48178
|
-
3600352804,
|
|
48179
|
-
1432725776,
|
|
48180
|
-
4094571909,
|
|
48181
|
-
1467031594,
|
|
48182
|
-
275423344,
|
|
48183
|
-
851169720,
|
|
48184
|
-
430227734,
|
|
48185
|
-
3100823752,
|
|
48186
|
-
506948616,
|
|
48187
|
-
1363258195,
|
|
48188
|
-
659060556,
|
|
48189
|
-
3750685593,
|
|
48190
|
-
883997877,
|
|
48191
|
-
3785050280,
|
|
48192
|
-
958139571,
|
|
48193
|
-
3318307427,
|
|
48194
|
-
1322822218,
|
|
48195
|
-
3812723403,
|
|
48196
|
-
1537002063,
|
|
48197
|
-
2003034995,
|
|
48198
|
-
1747873779,
|
|
48199
|
-
3602036899,
|
|
48200
|
-
1955562222,
|
|
48201
|
-
1575990012,
|
|
48202
|
-
2024104815,
|
|
48203
|
-
1125592928,
|
|
48204
|
-
2227730452,
|
|
48205
|
-
2716904306,
|
|
48206
|
-
2361852424,
|
|
48207
|
-
442776044,
|
|
48208
|
-
2428436474,
|
|
48209
|
-
593698344,
|
|
48210
|
-
2756734187,
|
|
48211
|
-
3733110249,
|
|
48212
|
-
3204031479,
|
|
48213
|
-
2999351573,
|
|
48214
|
-
3329325298,
|
|
48215
|
-
3815920427,
|
|
48216
|
-
3391569614,
|
|
48217
|
-
3928383900,
|
|
48218
|
-
3515267271,
|
|
48219
|
-
566280711,
|
|
48220
|
-
3940187606,
|
|
48221
|
-
3454069534,
|
|
48222
|
-
4118630271,
|
|
48223
|
-
4000239992,
|
|
48224
|
-
116418474,
|
|
48225
|
-
1914138554,
|
|
48226
|
-
174292421,
|
|
48227
|
-
2731055270,
|
|
48228
|
-
289380356,
|
|
48229
|
-
3203993006,
|
|
48230
|
-
460393269,
|
|
48231
|
-
320620315,
|
|
48232
|
-
685471733,
|
|
48233
|
-
587496836,
|
|
48234
|
-
852142971,
|
|
48235
|
-
1086792851,
|
|
48236
|
-
1017036298,
|
|
48237
|
-
365543100,
|
|
48238
|
-
1126000580,
|
|
48239
|
-
2618297676,
|
|
48240
|
-
1288033470,
|
|
48241
|
-
3409855158,
|
|
48242
|
-
1501505948,
|
|
48243
|
-
4234509866,
|
|
48244
|
-
1607167915,
|
|
48245
|
-
987167468,
|
|
48246
|
-
1816402316,
|
|
48247
|
-
1246189591
|
|
48248
|
-
]);
|
|
48249
|
-
IV_512 = [
|
|
48250
|
-
1779033703,
|
|
48251
|
-
4089235720,
|
|
48252
|
-
3144134277,
|
|
48253
|
-
2227873595,
|
|
48254
|
-
1013904242,
|
|
48255
|
-
4271175723,
|
|
48256
|
-
2773480762,
|
|
48257
|
-
1595750129,
|
|
48258
|
-
1359893119,
|
|
48259
|
-
2917565137,
|
|
48260
|
-
2600822924,
|
|
48261
|
-
725511199,
|
|
48262
|
-
528734635,
|
|
48263
|
-
4215389547,
|
|
48264
|
-
1541459225,
|
|
48265
|
-
327033209
|
|
48266
|
-
];
|
|
48267
|
-
IV_384 = [
|
|
48268
|
-
3418070365,
|
|
48269
|
-
3238371032,
|
|
48270
|
-
1654270250,
|
|
48271
|
-
914150663,
|
|
48272
|
-
2438529370,
|
|
48273
|
-
812702999,
|
|
48274
|
-
355462360,
|
|
48275
|
-
4144912697,
|
|
48276
|
-
1731405415,
|
|
48277
|
-
4290775857,
|
|
48278
|
-
2394180231,
|
|
48279
|
-
1750603025,
|
|
48280
|
-
3675008525,
|
|
48281
|
-
1694076839,
|
|
48282
|
-
1203062813,
|
|
48283
|
-
3204075428
|
|
48284
|
-
];
|
|
48285
|
-
W3 = new Uint32Array(160);
|
|
48286
|
-
sha512 = (data) => digest64(data, IV_512, 64);
|
|
48287
|
-
sha384 = (data) => digest64(data, IV_384, 48);
|
|
48288
|
-
}
|
|
48289
|
-
});
|
|
48290
|
-
|
|
48291
|
-
// digest/digest.ts
|
|
48292
|
-
function digestFunction(name) {
|
|
48293
|
-
const canonical = normalizeDigestAlgorithmName(name);
|
|
48294
|
-
return canonical && canonical in DIGESTS ? DIGESTS[canonical] : void 0;
|
|
48295
|
-
}
|
|
48296
|
-
var DIGESTS;
|
|
48297
|
-
var init_digest2 = __esm({
|
|
48298
|
-
"digest/digest.ts"() {
|
|
48299
|
-
init_algorithm_names();
|
|
48300
|
-
init_sha1();
|
|
48301
|
-
init_sha256();
|
|
48302
|
-
init_sha512();
|
|
48303
|
-
DIGESTS = {
|
|
48304
|
-
"SHA-1": sha1,
|
|
48305
|
-
"SHA-256": sha256,
|
|
48306
|
-
"SHA-384": sha384,
|
|
48307
|
-
"SHA-512": sha512
|
|
48308
|
-
};
|
|
48309
|
-
}
|
|
48310
|
-
});
|
|
48311
|
-
|
|
48312
|
-
// crypto/key-derivation.ts
|
|
48313
|
-
async function spinPassword(password, salt, spinCount, hashAlgorithm) {
|
|
48314
|
-
if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
|
|
48315
|
-
throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
|
|
48316
|
-
}
|
|
48317
|
-
const passwordBytes = encodePasswordUtf16LE(password);
|
|
48318
|
-
const digest2 = digestFunction(hashAlgorithm);
|
|
48319
|
-
if (digest2) {
|
|
48320
|
-
let h3 = digest2(concatArrays(salt, passwordBytes));
|
|
48321
|
-
const buffer = new Uint8Array(4 + h3.length);
|
|
48322
|
-
const view = new DataView(buffer.buffer);
|
|
48323
|
-
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
48324
|
-
view.setUint32(0, i2, true);
|
|
48325
|
-
buffer.set(h3, 4);
|
|
48326
|
-
h3 = digest2(buffer);
|
|
48327
|
-
}
|
|
48328
|
-
return h3;
|
|
48329
|
-
}
|
|
48330
|
-
let h2 = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
|
|
48331
|
-
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
48332
|
-
h2 = await hash(hashAlgorithm, concatArrays(uint32LE(i2), h2));
|
|
48333
|
-
}
|
|
48334
|
-
return h2;
|
|
48335
|
-
}
|
|
48336
|
-
async function extendKey(h2, hashAlgorithm, keyLength) {
|
|
48337
|
-
const pad2 = async (value) => {
|
|
48338
|
-
const input = new Uint8Array(64).fill(value);
|
|
48339
|
-
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) input[i2] = h2[i2] ^ value;
|
|
48340
|
-
return hash(hashAlgorithm, input);
|
|
48341
|
-
};
|
|
48342
|
-
const x3 = concatArrays(await pad2(54), await pad2(92));
|
|
48343
|
-
return x3.subarray(0, keyLength);
|
|
48344
|
-
}
|
|
48345
|
-
function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
|
|
48346
|
-
return spinPassword(password, salt, spinCount, hashAlgorithm);
|
|
48347
|
-
}
|
|
48348
|
-
async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
48349
|
-
const h2 = await hash(hashAlgorithm, concatArrays(base, blockKey));
|
|
48350
|
-
const keyLength = keyBits / 8;
|
|
48351
|
-
if (hashSize >= keyLength) return h2.subarray(0, keyLength);
|
|
48352
|
-
return extendKey(h2, hashAlgorithm, keyLength);
|
|
48353
|
-
}
|
|
48354
|
-
function computeStandardKeyBase(password, salt) {
|
|
48355
|
-
return spinPassword(password, salt, 5e4, "SHA-1");
|
|
48356
|
-
}
|
|
48357
|
-
async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
|
|
48358
|
-
const h2 = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
|
|
48359
|
-
return extendKey(h2, "SHA-1", keySize / 8);
|
|
48360
|
-
}
|
|
48361
|
-
async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
|
|
48362
|
-
const base = await computeStandardKeyBase(password, salt);
|
|
48363
|
-
return deriveStandardKeyFromBase(base, keySize, blockNumber);
|
|
48364
|
-
}
|
|
48365
|
-
async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
|
|
48366
|
-
const h2 = await hash(hashAlgorithm, concatArrays(salt, blockKey));
|
|
48367
|
-
if (h2.length >= blockSize) return h2.subarray(0, blockSize);
|
|
48368
|
-
const padded = new Uint8Array(blockSize).fill(54);
|
|
48369
|
-
padded.set(h2);
|
|
48370
|
-
return padded;
|
|
48371
|
-
}
|
|
48372
|
-
var BLOCK_KEYS, MAX_SPIN_COUNT;
|
|
48373
|
-
var init_key_derivation = __esm({
|
|
48374
|
-
"crypto/key-derivation.ts"() {
|
|
48375
|
-
init_ooxml_crypto_primitives();
|
|
48376
|
-
init_digest2();
|
|
48377
|
-
BLOCK_KEYS = {
|
|
48378
|
-
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
48379
|
-
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
48380
|
-
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
48381
|
-
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
48382
|
-
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
48383
|
-
};
|
|
48384
|
-
MAX_SPIN_COUNT = 1e7;
|
|
48385
|
-
}
|
|
48386
|
-
});
|
|
48387
|
-
|
|
48388
|
-
// crypto/decrypt.ts
|
|
48389
|
-
async function verifyAgilePassword(info, password) {
|
|
48390
|
-
const pke = info.passwordKeyEncryptor;
|
|
48391
|
-
const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
|
|
48392
|
-
const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
|
|
48393
|
-
const verifierHashInput = await aesCbcDecryptRaw(
|
|
48394
|
-
await blockKey(BLOCK_KEYS.verifierHashInput),
|
|
48395
|
-
pke.saltValue,
|
|
48396
|
-
pke.encryptedVerifierHashInput
|
|
48397
|
-
);
|
|
48398
|
-
const verifierHashValue = await aesCbcDecryptRaw(
|
|
48399
|
-
await blockKey(BLOCK_KEYS.verifierHashValue),
|
|
48400
|
-
pke.saltValue,
|
|
48401
|
-
pke.encryptedVerifierHashValue
|
|
48402
|
-
);
|
|
48403
|
-
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
48404
|
-
if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
|
|
48405
|
-
let difference = 0;
|
|
48406
|
-
for (let i2 = 0; i2 < pke.hashSize; i2++) difference |= verifierHashValue[i2] ^ computedHash[i2];
|
|
48407
|
-
if (difference !== 0) return null;
|
|
48408
|
-
const decryptedKey = await aesCbcDecryptRaw(
|
|
48409
|
-
await blockKey(BLOCK_KEYS.encryptedKeyValue),
|
|
48410
|
-
pke.saltValue,
|
|
48411
|
-
pke.encryptedKeyValue
|
|
48412
|
-
);
|
|
48413
|
-
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
48414
|
-
}
|
|
48415
|
-
async function verifyStandardPassword(info, password) {
|
|
48416
|
-
const key2 = await deriveStandardKey(
|
|
48417
|
-
password,
|
|
48418
|
-
info.verifier.salt,
|
|
48419
|
-
info.header.keySize,
|
|
48420
|
-
info.header.algIdHash
|
|
48421
|
-
);
|
|
48422
|
-
const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
|
|
48423
|
-
const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
|
|
48424
|
-
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
48425
|
-
const hashSize = info.verifier.verifierHashSize;
|
|
48426
|
-
let match = true;
|
|
48427
|
-
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
48428
|
-
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
48429
|
-
match = false;
|
|
48430
|
-
break;
|
|
48431
|
-
}
|
|
48432
|
-
}
|
|
48433
|
-
return match ? key2 : null;
|
|
48434
|
-
}
|
|
48435
|
-
async function verifyAgileDataIntegrity(info, key2, encryptedPackage) {
|
|
48436
|
-
const keyData = info.keyData;
|
|
48437
|
-
if (!info.dataIntegrity) {
|
|
48438
|
-
return;
|
|
48439
|
-
}
|
|
48440
|
-
const hmacKeyIV = await generateIV(
|
|
48441
|
-
keyData.hashAlgorithm,
|
|
48442
|
-
keyData.saltValue,
|
|
48443
|
-
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
48444
|
-
keyData.blockSize
|
|
48445
|
-
);
|
|
48446
|
-
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
48447
|
-
key2,
|
|
48448
|
-
hmacKeyIV,
|
|
48449
|
-
info.dataIntegrity.encryptedHmacKey
|
|
48450
|
-
);
|
|
48451
|
-
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
48452
|
-
const hmacValueIV = await generateIV(
|
|
48453
|
-
keyData.hashAlgorithm,
|
|
48454
|
-
keyData.saltValue,
|
|
48455
|
-
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
48456
|
-
keyData.blockSize
|
|
48457
|
-
);
|
|
48458
|
-
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
48459
|
-
key2,
|
|
48460
|
-
hmacValueIV,
|
|
48461
|
-
info.dataIntegrity.encryptedHmacValue
|
|
48462
|
-
);
|
|
48463
|
-
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
48464
|
-
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
48465
|
-
let match = true;
|
|
48466
|
-
if (computedHmac.length < keyData.hashSize) {
|
|
48467
|
-
match = false;
|
|
48468
|
-
} else {
|
|
48469
|
-
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
48470
|
-
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
48471
|
-
match = false;
|
|
48472
|
-
break;
|
|
48473
|
-
}
|
|
48474
|
-
}
|
|
48475
|
-
}
|
|
48476
|
-
if (!match) {
|
|
48477
|
-
throw new exports.DataIntegrityError(
|
|
48478
|
-
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
48479
|
-
);
|
|
48480
|
-
}
|
|
48481
|
-
}
|
|
48482
|
-
async function decryptAgilePackage(encryptedPackage, key2, info) {
|
|
48483
|
-
const keyData = info.keyData;
|
|
48484
|
-
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
48485
|
-
const originalSize = sizeView.getUint32(0, true) + sizeView.getUint32(4, true) * 4294967296;
|
|
48486
|
-
const encryptedData = encryptedPackage.subarray(8);
|
|
48487
|
-
const segmentSize = 4096;
|
|
48488
|
-
const result = new Uint8Array(originalSize);
|
|
48489
|
-
let resultOffset = 0;
|
|
48490
|
-
const numSegments = Math.ceil(encryptedData.length / segmentSize);
|
|
48491
|
-
for (let segment = 0; segment < numSegments; segment++) {
|
|
48492
|
-
const segmentStart = segment * segmentSize;
|
|
48493
|
-
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
48494
|
-
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
48495
|
-
const blockKeyBytes = uint32LE(segment);
|
|
48496
|
-
const segmentIV = await generateIV(
|
|
48497
|
-
keyData.hashAlgorithm,
|
|
48498
|
-
keyData.saltValue,
|
|
48499
|
-
blockKeyBytes,
|
|
48500
|
-
keyData.blockSize
|
|
48501
|
-
);
|
|
48502
|
-
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
48503
|
-
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
48504
|
-
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
48505
|
-
resultOffset += bytesToCopy;
|
|
48506
|
-
}
|
|
48507
|
-
return result.buffer;
|
|
48508
|
-
}
|
|
48509
|
-
async function decryptStandardPackage(encryptedPackage, key2) {
|
|
48510
|
-
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
48511
|
-
const originalSize = sizeView.getUint32(0, true);
|
|
48512
|
-
const encryptedData = encryptedPackage.subarray(8);
|
|
48513
|
-
const decrypted = await aesEcbDecrypt(key2, encryptedData);
|
|
48514
|
-
return decrypted.slice(0, originalSize).buffer;
|
|
48515
|
-
}
|
|
48516
|
-
var init_decrypt = __esm({
|
|
48517
|
-
"crypto/decrypt.ts"() {
|
|
48518
|
-
init_ooxml_crypto_primitives();
|
|
48519
|
-
init_aes_ecb();
|
|
48520
|
-
init_errors();
|
|
48521
|
-
init_key_derivation();
|
|
48522
|
-
}
|
|
48523
|
-
});
|
|
48524
|
-
|
|
48525
|
-
// crypto/encryption-info-write.ts
|
|
48526
|
-
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
48527
|
-
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
48528
|
-
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
48529
|
-
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
48530
|
-
<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>`;
|
|
48531
|
-
}
|
|
48532
|
-
function buildEncryptionInfoStream(xmlString) {
|
|
48533
|
-
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
48534
|
-
const result = new Uint8Array(8 + xmlBytes.length);
|
|
48535
|
-
const view = new DataView(result.buffer);
|
|
48536
|
-
view.setUint16(0, 4, true);
|
|
48537
|
-
view.setUint16(2, 4, true);
|
|
48538
|
-
view.setUint32(4, 64, true);
|
|
48539
|
-
result.set(xmlBytes, 8);
|
|
48540
|
-
return result;
|
|
48541
|
-
}
|
|
48542
|
-
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
48543
|
-
const algId = STANDARD_ALG_IDS[keyBits];
|
|
48544
|
-
if (!algId) {
|
|
48545
|
-
throw new Error(
|
|
48546
|
-
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
48547
|
-
);
|
|
48548
|
-
}
|
|
48549
|
-
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
48550
|
-
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
48551
|
-
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
48552
|
-
cspNameBytes[i2 * 2] = code & 255;
|
|
48553
|
-
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
48554
|
-
}
|
|
48555
|
-
const headerFixedSize = 32;
|
|
48556
|
-
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
48557
|
-
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
48558
|
-
const totalSize = 12 + headerSize + verifierSize;
|
|
48559
|
-
const data = new Uint8Array(totalSize);
|
|
48560
|
-
const view = new DataView(data.buffer);
|
|
48561
|
-
view.setUint16(0, 4, true);
|
|
48562
|
-
view.setUint16(2, 2, true);
|
|
48563
|
-
view.setUint32(4, STANDARD_FLAGS, true);
|
|
48564
|
-
view.setUint32(8, headerSize, true);
|
|
48565
|
-
const h2 = 12;
|
|
48566
|
-
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
48567
|
-
view.setUint32(h2 + 4, 0, true);
|
|
48568
|
-
view.setUint32(h2 + 8, algId, true);
|
|
48569
|
-
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
48570
|
-
view.setUint32(h2 + 16, keyBits, true);
|
|
48571
|
-
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
48572
|
-
view.setUint32(h2 + 24, 0, true);
|
|
48573
|
-
view.setUint32(h2 + 28, 0, true);
|
|
48574
|
-
data.set(cspNameBytes, h2 + 32);
|
|
48575
|
-
const v = 12 + headerSize;
|
|
48576
|
-
view.setUint32(v, 16, true);
|
|
48577
|
-
data.set(salt.subarray(0, 16), v + 4);
|
|
48578
|
-
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
48579
|
-
view.setUint32(v + 36, 20, true);
|
|
48580
|
-
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
48581
|
-
return data;
|
|
48582
|
-
}
|
|
48583
|
-
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
48584
|
-
var init_encryption_info_write = __esm({
|
|
48585
|
-
"crypto/encryption-info-write.ts"() {
|
|
48586
|
-
init_ooxml_crypto_primitives();
|
|
48587
|
-
STANDARD_ALG_IDS = {
|
|
48588
|
-
128: 26126,
|
|
48589
|
-
// CALG_AES_128
|
|
48590
|
-
192: 26127,
|
|
48591
|
-
// CALG_AES_192
|
|
48592
|
-
256: 26128
|
|
48593
|
-
// CALG_AES_256
|
|
48594
|
-
};
|
|
48595
|
-
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
48596
|
-
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
48597
|
-
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
48598
|
-
STANDARD_FLAGS = 36;
|
|
48599
|
-
}
|
|
48600
|
-
});
|
|
48601
|
-
|
|
48602
|
-
// crypto/encrypt.ts
|
|
48603
|
-
function container(encryptionInfo, encryptedPackage) {
|
|
48604
|
-
const streams2 = /* @__PURE__ */ new Map();
|
|
48605
|
-
streams2.set("EncryptionInfo", encryptionInfo);
|
|
48606
|
-
streams2.set("EncryptedPackage", encryptedPackage);
|
|
48607
|
-
return new Uint8Array(buildOle2(streams2));
|
|
48608
|
-
}
|
|
48609
|
-
function randomBytes2(size) {
|
|
48610
|
-
const bytes = new Uint8Array(size);
|
|
48611
|
-
getCrypto().getRandomValues(bytes);
|
|
48612
|
-
return bytes;
|
|
48613
|
-
}
|
|
48614
|
-
function padTo(data, blockSize) {
|
|
48615
|
-
const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
|
|
48616
|
-
padded.set(data);
|
|
48617
|
-
return padded;
|
|
48618
|
-
}
|
|
48619
|
-
function withSizePrefix(size, body) {
|
|
48620
|
-
const out = new Uint8Array(8 + body.length);
|
|
48621
|
-
const view = new DataView(out.buffer, 0, 8);
|
|
48622
|
-
view.setUint32(0, size % 4294967296, true);
|
|
48623
|
-
view.setUint32(4, Math.floor(size / 4294967296), true);
|
|
48624
|
-
out.set(body, 8);
|
|
48625
|
-
return out;
|
|
48626
|
-
}
|
|
48627
|
-
async function encryptAgilePackage(packageData, key2, info) {
|
|
48628
|
-
const { hashAlgorithm, saltValue, blockSize } = info.keyData;
|
|
48629
|
-
const padded = padTo(packageData, SEGMENT_SIZE);
|
|
48630
|
-
const encrypted = withSizePrefix(packageData.length, padded);
|
|
48631
|
-
for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
|
|
48632
|
-
const iv = await generateIV(
|
|
48633
|
-
hashAlgorithm,
|
|
48634
|
-
saltValue,
|
|
48635
|
-
uint32LE(start / SEGMENT_SIZE),
|
|
48636
|
-
blockSize
|
|
48637
|
-
);
|
|
48638
|
-
const segment = padded.subarray(start, start + SEGMENT_SIZE);
|
|
48639
|
-
encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
|
|
48640
|
-
}
|
|
48641
|
-
return encrypted;
|
|
48642
|
-
}
|
|
48643
|
-
async function encryptStandardPackage(packageData, key2) {
|
|
48644
|
-
const encryptedData = await aesEcbEncrypt(key2, packageData);
|
|
48645
|
-
return withSizePrefix(packageData.length, encryptedData);
|
|
48646
|
-
}
|
|
48647
|
-
async function encryptAgile(packageData, password, options = {}) {
|
|
48648
|
-
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
48649
|
-
const hashAlgorithm = "SHA-512";
|
|
48650
|
-
const hashSize = 64;
|
|
48651
|
-
const blockSize = 16;
|
|
48652
|
-
const spinCount = options.spinCount ?? 1e5;
|
|
48653
|
-
const keyDataSalt = randomBytes2(16);
|
|
48654
|
-
const pkeSalt = randomBytes2(16);
|
|
48655
|
-
const documentKey = randomBytes2(keyBits / 8);
|
|
48656
|
-
const verifierHashInput = randomBytes2(16);
|
|
48657
|
-
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
48658
|
-
const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
|
|
48659
|
-
const encryptUnder = async (block, data) => {
|
|
48660
|
-
const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
|
|
48661
|
-
return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
|
|
48662
|
-
};
|
|
48663
|
-
const passwordKeyEncryptor = {
|
|
48664
|
-
saltSize: 16,
|
|
48665
|
-
blockSize,
|
|
48666
|
-
keyBits,
|
|
48667
|
-
hashSize,
|
|
48668
|
-
cipherAlgorithm: "AES",
|
|
48669
|
-
cipherChaining: "ChainingModeCBC",
|
|
48670
|
-
hashAlgorithm,
|
|
48671
|
-
saltValue: pkeSalt,
|
|
48672
|
-
spinCount,
|
|
48673
|
-
encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
|
|
48674
|
-
encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
|
|
48675
|
-
encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
|
|
48676
|
-
};
|
|
48677
|
-
const keyData = {
|
|
48678
|
-
saltSize: 16,
|
|
48679
|
-
blockSize,
|
|
48680
|
-
keyBits,
|
|
48681
|
-
hashSize,
|
|
48682
|
-
cipherAlgorithm: "AES",
|
|
48683
|
-
cipherChaining: "ChainingModeCBC",
|
|
48684
|
-
hashAlgorithm,
|
|
48685
|
-
saltValue: keyDataSalt
|
|
48686
|
-
};
|
|
48687
|
-
const info = {
|
|
48688
|
-
keyData};
|
|
48689
|
-
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
|
|
48690
|
-
const hmacKey = randomBytes2(hashSize);
|
|
48691
|
-
const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
|
|
48692
|
-
const encryptIntegrity = async (block, data) => {
|
|
48693
|
-
const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
|
|
48694
|
-
return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
|
|
48695
|
-
};
|
|
48696
|
-
const dataIntegrity = {
|
|
48697
|
-
encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
|
|
48698
|
-
encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
|
|
48699
|
-
};
|
|
48700
|
-
const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
|
|
48701
|
-
return container(buildEncryptionInfoStream(xml), encryptedPackage);
|
|
48702
|
-
}
|
|
48703
|
-
async function encryptStandard(packageData, password, options = {}) {
|
|
48704
|
-
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
48705
|
-
const salt = randomBytes2(16);
|
|
48706
|
-
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
48707
|
-
const verifier = randomBytes2(16);
|
|
48708
|
-
const paddedVerifierHash = new Uint8Array(32);
|
|
48709
|
-
paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
|
|
48710
|
-
const encryptionInfo = buildStandardEncryptionInfoStream(
|
|
48711
|
-
keyBits,
|
|
48712
|
-
salt,
|
|
48713
|
-
await aesEcbEncrypt(key2, verifier),
|
|
48714
|
-
await aesEcbEncrypt(key2, paddedVerifierHash)
|
|
48715
|
-
);
|
|
48716
|
-
return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
|
|
48717
|
-
}
|
|
48718
|
-
var SEGMENT_SIZE;
|
|
48719
|
-
var init_encrypt = __esm({
|
|
48720
|
-
"crypto/encrypt.ts"() {
|
|
48721
|
-
init_ole2_parser_write();
|
|
48722
|
-
init_ooxml_crypto_primitives();
|
|
48723
|
-
init_aes_ecb();
|
|
48724
|
-
init_encryption_info_write();
|
|
48725
|
-
init_key_derivation();
|
|
48726
|
-
SEGMENT_SIZE = 4096;
|
|
48727
|
-
}
|
|
48728
|
-
});
|
|
48729
|
-
|
|
48730
|
-
// crypto/encryption-info.ts
|
|
48731
|
-
function parseEncryptionInfo(data) {
|
|
48732
|
-
if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
|
|
48733
|
-
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
48734
|
-
const versionMajor = view.getUint16(0, true);
|
|
48735
|
-
const versionMinor = view.getUint16(2, true);
|
|
48736
|
-
if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
|
|
48737
|
-
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
48738
|
-
return parseStandardEncryptionInfo(data);
|
|
48739
|
-
}
|
|
48740
|
-
throw new Error(
|
|
48741
|
-
`Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
|
|
48742
|
-
);
|
|
48743
|
-
}
|
|
48744
|
-
function parseStandardEncryptionInfo(data) {
|
|
48745
|
-
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
48746
|
-
const versionMajor = view.getUint16(0, true);
|
|
48747
|
-
const versionMinor = view.getUint16(2, true);
|
|
48748
|
-
const flags = view.getUint32(4, true);
|
|
48749
|
-
const headerSize = view.getUint32(8, true);
|
|
48750
|
-
const headerOffset = 12;
|
|
48751
|
-
const hFlags = view.getUint32(headerOffset, true);
|
|
48752
|
-
const algId = view.getUint32(headerOffset + 8, true);
|
|
48753
|
-
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
48754
|
-
const keySize = view.getUint32(headerOffset + 16, true);
|
|
48755
|
-
const providerType = view.getUint32(headerOffset + 20, true);
|
|
48756
|
-
let cspName = "";
|
|
48757
|
-
const cspEnd = headerOffset + headerSize;
|
|
48758
|
-
for (let i2 = headerOffset + 32; i2 < cspEnd - 1; i2 += 2) {
|
|
48759
|
-
const ch = view.getUint16(i2, true);
|
|
48760
|
-
if (ch === 0) break;
|
|
48761
|
-
cspName += String.fromCharCode(ch);
|
|
48762
|
-
}
|
|
48763
|
-
const verifierOffset = 12 + headerSize;
|
|
48764
|
-
const saltSize = view.getUint32(verifierOffset, true);
|
|
48765
|
-
const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
|
|
48766
|
-
const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
|
|
48767
|
-
const verifierHashSize = view.getUint32(verifierOffset + 36, true);
|
|
48768
|
-
const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
|
|
48769
|
-
const encryptedVerifierHash = new Uint8Array(
|
|
48770
|
-
data.buffer,
|
|
48771
|
-
data.byteOffset + verifierOffset + 40,
|
|
48772
|
-
encryptedVerifierHashLength
|
|
48773
|
-
);
|
|
48774
|
-
return {
|
|
48775
|
-
version: { major: versionMajor, minor: versionMinor },
|
|
48776
|
-
isAgile: false,
|
|
48777
|
-
isStandard: true,
|
|
48778
|
-
flags,
|
|
48779
|
-
headerSize,
|
|
48780
|
-
header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
|
|
48781
|
-
verifier: {
|
|
48782
|
-
saltSize,
|
|
48783
|
-
salt: new Uint8Array(salt),
|
|
48784
|
-
encryptedVerifier: new Uint8Array(encryptedVerifier),
|
|
48785
|
-
verifierHashSize,
|
|
48786
|
-
encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
|
|
48787
|
-
}
|
|
48788
|
-
};
|
|
48789
|
-
}
|
|
48790
|
-
function tagAttribute(xml, tag, attr5) {
|
|
48791
|
-
const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
|
|
48792
|
-
if (!tagMatch) return "";
|
|
48793
|
-
const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr5}="([^"]*)"`, "i"));
|
|
48794
|
-
return attrMatch?.[1] ?? "";
|
|
48795
|
-
}
|
|
48796
|
-
function parseAgileEncryptionInfo(data) {
|
|
48797
|
-
const xml = new TextDecoder("utf-8").decode(data.subarray(8));
|
|
48798
|
-
const keyData = (attr5) => tagAttribute(xml, "keyData", attr5);
|
|
48799
|
-
const integrity = (attr5) => tagAttribute(xml, "dataIntegrity", attr5);
|
|
48800
|
-
const pke = (attr5) => tagAttribute(xml, "encryptedKey", attr5);
|
|
48801
|
-
const int = (value) => parseInt(value, 10);
|
|
48802
|
-
const encryptedHmacKey = integrity("encryptedHmacKey");
|
|
48803
|
-
return {
|
|
48804
|
-
version: { major: 4, minor: 4 },
|
|
48805
|
-
isAgile: true,
|
|
48806
|
-
keyData: {
|
|
48807
|
-
saltSize: int(keyData("saltSize")),
|
|
48808
|
-
blockSize: int(keyData("blockSize")),
|
|
48809
|
-
keyBits: int(keyData("keyBits")),
|
|
48810
|
-
hashSize: int(keyData("hashSize")),
|
|
48811
|
-
cipherAlgorithm: keyData("cipherAlgorithm"),
|
|
48812
|
-
cipherChaining: keyData("cipherChaining"),
|
|
48813
|
-
hashAlgorithm: keyData("hashAlgorithm"),
|
|
48814
|
-
saltValue: base64Decode(keyData("saltValue"))
|
|
48815
|
-
},
|
|
48816
|
-
...encryptedHmacKey ? {
|
|
48817
|
-
dataIntegrity: {
|
|
48818
|
-
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
48819
|
-
encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
|
|
48820
|
-
}
|
|
48821
|
-
} : {},
|
|
48822
|
-
passwordKeyEncryptor: {
|
|
48823
|
-
saltSize: int(pke("saltSize")),
|
|
48824
|
-
blockSize: int(pke("blockSize")),
|
|
48825
|
-
keyBits: int(pke("keyBits")),
|
|
48826
|
-
hashSize: int(pke("hashSize")),
|
|
48827
|
-
cipherAlgorithm: pke("cipherAlgorithm"),
|
|
48828
|
-
cipherChaining: pke("cipherChaining"),
|
|
48829
|
-
hashAlgorithm: pke("hashAlgorithm"),
|
|
48830
|
-
saltValue: base64Decode(pke("saltValue")),
|
|
48831
|
-
spinCount: int(pke("spinCount")),
|
|
48832
|
-
encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
|
|
48833
|
-
encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
|
|
48834
|
-
encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
|
|
48835
|
-
}
|
|
48836
|
-
};
|
|
48837
|
-
}
|
|
48838
|
-
var RC4_ALG_ID;
|
|
48839
|
-
var init_encryption_info = __esm({
|
|
48840
|
-
"crypto/encryption-info.ts"() {
|
|
48841
|
-
init_ooxml_crypto_primitives();
|
|
48842
|
-
RC4_ALG_ID = 26625;
|
|
48843
|
-
}
|
|
48844
|
-
});
|
|
48845
|
-
|
|
48846
|
-
// crypto/index.ts
|
|
48847
|
-
function streams(bytes) {
|
|
48848
|
-
const opened = openEncryptedPackage(bytes);
|
|
48849
|
-
if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
|
|
48850
|
-
const file = parseOle2(toArrayBuffer(bytes));
|
|
48851
|
-
if (!file.getStream("EncryptionInfo")) {
|
|
48852
|
-
throw new Error(
|
|
48853
|
-
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
48854
|
-
);
|
|
48855
|
-
}
|
|
48856
|
-
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
48857
|
-
}
|
|
48858
|
-
async function decryptOoxmlPackage(input, password) {
|
|
48859
|
-
const { info: infoStream, data } = streams(toBytes(input));
|
|
48860
|
-
const info = parseEncryptionInfo(infoStream);
|
|
48861
|
-
if (isStandard(info)) {
|
|
48862
|
-
const key3 = await verifyStandardPassword(info, password);
|
|
48863
|
-
if (!key3) throw new exports.IncorrectPasswordError();
|
|
48864
|
-
return new Uint8Array(await decryptStandardPackage(data, key3));
|
|
48865
|
-
}
|
|
48866
|
-
const key2 = await verifyAgilePassword(info, password);
|
|
48867
|
-
if (!key2) throw new exports.IncorrectPasswordError();
|
|
48868
|
-
await verifyAgileDataIntegrity(info, key2, data);
|
|
48869
|
-
return new Uint8Array(await decryptAgilePackage(data, key2, info));
|
|
48870
|
-
}
|
|
48871
|
-
function encryptOoxmlPackage(input, password, options = {}) {
|
|
48872
|
-
const bytes = toBytes(input);
|
|
48873
|
-
return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
|
|
48874
|
-
}
|
|
48875
|
-
async function verifyOoxmlPackagePassword(input, password) {
|
|
48876
|
-
try {
|
|
48877
|
-
const opened = openEncryptedPackage(input);
|
|
48878
|
-
if (!opened) return false;
|
|
48879
|
-
const info = parseEncryptionInfo(opened.encryptionInfo);
|
|
48880
|
-
const key2 = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password);
|
|
48881
|
-
return key2 !== null;
|
|
48882
|
-
} catch {
|
|
48883
|
-
return false;
|
|
48884
|
-
}
|
|
48885
|
-
}
|
|
48886
|
-
var isStandard;
|
|
48887
|
-
var init_crypto = __esm({
|
|
48888
|
-
"crypto/index.ts"() {
|
|
48889
|
-
init_ole2_parser_read();
|
|
48890
|
-
init_decrypt();
|
|
48891
|
-
init_detect();
|
|
48892
|
-
init_encrypt();
|
|
48893
|
-
init_encryption_info();
|
|
48894
|
-
init_errors();
|
|
48895
|
-
isStandard = (info) => "isStandard" in info && info.isStandard;
|
|
48896
|
-
}
|
|
48897
|
-
});
|
|
48898
|
-
|
|
48899
|
-
// pptx/core/utils/ooxml-crypto-primitives.ts
|
|
48900
|
-
var init_ooxml_crypto_primitives2 = __esm({
|
|
48901
|
-
"pptx/core/utils/ooxml-crypto-primitives.ts"() {
|
|
48902
|
-
init_ooxml_crypto_primitives();
|
|
48903
|
-
}
|
|
48904
|
-
});
|
|
48905
|
-
|
|
48906
|
-
// pptx/core/utils/ooxml-crypto.ts
|
|
48907
|
-
async function decryptPptx(encryptedBuffer, password) {
|
|
48908
|
-
return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
|
|
48909
|
-
}
|
|
48910
|
-
async function encryptPptx(pptxBuffer, password, options) {
|
|
48911
|
-
return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
|
|
48912
|
-
}
|
|
48913
|
-
function verifyPassword(encryptedBuffer, password) {
|
|
48914
|
-
return verifyOoxmlPackagePassword(encryptedBuffer, password);
|
|
48915
|
-
}
|
|
48916
|
-
var init_ooxml_crypto = __esm({
|
|
48917
|
-
"pptx/core/utils/ooxml-crypto.ts"() {
|
|
48918
|
-
init_crypto();
|
|
48919
|
-
init_errors();
|
|
48920
|
-
}
|
|
48921
|
-
});
|
|
48922
|
-
|
|
48923
|
-
// pptx/core/utils/ole2-parser.ts
|
|
48924
|
-
var init_ole2_parser = __esm({
|
|
48925
|
-
"pptx/core/utils/ole2-parser.ts"() {
|
|
48926
|
-
init_ole2_parser_types2();
|
|
48927
|
-
init_ole2_parser_read2();
|
|
48928
|
-
init_ole2_parser_write2();
|
|
48929
|
-
}
|
|
48930
|
-
});
|
|
48931
|
-
|
|
48932
|
-
// pptx/core/utils/digests/algorithm-names.ts
|
|
48933
|
-
function normalizeDigestAlgorithmName2(name) {
|
|
48934
|
-
const key2 = name.toUpperCase().replace(/[-_\s]/g, "");
|
|
48935
|
-
return CANONICAL_BY_LOOKUP_KEY2[key2];
|
|
48936
|
-
}
|
|
48937
|
-
var CANONICAL_BY_LOOKUP_KEY2, WEB_CRYPTO_ALGORITHMS;
|
|
48938
|
-
var init_algorithm_names2 = __esm({
|
|
48939
|
-
"pptx/core/utils/digests/algorithm-names.ts"() {
|
|
48940
|
-
CANONICAL_BY_LOOKUP_KEY2 = {
|
|
48941
|
-
SHA1: "SHA-1",
|
|
48942
|
-
SHA256: "SHA-256",
|
|
48943
|
-
SHA384: "SHA-384",
|
|
48944
|
-
SHA512: "SHA-512",
|
|
48945
|
-
MD2: "MD2",
|
|
48946
|
-
MD4: "MD4",
|
|
48947
|
-
MD5: "MD5",
|
|
48948
|
-
RIPEMD128: "RIPEMD-128",
|
|
48949
|
-
RIPEMD160: "RIPEMD-160",
|
|
48950
|
-
WHIRLPOOL: "WHIRLPOOL"
|
|
48951
|
-
};
|
|
48952
|
-
WEB_CRYPTO_ALGORITHMS = /* @__PURE__ */ new Set([
|
|
48953
|
-
"SHA-1",
|
|
48954
|
-
"SHA-256",
|
|
48955
|
-
"SHA-384",
|
|
48956
|
-
"SHA-512"
|
|
48957
|
-
]);
|
|
48958
|
-
}
|
|
48959
|
-
});
|
|
48960
|
-
|
|
48961
|
-
// pptx/core/utils/digests/md2.ts
|
|
47807
|
+
// digest/md2.ts
|
|
48962
47808
|
function transform(state, checksum, block) {
|
|
48963
47809
|
const x = new Uint8Array(48);
|
|
48964
47810
|
x.set(state, 0);
|
|
@@ -48967,17 +47813,17 @@ function transform(state, checksum, block) {
|
|
|
48967
47813
|
x[32 + k] = state[k] ^ block[k];
|
|
48968
47814
|
}
|
|
48969
47815
|
let t = 0;
|
|
48970
|
-
for (let
|
|
47816
|
+
for (let round3 = 0; round3 < 18; round3++) {
|
|
48971
47817
|
for (let k = 0; k < 48; k++) {
|
|
48972
|
-
x[k]
|
|
47818
|
+
x[k] = x[k] ^ S[t];
|
|
48973
47819
|
t = x[k];
|
|
48974
47820
|
}
|
|
48975
|
-
t = t +
|
|
47821
|
+
t = t + round3 & 255;
|
|
48976
47822
|
}
|
|
48977
47823
|
state.set(x.subarray(0, 16));
|
|
48978
47824
|
t = checksum[15];
|
|
48979
47825
|
for (let k = 0; k < 16; k++) {
|
|
48980
|
-
checksum[k]
|
|
47826
|
+
checksum[k] = checksum[k] ^ S[block[k] ^ t];
|
|
48981
47827
|
t = checksum[k];
|
|
48982
47828
|
}
|
|
48983
47829
|
}
|
|
@@ -48996,7 +47842,7 @@ function md2(message) {
|
|
|
48996
47842
|
}
|
|
48997
47843
|
var S;
|
|
48998
47844
|
var init_md2 = __esm({
|
|
48999
|
-
"
|
|
47845
|
+
"digest/md2.ts"() {
|
|
49000
47846
|
S = [
|
|
49001
47847
|
41,
|
|
49002
47848
|
46,
|
|
@@ -49258,171 +48104,89 @@ var init_md2 = __esm({
|
|
|
49258
48104
|
}
|
|
49259
48105
|
});
|
|
49260
48106
|
|
|
49261
|
-
//
|
|
48107
|
+
// digest/bit-ops.ts
|
|
49262
48108
|
function rotl32(x, n) {
|
|
49263
48109
|
return (x << n | x >>> 32 - n) >>> 0;
|
|
49264
48110
|
}
|
|
49265
48111
|
function add32(...values) {
|
|
49266
48112
|
let sum = 0;
|
|
49267
|
-
for (const value of values)
|
|
49268
|
-
sum = sum + value >>> 0;
|
|
49269
|
-
}
|
|
48113
|
+
for (const value of values) sum = sum + value >>> 0;
|
|
49270
48114
|
return sum;
|
|
49271
48115
|
}
|
|
49272
48116
|
function padMd4Style(message) {
|
|
49273
|
-
const bitLength = BigInt(message.length) * 8n;
|
|
49274
48117
|
const paddedLength = message.length + 9 + 63 & -64;
|
|
49275
48118
|
const padded = new Uint8Array(paddedLength);
|
|
49276
48119
|
padded.set(message);
|
|
49277
48120
|
padded[message.length] = 128;
|
|
49278
|
-
new DataView(padded.buffer).setBigUint64(paddedLength - 8,
|
|
48121
|
+
new DataView(padded.buffer).setBigUint64(paddedLength - 8, BigInt(message.length) * 8n, true);
|
|
49279
48122
|
return padded;
|
|
49280
48123
|
}
|
|
49281
|
-
function applyRotatingRound(r, ops, f6, x) {
|
|
49282
|
-
let target = 0;
|
|
49283
|
-
for (const [k, s, addConst] of ops) {
|
|
49284
|
-
const i1 = target + 1 & 3;
|
|
49285
|
-
const i2 = target + 2 & 3;
|
|
49286
|
-
const i3 = target + 3 & 3;
|
|
49287
|
-
r[target] = rotl32(add32(r[target], f6(r[i1], r[i2], r[i3]), x[k], addConst), s);
|
|
49288
|
-
target = target + 3 & 3;
|
|
49289
|
-
}
|
|
49290
|
-
}
|
|
49291
|
-
function applyRotatingRoundWithFeedback(r, ops, f6, x) {
|
|
48124
|
+
function applyRotatingRound(r, ops, f6, x, feedback = false) {
|
|
49292
48125
|
let target = 0;
|
|
49293
48126
|
for (const [k, s, addConst] of ops) {
|
|
49294
48127
|
const i1 = target + 1 & 3;
|
|
49295
|
-
const
|
|
49296
|
-
const
|
|
49297
|
-
|
|
49298
|
-
|
|
48128
|
+
const next = r[i1];
|
|
48129
|
+
const rotated = rotl32(
|
|
48130
|
+
add32(r[target], f6(next, r[target + 2 & 3], r[target + 3 & 3]), x[k], addConst),
|
|
48131
|
+
s
|
|
48132
|
+
);
|
|
48133
|
+
r[target] = feedback ? add32(next, rotated) : rotated;
|
|
49299
48134
|
target = target + 3 & 3;
|
|
49300
48135
|
}
|
|
49301
48136
|
}
|
|
49302
|
-
function mdStyleDigest(message, initialState,
|
|
48137
|
+
function mdStyleDigest(message, initialState, transform7) {
|
|
49303
48138
|
const padded = padMd4Style(message);
|
|
49304
48139
|
const view = new DataView(padded.buffer);
|
|
49305
48140
|
const state = [...initialState];
|
|
49306
|
-
const
|
|
49307
|
-
for (let
|
|
49308
|
-
for (let i2 = 0; i2 < 16; i2++)
|
|
49309
|
-
|
|
49310
|
-
}
|
|
49311
|
-
transform6(state, words);
|
|
48141
|
+
const words2 = new Array(16).fill(0);
|
|
48142
|
+
for (let offset = 0; offset < padded.length; offset += 64) {
|
|
48143
|
+
for (let i2 = 0; i2 < 16; i2++) words2[i2] = view.getUint32(offset + i2 * 4, true);
|
|
48144
|
+
transform7(state, words2);
|
|
49312
48145
|
}
|
|
49313
48146
|
const out = new Uint8Array(state.length * 4);
|
|
49314
48147
|
const outView = new DataView(out.buffer);
|
|
49315
|
-
for (let i2 = 0; i2 < state.length; i2++)
|
|
49316
|
-
outView.setUint32(i2 * 4, state[i2], true);
|
|
49317
|
-
}
|
|
48148
|
+
for (let i2 = 0; i2 < state.length; i2++) outView.setUint32(i2 * 4, state[i2], true);
|
|
49318
48149
|
return out;
|
|
49319
48150
|
}
|
|
49320
48151
|
var init_bit_ops = __esm({
|
|
49321
|
-
"
|
|
48152
|
+
"digest/bit-ops.ts"() {
|
|
49322
48153
|
}
|
|
49323
48154
|
});
|
|
49324
48155
|
|
|
49325
|
-
//
|
|
49326
|
-
function
|
|
49327
|
-
return
|
|
49328
|
-
}
|
|
49329
|
-
function f2(x, y, z) {
|
|
49330
|
-
return x & y | x & z | y & z;
|
|
49331
|
-
}
|
|
49332
|
-
function f3(x, y, z) {
|
|
49333
|
-
return x ^ y ^ z;
|
|
48156
|
+
// digest/md4.ts
|
|
48157
|
+
function round(order, shifts, k) {
|
|
48158
|
+
return order.map((word, i2) => [word, shifts[i2 % 4], k]);
|
|
49334
48159
|
}
|
|
49335
48160
|
function transform2(state, x) {
|
|
49336
48161
|
const r = [...state];
|
|
49337
48162
|
applyRotatingRound(r, ROUND1, f1, x);
|
|
49338
48163
|
applyRotatingRound(r, ROUND2, f2, x);
|
|
49339
48164
|
applyRotatingRound(r, ROUND3, f3, x);
|
|
49340
|
-
for (let i2 = 0; i2 < 4; i2++)
|
|
49341
|
-
state[i2] = add32(state[i2], r[i2]);
|
|
49342
|
-
}
|
|
48165
|
+
for (let i2 = 0; i2 < 4; i2++) state[i2] = add32(state[i2], r[i2]);
|
|
49343
48166
|
}
|
|
49344
48167
|
function md4(message) {
|
|
49345
48168
|
return mdStyleDigest(message, INITIAL_STATE, transform2);
|
|
49346
48169
|
}
|
|
49347
|
-
var INITIAL_STATE,
|
|
48170
|
+
var INITIAL_STATE, K2, K3, f1, f2, f3, SEQUENTIAL, COLUMNS, BIT_REVERSED, ROUND1, ROUND2, ROUND3;
|
|
49348
48171
|
var init_md4 = __esm({
|
|
49349
|
-
"
|
|
48172
|
+
"digest/md4.ts"() {
|
|
49350
48173
|
init_bit_ops();
|
|
49351
48174
|
INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
|
|
49352
|
-
|
|
48175
|
+
K2 = 1518500249;
|
|
49353
48176
|
K3 = 1859775393;
|
|
49354
|
-
|
|
49355
|
-
|
|
49356
|
-
|
|
49357
|
-
|
|
49358
|
-
|
|
49359
|
-
|
|
49360
|
-
|
|
49361
|
-
|
|
49362
|
-
|
|
49363
|
-
[8, 3, 0],
|
|
49364
|
-
[9, 7, 0],
|
|
49365
|
-
[10, 11, 0],
|
|
49366
|
-
[11, 19, 0],
|
|
49367
|
-
[12, 3, 0],
|
|
49368
|
-
[13, 7, 0],
|
|
49369
|
-
[14, 11, 0],
|
|
49370
|
-
[15, 19, 0]
|
|
49371
|
-
];
|
|
49372
|
-
ROUND2 = [
|
|
49373
|
-
[0, 3, K22],
|
|
49374
|
-
[4, 5, K22],
|
|
49375
|
-
[8, 9, K22],
|
|
49376
|
-
[12, 13, K22],
|
|
49377
|
-
[1, 3, K22],
|
|
49378
|
-
[5, 5, K22],
|
|
49379
|
-
[9, 9, K22],
|
|
49380
|
-
[13, 13, K22],
|
|
49381
|
-
[2, 3, K22],
|
|
49382
|
-
[6, 5, K22],
|
|
49383
|
-
[10, 9, K22],
|
|
49384
|
-
[14, 13, K22],
|
|
49385
|
-
[3, 3, K22],
|
|
49386
|
-
[7, 5, K22],
|
|
49387
|
-
[11, 9, K22],
|
|
49388
|
-
[15, 13, K22]
|
|
49389
|
-
];
|
|
49390
|
-
ROUND3 = [
|
|
49391
|
-
[0, 3, K3],
|
|
49392
|
-
[8, 9, K3],
|
|
49393
|
-
[4, 11, K3],
|
|
49394
|
-
[12, 15, K3],
|
|
49395
|
-
[2, 3, K3],
|
|
49396
|
-
[10, 9, K3],
|
|
49397
|
-
[6, 11, K3],
|
|
49398
|
-
[14, 15, K3],
|
|
49399
|
-
[1, 3, K3],
|
|
49400
|
-
[9, 9, K3],
|
|
49401
|
-
[5, 11, K3],
|
|
49402
|
-
[13, 15, K3],
|
|
49403
|
-
[3, 3, K3],
|
|
49404
|
-
[11, 9, K3],
|
|
49405
|
-
[7, 11, K3],
|
|
49406
|
-
[15, 15, K3]
|
|
49407
|
-
];
|
|
48177
|
+
f1 = (x, y, z) => x & y | ~x & z;
|
|
48178
|
+
f2 = (x, y, z) => x & y | x & z | y & z;
|
|
48179
|
+
f3 = (x, y, z) => x ^ y ^ z;
|
|
48180
|
+
SEQUENTIAL = Array.from({ length: 16 }, (_, i2) => i2);
|
|
48181
|
+
COLUMNS = Array.from({ length: 16 }, (_, i2) => i2 % 4 * 4 + (i2 >> 2));
|
|
48182
|
+
BIT_REVERSED = [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15];
|
|
48183
|
+
ROUND1 = round(SEQUENTIAL, [3, 7, 11, 19], 0);
|
|
48184
|
+
ROUND2 = round(COLUMNS, [3, 5, 9, 13], K2);
|
|
48185
|
+
ROUND3 = round(BIT_REVERSED, [3, 9, 11, 15], K3);
|
|
49408
48186
|
}
|
|
49409
48187
|
});
|
|
49410
48188
|
|
|
49411
|
-
//
|
|
49412
|
-
var init_md42 = __esm({
|
|
49413
|
-
"pptx/core/utils/digests/md4.ts"() {
|
|
49414
|
-
init_md4();
|
|
49415
|
-
}
|
|
49416
|
-
});
|
|
49417
|
-
|
|
49418
|
-
// pptx/core/utils/digests/bit-ops.ts
|
|
49419
|
-
var init_bit_ops2 = __esm({
|
|
49420
|
-
"pptx/core/utils/digests/bit-ops.ts"() {
|
|
49421
|
-
init_bit_ops();
|
|
49422
|
-
}
|
|
49423
|
-
});
|
|
49424
|
-
|
|
49425
|
-
// pptx/core/utils/digests/md5.ts
|
|
48189
|
+
// digest/md5.ts
|
|
49426
48190
|
function f(x, y, z) {
|
|
49427
48191
|
return x & y | ~x & z;
|
|
49428
48192
|
}
|
|
@@ -49435,18 +48199,18 @@ function h(x, y, z) {
|
|
|
49435
48199
|
function i(x, y, z) {
|
|
49436
48200
|
return y ^ (x | ~z);
|
|
49437
48201
|
}
|
|
49438
|
-
function buildOps(
|
|
49439
|
-
const shifts = SHIFTS[
|
|
49440
|
-
const wordIndex = WORD_INDEX[
|
|
48202
|
+
function buildOps(round3) {
|
|
48203
|
+
const shifts = SHIFTS[round3];
|
|
48204
|
+
const wordIndex = WORD_INDEX[round3];
|
|
49441
48205
|
return Array.from({ length: 16 }, (_, idx) => {
|
|
49442
|
-
const opNumber =
|
|
48206
|
+
const opNumber = round3 * 16 + idx;
|
|
49443
48207
|
return [wordIndex(idx), shifts[idx % 4], T[opNumber]];
|
|
49444
48208
|
});
|
|
49445
48209
|
}
|
|
49446
48210
|
function transform3(state, x) {
|
|
49447
48211
|
const r = [...state];
|
|
49448
|
-
for (let
|
|
49449
|
-
|
|
48212
|
+
for (let round3 = 0; round3 < 4; round3++) {
|
|
48213
|
+
applyRotatingRound(r, ROUNDS[round3], ROUND_FNS[round3], x, true);
|
|
49450
48214
|
}
|
|
49451
48215
|
for (let idx = 0; idx < 4; idx++) {
|
|
49452
48216
|
state[idx] = add32(state[idx], r[idx]);
|
|
@@ -49457,8 +48221,8 @@ function md5(message) {
|
|
|
49457
48221
|
}
|
|
49458
48222
|
var INITIAL_STATE2, T, SHIFTS, WORD_INDEX, ROUND_FNS, ROUNDS;
|
|
49459
48223
|
var init_md5 = __esm({
|
|
49460
|
-
"
|
|
49461
|
-
|
|
48224
|
+
"digest/md5.ts"() {
|
|
48225
|
+
init_bit_ops();
|
|
49462
48226
|
INITIAL_STATE2 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
49463
48227
|
T = Array.from(
|
|
49464
48228
|
{ length: 64 },
|
|
@@ -49481,7 +48245,7 @@ var init_md5 = __esm({
|
|
|
49481
48245
|
}
|
|
49482
48246
|
});
|
|
49483
48247
|
|
|
49484
|
-
//
|
|
48248
|
+
// digest/ripemd-functions.ts
|
|
49485
48249
|
function f12(x, y, z) {
|
|
49486
48250
|
return x ^ y ^ z;
|
|
49487
48251
|
}
|
|
@@ -49498,17 +48262,17 @@ function f5(x, y, z) {
|
|
|
49498
48262
|
return x ^ (y | ~z);
|
|
49499
48263
|
}
|
|
49500
48264
|
var init_ripemd_functions = __esm({
|
|
49501
|
-
"
|
|
48265
|
+
"digest/ripemd-functions.ts"() {
|
|
49502
48266
|
}
|
|
49503
48267
|
});
|
|
49504
48268
|
|
|
49505
|
-
//
|
|
48269
|
+
// digest/ripemd128.ts
|
|
49506
48270
|
function transform4(state, x) {
|
|
49507
48271
|
const left = [...state];
|
|
49508
48272
|
const right = [...state];
|
|
49509
|
-
for (let
|
|
49510
|
-
applyRotatingRound(left, LEFT_ROUNDS[
|
|
49511
|
-
applyRotatingRound(right, RIGHT_ROUNDS[
|
|
48273
|
+
for (let round3 = 0; round3 < 4; round3++) {
|
|
48274
|
+
applyRotatingRound(left, LEFT_ROUNDS[round3], LEFT_FNS[round3], x);
|
|
48275
|
+
applyRotatingRound(right, RIGHT_ROUNDS[round3], RIGHT_FNS[round3], x);
|
|
49512
48276
|
}
|
|
49513
48277
|
const orig = state;
|
|
49514
48278
|
const newState = [
|
|
@@ -49526,8 +48290,8 @@ function ripemd128(message) {
|
|
|
49526
48290
|
}
|
|
49527
48291
|
var INITIAL_STATE3, LEFT_ROUNDS, RIGHT_ROUNDS, LEFT_FNS, RIGHT_FNS;
|
|
49528
48292
|
var init_ripemd128 = __esm({
|
|
49529
|
-
"
|
|
49530
|
-
|
|
48293
|
+
"digest/ripemd128.ts"() {
|
|
48294
|
+
init_bit_ops();
|
|
49531
48295
|
init_ripemd_functions();
|
|
49532
48296
|
INITIAL_STATE3 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
49533
48297
|
LEFT_ROUNDS = [
|
|
@@ -49683,7 +48447,7 @@ var init_ripemd128 = __esm({
|
|
|
49683
48447
|
}
|
|
49684
48448
|
});
|
|
49685
48449
|
|
|
49686
|
-
//
|
|
48450
|
+
// digest/ripemd160.ts
|
|
49687
48451
|
function applyLane(r, ops, f6, x, startTarget) {
|
|
49688
48452
|
let target = startTarget;
|
|
49689
48453
|
for (const [k, s, addConst] of ops) {
|
|
@@ -49691,11 +48455,10 @@ function applyLane(r, ops, f6, x, startTarget) {
|
|
|
49691
48455
|
const i2 = (target + 2) % 5;
|
|
49692
48456
|
const i3 = (target + 3) % 5;
|
|
49693
48457
|
const i4 = (target + 4) % 5;
|
|
49694
|
-
const
|
|
49695
|
-
|
|
49696
|
-
|
|
49697
|
-
);
|
|
49698
|
-
r[i2] = rotl32(r[i2], 10);
|
|
48458
|
+
const sum = r[target] + f6(r[i1], r[i2], r[i3]) + x[k] + addConst >>> 0;
|
|
48459
|
+
const newTarget = (sum << s | sum >>> 32 - s) + r[i4] >>> 0;
|
|
48460
|
+
const c = r[i2];
|
|
48461
|
+
r[i2] = (c << 10 | c >>> 22) >>> 0;
|
|
49699
48462
|
r[target] = newTarget;
|
|
49700
48463
|
target = (target + 4) % 5;
|
|
49701
48464
|
}
|
|
@@ -49706,9 +48469,9 @@ function transform5(state, x) {
|
|
|
49706
48469
|
const right = [...state];
|
|
49707
48470
|
let leftTarget = 0;
|
|
49708
48471
|
let rightTarget = 0;
|
|
49709
|
-
for (let
|
|
49710
|
-
leftTarget = applyLane(left, LEFT_ROUNDS2[
|
|
49711
|
-
rightTarget = applyLane(right, RIGHT_ROUNDS2[
|
|
48472
|
+
for (let round3 = 0; round3 < 5; round3++) {
|
|
48473
|
+
leftTarget = applyLane(left, LEFT_ROUNDS2[round3], LEFT_FNS2[round3], x, leftTarget);
|
|
48474
|
+
rightTarget = applyLane(right, RIGHT_ROUNDS2[round3], RIGHT_FNS2[round3], x, rightTarget);
|
|
49712
48475
|
}
|
|
49713
48476
|
const orig = state;
|
|
49714
48477
|
const newState = [
|
|
@@ -49727,8 +48490,8 @@ function ripemd160(message) {
|
|
|
49727
48490
|
}
|
|
49728
48491
|
var INITIAL_STATE4, LEFT_ROUNDS2, RIGHT_ROUNDS2, LEFT_FNS2, RIGHT_FNS2;
|
|
49729
48492
|
var init_ripemd160 = __esm({
|
|
49730
|
-
"
|
|
49731
|
-
|
|
48493
|
+
"digest/ripemd160.ts"() {
|
|
48494
|
+
init_bit_ops();
|
|
49732
48495
|
init_ripemd_functions();
|
|
49733
48496
|
INITIAL_STATE4 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
49734
48497
|
LEFT_ROUNDS2 = [
|
|
@@ -49823,107 +48586,591 @@ var init_ripemd160 = __esm({
|
|
|
49823
48586
|
[13, 6, 2840853838]
|
|
49824
48587
|
]
|
|
49825
48588
|
];
|
|
49826
|
-
RIGHT_ROUNDS2 = [
|
|
49827
|
-
[
|
|
49828
|
-
[5, 8, 1352829926],
|
|
49829
|
-
[14, 9, 1352829926],
|
|
49830
|
-
[7, 9, 1352829926],
|
|
49831
|
-
[0, 11, 1352829926],
|
|
49832
|
-
[9, 13, 1352829926],
|
|
49833
|
-
[2, 15, 1352829926],
|
|
49834
|
-
[11, 15, 1352829926],
|
|
49835
|
-
[4, 5, 1352829926],
|
|
49836
|
-
[13, 7, 1352829926],
|
|
49837
|
-
[6, 7, 1352829926],
|
|
49838
|
-
[15, 8, 1352829926],
|
|
49839
|
-
[8, 11, 1352829926],
|
|
49840
|
-
[1, 14, 1352829926],
|
|
49841
|
-
[10, 14, 1352829926],
|
|
49842
|
-
[3, 12, 1352829926],
|
|
49843
|
-
[12, 6, 1352829926]
|
|
49844
|
-
],
|
|
49845
|
-
[
|
|
49846
|
-
[6, 9, 1548603684],
|
|
49847
|
-
[11, 13, 1548603684],
|
|
49848
|
-
[3, 15, 1548603684],
|
|
49849
|
-
[7, 7, 1548603684],
|
|
49850
|
-
[0, 12, 1548603684],
|
|
49851
|
-
[13, 8, 1548603684],
|
|
49852
|
-
[5, 9, 1548603684],
|
|
49853
|
-
[10, 11, 1548603684],
|
|
49854
|
-
[14, 7, 1548603684],
|
|
49855
|
-
[15, 7, 1548603684],
|
|
49856
|
-
[8, 12, 1548603684],
|
|
49857
|
-
[12, 7, 1548603684],
|
|
49858
|
-
[4, 6, 1548603684],
|
|
49859
|
-
[9, 15, 1548603684],
|
|
49860
|
-
[1, 13, 1548603684],
|
|
49861
|
-
[2, 11, 1548603684]
|
|
49862
|
-
],
|
|
49863
|
-
[
|
|
49864
|
-
[15, 9, 1836072691],
|
|
49865
|
-
[5, 7, 1836072691],
|
|
49866
|
-
[1, 15, 1836072691],
|
|
49867
|
-
[3, 11, 1836072691],
|
|
49868
|
-
[7, 8, 1836072691],
|
|
49869
|
-
[14, 6, 1836072691],
|
|
49870
|
-
[6, 6, 1836072691],
|
|
49871
|
-
[9, 14, 1836072691],
|
|
49872
|
-
[11, 12, 1836072691],
|
|
49873
|
-
[8, 13, 1836072691],
|
|
49874
|
-
[12, 5, 1836072691],
|
|
49875
|
-
[2, 14, 1836072691],
|
|
49876
|
-
[10, 13, 1836072691],
|
|
49877
|
-
[0, 13, 1836072691],
|
|
49878
|
-
[4, 7, 1836072691],
|
|
49879
|
-
[13, 5, 1836072691]
|
|
49880
|
-
],
|
|
49881
|
-
[
|
|
49882
|
-
[8, 15, 2053994217],
|
|
49883
|
-
[6, 5, 2053994217],
|
|
49884
|
-
[4, 8, 2053994217],
|
|
49885
|
-
[1, 11, 2053994217],
|
|
49886
|
-
[3, 14, 2053994217],
|
|
49887
|
-
[11, 14, 2053994217],
|
|
49888
|
-
[15, 6, 2053994217],
|
|
49889
|
-
[0, 14, 2053994217],
|
|
49890
|
-
[5, 6, 2053994217],
|
|
49891
|
-
[12, 9, 2053994217],
|
|
49892
|
-
[2, 12, 2053994217],
|
|
49893
|
-
[13, 9, 2053994217],
|
|
49894
|
-
[9, 12, 2053994217],
|
|
49895
|
-
[7, 5, 2053994217],
|
|
49896
|
-
[10, 15, 2053994217],
|
|
49897
|
-
[14, 8, 2053994217]
|
|
49898
|
-
],
|
|
49899
|
-
[
|
|
49900
|
-
[12, 8, 0],
|
|
49901
|
-
[15, 5, 0],
|
|
49902
|
-
[10, 12, 0],
|
|
49903
|
-
[4, 9, 0],
|
|
49904
|
-
[1, 12, 0],
|
|
49905
|
-
[5, 5, 0],
|
|
49906
|
-
[8, 14, 0],
|
|
49907
|
-
[7, 6, 0],
|
|
49908
|
-
[6, 8, 0],
|
|
49909
|
-
[2, 13, 0],
|
|
49910
|
-
[13, 6, 0],
|
|
49911
|
-
[14, 5, 0],
|
|
49912
|
-
[0, 15, 0],
|
|
49913
|
-
[3, 13, 0],
|
|
49914
|
-
[9, 11, 0],
|
|
49915
|
-
[11, 11, 0]
|
|
49916
|
-
]
|
|
48589
|
+
RIGHT_ROUNDS2 = [
|
|
48590
|
+
[
|
|
48591
|
+
[5, 8, 1352829926],
|
|
48592
|
+
[14, 9, 1352829926],
|
|
48593
|
+
[7, 9, 1352829926],
|
|
48594
|
+
[0, 11, 1352829926],
|
|
48595
|
+
[9, 13, 1352829926],
|
|
48596
|
+
[2, 15, 1352829926],
|
|
48597
|
+
[11, 15, 1352829926],
|
|
48598
|
+
[4, 5, 1352829926],
|
|
48599
|
+
[13, 7, 1352829926],
|
|
48600
|
+
[6, 7, 1352829926],
|
|
48601
|
+
[15, 8, 1352829926],
|
|
48602
|
+
[8, 11, 1352829926],
|
|
48603
|
+
[1, 14, 1352829926],
|
|
48604
|
+
[10, 14, 1352829926],
|
|
48605
|
+
[3, 12, 1352829926],
|
|
48606
|
+
[12, 6, 1352829926]
|
|
48607
|
+
],
|
|
48608
|
+
[
|
|
48609
|
+
[6, 9, 1548603684],
|
|
48610
|
+
[11, 13, 1548603684],
|
|
48611
|
+
[3, 15, 1548603684],
|
|
48612
|
+
[7, 7, 1548603684],
|
|
48613
|
+
[0, 12, 1548603684],
|
|
48614
|
+
[13, 8, 1548603684],
|
|
48615
|
+
[5, 9, 1548603684],
|
|
48616
|
+
[10, 11, 1548603684],
|
|
48617
|
+
[14, 7, 1548603684],
|
|
48618
|
+
[15, 7, 1548603684],
|
|
48619
|
+
[8, 12, 1548603684],
|
|
48620
|
+
[12, 7, 1548603684],
|
|
48621
|
+
[4, 6, 1548603684],
|
|
48622
|
+
[9, 15, 1548603684],
|
|
48623
|
+
[1, 13, 1548603684],
|
|
48624
|
+
[2, 11, 1548603684]
|
|
48625
|
+
],
|
|
48626
|
+
[
|
|
48627
|
+
[15, 9, 1836072691],
|
|
48628
|
+
[5, 7, 1836072691],
|
|
48629
|
+
[1, 15, 1836072691],
|
|
48630
|
+
[3, 11, 1836072691],
|
|
48631
|
+
[7, 8, 1836072691],
|
|
48632
|
+
[14, 6, 1836072691],
|
|
48633
|
+
[6, 6, 1836072691],
|
|
48634
|
+
[9, 14, 1836072691],
|
|
48635
|
+
[11, 12, 1836072691],
|
|
48636
|
+
[8, 13, 1836072691],
|
|
48637
|
+
[12, 5, 1836072691],
|
|
48638
|
+
[2, 14, 1836072691],
|
|
48639
|
+
[10, 13, 1836072691],
|
|
48640
|
+
[0, 13, 1836072691],
|
|
48641
|
+
[4, 7, 1836072691],
|
|
48642
|
+
[13, 5, 1836072691]
|
|
48643
|
+
],
|
|
48644
|
+
[
|
|
48645
|
+
[8, 15, 2053994217],
|
|
48646
|
+
[6, 5, 2053994217],
|
|
48647
|
+
[4, 8, 2053994217],
|
|
48648
|
+
[1, 11, 2053994217],
|
|
48649
|
+
[3, 14, 2053994217],
|
|
48650
|
+
[11, 14, 2053994217],
|
|
48651
|
+
[15, 6, 2053994217],
|
|
48652
|
+
[0, 14, 2053994217],
|
|
48653
|
+
[5, 6, 2053994217],
|
|
48654
|
+
[12, 9, 2053994217],
|
|
48655
|
+
[2, 12, 2053994217],
|
|
48656
|
+
[13, 9, 2053994217],
|
|
48657
|
+
[9, 12, 2053994217],
|
|
48658
|
+
[7, 5, 2053994217],
|
|
48659
|
+
[10, 15, 2053994217],
|
|
48660
|
+
[14, 8, 2053994217]
|
|
48661
|
+
],
|
|
48662
|
+
[
|
|
48663
|
+
[12, 8, 0],
|
|
48664
|
+
[15, 5, 0],
|
|
48665
|
+
[10, 12, 0],
|
|
48666
|
+
[4, 9, 0],
|
|
48667
|
+
[1, 12, 0],
|
|
48668
|
+
[5, 5, 0],
|
|
48669
|
+
[8, 14, 0],
|
|
48670
|
+
[7, 6, 0],
|
|
48671
|
+
[6, 8, 0],
|
|
48672
|
+
[2, 13, 0],
|
|
48673
|
+
[13, 6, 0],
|
|
48674
|
+
[14, 5, 0],
|
|
48675
|
+
[0, 15, 0],
|
|
48676
|
+
[3, 13, 0],
|
|
48677
|
+
[9, 11, 0],
|
|
48678
|
+
[11, 11, 0]
|
|
48679
|
+
]
|
|
48680
|
+
];
|
|
48681
|
+
LEFT_FNS2 = [f12, f22, f32, f4, f5];
|
|
48682
|
+
RIGHT_FNS2 = [f5, f4, f32, f22, f12];
|
|
48683
|
+
}
|
|
48684
|
+
});
|
|
48685
|
+
|
|
48686
|
+
// digest/sha256.ts
|
|
48687
|
+
function compress(h2, view, offset) {
|
|
48688
|
+
for (let i2 = 0; i2 < 16; i2++) W[i2] = view.getUint32(offset + i2 * 4);
|
|
48689
|
+
for (let i2 = 16; i2 < 64; i2++) {
|
|
48690
|
+
const a2 = W[i2 - 15];
|
|
48691
|
+
const b2 = W[i2 - 2];
|
|
48692
|
+
const s0 = rotr(a2, 7) ^ rotr(a2, 18) ^ a2 >>> 3;
|
|
48693
|
+
const s1 = rotr(b2, 17) ^ rotr(b2, 19) ^ b2 >>> 10;
|
|
48694
|
+
W[i2] = W[i2 - 16] + s0 + W[i2 - 7] + s1 >>> 0;
|
|
48695
|
+
}
|
|
48696
|
+
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];
|
|
48697
|
+
for (let i2 = 0; i2 < 64; i2++) {
|
|
48698
|
+
const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
48699
|
+
const ch = e & f6 ^ ~e & g2;
|
|
48700
|
+
const t1 = k + S1 + ch + K[i2] + W[i2] >>> 0;
|
|
48701
|
+
const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
48702
|
+
const maj = a & b ^ a & c ^ b & c;
|
|
48703
|
+
const t2 = S0 + maj >>> 0;
|
|
48704
|
+
k = g2;
|
|
48705
|
+
g2 = f6;
|
|
48706
|
+
f6 = e;
|
|
48707
|
+
e = d + t1 >>> 0;
|
|
48708
|
+
d = c;
|
|
48709
|
+
c = b;
|
|
48710
|
+
b = a;
|
|
48711
|
+
a = t1 + t2 >>> 0;
|
|
48712
|
+
}
|
|
48713
|
+
h2[0] = h2[0] + a >>> 0;
|
|
48714
|
+
h2[1] = h2[1] + b >>> 0;
|
|
48715
|
+
h2[2] = h2[2] + c >>> 0;
|
|
48716
|
+
h2[3] = h2[3] + d >>> 0;
|
|
48717
|
+
h2[4] = h2[4] + e >>> 0;
|
|
48718
|
+
h2[5] = h2[5] + f6 >>> 0;
|
|
48719
|
+
h2[6] = h2[6] + g2 >>> 0;
|
|
48720
|
+
h2[7] = h2[7] + k >>> 0;
|
|
48721
|
+
}
|
|
48722
|
+
function pad64(data) {
|
|
48723
|
+
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
48724
|
+
padded.set(data);
|
|
48725
|
+
padded[data.length] = 128;
|
|
48726
|
+
const bits = data.length * 8;
|
|
48727
|
+
const view = new DataView(padded.buffer);
|
|
48728
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
48729
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
48730
|
+
return view;
|
|
48731
|
+
}
|
|
48732
|
+
function wordsOut(h2) {
|
|
48733
|
+
const out = new Uint8Array(h2.length * 4);
|
|
48734
|
+
const view = new DataView(out.buffer);
|
|
48735
|
+
for (let i2 = 0; i2 < h2.length; i2++) view.setUint32(i2 * 4, h2[i2]);
|
|
48736
|
+
return out;
|
|
48737
|
+
}
|
|
48738
|
+
function sha256(data) {
|
|
48739
|
+
const h2 = new Uint32Array(IV);
|
|
48740
|
+
const view = pad64(data);
|
|
48741
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress(h2, view, offset);
|
|
48742
|
+
return wordsOut(h2);
|
|
48743
|
+
}
|
|
48744
|
+
var K, IV, W, rotr;
|
|
48745
|
+
var init_sha256 = __esm({
|
|
48746
|
+
"digest/sha256.ts"() {
|
|
48747
|
+
K = new Uint32Array([
|
|
48748
|
+
1116352408,
|
|
48749
|
+
1899447441,
|
|
48750
|
+
3049323471,
|
|
48751
|
+
3921009573,
|
|
48752
|
+
961987163,
|
|
48753
|
+
1508970993,
|
|
48754
|
+
2453635748,
|
|
48755
|
+
2870763221,
|
|
48756
|
+
3624381080,
|
|
48757
|
+
310598401,
|
|
48758
|
+
607225278,
|
|
48759
|
+
1426881987,
|
|
48760
|
+
1925078388,
|
|
48761
|
+
2162078206,
|
|
48762
|
+
2614888103,
|
|
48763
|
+
3248222580,
|
|
48764
|
+
3835390401,
|
|
48765
|
+
4022224774,
|
|
48766
|
+
264347078,
|
|
48767
|
+
604807628,
|
|
48768
|
+
770255983,
|
|
48769
|
+
1249150122,
|
|
48770
|
+
1555081692,
|
|
48771
|
+
1996064986,
|
|
48772
|
+
2554220882,
|
|
48773
|
+
2821834349,
|
|
48774
|
+
2952996808,
|
|
48775
|
+
3210313671,
|
|
48776
|
+
3336571891,
|
|
48777
|
+
3584528711,
|
|
48778
|
+
113926993,
|
|
48779
|
+
338241895,
|
|
48780
|
+
666307205,
|
|
48781
|
+
773529912,
|
|
48782
|
+
1294757372,
|
|
48783
|
+
1396182291,
|
|
48784
|
+
1695183700,
|
|
48785
|
+
1986661051,
|
|
48786
|
+
2177026350,
|
|
48787
|
+
2456956037,
|
|
48788
|
+
2730485921,
|
|
48789
|
+
2820302411,
|
|
48790
|
+
3259730800,
|
|
48791
|
+
3345764771,
|
|
48792
|
+
3516065817,
|
|
48793
|
+
3600352804,
|
|
48794
|
+
4094571909,
|
|
48795
|
+
275423344,
|
|
48796
|
+
430227734,
|
|
48797
|
+
506948616,
|
|
48798
|
+
659060556,
|
|
48799
|
+
883997877,
|
|
48800
|
+
958139571,
|
|
48801
|
+
1322822218,
|
|
48802
|
+
1537002063,
|
|
48803
|
+
1747873779,
|
|
48804
|
+
1955562222,
|
|
48805
|
+
2024104815,
|
|
48806
|
+
2227730452,
|
|
48807
|
+
2361852424,
|
|
48808
|
+
2428436474,
|
|
48809
|
+
2756734187,
|
|
48810
|
+
3204031479,
|
|
48811
|
+
3329325298
|
|
48812
|
+
]);
|
|
48813
|
+
IV = [
|
|
48814
|
+
1779033703,
|
|
48815
|
+
3144134277,
|
|
48816
|
+
1013904242,
|
|
48817
|
+
2773480762,
|
|
48818
|
+
1359893119,
|
|
48819
|
+
2600822924,
|
|
48820
|
+
528734635,
|
|
48821
|
+
1541459225
|
|
48822
|
+
];
|
|
48823
|
+
W = new Uint32Array(64);
|
|
48824
|
+
rotr = (x, n) => x >>> n | x << 32 - n;
|
|
48825
|
+
}
|
|
48826
|
+
});
|
|
48827
|
+
|
|
48828
|
+
// digest/sha1.ts
|
|
48829
|
+
function compress2(h2, view, offset) {
|
|
48830
|
+
for (let i2 = 0; i2 < 16; i2++) W2[i2] = view.getUint32(offset + i2 * 4);
|
|
48831
|
+
for (let i2 = 16; i2 < 80; i2++) W2[i2] = rotl(W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16], 1);
|
|
48832
|
+
let a = h2[0], b = h2[1], c = h2[2], d = h2[3], e = h2[4];
|
|
48833
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
48834
|
+
let f6;
|
|
48835
|
+
let k;
|
|
48836
|
+
if (i2 < 20) {
|
|
48837
|
+
f6 = b & c | ~b & d;
|
|
48838
|
+
k = 1518500249;
|
|
48839
|
+
} else if (i2 < 40) {
|
|
48840
|
+
f6 = b ^ c ^ d;
|
|
48841
|
+
k = 1859775393;
|
|
48842
|
+
} else if (i2 < 60) {
|
|
48843
|
+
f6 = b & c | b & d | c & d;
|
|
48844
|
+
k = 2400959708;
|
|
48845
|
+
} else {
|
|
48846
|
+
f6 = b ^ c ^ d;
|
|
48847
|
+
k = 3395469782;
|
|
48848
|
+
}
|
|
48849
|
+
const t = rotl(a, 5) + f6 + e + k + W2[i2] >>> 0;
|
|
48850
|
+
e = d;
|
|
48851
|
+
d = c;
|
|
48852
|
+
c = rotl(b, 30) >>> 0;
|
|
48853
|
+
b = a;
|
|
48854
|
+
a = t;
|
|
48855
|
+
}
|
|
48856
|
+
h2[0] = h2[0] + a >>> 0;
|
|
48857
|
+
h2[1] = h2[1] + b >>> 0;
|
|
48858
|
+
h2[2] = h2[2] + c >>> 0;
|
|
48859
|
+
h2[3] = h2[3] + d >>> 0;
|
|
48860
|
+
h2[4] = h2[4] + e >>> 0;
|
|
48861
|
+
}
|
|
48862
|
+
function sha1(data) {
|
|
48863
|
+
const h2 = new Uint32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
|
|
48864
|
+
const view = pad64(data);
|
|
48865
|
+
for (let offset = 0; offset < view.byteLength; offset += 64) compress2(h2, view, offset);
|
|
48866
|
+
return wordsOut(h2);
|
|
48867
|
+
}
|
|
48868
|
+
var W2, rotl;
|
|
48869
|
+
var init_sha1 = __esm({
|
|
48870
|
+
"digest/sha1.ts"() {
|
|
48871
|
+
init_sha256();
|
|
48872
|
+
W2 = new Uint32Array(80);
|
|
48873
|
+
rotl = (x, n) => x << n | x >>> 32 - n;
|
|
48874
|
+
}
|
|
48875
|
+
});
|
|
48876
|
+
|
|
48877
|
+
// digest/sha512.ts
|
|
48878
|
+
function compress3(h2, data, offset) {
|
|
48879
|
+
for (let i2 = 0; i2 < 32; i2++) {
|
|
48880
|
+
const o = offset + i2 * 4;
|
|
48881
|
+
W3[i2] = (data[o] << 24 | data[o + 1] << 16 | data[o + 2] << 8 | data[o + 3]) >>> 0;
|
|
48882
|
+
}
|
|
48883
|
+
for (let i2 = 16; i2 < 80; i2++) {
|
|
48884
|
+
const xh = W3[(i2 - 15) * 2];
|
|
48885
|
+
const xl = W3[(i2 - 15) * 2 + 1];
|
|
48886
|
+
const s0h = (xh >>> 1 | xl << 31) ^ (xh >>> 8 | xl << 24) ^ xh >>> 7;
|
|
48887
|
+
const s0l = (xl >>> 1 | xh << 31) ^ (xl >>> 8 | xh << 24) ^ (xl >>> 7 | xh << 25);
|
|
48888
|
+
const yh = W3[(i2 - 2) * 2];
|
|
48889
|
+
const yl = W3[(i2 - 2) * 2 + 1];
|
|
48890
|
+
const s1h = (yh >>> 19 | yl << 13) ^ (yl >>> 29 | yh << 3) ^ yh >>> 6;
|
|
48891
|
+
const s1l = (yl >>> 19 | yh << 13) ^ (yh >>> 29 | yl << 3) ^ (yl >>> 6 | yh << 26);
|
|
48892
|
+
let lo = (s0l >>> 0) + (s1l >>> 0) + W3[(i2 - 7) * 2 + 1] + W3[(i2 - 16) * 2 + 1];
|
|
48893
|
+
const hi = s0h + s1h + W3[(i2 - 7) * 2] + W3[(i2 - 16) * 2] + Math.floor(lo / 4294967296);
|
|
48894
|
+
lo >>>= 0;
|
|
48895
|
+
W3[i2 * 2] = hi >>> 0;
|
|
48896
|
+
W3[i2 * 2 + 1] = lo;
|
|
48897
|
+
}
|
|
48898
|
+
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];
|
|
48899
|
+
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];
|
|
48900
|
+
for (let i2 = 0; i2 < 80; i2++) {
|
|
48901
|
+
const S1h = (eh >>> 14 | el << 18) ^ (eh >>> 18 | el << 14) ^ (el >>> 9 | eh << 23);
|
|
48902
|
+
const S1l = (el >>> 14 | eh << 18) ^ (el >>> 18 | eh << 14) ^ (eh >>> 9 | el << 23);
|
|
48903
|
+
const chh = eh & fh ^ ~eh & gh;
|
|
48904
|
+
const chl = el & fl ^ ~el & gl;
|
|
48905
|
+
let t1l = (hl >>> 0) + (S1l >>> 0) + (chl >>> 0) + K4[i2 * 2 + 1] + W3[i2 * 2 + 1];
|
|
48906
|
+
const t1h = hh + S1h + chh + K4[i2 * 2] + W3[i2 * 2] + Math.floor(t1l / 4294967296);
|
|
48907
|
+
t1l >>>= 0;
|
|
48908
|
+
const S0h = (ah >>> 28 | al << 4) ^ (al >>> 2 | ah << 30) ^ (al >>> 7 | ah << 25);
|
|
48909
|
+
const S0l = (al >>> 28 | ah << 4) ^ (ah >>> 2 | al << 30) ^ (ah >>> 7 | al << 25);
|
|
48910
|
+
const majh = ah & bh ^ ah & ch ^ bh & ch;
|
|
48911
|
+
const majl = al & bl ^ al & cl ^ bl & cl;
|
|
48912
|
+
let t2l = (S0l >>> 0) + (majl >>> 0);
|
|
48913
|
+
const t2h = S0h + majh + Math.floor(t2l / 4294967296);
|
|
48914
|
+
t2l >>>= 0;
|
|
48915
|
+
hh = gh;
|
|
48916
|
+
hl = gl;
|
|
48917
|
+
gh = fh;
|
|
48918
|
+
gl = fl;
|
|
48919
|
+
fh = eh;
|
|
48920
|
+
fl = el;
|
|
48921
|
+
let nl = (dl >>> 0) + t1l;
|
|
48922
|
+
eh = dh + t1h + Math.floor(nl / 4294967296) >>> 0;
|
|
48923
|
+
el = nl >>> 0;
|
|
48924
|
+
dh = ch;
|
|
48925
|
+
dl = cl;
|
|
48926
|
+
ch = bh;
|
|
48927
|
+
cl = bl;
|
|
48928
|
+
bh = ah;
|
|
48929
|
+
bl = al;
|
|
48930
|
+
nl = t1l + t2l;
|
|
48931
|
+
ah = t1h + t2h + Math.floor(nl / 4294967296) >>> 0;
|
|
48932
|
+
al = nl >>> 0;
|
|
48933
|
+
}
|
|
48934
|
+
const add7 = (i2, xh, xl) => {
|
|
48935
|
+
const lo = (h2[i2 + 1] >>> 0) + (xl >>> 0);
|
|
48936
|
+
h2[i2] = h2[i2] + xh + Math.floor(lo / 4294967296) >>> 0;
|
|
48937
|
+
h2[i2 + 1] = lo >>> 0;
|
|
48938
|
+
};
|
|
48939
|
+
add7(0, ah, al);
|
|
48940
|
+
add7(2, bh, bl);
|
|
48941
|
+
add7(4, ch, cl);
|
|
48942
|
+
add7(6, dh, dl);
|
|
48943
|
+
add7(8, eh, el);
|
|
48944
|
+
add7(10, fh, fl);
|
|
48945
|
+
add7(12, gh, gl);
|
|
48946
|
+
add7(14, hh, hl);
|
|
48947
|
+
}
|
|
48948
|
+
function digest64(data, iv, bytes) {
|
|
48949
|
+
const h2 = new Uint32Array(iv);
|
|
48950
|
+
const padded = new Uint8Array(Math.ceil((data.length + 17) / 128) * 128);
|
|
48951
|
+
padded.set(data);
|
|
48952
|
+
padded[data.length] = 128;
|
|
48953
|
+
const bits = data.length * 8;
|
|
48954
|
+
const view = new DataView(padded.buffer);
|
|
48955
|
+
view.setUint32(padded.length - 8, Math.floor(bits / 4294967296));
|
|
48956
|
+
view.setUint32(padded.length - 4, bits >>> 0);
|
|
48957
|
+
for (let offset = 0; offset < padded.length; offset += 128) compress3(h2, padded, offset);
|
|
48958
|
+
const out = new Uint8Array(bytes);
|
|
48959
|
+
const outView = new DataView(out.buffer);
|
|
48960
|
+
for (let i2 = 0; i2 < bytes / 4; i2++) outView.setUint32(i2 * 4, h2[i2]);
|
|
48961
|
+
return out;
|
|
48962
|
+
}
|
|
48963
|
+
var K4, IV_512, IV_384, W3, sha512, sha384;
|
|
48964
|
+
var init_sha512 = __esm({
|
|
48965
|
+
"digest/sha512.ts"() {
|
|
48966
|
+
K4 = new Uint32Array([
|
|
48967
|
+
1116352408,
|
|
48968
|
+
3609767458,
|
|
48969
|
+
1899447441,
|
|
48970
|
+
602891725,
|
|
48971
|
+
3049323471,
|
|
48972
|
+
3964484399,
|
|
48973
|
+
3921009573,
|
|
48974
|
+
2173295548,
|
|
48975
|
+
961987163,
|
|
48976
|
+
4081628472,
|
|
48977
|
+
1508970993,
|
|
48978
|
+
3053834265,
|
|
48979
|
+
2453635748,
|
|
48980
|
+
2937671579,
|
|
48981
|
+
2870763221,
|
|
48982
|
+
3664609560,
|
|
48983
|
+
3624381080,
|
|
48984
|
+
2734883394,
|
|
48985
|
+
310598401,
|
|
48986
|
+
1164996542,
|
|
48987
|
+
607225278,
|
|
48988
|
+
1323610764,
|
|
48989
|
+
1426881987,
|
|
48990
|
+
3590304994,
|
|
48991
|
+
1925078388,
|
|
48992
|
+
4068182383,
|
|
48993
|
+
2162078206,
|
|
48994
|
+
991336113,
|
|
48995
|
+
2614888103,
|
|
48996
|
+
633803317,
|
|
48997
|
+
3248222580,
|
|
48998
|
+
3479774868,
|
|
48999
|
+
3835390401,
|
|
49000
|
+
2666613458,
|
|
49001
|
+
4022224774,
|
|
49002
|
+
944711139,
|
|
49003
|
+
264347078,
|
|
49004
|
+
2341262773,
|
|
49005
|
+
604807628,
|
|
49006
|
+
2007800933,
|
|
49007
|
+
770255983,
|
|
49008
|
+
1495990901,
|
|
49009
|
+
1249150122,
|
|
49010
|
+
1856431235,
|
|
49011
|
+
1555081692,
|
|
49012
|
+
3175218132,
|
|
49013
|
+
1996064986,
|
|
49014
|
+
2198950837,
|
|
49015
|
+
2554220882,
|
|
49016
|
+
3999719339,
|
|
49017
|
+
2821834349,
|
|
49018
|
+
766784016,
|
|
49019
|
+
2952996808,
|
|
49020
|
+
2566594879,
|
|
49021
|
+
3210313671,
|
|
49022
|
+
3203337956,
|
|
49023
|
+
3336571891,
|
|
49024
|
+
1034457026,
|
|
49025
|
+
3584528711,
|
|
49026
|
+
2466948901,
|
|
49027
|
+
113926993,
|
|
49028
|
+
3758326383,
|
|
49029
|
+
338241895,
|
|
49030
|
+
168717936,
|
|
49031
|
+
666307205,
|
|
49032
|
+
1188179964,
|
|
49033
|
+
773529912,
|
|
49034
|
+
1546045734,
|
|
49035
|
+
1294757372,
|
|
49036
|
+
1522805485,
|
|
49037
|
+
1396182291,
|
|
49038
|
+
2643833823,
|
|
49039
|
+
1695183700,
|
|
49040
|
+
2343527390,
|
|
49041
|
+
1986661051,
|
|
49042
|
+
1014477480,
|
|
49043
|
+
2177026350,
|
|
49044
|
+
1206759142,
|
|
49045
|
+
2456956037,
|
|
49046
|
+
344077627,
|
|
49047
|
+
2730485921,
|
|
49048
|
+
1290863460,
|
|
49049
|
+
2820302411,
|
|
49050
|
+
3158454273,
|
|
49051
|
+
3259730800,
|
|
49052
|
+
3505952657,
|
|
49053
|
+
3345764771,
|
|
49054
|
+
106217008,
|
|
49055
|
+
3516065817,
|
|
49056
|
+
3606008344,
|
|
49057
|
+
3600352804,
|
|
49058
|
+
1432725776,
|
|
49059
|
+
4094571909,
|
|
49060
|
+
1467031594,
|
|
49061
|
+
275423344,
|
|
49062
|
+
851169720,
|
|
49063
|
+
430227734,
|
|
49064
|
+
3100823752,
|
|
49065
|
+
506948616,
|
|
49066
|
+
1363258195,
|
|
49067
|
+
659060556,
|
|
49068
|
+
3750685593,
|
|
49069
|
+
883997877,
|
|
49070
|
+
3785050280,
|
|
49071
|
+
958139571,
|
|
49072
|
+
3318307427,
|
|
49073
|
+
1322822218,
|
|
49074
|
+
3812723403,
|
|
49075
|
+
1537002063,
|
|
49076
|
+
2003034995,
|
|
49077
|
+
1747873779,
|
|
49078
|
+
3602036899,
|
|
49079
|
+
1955562222,
|
|
49080
|
+
1575990012,
|
|
49081
|
+
2024104815,
|
|
49082
|
+
1125592928,
|
|
49083
|
+
2227730452,
|
|
49084
|
+
2716904306,
|
|
49085
|
+
2361852424,
|
|
49086
|
+
442776044,
|
|
49087
|
+
2428436474,
|
|
49088
|
+
593698344,
|
|
49089
|
+
2756734187,
|
|
49090
|
+
3733110249,
|
|
49091
|
+
3204031479,
|
|
49092
|
+
2999351573,
|
|
49093
|
+
3329325298,
|
|
49094
|
+
3815920427,
|
|
49095
|
+
3391569614,
|
|
49096
|
+
3928383900,
|
|
49097
|
+
3515267271,
|
|
49098
|
+
566280711,
|
|
49099
|
+
3940187606,
|
|
49100
|
+
3454069534,
|
|
49101
|
+
4118630271,
|
|
49102
|
+
4000239992,
|
|
49103
|
+
116418474,
|
|
49104
|
+
1914138554,
|
|
49105
|
+
174292421,
|
|
49106
|
+
2731055270,
|
|
49107
|
+
289380356,
|
|
49108
|
+
3203993006,
|
|
49109
|
+
460393269,
|
|
49110
|
+
320620315,
|
|
49111
|
+
685471733,
|
|
49112
|
+
587496836,
|
|
49113
|
+
852142971,
|
|
49114
|
+
1086792851,
|
|
49115
|
+
1017036298,
|
|
49116
|
+
365543100,
|
|
49117
|
+
1126000580,
|
|
49118
|
+
2618297676,
|
|
49119
|
+
1288033470,
|
|
49120
|
+
3409855158,
|
|
49121
|
+
1501505948,
|
|
49122
|
+
4234509866,
|
|
49123
|
+
1607167915,
|
|
49124
|
+
987167468,
|
|
49125
|
+
1816402316,
|
|
49126
|
+
1246189591
|
|
49127
|
+
]);
|
|
49128
|
+
IV_512 = [
|
|
49129
|
+
1779033703,
|
|
49130
|
+
4089235720,
|
|
49131
|
+
3144134277,
|
|
49132
|
+
2227873595,
|
|
49133
|
+
1013904242,
|
|
49134
|
+
4271175723,
|
|
49135
|
+
2773480762,
|
|
49136
|
+
1595750129,
|
|
49137
|
+
1359893119,
|
|
49138
|
+
2917565137,
|
|
49139
|
+
2600822924,
|
|
49140
|
+
725511199,
|
|
49141
|
+
528734635,
|
|
49142
|
+
4215389547,
|
|
49143
|
+
1541459225,
|
|
49144
|
+
327033209
|
|
49145
|
+
];
|
|
49146
|
+
IV_384 = [
|
|
49147
|
+
3418070365,
|
|
49148
|
+
3238371032,
|
|
49149
|
+
1654270250,
|
|
49150
|
+
914150663,
|
|
49151
|
+
2438529370,
|
|
49152
|
+
812702999,
|
|
49153
|
+
355462360,
|
|
49154
|
+
4144912697,
|
|
49155
|
+
1731405415,
|
|
49156
|
+
4290775857,
|
|
49157
|
+
2394180231,
|
|
49158
|
+
1750603025,
|
|
49159
|
+
3675008525,
|
|
49160
|
+
1694076839,
|
|
49161
|
+
1203062813,
|
|
49162
|
+
3204075428
|
|
49917
49163
|
];
|
|
49918
|
-
|
|
49919
|
-
|
|
49164
|
+
W3 = new Uint32Array(160);
|
|
49165
|
+
sha512 = (data) => digest64(data, IV_512, 64);
|
|
49166
|
+
sha384 = (data) => digest64(data, IV_384, 48);
|
|
49920
49167
|
}
|
|
49921
49168
|
});
|
|
49922
49169
|
|
|
49923
|
-
//
|
|
49170
|
+
// digest/whirlpool-sbox.ts
|
|
49924
49171
|
var TABLE0;
|
|
49925
49172
|
var init_whirlpool_sbox = __esm({
|
|
49926
|
-
"
|
|
49173
|
+
"digest/whirlpool-sbox.ts"() {
|
|
49927
49174
|
TABLE0 = [
|
|
49928
49175
|
0x18186018c07830d8n,
|
|
49929
49176
|
0x23238c2305af4626n,
|
|
@@ -50185,183 +49432,812 @@ var init_whirlpool_sbox = __esm({
|
|
|
50185
49432
|
}
|
|
50186
49433
|
});
|
|
50187
49434
|
|
|
50188
|
-
//
|
|
50189
|
-
function rotateBytesRight(value, bytes) {
|
|
50190
|
-
const bits = BigInt(bytes) * 8n;
|
|
50191
|
-
return (value >> bits | value << 64n - bits) & WORD_MASK;
|
|
49435
|
+
// digest/whirlpool-table.ts
|
|
49436
|
+
function rotateBytesRight(value, bytes) {
|
|
49437
|
+
const bits = BigInt(bytes) * 8n;
|
|
49438
|
+
return (value >> bits | value << 64n - bits) & WORD_MASK;
|
|
49439
|
+
}
|
|
49440
|
+
var WORD_MASK, LOW_MASK, TABLES_HI, TABLES_LO, ROUND_CONSTANTS, ROUND_CONSTANTS_HI, ROUND_CONSTANTS_LO;
|
|
49441
|
+
var init_whirlpool_table = __esm({
|
|
49442
|
+
"digest/whirlpool-table.ts"() {
|
|
49443
|
+
init_whirlpool_sbox();
|
|
49444
|
+
WORD_MASK = (1n << 64n) - 1n;
|
|
49445
|
+
LOW_MASK = 0xffffffffn;
|
|
49446
|
+
TABLES_HI = new Uint32Array(8 * 256);
|
|
49447
|
+
TABLES_LO = new Uint32Array(8 * 256);
|
|
49448
|
+
for (let t = 0; t < 8; t++) {
|
|
49449
|
+
for (let x = 0; x < 256; x++) {
|
|
49450
|
+
const value = t === 0 ? TABLE0[x] : rotateBytesRight(TABLE0[x], t);
|
|
49451
|
+
TABLES_HI[t * 256 + x] = Number(value >> 32n);
|
|
49452
|
+
TABLES_LO[t * 256 + x] = Number(value & LOW_MASK);
|
|
49453
|
+
}
|
|
49454
|
+
}
|
|
49455
|
+
ROUND_CONSTANTS = [
|
|
49456
|
+
0x1823c6e887b8014fn,
|
|
49457
|
+
0x36a6d2f5796f9152n,
|
|
49458
|
+
0x60bc9b8ea30c7b35n,
|
|
49459
|
+
0x1de0d7c22e4bfe57n,
|
|
49460
|
+
0x157737e59ff04adan,
|
|
49461
|
+
0x58c9290ab1a06b85n,
|
|
49462
|
+
0xbd5d10f4cb3e0567n,
|
|
49463
|
+
0xe427418ba77d95d8n,
|
|
49464
|
+
0xfbee7c66dd17479en,
|
|
49465
|
+
0xca2dbf07ad5a8333n
|
|
49466
|
+
];
|
|
49467
|
+
ROUND_CONSTANTS_HI = Uint32Array.from(ROUND_CONSTANTS, (c) => Number(c >> 32n));
|
|
49468
|
+
ROUND_CONSTANTS_LO = Uint32Array.from(ROUND_CONSTANTS, (c) => Number(c & LOW_MASK));
|
|
49469
|
+
}
|
|
49470
|
+
});
|
|
49471
|
+
|
|
49472
|
+
// digest/whirlpool.ts
|
|
49473
|
+
function op(src, column, out) {
|
|
49474
|
+
const { hi: h2, lo: l } = src;
|
|
49475
|
+
const b0 = h2[column] >>> 24;
|
|
49476
|
+
const b1 = h2[column + 7 & 7] >>> 16 & 255;
|
|
49477
|
+
const b2 = h2[column + 6 & 7] >>> 8 & 255;
|
|
49478
|
+
const b3 = h2[column + 5 & 7] & 255;
|
|
49479
|
+
const b4 = l[column + 4 & 7] >>> 24;
|
|
49480
|
+
const b5 = l[column + 3 & 7] >>> 16 & 255;
|
|
49481
|
+
const b6 = l[column + 2 & 7] >>> 8 & 255;
|
|
49482
|
+
const b7 = l[column + 1 & 7] & 255;
|
|
49483
|
+
out.hi[column] = TABLES_HI2[b0] ^ TABLES_HI2[256 + b1] ^ TABLES_HI2[512 + b2] ^ TABLES_HI2[768 + b3] ^ TABLES_HI2[1024 + b4] ^ TABLES_HI2[1280 + b5] ^ TABLES_HI2[1536 + b6] ^ TABLES_HI2[1792 + b7];
|
|
49484
|
+
out.lo[column] = TABLES_LO2[b0] ^ TABLES_LO2[256 + b1] ^ TABLES_LO2[512 + b2] ^ TABLES_LO2[768 + b3] ^ TABLES_LO2[1024 + b4] ^ TABLES_LO2[1280 + b5] ^ TABLES_LO2[1536 + b6] ^ TABLES_LO2[1792 + b7];
|
|
49485
|
+
}
|
|
49486
|
+
function processBlock(hash2, block) {
|
|
49487
|
+
const { key: key2, state, initial, nextKey, next } = scratch;
|
|
49488
|
+
for (let i2 = 0; i2 < WORDS; i2++) {
|
|
49489
|
+
initial.hi[i2] = block.hi[i2] ^ hash2.hi[i2];
|
|
49490
|
+
initial.lo[i2] = block.lo[i2] ^ hash2.lo[i2];
|
|
49491
|
+
}
|
|
49492
|
+
key2.hi.set(hash2.hi);
|
|
49493
|
+
key2.lo.set(hash2.lo);
|
|
49494
|
+
state.hi.set(initial.hi);
|
|
49495
|
+
state.lo.set(initial.lo);
|
|
49496
|
+
for (let round3 = 0; round3 < ROUNDS2; round3++) {
|
|
49497
|
+
for (let j = 0; j < WORDS; j++) op(key2, j, nextKey);
|
|
49498
|
+
nextKey.hi[0] = nextKey.hi[0] ^ ROUND_CONSTANTS_HI2[round3];
|
|
49499
|
+
nextKey.lo[0] = nextKey.lo[0] ^ ROUND_CONSTANTS_LO2[round3];
|
|
49500
|
+
for (let j = 0; j < WORDS; j++) {
|
|
49501
|
+
op(state, j, next);
|
|
49502
|
+
next.hi[j] = next.hi[j] ^ nextKey.hi[j];
|
|
49503
|
+
next.lo[j] = next.lo[j] ^ nextKey.lo[j];
|
|
49504
|
+
}
|
|
49505
|
+
key2.hi.set(nextKey.hi);
|
|
49506
|
+
key2.lo.set(nextKey.lo);
|
|
49507
|
+
state.hi.set(next.hi);
|
|
49508
|
+
state.lo.set(next.lo);
|
|
49509
|
+
}
|
|
49510
|
+
for (let i2 = 0; i2 < WORDS; i2++) {
|
|
49511
|
+
hash2.hi[i2] = initial.hi[i2] ^ state.hi[i2];
|
|
49512
|
+
hash2.lo[i2] = initial.lo[i2] ^ state.lo[i2];
|
|
49513
|
+
}
|
|
49514
|
+
}
|
|
49515
|
+
function pad(message) {
|
|
49516
|
+
let total = message.length + 1;
|
|
49517
|
+
while (total % BLOCK_BYTES !== 32) {
|
|
49518
|
+
total++;
|
|
49519
|
+
}
|
|
49520
|
+
total += 32;
|
|
49521
|
+
const padded = new Uint8Array(total);
|
|
49522
|
+
padded.set(message);
|
|
49523
|
+
padded[message.length] = 128;
|
|
49524
|
+
new DataView(padded.buffer).setBigUint64(total - 8, BigInt(message.length) * 8n, false);
|
|
49525
|
+
return padded;
|
|
49526
|
+
}
|
|
49527
|
+
function whirlpool(message) {
|
|
49528
|
+
const padded = pad(message);
|
|
49529
|
+
const view = new DataView(padded.buffer);
|
|
49530
|
+
const hash2 = words();
|
|
49531
|
+
const block = words();
|
|
49532
|
+
for (let offset = 0; offset < padded.length; offset += BLOCK_BYTES) {
|
|
49533
|
+
for (let i2 = 0; i2 < WORDS; i2++) {
|
|
49534
|
+
block.hi[i2] = view.getUint32(offset + i2 * 8, false);
|
|
49535
|
+
block.lo[i2] = view.getUint32(offset + i2 * 8 + 4, false);
|
|
49536
|
+
}
|
|
49537
|
+
processBlock(hash2, block);
|
|
49538
|
+
}
|
|
49539
|
+
const out = new Uint8Array(BLOCK_BYTES);
|
|
49540
|
+
const outView = new DataView(out.buffer);
|
|
49541
|
+
for (let i2 = 0; i2 < WORDS; i2++) {
|
|
49542
|
+
outView.setUint32(i2 * 8, hash2.hi[i2], false);
|
|
49543
|
+
outView.setUint32(i2 * 8 + 4, hash2.lo[i2], false);
|
|
49544
|
+
}
|
|
49545
|
+
return out;
|
|
49546
|
+
}
|
|
49547
|
+
var TABLES_HI2, TABLES_LO2, ROUND_CONSTANTS_HI2, ROUND_CONSTANTS_LO2, BLOCK_BYTES, WORDS, ROUNDS2, words, scratch;
|
|
49548
|
+
var init_whirlpool = __esm({
|
|
49549
|
+
"digest/whirlpool.ts"() {
|
|
49550
|
+
init_whirlpool_table();
|
|
49551
|
+
TABLES_HI2 = TABLES_HI;
|
|
49552
|
+
TABLES_LO2 = TABLES_LO;
|
|
49553
|
+
ROUND_CONSTANTS_HI2 = ROUND_CONSTANTS_HI;
|
|
49554
|
+
ROUND_CONSTANTS_LO2 = ROUND_CONSTANTS_LO;
|
|
49555
|
+
BLOCK_BYTES = 64;
|
|
49556
|
+
WORDS = 8;
|
|
49557
|
+
ROUNDS2 = 10;
|
|
49558
|
+
words = () => ({ hi: new Uint32Array(WORDS), lo: new Uint32Array(WORDS) });
|
|
49559
|
+
scratch = { key: words(), state: words(), initial: words(), nextKey: words(), next: words() };
|
|
49560
|
+
}
|
|
49561
|
+
});
|
|
49562
|
+
|
|
49563
|
+
// digest/digest.ts
|
|
49564
|
+
function digestFunction(name) {
|
|
49565
|
+
const canonical = normalizeDigestAlgorithmName(name);
|
|
49566
|
+
return canonical && DIGESTS[canonical];
|
|
49567
|
+
}
|
|
49568
|
+
var DIGESTS;
|
|
49569
|
+
var init_digest2 = __esm({
|
|
49570
|
+
"digest/digest.ts"() {
|
|
49571
|
+
init_algorithm_names();
|
|
49572
|
+
init_md2();
|
|
49573
|
+
init_md4();
|
|
49574
|
+
init_md5();
|
|
49575
|
+
init_ripemd128();
|
|
49576
|
+
init_ripemd160();
|
|
49577
|
+
init_sha1();
|
|
49578
|
+
init_sha256();
|
|
49579
|
+
init_sha512();
|
|
49580
|
+
init_whirlpool();
|
|
49581
|
+
DIGESTS = {
|
|
49582
|
+
"SHA-1": sha1,
|
|
49583
|
+
"SHA-256": sha256,
|
|
49584
|
+
"SHA-384": sha384,
|
|
49585
|
+
"SHA-512": sha512,
|
|
49586
|
+
MD2: md2,
|
|
49587
|
+
MD4: md4,
|
|
49588
|
+
MD5: md5,
|
|
49589
|
+
"RIPEMD-128": ripemd128,
|
|
49590
|
+
"RIPEMD-160": ripemd160,
|
|
49591
|
+
WHIRLPOOL: whirlpool
|
|
49592
|
+
};
|
|
49593
|
+
}
|
|
49594
|
+
});
|
|
49595
|
+
|
|
49596
|
+
// crypto/key-derivation.ts
|
|
49597
|
+
async function spinPassword(password, salt, spinCount, hashAlgorithm) {
|
|
49598
|
+
if (!Number.isInteger(spinCount) || spinCount < 0 || spinCount > MAX_SPIN_COUNT) {
|
|
49599
|
+
throw new Error(`Unsupported encryption spin count: ${spinCount}.`);
|
|
49600
|
+
}
|
|
49601
|
+
const passwordBytes = encodePasswordUtf16LE(password);
|
|
49602
|
+
const digest = digestFunction(hashAlgorithm);
|
|
49603
|
+
if (digest) {
|
|
49604
|
+
let h3 = digest(concatArrays(salt, passwordBytes));
|
|
49605
|
+
const buffer = new Uint8Array(4 + h3.length);
|
|
49606
|
+
const view = new DataView(buffer.buffer);
|
|
49607
|
+
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
49608
|
+
view.setUint32(0, i2, true);
|
|
49609
|
+
buffer.set(h3, 4);
|
|
49610
|
+
h3 = digest(buffer);
|
|
49611
|
+
}
|
|
49612
|
+
return h3;
|
|
49613
|
+
}
|
|
49614
|
+
let h2 = await hash(hashAlgorithm, concatArrays(salt, passwordBytes));
|
|
49615
|
+
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
49616
|
+
h2 = await hash(hashAlgorithm, concatArrays(uint32LE(i2), h2));
|
|
49617
|
+
}
|
|
49618
|
+
return h2;
|
|
49619
|
+
}
|
|
49620
|
+
async function extendKey(h2, hashAlgorithm, keyLength) {
|
|
49621
|
+
const pad2 = async (value) => {
|
|
49622
|
+
const input = new Uint8Array(64).fill(value);
|
|
49623
|
+
for (let i2 = 0; i2 < h2.length && i2 < 64; i2++) input[i2] = h2[i2] ^ value;
|
|
49624
|
+
return hash(hashAlgorithm, input);
|
|
49625
|
+
};
|
|
49626
|
+
const x3 = concatArrays(await pad2(54), await pad2(92));
|
|
49627
|
+
return x3.subarray(0, keyLength);
|
|
49628
|
+
}
|
|
49629
|
+
function computeAgileKeyBase(password, salt, spinCount, hashAlgorithm) {
|
|
49630
|
+
return spinPassword(password, salt, spinCount, hashAlgorithm);
|
|
49631
|
+
}
|
|
49632
|
+
async function deriveAgileKeyFromBase(base, hashAlgorithm, blockKey, keyBits, hashSize) {
|
|
49633
|
+
const h2 = await hash(hashAlgorithm, concatArrays(base, blockKey));
|
|
49634
|
+
const keyLength = keyBits / 8;
|
|
49635
|
+
if (hashSize >= keyLength) return h2.subarray(0, keyLength);
|
|
49636
|
+
return extendKey(h2, hashAlgorithm, keyLength);
|
|
49637
|
+
}
|
|
49638
|
+
function computeStandardKeyBase(password, salt) {
|
|
49639
|
+
return spinPassword(password, salt, 5e4, "SHA-1");
|
|
49640
|
+
}
|
|
49641
|
+
async function deriveStandardKeyFromBase(base, keySize, blockNumber = 0) {
|
|
49642
|
+
const h2 = await hash("SHA-1", concatArrays(base, uint32LE(blockNumber)));
|
|
49643
|
+
return extendKey(h2, "SHA-1", keySize / 8);
|
|
49644
|
+
}
|
|
49645
|
+
async function deriveStandardKey(password, salt, keySize, _algIdHash, blockNumber = 0) {
|
|
49646
|
+
const base = await computeStandardKeyBase(password, salt);
|
|
49647
|
+
return deriveStandardKeyFromBase(base, keySize, blockNumber);
|
|
49648
|
+
}
|
|
49649
|
+
async function generateIV(hashAlgorithm, salt, blockKey, blockSize) {
|
|
49650
|
+
const h2 = await hash(hashAlgorithm, concatArrays(salt, blockKey));
|
|
49651
|
+
if (h2.length >= blockSize) return h2.subarray(0, blockSize);
|
|
49652
|
+
const padded = new Uint8Array(blockSize).fill(54);
|
|
49653
|
+
padded.set(h2);
|
|
49654
|
+
return padded;
|
|
49655
|
+
}
|
|
49656
|
+
var BLOCK_KEYS, MAX_SPIN_COUNT;
|
|
49657
|
+
var init_key_derivation = __esm({
|
|
49658
|
+
"crypto/key-derivation.ts"() {
|
|
49659
|
+
init_ooxml_crypto_primitives();
|
|
49660
|
+
init_digest2();
|
|
49661
|
+
BLOCK_KEYS = {
|
|
49662
|
+
verifierHashInput: new Uint8Array([254, 167, 210, 118, 59, 75, 158, 121]),
|
|
49663
|
+
verifierHashValue: new Uint8Array([215, 170, 15, 109, 48, 97, 52, 78]),
|
|
49664
|
+
encryptedKeyValue: new Uint8Array([20, 110, 11, 231, 171, 172, 208, 214]),
|
|
49665
|
+
dataIntegrityHmacKey: new Uint8Array([95, 178, 173, 1, 12, 185, 225, 246]),
|
|
49666
|
+
dataIntegrityHmacValue: new Uint8Array([160, 103, 127, 2, 178, 44, 132, 51])
|
|
49667
|
+
};
|
|
49668
|
+
MAX_SPIN_COUNT = 1e7;
|
|
49669
|
+
}
|
|
49670
|
+
});
|
|
49671
|
+
|
|
49672
|
+
// crypto/decrypt.ts
|
|
49673
|
+
async function verifyAgilePassword(info, password) {
|
|
49674
|
+
const pke = info.passwordKeyEncryptor;
|
|
49675
|
+
const base = await computeAgileKeyBase(password, pke.saltValue, pke.spinCount, pke.hashAlgorithm);
|
|
49676
|
+
const blockKey = (block) => deriveAgileKeyFromBase(base, pke.hashAlgorithm, block, pke.keyBits, pke.hashSize);
|
|
49677
|
+
const verifierHashInput = await aesCbcDecryptRaw(
|
|
49678
|
+
await blockKey(BLOCK_KEYS.verifierHashInput),
|
|
49679
|
+
pke.saltValue,
|
|
49680
|
+
pke.encryptedVerifierHashInput
|
|
49681
|
+
);
|
|
49682
|
+
const verifierHashValue = await aesCbcDecryptRaw(
|
|
49683
|
+
await blockKey(BLOCK_KEYS.verifierHashValue),
|
|
49684
|
+
pke.saltValue,
|
|
49685
|
+
pke.encryptedVerifierHashValue
|
|
49686
|
+
);
|
|
49687
|
+
const computedHash = await hash(pke.hashAlgorithm, verifierHashInput.subarray(0, pke.saltSize));
|
|
49688
|
+
if (computedHash.length < pke.hashSize || verifierHashValue.length < pke.hashSize) return null;
|
|
49689
|
+
let difference = 0;
|
|
49690
|
+
for (let i2 = 0; i2 < pke.hashSize; i2++) difference |= verifierHashValue[i2] ^ computedHash[i2];
|
|
49691
|
+
if (difference !== 0) return null;
|
|
49692
|
+
const decryptedKey = await aesCbcDecryptRaw(
|
|
49693
|
+
await blockKey(BLOCK_KEYS.encryptedKeyValue),
|
|
49694
|
+
pke.saltValue,
|
|
49695
|
+
pke.encryptedKeyValue
|
|
49696
|
+
);
|
|
49697
|
+
return decryptedKey.subarray(0, info.keyData.keyBits / 8);
|
|
49698
|
+
}
|
|
49699
|
+
async function verifyStandardPassword(info, password) {
|
|
49700
|
+
const key2 = await deriveStandardKey(
|
|
49701
|
+
password,
|
|
49702
|
+
info.verifier.salt,
|
|
49703
|
+
info.header.keySize,
|
|
49704
|
+
info.header.algIdHash
|
|
49705
|
+
);
|
|
49706
|
+
const decryptedVerifier = await aesEcbDecrypt(key2, info.verifier.encryptedVerifier);
|
|
49707
|
+
const decryptedHash = await aesEcbDecrypt(key2, info.verifier.encryptedVerifierHash);
|
|
49708
|
+
const computedHash = await hash("SHA-1", decryptedVerifier);
|
|
49709
|
+
const hashSize = info.verifier.verifierHashSize;
|
|
49710
|
+
let match = true;
|
|
49711
|
+
for (let i2 = 0; i2 < Math.min(hashSize, 20); i2++) {
|
|
49712
|
+
if (computedHash[i2] !== decryptedHash[i2]) {
|
|
49713
|
+
match = false;
|
|
49714
|
+
break;
|
|
49715
|
+
}
|
|
49716
|
+
}
|
|
49717
|
+
return match ? key2 : null;
|
|
49718
|
+
}
|
|
49719
|
+
async function verifyAgileDataIntegrity(info, key2, encryptedPackage) {
|
|
49720
|
+
const keyData = info.keyData;
|
|
49721
|
+
if (!info.dataIntegrity) {
|
|
49722
|
+
return;
|
|
49723
|
+
}
|
|
49724
|
+
const hmacKeyIV = await generateIV(
|
|
49725
|
+
keyData.hashAlgorithm,
|
|
49726
|
+
keyData.saltValue,
|
|
49727
|
+
BLOCK_KEYS.dataIntegrityHmacKey,
|
|
49728
|
+
keyData.blockSize
|
|
49729
|
+
);
|
|
49730
|
+
const decryptedHmacKey = await aesCbcDecryptRaw(
|
|
49731
|
+
key2,
|
|
49732
|
+
hmacKeyIV,
|
|
49733
|
+
info.dataIntegrity.encryptedHmacKey
|
|
49734
|
+
);
|
|
49735
|
+
const hmacKey = decryptedHmacKey.subarray(0, keyData.hashSize);
|
|
49736
|
+
const hmacValueIV = await generateIV(
|
|
49737
|
+
keyData.hashAlgorithm,
|
|
49738
|
+
keyData.saltValue,
|
|
49739
|
+
BLOCK_KEYS.dataIntegrityHmacValue,
|
|
49740
|
+
keyData.blockSize
|
|
49741
|
+
);
|
|
49742
|
+
const decryptedHmacValue = await aesCbcDecryptRaw(
|
|
49743
|
+
key2,
|
|
49744
|
+
hmacValueIV,
|
|
49745
|
+
info.dataIntegrity.encryptedHmacValue
|
|
49746
|
+
);
|
|
49747
|
+
const expectedHmac = decryptedHmacValue.subarray(0, keyData.hashSize);
|
|
49748
|
+
const computedHmac = await hmac(keyData.hashAlgorithm, hmacKey, encryptedPackage);
|
|
49749
|
+
let match = true;
|
|
49750
|
+
if (computedHmac.length < keyData.hashSize) {
|
|
49751
|
+
match = false;
|
|
49752
|
+
} else {
|
|
49753
|
+
for (let i2 = 0; i2 < keyData.hashSize; i2++) {
|
|
49754
|
+
if (computedHmac[i2] !== expectedHmac[i2]) {
|
|
49755
|
+
match = false;
|
|
49756
|
+
break;
|
|
49757
|
+
}
|
|
49758
|
+
}
|
|
49759
|
+
}
|
|
49760
|
+
if (!match) {
|
|
49761
|
+
throw new exports.DataIntegrityError(
|
|
49762
|
+
"Data integrity check failed. The encrypted file may be corrupted or tampered with."
|
|
49763
|
+
);
|
|
49764
|
+
}
|
|
49765
|
+
}
|
|
49766
|
+
async function decryptAgilePackage(encryptedPackage, key2, info) {
|
|
49767
|
+
const keyData = info.keyData;
|
|
49768
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
49769
|
+
const originalSize = sizeView.getUint32(0, true) + sizeView.getUint32(4, true) * 4294967296;
|
|
49770
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
49771
|
+
const segmentSize = 4096;
|
|
49772
|
+
const result = new Uint8Array(originalSize);
|
|
49773
|
+
let resultOffset = 0;
|
|
49774
|
+
const numSegments = Math.ceil(encryptedData.length / segmentSize);
|
|
49775
|
+
for (let segment = 0; segment < numSegments; segment++) {
|
|
49776
|
+
const segmentStart = segment * segmentSize;
|
|
49777
|
+
const segmentEnd = Math.min(segmentStart + segmentSize, encryptedData.length);
|
|
49778
|
+
const segmentData = encryptedData.subarray(segmentStart, segmentEnd);
|
|
49779
|
+
const blockKeyBytes = uint32LE(segment);
|
|
49780
|
+
const segmentIV = await generateIV(
|
|
49781
|
+
keyData.hashAlgorithm,
|
|
49782
|
+
keyData.saltValue,
|
|
49783
|
+
blockKeyBytes,
|
|
49784
|
+
keyData.blockSize
|
|
49785
|
+
);
|
|
49786
|
+
const decrypted = await aesCbcDecryptRaw(key2, segmentIV, segmentData);
|
|
49787
|
+
const bytesToCopy = Math.min(decrypted.length, originalSize - resultOffset);
|
|
49788
|
+
result.set(decrypted.subarray(0, bytesToCopy), resultOffset);
|
|
49789
|
+
resultOffset += bytesToCopy;
|
|
49790
|
+
}
|
|
49791
|
+
return result.buffer;
|
|
49792
|
+
}
|
|
49793
|
+
async function decryptStandardPackage(encryptedPackage, key2) {
|
|
49794
|
+
const sizeView = new DataView(encryptedPackage.buffer, encryptedPackage.byteOffset, 8);
|
|
49795
|
+
const originalSize = sizeView.getUint32(0, true);
|
|
49796
|
+
const encryptedData = encryptedPackage.subarray(8);
|
|
49797
|
+
const decrypted = await aesEcbDecrypt(key2, encryptedData);
|
|
49798
|
+
return decrypted.slice(0, originalSize).buffer;
|
|
49799
|
+
}
|
|
49800
|
+
var init_decrypt = __esm({
|
|
49801
|
+
"crypto/decrypt.ts"() {
|
|
49802
|
+
init_ooxml_crypto_primitives();
|
|
49803
|
+
init_aes_ecb();
|
|
49804
|
+
init_errors();
|
|
49805
|
+
init_key_derivation();
|
|
49806
|
+
}
|
|
49807
|
+
});
|
|
49808
|
+
|
|
49809
|
+
// crypto/encryption-info-write.ts
|
|
49810
|
+
function buildAgileEncryptionInfoXml(keyData, pke, dataIntegrity) {
|
|
49811
|
+
const xmlNs = "http://schemas.microsoft.com/office/2006/encryption";
|
|
49812
|
+
const pNs = "http://schemas.microsoft.com/office/2006/keyEncryptor/password";
|
|
49813
|
+
return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
|
|
49814
|
+
<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>`;
|
|
49815
|
+
}
|
|
49816
|
+
function buildEncryptionInfoStream(xmlString) {
|
|
49817
|
+
const xmlBytes = new TextEncoder().encode(xmlString);
|
|
49818
|
+
const result = new Uint8Array(8 + xmlBytes.length);
|
|
49819
|
+
const view = new DataView(result.buffer);
|
|
49820
|
+
view.setUint16(0, 4, true);
|
|
49821
|
+
view.setUint16(2, 4, true);
|
|
49822
|
+
view.setUint32(4, 64, true);
|
|
49823
|
+
result.set(xmlBytes, 8);
|
|
49824
|
+
return result;
|
|
49825
|
+
}
|
|
49826
|
+
function buildStandardEncryptionInfoStream(keyBits, salt, encryptedVerifier, encryptedVerifierHash) {
|
|
49827
|
+
const algId = STANDARD_ALG_IDS[keyBits];
|
|
49828
|
+
if (!algId) {
|
|
49829
|
+
throw new Error(
|
|
49830
|
+
`Unsupported standard encryption key size: ${keyBits} bits. Use 128, 192, or 256.`
|
|
49831
|
+
);
|
|
49832
|
+
}
|
|
49833
|
+
const cspNameBytes = new Uint8Array((STANDARD_CSP_NAME.length + 1) * 2);
|
|
49834
|
+
for (let i2 = 0; i2 < STANDARD_CSP_NAME.length; i2++) {
|
|
49835
|
+
const code = STANDARD_CSP_NAME.charCodeAt(i2);
|
|
49836
|
+
cspNameBytes[i2 * 2] = code & 255;
|
|
49837
|
+
cspNameBytes[i2 * 2 + 1] = code >> 8 & 255;
|
|
49838
|
+
}
|
|
49839
|
+
const headerFixedSize = 32;
|
|
49840
|
+
const headerSize = headerFixedSize + cspNameBytes.length;
|
|
49841
|
+
const verifierSize = 4 + 16 + 16 + 4 + 32;
|
|
49842
|
+
const totalSize = 12 + headerSize + verifierSize;
|
|
49843
|
+
const data = new Uint8Array(totalSize);
|
|
49844
|
+
const view = new DataView(data.buffer);
|
|
49845
|
+
view.setUint16(0, 4, true);
|
|
49846
|
+
view.setUint16(2, 2, true);
|
|
49847
|
+
view.setUint32(4, STANDARD_FLAGS, true);
|
|
49848
|
+
view.setUint32(8, headerSize, true);
|
|
49849
|
+
const h2 = 12;
|
|
49850
|
+
view.setUint32(h2, STANDARD_FLAGS, true);
|
|
49851
|
+
view.setUint32(h2 + 4, 0, true);
|
|
49852
|
+
view.setUint32(h2 + 8, algId, true);
|
|
49853
|
+
view.setUint32(h2 + 12, STANDARD_ALG_ID_HASH_SHA1, true);
|
|
49854
|
+
view.setUint32(h2 + 16, keyBits, true);
|
|
49855
|
+
view.setUint32(h2 + 20, STANDARD_PROVIDER_TYPE_RSA_AES, true);
|
|
49856
|
+
view.setUint32(h2 + 24, 0, true);
|
|
49857
|
+
view.setUint32(h2 + 28, 0, true);
|
|
49858
|
+
data.set(cspNameBytes, h2 + 32);
|
|
49859
|
+
const v = 12 + headerSize;
|
|
49860
|
+
view.setUint32(v, 16, true);
|
|
49861
|
+
data.set(salt.subarray(0, 16), v + 4);
|
|
49862
|
+
data.set(encryptedVerifier.subarray(0, 16), v + 20);
|
|
49863
|
+
view.setUint32(v + 36, 20, true);
|
|
49864
|
+
data.set(encryptedVerifierHash.subarray(0, 32), v + 40);
|
|
49865
|
+
return data;
|
|
49866
|
+
}
|
|
49867
|
+
var STANDARD_ALG_IDS, STANDARD_ALG_ID_HASH_SHA1, STANDARD_PROVIDER_TYPE_RSA_AES, STANDARD_CSP_NAME, STANDARD_FLAGS;
|
|
49868
|
+
var init_encryption_info_write = __esm({
|
|
49869
|
+
"crypto/encryption-info-write.ts"() {
|
|
49870
|
+
init_ooxml_crypto_primitives();
|
|
49871
|
+
STANDARD_ALG_IDS = {
|
|
49872
|
+
128: 26126,
|
|
49873
|
+
// CALG_AES_128
|
|
49874
|
+
192: 26127,
|
|
49875
|
+
// CALG_AES_192
|
|
49876
|
+
256: 26128
|
|
49877
|
+
// CALG_AES_256
|
|
49878
|
+
};
|
|
49879
|
+
STANDARD_ALG_ID_HASH_SHA1 = 32772;
|
|
49880
|
+
STANDARD_PROVIDER_TYPE_RSA_AES = 24;
|
|
49881
|
+
STANDARD_CSP_NAME = "Microsoft Enhanced RSA and AES Cryptographic Provider";
|
|
49882
|
+
STANDARD_FLAGS = 36;
|
|
49883
|
+
}
|
|
49884
|
+
});
|
|
49885
|
+
|
|
49886
|
+
// crypto/encrypt.ts
|
|
49887
|
+
function container(encryptionInfo, encryptedPackage) {
|
|
49888
|
+
const streams2 = /* @__PURE__ */ new Map();
|
|
49889
|
+
streams2.set("EncryptionInfo", encryptionInfo);
|
|
49890
|
+
streams2.set("EncryptedPackage", encryptedPackage);
|
|
49891
|
+
return new Uint8Array(buildOle2(streams2));
|
|
50192
49892
|
}
|
|
50193
|
-
|
|
50194
|
-
|
|
50195
|
-
|
|
50196
|
-
|
|
50197
|
-
|
|
50198
|
-
|
|
50199
|
-
|
|
50200
|
-
|
|
49893
|
+
function randomBytes2(size) {
|
|
49894
|
+
const bytes = new Uint8Array(size);
|
|
49895
|
+
getCrypto().getRandomValues(bytes);
|
|
49896
|
+
return bytes;
|
|
49897
|
+
}
|
|
49898
|
+
function padTo(data, blockSize) {
|
|
49899
|
+
const padded = new Uint8Array(Math.ceil(data.length / blockSize) * blockSize);
|
|
49900
|
+
padded.set(data);
|
|
49901
|
+
return padded;
|
|
49902
|
+
}
|
|
49903
|
+
function withSizePrefix(size, body) {
|
|
49904
|
+
const out = new Uint8Array(8 + body.length);
|
|
49905
|
+
const view = new DataView(out.buffer, 0, 8);
|
|
49906
|
+
view.setUint32(0, size % 4294967296, true);
|
|
49907
|
+
view.setUint32(4, Math.floor(size / 4294967296), true);
|
|
49908
|
+
out.set(body, 8);
|
|
49909
|
+
return out;
|
|
49910
|
+
}
|
|
49911
|
+
async function encryptAgilePackage(packageData, key2, info) {
|
|
49912
|
+
const { hashAlgorithm, saltValue, blockSize } = info.keyData;
|
|
49913
|
+
const padded = padTo(packageData, SEGMENT_SIZE);
|
|
49914
|
+
const encrypted = withSizePrefix(packageData.length, padded);
|
|
49915
|
+
for (let start = 0; start < padded.length; start += SEGMENT_SIZE) {
|
|
49916
|
+
const iv = await generateIV(
|
|
49917
|
+
hashAlgorithm,
|
|
49918
|
+
saltValue,
|
|
49919
|
+
uint32LE(start / SEGMENT_SIZE),
|
|
49920
|
+
blockSize
|
|
50201
49921
|
);
|
|
50202
|
-
|
|
50203
|
-
|
|
50204
|
-
|
|
50205
|
-
|
|
50206
|
-
|
|
50207
|
-
|
|
50208
|
-
|
|
50209
|
-
|
|
50210
|
-
|
|
50211
|
-
|
|
50212
|
-
|
|
50213
|
-
|
|
49922
|
+
const segment = padded.subarray(start, start + SEGMENT_SIZE);
|
|
49923
|
+
encrypted.set(await aesCbcEncryptNoPad(key2, iv, segment), 8 + start);
|
|
49924
|
+
}
|
|
49925
|
+
return encrypted;
|
|
49926
|
+
}
|
|
49927
|
+
async function encryptStandardPackage(packageData, key2) {
|
|
49928
|
+
const encryptedData = await aesEcbEncrypt(key2, packageData);
|
|
49929
|
+
return withSizePrefix(packageData.length, encryptedData);
|
|
49930
|
+
}
|
|
49931
|
+
async function encryptAgile(packageData, password, options = {}) {
|
|
49932
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
49933
|
+
const hashAlgorithm = "SHA-512";
|
|
49934
|
+
const hashSize = 64;
|
|
49935
|
+
const blockSize = 16;
|
|
49936
|
+
const spinCount = options.spinCount ?? 1e5;
|
|
49937
|
+
const keyDataSalt = randomBytes2(16);
|
|
49938
|
+
const pkeSalt = randomBytes2(16);
|
|
49939
|
+
const documentKey = randomBytes2(keyBits / 8);
|
|
49940
|
+
const verifierHashInput = randomBytes2(16);
|
|
49941
|
+
const verifierHash = await hash(hashAlgorithm, verifierHashInput);
|
|
49942
|
+
const base = await computeAgileKeyBase(password, pkeSalt, spinCount, hashAlgorithm);
|
|
49943
|
+
const encryptUnder = async (block, data) => {
|
|
49944
|
+
const key2 = await deriveAgileKeyFromBase(base, hashAlgorithm, block, keyBits, hashSize);
|
|
49945
|
+
return aesCbcEncryptNoPad(key2, pkeSalt, padTo(data, blockSize));
|
|
49946
|
+
};
|
|
49947
|
+
const passwordKeyEncryptor = {
|
|
49948
|
+
saltSize: 16,
|
|
49949
|
+
blockSize,
|
|
49950
|
+
keyBits,
|
|
49951
|
+
hashSize,
|
|
49952
|
+
cipherAlgorithm: "AES",
|
|
49953
|
+
cipherChaining: "ChainingModeCBC",
|
|
49954
|
+
hashAlgorithm,
|
|
49955
|
+
saltValue: pkeSalt,
|
|
49956
|
+
spinCount,
|
|
49957
|
+
encryptedVerifierHashInput: await encryptUnder(BLOCK_KEYS.verifierHashInput, verifierHashInput),
|
|
49958
|
+
encryptedVerifierHashValue: await encryptUnder(BLOCK_KEYS.verifierHashValue, verifierHash),
|
|
49959
|
+
encryptedKeyValue: await encryptUnder(BLOCK_KEYS.encryptedKeyValue, documentKey)
|
|
49960
|
+
};
|
|
49961
|
+
const keyData = {
|
|
49962
|
+
saltSize: 16,
|
|
49963
|
+
blockSize,
|
|
49964
|
+
keyBits,
|
|
49965
|
+
hashSize,
|
|
49966
|
+
cipherAlgorithm: "AES",
|
|
49967
|
+
cipherChaining: "ChainingModeCBC",
|
|
49968
|
+
hashAlgorithm,
|
|
49969
|
+
saltValue: keyDataSalt
|
|
49970
|
+
};
|
|
49971
|
+
const info = {
|
|
49972
|
+
keyData};
|
|
49973
|
+
const encryptedPackage = await encryptAgilePackage(packageData, documentKey, info);
|
|
49974
|
+
const hmacKey = randomBytes2(hashSize);
|
|
49975
|
+
const hmacValue = await hmac(hashAlgorithm, hmacKey, encryptedPackage);
|
|
49976
|
+
const encryptIntegrity = async (block, data) => {
|
|
49977
|
+
const iv = await generateIV(hashAlgorithm, keyDataSalt, block, blockSize);
|
|
49978
|
+
return aesCbcEncryptNoPad(documentKey, iv, padTo(data, blockSize));
|
|
49979
|
+
};
|
|
49980
|
+
const dataIntegrity = {
|
|
49981
|
+
encryptedHmacKey: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacKey, hmacKey),
|
|
49982
|
+
encryptedHmacValue: await encryptIntegrity(BLOCK_KEYS.dataIntegrityHmacValue, hmacValue)
|
|
49983
|
+
};
|
|
49984
|
+
const xml = buildAgileEncryptionInfoXml(keyData, passwordKeyEncryptor, dataIntegrity);
|
|
49985
|
+
return container(buildEncryptionInfoStream(xml), encryptedPackage);
|
|
49986
|
+
}
|
|
49987
|
+
async function encryptStandard(packageData, password, options = {}) {
|
|
49988
|
+
const keyBits = options.algorithm === "AES128" ? 128 : 256;
|
|
49989
|
+
const salt = randomBytes2(16);
|
|
49990
|
+
const key2 = await deriveStandardKey(password, salt, keyBits);
|
|
49991
|
+
const verifier = randomBytes2(16);
|
|
49992
|
+
const paddedVerifierHash = new Uint8Array(32);
|
|
49993
|
+
paddedVerifierHash.set((await hash("SHA-1", verifier)).subarray(0, 20));
|
|
49994
|
+
const encryptionInfo = buildStandardEncryptionInfoStream(
|
|
49995
|
+
keyBits,
|
|
49996
|
+
salt,
|
|
49997
|
+
await aesEcbEncrypt(key2, verifier),
|
|
49998
|
+
await aesEcbEncrypt(key2, paddedVerifierHash)
|
|
49999
|
+
);
|
|
50000
|
+
return container(encryptionInfo, await encryptStandardPackage(packageData, key2));
|
|
50001
|
+
}
|
|
50002
|
+
var SEGMENT_SIZE;
|
|
50003
|
+
var init_encrypt = __esm({
|
|
50004
|
+
"crypto/encrypt.ts"() {
|
|
50005
|
+
init_ole2_parser_write();
|
|
50006
|
+
init_ooxml_crypto_primitives();
|
|
50007
|
+
init_aes_ecb();
|
|
50008
|
+
init_encryption_info_write();
|
|
50009
|
+
init_key_derivation();
|
|
50010
|
+
SEGMENT_SIZE = 4096;
|
|
50214
50011
|
}
|
|
50215
50012
|
});
|
|
50216
50013
|
|
|
50217
|
-
//
|
|
50218
|
-
function
|
|
50219
|
-
|
|
50220
|
-
|
|
50221
|
-
|
|
50222
|
-
|
|
50223
|
-
|
|
50224
|
-
|
|
50014
|
+
// crypto/encryption-info.ts
|
|
50015
|
+
function parseEncryptionInfo(data) {
|
|
50016
|
+
if (data.byteLength < 8) throw new Error("The EncryptionInfo stream is truncated.");
|
|
50017
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
50018
|
+
const versionMajor = view.getUint16(0, true);
|
|
50019
|
+
const versionMinor = view.getUint16(2, true);
|
|
50020
|
+
if (versionMajor === 4 && versionMinor === 4) return parseAgileEncryptionInfo(data);
|
|
50021
|
+
if ((versionMajor === 2 || versionMajor === 3 || versionMajor === 4) && versionMinor === 2) {
|
|
50022
|
+
return parseStandardEncryptionInfo(data);
|
|
50225
50023
|
}
|
|
50226
|
-
|
|
50024
|
+
throw new Error(
|
|
50025
|
+
`Unsupported encryption version: ${versionMajor}.${versionMinor}. Only Standard (2.2-4.2) and Agile (4.4) encryption are supported.`
|
|
50026
|
+
);
|
|
50227
50027
|
}
|
|
50228
|
-
function
|
|
50229
|
-
const
|
|
50230
|
-
|
|
50231
|
-
|
|
50232
|
-
|
|
50233
|
-
|
|
50234
|
-
|
|
50235
|
-
|
|
50028
|
+
function parseStandardEncryptionInfo(data) {
|
|
50029
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
50030
|
+
const versionMajor = view.getUint16(0, true);
|
|
50031
|
+
const versionMinor = view.getUint16(2, true);
|
|
50032
|
+
const flags = view.getUint32(4, true);
|
|
50033
|
+
const headerSize = view.getUint32(8, true);
|
|
50034
|
+
const headerOffset = 12;
|
|
50035
|
+
const hFlags = view.getUint32(headerOffset, true);
|
|
50036
|
+
const algId = view.getUint32(headerOffset + 8, true);
|
|
50037
|
+
const algIdHash = view.getUint32(headerOffset + 12, true);
|
|
50038
|
+
const keySize = view.getUint32(headerOffset + 16, true);
|
|
50039
|
+
const providerType = view.getUint32(headerOffset + 20, true);
|
|
50040
|
+
let cspName = "";
|
|
50041
|
+
const cspEnd = headerOffset + headerSize;
|
|
50042
|
+
for (let i2 = headerOffset + 32; i2 < cspEnd - 1; i2 += 2) {
|
|
50043
|
+
const ch = view.getUint16(i2, true);
|
|
50044
|
+
if (ch === 0) break;
|
|
50045
|
+
cspName += String.fromCharCode(ch);
|
|
50046
|
+
}
|
|
50047
|
+
const verifierOffset = 12 + headerSize;
|
|
50048
|
+
const saltSize = view.getUint32(verifierOffset, true);
|
|
50049
|
+
const salt = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 4, 16);
|
|
50050
|
+
const encryptedVerifier = new Uint8Array(data.buffer, data.byteOffset + verifierOffset + 20, 16);
|
|
50051
|
+
const verifierHashSize = view.getUint32(verifierOffset + 36, true);
|
|
50052
|
+
const encryptedVerifierHashLength = algId === RC4_ALG_ID ? verifierHashSize : Math.ceil(verifierHashSize / 16) * 16;
|
|
50053
|
+
const encryptedVerifierHash = new Uint8Array(
|
|
50054
|
+
data.buffer,
|
|
50055
|
+
data.byteOffset + verifierOffset + 40,
|
|
50056
|
+
encryptedVerifierHashLength
|
|
50057
|
+
);
|
|
50058
|
+
return {
|
|
50059
|
+
version: { major: versionMajor, minor: versionMinor },
|
|
50060
|
+
isAgile: false,
|
|
50061
|
+
isStandard: true,
|
|
50062
|
+
flags,
|
|
50063
|
+
headerSize,
|
|
50064
|
+
header: { flags: hFlags, algId, algIdHash, keySize, providerType, cspName },
|
|
50065
|
+
verifier: {
|
|
50066
|
+
saltSize,
|
|
50067
|
+
salt: new Uint8Array(salt),
|
|
50068
|
+
encryptedVerifier: new Uint8Array(encryptedVerifier),
|
|
50069
|
+
verifierHashSize,
|
|
50070
|
+
encryptedVerifierHash: new Uint8Array(encryptedVerifierHash)
|
|
50236
50071
|
}
|
|
50237
|
-
|
|
50238
|
-
|
|
50239
|
-
|
|
50072
|
+
};
|
|
50073
|
+
}
|
|
50074
|
+
function tagAttribute(xml, tag, attr5) {
|
|
50075
|
+
const tagMatch = xml.match(new RegExp(`<[^>]*${tag}[^>]*>`, "i"));
|
|
50076
|
+
if (!tagMatch) return "";
|
|
50077
|
+
const attrMatch = tagMatch[0].match(new RegExp(`\\b${attr5}="([^"]*)"`, "i"));
|
|
50078
|
+
return attrMatch?.[1] ?? "";
|
|
50079
|
+
}
|
|
50080
|
+
function parseAgileEncryptionInfo(data) {
|
|
50081
|
+
const xml = new TextDecoder("utf-8").decode(data.subarray(8));
|
|
50082
|
+
const keyData = (attr5) => tagAttribute(xml, "keyData", attr5);
|
|
50083
|
+
const integrity = (attr5) => tagAttribute(xml, "dataIntegrity", attr5);
|
|
50084
|
+
const pke = (attr5) => tagAttribute(xml, "encryptedKey", attr5);
|
|
50085
|
+
const int = (value) => parseInt(value, 10);
|
|
50086
|
+
const encryptedHmacKey = integrity("encryptedHmacKey");
|
|
50087
|
+
return {
|
|
50088
|
+
version: { major: 4, minor: 4 },
|
|
50089
|
+
isAgile: true,
|
|
50090
|
+
keyData: {
|
|
50091
|
+
saltSize: int(keyData("saltSize")),
|
|
50092
|
+
blockSize: int(keyData("blockSize")),
|
|
50093
|
+
keyBits: int(keyData("keyBits")),
|
|
50094
|
+
hashSize: int(keyData("hashSize")),
|
|
50095
|
+
cipherAlgorithm: keyData("cipherAlgorithm"),
|
|
50096
|
+
cipherChaining: keyData("cipherChaining"),
|
|
50097
|
+
hashAlgorithm: keyData("hashAlgorithm"),
|
|
50098
|
+
saltValue: base64Decode(keyData("saltValue"))
|
|
50099
|
+
},
|
|
50100
|
+
...encryptedHmacKey ? {
|
|
50101
|
+
dataIntegrity: {
|
|
50102
|
+
encryptedHmacKey: base64Decode(encryptedHmacKey),
|
|
50103
|
+
encryptedHmacValue: base64Decode(integrity("encryptedHmacValue"))
|
|
50104
|
+
}
|
|
50105
|
+
} : {},
|
|
50106
|
+
passwordKeyEncryptor: {
|
|
50107
|
+
saltSize: int(pke("saltSize")),
|
|
50108
|
+
blockSize: int(pke("blockSize")),
|
|
50109
|
+
keyBits: int(pke("keyBits")),
|
|
50110
|
+
hashSize: int(pke("hashSize")),
|
|
50111
|
+
cipherAlgorithm: pke("cipherAlgorithm"),
|
|
50112
|
+
cipherChaining: pke("cipherChaining"),
|
|
50113
|
+
hashAlgorithm: pke("hashAlgorithm"),
|
|
50114
|
+
saltValue: base64Decode(pke("saltValue")),
|
|
50115
|
+
spinCount: int(pke("spinCount")),
|
|
50116
|
+
encryptedVerifierHashInput: base64Decode(pke("encryptedVerifierHashInput")),
|
|
50117
|
+
encryptedVerifierHashValue: base64Decode(pke("encryptedVerifierHashValue")),
|
|
50118
|
+
encryptedKeyValue: base64Decode(pke("encryptedKeyValue"))
|
|
50240
50119
|
}
|
|
50241
|
-
|
|
50242
|
-
|
|
50120
|
+
};
|
|
50121
|
+
}
|
|
50122
|
+
var RC4_ALG_ID;
|
|
50123
|
+
var init_encryption_info = __esm({
|
|
50124
|
+
"crypto/encryption-info.ts"() {
|
|
50125
|
+
init_ooxml_crypto_primitives();
|
|
50126
|
+
RC4_ALG_ID = 26625;
|
|
50243
50127
|
}
|
|
50244
|
-
|
|
50245
|
-
|
|
50128
|
+
});
|
|
50129
|
+
|
|
50130
|
+
// crypto/index.ts
|
|
50131
|
+
function streams(bytes) {
|
|
50132
|
+
const opened = openEncryptedPackage(bytes);
|
|
50133
|
+
if (opened) return { info: opened.encryptionInfo, data: opened.encryptedPackage };
|
|
50134
|
+
const file = parseOle2(toArrayBuffer(bytes));
|
|
50135
|
+
if (!file.getStream("EncryptionInfo")) {
|
|
50136
|
+
throw new Error(
|
|
50137
|
+
"EncryptionInfo stream not found. The file may not be an encrypted OOXML package."
|
|
50138
|
+
);
|
|
50246
50139
|
}
|
|
50140
|
+
throw new Error("EncryptedPackage stream not found. The file may be corrupted.");
|
|
50247
50141
|
}
|
|
50248
|
-
function
|
|
50249
|
-
|
|
50250
|
-
|
|
50251
|
-
|
|
50142
|
+
async function decryptOoxmlPackage(input, password) {
|
|
50143
|
+
const { info: infoStream, data } = streams(toBytes(input));
|
|
50144
|
+
const info = parseEncryptionInfo(infoStream);
|
|
50145
|
+
if (isStandard(info)) {
|
|
50146
|
+
const key3 = await verifyStandardPassword(info, password);
|
|
50147
|
+
if (!key3) throw new exports.IncorrectPasswordError();
|
|
50148
|
+
return new Uint8Array(await decryptStandardPackage(data, key3));
|
|
50252
50149
|
}
|
|
50253
|
-
|
|
50254
|
-
|
|
50255
|
-
|
|
50256
|
-
|
|
50257
|
-
new DataView(padded.buffer).setBigUint64(total - 8, BigInt(message.length) * 8n, false);
|
|
50258
|
-
return padded;
|
|
50150
|
+
const key2 = await verifyAgilePassword(info, password);
|
|
50151
|
+
if (!key2) throw new exports.IncorrectPasswordError();
|
|
50152
|
+
await verifyAgileDataIntegrity(info, key2, data);
|
|
50153
|
+
return new Uint8Array(await decryptAgilePackage(data, key2, info));
|
|
50259
50154
|
}
|
|
50260
|
-
function
|
|
50261
|
-
const
|
|
50262
|
-
|
|
50263
|
-
|
|
50264
|
-
|
|
50265
|
-
|
|
50266
|
-
|
|
50267
|
-
|
|
50268
|
-
|
|
50269
|
-
|
|
50270
|
-
|
|
50271
|
-
|
|
50272
|
-
|
|
50273
|
-
for (let i2 = 0; i2 < WORDS_PER_BLOCK; i2++) {
|
|
50274
|
-
outView.setBigUint64(i2 * 8, hash2[i2], false);
|
|
50155
|
+
function encryptOoxmlPackage(input, password, options = {}) {
|
|
50156
|
+
const bytes = toBytes(input);
|
|
50157
|
+
return options.encryptionScheme === "standard" ? encryptStandard(bytes, password, options) : encryptAgile(bytes, password, options);
|
|
50158
|
+
}
|
|
50159
|
+
async function verifyOoxmlPackagePassword(input, password) {
|
|
50160
|
+
try {
|
|
50161
|
+
const opened = openEncryptedPackage(input);
|
|
50162
|
+
if (!opened) return false;
|
|
50163
|
+
const info = parseEncryptionInfo(opened.encryptionInfo);
|
|
50164
|
+
const key2 = isStandard(info) ? await verifyStandardPassword(info, password) : await verifyAgilePassword(info, password);
|
|
50165
|
+
return key2 !== null;
|
|
50166
|
+
} catch {
|
|
50167
|
+
return false;
|
|
50275
50168
|
}
|
|
50276
|
-
return out;
|
|
50277
50169
|
}
|
|
50278
|
-
var
|
|
50279
|
-
var
|
|
50280
|
-
"
|
|
50281
|
-
|
|
50282
|
-
|
|
50283
|
-
|
|
50284
|
-
|
|
50170
|
+
var isStandard;
|
|
50171
|
+
var init_crypto = __esm({
|
|
50172
|
+
"crypto/index.ts"() {
|
|
50173
|
+
init_ole2_parser_read();
|
|
50174
|
+
init_decrypt();
|
|
50175
|
+
init_detect();
|
|
50176
|
+
init_encrypt();
|
|
50177
|
+
init_encryption_info();
|
|
50178
|
+
init_errors();
|
|
50179
|
+
isStandard = (info) => "isStandard" in info && info.isStandard;
|
|
50285
50180
|
}
|
|
50286
50181
|
});
|
|
50287
50182
|
|
|
50288
|
-
// pptx/core/utils/
|
|
50289
|
-
|
|
50290
|
-
|
|
50291
|
-
|
|
50183
|
+
// pptx/core/utils/ooxml-crypto-primitives.ts
|
|
50184
|
+
var init_ooxml_crypto_primitives2 = __esm({
|
|
50185
|
+
"pptx/core/utils/ooxml-crypto-primitives.ts"() {
|
|
50186
|
+
init_ooxml_crypto_primitives();
|
|
50292
50187
|
}
|
|
50293
|
-
|
|
50188
|
+
});
|
|
50189
|
+
|
|
50190
|
+
// pptx/core/utils/ooxml-crypto.ts
|
|
50191
|
+
async function decryptPptx(encryptedBuffer, password) {
|
|
50192
|
+
return (await decryptOoxmlPackage(encryptedBuffer, password)).buffer;
|
|
50294
50193
|
}
|
|
50295
|
-
async function
|
|
50296
|
-
|
|
50297
|
-
if (pure) {
|
|
50298
|
-
return pure(data);
|
|
50299
|
-
}
|
|
50300
|
-
if (WEB_CRYPTO_ALGORITHMS.has(algorithm)) {
|
|
50301
|
-
const subtle = getSubtle2();
|
|
50302
|
-
const result = await subtle.digest(algorithm, data);
|
|
50303
|
-
return new Uint8Array(result);
|
|
50304
|
-
}
|
|
50305
|
-
throw new Error(`Unsupported digest algorithm: ${algorithm}`);
|
|
50194
|
+
async function encryptPptx(pptxBuffer, password, options) {
|
|
50195
|
+
return (await encryptOoxmlPackage(pptxBuffer, password, options)).buffer;
|
|
50306
50196
|
}
|
|
50307
|
-
|
|
50308
|
-
|
|
50309
|
-
|
|
50310
|
-
|
|
50311
|
-
|
|
50312
|
-
|
|
50313
|
-
|
|
50314
|
-
init_ripemd128();
|
|
50315
|
-
init_ripemd160();
|
|
50316
|
-
init_whirlpool();
|
|
50317
|
-
PURE_DIGESTS = {
|
|
50318
|
-
MD2: md2,
|
|
50319
|
-
MD4: md4,
|
|
50320
|
-
MD5: md5,
|
|
50321
|
-
"RIPEMD-128": ripemd128,
|
|
50322
|
-
"RIPEMD-160": ripemd160,
|
|
50323
|
-
WHIRLPOOL: whirlpool
|
|
50324
|
-
};
|
|
50197
|
+
function verifyPassword(encryptedBuffer, password) {
|
|
50198
|
+
return verifyOoxmlPackagePassword(encryptedBuffer, password);
|
|
50199
|
+
}
|
|
50200
|
+
var init_ooxml_crypto = __esm({
|
|
50201
|
+
"pptx/core/utils/ooxml-crypto.ts"() {
|
|
50202
|
+
init_crypto();
|
|
50203
|
+
init_errors();
|
|
50325
50204
|
}
|
|
50326
50205
|
});
|
|
50327
50206
|
|
|
50328
|
-
// pptx/core/utils/
|
|
50329
|
-
var
|
|
50330
|
-
"pptx/core/utils/
|
|
50331
|
-
|
|
50332
|
-
|
|
50207
|
+
// pptx/core/utils/ole2-parser.ts
|
|
50208
|
+
var init_ole2_parser = __esm({
|
|
50209
|
+
"pptx/core/utils/ole2-parser.ts"() {
|
|
50210
|
+
init_ole2_parser_types2();
|
|
50211
|
+
init_ole2_parser_read2();
|
|
50212
|
+
init_ole2_parser_write2();
|
|
50333
50213
|
}
|
|
50334
50214
|
});
|
|
50335
50215
|
|
|
50336
|
-
//
|
|
50337
|
-
function
|
|
50338
|
-
const
|
|
50339
|
-
|
|
50340
|
-
|
|
50341
|
-
|
|
50342
|
-
|
|
50343
|
-
|
|
50344
|
-
return buf;
|
|
50345
|
-
}
|
|
50346
|
-
function concat(...arrays) {
|
|
50347
|
-
let totalLength = 0;
|
|
50348
|
-
for (const arr of arrays) {
|
|
50349
|
-
totalLength += arr.length;
|
|
50216
|
+
// digest/password-hash.ts
|
|
50217
|
+
function spinPasswordHash(password, salt, spinCount, digest) {
|
|
50218
|
+
const input = new Uint8Array(salt.length + password.length * 2);
|
|
50219
|
+
input.set(salt);
|
|
50220
|
+
for (let i2 = 0; i2 < password.length; i2++) {
|
|
50221
|
+
const code = password.charCodeAt(i2);
|
|
50222
|
+
input[salt.length + i2 * 2] = code & 255;
|
|
50223
|
+
input[salt.length + i2 * 2 + 1] = code >> 8;
|
|
50350
50224
|
}
|
|
50351
|
-
|
|
50352
|
-
|
|
50353
|
-
|
|
50354
|
-
|
|
50355
|
-
|
|
50225
|
+
let value = digest(input);
|
|
50226
|
+
const buffer = new Uint8Array(value.length + 4);
|
|
50227
|
+
const view = new DataView(buffer.buffer);
|
|
50228
|
+
for (let i2 = 0; i2 < spinCount; i2++) {
|
|
50229
|
+
buffer.set(value);
|
|
50230
|
+
view.setUint32(value.length, i2, true);
|
|
50231
|
+
value = digest(buffer);
|
|
50356
50232
|
}
|
|
50357
|
-
return
|
|
50358
|
-
}
|
|
50359
|
-
function uint32LE2(value) {
|
|
50360
|
-
const buf = new Uint8Array(4);
|
|
50361
|
-
const view = new DataView(buf.buffer);
|
|
50362
|
-
view.setUint32(0, value, true);
|
|
50363
|
-
return buf;
|
|
50233
|
+
return value;
|
|
50364
50234
|
}
|
|
50235
|
+
var init_password_hash = __esm({
|
|
50236
|
+
"digest/password-hash.ts"() {
|
|
50237
|
+
}
|
|
50238
|
+
});
|
|
50239
|
+
|
|
50240
|
+
// pptx/core/utils/modify-verifier-codec.ts
|
|
50365
50241
|
function base64Decode2(str) {
|
|
50366
50242
|
const normalized = str.replace(/\s+/g, "");
|
|
50367
50243
|
if (typeof Buffer !== "undefined") {
|
|
@@ -50397,12 +50273,11 @@ function randomSalt() {
|
|
|
50397
50273
|
return salt;
|
|
50398
50274
|
}
|
|
50399
50275
|
async function iteratedHash(algorithm, salt, password, spinCount) {
|
|
50400
|
-
const
|
|
50401
|
-
|
|
50402
|
-
|
|
50403
|
-
h2 = await digest(algorithm, concat(h2, uint32LE2(i2)));
|
|
50276
|
+
const digest = digestFunction(algorithm);
|
|
50277
|
+
if (!digest) {
|
|
50278
|
+
throw new Error(`Unsupported digest algorithm: ${algorithm}`);
|
|
50404
50279
|
}
|
|
50405
|
-
return
|
|
50280
|
+
return spinPasswordHash(password, salt, spinCount, digest);
|
|
50406
50281
|
}
|
|
50407
50282
|
function bytesEqual2(a, b) {
|
|
50408
50283
|
if (a.length !== b.length) {
|
|
@@ -50417,17 +50292,18 @@ function bytesEqual2(a, b) {
|
|
|
50417
50292
|
}
|
|
50418
50293
|
var init_modify_verifier_codec = __esm({
|
|
50419
50294
|
"pptx/core/utils/modify-verifier-codec.ts"() {
|
|
50420
|
-
|
|
50295
|
+
init_digest2();
|
|
50296
|
+
init_password_hash();
|
|
50421
50297
|
}
|
|
50422
50298
|
});
|
|
50423
50299
|
|
|
50424
50300
|
// pptx/core/utils/modify-verifier.ts
|
|
50425
50301
|
function resolveModifyVerifierAlgorithmName(verifier) {
|
|
50426
50302
|
if (verifier.algorithmName) {
|
|
50427
|
-
return
|
|
50303
|
+
return normalizeDigestAlgorithmName(verifier.algorithmName);
|
|
50428
50304
|
}
|
|
50429
50305
|
if (verifier.algIdExt) {
|
|
50430
|
-
return
|
|
50306
|
+
return normalizeDigestAlgorithmName(verifier.algIdExt);
|
|
50431
50307
|
}
|
|
50432
50308
|
if (verifier.cryptAlgorithmSid !== void 0) {
|
|
50433
50309
|
return CRYPT_ALGORITHM_SID_NAMES[verifier.cryptAlgorithmSid];
|
|
@@ -50447,7 +50323,7 @@ async function verifyModifyPassword(verifier, password) {
|
|
|
50447
50323
|
}
|
|
50448
50324
|
async function createModifyVerifier(password, options) {
|
|
50449
50325
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
50450
|
-
const algorithm =
|
|
50326
|
+
const algorithm = normalizeDigestAlgorithmName(requestedAlgorithm);
|
|
50451
50327
|
if (!algorithm) {
|
|
50452
50328
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
50453
50329
|
}
|
|
@@ -50465,7 +50341,7 @@ async function createModifyVerifier(password, options) {
|
|
|
50465
50341
|
}
|
|
50466
50342
|
async function createSaltlessModifyVerifierForTesting(password, options) {
|
|
50467
50343
|
const requestedAlgorithm = options?.algorithmName ?? "SHA-512";
|
|
50468
|
-
const algorithm =
|
|
50344
|
+
const algorithm = normalizeDigestAlgorithmName(requestedAlgorithm);
|
|
50469
50345
|
if (!algorithm) {
|
|
50470
50346
|
throw new Error(`Unsupported modify-verifier hash algorithm: ${requestedAlgorithm}`);
|
|
50471
50347
|
}
|
|
@@ -50482,7 +50358,7 @@ async function createSaltlessModifyVerifierForTesting(password, options) {
|
|
|
50482
50358
|
var CRYPT_ALGORITHM_SID_NAMES;
|
|
50483
50359
|
var init_modify_verifier = __esm({
|
|
50484
50360
|
"pptx/core/utils/modify-verifier.ts"() {
|
|
50485
|
-
|
|
50361
|
+
init_algorithm_names();
|
|
50486
50362
|
init_modify_verifier_codec();
|
|
50487
50363
|
CRYPT_ALGORITHM_SID_NAMES = {
|
|
50488
50364
|
1: "MD2",
|
|
@@ -54131,12 +54007,12 @@ function buildGroupChild(shape, kind, xml, colors) {
|
|
|
54131
54007
|
};
|
|
54132
54008
|
}
|
|
54133
54009
|
function buildNestedGroupChild(group, xml, colors) {
|
|
54134
|
-
const
|
|
54010
|
+
const transform7 = parseGroupTransform(group, xml);
|
|
54135
54011
|
return {
|
|
54136
54012
|
kind: "grpSp",
|
|
54137
|
-
off:
|
|
54138
|
-
ext:
|
|
54139
|
-
transform:
|
|
54013
|
+
off: transform7.off,
|
|
54014
|
+
ext: transform7.ext,
|
|
54015
|
+
transform: transform7,
|
|
54140
54016
|
children: parseGroupChildren(group, xml, colors),
|
|
54141
54017
|
// Verbatim source for byte-identical re-emission while untouched; see
|
|
54142
54018
|
// `PptxChartUserShape.rawXml`'s doc (same contract one level up).
|
|
@@ -54176,12 +54052,12 @@ function parseAnchorShape(anchor, base, xml, colors) {
|
|
|
54176
54052
|
}
|
|
54177
54053
|
const group = xml.getChildByLocalName(anchor, "grpSp");
|
|
54178
54054
|
if (group) {
|
|
54179
|
-
const
|
|
54055
|
+
const transform7 = parseGroupTransform(group, xml);
|
|
54180
54056
|
return [
|
|
54181
54057
|
{
|
|
54182
54058
|
kind: "grpSp",
|
|
54183
54059
|
...base,
|
|
54184
|
-
transform:
|
|
54060
|
+
transform: transform7,
|
|
54185
54061
|
children: parseGroupChildren(group, xml, colors),
|
|
54186
54062
|
// Verbatim source for byte-identical re-emission while untouched;
|
|
54187
54063
|
// see `PptxChartUserShape.rawXml`'s doc.
|
|
@@ -56448,13 +56324,13 @@ function parseLights(model3d) {
|
|
|
56448
56324
|
}
|
|
56449
56325
|
function parseModel3DScene(model3d) {
|
|
56450
56326
|
const camera = parseCamera(am(model3d, "camera"));
|
|
56451
|
-
const
|
|
56327
|
+
const transform7 = parseTransform(am(model3d, "trans"));
|
|
56452
56328
|
const lights = parseLights(model3d);
|
|
56453
56329
|
const viewportSizeEmu = num2(am(model3d, "objViewport"), "viewportSz");
|
|
56454
|
-
if (!camera && !
|
|
56330
|
+
if (!camera && !transform7 && lights.length === 0) {
|
|
56455
56331
|
return void 0;
|
|
56456
56332
|
}
|
|
56457
|
-
return { camera, transform:
|
|
56333
|
+
return { camera, transform: transform7, lights, viewportSizeEmu };
|
|
56458
56334
|
}
|
|
56459
56335
|
var ANGLE_UNIT, point, delta, LIGHT_TAGS;
|
|
56460
56336
|
var init_model3d_scene_parser = __esm({
|
|
@@ -72693,11 +72569,11 @@ function materializeInheritedShapeTransform(shape, element) {
|
|
|
72693
72569
|
if (!changed) {
|
|
72694
72570
|
return void 0;
|
|
72695
72571
|
}
|
|
72696
|
-
const
|
|
72572
|
+
const transform7 = {};
|
|
72697
72573
|
const properties = { ...xmlChild(shape, "p:spPr") };
|
|
72698
72574
|
delete properties["a:xfrm"];
|
|
72699
|
-
shape["p:spPr"] = { "a:xfrm":
|
|
72700
|
-
return
|
|
72575
|
+
shape["p:spPr"] = { "a:xfrm": transform7, ...properties };
|
|
72576
|
+
return transform7;
|
|
72701
72577
|
}
|
|
72702
72578
|
var NUMERIC_KEYS;
|
|
72703
72579
|
var init_inherited_shape_transform = __esm({
|
|
@@ -72718,16 +72594,16 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
72718
72594
|
init_inherited_shape_transform();
|
|
72719
72595
|
exports.PptxElementTransformUpdater = class {
|
|
72720
72596
|
applyTransform(shape, element, emuPerPx, enclosingGroupChildSpace) {
|
|
72721
|
-
const
|
|
72597
|
+
const transform7 = shape["p:spPr"]?.["a:xfrm"] || shape["p:xfrm"] || // A group's child geometry uses a different frame from the load-time baseline.
|
|
72722
72598
|
!enclosingGroupChildSpace && materializeInheritedShapeTransform(shape, element);
|
|
72723
|
-
if (!
|
|
72599
|
+
if (!transform7) {
|
|
72724
72600
|
return;
|
|
72725
72601
|
}
|
|
72726
|
-
if (!
|
|
72727
|
-
|
|
72602
|
+
if (!transform7["a:off"]) {
|
|
72603
|
+
transform7["a:off"] = {};
|
|
72728
72604
|
}
|
|
72729
|
-
if (!
|
|
72730
|
-
|
|
72605
|
+
if (!transform7["a:ext"]) {
|
|
72606
|
+
transform7["a:ext"] = {};
|
|
72731
72607
|
}
|
|
72732
72608
|
const inverted = enclosingGroupChildSpace ? resolveGroupChildBoxEmu(element, enclosingGroupChildSpace, emuPerPx) : void 0;
|
|
72733
72609
|
const extCx = inverted ? inverted.widthEmu : resolveXfrmEmu(element.width, element.widthEmu, emuPerPx);
|
|
@@ -72755,34 +72631,34 @@ var init_PptxElementTransformUpdater = __esm({
|
|
|
72755
72631
|
offX = rotatedResize ? rotatedResize.offXEmu : naiveOffX;
|
|
72756
72632
|
offY = rotatedResize ? rotatedResize.offYEmu : naiveOffY;
|
|
72757
72633
|
}
|
|
72758
|
-
|
|
72759
|
-
|
|
72760
|
-
|
|
72761
|
-
|
|
72634
|
+
transform7["a:off"]["@_x"] = String(offX);
|
|
72635
|
+
transform7["a:off"]["@_y"] = String(offY);
|
|
72636
|
+
transform7["a:ext"]["@_cx"] = String(extCx);
|
|
72637
|
+
transform7["a:ext"]["@_cy"] = String(extCy);
|
|
72762
72638
|
if (element.rotation !== void 0) {
|
|
72763
|
-
|
|
72639
|
+
transform7["@_rot"] = String(Math.round(element.rotation * 6e4));
|
|
72764
72640
|
}
|
|
72765
72641
|
if (element.skewX !== void 0) {
|
|
72766
|
-
|
|
72642
|
+
transform7["@_skewX"] = String(Math.round(element.skewX * 6e4));
|
|
72767
72643
|
}
|
|
72768
72644
|
if (element.skewY !== void 0) {
|
|
72769
|
-
|
|
72645
|
+
transform7["@_skewY"] = String(Math.round(element.skewY * 6e4));
|
|
72770
72646
|
}
|
|
72771
72647
|
const nonVisual = xmlChild(shape, "p:nvSpPr") ?? xmlChild(shape, "p:nvPicPr");
|
|
72772
72648
|
const isPlaceholder = xmlHasChild(xmlChild(nonVisual, "p:nvPr"), "p:ph");
|
|
72773
72649
|
if (element.flipHorizontal) {
|
|
72774
|
-
|
|
72775
|
-
} else if (element.inheritedTransform?.flipHorizontal || isPlaceholder &&
|
|
72776
|
-
|
|
72777
|
-
} else if (
|
|
72778
|
-
delete
|
|
72650
|
+
transform7["@_flipH"] = "1";
|
|
72651
|
+
} else if (element.inheritedTransform?.flipHorizontal || isPlaceholder && transform7["@_flipH"] !== void 0 && transform7["@_flipH"] !== "false") {
|
|
72652
|
+
transform7["@_flipH"] = "0";
|
|
72653
|
+
} else if (transform7["@_flipH"] !== "0" && transform7["@_flipH"] !== "false") {
|
|
72654
|
+
delete transform7["@_flipH"];
|
|
72779
72655
|
}
|
|
72780
72656
|
if (element.flipVertical) {
|
|
72781
|
-
|
|
72782
|
-
} else if (element.inheritedTransform?.flipVertical || isPlaceholder &&
|
|
72783
|
-
|
|
72784
|
-
} else if (
|
|
72785
|
-
delete
|
|
72657
|
+
transform7["@_flipV"] = "1";
|
|
72658
|
+
} else if (element.inheritedTransform?.flipVertical || isPlaceholder && transform7["@_flipV"] !== void 0 && transform7["@_flipV"] !== "false") {
|
|
72659
|
+
transform7["@_flipV"] = "0";
|
|
72660
|
+
} else if (transform7["@_flipV"] !== "0" && transform7["@_flipV"] !== "false") {
|
|
72661
|
+
delete transform7["@_flipV"];
|
|
72786
72662
|
}
|
|
72787
72663
|
}
|
|
72788
72664
|
};
|
|
@@ -77958,11 +77834,11 @@ var init_PptxGraphicFrameParser = __esm({
|
|
|
77958
77834
|
const placeholder = readGraphicFramePlaceholder(frame2);
|
|
77959
77835
|
const ownTransform = frame2["p:xfrm"];
|
|
77960
77836
|
const inheritedTransform = placeholder && slidePath && !hasUsableTransform(ownTransform) ? readInheritedTransform(this.context.findPlaceholderNode?.(slidePath, placeholder)) : void 0;
|
|
77961
|
-
const
|
|
77962
|
-
const offset =
|
|
77963
|
-
const extent =
|
|
77837
|
+
const transform7 = inheritedTransform ?? ownTransform;
|
|
77838
|
+
const offset = transform7?.["a:off"] || {};
|
|
77839
|
+
const extent = transform7?.["a:ext"] || {};
|
|
77964
77840
|
const graphicData = frame2["a:graphic"]?.["a:graphicData"];
|
|
77965
|
-
const { flipHorizontal, flipVertical } = this.context.readFlipState(
|
|
77841
|
+
const { flipHorizontal, flipVertical } = this.context.readFlipState(transform7);
|
|
77966
77842
|
const type = this.parseGraphicFrameType(graphicData);
|
|
77967
77843
|
if (slidePath) {
|
|
77968
77844
|
this.context.inspectGraphicFrameCompatibility(type, slidePath, id);
|
|
@@ -77992,9 +77868,9 @@ var init_PptxGraphicFrameParser = __esm({
|
|
|
77992
77868
|
yEmu: parseInt(String(offset["@_y"] || "0"), 10),
|
|
77993
77869
|
widthEmu: parseInt(String(extent["@_cx"] || "0"), 10),
|
|
77994
77870
|
heightEmu: parseInt(String(extent["@_cy"] || "0"), 10),
|
|
77995
|
-
rotation:
|
|
77996
|
-
skewX:
|
|
77997
|
-
skewY:
|
|
77871
|
+
rotation: transform7?.["@_rot"] ? parseInt(String(transform7["@_rot"]), 10) / 6e4 : void 0,
|
|
77872
|
+
skewX: transform7?.["@_skewX"] ? parseInt(String(transform7["@_skewX"]), 10) / 6e4 : void 0,
|
|
77873
|
+
skewY: transform7?.["@_skewY"] ? parseInt(String(transform7["@_skewY"]), 10) / 6e4 : void 0,
|
|
77998
77874
|
flipHorizontal,
|
|
77999
77875
|
flipVertical,
|
|
78000
77876
|
// `p:nvGraphicFramePr/p:nvPr/p:ph`: a table/chart/SmartArt/OLE/media
|
|
@@ -78203,12 +78079,12 @@ var init_PptxConnectorParser = __esm({
|
|
|
78203
78079
|
parseConnector(connector, id, slidePath) {
|
|
78204
78080
|
try {
|
|
78205
78081
|
const shapeProperties = connector["p:spPr"];
|
|
78206
|
-
const
|
|
78207
|
-
if (!
|
|
78082
|
+
const transform7 = shapeProperties?.["a:xfrm"];
|
|
78083
|
+
if (!transform7) {
|
|
78208
78084
|
return null;
|
|
78209
78085
|
}
|
|
78210
|
-
const offset =
|
|
78211
|
-
const extent =
|
|
78086
|
+
const offset = transform7["a:off"];
|
|
78087
|
+
const extent = transform7["a:ext"];
|
|
78212
78088
|
if (!offset || !extent) {
|
|
78213
78089
|
return null;
|
|
78214
78090
|
}
|
|
@@ -78218,10 +78094,10 @@ var init_PptxConnectorParser = __esm({
|
|
|
78218
78094
|
const shapeAdjustments = this.context.parseGeometryAdjustments(
|
|
78219
78095
|
shapeProperties?.["a:prstGeom"]
|
|
78220
78096
|
);
|
|
78221
|
-
const rotation =
|
|
78222
|
-
const skewX =
|
|
78223
|
-
const skewY =
|
|
78224
|
-
const { flipHorizontal, flipVertical } = this.context.readFlipState(
|
|
78097
|
+
const rotation = transform7["@_rot"] ? parseInt(String(transform7["@_rot"]), 10) / 6e4 : void 0;
|
|
78098
|
+
const skewX = transform7["@_skewX"] ? parseInt(String(transform7["@_skewX"]), 10) / 6e4 : void 0;
|
|
78099
|
+
const skewY = transform7["@_skewY"] ? parseInt(String(transform7["@_skewY"]), 10) / 6e4 : void 0;
|
|
78100
|
+
const { flipHorizontal, flipVertical } = this.context.readFlipState(transform7);
|
|
78225
78101
|
const cNvConnectionShapeProperties = connector?.["p:nvCxnSpPr"]?.["p:cNvCxnSpPr"];
|
|
78226
78102
|
const shapeStyle = this.context.extractShapeStyle(
|
|
78227
78103
|
shapeProperties,
|
|
@@ -107365,8 +107241,8 @@ function parseChartStyleDefinition(styleRoot, xmlLookup, resolveSchemeColor, par
|
|
|
107365
107241
|
for (const attribute6 of Array.from(element.attributes))
|
|
107366
107242
|
if (attribute6.localName !== "xmlns" && attribute6.prefix !== "xmlns")
|
|
107367
107243
|
raw[`@_${attribute6.localName}`] = attribute6.value;
|
|
107368
|
-
for (const
|
|
107369
|
-
raw[`a:${
|
|
107244
|
+
for (const transform7 of elements(element))
|
|
107245
|
+
raw[`a:${transform7.localName}`] = transform7.hasAttribute("val") ? { "@_val": transform7.getAttribute("val") ?? "" } : {};
|
|
107370
107246
|
const fill = {};
|
|
107371
107247
|
const key2 = `a:${element.localName}`;
|
|
107372
107248
|
fill[key2] = raw;
|
|
@@ -112106,9 +111982,148 @@ var init_current_user_writer = __esm({
|
|
|
112106
111982
|
}
|
|
112107
111983
|
});
|
|
112108
111984
|
|
|
111985
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
|
|
111986
|
+
function rotl322(x, n) {
|
|
111987
|
+
return (x << n | x >>> 32 - n) >>> 0;
|
|
111988
|
+
}
|
|
111989
|
+
function add322(...values) {
|
|
111990
|
+
let sum = 0;
|
|
111991
|
+
for (const value of values) {
|
|
111992
|
+
sum = sum + value >>> 0;
|
|
111993
|
+
}
|
|
111994
|
+
return sum;
|
|
111995
|
+
}
|
|
111996
|
+
function padMd4Style2(message) {
|
|
111997
|
+
const bitLength = BigInt(message.length) * 8n;
|
|
111998
|
+
const paddedLength = message.length + 9 + 63 & -64;
|
|
111999
|
+
const padded = new Uint8Array(paddedLength);
|
|
112000
|
+
padded.set(message);
|
|
112001
|
+
padded[message.length] = 128;
|
|
112002
|
+
new DataView(padded.buffer).setBigUint64(paddedLength - 8, bitLength, true);
|
|
112003
|
+
return padded;
|
|
112004
|
+
}
|
|
112005
|
+
function applyRotatingRound2(r, ops, f6, x) {
|
|
112006
|
+
let target = 0;
|
|
112007
|
+
for (const [k, s, addConst] of ops) {
|
|
112008
|
+
const i1 = target + 1 & 3;
|
|
112009
|
+
const i2 = target + 2 & 3;
|
|
112010
|
+
const i3 = target + 3 & 3;
|
|
112011
|
+
r[target] = rotl322(add322(r[target], f6(r[i1], r[i2], r[i3]), x[k], addConst), s);
|
|
112012
|
+
target = target + 3 & 3;
|
|
112013
|
+
}
|
|
112014
|
+
}
|
|
112015
|
+
function mdStyleDigest2(message, initialState, transform7) {
|
|
112016
|
+
const padded = padMd4Style2(message);
|
|
112017
|
+
const view = new DataView(padded.buffer);
|
|
112018
|
+
const state = [...initialState];
|
|
112019
|
+
const words2 = new Array(16);
|
|
112020
|
+
for (let blockOffset = 0; blockOffset < padded.length; blockOffset += 64) {
|
|
112021
|
+
for (let i2 = 0; i2 < 16; i2++) {
|
|
112022
|
+
words2[i2] = view.getUint32(blockOffset + i2 * 4, true);
|
|
112023
|
+
}
|
|
112024
|
+
transform7(state, words2);
|
|
112025
|
+
}
|
|
112026
|
+
const out = new Uint8Array(state.length * 4);
|
|
112027
|
+
const outView = new DataView(out.buffer);
|
|
112028
|
+
for (let i2 = 0; i2 < state.length; i2++) {
|
|
112029
|
+
outView.setUint32(i2 * 4, state[i2], true);
|
|
112030
|
+
}
|
|
112031
|
+
return out;
|
|
112032
|
+
}
|
|
112033
|
+
var init_bit_ops2 = __esm({
|
|
112034
|
+
"../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
|
|
112035
|
+
}
|
|
112036
|
+
});
|
|
112037
|
+
|
|
112038
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
|
|
112039
|
+
function f13(x, y, z) {
|
|
112040
|
+
return x & y | ~x & z;
|
|
112041
|
+
}
|
|
112042
|
+
function f23(x, y, z) {
|
|
112043
|
+
return x & y | x & z | y & z;
|
|
112044
|
+
}
|
|
112045
|
+
function f33(x, y, z) {
|
|
112046
|
+
return x ^ y ^ z;
|
|
112047
|
+
}
|
|
112048
|
+
function transform6(state, x) {
|
|
112049
|
+
const r = [...state];
|
|
112050
|
+
applyRotatingRound2(r, ROUND12, f13, x);
|
|
112051
|
+
applyRotatingRound2(r, ROUND22, f23, x);
|
|
112052
|
+
applyRotatingRound2(r, ROUND32, f33, x);
|
|
112053
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
112054
|
+
state[i2] = add322(state[i2], r[i2]);
|
|
112055
|
+
}
|
|
112056
|
+
}
|
|
112057
|
+
function md42(message) {
|
|
112058
|
+
return mdStyleDigest2(message, INITIAL_STATE5, transform6);
|
|
112059
|
+
}
|
|
112060
|
+
var INITIAL_STATE5, K22, K32, ROUND12, ROUND22, ROUND32;
|
|
112061
|
+
var init_md42 = __esm({
|
|
112062
|
+
"../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
|
|
112063
|
+
init_bit_ops2();
|
|
112064
|
+
INITIAL_STATE5 = [1732584193, 4023233417, 2562383102, 271733878];
|
|
112065
|
+
K22 = 1518500249;
|
|
112066
|
+
K32 = 1859775393;
|
|
112067
|
+
ROUND12 = [
|
|
112068
|
+
[0, 3, 0],
|
|
112069
|
+
[1, 7, 0],
|
|
112070
|
+
[2, 11, 0],
|
|
112071
|
+
[3, 19, 0],
|
|
112072
|
+
[4, 3, 0],
|
|
112073
|
+
[5, 7, 0],
|
|
112074
|
+
[6, 11, 0],
|
|
112075
|
+
[7, 19, 0],
|
|
112076
|
+
[8, 3, 0],
|
|
112077
|
+
[9, 7, 0],
|
|
112078
|
+
[10, 11, 0],
|
|
112079
|
+
[11, 19, 0],
|
|
112080
|
+
[12, 3, 0],
|
|
112081
|
+
[13, 7, 0],
|
|
112082
|
+
[14, 11, 0],
|
|
112083
|
+
[15, 19, 0]
|
|
112084
|
+
];
|
|
112085
|
+
ROUND22 = [
|
|
112086
|
+
[0, 3, K22],
|
|
112087
|
+
[4, 5, K22],
|
|
112088
|
+
[8, 9, K22],
|
|
112089
|
+
[12, 13, K22],
|
|
112090
|
+
[1, 3, K22],
|
|
112091
|
+
[5, 5, K22],
|
|
112092
|
+
[9, 9, K22],
|
|
112093
|
+
[13, 13, K22],
|
|
112094
|
+
[2, 3, K22],
|
|
112095
|
+
[6, 5, K22],
|
|
112096
|
+
[10, 9, K22],
|
|
112097
|
+
[14, 13, K22],
|
|
112098
|
+
[3, 3, K22],
|
|
112099
|
+
[7, 5, K22],
|
|
112100
|
+
[11, 9, K22],
|
|
112101
|
+
[15, 13, K22]
|
|
112102
|
+
];
|
|
112103
|
+
ROUND32 = [
|
|
112104
|
+
[0, 3, K32],
|
|
112105
|
+
[8, 9, K32],
|
|
112106
|
+
[4, 11, K32],
|
|
112107
|
+
[12, 15, K32],
|
|
112108
|
+
[2, 3, K32],
|
|
112109
|
+
[10, 9, K32],
|
|
112110
|
+
[6, 11, K32],
|
|
112111
|
+
[14, 15, K32],
|
|
112112
|
+
[1, 3, K32],
|
|
112113
|
+
[9, 9, K32],
|
|
112114
|
+
[5, 11, K32],
|
|
112115
|
+
[13, 15, K32],
|
|
112116
|
+
[3, 3, K32],
|
|
112117
|
+
[11, 9, K32],
|
|
112118
|
+
[7, 11, K32],
|
|
112119
|
+
[15, 15, K32]
|
|
112120
|
+
];
|
|
112121
|
+
}
|
|
112122
|
+
});
|
|
112123
|
+
|
|
112109
112124
|
// ../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
|
|
112110
112125
|
function pictureUid(picture) {
|
|
112111
|
-
return
|
|
112126
|
+
return md42(picture.bytes);
|
|
112112
112127
|
}
|
|
112113
112128
|
function buildBlip(picture, uid) {
|
|
112114
112129
|
const info = BLIP_INFO[picture.extension];
|
|
@@ -112130,7 +112145,7 @@ function buildFbse(picture, uid, foDelay, size) {
|
|
|
112130
112145
|
var MSOBLIP_PICT, BLIP_INFO;
|
|
112131
112146
|
var init_blip_writer = __esm({
|
|
112132
112147
|
"../../node_modules/.bun/@christophervr+ole2@0.12.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
|
|
112133
|
-
|
|
112148
|
+
init_md42();
|
|
112134
112149
|
init_png_encoder();
|
|
112135
112150
|
init_record_types();
|
|
112136
112151
|
init_byte_writer();
|
|
@@ -120192,25 +120207,25 @@ function buildOffExt(off, ext) {
|
|
|
120192
120207
|
function buildChildXfrm(child29) {
|
|
120193
120208
|
return buildOffExt(child29.off, child29.ext);
|
|
120194
120209
|
}
|
|
120195
|
-
function buildGroupTransformXfrm(
|
|
120210
|
+
function buildGroupTransformXfrm(transform7) {
|
|
120196
120211
|
const xfrm = {
|
|
120197
|
-
...buildOffExt(
|
|
120212
|
+
...buildOffExt(transform7.off, transform7.ext),
|
|
120198
120213
|
"a:chOff": {
|
|
120199
|
-
"@_x": String(Math.round(
|
|
120200
|
-
"@_y": String(Math.round(
|
|
120214
|
+
"@_x": String(Math.round(transform7.chOff.x)),
|
|
120215
|
+
"@_y": String(Math.round(transform7.chOff.y))
|
|
120201
120216
|
},
|
|
120202
120217
|
"a:chExt": {
|
|
120203
|
-
"@_cx": String(Math.round(
|
|
120204
|
-
"@_cy": String(Math.round(
|
|
120218
|
+
"@_cx": String(Math.round(transform7.chExt.cx)),
|
|
120219
|
+
"@_cy": String(Math.round(transform7.chExt.cy))
|
|
120205
120220
|
}
|
|
120206
120221
|
};
|
|
120207
|
-
if (
|
|
120208
|
-
xfrm["@_rot"] = String(Math.round(
|
|
120222
|
+
if (transform7.rotation) {
|
|
120223
|
+
xfrm["@_rot"] = String(Math.round(transform7.rotation * 6e4));
|
|
120209
120224
|
}
|
|
120210
|
-
if (
|
|
120225
|
+
if (transform7.flipH) {
|
|
120211
120226
|
xfrm["@_flipH"] = "1";
|
|
120212
120227
|
}
|
|
120213
|
-
if (
|
|
120228
|
+
if (transform7.flipV) {
|
|
120214
120229
|
xfrm["@_flipV"] = "1";
|
|
120215
120230
|
}
|
|
120216
120231
|
return xfrm;
|
|
@@ -120257,14 +120272,14 @@ function appendGroupChildren(node, children16, idState) {
|
|
|
120257
120272
|
}
|
|
120258
120273
|
}
|
|
120259
120274
|
function buildGroupNode(group, id, idState) {
|
|
120260
|
-
const
|
|
120275
|
+
const transform7 = group.transform ?? DEFAULT_GROUP_TRANSFORM;
|
|
120261
120276
|
const node = {
|
|
120262
120277
|
"cdr:nvGrpSpPr": {
|
|
120263
120278
|
"cdr:cNvPr": { "@_id": String(id), "@_name": `Group ${id}` },
|
|
120264
120279
|
"cdr:cNvGrpSpPr": {}
|
|
120265
120280
|
},
|
|
120266
120281
|
"cdr:grpSpPr": {
|
|
120267
|
-
"a:xfrm": buildGroupTransformXfrm(
|
|
120282
|
+
"a:xfrm": buildGroupTransformXfrm(transform7)
|
|
120268
120283
|
}
|
|
120269
120284
|
};
|
|
120270
120285
|
appendGroupChildren(node, group.children ?? [], idState);
|
|
@@ -120800,7 +120815,7 @@ function buildArtisticNode(effects, elementName) {
|
|
|
120800
120815
|
if (params && Object.keys(params).length > 0) {
|
|
120801
120816
|
for (const [name, value] of Object.entries(params)) {
|
|
120802
120817
|
if (Number.isFinite(value)) {
|
|
120803
|
-
node[`@_${name}`] =
|
|
120818
|
+
node[`@_${name}`] = round2(value);
|
|
120804
120819
|
}
|
|
120805
120820
|
}
|
|
120806
120821
|
return node;
|
|
@@ -120808,16 +120823,16 @@ function buildArtisticNode(effects, elementName) {
|
|
|
120808
120823
|
const radius = effects.artisticRadius;
|
|
120809
120824
|
const primary = ARTISTIC_PRIMARY_ATTRIBUTE[elementName];
|
|
120810
120825
|
if (primary !== void 0 && typeof radius === "number" && Number.isFinite(radius)) {
|
|
120811
|
-
node[`@_${primary}`] = primary === "radius" ?
|
|
120826
|
+
node[`@_${primary}`] = primary === "radius" ? round2(radius) : round2(radius * 1e3);
|
|
120812
120827
|
}
|
|
120813
120828
|
return node;
|
|
120814
120829
|
}
|
|
120815
120830
|
function buildMarks(marks) {
|
|
120816
120831
|
return (marks ?? []).map((mark) => ({
|
|
120817
|
-
"@_x1":
|
|
120818
|
-
"@_y1":
|
|
120819
|
-
"@_x2":
|
|
120820
|
-
"@_y2":
|
|
120832
|
+
"@_x1": round2(mark.x1 * 1e5),
|
|
120833
|
+
"@_y1": round2(mark.y1 * 1e5),
|
|
120834
|
+
"@_x2": round2(mark.x2 * 1e5),
|
|
120835
|
+
"@_y2": round2(mark.y2 * 1e5)
|
|
120821
120836
|
}));
|
|
120822
120837
|
}
|
|
120823
120838
|
function buildBackgroundRemovalNode(removal) {
|
|
@@ -120825,10 +120840,10 @@ function buildBackgroundRemovalNode(removal) {
|
|
|
120825
120840
|
return removal.rawXml;
|
|
120826
120841
|
}
|
|
120827
120842
|
const node = {
|
|
120828
|
-
"@_t":
|
|
120829
|
-
"@_b":
|
|
120830
|
-
"@_l":
|
|
120831
|
-
"@_r":
|
|
120843
|
+
"@_t": round2(removal.top * 1e5),
|
|
120844
|
+
"@_b": round2(removal.bottom * 1e5),
|
|
120845
|
+
"@_l": round2(removal.left * 1e5),
|
|
120846
|
+
"@_r": round2(removal.right * 1e5)
|
|
120832
120847
|
};
|
|
120833
120848
|
const foreground = buildMarks(removal.foregroundMarks);
|
|
120834
120849
|
if (foreground.length > 0) {
|
|
@@ -120846,26 +120861,26 @@ function buildImgEffects(effects) {
|
|
|
120846
120861
|
out.push({ "a14:backgroundRemoval": buildBackgroundRemovalNode(effects.backgroundRemoval) });
|
|
120847
120862
|
}
|
|
120848
120863
|
if (finite3(effects.sharpenSoften?.amount)) {
|
|
120849
|
-
out.push({ "a14:sharpenSoften": { "@_amount":
|
|
120864
|
+
out.push({ "a14:sharpenSoften": { "@_amount": round2(effects.sharpenSoften.amount) } });
|
|
120850
120865
|
}
|
|
120851
120866
|
const bc = effects.brightnessContrast;
|
|
120852
120867
|
if (bc && (finite3(bc.bright) || finite3(bc.contrast))) {
|
|
120853
120868
|
const node = {};
|
|
120854
120869
|
if (finite3(bc.bright)) {
|
|
120855
|
-
node["@_bright"] =
|
|
120870
|
+
node["@_bright"] = round2(bc.bright);
|
|
120856
120871
|
}
|
|
120857
120872
|
if (finite3(bc.contrast)) {
|
|
120858
|
-
node["@_contrast"] =
|
|
120873
|
+
node["@_contrast"] = round2(bc.contrast);
|
|
120859
120874
|
}
|
|
120860
120875
|
out.push({ "a14:brightnessContrast": node });
|
|
120861
120876
|
}
|
|
120862
120877
|
if (finite3(effects.colorTemperature?.colorTemp)) {
|
|
120863
120878
|
out.push({
|
|
120864
|
-
"a14:colorTemperature": { "@_colorTemp":
|
|
120879
|
+
"a14:colorTemperature": { "@_colorTemp": round2(effects.colorTemperature.colorTemp) }
|
|
120865
120880
|
});
|
|
120866
120881
|
}
|
|
120867
120882
|
if (finite3(effects.colorSaturation?.sat)) {
|
|
120868
|
-
out.push({ "a14:saturation": { "@_sat":
|
|
120883
|
+
out.push({ "a14:saturation": { "@_sat": round2(effects.colorSaturation.sat) } });
|
|
120869
120884
|
}
|
|
120870
120885
|
const artistic = a14ArtisticElementName(effects.artisticEffect);
|
|
120871
120886
|
if (artistic !== void 0) {
|
|
@@ -120914,7 +120929,7 @@ function applyA14ImageExtension(blip, effects) {
|
|
|
120914
120929
|
extLst[extKey] = entries.length === 1 ? entries[0] : entries;
|
|
120915
120930
|
blip[extLstKey] = extLst;
|
|
120916
120931
|
}
|
|
120917
|
-
var GALLERY_TO_A14,
|
|
120932
|
+
var GALLERY_TO_A14, round2, finite3;
|
|
120918
120933
|
var init_image_a14_effects_writer = __esm({
|
|
120919
120934
|
"pptx/core/core/runtime/image-a14-effects-writer.ts"() {
|
|
120920
120935
|
init_image_a14_effects();
|
|
@@ -120946,7 +120961,7 @@ var init_image_a14_effects_writer = __esm({
|
|
|
120946
120961
|
texturizer: "artisticTexturizer",
|
|
120947
120962
|
watercolorSponge: "artisticWatercolorSponge"
|
|
120948
120963
|
};
|
|
120949
|
-
|
|
120964
|
+
round2 = (value) => String(Math.round(value));
|
|
120950
120965
|
finite3 = (value) => typeof value === "number" && Number.isFinite(value);
|
|
120951
120966
|
}
|
|
120952
120967
|
});
|
|
@@ -122637,7 +122652,7 @@ function renderSmartArtShape(shape) {
|
|
|
122637
122652
|
const fillOpacity = shape.fillOpacity !== void 0 && shape.fillOpacity < 1 ? ` fill-opacity="${shape.fillOpacity}"` : "";
|
|
122638
122653
|
const fill = esc3(shape.fillColor ?? "#4472C4");
|
|
122639
122654
|
const stroke = esc3(shape.strokeColor ?? "#FFFFFF");
|
|
122640
|
-
const
|
|
122655
|
+
const transform7 = shape.rotation ? ` transform="rotate(${shape.rotation} ${shape.x + shape.width / 2} ${shape.y + shape.height / 2})"` : "";
|
|
122641
122656
|
let geometry;
|
|
122642
122657
|
if (shape.shapeType === "ellipse") {
|
|
122643
122658
|
geometry = `<ellipse cx="${shape.x + shape.width / 2}" cy="${shape.y + shape.height / 2}" rx="${shape.width / 2}" ry="${shape.height / 2}" fill="${fill}"${fillOpacity} stroke="${stroke}" />`;
|
|
@@ -122647,7 +122662,7 @@ function renderSmartArtShape(shape) {
|
|
|
122647
122662
|
geometry = `<rect x="${shape.x}" y="${shape.y}" width="${shape.width}" height="${shape.height}" rx="${shape.shapeType === "roundRect" ? Math.min(shape.width, shape.height) * 0.12 : 0}" fill="${fill}"${fillOpacity} stroke="${stroke}" stroke-width="${shape.strokeWidth ?? 1}" />`;
|
|
122648
122663
|
}
|
|
122649
122664
|
const text = shape.text ? `<text x="${shape.x + shape.width / 2}" y="${shape.y + shape.height / 2}" text-anchor="middle" dominant-baseline="central" font-family="Arial" font-size="${shape.fontSize ?? 12}" fill="${esc3(shape.fontColor ?? "#FFFFFF")}">${esc3(shape.text)}</text>` : "";
|
|
122650
|
-
return `<g data-smartart-shape="${esc3(shape.id)}"${
|
|
122665
|
+
return `<g data-smartart-shape="${esc3(shape.id)}"${transform7}>${geometry}${text}</g>`;
|
|
122651
122666
|
}
|
|
122652
122667
|
function renderSmartArtSvg(element) {
|
|
122653
122668
|
const data = element.smartArtData;
|
|
@@ -123059,7 +123074,7 @@ function renderElement(el, defaults, ctx) {
|
|
|
123059
123074
|
if (el.hidden) {
|
|
123060
123075
|
return "";
|
|
123061
123076
|
}
|
|
123062
|
-
const
|
|
123077
|
+
const transform7 = renderTransform(el);
|
|
123063
123078
|
const opacity2 = el.opacity;
|
|
123064
123079
|
let inner = "";
|
|
123065
123080
|
switch (el.type) {
|
|
@@ -123114,7 +123129,7 @@ function renderElement(el, defaults, ctx) {
|
|
|
123114
123129
|
return "";
|
|
123115
123130
|
}
|
|
123116
123131
|
return `<g${attrs2({
|
|
123117
|
-
transform:
|
|
123132
|
+
transform: transform7,
|
|
123118
123133
|
opacity: opacity2 !== void 0 && opacity2 < 1 ? opacity2 : void 0
|
|
123119
123134
|
})}>${inner}</g>`;
|
|
123120
123135
|
}
|
|
@@ -133166,13 +133181,13 @@ function applyRoleColors(labels, roleColors, getLocalName2, resolveColor2) {
|
|
|
133166
133181
|
}
|
|
133167
133182
|
return mutated;
|
|
133168
133183
|
}
|
|
133169
|
-
function applySmartArtColorTransform(colorsDef,
|
|
133170
|
-
if (!
|
|
133184
|
+
function applySmartArtColorTransform(colorsDef, transform7, getLocalName2, resolveColor2) {
|
|
133185
|
+
if (!transform7) {
|
|
133171
133186
|
return false;
|
|
133172
133187
|
}
|
|
133173
133188
|
let mutated = false;
|
|
133174
|
-
mutated = applySmartArtDefinitionMetadata(colorsDef,
|
|
133175
|
-
mutated = applySmartArtColorStyleLabels(colorsDef,
|
|
133189
|
+
mutated = applySmartArtDefinitionMetadata(colorsDef, transform7, getLocalName2) || mutated;
|
|
133190
|
+
mutated = applySmartArtColorStyleLabels(colorsDef, transform7.labels, getLocalName2) || mutated;
|
|
133176
133191
|
const styleLblKey = findKey34(colorsDef, "styleLbl", getLocalName2);
|
|
133177
133192
|
if (!styleLblKey) {
|
|
133178
133193
|
return mutated;
|
|
@@ -133181,15 +133196,15 @@ function applySmartArtColorTransform(colorsDef, transform6, getLocalName2, resol
|
|
|
133181
133196
|
if (labels.length === 0) {
|
|
133182
133197
|
return mutated;
|
|
133183
133198
|
}
|
|
133184
|
-
if (
|
|
133185
|
-
return applyRoleColors(labels,
|
|
133199
|
+
if (transform7.roleColors) {
|
|
133200
|
+
return applyRoleColors(labels, transform7.roleColors, getLocalName2, resolveColor2) || mutated;
|
|
133186
133201
|
}
|
|
133187
133202
|
let fillIndex = 0;
|
|
133188
133203
|
let lineIndex = 0;
|
|
133189
133204
|
for (const label of labels) {
|
|
133190
133205
|
const fillKey = findKey34(label, "fillClrLst", getLocalName2);
|
|
133191
133206
|
if (fillKey) {
|
|
133192
|
-
const value =
|
|
133207
|
+
const value = transform7.fillColors[fillIndex++];
|
|
133193
133208
|
const list2 = asObject2(label[fillKey]);
|
|
133194
133209
|
if (list2 && value) {
|
|
133195
133210
|
applyColorToList(list2, value, getLocalName2, resolveColor2);
|
|
@@ -133198,7 +133213,7 @@ function applySmartArtColorTransform(colorsDef, transform6, getLocalName2, resol
|
|
|
133198
133213
|
}
|
|
133199
133214
|
const lineKey = findKey34(label, "linClrLst", getLocalName2);
|
|
133200
133215
|
if (lineKey) {
|
|
133201
|
-
const value =
|
|
133216
|
+
const value = transform7.lineColors[lineIndex++];
|
|
133202
133217
|
const list2 = asObject2(label[lineKey]);
|
|
133203
133218
|
if (list2 && value) {
|
|
133204
133219
|
applyColorToList(list2, value, getLocalName2, resolveColor2);
|
|
@@ -133903,8 +133918,8 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
133903
133918
|
* carries no colour transform.
|
|
133904
133919
|
*/
|
|
133905
133920
|
async regenerateSmartArtColorPart(slidePath, smartArtData) {
|
|
133906
|
-
const
|
|
133907
|
-
if (!smartArtData?.colorsRelId || !
|
|
133921
|
+
const transform7 = smartArtData?.colorTransform;
|
|
133922
|
+
if (!smartArtData?.colorsRelId || !transform7) {
|
|
133908
133923
|
return;
|
|
133909
133924
|
}
|
|
133910
133925
|
await this.mergeSmartArtDiagramPart(
|
|
@@ -133914,7 +133929,7 @@ var init_PptxHandlerRuntimeSaveDocumentParts = __esm({
|
|
|
133914
133929
|
"colours",
|
|
133915
133930
|
(colorsDef) => applySmartArtColorTransform(
|
|
133916
133931
|
colorsDef,
|
|
133917
|
-
|
|
133932
|
+
transform7,
|
|
133918
133933
|
(k) => this.compatibilityService.getXmlLocalName(k),
|
|
133919
133934
|
(node) => this.parseColor(node)
|
|
133920
133935
|
)
|
|
@@ -136494,27 +136509,27 @@ var init_PptxHandlerRuntimeSaveZoom = __esm({
|
|
|
136494
136509
|
}
|
|
136495
136510
|
applyZoomTransform(shapeProperties, el) {
|
|
136496
136511
|
const emu2 = _PptxHandlerRuntime.EMU_PER_PX;
|
|
136497
|
-
const
|
|
136498
|
-
|
|
136512
|
+
const transform7 = ensureXmlChildOrCreate(shapeProperties, "a:xfrm");
|
|
136513
|
+
transform7["a:off"] = {
|
|
136499
136514
|
"@_x": String(Math.round(el.x * emu2)),
|
|
136500
136515
|
"@_y": String(Math.round(el.y * emu2))
|
|
136501
136516
|
};
|
|
136502
|
-
|
|
136517
|
+
transform7["a:ext"] = {
|
|
136503
136518
|
"@_cx": String(Math.round(Math.max(el.width, 1) * emu2)),
|
|
136504
136519
|
"@_cy": String(Math.round(Math.max(el.height, 1) * emu2))
|
|
136505
136520
|
};
|
|
136506
136521
|
if (el.rotation !== void 0) {
|
|
136507
|
-
|
|
136522
|
+
transform7["@_rot"] = String(Math.round(el.rotation * 6e4));
|
|
136508
136523
|
}
|
|
136509
136524
|
if (el.flipHorizontal) {
|
|
136510
|
-
|
|
136525
|
+
transform7["@_flipH"] = "1";
|
|
136511
136526
|
} else {
|
|
136512
|
-
delete
|
|
136527
|
+
delete transform7["@_flipH"];
|
|
136513
136528
|
}
|
|
136514
136529
|
if (el.flipVertical) {
|
|
136515
|
-
|
|
136530
|
+
transform7["@_flipV"] = "1";
|
|
136516
136531
|
} else {
|
|
136517
|
-
delete
|
|
136532
|
+
delete transform7["@_flipV"];
|
|
136518
136533
|
}
|
|
136519
136534
|
}
|
|
136520
136535
|
applyZoomBlipRelationship(zoomProperties, relationshipId2) {
|
|
@@ -136913,41 +136928,41 @@ var init_PptxHandlerRuntimeSaveModel3D = __esm({
|
|
|
136913
136928
|
return result;
|
|
136914
136929
|
}
|
|
136915
136930
|
applyModel3DTransform(spPr, el) {
|
|
136916
|
-
const
|
|
136931
|
+
const transform7 = ensureXmlChildOrCreate(spPr, "a:xfrm");
|
|
136917
136932
|
const emu2 = _PptxHandlerRuntime.EMU_PER_PX;
|
|
136918
136933
|
const width = Math.max(el.width, 1);
|
|
136919
136934
|
const height = Math.max(el.height, 1);
|
|
136920
|
-
|
|
136935
|
+
transform7["a:off"] = {
|
|
136921
136936
|
"@_x": String(resolveXfrmEmu(el.x, el.xEmu, emu2)),
|
|
136922
136937
|
"@_y": String(resolveXfrmEmu(el.y, el.yEmu, emu2))
|
|
136923
136938
|
};
|
|
136924
|
-
|
|
136939
|
+
transform7["a:ext"] = {
|
|
136925
136940
|
"@_cx": String(resolveXfrmEmu(width, el.widthEmu, emu2)),
|
|
136926
136941
|
"@_cy": String(resolveXfrmEmu(height, el.heightEmu, emu2))
|
|
136927
136942
|
};
|
|
136928
|
-
this.applyModel3DTransformFlags(
|
|
136943
|
+
this.applyModel3DTransformFlags(transform7, el);
|
|
136929
136944
|
}
|
|
136930
|
-
applyModel3DTransformFlags(
|
|
136945
|
+
applyModel3DTransformFlags(transform7, el) {
|
|
136931
136946
|
for (const [attribute6, value] of [
|
|
136932
136947
|
["@_rot", el.rotation],
|
|
136933
136948
|
["@_skewX", el.skewX],
|
|
136934
136949
|
["@_skewY", el.skewY]
|
|
136935
136950
|
]) {
|
|
136936
136951
|
if (value === void 0) {
|
|
136937
|
-
delete
|
|
136952
|
+
delete transform7[attribute6];
|
|
136938
136953
|
} else {
|
|
136939
|
-
|
|
136954
|
+
transform7[attribute6] = String(Math.round(value * 6e4));
|
|
136940
136955
|
}
|
|
136941
136956
|
}
|
|
136942
136957
|
if (el.flipHorizontal) {
|
|
136943
|
-
|
|
136958
|
+
transform7["@_flipH"] = "1";
|
|
136944
136959
|
} else {
|
|
136945
|
-
delete
|
|
136960
|
+
delete transform7["@_flipH"];
|
|
136946
136961
|
}
|
|
136947
136962
|
if (el.flipVertical) {
|
|
136948
|
-
|
|
136963
|
+
transform7["@_flipV"] = "1";
|
|
136949
136964
|
} else {
|
|
136950
|
-
delete
|
|
136965
|
+
delete transform7["@_flipV"];
|
|
136951
136966
|
}
|
|
136952
136967
|
}
|
|
136953
136968
|
buildModel3DFallbackPicture(el, posterRelationshipId) {
|
|
@@ -137141,14 +137156,14 @@ var init_PptxHandlerRuntimeSaveContentPartInk = __esm({
|
|
|
137141
137156
|
applyContentPartTransform(shape, el) {
|
|
137142
137157
|
const emu2 = _PptxHandlerRuntime.EMU_PER_PX;
|
|
137143
137158
|
const xfrmKey = Object.hasOwn(shape, "p:xfrm") ? "p:xfrm" : "p14:xfrm";
|
|
137144
|
-
const
|
|
137159
|
+
const transform7 = ensureXmlChildOrCreate(shape, xfrmKey);
|
|
137145
137160
|
const width = Math.max(el.width, 1);
|
|
137146
137161
|
const height = Math.max(el.height, 1);
|
|
137147
|
-
|
|
137162
|
+
transform7["a:off"] = {
|
|
137148
137163
|
"@_x": String(resolveXfrmEmu(el.x, el.xEmu, emu2)),
|
|
137149
137164
|
"@_y": String(resolveXfrmEmu(el.y, el.yEmu, emu2))
|
|
137150
137165
|
};
|
|
137151
|
-
|
|
137166
|
+
transform7["a:ext"] = {
|
|
137152
137167
|
"@_cx": String(resolveXfrmEmu(width, el.widthEmu, emu2)),
|
|
137153
137168
|
"@_cy": String(resolveXfrmEmu(height, el.heightEmu, emu2))
|
|
137154
137169
|
};
|
|
@@ -141990,9 +142005,9 @@ var init_PptxHandlerRuntimeZoomParsing = __esm({
|
|
|
141990
142005
|
const zoomObject = zoom["pslz:sldZmObj"];
|
|
141991
142006
|
const zoomProperties = zoomObject?.["pslz:zmPr"];
|
|
141992
142007
|
const shapeProperties = zoomProperties?.["p166:spPr"];
|
|
141993
|
-
const
|
|
141994
|
-
const offset =
|
|
141995
|
-
const extent =
|
|
142008
|
+
const transform7 = shapeProperties?.["a:xfrm"];
|
|
142009
|
+
const offset = transform7?.["a:off"];
|
|
142010
|
+
const extent = transform7?.["a:ext"];
|
|
141996
142011
|
const targetSlideIndex = this.findSlideIndexByNumericId(zoomObject?.["@_sldId"]);
|
|
141997
142012
|
if (!zoomObject || !zoomProperties || !offset || !extent || targetSlideIndex < 0) {
|
|
141998
142013
|
return null;
|
|
@@ -142021,9 +142036,9 @@ var init_PptxHandlerRuntimeZoomParsing = __esm({
|
|
|
142021
142036
|
y: Number(offset["@_y"] ?? 0) / emu2,
|
|
142022
142037
|
width: Number(extent["@_cx"] ?? 0) / emu2,
|
|
142023
142038
|
height: Number(extent["@_cy"] ?? 0) / emu2,
|
|
142024
|
-
rotation:
|
|
142025
|
-
flipHorizontal: readBoolean(
|
|
142026
|
-
flipVertical: readBoolean(
|
|
142039
|
+
rotation: transform7?.["@_rot"] !== void 0 ? Number(transform7["@_rot"]) / 6e4 : void 0,
|
|
142040
|
+
flipHorizontal: readBoolean(transform7?.["@_flipH"]),
|
|
142041
|
+
flipVertical: readBoolean(transform7?.["@_flipV"]),
|
|
142027
142042
|
imagePath,
|
|
142028
142043
|
imageData,
|
|
142029
142044
|
...this.parseZoomObjectProperties(zoomProperties),
|
|
@@ -142084,9 +142099,9 @@ var init_PptxHandlerRuntimeSectionZoomParsing = __esm({
|
|
|
142084
142099
|
const targetSlideIndex = this.findSlideIndexByNumericId(section?.slideIds[0]);
|
|
142085
142100
|
const zoomProperties = zoomObject?.["psezm:zmPr"];
|
|
142086
142101
|
const shapeProperties = zoomProperties?.["p166:spPr"];
|
|
142087
|
-
const
|
|
142088
|
-
const offset =
|
|
142089
|
-
const extent =
|
|
142102
|
+
const transform7 = shapeProperties?.["a:xfrm"];
|
|
142103
|
+
const offset = transform7?.["a:off"];
|
|
142104
|
+
const extent = transform7?.["a:ext"];
|
|
142090
142105
|
if (!sectionId || !zoomProperties || !offset || !extent || targetSlideIndex < 0) {
|
|
142091
142106
|
return null;
|
|
142092
142107
|
}
|
|
@@ -142115,9 +142130,9 @@ var init_PptxHandlerRuntimeSectionZoomParsing = __esm({
|
|
|
142115
142130
|
y: Number(offset["@_y"] ?? 0) / emu2,
|
|
142116
142131
|
width: Number(extent["@_cx"] ?? 0) / emu2,
|
|
142117
142132
|
height: Number(extent["@_cy"] ?? 0) / emu2,
|
|
142118
|
-
rotation:
|
|
142119
|
-
flipHorizontal: readBoolean2(
|
|
142120
|
-
flipVertical: readBoolean2(
|
|
142133
|
+
rotation: transform7?.["@_rot"] !== void 0 ? Number(transform7["@_rot"]) / 6e4 : void 0,
|
|
142134
|
+
flipHorizontal: readBoolean2(transform7?.["@_flipH"]),
|
|
142135
|
+
flipVertical: readBoolean2(transform7?.["@_flipV"]),
|
|
142121
142136
|
imagePath,
|
|
142122
142137
|
imageData,
|
|
142123
142138
|
...this.parseZoomObjectProperties(zoomProperties),
|
|
@@ -142152,9 +142167,9 @@ var init_PptxHandlerRuntimeSummaryZoomParsing = __esm({
|
|
|
142152
142167
|
const targetSlideIndex = this.findSlideIndexByNumericId(section?.slideIds[0]);
|
|
142153
142168
|
const properties = object["psuz:zmPr"];
|
|
142154
142169
|
const shapeProperties = properties?.["p166:spPr"];
|
|
142155
|
-
const
|
|
142156
|
-
const offset =
|
|
142157
|
-
const extent =
|
|
142170
|
+
const transform7 = shapeProperties?.["a:xfrm"];
|
|
142171
|
+
const offset = transform7?.["a:off"];
|
|
142172
|
+
const extent = transform7?.["a:ext"];
|
|
142158
142173
|
if (!sectionId || targetSlideIndex < 0 || !properties || !offset || !extent) {
|
|
142159
142174
|
continue;
|
|
142160
142175
|
}
|
|
@@ -145668,7 +145683,7 @@ var init_PptxHandlerRuntimeGroupParsing = __esm({
|
|
|
145668
145683
|
return [];
|
|
145669
145684
|
}
|
|
145670
145685
|
const grpSpPr = group["p:grpSpPr"];
|
|
145671
|
-
const
|
|
145686
|
+
const transform7 = readGroupTransform(grpSpPr?.["a:xfrm"], _PptxHandlerRuntime.EMU_PER_PX);
|
|
145672
145687
|
this.unwrapAlternateContent(group);
|
|
145673
145688
|
const childOrder3 = this.extractSpTreeChildOrder(
|
|
145674
145689
|
resolveGroupXmlSlice(group, rawXmlStr),
|
|
@@ -145690,7 +145705,7 @@ var init_PptxHandlerRuntimeGroupParsing = __esm({
|
|
|
145690
145705
|
depth + 1
|
|
145691
145706
|
);
|
|
145692
145707
|
if (nested) {
|
|
145693
|
-
transformGroupChild(nested,
|
|
145708
|
+
transformGroupChild(nested, transform7);
|
|
145694
145709
|
elements3.push(nested);
|
|
145695
145710
|
}
|
|
145696
145711
|
} else {
|
|
@@ -145704,7 +145719,7 @@ var init_PptxHandlerRuntimeGroupParsing = __esm({
|
|
|
145704
145719
|
if (element) {
|
|
145705
145720
|
const childNode = this.ensureArray(group[entry2.tag])[entry2.indexInType];
|
|
145706
145721
|
applyRawChildGeometry(element, childNode, _PptxHandlerRuntime.EMU_PER_PX);
|
|
145707
|
-
transformGroupChild(element,
|
|
145722
|
+
transformGroupChild(element, transform7);
|
|
145708
145723
|
elements3.push(element);
|
|
145709
145724
|
}
|
|
145710
145725
|
}
|
|
@@ -145726,11 +145741,11 @@ var init_PptxHandlerRuntimeGroupParsing = __esm({
|
|
|
145726
145741
|
grpSpPr?.["a:xfrm"],
|
|
145727
145742
|
_PptxHandlerRuntime.EMU_PER_PX
|
|
145728
145743
|
);
|
|
145729
|
-
const
|
|
145730
|
-
const parentX =
|
|
145731
|
-
const parentY =
|
|
145732
|
-
const parentW =
|
|
145733
|
-
const parentH =
|
|
145744
|
+
const round3 = depth === 0 ? Math.round : (value) => value;
|
|
145745
|
+
const parentX = round3(raw.parentX);
|
|
145746
|
+
const parentY = round3(raw.parentY);
|
|
145747
|
+
const parentW = round3(raw.parentW);
|
|
145748
|
+
const parentH = round3(raw.parentH);
|
|
145734
145749
|
const grpFillStyle = grpSpPr ? this.extractShapeStyle(grpSpPr) : void 0;
|
|
145735
145750
|
if (grpFillStyle?.fillMode === "image" && grpSpPr) {
|
|
145736
145751
|
const blipFill = grpSpPr["a:blipFill"];
|
|
@@ -155022,9 +155037,9 @@ function withPlaceableHeader(view, headerOffset, wmf) {
|
|
|
155022
155037
|
const inch = widthEmu > 0 && right > left ? Math.round((right - left) * 914400 / widthEmu) : 1440;
|
|
155023
155038
|
const out = new Uint8Array(22 + wmf.length);
|
|
155024
155039
|
const out16 = new DataView(out.buffer);
|
|
155025
|
-
const
|
|
155040
|
+
const words2 = [52695, 39622, 0, left, top, right, bottom, inch, 0, 0];
|
|
155026
155041
|
let checksum = 0;
|
|
155027
|
-
|
|
155042
|
+
words2.forEach((word, i2) => {
|
|
155028
155043
|
out16.setUint16(i2 * 2, word & 65535, true);
|
|
155029
155044
|
checksum ^= word & 65535;
|
|
155030
155045
|
});
|