ooxml-core 1.6.0 → 1.6.2
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-DDEJ6CKU.mjs → PptxHandler-BL4B7CZO.mjs} +2 -2
- package/dist/automation/index.cjs +1 -1
- package/dist/automation/index.mjs +1 -1
- package/dist/chart/gradient-definition.d.ts +2 -0
- package/dist/chart/gradient-definition.d.ts.map +1 -1
- package/dist/chart/index.cjs +1 -1
- package/dist/chart/index.mjs +1 -1
- package/dist/{chunk-5L4DHJV3.mjs → chunk-GAGSCAR3.mjs} +46 -43
- package/dist/{chunk-QXZJOUW4.mjs → chunk-NIHPA63A.mjs} +1 -1
- package/dist/{chunk-UQQGC6O3.mjs → chunk-TTPZITQN.mjs} +841 -614
- package/dist/{chunk-Q52O7SXQ.mjs → chunk-Z7IQR4S4.mjs} +3 -3
- package/dist/{chunk-EPNLABIU.mjs → chunk-ZAP5WLEN.mjs} +1 -1
- package/dist/crypto/index.cjs +281 -109
- package/dist/crypto/index.mjs +281 -109
- package/dist/diagram/engine/text-measure.d.ts +1 -1
- package/dist/diagram/layout/smartart-font-table.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-interpreter-linear-content-size.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-item-font-size.d.ts +1 -1
- package/dist/diagram/layout/smartart-layout-item-font-tier-fit.d.ts +1 -1
- package/dist/diagram/layout/smartart-line-pitch.d.ts +1 -1
- package/dist/diagram/layout/smartart-text-wrap-fit.d.ts +1 -1
- package/dist/docx/index.cjs +1 -1
- package/dist/docx/index.mjs +1 -1
- package/dist/docx/layout/index.cjs +1 -1
- package/dist/docx/layout/index.mjs +1 -1
- package/dist/docx/load/index.cjs +481 -254
- package/dist/docx/load/index.mjs +481 -254
- package/dist/docx/ui/index.cjs +1 -1
- package/dist/docx/ui/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/pptx/automation/index.cjs +1391 -1154
- package/dist/pptx/automation/index.d.ts +3 -3
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{index-JNv7AJx5.d.ts → index-CKIUurnd.d.ts} +2 -2
- package/dist/pptx/chunks/{index-JNv7AJx5.d.ts.map → index-CKIUurnd.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-EZJZ7USt.d.ts → index-Cn-GzYGp.d.ts} +64 -15
- package/dist/pptx/chunks/{index-EZJZ7USt.d.ts.map → index-Cn-GzYGp.d.ts.map} +1 -1
- package/dist/pptx/chunks/{text-operations-DtCxXrMh.d.ts → text-operations-BHfAm5K9.d.ts} +8 -1
- package/dist/pptx/chunks/text-operations-BHfAm5K9.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +1270 -1088
- 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 +1411 -1174
- package/dist/pptx/index.d.ts +3 -3
- package/dist/pptx/index.mjs +5 -5
- package/dist/text/font-metrics/font-advance-widths-aptos-display.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-aptos.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-arial.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-calibri-light.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-calibri.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-segoe-ui.generated.d.ts +1 -1
- package/dist/text/font-metrics/font-advance-widths-times-new-roman.generated.d.ts +1 -1
- package/dist/visio/index.cjs +482 -232
- package/dist/visio/index.mjs +482 -232
- package/dist/visio/ui/data-graphic-rules.d.ts +2 -2
- package/dist/xlsx/formula/test-helpers.d.ts +9 -9
- package/dist/xlsx/index.cjs +1 -1
- package/dist/xlsx/index.mjs +1 -1
- package/dist/xlsx/load/index.cjs +415 -188
- package/dist/xlsx/load/index.mjs +415 -188
- package/package.json +5 -5
- package/dist/pptx/chunks/text-operations-DtCxXrMh.d.ts.map +0 -1
package/dist/visio/index.cjs
CHANGED
|
@@ -445,8 +445,8 @@ function inspectNamespaces(root2, check) {
|
|
|
445
445
|
if (attr2.namespaceURI === xmlns && (attr2.name === "xmlns:xmlns" || attr2.value === xmlns || (attr2.name === "xmlns:xml" ? attr2.value !== xml : attr2.value === xml) || attr2.name !== "xmlns" && !attr2.value))
|
|
446
446
|
fail("INVALID_XML", "Invalid reserved XML namespace binding");
|
|
447
447
|
}
|
|
448
|
-
for (const
|
|
449
|
-
if (
|
|
448
|
+
for (const child3 of Array.from(element2.childNodes))
|
|
449
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -701,7 +701,7 @@ function metadataAttributes(node2) {
|
|
|
701
701
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
702
702
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
703
703
|
var children2 = (node2, name3) => node2 ? elements(node2).filter(
|
|
704
|
-
(
|
|
704
|
+
(child3) => child3.localName === name3 && (child3.namespaceURI === VISIO_NS || child3.namespaceURI === VISIO_LEGACY_NS)
|
|
705
705
|
) : [];
|
|
706
706
|
var child = (node2, name3) => children2(node2, name3)[0];
|
|
707
707
|
var attribute2 = (node2, name3) => node2?.getAttribute(name3) ?? void 0;
|
|
@@ -2269,7 +2269,7 @@ function setCell(shape, name3, value, formula) {
|
|
|
2269
2269
|
node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
2270
2270
|
node2.setAttribute("N", name3);
|
|
2271
2271
|
const before = Array.from(shape.childNodes).find(
|
|
2272
|
-
(
|
|
2272
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
2273
2273
|
);
|
|
2274
2274
|
shape.insertBefore(node2, before ?? null);
|
|
2275
2275
|
}
|
|
@@ -4168,7 +4168,7 @@ function serializeEditedXml(root2, limits, check) {
|
|
|
4168
4168
|
if (/[\t\r\n]/.test(attr2.value))
|
|
4169
4169
|
fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
|
|
4170
4170
|
}
|
|
4171
|
-
for (const
|
|
4171
|
+
for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
|
|
4172
4172
|
}
|
|
4173
4173
|
let xml = buildXml(root2.ownerDocument);
|
|
4174
4174
|
xml = xml.replace(
|
|
@@ -5897,7 +5897,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5897
5897
|
const p = target2.paint;
|
|
5898
5898
|
characters += p.fill.length + p.stroke.length + p.fillRule.length + p.strokeLinecap.length + p.strokeLinejoin.length;
|
|
5899
5899
|
}
|
|
5900
|
-
} else for (const
|
|
5900
|
+
} else for (const child3 of target2.items) strings(child3);
|
|
5901
5901
|
if (characters > limits.maxCharacters) limit("Retained vector character limit exceeded.");
|
|
5902
5902
|
}
|
|
5903
5903
|
for (const clip of scene.clips) strings(clip);
|
|
@@ -5943,7 +5943,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5943
5943
|
finite2(extent2 * (Math.abs(matrix3[0]) + Math.abs(matrix3[2])), limits.maxCoordinate);
|
|
5944
5944
|
finite2(extent2 * (Math.abs(matrix3[1]) + Math.abs(matrix3[3])), limits.maxCoordinate);
|
|
5945
5945
|
}
|
|
5946
|
-
} else for (const
|
|
5946
|
+
} else for (const child3 of target2.items) content2(child3, matrix3, depth + 1);
|
|
5947
5947
|
if (target2.clipIndex !== void 0) content2(scene.clips[target2.clipIndex], matrix3, depth + 1);
|
|
5948
5948
|
}
|
|
5949
5949
|
for (const clip of scene.clips) content2(clip, IDENTITY, 1);
|
|
@@ -6074,7 +6074,7 @@ function validate(value, limits) {
|
|
|
6074
6074
|
kind: "group",
|
|
6075
6075
|
...base(node2),
|
|
6076
6076
|
items: Object.freeze(
|
|
6077
|
-
array(node2.items, limits.maxNodes - nodes).map((
|
|
6077
|
+
array(node2.items, limits.maxNodes - nodes).map((child3) => item(child3, depth + 1))
|
|
6078
6078
|
)
|
|
6079
6079
|
});
|
|
6080
6080
|
}
|
|
@@ -6082,11 +6082,11 @@ function validate(value, limits) {
|
|
|
6082
6082
|
const node2 = own(input, ["matrix", "clipIndex", "items"], depth);
|
|
6083
6083
|
const items2 = [];
|
|
6084
6084
|
for (const value2 of array(node2.items, limits.maxNodes - nodes)) {
|
|
6085
|
-
const
|
|
6086
|
-
if (
|
|
6085
|
+
const child3 = own(value2, ["matrix", "clipIndex", "commands", "clipRule"], depth + 1);
|
|
6086
|
+
if (child3.clipRule !== "nonzero" && child3.clipRule !== "evenodd")
|
|
6087
6087
|
unsafe("Invalid normalized clip rule.");
|
|
6088
6088
|
items2.push(
|
|
6089
|
-
Object.freeze({ ...base(
|
|
6089
|
+
Object.freeze({ ...base(child3), commands: path(child3.commands), clipRule: child3.clipRule })
|
|
6090
6090
|
);
|
|
6091
6091
|
}
|
|
6092
6092
|
return Object.freeze({ ...base(node2), items: Object.freeze(items2) });
|
|
@@ -6212,7 +6212,7 @@ function sanitize(root2, limits) {
|
|
|
6212
6212
|
paint: paint(data2.attrs)
|
|
6213
6213
|
}) : Object.assign(target2, {
|
|
6214
6214
|
kind: "group",
|
|
6215
|
-
items: Object.freeze(children5(data2.children).map((
|
|
6215
|
+
items: Object.freeze(children5(data2.children).map((child3) => item(child3, depth + 1)))
|
|
6216
6216
|
});
|
|
6217
6217
|
freezeLater.push(result);
|
|
6218
6218
|
return result;
|
|
@@ -6229,8 +6229,8 @@ function sanitize(root2, limits) {
|
|
|
6229
6229
|
ids.set(id3, clips.length);
|
|
6230
6230
|
const target2 = base(data2.attrs);
|
|
6231
6231
|
const paths = [];
|
|
6232
|
-
for (const
|
|
6233
|
-
const part = node2(
|
|
6232
|
+
for (const child3 of children5(data2.children)) {
|
|
6233
|
+
const part = node2(child3, depth + 1, true);
|
|
6234
6234
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
6235
6235
|
const path = Object.assign(base(part.attrs), {
|
|
6236
6236
|
commands: leaf(part),
|
|
@@ -6254,12 +6254,12 @@ function sanitize(root2, limits) {
|
|
|
6254
6254
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
6255
6255
|
unsafe("Viewport differs from dimensions.");
|
|
6256
6256
|
const items = [];
|
|
6257
|
-
for (const
|
|
6258
|
-
const peek = record(
|
|
6257
|
+
for (const child3 of children5(data.children)) {
|
|
6258
|
+
const peek = record(child3, ["tag", "attrs", "children"]);
|
|
6259
6259
|
if (peek.tag === "defs") {
|
|
6260
|
-
const defs = node2(
|
|
6260
|
+
const defs = node2(child3, 1);
|
|
6261
6261
|
for (const value of children5(defs.children)) definition(value, 2);
|
|
6262
|
-
} else items.push(item(
|
|
6262
|
+
} else items.push(item(child3, 1));
|
|
6263
6263
|
}
|
|
6264
6264
|
for (const { target: target2, id: id3 } of pending) {
|
|
6265
6265
|
const index = ids.get(id3);
|
|
@@ -7085,9 +7085,9 @@ function parseDrawingColor(element2) {
|
|
|
7085
7085
|
const color2 = {
|
|
7086
7086
|
kind,
|
|
7087
7087
|
value: colorValue(kind, element2),
|
|
7088
|
-
transforms: elements(element2).map((
|
|
7089
|
-
name:
|
|
7090
|
-
value:
|
|
7088
|
+
transforms: elements(element2).map((child3) => ({
|
|
7089
|
+
name: child3.localName,
|
|
7090
|
+
value: child3.getAttribute("val") ?? ""
|
|
7091
7091
|
}))
|
|
7092
7092
|
};
|
|
7093
7093
|
const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
|
|
@@ -7268,7 +7268,7 @@ function drawingThemeXml(theme2, parts) {
|
|
|
7268
7268
|
const color2 = theme2.colorScheme.colors[slot];
|
|
7269
7269
|
if (!color2) throw new Error(`The theme colour scheme has no ${slot} colour.`);
|
|
7270
7270
|
const node2 = doc.createElementNS(NS.a, `a:${slot}`);
|
|
7271
|
-
for (const
|
|
7271
|
+
for (const child3 of fragment(node2, drawingColorXml(color2), namespaces)) node2.appendChild(child3);
|
|
7272
7272
|
scheme.appendChild(node2);
|
|
7273
7273
|
}
|
|
7274
7274
|
extensionList(scheme, parts.colorSchemeExtensions, namespaces);
|
|
@@ -7752,7 +7752,7 @@ function legacyFillGradient(cells4, width, height, resolve) {
|
|
|
7752
7752
|
};
|
|
7753
7753
|
}
|
|
7754
7754
|
|
|
7755
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
7755
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
7756
7756
|
var CRC_TABLE = (() => {
|
|
7757
7757
|
const table2 = new Uint32Array(256);
|
|
7758
7758
|
for (let n = 0; n < 256; n++) {
|
|
@@ -10525,7 +10525,7 @@ function cloneInherited(shape, parentId, context) {
|
|
|
10525
10525
|
return {
|
|
10526
10526
|
...shape,
|
|
10527
10527
|
id: id3,
|
|
10528
|
-
children: shape.children.map((
|
|
10528
|
+
children: shape.children.map((child3) => cloneInherited(child3, id3, context))
|
|
10529
10529
|
};
|
|
10530
10530
|
}
|
|
10531
10531
|
function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
@@ -10908,7 +10908,7 @@ function scan(xml) {
|
|
|
10908
10908
|
}
|
|
10909
10909
|
const children5 = [];
|
|
10910
10910
|
let depth = 0;
|
|
10911
|
-
let
|
|
10911
|
+
let child3;
|
|
10912
10912
|
i = openEnd;
|
|
10913
10913
|
for (; ; ) {
|
|
10914
10914
|
const lt = xml.indexOf("<", i);
|
|
@@ -10926,13 +10926,13 @@ function scan(xml) {
|
|
|
10926
10926
|
return { root: root2, children: children5 };
|
|
10927
10927
|
}
|
|
10928
10928
|
depth--;
|
|
10929
|
-
if (depth === 0 &&
|
|
10930
|
-
children5.push({ ...
|
|
10929
|
+
if (depth === 0 && child3)
|
|
10930
|
+
children5.push({ ...child3, closeStart: lt, end, selfClosing: false });
|
|
10931
10931
|
} else if (xml[end - 2] === "/") {
|
|
10932
10932
|
if (depth === 0)
|
|
10933
10933
|
children5.push({ start: lt, openEnd: end, closeStart: end, end, selfClosing: true });
|
|
10934
10934
|
} else {
|
|
10935
|
-
if (depth === 0)
|
|
10935
|
+
if (depth === 0) child3 = { start: lt, openEnd: end };
|
|
10936
10936
|
depth++;
|
|
10937
10937
|
}
|
|
10938
10938
|
}
|
|
@@ -11595,7 +11595,7 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
11595
11595
|
return result.reverse();
|
|
11596
11596
|
}
|
|
11597
11597
|
|
|
11598
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11598
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
11599
11599
|
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
11600
11600
|
var ENDOFCHAIN = 4294967294;
|
|
11601
11601
|
var FREESECT = 4294967295;
|
|
@@ -11603,7 +11603,9 @@ var FATSECT = 4294967293;
|
|
|
11603
11603
|
var DIFSECT = 4294967292;
|
|
11604
11604
|
var MAXREGSECT = 4294967290;
|
|
11605
11605
|
var ENTRY_TYPE_EMPTY = 0;
|
|
11606
|
+
var ENTRY_TYPE_STORAGE = 1;
|
|
11606
11607
|
var ENTRY_TYPE_STREAM = 2;
|
|
11608
|
+
var NOSTREAM = 4294967295;
|
|
11607
11609
|
var ENTRY_TYPE_ROOT = 5;
|
|
11608
11610
|
var DIR_ENTRY_SIZE = 128;
|
|
11609
11611
|
var Ole2ParseError = class extends Error {
|
|
@@ -11613,10 +11615,174 @@ var Ole2ParseError = class extends Error {
|
|
|
11613
11615
|
}
|
|
11614
11616
|
};
|
|
11615
11617
|
|
|
11616
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
const
|
|
11618
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
11619
|
+
var FILETIME_UNIX_EPOCH = 116444736000000000n;
|
|
11620
|
+
function readFileTime(view2, offset) {
|
|
11621
|
+
const ticks = view2.getBigUint64(offset, true);
|
|
11622
|
+
if (ticks === 0n)
|
|
11623
|
+
return void 0;
|
|
11624
|
+
const ms = Number((ticks - FILETIME_UNIX_EPOCH) / 10000n);
|
|
11625
|
+
const date2 = new Date(ms);
|
|
11626
|
+
return Number.isNaN(date2.getTime()) ? void 0 : date2;
|
|
11627
|
+
}
|
|
11628
|
+
function decodeSlot(dir, id3, majorVersion, warnings) {
|
|
11629
|
+
const view2 = new DataView(dir.buffer, dir.byteOffset + id3 * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
11630
|
+
const nameLen = view2.getUint16(64, true);
|
|
11631
|
+
const type = view2.getUint8(66);
|
|
11632
|
+
const nameValid = nameLen >= 2 && nameLen <= 64 && nameLen % 2 === 0 && view2.getUint16(nameLen - 2, true) === 0;
|
|
11633
|
+
let name3 = "";
|
|
11634
|
+
if (nameValid)
|
|
11635
|
+
for (let j = 0; j < nameLen - 2; j += 2)
|
|
11636
|
+
name3 += String.fromCharCode(view2.getUint16(j, true));
|
|
11637
|
+
const link = (offset) => {
|
|
11638
|
+
const value = view2.getUint32(offset, true);
|
|
11639
|
+
return value === NOSTREAM ? -1 : value;
|
|
11640
|
+
};
|
|
11641
|
+
const sizeLow = view2.getUint32(120, true);
|
|
11642
|
+
const sizeHigh = view2.getUint32(124, true);
|
|
11643
|
+
let size3 = sizeLow;
|
|
11644
|
+
if (majorVersion === 4)
|
|
11645
|
+
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11646
|
+
else if (sizeHigh !== 0 && type !== ENTRY_TYPE_EMPTY) {
|
|
11647
|
+
warnings.push({ code: "size-high-bits", message: `Ignored v3 stream-size high bits on directory entry ${id3}` });
|
|
11648
|
+
}
|
|
11649
|
+
return {
|
|
11650
|
+
id: id3,
|
|
11651
|
+
type,
|
|
11652
|
+
nameValid,
|
|
11653
|
+
entry: {
|
|
11654
|
+
id: id3,
|
|
11655
|
+
name: name3,
|
|
11656
|
+
type,
|
|
11657
|
+
color: view2.getUint8(67),
|
|
11658
|
+
leftSiblingId: link(68),
|
|
11659
|
+
rightSiblingId: link(72),
|
|
11660
|
+
childId: link(76),
|
|
11661
|
+
clsid: new Uint8Array(view2.buffer.slice(view2.byteOffset + 80, view2.byteOffset + 96)),
|
|
11662
|
+
stateBits: view2.getUint32(96, true),
|
|
11663
|
+
created: readFileTime(view2, 100),
|
|
11664
|
+
modified: readFileTime(view2, 108),
|
|
11665
|
+
startSector: view2.getUint32(116, true),
|
|
11666
|
+
size: size3,
|
|
11667
|
+
parentId: -1
|
|
11668
|
+
}
|
|
11669
|
+
};
|
|
11670
|
+
}
|
|
11671
|
+
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
11672
|
+
const count = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
11673
|
+
const slots = [];
|
|
11674
|
+
for (let id3 = 0; id3 < count; id3++)
|
|
11675
|
+
slots.push(decodeSlot(dir, id3, majorVersion, warnings));
|
|
11676
|
+
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
11677
|
+
if (roots.length !== 1 || !roots[0].nameValid)
|
|
11678
|
+
throw new Ole2ParseError("Invalid root directory entry");
|
|
11679
|
+
const root2 = roots[0];
|
|
11680
|
+
root2.entry.path = [];
|
|
11681
|
+
const reached = /* @__PURE__ */ new Set([root2.id]);
|
|
11682
|
+
const fail3 = (message) => {
|
|
11683
|
+
if (strict)
|
|
11684
|
+
throw new Ole2ParseError(message);
|
|
11685
|
+
warnings.push({ code: "directory-link", message });
|
|
11686
|
+
};
|
|
11687
|
+
const pending = [];
|
|
11688
|
+
const push = (id3, parent, from) => {
|
|
11689
|
+
if (id3 === -1)
|
|
11690
|
+
return;
|
|
11691
|
+
const target2 = slots[id3];
|
|
11692
|
+
if (!target2 || target2.type === ENTRY_TYPE_EMPTY || target2.type === ENTRY_TYPE_ROOT) {
|
|
11693
|
+
fail3(`Directory entry ${from} links to invalid entry ${id3}`);
|
|
11694
|
+
return;
|
|
11695
|
+
}
|
|
11696
|
+
if (reached.has(id3)) {
|
|
11697
|
+
fail3(`Cyclic directory tree at entry ${id3}`);
|
|
11698
|
+
return;
|
|
11699
|
+
}
|
|
11700
|
+
reached.add(id3);
|
|
11701
|
+
pending.push({ id: id3, parent });
|
|
11702
|
+
};
|
|
11703
|
+
push(root2.entry.childId, root2, root2.id);
|
|
11704
|
+
while (pending.length) {
|
|
11705
|
+
const { id: id3, parent } = pending.pop();
|
|
11706
|
+
const slot = slots[id3];
|
|
11707
|
+
if (!slot.nameValid)
|
|
11708
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11709
|
+
slot.entry.parentId = parent.id;
|
|
11710
|
+
slot.entry.path = [...parent.entry.path, slot.entry.name];
|
|
11711
|
+
push(slot.entry.leftSiblingId, parent, id3);
|
|
11712
|
+
push(slot.entry.rightSiblingId, parent, id3);
|
|
11713
|
+
if (slot.type === ENTRY_TYPE_STORAGE)
|
|
11714
|
+
push(slot.entry.childId, slot, id3);
|
|
11715
|
+
}
|
|
11716
|
+
const entries = [];
|
|
11717
|
+
for (const slot of slots) {
|
|
11718
|
+
if (slot.type === ENTRY_TYPE_EMPTY)
|
|
11719
|
+
continue;
|
|
11720
|
+
if (!reached.has(slot.id)) {
|
|
11721
|
+
if (!slot.nameValid) {
|
|
11722
|
+
if (strict)
|
|
11723
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11724
|
+
warnings.push({ code: "invalid-unreachable-entry", message: `Skipped undecodable stale directory entry ${slot.id}` });
|
|
11725
|
+
continue;
|
|
11726
|
+
}
|
|
11727
|
+
if (strict)
|
|
11728
|
+
throw new Ole2ParseError(`Directory entry ${slot.id} is not reachable from the root`);
|
|
11729
|
+
warnings.push({ code: "unreachable-entry", message: `Directory entry ${slot.id} (${slot.entry.name}) is not reachable from the root` });
|
|
11730
|
+
}
|
|
11731
|
+
entries.push(slot.entry);
|
|
11732
|
+
}
|
|
11733
|
+
return entries;
|
|
11734
|
+
}
|
|
11735
|
+
function sameName(a, b) {
|
|
11736
|
+
return a.length === b.length && a.toUpperCase() === b.toUpperCase();
|
|
11737
|
+
}
|
|
11738
|
+
function bareName(name3) {
|
|
11739
|
+
return name3.replace(/^[\u0001-\u0006]/, "");
|
|
11740
|
+
}
|
|
11741
|
+
function normalizePath(path, rootName) {
|
|
11742
|
+
const parts = typeof path === "string" ? path.split("/").filter((part) => part !== "") : [...path];
|
|
11743
|
+
if (parts.length && sameName(parts[0], rootName) && typeof path === "string")
|
|
11744
|
+
parts.shift();
|
|
11745
|
+
return parts;
|
|
11746
|
+
}
|
|
11747
|
+
function child2(entries, parentId, name3) {
|
|
11748
|
+
const children5 = entries.filter((entry) => entry.parentId === parentId && entry.path !== void 0);
|
|
11749
|
+
const pick = (matches) => matches.length === 1 ? matches[0] : void 0;
|
|
11750
|
+
const exact = children5.filter((entry) => entry.name === name3);
|
|
11751
|
+
if (exact.length)
|
|
11752
|
+
return pick(exact);
|
|
11753
|
+
const folded = children5.filter((entry) => sameName(entry.name, name3));
|
|
11754
|
+
if (folded.length)
|
|
11755
|
+
return pick(folded);
|
|
11756
|
+
return pick(children5.filter((entry) => sameName(bareName(entry.name), bareName(name3))));
|
|
11757
|
+
}
|
|
11758
|
+
function findDirectoryEntry(entries, path) {
|
|
11759
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11760
|
+
if (!root2)
|
|
11761
|
+
return void 0;
|
|
11762
|
+
let current = root2;
|
|
11763
|
+
for (const name3 of normalizePath(path, root2.name)) {
|
|
11764
|
+
if (current.type !== ENTRY_TYPE_ROOT && current.type !== ENTRY_TYPE_STORAGE)
|
|
11765
|
+
return void 0;
|
|
11766
|
+
current = child2(entries, current.id, name3);
|
|
11767
|
+
if (!current)
|
|
11768
|
+
return void 0;
|
|
11769
|
+
}
|
|
11770
|
+
return current;
|
|
11771
|
+
}
|
|
11772
|
+
function findStreamByName(entries, name3, isReadable) {
|
|
11773
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11774
|
+
if (root2 && root2.name === name3)
|
|
11775
|
+
return root2;
|
|
11776
|
+
const top = entries.filter((entry) => entry.parentId === root2?.id && isReadable(entry));
|
|
11777
|
+
return top.find((entry) => entry.name === name3) ?? top.find((entry) => sameName(entry.name, name3)) ?? entries.find((entry) => entry.name === name3 && isReadable(entry));
|
|
11778
|
+
}
|
|
11779
|
+
|
|
11780
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
11781
|
+
function parseOle2(buffer, options = {}) {
|
|
11782
|
+
const strict = options.strict === true;
|
|
11783
|
+
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
11784
|
+
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
11785
|
+
const warnings = [];
|
|
11620
11786
|
if (data.length < 512) {
|
|
11621
11787
|
throw new Ole2ParseError("Truncated OLE2 compound file header");
|
|
11622
11788
|
}
|
|
@@ -11625,11 +11791,12 @@ function parseOle2(buffer) {
|
|
|
11625
11791
|
throw new Ole2ParseError("Not a valid OLE2 compound file");
|
|
11626
11792
|
}
|
|
11627
11793
|
}
|
|
11628
|
-
view2.getUint16(24, true);
|
|
11629
11794
|
const majorVersion = view2.getUint16(26, true);
|
|
11630
11795
|
const byteOrder = view2.getUint16(28, true);
|
|
11631
11796
|
if (byteOrder !== 65534) {
|
|
11632
|
-
|
|
11797
|
+
if (strict)
|
|
11798
|
+
throw new Ole2ParseError("Invalid byte order mark");
|
|
11799
|
+
warnings.push({ code: "byte-order", message: `Ignored byte order mark 0x${byteOrder.toString(16)}` });
|
|
11633
11800
|
}
|
|
11634
11801
|
const sectorSizePower = view2.getUint16(30, true);
|
|
11635
11802
|
const miniSectorSizePower = view2.getUint16(32, true);
|
|
@@ -11638,10 +11805,14 @@ function parseOle2(buffer) {
|
|
|
11638
11805
|
}
|
|
11639
11806
|
const sectorSize = 1 << sectorSizePower;
|
|
11640
11807
|
const miniSectorSize = 1 << miniSectorSizePower;
|
|
11641
|
-
if (data.length < sectorSize
|
|
11808
|
+
if (data.length < sectorSize)
|
|
11642
11809
|
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11810
|
+
if (data.length % sectorSize !== 0) {
|
|
11811
|
+
if (strict)
|
|
11812
|
+
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11813
|
+
warnings.push({ code: "unaligned-length", message: `File length ${data.length} is not a multiple of ${sectorSize}` });
|
|
11643
11814
|
}
|
|
11644
|
-
const sectorCount = data.length / sectorSize - 1;
|
|
11815
|
+
const sectorCount = Math.ceil(data.length / sectorSize) - 1;
|
|
11645
11816
|
const totalFATSectors = view2.getUint32(44, true);
|
|
11646
11817
|
const firstDirectorySector = view2.getUint32(48, true);
|
|
11647
11818
|
const miniStreamCutoff = view2.getUint32(56, true);
|
|
@@ -11662,6 +11833,13 @@ function parseOle2(buffer) {
|
|
|
11662
11833
|
}
|
|
11663
11834
|
return data.subarray(offset, offset + sectorSize);
|
|
11664
11835
|
}
|
|
11836
|
+
function copySector(sector, target2, at2, want) {
|
|
11837
|
+
const offset = sectorOffset(sector);
|
|
11838
|
+
if (sector >= sectorCount || offset + want > data.length) {
|
|
11839
|
+
throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
|
|
11840
|
+
}
|
|
11841
|
+
target2.set(data.subarray(offset, offset + want), at2);
|
|
11842
|
+
}
|
|
11665
11843
|
const fatSectors = [];
|
|
11666
11844
|
for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
|
|
11667
11845
|
const sector = view2.getUint32(76 + i * 4, true);
|
|
@@ -11697,29 +11875,36 @@ function parseOle2(buffer) {
|
|
|
11697
11875
|
fatEntries.push(fatView.getUint32(i * 4, true));
|
|
11698
11876
|
}
|
|
11699
11877
|
}
|
|
11700
|
-
function
|
|
11701
|
-
const
|
|
11702
|
-
let current = startSector;
|
|
11878
|
+
function followChain(table2, start, label, needed) {
|
|
11879
|
+
const ids = [];
|
|
11703
11880
|
const visited = /* @__PURE__ */ new Set();
|
|
11881
|
+
let current = start;
|
|
11704
11882
|
while (current <= MAXREGSECT) {
|
|
11883
|
+
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
11884
|
+
return ids;
|
|
11705
11885
|
if (visited.has(current)) {
|
|
11706
|
-
throw new Ole2ParseError(`Circular reference in
|
|
11886
|
+
throw new Ole2ParseError(`Circular reference in ${label} chain at sector ${current}`);
|
|
11707
11887
|
}
|
|
11708
11888
|
visited.add(current);
|
|
11709
|
-
|
|
11710
|
-
if (
|
|
11711
|
-
throw new Ole2ParseError(
|
|
11712
|
-
current =
|
|
11713
|
-
}
|
|
11714
|
-
if (current !== ENDOFCHAIN)
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
for (const sector of sectors) {
|
|
11720
|
-
result.set(sector, offset);
|
|
11721
|
-
offset += sectorSize;
|
|
11889
|
+
ids.push(current);
|
|
11890
|
+
if (table2[current] === void 0)
|
|
11891
|
+
throw new Ole2ParseError(`Missing ${label} chain entry`);
|
|
11892
|
+
current = table2[current];
|
|
11893
|
+
}
|
|
11894
|
+
if (current !== ENDOFCHAIN) {
|
|
11895
|
+
if (strict || needed === void 0 || ids.length < needed) {
|
|
11896
|
+
throw new Ole2ParseError(`Invalid ${label} chain terminator`);
|
|
11897
|
+
}
|
|
11898
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label} chain ending in 0x${current.toString(16)}` });
|
|
11722
11899
|
}
|
|
11900
|
+
return ids;
|
|
11901
|
+
}
|
|
11902
|
+
function readMetadataChain(startSector, label) {
|
|
11903
|
+
if (startSector > MAXREGSECT)
|
|
11904
|
+
return new Uint8Array(0);
|
|
11905
|
+
const ids = followChain(fatEntries, startSector, label === "directory" ? "FAT" : label);
|
|
11906
|
+
const result = new Uint8Array(ids.length * sectorSize);
|
|
11907
|
+
ids.forEach((id3, i) => result.set(readSector(id3), i * sectorSize));
|
|
11723
11908
|
return result;
|
|
11724
11909
|
}
|
|
11725
11910
|
function readStream(startSector, size3) {
|
|
@@ -11727,68 +11912,44 @@ function parseOle2(buffer) {
|
|
|
11727
11912
|
return new Uint8Array(0);
|
|
11728
11913
|
if (size3 > sectorCount * sectorSize)
|
|
11729
11914
|
throw new Ole2ParseError("Stream size exceeds file size");
|
|
11730
|
-
const
|
|
11731
|
-
|
|
11915
|
+
const needed = Math.ceil(size3 / sectorSize);
|
|
11916
|
+
const ids = followChain(fatEntries, startSector, "FAT", needed);
|
|
11917
|
+
if (ids.length < needed)
|
|
11732
11918
|
throw new Ole2ParseError("Truncated stream sector chain");
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
|
|
11737
|
-
const entries = [];
|
|
11738
|
-
for (let i = 0; i < numEntries; i++) {
|
|
11739
|
-
const entryOffset = i * DIR_ENTRY_SIZE;
|
|
11740
|
-
const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
|
|
11741
|
-
const nameLen = entryView.getUint16(64, true);
|
|
11742
|
-
const objectType = entryView.getUint8(66);
|
|
11743
|
-
if (objectType === ENTRY_TYPE_EMPTY) {
|
|
11744
|
-
continue;
|
|
11745
|
-
}
|
|
11746
|
-
if (nameLen < 2 || nameLen > 64 || nameLen % 2 !== 0 || entryView.getUint16(nameLen - 2, true) !== 0) {
|
|
11747
|
-
throw new Ole2ParseError("Invalid directory entry name");
|
|
11919
|
+
const result = new Uint8Array(size3);
|
|
11920
|
+
for (let i = 0; i < needed; i++) {
|
|
11921
|
+
copySector(ids[i], result, i * sectorSize, Math.min(sectorSize, size3 - i * sectorSize));
|
|
11748
11922
|
}
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
|
|
11758
|
-
const startSector = entryView.getUint32(116, true);
|
|
11759
|
-
const sizeLow = entryView.getUint32(120, true);
|
|
11760
|
-
let size3 = sizeLow;
|
|
11761
|
-
if (majorVersion === 4) {
|
|
11762
|
-
const sizeHigh = entryView.getUint32(124, true);
|
|
11763
|
-
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11764
|
-
if (!Number.isSafeInteger(size3) || size3 > sectorCount * sectorSize) {
|
|
11765
|
-
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11766
|
-
}
|
|
11923
|
+
return result;
|
|
11924
|
+
}
|
|
11925
|
+
if (firstDirectorySector > MAXREGSECT)
|
|
11926
|
+
throw new Ole2ParseError("Missing directory chain");
|
|
11927
|
+
const entries = readDirectory(readMetadataChain(firstDirectorySector, "directory"), majorVersion, strict, warnings);
|
|
11928
|
+
for (const entry of entries) {
|
|
11929
|
+
if (majorVersion === 4 && (!Number.isSafeInteger(entry.size) || entry.size > sectorCount * sectorSize)) {
|
|
11930
|
+
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11767
11931
|
}
|
|
11768
|
-
entries.push({
|
|
11769
|
-
name: name3,
|
|
11770
|
-
type: objectType,
|
|
11771
|
-
startSector,
|
|
11772
|
-
size: size3,
|
|
11773
|
-
childId: childId === 4294967295 ? -1 : childId,
|
|
11774
|
-
leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
|
|
11775
|
-
rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId,
|
|
11776
|
-
clsid
|
|
11777
|
-
});
|
|
11778
11932
|
}
|
|
11779
11933
|
const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
|
|
11780
|
-
if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
|
|
11781
|
-
throw new Ole2ParseError("Invalid root directory entry");
|
|
11782
|
-
}
|
|
11783
11934
|
let miniStreamData;
|
|
11784
|
-
if (rootEntry
|
|
11935
|
+
if (rootEntry.startSector <= MAXREGSECT) {
|
|
11785
11936
|
miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
|
|
11786
11937
|
}
|
|
11787
11938
|
const miniFatEntries = [];
|
|
11788
|
-
if (firstMiniFATSector
|
|
11789
|
-
|
|
11790
|
-
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
11939
|
+
if (firstMiniFATSector > MAXREGSECT && totalMiniFATSectors > 0) {
|
|
11940
|
+
if (strict)
|
|
11791
11941
|
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
11942
|
+
warnings.push({ code: "mini-fat-count", message: `Header lists ${totalMiniFATSectors} mini FAT sectors but no chain` });
|
|
11943
|
+
}
|
|
11944
|
+
if (firstMiniFATSector <= MAXREGSECT && (totalMiniFATSectors > 0 || !strict)) {
|
|
11945
|
+
const miniFatRaw = readMetadataChain(firstMiniFATSector, "mini FAT");
|
|
11946
|
+
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
11947
|
+
if (strict)
|
|
11948
|
+
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
11949
|
+
warnings.push({
|
|
11950
|
+
code: "mini-fat-count",
|
|
11951
|
+
message: `Header lists ${totalMiniFATSectors} mini FAT sectors; chain has ${miniFatRaw.length / sectorSize}`
|
|
11952
|
+
});
|
|
11792
11953
|
}
|
|
11793
11954
|
const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
|
|
11794
11955
|
const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
|
|
@@ -11802,48 +11963,67 @@ function parseOle2(buffer) {
|
|
|
11802
11963
|
if (!miniStreamData) {
|
|
11803
11964
|
throw new Ole2ParseError("Mini stream container not found");
|
|
11804
11965
|
}
|
|
11805
|
-
const
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11966
|
+
const needed = Math.ceil(size3 / miniSectorSize);
|
|
11967
|
+
const capacity = miniStreamData.length / miniSectorSize;
|
|
11968
|
+
let ids;
|
|
11969
|
+
try {
|
|
11970
|
+
ids = followChain(miniFatEntries, startSector, "mini FAT", needed);
|
|
11971
|
+
} catch (error) {
|
|
11972
|
+
if (error instanceof Ole2ParseError && /Missing mini FAT/.test(error.message)) {
|
|
11973
|
+
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11811
11974
|
}
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11975
|
+
throw error;
|
|
11976
|
+
}
|
|
11977
|
+
const result = new Uint8Array(size3);
|
|
11978
|
+
for (let i = 0; i < ids.length && i < needed; i++) {
|
|
11979
|
+
const id3 = ids[i];
|
|
11980
|
+
if (id3 >= capacity || (id3 + 1) * miniSectorSize > miniStreamData.length) {
|
|
11815
11981
|
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11816
11982
|
}
|
|
11817
|
-
|
|
11818
|
-
|
|
11983
|
+
const want = Math.min(miniSectorSize, size3 - i * miniSectorSize);
|
|
11984
|
+
result.set(miniStreamData.subarray(id3 * miniSectorSize, id3 * miniSectorSize + want), i * miniSectorSize);
|
|
11819
11985
|
}
|
|
11820
|
-
if (
|
|
11821
|
-
throw new Ole2ParseError("Invalid mini FAT chain terminator");
|
|
11822
|
-
const totalLength = sectors.length * miniSectorSize;
|
|
11823
|
-
if (totalLength < size3)
|
|
11986
|
+
if (ids.length < needed)
|
|
11824
11987
|
throw new Ole2ParseError("Truncated mini stream sector chain");
|
|
11825
|
-
|
|
11826
|
-
let offset = 0;
|
|
11827
|
-
for (const sector of sectors) {
|
|
11828
|
-
result.set(sector, offset);
|
|
11829
|
-
offset += miniSectorSize;
|
|
11830
|
-
}
|
|
11831
|
-
return result.subarray(0, size3);
|
|
11988
|
+
return result;
|
|
11832
11989
|
}
|
|
11833
|
-
function
|
|
11834
|
-
const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name3);
|
|
11835
|
-
if (!entry) {
|
|
11836
|
-
return void 0;
|
|
11837
|
-
}
|
|
11990
|
+
function readEntry(entry) {
|
|
11838
11991
|
if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
|
|
11839
11992
|
return readMiniStream(entry.startSector, entry.size);
|
|
11840
11993
|
}
|
|
11841
11994
|
return readStream(entry.startSector, entry.size);
|
|
11842
11995
|
}
|
|
11843
|
-
|
|
11996
|
+
const readable = (entry) => entry.type === ENTRY_TYPE_STREAM || entry.type === ENTRY_TYPE_ROOT;
|
|
11997
|
+
return {
|
|
11998
|
+
entries,
|
|
11999
|
+
warnings,
|
|
12000
|
+
getStream(name3) {
|
|
12001
|
+
const entry = findStreamByName(entries, name3, readable);
|
|
12002
|
+
return entry ? readEntry(entry) : void 0;
|
|
12003
|
+
},
|
|
12004
|
+
getStreamByPath(path) {
|
|
12005
|
+
const entry = findDirectoryEntry(entries, path);
|
|
12006
|
+
return entry && entry.type === ENTRY_TYPE_STREAM ? readEntry(entry) : void 0;
|
|
12007
|
+
},
|
|
12008
|
+
getStreamById(id3) {
|
|
12009
|
+
const entry = entries.find((candidate) => candidate.id === id3);
|
|
12010
|
+
return entry && readable(entry) ? readEntry(entry) : void 0;
|
|
12011
|
+
},
|
|
12012
|
+
findEntry(path) {
|
|
12013
|
+
return findDirectoryEntry(entries, path);
|
|
12014
|
+
}
|
|
12015
|
+
};
|
|
11844
12016
|
}
|
|
11845
12017
|
|
|
11846
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12018
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document-base.js
|
|
12019
|
+
var copyOf = (bytes) => bytes === void 0 ? void 0 : new Uint8Array(bytes);
|
|
12020
|
+
var detachEntry = (entry) => ({
|
|
12021
|
+
...entry,
|
|
12022
|
+
clsid: new Uint8Array(entry.clsid),
|
|
12023
|
+
path: entry.path && [...entry.path],
|
|
12024
|
+
created: entry.created && new Date(entry.created),
|
|
12025
|
+
modified: entry.modified && new Date(entry.modified)
|
|
12026
|
+
});
|
|
11847
12027
|
var Ole2DocumentError = class extends Error {
|
|
11848
12028
|
code;
|
|
11849
12029
|
constructor(code, message) {
|
|
@@ -11876,16 +12056,31 @@ var Ole2DocumentBase = class {
|
|
|
11876
12056
|
return this.#revision;
|
|
11877
12057
|
}
|
|
11878
12058
|
get entries() {
|
|
11879
|
-
return this.#container.entries.map(
|
|
12059
|
+
return this.#container.entries.map(detachEntry);
|
|
12060
|
+
}
|
|
12061
|
+
get warnings() {
|
|
12062
|
+
return this.#container.warnings.map((warning) => ({ ...warning }));
|
|
11880
12063
|
}
|
|
11881
|
-
#getStream = (name3) =>
|
|
11882
|
-
|
|
11883
|
-
|
|
12064
|
+
#getStream = (name3) => copyOf(this.#container.getStream(name3));
|
|
12065
|
+
#getStreamByPath = (path) => copyOf(this.#container.getStreamByPath(path));
|
|
12066
|
+
#getStreamById = (id3) => copyOf(this.#container.getStreamById(id3));
|
|
12067
|
+
#findEntry = (path) => {
|
|
12068
|
+
const entry = this.#container.findEntry(path);
|
|
12069
|
+
return entry && detachEntry(entry);
|
|
11884
12070
|
};
|
|
11885
12071
|
/** Retain the original detachable callback API while observing current state. */
|
|
11886
12072
|
get getStream() {
|
|
11887
12073
|
return this.#getStream;
|
|
11888
12074
|
}
|
|
12075
|
+
get getStreamByPath() {
|
|
12076
|
+
return this.#getStreamByPath;
|
|
12077
|
+
}
|
|
12078
|
+
get getStreamById() {
|
|
12079
|
+
return this.#getStreamById;
|
|
12080
|
+
}
|
|
12081
|
+
get findEntry() {
|
|
12082
|
+
return this.#findEntry;
|
|
12083
|
+
}
|
|
11889
12084
|
/** Isolated working input: codecs cannot accidentally mutate current state. */
|
|
11890
12085
|
getBytes() {
|
|
11891
12086
|
return new Uint8Array(this.#bytes);
|
|
@@ -11908,7 +12103,7 @@ var Ole2DocumentBase = class {
|
|
|
11908
12103
|
}
|
|
11909
12104
|
};
|
|
11910
12105
|
|
|
11911
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12106
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
11912
12107
|
var END = 4294967294;
|
|
11913
12108
|
var MAX = 4294967290;
|
|
11914
12109
|
var NIL = 4294967295;
|
|
@@ -11943,6 +12138,58 @@ function chainToEnd(table2, start, max) {
|
|
|
11943
12138
|
}
|
|
11944
12139
|
return out;
|
|
11945
12140
|
}
|
|
12141
|
+
function chainPrefix(table2, start, needed) {
|
|
12142
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
12143
|
+
let id3 = start;
|
|
12144
|
+
while (out.length < needed) {
|
|
12145
|
+
if (id3 > MAX || id3 >= table2.length || seen.has(id3))
|
|
12146
|
+
throw new Error("Invalid CFB chain");
|
|
12147
|
+
seen.add(id3);
|
|
12148
|
+
out.push(id3);
|
|
12149
|
+
id3 = table2[id3];
|
|
12150
|
+
}
|
|
12151
|
+
return out;
|
|
12152
|
+
}
|
|
12153
|
+
function readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32) {
|
|
12154
|
+
const size3 = target2.size;
|
|
12155
|
+
if (size3 === 0)
|
|
12156
|
+
return new Uint8Array(0);
|
|
12157
|
+
const out = new Uint8Array(size3);
|
|
12158
|
+
const copyPhysical = (at2, want, into) => {
|
|
12159
|
+
if (at2 + want > input.length)
|
|
12160
|
+
throw new Error("Stream data exceeds file size");
|
|
12161
|
+
out.set(input.subarray(at2, at2 + want), into);
|
|
12162
|
+
};
|
|
12163
|
+
if (size3 >= read32(56)) {
|
|
12164
|
+
if (size3 > sectorCount * sectorSize)
|
|
12165
|
+
throw new Error("Stream size exceeds file size");
|
|
12166
|
+
chainPrefix(fat, target2.start, Math.ceil(size3 / sectorSize)).forEach((id3, i) => {
|
|
12167
|
+
if (id3 >= sectorCount)
|
|
12168
|
+
throw new Error("Invalid sector");
|
|
12169
|
+
copyPhysical((id3 + 1) * sectorSize, Math.min(sectorSize, size3 - i * sectorSize), i * sectorSize);
|
|
12170
|
+
});
|
|
12171
|
+
return out;
|
|
12172
|
+
}
|
|
12173
|
+
const miniFatSectors = chainToEnd(fat, read32(60), sectorCount);
|
|
12174
|
+
const miniCapacity = Math.floor(Math.min(root2.size, sectorCount * sectorSize) / miniSize);
|
|
12175
|
+
const miniFat = [];
|
|
12176
|
+
for (const id3 of miniFatSectors) {
|
|
12177
|
+
const bytes = sector(id3), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
12178
|
+
for (let j = 0; j < sectorSize / 4 && miniFat.length < miniCapacity; j++)
|
|
12179
|
+
miniFat.push(dv.getUint32(j * 4, true));
|
|
12180
|
+
}
|
|
12181
|
+
const rootSectors = chainPrefix(fat, root2.start, Math.ceil(root2.size / sectorSize));
|
|
12182
|
+
chainPrefix(miniFat, target2.start, Math.ceil(size3 / miniSize)).forEach((id3, i) => {
|
|
12183
|
+
const start = id3 * miniSize, want = Math.min(miniSize, size3 - i * miniSize);
|
|
12184
|
+
if (start + want > root2.size)
|
|
12185
|
+
throw new Error("Mini stream out of bounds");
|
|
12186
|
+
const rootSector = rootSectors[Math.floor(start / sectorSize)];
|
|
12187
|
+
if (rootSector >= sectorCount)
|
|
12188
|
+
throw new Error("Invalid sector");
|
|
12189
|
+
copyPhysical((rootSector + 1) * sectorSize + start % sectorSize, want, i * miniSize);
|
|
12190
|
+
});
|
|
12191
|
+
return out;
|
|
12192
|
+
}
|
|
11946
12193
|
function processCompoundFileStream(input, path, replacement) {
|
|
11947
12194
|
const reject2 = () => replacement ? input : void 0;
|
|
11948
12195
|
try {
|
|
@@ -11950,18 +12197,19 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
11950
12197
|
return reject2();
|
|
11951
12198
|
const view2 = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
11952
12199
|
const read32 = (offset2) => view2.getUint32(offset2, true);
|
|
11953
|
-
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 ||
|
|
12200
|
+
if (input[0] !== 208 || input[1] !== 207 || input[2] !== 17 || input[3] !== 224 || input[4] !== 161 || input[5] !== 177 || input[6] !== 26 || input[7] !== 225 || // Readers tolerate a non-canonical byte-order mark; edits do not.
|
|
12201
|
+
replacement && view2.getUint16(28, true) !== 65534)
|
|
11954
12202
|
return reject2();
|
|
11955
12203
|
const major = view2.getUint16(26, true), shift = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
11956
12204
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
11957
12205
|
return reject2();
|
|
11958
12206
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
11959
|
-
if (input.length % sectorSize !== 0)
|
|
12207
|
+
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
11960
12208
|
return reject2();
|
|
11961
|
-
const sectorCount = input.length / sectorSize - 1;
|
|
12209
|
+
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
11962
12210
|
const offset = (id3) => (id3 + 1) * sectorSize;
|
|
11963
12211
|
const sector = (id3) => {
|
|
11964
|
-
if (id3 > MAX || id3 >= sectorCount)
|
|
12212
|
+
if (id3 > MAX || id3 >= sectorCount || offset(id3) + sectorSize > input.length)
|
|
11965
12213
|
throw new Error("Invalid sector");
|
|
11966
12214
|
return input.subarray(offset(id3), offset(id3) + sectorSize);
|
|
11967
12215
|
};
|
|
@@ -12011,7 +12259,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12011
12259
|
for (let i = 0; i < nameLength - 2; i += 2)
|
|
12012
12260
|
name3 += String.fromCharCode(dvDir.getUint16(p + i, true));
|
|
12013
12261
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
12014
|
-
if (sizeHigh !== 0)
|
|
12262
|
+
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
12015
12263
|
return reject2();
|
|
12016
12264
|
entries.push({
|
|
12017
12265
|
id: id3,
|
|
@@ -12058,6 +12306,8 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12058
12306
|
}
|
|
12059
12307
|
if (!target2)
|
|
12060
12308
|
return reject2();
|
|
12309
|
+
if (!replacement)
|
|
12310
|
+
return readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
12061
12311
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
12062
12312
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
12063
12313
|
return reject2();
|
|
@@ -12181,7 +12431,7 @@ function replaceCompoundFileStream(input, path, replacement) {
|
|
|
12181
12431
|
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
12182
12432
|
}
|
|
12183
12433
|
|
|
12184
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12434
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
12185
12435
|
var END2 = 4294967294;
|
|
12186
12436
|
var FREE = 4294967295;
|
|
12187
12437
|
var FAT = 4294967293;
|
|
@@ -12369,7 +12619,7 @@ function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
|
12369
12619
|
}
|
|
12370
12620
|
}
|
|
12371
12621
|
|
|
12372
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12622
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
12373
12623
|
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
12374
12624
|
const sectorCount = input.length / sectorSize - 1;
|
|
12375
12625
|
const entriesPerFat = sectorSize / 4;
|
|
@@ -12416,7 +12666,7 @@ function followCompoundAllocation(table2, start) {
|
|
|
12416
12666
|
return ids;
|
|
12417
12667
|
}
|
|
12418
12668
|
|
|
12419
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12669
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
12420
12670
|
var END3 = 4294967294;
|
|
12421
12671
|
var FREE2 = 4294967295;
|
|
12422
12672
|
var SECTOR = 512;
|
|
@@ -12488,7 +12738,7 @@ function resizeMiniCompoundStream(input, fat, fatIds, root2, target2, replacemen
|
|
|
12488
12738
|
return output.bytes;
|
|
12489
12739
|
}
|
|
12490
12740
|
|
|
12491
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12741
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
12492
12742
|
var END4 = 4294967294;
|
|
12493
12743
|
var FREE3 = 4294967295;
|
|
12494
12744
|
var FAT2 = 4294967293;
|
|
@@ -12653,7 +12903,7 @@ function resizeCompoundFileStream(input, path, replacement) {
|
|
|
12653
12903
|
}
|
|
12654
12904
|
}
|
|
12655
12905
|
|
|
12656
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12906
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
12657
12907
|
var FC_LCB_INDEX = {
|
|
12658
12908
|
plcfbteChpx: 12,
|
|
12659
12909
|
plcfbtePapx: 13,
|
|
@@ -12749,7 +12999,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
12749
12999
|
view2.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
12750
13000
|
}
|
|
12751
13001
|
|
|
12752
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13002
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
12753
13003
|
var DocCfbRewriteError = class extends Error {
|
|
12754
13004
|
constructor(message) {
|
|
12755
13005
|
super(message);
|
|
@@ -12804,7 +13054,7 @@ function unwrapDocBytes(bytes) {
|
|
|
12804
13054
|
}
|
|
12805
13055
|
}
|
|
12806
13056
|
|
|
12807
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13057
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
12808
13058
|
var PAGE_SIZE = 512;
|
|
12809
13059
|
function parseBteTable(tableStream, at2) {
|
|
12810
13060
|
const view2 = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
@@ -12945,7 +13195,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
12945
13195
|
return page;
|
|
12946
13196
|
}
|
|
12947
13197
|
|
|
12948
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13198
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
12949
13199
|
var CP1252_HIGH_BLOCK = [
|
|
12950
13200
|
8364,
|
|
12951
13201
|
129,
|
|
@@ -13013,7 +13263,7 @@ function encodeCp1252(text3) {
|
|
|
13013
13263
|
return Uint8Array.from(bytes);
|
|
13014
13264
|
}
|
|
13015
13265
|
|
|
13016
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13266
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
13017
13267
|
var CLXT_PRC = 1;
|
|
13018
13268
|
var CLXT_PCDT = 2;
|
|
13019
13269
|
var DocResourceLimitError = class extends Error {
|
|
@@ -13225,7 +13475,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
13225
13475
|
return result;
|
|
13226
13476
|
}
|
|
13227
13477
|
|
|
13228
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13478
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
13229
13479
|
var UnsupportedDocFieldEditError = class extends Error {
|
|
13230
13480
|
constructor(message) {
|
|
13231
13481
|
super(message);
|
|
@@ -13309,7 +13559,7 @@ function shiftDocMainFieldCps(table2, at2, body, editStart, editEnd, delta, maxF
|
|
|
13309
13559
|
return result;
|
|
13310
13560
|
}
|
|
13311
13561
|
|
|
13312
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13562
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
13313
13563
|
var RISKY_PLCF_INDICES = [2, 3, 4, 5, 17, 18, 19, 20, 40, 41, 42, 43, 46, 47, 48, 54, 55, 56, 57, 58, 59, 75, 76, 89, 90];
|
|
13314
13564
|
var RISKY_STTB_INDICES = [21, 22, 23];
|
|
13315
13565
|
var SAFE_EXTENDED_FC_LCB_INDICES = /* @__PURE__ */ new Set([93, 94, 113, 181, 182]);
|
|
@@ -13578,7 +13828,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text3, limits) {
|
|
|
13578
13828
|
}
|
|
13579
13829
|
}
|
|
13580
13830
|
|
|
13581
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13831
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-runs.js
|
|
13582
13832
|
var LIMIT = 65536;
|
|
13583
13833
|
var SAFE_OPERANDS = /* @__PURE__ */ new Set([
|
|
13584
13834
|
2101,
|
|
@@ -13816,7 +14066,7 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value) {
|
|
|
13816
14066
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13817
14067
|
}
|
|
13818
14068
|
|
|
13819
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14069
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-paragraph-format.js
|
|
13820
14070
|
var LIMIT2 = 65536;
|
|
13821
14071
|
var SPRM_LIMIT = 262144;
|
|
13822
14072
|
var PAGE_NUMBER_MASK = 4194303;
|
|
@@ -14004,7 +14254,7 @@ function writeDocParagraphAlignment(input, index, alignment) {
|
|
|
14004
14254
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
14005
14255
|
}
|
|
14006
14256
|
|
|
14007
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14257
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/doc-document.js
|
|
14008
14258
|
var DOC_CAPABILITIES = Object.freeze({
|
|
14009
14259
|
read: Object.freeze(["paragraph-text", "character-runs", "direct-character-formatting", "paragraph-style-index", "direct-paragraph-alignment", "compound-streams"]),
|
|
14010
14260
|
write: Object.freeze(["paragraph-text", "existing-direct-bold-italic", "existing-direct-font-size", "existing-direct-underline", "existing-direct-paragraph-alignment"]),
|
|
@@ -14200,7 +14450,7 @@ var DocDocument = class extends Ole2DocumentBase {
|
|
|
14200
14450
|
}
|
|
14201
14451
|
};
|
|
14202
14452
|
|
|
14203
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14453
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
14204
14454
|
function compareDirEntryNames(a, b) {
|
|
14205
14455
|
const ua = a.toUpperCase();
|
|
14206
14456
|
const ub = b.toUpperCase();
|
|
@@ -14267,7 +14517,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
14267
14517
|
}
|
|
14268
14518
|
}
|
|
14269
14519
|
|
|
14270
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14520
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
14271
14521
|
function writeHeader(outView, outBytes, params) {
|
|
14272
14522
|
outBytes.set(OLE_MAGIC, 0);
|
|
14273
14523
|
outView.setUint16(24, 62, true);
|
|
@@ -14360,7 +14610,7 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
14360
14610
|
}
|
|
14361
14611
|
}
|
|
14362
14612
|
|
|
14363
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14613
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
14364
14614
|
function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
14365
14615
|
const sectorSize = 512;
|
|
14366
14616
|
const miniSectorSize = 64;
|
|
@@ -14541,7 +14791,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
14541
14791
|
return output;
|
|
14542
14792
|
}
|
|
14543
14793
|
|
|
14544
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14794
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
14545
14795
|
var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
14546
14796
|
function unwrapXlsBytes(bytes) {
|
|
14547
14797
|
if (!isCfb(bytes)) {
|
|
@@ -14608,7 +14858,7 @@ function isCfb(bytes) {
|
|
|
14608
14858
|
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
14609
14859
|
}
|
|
14610
14860
|
|
|
14611
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14861
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
14612
14862
|
var TABLE = `0 COUNT -1|1 IF -1|2 ISNA 1|3 ISERROR 1|4 SUM -1|5 AVERAGE -1|6 MIN -1|7 MAX -1|8 ROW -1|9 COLUMN -1|10 NA 0|11 NPV -1|12 STDEV -1|13 DOLLAR -1|14 FIXED -1|15 SIN 1|16 COS 1|17 TAN 1|18 ATAN 1|19 PI 0|20 SQRT 1|21 EXP 1|22 LN 1|23 LOG10 1|24 ABS 1|25 INT 1|26 SIGN 1|27 ROUND 2|28 LOOKUP -1|29 INDEX -1|30 REPT 2|31 MID 3|32 LEN 1|33 VALUE 1|34 TRUE 0|35 FALSE 0|36 AND -1|37 OR -1|38 NOT 1|39 MOD 2|40 DCOUNT 3|41 DSUM 3|42 DAVERAGE 3|43 DMIN 3|44 DMAX 3|45 DSTDEV 3|46 VAR -1|47 DVAR 3|48 TEXT 2|49 LINEST -1|50 TREND -1|51 LOGEST -1|52 GROWTH -1|56 PV -1|57 FV -1|58 NPER -1|59 PMT -1|60 RATE -1|61 MIRR 3|62 IRR -1|63 RAND 0|64 MATCH -1|65 DATE 3|66 TIME 3|67 DAY 1|68 MONTH 1|69 YEAR 1|70 WEEKDAY -1|71 HOUR 1|72 MINUTE 1|73 SECOND 1|74 NOW 0|75 AREAS 1|76 ROWS 1|77 COLUMNS 1|78 OFFSET -1|82 SEARCH -1|83 TRANSPOSE 1|86 TYPE 1|97 ATAN2 2|98 ASIN 1|99 ACOS 1|100 CHOOSE -1|101 HLOOKUP -1|102 VLOOKUP -1|105 ISREF 1|109 LOG -1|111 CHAR 1|112 LOWER 1|113 UPPER 1|114 PROPER 1|115 LEFT -1|116 RIGHT -1|117 EXACT 2|118 TRIM 1|119 REPLACE 4|120 SUBSTITUTE -1|121 CODE 1|124 FIND -1|125 CELL -1|126 ISERR 1|127 ISTEXT 1|128 ISNUMBER 1|129 ISBLANK 1|130 T 1|131 N 1|140 DATEVALUE 1|141 TIMEVALUE 1|142 SLN 3|143 SYD 4|144 DDB -1|148 INDIRECT -1|150 CALL -1|162 CLEAN 1|163 MDETERM 1|164 MINVERSE 1|165 MMULT 2|167 IPMT -1|168 PPMT -1|169 COUNTA -1|183 PRODUCT -1|184 FACT 1|189 DPRODUCT 3|190 ISNONTEXT 1|193 STDEVP -1|194 VARP -1|195 DSTDEVP 3|196 DVARP 3|197 TRUNC -1|198 ISLOGICAL 1|199 DCOUNTA 3|204 USDOLLAR -1|205 FINDB -1|206 SEARCHB -1|207 REPLACEB 4|208 LEFTB -1|209 RIGHTB -1|210 MIDB 3|211 LENB 1|212 ROUNDUP 2|213 ROUNDDOWN 2|214 ASC 1|215 DBCS 1|216 RANK -1|219 ADDRESS -1|220 DAYS360 -1|221 TODAY 0|222 VDB -1|227 MEDIAN -1|228 SUMPRODUCT -1|229 SINH 1|230 COSH 1|231 TANH 1|232 ASINH 1|233 ACOSH 1|234 ATANH 1|235 DGET 3|244 INFO 1|247 DB -1|252 FREQUENCY 2|261 ERROR.TYPE 1|269 AVEDEV -1|270 BETADIST -1|271 GAMMALN 1|272 BETAINV -1|273 BINOMDIST 4|274 CHIDIST 2|275 CHIINV 2|276 COMBIN 2|277 CONFIDENCE 3|278 CRITBINOM 3|279 EVEN 1|280 EXPONDIST 3|281 FDIST 3|282 FINV 3|283 FISHER 1|284 FISHERINV 1|285 FLOOR 2|286 GAMMADIST 4|287 GAMMAINV 3|288 CEILING 2|289 HYPGEOMDIST 4|290 LOGNORMDIST 3|291 LOGINV 3|292 NEGBINOMDIST 3|293 NORMDIST 4|294 NORMSDIST 1|295 NORMINV 3|296 NORMSINV 1|297 STANDARDIZE 3|298 ODD 1|299 PERMUT 2|300 POISSON 3|301 TDIST 3|302 WEIBULL 4|303 SUMXMY2 2|304 SUMX2MY2 2|305 SUMX2PY2 2|306 CHITEST 2|307 CORREL 2|308 COVAR 2|309 FORECAST 3|310 FTEST 2|311 INTERCEPT 2|312 PEARSON 2|313 RSQ 2|314 STEYX 2|315 SLOPE 2|316 TTEST 4|317 PROB -1|318 DEVSQ -1|319 GEOMEAN -1|320 HARMEAN -1|321 SUMSQ -1|322 KURT -1|323 SKEW -1|324 ZTEST -1|325 LARGE 2|326 SMALL 2|327 QUARTILE 2|328 PERCENTILE 2|329 PERCENTRANK -1|330 MODE -1|331 TRIMMEAN 2|332 TINV 2|336 CONCATENATE -1|337 POWER 2|342 RADIANS 1|343 DEGREES 1|344 SUBTOTAL -1|345 SUMIF -1|346 COUNTIF 2|347 COUNTBLANK 1|350 ISPMT 4|351 DATEDIF 3|352 DATESTRING 1|353 NUMBERSTRING 2|354 ROMAN -1|358 GETPIVOTDATA -1|359 HYPERLINK -1|360 PHONETIC 1|361 AVERAGEA -1|362 MAXA -1|363 MINA -1|364 STDEVPA -1|365 VARPA -1|366 STDEVA -1|367 VARA -1|368 BAHTTEXT 1`;
|
|
14613
14863
|
var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
14614
14864
|
const [id3, name3, argc] = entry.split(" ");
|
|
@@ -14616,7 +14866,7 @@ var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
|
14616
14866
|
}));
|
|
14617
14867
|
var XLS_USER_FUNCTION_ID = 255;
|
|
14618
14868
|
|
|
14619
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14869
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
|
|
14620
14870
|
var BIFF_ERRORS = {
|
|
14621
14871
|
0: "#NULL!",
|
|
14622
14872
|
7: "#DIV/0!",
|
|
@@ -14711,7 +14961,7 @@ function readArrayConstant(extra) {
|
|
|
14711
14961
|
return `{${lines2.join(";")}}`;
|
|
14712
14962
|
}
|
|
14713
14963
|
|
|
14714
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14964
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
|
|
14715
14965
|
var RT_CONTINUE = 60;
|
|
14716
14966
|
function readXlsRecords(bytes, start = 0, end = bytes.length) {
|
|
14717
14967
|
const records = [];
|
|
@@ -14877,7 +15127,7 @@ function joinedData(record5) {
|
|
|
14877
15127
|
return out;
|
|
14878
15128
|
}
|
|
14879
15129
|
|
|
14880
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15130
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
14881
15131
|
function decodeFormula(rgce, extra, context, options) {
|
|
14882
15132
|
try {
|
|
14883
15133
|
return decode(rgce, new ByteReader(extra), context, options);
|
|
@@ -15108,7 +15358,7 @@ function readAttr(reader, stack, whitespace) {
|
|
|
15108
15358
|
}
|
|
15109
15359
|
}
|
|
15110
15360
|
|
|
15111
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15361
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
|
|
15112
15362
|
function parseSharedStrings(record5) {
|
|
15113
15363
|
const reader = SegmentReader.of(record5);
|
|
15114
15364
|
reader.u32();
|
|
@@ -15125,7 +15375,7 @@ function parseSharedStrings(record5) {
|
|
|
15125
15375
|
return strings;
|
|
15126
15376
|
}
|
|
15127
15377
|
|
|
15128
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15378
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
|
|
15129
15379
|
var DEFAULT_XLS_PALETTE = "000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333".split(" ");
|
|
15130
15380
|
var XLS_BUILTIN_FORMATS = {
|
|
15131
15381
|
0: "General",
|
|
@@ -15382,7 +15632,7 @@ function applyXfExt(data, xfs, palette) {
|
|
|
15382
15632
|
}
|
|
15383
15633
|
}
|
|
15384
15634
|
|
|
15385
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15635
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
|
|
15386
15636
|
var XlsReadError = class extends Error {
|
|
15387
15637
|
code;
|
|
15388
15638
|
constructor(code, message) {
|
|
@@ -15392,7 +15642,7 @@ var XlsReadError = class extends Error {
|
|
|
15392
15642
|
}
|
|
15393
15643
|
};
|
|
15394
15644
|
|
|
15395
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15645
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
|
|
15396
15646
|
var RT = {
|
|
15397
15647
|
BOF: 2057,
|
|
15398
15648
|
EOF: 10,
|
|
@@ -15630,7 +15880,7 @@ function parseGlobals(records) {
|
|
|
15630
15880
|
return out;
|
|
15631
15881
|
}
|
|
15632
15882
|
|
|
15633
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15883
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
15634
15884
|
function encodeRkExact(value) {
|
|
15635
15885
|
if (!Number.isFinite(value))
|
|
15636
15886
|
return void 0;
|
|
@@ -15795,7 +16045,7 @@ function editXlsNumericCell(input, edit) {
|
|
|
15795
16045
|
}
|
|
15796
16046
|
}
|
|
15797
16047
|
|
|
15798
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16048
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
15799
16049
|
var OPCODE_BOF = 2057;
|
|
15800
16050
|
var OPCODE_EOF = 10;
|
|
15801
16051
|
var OPCODE_FILEPASS = 47;
|
|
@@ -15842,7 +16092,7 @@ function decodeRk(rk) {
|
|
|
15842
16092
|
return isDiv100 ? value / 100 : value;
|
|
15843
16093
|
}
|
|
15844
16094
|
|
|
15845
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16095
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
|
|
15846
16096
|
function readRefU(r) {
|
|
15847
16097
|
return { firstRow: r.u16(), lastRow: r.u16(), firstCol: r.u8(), lastCol: r.u8() };
|
|
15848
16098
|
}
|
|
@@ -15900,7 +16150,7 @@ function resolveFormulas(formulas, shared, arrays, globals) {
|
|
|
15900
16150
|
}
|
|
15901
16151
|
}
|
|
15902
16152
|
|
|
15903
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16153
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
|
|
15904
16154
|
function parseMergedCells(data) {
|
|
15905
16155
|
const r = new ByteReader(data);
|
|
15906
16156
|
const count = r.u16();
|
|
@@ -16095,7 +16345,7 @@ function parseNote(data) {
|
|
|
16095
16345
|
return { row: row2, col, visible: (flags & 2) !== 0, id: id3, author: r.xlString() };
|
|
16096
16346
|
}
|
|
16097
16347
|
|
|
16098
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16348
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
|
|
16099
16349
|
var UNSUPPORTED = {
|
|
16100
16350
|
432: "conditional formatting",
|
|
16101
16351
|
2169: "conditional formatting",
|
|
@@ -16351,7 +16601,7 @@ function parseSheet(bound2, records, start, globals) {
|
|
|
16351
16601
|
return sheet;
|
|
16352
16602
|
}
|
|
16353
16603
|
|
|
16354
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16604
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
|
|
16355
16605
|
function compoundStreamNames(bytes) {
|
|
16356
16606
|
if (!OLE_MAGIC.every((value, index) => bytes[index] === value))
|
|
16357
16607
|
return [];
|
|
@@ -16421,7 +16671,7 @@ function readXlsWorkbook(bytes) {
|
|
|
16421
16671
|
};
|
|
16422
16672
|
}
|
|
16423
16673
|
|
|
16424
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16674
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-sst.js
|
|
16425
16675
|
var SstCursor = class {
|
|
16426
16676
|
segments;
|
|
16427
16677
|
segment = 0;
|
|
@@ -16544,7 +16794,7 @@ function appendXlsSstString(value) {
|
|
|
16544
16794
|
return Uint8Array.from(records);
|
|
16545
16795
|
}
|
|
16546
16796
|
|
|
16547
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16797
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
16548
16798
|
var CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
16549
16799
|
function record2(opcode, data) {
|
|
16550
16800
|
const out = new Uint8Array(data.length + 4), view2 = new DataView(out.buffer);
|
|
@@ -16636,7 +16886,7 @@ function relocateXlsDbCells(input, out, records, replacement, map) {
|
|
|
16636
16886
|
}
|
|
16637
16887
|
}
|
|
16638
16888
|
|
|
16639
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16889
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
16640
16890
|
var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
16641
16891
|
6,
|
|
16642
16892
|
10,
|
|
@@ -16994,7 +17244,7 @@ var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
|
16994
17244
|
]);
|
|
16995
17245
|
var XLS_FRT_WRAPPER = 2129;
|
|
16996
17246
|
|
|
16997
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17247
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
16998
17248
|
var EditError = class extends Error {
|
|
16999
17249
|
reason;
|
|
17000
17250
|
constructor(reason) {
|
|
@@ -17118,7 +17368,7 @@ function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
|
17118
17368
|
return target2;
|
|
17119
17369
|
}
|
|
17120
17370
|
|
|
17121
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17371
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-edit.js
|
|
17122
17372
|
function extSst(entries, map) {
|
|
17123
17373
|
const interval = Math.max(Math.floor(entries.length / 128) + 1, 8);
|
|
17124
17374
|
const count = Math.ceil(entries.length / interval);
|
|
@@ -17254,7 +17504,7 @@ function editXlsStringWorkbookStream(input, edit) {
|
|
|
17254
17504
|
}
|
|
17255
17505
|
}
|
|
17256
17506
|
|
|
17257
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17507
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-cell.js
|
|
17258
17508
|
function editXlsPreservedStringCell(input, edit) {
|
|
17259
17509
|
if (!OLE_MAGIC.every((value, index) => input[index] === value))
|
|
17260
17510
|
return editXlsStringWorkbookStream(input, edit);
|
|
@@ -17273,7 +17523,7 @@ function editXlsPreservedStringCell(input, edit) {
|
|
|
17273
17523
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17274
17524
|
}
|
|
17275
17525
|
|
|
17276
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17526
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-edit.js
|
|
17277
17527
|
var ERRORS = Object.freeze({
|
|
17278
17528
|
"#NULL!": 0,
|
|
17279
17529
|
"#DIV/0!": 7,
|
|
@@ -17391,7 +17641,7 @@ function editXlsBoolErrorCell(input, edit) {
|
|
|
17391
17641
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17392
17642
|
}
|
|
17393
17643
|
|
|
17394
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17644
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-record.js
|
|
17395
17645
|
function record3(opcode, data) {
|
|
17396
17646
|
const out = new Uint8Array(4 + data.length), view2 = new DataView(out.buffer);
|
|
17397
17647
|
view2.setUint16(0, opcode, true);
|
|
@@ -17437,7 +17687,7 @@ function replaceXlsBlankRecord(input, target2, col, value) {
|
|
|
17437
17687
|
return { start: target2.headerOffset, end: p + target2.length, bytes };
|
|
17438
17688
|
}
|
|
17439
17689
|
|
|
17440
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17690
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-stored-cell-edit.js
|
|
17441
17691
|
function applyXlsCellRecordReplacement(input, m, replacement) {
|
|
17442
17692
|
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
|
|
17443
17693
|
reject("malformed-records");
|
|
@@ -17549,17 +17799,17 @@ function editXlsStoredCell(input, edit, sourceKind) {
|
|
|
17549
17799
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17550
17800
|
}
|
|
17551
17801
|
|
|
17552
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17802
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-edit.js
|
|
17553
17803
|
function editXlsBlankCell(input, edit) {
|
|
17554
17804
|
return editXlsStoredCell(input, edit, "blank");
|
|
17555
17805
|
}
|
|
17556
17806
|
|
|
17557
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17807
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-conversion.js
|
|
17558
17808
|
function editXlsBoolErrorScalarCell(input, edit) {
|
|
17559
17809
|
return editXlsStoredCell(input, edit, "bool-error");
|
|
17560
17810
|
}
|
|
17561
17811
|
|
|
17562
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17812
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/xls-document.js
|
|
17563
17813
|
function cellType(cell) {
|
|
17564
17814
|
if (cell.formula !== void 0 || cell.formulaUndecoded || cell.arrayRange || cell.sharedFormula)
|
|
17565
17815
|
return "formula";
|
|
@@ -17756,7 +18006,7 @@ var XlsDocument = class extends Ole2DocumentBase {
|
|
|
17756
18006
|
}
|
|
17757
18007
|
};
|
|
17758
18008
|
|
|
17759
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18009
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
|
|
17760
18010
|
var PptParseError = class extends Error {
|
|
17761
18011
|
constructor(message) {
|
|
17762
18012
|
super(message);
|
|
@@ -17790,7 +18040,7 @@ function readRecordOrThrow(view2, offset) {
|
|
|
17790
18040
|
return rec;
|
|
17791
18041
|
}
|
|
17792
18042
|
|
|
17793
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18043
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
|
|
17794
18044
|
var RT2 = {
|
|
17795
18045
|
Document: 1e3,
|
|
17796
18046
|
DocumentAtom: 1001,
|
|
@@ -17885,7 +18135,7 @@ var OA = {
|
|
|
17885
18135
|
var HEADER_TOKEN_PLAIN = 3817979999;
|
|
17886
18136
|
var HEADER_TOKEN_ENCRYPTED = 4090610911;
|
|
17887
18137
|
|
|
17888
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18138
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
|
|
17889
18139
|
var DEFAULT_MAX_EDITS = 1e4;
|
|
17890
18140
|
var DEFAULT_MAX_ENTRIES = 1e6;
|
|
17891
18141
|
function checkedLimit(value) {
|
|
@@ -18002,7 +18252,7 @@ function buildPersistDirectory(view2, offsetToCurrentEdit, limits = {}) {
|
|
|
18002
18252
|
return { currentEdit: edits[0], directory };
|
|
18003
18253
|
}
|
|
18004
18254
|
|
|
18005
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18255
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text.js
|
|
18006
18256
|
var PptTextError = class extends PptParseError {
|
|
18007
18257
|
code;
|
|
18008
18258
|
constructor(code, message) {
|
|
@@ -18257,7 +18507,7 @@ function editPptSlideText(input, edit) {
|
|
|
18257
18507
|
}
|
|
18258
18508
|
}
|
|
18259
18509
|
|
|
18260
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18510
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-reader.js
|
|
18261
18511
|
var DEFAULT_LIMITS = { maxRecords: 1e5, maxShapes: 1e4, maxProperties: 1e5, maxNameChars: 1e6, maxTextBytes: 16 * 1024 * 1024 };
|
|
18262
18512
|
var GEOMETRY_PROPERTY_IDS = /* @__PURE__ */ new Set([4, 127, 128, 191, 385, 447, 448, 459, 511, 896, 959]);
|
|
18263
18513
|
function pptShapeChildren(view2, parent) {
|
|
@@ -18337,8 +18587,8 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18337
18587
|
}
|
|
18338
18588
|
}
|
|
18339
18589
|
if (rec.recVer === 15 || rec.recType === OA.ClientTextbox)
|
|
18340
|
-
for (const
|
|
18341
|
-
preflight.push({ rec:
|
|
18590
|
+
for (const child3 of pptShapeChildren(view2, rec))
|
|
18591
|
+
preflight.push({ rec: child3, depth: depth + 1 });
|
|
18342
18592
|
}
|
|
18343
18593
|
const textModel = readPptSlideTexts(input);
|
|
18344
18594
|
return textModel.slides.map((slide) => {
|
|
@@ -18476,7 +18726,7 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18476
18726
|
});
|
|
18477
18727
|
}
|
|
18478
18728
|
|
|
18479
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18729
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-edit.js
|
|
18480
18730
|
function equalPptShapeBounds(a, b) {
|
|
18481
18731
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
18482
18732
|
}
|
|
@@ -18565,7 +18815,7 @@ function editPptShapeBounds(input, edit) {
|
|
|
18565
18815
|
}
|
|
18566
18816
|
}
|
|
18567
18817
|
|
|
18568
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18818
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-notes.js
|
|
18569
18819
|
var viewOf2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18570
18820
|
function fail2(message) {
|
|
18571
18821
|
throw new PptTextError("corrupt", message);
|
|
@@ -18604,11 +18854,11 @@ function inspect5(input, limits = {}) {
|
|
|
18604
18854
|
fail2("Notes record budget exceeded");
|
|
18605
18855
|
if (end - pos < 8)
|
|
18606
18856
|
fail2("Truncated notes child header");
|
|
18607
|
-
const
|
|
18608
|
-
if (
|
|
18857
|
+
const child3 = record5(pos);
|
|
18858
|
+
if (child3.dataOffset + child3.recLen > end)
|
|
18609
18859
|
fail2("Notes child exceeds parent");
|
|
18610
|
-
result.push(
|
|
18611
|
-
pos =
|
|
18860
|
+
result.push(child3);
|
|
18861
|
+
pos = child3.dataOffset + child3.recLen;
|
|
18612
18862
|
}
|
|
18613
18863
|
return result;
|
|
18614
18864
|
};
|
|
@@ -18851,7 +19101,7 @@ function editPptNotesText(input, edit) {
|
|
|
18851
19101
|
}
|
|
18852
19102
|
}
|
|
18853
19103
|
|
|
18854
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19104
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text-style.js
|
|
18855
19105
|
var viewOf3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18856
19106
|
var MAX_RECORDS = 1e5;
|
|
18857
19107
|
var MAX_RUNS = 2e4;
|
|
@@ -19034,22 +19284,22 @@ function readPptCharacterRuns(input, limits = {}) {
|
|
|
19034
19284
|
associations.set(atom, { styles: group.styles, textCount: group.atoms.length });
|
|
19035
19285
|
}
|
|
19036
19286
|
};
|
|
19037
|
-
for (const
|
|
19038
|
-
if (textParent && (
|
|
19287
|
+
for (const child3 of list2) {
|
|
19288
|
+
if (textParent && (child3.recType === RT2.TextHeaderAtom || child3.recType === RT2.SlidePersistAtom)) {
|
|
19039
19289
|
finish();
|
|
19040
|
-
group =
|
|
19041
|
-
if (group && (
|
|
19290
|
+
group = child3.recType === RT2.TextHeaderAtom ? { atoms: [], styles: [] } : void 0;
|
|
19291
|
+
if (group && (child3.recVer !== 0 || child3.recInstance > (record5.recType === OA.ClientTextbox ? 0 : 5) || child3.recLen !== 4))
|
|
19042
19292
|
throw new Error("Invalid formatting TextHeaderAtom");
|
|
19043
|
-
} else if (group && (
|
|
19044
|
-
group.atoms.push(
|
|
19045
|
-
else if (group &&
|
|
19046
|
-
styleBytes +=
|
|
19293
|
+
} else if (group && (child3.recType === RT2.TextCharsAtom || child3.recType === RT2.TextBytesAtom))
|
|
19294
|
+
group.atoms.push(child3.headerOffset);
|
|
19295
|
+
else if (group && child3.recType === RT2.StyleTextPropAtom) {
|
|
19296
|
+
styleBytes += child3.recLen;
|
|
19047
19297
|
if (styleBytes > maxStyleBytes)
|
|
19048
19298
|
throw new Error("Formatting payload budget exceeded");
|
|
19049
|
-
group.styles.push(
|
|
19299
|
+
group.styles.push(child3);
|
|
19050
19300
|
}
|
|
19051
|
-
if (
|
|
19052
|
-
stack.push({ record:
|
|
19301
|
+
if (child3.recVer === 15 || child3.recType === OA.ClientTextbox)
|
|
19302
|
+
stack.push({ record: child3, depth: depth + 1 });
|
|
19053
19303
|
}
|
|
19054
19304
|
finish();
|
|
19055
19305
|
}
|
|
@@ -19137,7 +19387,7 @@ function editPptCharacterFontSize(input, edit) {
|
|
|
19137
19387
|
}
|
|
19138
19388
|
}
|
|
19139
19389
|
|
|
19140
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19390
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt-document.js
|
|
19141
19391
|
var PPT_CAPABILITIES = Object.freeze({
|
|
19142
19392
|
read: Object.freeze(["active-slide-ids", "active-outline-and-inline-text", "text-encoding", "direct-character-run-spans-and-font-size", "active-shape-ids-and-flags", "primitive-shape-kind", "explicit-anchor-geometry", "validated-inline-shape-text", "active-notes-identities-and-inline-text", "opaque-streams"]),
|
|
19143
19393
|
write: Object.freeze(["existing-text-fixed-utf16-length", "existing-literal-inline-text-box-font-size", "unmirrored-top-level-small-anchor-bounds", "existing-notes-body-fixed-utf16-length"]),
|
|
@@ -19573,7 +19823,7 @@ var PptDocument = class extends Ole2DocumentBase {
|
|
|
19573
19823
|
}
|
|
19574
19824
|
};
|
|
19575
19825
|
|
|
19576
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19826
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression.js
|
|
19577
19827
|
function decodeVsdBlock(input, limit3 = 32 * 1024 * 1024) {
|
|
19578
19828
|
if (!Number.isSafeInteger(limit3) || limit3 < 0 || limit3 > 64 * 1024 * 1024)
|
|
19579
19829
|
throw new Error("Invalid VSD decompression limit");
|
|
@@ -19620,7 +19870,7 @@ function encodeVsdBlock(input) {
|
|
|
19620
19870
|
return output;
|
|
19621
19871
|
}
|
|
19622
19872
|
|
|
19623
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19873
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-reader.js
|
|
19624
19874
|
var VsdError = class extends Error {
|
|
19625
19875
|
reason;
|
|
19626
19876
|
constructor(reason) {
|
|
@@ -19994,7 +20244,7 @@ function readVsdDrawing(input) {
|
|
|
19994
20244
|
return data;
|
|
19995
20245
|
}
|
|
19996
20246
|
|
|
19997
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20247
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression-fit.js
|
|
19998
20248
|
var VSD_COMPRESSION_FIT_MAX_BYTES = 8 * 1024 * 1024;
|
|
19999
20249
|
var MAX_INPUT = VSD_COMPRESSION_FIT_MAX_BYTES;
|
|
20000
20250
|
var MAX_GAP = 4096;
|
|
@@ -20169,7 +20419,7 @@ function encodeVsdBlockToSize(input, capacity) {
|
|
|
20169
20419
|
return { bytes: output, paddingBytes: 0 };
|
|
20170
20420
|
}
|
|
20171
20421
|
|
|
20172
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20422
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-writer.js
|
|
20173
20423
|
function replaceRecord(input, drawing, record5, replacement) {
|
|
20174
20424
|
if (!drawing.writable)
|
|
20175
20425
|
throw new VsdError("shared-or-overlapping-allocation");
|
|
@@ -20253,7 +20503,7 @@ function replaceVsdShapeTransform(input, pageId2, shapeId2, transform2) {
|
|
|
20253
20503
|
return candidate;
|
|
20254
20504
|
}
|
|
20255
20505
|
|
|
20256
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20506
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-document.js
|
|
20257
20507
|
var VsdShape = class {
|
|
20258
20508
|
id;
|
|
20259
20509
|
#read;
|
|
@@ -20404,7 +20654,7 @@ var VsdDocument = class extends Ole2DocumentBase {
|
|
|
20404
20654
|
}
|
|
20405
20655
|
};
|
|
20406
20656
|
|
|
20407
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20657
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document.js
|
|
20408
20658
|
var CfbDocument = class extends Ole2DocumentBase {
|
|
20409
20659
|
get kind() {
|
|
20410
20660
|
return "cfb";
|
|
@@ -24402,8 +24652,8 @@ async function assertShapeOrderPackageScope(pkg, check) {
|
|
|
24402
24652
|
);
|
|
24403
24653
|
}
|
|
24404
24654
|
}
|
|
24405
|
-
for (const
|
|
24406
|
-
if (
|
|
24655
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
24656
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
24407
24657
|
}
|
|
24408
24658
|
}
|
|
24409
24659
|
}
|
|
@@ -25060,10 +25310,10 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
25060
25310
|
))
|
|
25061
25311
|
fail("EDIT_REFERENCED_DELETE", "Scoped metadata references the deleted shape.");
|
|
25062
25312
|
}
|
|
25063
|
-
for (const
|
|
25064
|
-
if (
|
|
25313
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25314
|
+
if (child3.nodeType === 1)
|
|
25065
25315
|
pending.push({
|
|
25066
|
-
node:
|
|
25316
|
+
node: child3,
|
|
25067
25317
|
style: style2,
|
|
25068
25318
|
...pageId2 === void 0 ? {} : { pageId: pageId2 }
|
|
25069
25319
|
});
|
|
@@ -27262,7 +27512,7 @@ function changeVisioShape(roots, document, edit, check) {
|
|
|
27262
27512
|
const outline = target2 === "ellipse" || target2 === "circle" ? void 0 : visioBasicShapeOutline(target2);
|
|
27263
27513
|
const replacement = outline ? outlineGeometrySections(shape, outline) : [ellipseGeometrySection(shape, width, height)];
|
|
27264
27514
|
const old = geometrySections(shape);
|
|
27265
|
-
const anchor = old[0] ?? Array.from(shape.children).find((
|
|
27515
|
+
const anchor = old[0] ?? Array.from(shape.children).find((child3) => AFTER_SECTIONS.has(child3.localName)) ?? null;
|
|
27266
27516
|
const changed = [];
|
|
27267
27517
|
const rounding = outline?.rounding ? outline.rounding * Math.min(width, height) : 0;
|
|
27268
27518
|
const roundingCell = local.get("Rounding");
|
|
@@ -28561,7 +28811,7 @@ function valueCell2(parent, name3, value, unit2) {
|
|
|
28561
28811
|
cell.setAttribute("V", value);
|
|
28562
28812
|
if (unit2) cell.setAttribute("U", unit2);
|
|
28563
28813
|
const before = Array.from(parent.childNodes).find(
|
|
28564
|
-
(
|
|
28814
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
28565
28815
|
);
|
|
28566
28816
|
parent.insertBefore(cell, before ?? null);
|
|
28567
28817
|
}
|
|
@@ -29396,10 +29646,10 @@ function buildContentTypesXml(types) {
|
|
|
29396
29646
|
|
|
29397
29647
|
// visio/create-document.ts
|
|
29398
29648
|
function element(parent, name3, attributes = {}) {
|
|
29399
|
-
const
|
|
29400
|
-
for (const [key2, value] of Object.entries(attributes))
|
|
29401
|
-
parent.appendChild(
|
|
29402
|
-
return
|
|
29649
|
+
const child3 = parent.ownerDocument.createElementNS(VISIO_NS, name3);
|
|
29650
|
+
for (const [key2, value] of Object.entries(attributes)) child3.setAttribute(key2, value);
|
|
29651
|
+
parent.appendChild(child3);
|
|
29652
|
+
return child3;
|
|
29403
29653
|
}
|
|
29404
29654
|
function root(name3) {
|
|
29405
29655
|
const result = parseXml(`<${name3} xmlns="${VISIO_NS}"/>`).documentElement;
|