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.mjs
CHANGED
|
@@ -439,8 +439,8 @@ function inspectNamespaces(root2, check) {
|
|
|
439
439
|
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))
|
|
440
440
|
fail("INVALID_XML", "Invalid reserved XML namespace binding");
|
|
441
441
|
}
|
|
442
|
-
for (const
|
|
443
|
-
if (
|
|
442
|
+
for (const child3 of Array.from(element2.childNodes))
|
|
443
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
@@ -695,7 +695,7 @@ function metadataAttributes(node2) {
|
|
|
695
695
|
var VISIO_NS = "http://schemas.microsoft.com/office/visio/2012/main";
|
|
696
696
|
var VISIO_LEGACY_NS = "http://schemas.microsoft.com/office/visio/2011/1/core";
|
|
697
697
|
var children2 = (node2, name3) => node2 ? elements(node2).filter(
|
|
698
|
-
(
|
|
698
|
+
(child3) => child3.localName === name3 && (child3.namespaceURI === VISIO_NS || child3.namespaceURI === VISIO_LEGACY_NS)
|
|
699
699
|
) : [];
|
|
700
700
|
var child = (node2, name3) => children2(node2, name3)[0];
|
|
701
701
|
var attribute2 = (node2, name3) => node2?.getAttribute(name3) ?? void 0;
|
|
@@ -2263,7 +2263,7 @@ function setCell(shape, name3, value, formula) {
|
|
|
2263
2263
|
node2 = shape.ownerDocument.createElementNS(shape.namespaceURI, "Cell");
|
|
2264
2264
|
node2.setAttribute("N", name3);
|
|
2265
2265
|
const before = Array.from(shape.childNodes).find(
|
|
2266
|
-
(
|
|
2266
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
2267
2267
|
);
|
|
2268
2268
|
shape.insertBefore(node2, before ?? null);
|
|
2269
2269
|
}
|
|
@@ -4162,7 +4162,7 @@ function serializeEditedXml(root2, limits, check) {
|
|
|
4162
4162
|
if (/[\t\r\n]/.test(attr2.value))
|
|
4163
4163
|
fail("UNSUPPORTED_XML_EDIT", "Attribute whitespace cannot be preserved by this writer.");
|
|
4164
4164
|
}
|
|
4165
|
-
for (const
|
|
4165
|
+
for (const child3 of Array.from(node2.childNodes)) pending.push(child3);
|
|
4166
4166
|
}
|
|
4167
4167
|
let xml = buildXml(root2.ownerDocument);
|
|
4168
4168
|
xml = xml.replace(
|
|
@@ -5891,7 +5891,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5891
5891
|
const p = target2.paint;
|
|
5892
5892
|
characters += p.fill.length + p.stroke.length + p.fillRule.length + p.strokeLinecap.length + p.strokeLinejoin.length;
|
|
5893
5893
|
}
|
|
5894
|
-
} else for (const
|
|
5894
|
+
} else for (const child3 of target2.items) strings(child3);
|
|
5895
5895
|
if (characters > limits.maxCharacters) limit("Retained vector character limit exceeded.");
|
|
5896
5896
|
}
|
|
5897
5897
|
for (const clip of scene.clips) strings(clip);
|
|
@@ -5937,7 +5937,7 @@ function checkVectorGraph(scene, limits) {
|
|
|
5937
5937
|
finite2(extent2 * (Math.abs(matrix3[0]) + Math.abs(matrix3[2])), limits.maxCoordinate);
|
|
5938
5938
|
finite2(extent2 * (Math.abs(matrix3[1]) + Math.abs(matrix3[3])), limits.maxCoordinate);
|
|
5939
5939
|
}
|
|
5940
|
-
} else for (const
|
|
5940
|
+
} else for (const child3 of target2.items) content2(child3, matrix3, depth + 1);
|
|
5941
5941
|
if (target2.clipIndex !== void 0) content2(scene.clips[target2.clipIndex], matrix3, depth + 1);
|
|
5942
5942
|
}
|
|
5943
5943
|
for (const clip of scene.clips) content2(clip, IDENTITY, 1);
|
|
@@ -6068,7 +6068,7 @@ function validate(value, limits) {
|
|
|
6068
6068
|
kind: "group",
|
|
6069
6069
|
...base(node2),
|
|
6070
6070
|
items: Object.freeze(
|
|
6071
|
-
array(node2.items, limits.maxNodes - nodes).map((
|
|
6071
|
+
array(node2.items, limits.maxNodes - nodes).map((child3) => item(child3, depth + 1))
|
|
6072
6072
|
)
|
|
6073
6073
|
});
|
|
6074
6074
|
}
|
|
@@ -6076,11 +6076,11 @@ function validate(value, limits) {
|
|
|
6076
6076
|
const node2 = own(input, ["matrix", "clipIndex", "items"], depth);
|
|
6077
6077
|
const items2 = [];
|
|
6078
6078
|
for (const value2 of array(node2.items, limits.maxNodes - nodes)) {
|
|
6079
|
-
const
|
|
6080
|
-
if (
|
|
6079
|
+
const child3 = own(value2, ["matrix", "clipIndex", "commands", "clipRule"], depth + 1);
|
|
6080
|
+
if (child3.clipRule !== "nonzero" && child3.clipRule !== "evenodd")
|
|
6081
6081
|
unsafe("Invalid normalized clip rule.");
|
|
6082
6082
|
items2.push(
|
|
6083
|
-
Object.freeze({ ...base(
|
|
6083
|
+
Object.freeze({ ...base(child3), commands: path(child3.commands), clipRule: child3.clipRule })
|
|
6084
6084
|
);
|
|
6085
6085
|
}
|
|
6086
6086
|
return Object.freeze({ ...base(node2), items: Object.freeze(items2) });
|
|
@@ -6206,7 +6206,7 @@ function sanitize(root2, limits) {
|
|
|
6206
6206
|
paint: paint(data2.attrs)
|
|
6207
6207
|
}) : Object.assign(target2, {
|
|
6208
6208
|
kind: "group",
|
|
6209
|
-
items: Object.freeze(children5(data2.children).map((
|
|
6209
|
+
items: Object.freeze(children5(data2.children).map((child3) => item(child3, depth + 1)))
|
|
6210
6210
|
});
|
|
6211
6211
|
freezeLater.push(result);
|
|
6212
6212
|
return result;
|
|
@@ -6223,8 +6223,8 @@ function sanitize(root2, limits) {
|
|
|
6223
6223
|
ids.set(id3, clips.length);
|
|
6224
6224
|
const target2 = base(data2.attrs);
|
|
6225
6225
|
const paths = [];
|
|
6226
|
-
for (const
|
|
6227
|
-
const part = node2(
|
|
6226
|
+
for (const child3 of children5(data2.children)) {
|
|
6227
|
+
const part = node2(child3, depth + 1, true);
|
|
6228
6228
|
if (part.tag !== "path") unsafe("Clip content must be a path.");
|
|
6229
6229
|
const path = Object.assign(base(part.attrs), {
|
|
6230
6230
|
commands: leaf(part),
|
|
@@ -6248,12 +6248,12 @@ function sanitize(root2, limits) {
|
|
|
6248
6248
|
if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height)
|
|
6249
6249
|
unsafe("Viewport differs from dimensions.");
|
|
6250
6250
|
const items = [];
|
|
6251
|
-
for (const
|
|
6252
|
-
const peek = record(
|
|
6251
|
+
for (const child3 of children5(data.children)) {
|
|
6252
|
+
const peek = record(child3, ["tag", "attrs", "children"]);
|
|
6253
6253
|
if (peek.tag === "defs") {
|
|
6254
|
-
const defs = node2(
|
|
6254
|
+
const defs = node2(child3, 1);
|
|
6255
6255
|
for (const value of children5(defs.children)) definition(value, 2);
|
|
6256
|
-
} else items.push(item(
|
|
6256
|
+
} else items.push(item(child3, 1));
|
|
6257
6257
|
}
|
|
6258
6258
|
for (const { target: target2, id: id3 } of pending) {
|
|
6259
6259
|
const index = ids.get(id3);
|
|
@@ -7079,9 +7079,9 @@ function parseDrawingColor(element2) {
|
|
|
7079
7079
|
const color2 = {
|
|
7080
7080
|
kind,
|
|
7081
7081
|
value: colorValue(kind, element2),
|
|
7082
|
-
transforms: elements(element2).map((
|
|
7083
|
-
name:
|
|
7084
|
-
value:
|
|
7082
|
+
transforms: elements(element2).map((child3) => ({
|
|
7083
|
+
name: child3.localName,
|
|
7084
|
+
value: child3.getAttribute("val") ?? ""
|
|
7085
7085
|
}))
|
|
7086
7086
|
};
|
|
7087
7087
|
const fallback = kind === "system" ? element2.getAttribute("lastClr") : null;
|
|
@@ -7262,7 +7262,7 @@ function drawingThemeXml(theme2, parts) {
|
|
|
7262
7262
|
const color2 = theme2.colorScheme.colors[slot];
|
|
7263
7263
|
if (!color2) throw new Error(`The theme colour scheme has no ${slot} colour.`);
|
|
7264
7264
|
const node2 = doc.createElementNS(NS.a, `a:${slot}`);
|
|
7265
|
-
for (const
|
|
7265
|
+
for (const child3 of fragment(node2, drawingColorXml(color2), namespaces)) node2.appendChild(child3);
|
|
7266
7266
|
scheme.appendChild(node2);
|
|
7267
7267
|
}
|
|
7268
7268
|
extensionList(scheme, parts.colorSchemeExtensions, namespaces);
|
|
@@ -7746,7 +7746,7 @@ function legacyFillGradient(cells4, width, height, resolve) {
|
|
|
7746
7746
|
};
|
|
7747
7747
|
}
|
|
7748
7748
|
|
|
7749
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
7749
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
|
|
7750
7750
|
var CRC_TABLE = (() => {
|
|
7751
7751
|
const table2 = new Uint32Array(256);
|
|
7752
7752
|
for (let n = 0; n < 256; n++) {
|
|
@@ -10519,7 +10519,7 @@ function cloneInherited(shape, parentId, context) {
|
|
|
10519
10519
|
return {
|
|
10520
10520
|
...shape,
|
|
10521
10521
|
id: id3,
|
|
10522
|
-
children: shape.children.map((
|
|
10522
|
+
children: shape.children.map((child3) => cloneInherited(child3, id3, context))
|
|
10523
10523
|
};
|
|
10524
10524
|
}
|
|
10525
10525
|
function normalizeShapes(raw, context, depth = 0, masterStack = []) {
|
|
@@ -10902,7 +10902,7 @@ function scan(xml) {
|
|
|
10902
10902
|
}
|
|
10903
10903
|
const children5 = [];
|
|
10904
10904
|
let depth = 0;
|
|
10905
|
-
let
|
|
10905
|
+
let child3;
|
|
10906
10906
|
i = openEnd;
|
|
10907
10907
|
for (; ; ) {
|
|
10908
10908
|
const lt = xml.indexOf("<", i);
|
|
@@ -10920,13 +10920,13 @@ function scan(xml) {
|
|
|
10920
10920
|
return { root: root2, children: children5 };
|
|
10921
10921
|
}
|
|
10922
10922
|
depth--;
|
|
10923
|
-
if (depth === 0 &&
|
|
10924
|
-
children5.push({ ...
|
|
10923
|
+
if (depth === 0 && child3)
|
|
10924
|
+
children5.push({ ...child3, closeStart: lt, end, selfClosing: false });
|
|
10925
10925
|
} else if (xml[end - 2] === "/") {
|
|
10926
10926
|
if (depth === 0)
|
|
10927
10927
|
children5.push({ start: lt, openEnd: end, closeStart: end, end, selfClosing: true });
|
|
10928
10928
|
} else {
|
|
10929
|
-
if (depth === 0)
|
|
10929
|
+
if (depth === 0) child3 = { start: lt, openEnd: end };
|
|
10930
10930
|
depth++;
|
|
10931
10931
|
}
|
|
10932
10932
|
}
|
|
@@ -11589,7 +11589,7 @@ function getVisioPageLayers(document, pageId2) {
|
|
|
11589
11589
|
return result.reverse();
|
|
11590
11590
|
}
|
|
11591
11591
|
|
|
11592
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11592
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
|
|
11593
11593
|
var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
|
|
11594
11594
|
var ENDOFCHAIN = 4294967294;
|
|
11595
11595
|
var FREESECT = 4294967295;
|
|
@@ -11597,7 +11597,9 @@ var FATSECT = 4294967293;
|
|
|
11597
11597
|
var DIFSECT = 4294967292;
|
|
11598
11598
|
var MAXREGSECT = 4294967290;
|
|
11599
11599
|
var ENTRY_TYPE_EMPTY = 0;
|
|
11600
|
+
var ENTRY_TYPE_STORAGE = 1;
|
|
11600
11601
|
var ENTRY_TYPE_STREAM = 2;
|
|
11602
|
+
var NOSTREAM = 4294967295;
|
|
11601
11603
|
var ENTRY_TYPE_ROOT = 5;
|
|
11602
11604
|
var DIR_ENTRY_SIZE = 128;
|
|
11603
11605
|
var Ole2ParseError = class extends Error {
|
|
@@ -11607,10 +11609,174 @@ var Ole2ParseError = class extends Error {
|
|
|
11607
11609
|
}
|
|
11608
11610
|
};
|
|
11609
11611
|
|
|
11610
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
const
|
|
11612
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-directory.js
|
|
11613
|
+
var FILETIME_UNIX_EPOCH = 116444736000000000n;
|
|
11614
|
+
function readFileTime(view2, offset) {
|
|
11615
|
+
const ticks = view2.getBigUint64(offset, true);
|
|
11616
|
+
if (ticks === 0n)
|
|
11617
|
+
return void 0;
|
|
11618
|
+
const ms = Number((ticks - FILETIME_UNIX_EPOCH) / 10000n);
|
|
11619
|
+
const date2 = new Date(ms);
|
|
11620
|
+
return Number.isNaN(date2.getTime()) ? void 0 : date2;
|
|
11621
|
+
}
|
|
11622
|
+
function decodeSlot(dir, id3, majorVersion, warnings) {
|
|
11623
|
+
const view2 = new DataView(dir.buffer, dir.byteOffset + id3 * DIR_ENTRY_SIZE, DIR_ENTRY_SIZE);
|
|
11624
|
+
const nameLen = view2.getUint16(64, true);
|
|
11625
|
+
const type = view2.getUint8(66);
|
|
11626
|
+
const nameValid = nameLen >= 2 && nameLen <= 64 && nameLen % 2 === 0 && view2.getUint16(nameLen - 2, true) === 0;
|
|
11627
|
+
let name3 = "";
|
|
11628
|
+
if (nameValid)
|
|
11629
|
+
for (let j = 0; j < nameLen - 2; j += 2)
|
|
11630
|
+
name3 += String.fromCharCode(view2.getUint16(j, true));
|
|
11631
|
+
const link = (offset) => {
|
|
11632
|
+
const value = view2.getUint32(offset, true);
|
|
11633
|
+
return value === NOSTREAM ? -1 : value;
|
|
11634
|
+
};
|
|
11635
|
+
const sizeLow = view2.getUint32(120, true);
|
|
11636
|
+
const sizeHigh = view2.getUint32(124, true);
|
|
11637
|
+
let size3 = sizeLow;
|
|
11638
|
+
if (majorVersion === 4)
|
|
11639
|
+
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11640
|
+
else if (sizeHigh !== 0 && type !== ENTRY_TYPE_EMPTY) {
|
|
11641
|
+
warnings.push({ code: "size-high-bits", message: `Ignored v3 stream-size high bits on directory entry ${id3}` });
|
|
11642
|
+
}
|
|
11643
|
+
return {
|
|
11644
|
+
id: id3,
|
|
11645
|
+
type,
|
|
11646
|
+
nameValid,
|
|
11647
|
+
entry: {
|
|
11648
|
+
id: id3,
|
|
11649
|
+
name: name3,
|
|
11650
|
+
type,
|
|
11651
|
+
color: view2.getUint8(67),
|
|
11652
|
+
leftSiblingId: link(68),
|
|
11653
|
+
rightSiblingId: link(72),
|
|
11654
|
+
childId: link(76),
|
|
11655
|
+
clsid: new Uint8Array(view2.buffer.slice(view2.byteOffset + 80, view2.byteOffset + 96)),
|
|
11656
|
+
stateBits: view2.getUint32(96, true),
|
|
11657
|
+
created: readFileTime(view2, 100),
|
|
11658
|
+
modified: readFileTime(view2, 108),
|
|
11659
|
+
startSector: view2.getUint32(116, true),
|
|
11660
|
+
size: size3,
|
|
11661
|
+
parentId: -1
|
|
11662
|
+
}
|
|
11663
|
+
};
|
|
11664
|
+
}
|
|
11665
|
+
function readDirectory(dir, majorVersion, strict, warnings) {
|
|
11666
|
+
const count = Math.floor(dir.length / DIR_ENTRY_SIZE);
|
|
11667
|
+
const slots = [];
|
|
11668
|
+
for (let id3 = 0; id3 < count; id3++)
|
|
11669
|
+
slots.push(decodeSlot(dir, id3, majorVersion, warnings));
|
|
11670
|
+
const roots = slots.filter((slot) => slot.type === ENTRY_TYPE_ROOT);
|
|
11671
|
+
if (roots.length !== 1 || !roots[0].nameValid)
|
|
11672
|
+
throw new Ole2ParseError("Invalid root directory entry");
|
|
11673
|
+
const root2 = roots[0];
|
|
11674
|
+
root2.entry.path = [];
|
|
11675
|
+
const reached = /* @__PURE__ */ new Set([root2.id]);
|
|
11676
|
+
const fail3 = (message) => {
|
|
11677
|
+
if (strict)
|
|
11678
|
+
throw new Ole2ParseError(message);
|
|
11679
|
+
warnings.push({ code: "directory-link", message });
|
|
11680
|
+
};
|
|
11681
|
+
const pending = [];
|
|
11682
|
+
const push = (id3, parent, from) => {
|
|
11683
|
+
if (id3 === -1)
|
|
11684
|
+
return;
|
|
11685
|
+
const target2 = slots[id3];
|
|
11686
|
+
if (!target2 || target2.type === ENTRY_TYPE_EMPTY || target2.type === ENTRY_TYPE_ROOT) {
|
|
11687
|
+
fail3(`Directory entry ${from} links to invalid entry ${id3}`);
|
|
11688
|
+
return;
|
|
11689
|
+
}
|
|
11690
|
+
if (reached.has(id3)) {
|
|
11691
|
+
fail3(`Cyclic directory tree at entry ${id3}`);
|
|
11692
|
+
return;
|
|
11693
|
+
}
|
|
11694
|
+
reached.add(id3);
|
|
11695
|
+
pending.push({ id: id3, parent });
|
|
11696
|
+
};
|
|
11697
|
+
push(root2.entry.childId, root2, root2.id);
|
|
11698
|
+
while (pending.length) {
|
|
11699
|
+
const { id: id3, parent } = pending.pop();
|
|
11700
|
+
const slot = slots[id3];
|
|
11701
|
+
if (!slot.nameValid)
|
|
11702
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11703
|
+
slot.entry.parentId = parent.id;
|
|
11704
|
+
slot.entry.path = [...parent.entry.path, slot.entry.name];
|
|
11705
|
+
push(slot.entry.leftSiblingId, parent, id3);
|
|
11706
|
+
push(slot.entry.rightSiblingId, parent, id3);
|
|
11707
|
+
if (slot.type === ENTRY_TYPE_STORAGE)
|
|
11708
|
+
push(slot.entry.childId, slot, id3);
|
|
11709
|
+
}
|
|
11710
|
+
const entries = [];
|
|
11711
|
+
for (const slot of slots) {
|
|
11712
|
+
if (slot.type === ENTRY_TYPE_EMPTY)
|
|
11713
|
+
continue;
|
|
11714
|
+
if (!reached.has(slot.id)) {
|
|
11715
|
+
if (!slot.nameValid) {
|
|
11716
|
+
if (strict)
|
|
11717
|
+
throw new Ole2ParseError("Invalid directory entry name");
|
|
11718
|
+
warnings.push({ code: "invalid-unreachable-entry", message: `Skipped undecodable stale directory entry ${slot.id}` });
|
|
11719
|
+
continue;
|
|
11720
|
+
}
|
|
11721
|
+
if (strict)
|
|
11722
|
+
throw new Ole2ParseError(`Directory entry ${slot.id} is not reachable from the root`);
|
|
11723
|
+
warnings.push({ code: "unreachable-entry", message: `Directory entry ${slot.id} (${slot.entry.name}) is not reachable from the root` });
|
|
11724
|
+
}
|
|
11725
|
+
entries.push(slot.entry);
|
|
11726
|
+
}
|
|
11727
|
+
return entries;
|
|
11728
|
+
}
|
|
11729
|
+
function sameName(a, b) {
|
|
11730
|
+
return a.length === b.length && a.toUpperCase() === b.toUpperCase();
|
|
11731
|
+
}
|
|
11732
|
+
function bareName(name3) {
|
|
11733
|
+
return name3.replace(/^[\u0001-\u0006]/, "");
|
|
11734
|
+
}
|
|
11735
|
+
function normalizePath(path, rootName) {
|
|
11736
|
+
const parts = typeof path === "string" ? path.split("/").filter((part) => part !== "") : [...path];
|
|
11737
|
+
if (parts.length && sameName(parts[0], rootName) && typeof path === "string")
|
|
11738
|
+
parts.shift();
|
|
11739
|
+
return parts;
|
|
11740
|
+
}
|
|
11741
|
+
function child2(entries, parentId, name3) {
|
|
11742
|
+
const children5 = entries.filter((entry) => entry.parentId === parentId && entry.path !== void 0);
|
|
11743
|
+
const pick = (matches) => matches.length === 1 ? matches[0] : void 0;
|
|
11744
|
+
const exact = children5.filter((entry) => entry.name === name3);
|
|
11745
|
+
if (exact.length)
|
|
11746
|
+
return pick(exact);
|
|
11747
|
+
const folded = children5.filter((entry) => sameName(entry.name, name3));
|
|
11748
|
+
if (folded.length)
|
|
11749
|
+
return pick(folded);
|
|
11750
|
+
return pick(children5.filter((entry) => sameName(bareName(entry.name), bareName(name3))));
|
|
11751
|
+
}
|
|
11752
|
+
function findDirectoryEntry(entries, path) {
|
|
11753
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11754
|
+
if (!root2)
|
|
11755
|
+
return void 0;
|
|
11756
|
+
let current = root2;
|
|
11757
|
+
for (const name3 of normalizePath(path, root2.name)) {
|
|
11758
|
+
if (current.type !== ENTRY_TYPE_ROOT && current.type !== ENTRY_TYPE_STORAGE)
|
|
11759
|
+
return void 0;
|
|
11760
|
+
current = child2(entries, current.id, name3);
|
|
11761
|
+
if (!current)
|
|
11762
|
+
return void 0;
|
|
11763
|
+
}
|
|
11764
|
+
return current;
|
|
11765
|
+
}
|
|
11766
|
+
function findStreamByName(entries, name3, isReadable) {
|
|
11767
|
+
const root2 = entries.find((entry) => entry.type === ENTRY_TYPE_ROOT);
|
|
11768
|
+
if (root2 && root2.name === name3)
|
|
11769
|
+
return root2;
|
|
11770
|
+
const top = entries.filter((entry) => entry.parentId === root2?.id && isReadable(entry));
|
|
11771
|
+
return top.find((entry) => entry.name === name3) ?? top.find((entry) => sameName(entry.name, name3)) ?? entries.find((entry) => entry.name === name3 && isReadable(entry));
|
|
11772
|
+
}
|
|
11773
|
+
|
|
11774
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
|
|
11775
|
+
function parseOle2(buffer, options = {}) {
|
|
11776
|
+
const strict = options.strict === true;
|
|
11777
|
+
const data = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
11778
|
+
const view2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
11779
|
+
const warnings = [];
|
|
11614
11780
|
if (data.length < 512) {
|
|
11615
11781
|
throw new Ole2ParseError("Truncated OLE2 compound file header");
|
|
11616
11782
|
}
|
|
@@ -11619,11 +11785,12 @@ function parseOle2(buffer) {
|
|
|
11619
11785
|
throw new Ole2ParseError("Not a valid OLE2 compound file");
|
|
11620
11786
|
}
|
|
11621
11787
|
}
|
|
11622
|
-
view2.getUint16(24, true);
|
|
11623
11788
|
const majorVersion = view2.getUint16(26, true);
|
|
11624
11789
|
const byteOrder = view2.getUint16(28, true);
|
|
11625
11790
|
if (byteOrder !== 65534) {
|
|
11626
|
-
|
|
11791
|
+
if (strict)
|
|
11792
|
+
throw new Ole2ParseError("Invalid byte order mark");
|
|
11793
|
+
warnings.push({ code: "byte-order", message: `Ignored byte order mark 0x${byteOrder.toString(16)}` });
|
|
11627
11794
|
}
|
|
11628
11795
|
const sectorSizePower = view2.getUint16(30, true);
|
|
11629
11796
|
const miniSectorSizePower = view2.getUint16(32, true);
|
|
@@ -11632,10 +11799,14 @@ function parseOle2(buffer) {
|
|
|
11632
11799
|
}
|
|
11633
11800
|
const sectorSize = 1 << sectorSizePower;
|
|
11634
11801
|
const miniSectorSize = 1 << miniSectorSizePower;
|
|
11635
|
-
if (data.length < sectorSize
|
|
11802
|
+
if (data.length < sectorSize)
|
|
11636
11803
|
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11804
|
+
if (data.length % sectorSize !== 0) {
|
|
11805
|
+
if (strict)
|
|
11806
|
+
throw new Ole2ParseError("Truncated OLE2 sector");
|
|
11807
|
+
warnings.push({ code: "unaligned-length", message: `File length ${data.length} is not a multiple of ${sectorSize}` });
|
|
11637
11808
|
}
|
|
11638
|
-
const sectorCount = data.length / sectorSize - 1;
|
|
11809
|
+
const sectorCount = Math.ceil(data.length / sectorSize) - 1;
|
|
11639
11810
|
const totalFATSectors = view2.getUint32(44, true);
|
|
11640
11811
|
const firstDirectorySector = view2.getUint32(48, true);
|
|
11641
11812
|
const miniStreamCutoff = view2.getUint32(56, true);
|
|
@@ -11656,6 +11827,13 @@ function parseOle2(buffer) {
|
|
|
11656
11827
|
}
|
|
11657
11828
|
return data.subarray(offset, offset + sectorSize);
|
|
11658
11829
|
}
|
|
11830
|
+
function copySector(sector, target2, at2, want) {
|
|
11831
|
+
const offset = sectorOffset(sector);
|
|
11832
|
+
if (sector >= sectorCount || offset + want > data.length) {
|
|
11833
|
+
throw new Ole2ParseError(`Sector ${sector} at offset ${offset} exceeds file size ${data.length}`);
|
|
11834
|
+
}
|
|
11835
|
+
target2.set(data.subarray(offset, offset + want), at2);
|
|
11836
|
+
}
|
|
11659
11837
|
const fatSectors = [];
|
|
11660
11838
|
for (let i = 0; i < 109 && fatSectors.length < totalFATSectors; i++) {
|
|
11661
11839
|
const sector = view2.getUint32(76 + i * 4, true);
|
|
@@ -11691,29 +11869,36 @@ function parseOle2(buffer) {
|
|
|
11691
11869
|
fatEntries.push(fatView.getUint32(i * 4, true));
|
|
11692
11870
|
}
|
|
11693
11871
|
}
|
|
11694
|
-
function
|
|
11695
|
-
const
|
|
11696
|
-
let current = startSector;
|
|
11872
|
+
function followChain(table2, start, label, needed) {
|
|
11873
|
+
const ids = [];
|
|
11697
11874
|
const visited = /* @__PURE__ */ new Set();
|
|
11875
|
+
let current = start;
|
|
11698
11876
|
while (current <= MAXREGSECT) {
|
|
11877
|
+
if (!strict && needed !== void 0 && ids.length >= needed)
|
|
11878
|
+
return ids;
|
|
11699
11879
|
if (visited.has(current)) {
|
|
11700
|
-
throw new Ole2ParseError(`Circular reference in
|
|
11880
|
+
throw new Ole2ParseError(`Circular reference in ${label} chain at sector ${current}`);
|
|
11701
11881
|
}
|
|
11702
11882
|
visited.add(current);
|
|
11703
|
-
|
|
11704
|
-
if (
|
|
11705
|
-
throw new Ole2ParseError(
|
|
11706
|
-
current =
|
|
11707
|
-
}
|
|
11708
|
-
if (current !== ENDOFCHAIN)
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
for (const sector of sectors) {
|
|
11714
|
-
result.set(sector, offset);
|
|
11715
|
-
offset += sectorSize;
|
|
11883
|
+
ids.push(current);
|
|
11884
|
+
if (table2[current] === void 0)
|
|
11885
|
+
throw new Ole2ParseError(`Missing ${label} chain entry`);
|
|
11886
|
+
current = table2[current];
|
|
11887
|
+
}
|
|
11888
|
+
if (current !== ENDOFCHAIN) {
|
|
11889
|
+
if (strict || needed === void 0 || ids.length < needed) {
|
|
11890
|
+
throw new Ole2ParseError(`Invalid ${label} chain terminator`);
|
|
11891
|
+
}
|
|
11892
|
+
warnings.push({ code: "chain-terminator", message: `Accepted ${label} chain ending in 0x${current.toString(16)}` });
|
|
11716
11893
|
}
|
|
11894
|
+
return ids;
|
|
11895
|
+
}
|
|
11896
|
+
function readMetadataChain(startSector, label) {
|
|
11897
|
+
if (startSector > MAXREGSECT)
|
|
11898
|
+
return new Uint8Array(0);
|
|
11899
|
+
const ids = followChain(fatEntries, startSector, label === "directory" ? "FAT" : label);
|
|
11900
|
+
const result = new Uint8Array(ids.length * sectorSize);
|
|
11901
|
+
ids.forEach((id3, i) => result.set(readSector(id3), i * sectorSize));
|
|
11717
11902
|
return result;
|
|
11718
11903
|
}
|
|
11719
11904
|
function readStream(startSector, size3) {
|
|
@@ -11721,68 +11906,44 @@ function parseOle2(buffer) {
|
|
|
11721
11906
|
return new Uint8Array(0);
|
|
11722
11907
|
if (size3 > sectorCount * sectorSize)
|
|
11723
11908
|
throw new Ole2ParseError("Stream size exceeds file size");
|
|
11724
|
-
const
|
|
11725
|
-
|
|
11909
|
+
const needed = Math.ceil(size3 / sectorSize);
|
|
11910
|
+
const ids = followChain(fatEntries, startSector, "FAT", needed);
|
|
11911
|
+
if (ids.length < needed)
|
|
11726
11912
|
throw new Ole2ParseError("Truncated stream sector chain");
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
|
|
11731
|
-
const entries = [];
|
|
11732
|
-
for (let i = 0; i < numEntries; i++) {
|
|
11733
|
-
const entryOffset = i * DIR_ENTRY_SIZE;
|
|
11734
|
-
const entryView = new DataView(dirRaw.buffer, dirRaw.byteOffset + entryOffset, DIR_ENTRY_SIZE);
|
|
11735
|
-
const nameLen = entryView.getUint16(64, true);
|
|
11736
|
-
const objectType = entryView.getUint8(66);
|
|
11737
|
-
if (objectType === ENTRY_TYPE_EMPTY) {
|
|
11738
|
-
continue;
|
|
11739
|
-
}
|
|
11740
|
-
if (nameLen < 2 || nameLen > 64 || nameLen % 2 !== 0 || entryView.getUint16(nameLen - 2, true) !== 0) {
|
|
11741
|
-
throw new Ole2ParseError("Invalid directory entry name");
|
|
11913
|
+
const result = new Uint8Array(size3);
|
|
11914
|
+
for (let i = 0; i < needed; i++) {
|
|
11915
|
+
copySector(ids[i], result, i * sectorSize, Math.min(sectorSize, size3 - i * sectorSize));
|
|
11742
11916
|
}
|
|
11743
|
-
|
|
11744
|
-
|
|
11745
|
-
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
const clsid = new Uint8Array(entryView.buffer.slice(entryView.byteOffset + 80, entryView.byteOffset + 96));
|
|
11752
|
-
const startSector = entryView.getUint32(116, true);
|
|
11753
|
-
const sizeLow = entryView.getUint32(120, true);
|
|
11754
|
-
let size3 = sizeLow;
|
|
11755
|
-
if (majorVersion === 4) {
|
|
11756
|
-
const sizeHigh = entryView.getUint32(124, true);
|
|
11757
|
-
size3 = sizeLow + sizeHigh * 4294967296;
|
|
11758
|
-
if (!Number.isSafeInteger(size3) || size3 > sectorCount * sectorSize) {
|
|
11759
|
-
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11760
|
-
}
|
|
11917
|
+
return result;
|
|
11918
|
+
}
|
|
11919
|
+
if (firstDirectorySector > MAXREGSECT)
|
|
11920
|
+
throw new Ole2ParseError("Missing directory chain");
|
|
11921
|
+
const entries = readDirectory(readMetadataChain(firstDirectorySector, "directory"), majorVersion, strict, warnings);
|
|
11922
|
+
for (const entry of entries) {
|
|
11923
|
+
if (majorVersion === 4 && (!Number.isSafeInteger(entry.size) || entry.size > sectorCount * sectorSize)) {
|
|
11924
|
+
throw new Ole2ParseError("Stream size exceeds supported file bounds");
|
|
11761
11925
|
}
|
|
11762
|
-
entries.push({
|
|
11763
|
-
name: name3,
|
|
11764
|
-
type: objectType,
|
|
11765
|
-
startSector,
|
|
11766
|
-
size: size3,
|
|
11767
|
-
childId: childId === 4294967295 ? -1 : childId,
|
|
11768
|
-
leftSiblingId: leftSiblingId === 4294967295 ? -1 : leftSiblingId,
|
|
11769
|
-
rightSiblingId: rightSiblingId === 4294967295 ? -1 : rightSiblingId,
|
|
11770
|
-
clsid
|
|
11771
|
-
});
|
|
11772
11926
|
}
|
|
11773
11927
|
const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
|
|
11774
|
-
if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
|
|
11775
|
-
throw new Ole2ParseError("Invalid root directory entry");
|
|
11776
|
-
}
|
|
11777
11928
|
let miniStreamData;
|
|
11778
|
-
if (rootEntry
|
|
11929
|
+
if (rootEntry.startSector <= MAXREGSECT) {
|
|
11779
11930
|
miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
|
|
11780
11931
|
}
|
|
11781
11932
|
const miniFatEntries = [];
|
|
11782
|
-
if (firstMiniFATSector
|
|
11783
|
-
|
|
11784
|
-
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
11933
|
+
if (firstMiniFATSector > MAXREGSECT && totalMiniFATSectors > 0) {
|
|
11934
|
+
if (strict)
|
|
11785
11935
|
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
11936
|
+
warnings.push({ code: "mini-fat-count", message: `Header lists ${totalMiniFATSectors} mini FAT sectors but no chain` });
|
|
11937
|
+
}
|
|
11938
|
+
if (firstMiniFATSector <= MAXREGSECT && (totalMiniFATSectors > 0 || !strict)) {
|
|
11939
|
+
const miniFatRaw = readMetadataChain(firstMiniFATSector, "mini FAT");
|
|
11940
|
+
if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
|
|
11941
|
+
if (strict)
|
|
11942
|
+
throw new Ole2ParseError("Unexpected mini FAT chain length");
|
|
11943
|
+
warnings.push({
|
|
11944
|
+
code: "mini-fat-count",
|
|
11945
|
+
message: `Header lists ${totalMiniFATSectors} mini FAT sectors; chain has ${miniFatRaw.length / sectorSize}`
|
|
11946
|
+
});
|
|
11786
11947
|
}
|
|
11787
11948
|
const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
|
|
11788
11949
|
const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
|
|
@@ -11796,48 +11957,67 @@ function parseOle2(buffer) {
|
|
|
11796
11957
|
if (!miniStreamData) {
|
|
11797
11958
|
throw new Ole2ParseError("Mini stream container not found");
|
|
11798
11959
|
}
|
|
11799
|
-
const
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11960
|
+
const needed = Math.ceil(size3 / miniSectorSize);
|
|
11961
|
+
const capacity = miniStreamData.length / miniSectorSize;
|
|
11962
|
+
let ids;
|
|
11963
|
+
try {
|
|
11964
|
+
ids = followChain(miniFatEntries, startSector, "mini FAT", needed);
|
|
11965
|
+
} catch (error) {
|
|
11966
|
+
if (error instanceof Ole2ParseError && /Missing mini FAT/.test(error.message)) {
|
|
11967
|
+
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11805
11968
|
}
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11969
|
+
throw error;
|
|
11970
|
+
}
|
|
11971
|
+
const result = new Uint8Array(size3);
|
|
11972
|
+
for (let i = 0; i < ids.length && i < needed; i++) {
|
|
11973
|
+
const id3 = ids[i];
|
|
11974
|
+
if (id3 >= capacity || (id3 + 1) * miniSectorSize > miniStreamData.length) {
|
|
11809
11975
|
throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
|
|
11810
11976
|
}
|
|
11811
|
-
|
|
11812
|
-
|
|
11977
|
+
const want = Math.min(miniSectorSize, size3 - i * miniSectorSize);
|
|
11978
|
+
result.set(miniStreamData.subarray(id3 * miniSectorSize, id3 * miniSectorSize + want), i * miniSectorSize);
|
|
11813
11979
|
}
|
|
11814
|
-
if (
|
|
11815
|
-
throw new Ole2ParseError("Invalid mini FAT chain terminator");
|
|
11816
|
-
const totalLength = sectors.length * miniSectorSize;
|
|
11817
|
-
if (totalLength < size3)
|
|
11980
|
+
if (ids.length < needed)
|
|
11818
11981
|
throw new Ole2ParseError("Truncated mini stream sector chain");
|
|
11819
|
-
|
|
11820
|
-
let offset = 0;
|
|
11821
|
-
for (const sector of sectors) {
|
|
11822
|
-
result.set(sector, offset);
|
|
11823
|
-
offset += miniSectorSize;
|
|
11824
|
-
}
|
|
11825
|
-
return result.subarray(0, size3);
|
|
11982
|
+
return result;
|
|
11826
11983
|
}
|
|
11827
|
-
function
|
|
11828
|
-
const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name3);
|
|
11829
|
-
if (!entry) {
|
|
11830
|
-
return void 0;
|
|
11831
|
-
}
|
|
11984
|
+
function readEntry(entry) {
|
|
11832
11985
|
if (entry.size < miniStreamCutoff && entry.type !== ENTRY_TYPE_ROOT) {
|
|
11833
11986
|
return readMiniStream(entry.startSector, entry.size);
|
|
11834
11987
|
}
|
|
11835
11988
|
return readStream(entry.startSector, entry.size);
|
|
11836
11989
|
}
|
|
11837
|
-
|
|
11990
|
+
const readable = (entry) => entry.type === ENTRY_TYPE_STREAM || entry.type === ENTRY_TYPE_ROOT;
|
|
11991
|
+
return {
|
|
11992
|
+
entries,
|
|
11993
|
+
warnings,
|
|
11994
|
+
getStream(name3) {
|
|
11995
|
+
const entry = findStreamByName(entries, name3, readable);
|
|
11996
|
+
return entry ? readEntry(entry) : void 0;
|
|
11997
|
+
},
|
|
11998
|
+
getStreamByPath(path) {
|
|
11999
|
+
const entry = findDirectoryEntry(entries, path);
|
|
12000
|
+
return entry && entry.type === ENTRY_TYPE_STREAM ? readEntry(entry) : void 0;
|
|
12001
|
+
},
|
|
12002
|
+
getStreamById(id3) {
|
|
12003
|
+
const entry = entries.find((candidate) => candidate.id === id3);
|
|
12004
|
+
return entry && readable(entry) ? readEntry(entry) : void 0;
|
|
12005
|
+
},
|
|
12006
|
+
findEntry(path) {
|
|
12007
|
+
return findDirectoryEntry(entries, path);
|
|
12008
|
+
}
|
|
12009
|
+
};
|
|
11838
12010
|
}
|
|
11839
12011
|
|
|
11840
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12012
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document-base.js
|
|
12013
|
+
var copyOf = (bytes) => bytes === void 0 ? void 0 : new Uint8Array(bytes);
|
|
12014
|
+
var detachEntry = (entry) => ({
|
|
12015
|
+
...entry,
|
|
12016
|
+
clsid: new Uint8Array(entry.clsid),
|
|
12017
|
+
path: entry.path && [...entry.path],
|
|
12018
|
+
created: entry.created && new Date(entry.created),
|
|
12019
|
+
modified: entry.modified && new Date(entry.modified)
|
|
12020
|
+
});
|
|
11841
12021
|
var Ole2DocumentError = class extends Error {
|
|
11842
12022
|
code;
|
|
11843
12023
|
constructor(code, message) {
|
|
@@ -11870,16 +12050,31 @@ var Ole2DocumentBase = class {
|
|
|
11870
12050
|
return this.#revision;
|
|
11871
12051
|
}
|
|
11872
12052
|
get entries() {
|
|
11873
|
-
return this.#container.entries.map(
|
|
12053
|
+
return this.#container.entries.map(detachEntry);
|
|
12054
|
+
}
|
|
12055
|
+
get warnings() {
|
|
12056
|
+
return this.#container.warnings.map((warning) => ({ ...warning }));
|
|
11874
12057
|
}
|
|
11875
|
-
#getStream = (name3) =>
|
|
11876
|
-
|
|
11877
|
-
|
|
12058
|
+
#getStream = (name3) => copyOf(this.#container.getStream(name3));
|
|
12059
|
+
#getStreamByPath = (path) => copyOf(this.#container.getStreamByPath(path));
|
|
12060
|
+
#getStreamById = (id3) => copyOf(this.#container.getStreamById(id3));
|
|
12061
|
+
#findEntry = (path) => {
|
|
12062
|
+
const entry = this.#container.findEntry(path);
|
|
12063
|
+
return entry && detachEntry(entry);
|
|
11878
12064
|
};
|
|
11879
12065
|
/** Retain the original detachable callback API while observing current state. */
|
|
11880
12066
|
get getStream() {
|
|
11881
12067
|
return this.#getStream;
|
|
11882
12068
|
}
|
|
12069
|
+
get getStreamByPath() {
|
|
12070
|
+
return this.#getStreamByPath;
|
|
12071
|
+
}
|
|
12072
|
+
get getStreamById() {
|
|
12073
|
+
return this.#getStreamById;
|
|
12074
|
+
}
|
|
12075
|
+
get findEntry() {
|
|
12076
|
+
return this.#findEntry;
|
|
12077
|
+
}
|
|
11883
12078
|
/** Isolated working input: codecs cannot accidentally mutate current state. */
|
|
11884
12079
|
getBytes() {
|
|
11885
12080
|
return new Uint8Array(this.#bytes);
|
|
@@ -11902,7 +12097,7 @@ var Ole2DocumentBase = class {
|
|
|
11902
12097
|
}
|
|
11903
12098
|
};
|
|
11904
12099
|
|
|
11905
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12100
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
|
|
11906
12101
|
var END = 4294967294;
|
|
11907
12102
|
var MAX = 4294967290;
|
|
11908
12103
|
var NIL = 4294967295;
|
|
@@ -11937,6 +12132,58 @@ function chainToEnd(table2, start, max) {
|
|
|
11937
12132
|
}
|
|
11938
12133
|
return out;
|
|
11939
12134
|
}
|
|
12135
|
+
function chainPrefix(table2, start, needed) {
|
|
12136
|
+
const out = [], seen = /* @__PURE__ */ new Set();
|
|
12137
|
+
let id3 = start;
|
|
12138
|
+
while (out.length < needed) {
|
|
12139
|
+
if (id3 > MAX || id3 >= table2.length || seen.has(id3))
|
|
12140
|
+
throw new Error("Invalid CFB chain");
|
|
12141
|
+
seen.add(id3);
|
|
12142
|
+
out.push(id3);
|
|
12143
|
+
id3 = table2[id3];
|
|
12144
|
+
}
|
|
12145
|
+
return out;
|
|
12146
|
+
}
|
|
12147
|
+
function readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32) {
|
|
12148
|
+
const size3 = target2.size;
|
|
12149
|
+
if (size3 === 0)
|
|
12150
|
+
return new Uint8Array(0);
|
|
12151
|
+
const out = new Uint8Array(size3);
|
|
12152
|
+
const copyPhysical = (at2, want, into) => {
|
|
12153
|
+
if (at2 + want > input.length)
|
|
12154
|
+
throw new Error("Stream data exceeds file size");
|
|
12155
|
+
out.set(input.subarray(at2, at2 + want), into);
|
|
12156
|
+
};
|
|
12157
|
+
if (size3 >= read32(56)) {
|
|
12158
|
+
if (size3 > sectorCount * sectorSize)
|
|
12159
|
+
throw new Error("Stream size exceeds file size");
|
|
12160
|
+
chainPrefix(fat, target2.start, Math.ceil(size3 / sectorSize)).forEach((id3, i) => {
|
|
12161
|
+
if (id3 >= sectorCount)
|
|
12162
|
+
throw new Error("Invalid sector");
|
|
12163
|
+
copyPhysical((id3 + 1) * sectorSize, Math.min(sectorSize, size3 - i * sectorSize), i * sectorSize);
|
|
12164
|
+
});
|
|
12165
|
+
return out;
|
|
12166
|
+
}
|
|
12167
|
+
const miniFatSectors = chainToEnd(fat, read32(60), sectorCount);
|
|
12168
|
+
const miniCapacity = Math.floor(Math.min(root2.size, sectorCount * sectorSize) / miniSize);
|
|
12169
|
+
const miniFat = [];
|
|
12170
|
+
for (const id3 of miniFatSectors) {
|
|
12171
|
+
const bytes = sector(id3), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
12172
|
+
for (let j = 0; j < sectorSize / 4 && miniFat.length < miniCapacity; j++)
|
|
12173
|
+
miniFat.push(dv.getUint32(j * 4, true));
|
|
12174
|
+
}
|
|
12175
|
+
const rootSectors = chainPrefix(fat, root2.start, Math.ceil(root2.size / sectorSize));
|
|
12176
|
+
chainPrefix(miniFat, target2.start, Math.ceil(size3 / miniSize)).forEach((id3, i) => {
|
|
12177
|
+
const start = id3 * miniSize, want = Math.min(miniSize, size3 - i * miniSize);
|
|
12178
|
+
if (start + want > root2.size)
|
|
12179
|
+
throw new Error("Mini stream out of bounds");
|
|
12180
|
+
const rootSector = rootSectors[Math.floor(start / sectorSize)];
|
|
12181
|
+
if (rootSector >= sectorCount)
|
|
12182
|
+
throw new Error("Invalid sector");
|
|
12183
|
+
copyPhysical((rootSector + 1) * sectorSize + start % sectorSize, want, i * miniSize);
|
|
12184
|
+
});
|
|
12185
|
+
return out;
|
|
12186
|
+
}
|
|
11940
12187
|
function processCompoundFileStream(input, path, replacement) {
|
|
11941
12188
|
const reject2 = () => replacement ? input : void 0;
|
|
11942
12189
|
try {
|
|
@@ -11944,18 +12191,19 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
11944
12191
|
return reject2();
|
|
11945
12192
|
const view2 = new DataView(input.buffer, input.byteOffset, input.byteLength);
|
|
11946
12193
|
const read32 = (offset2) => view2.getUint32(offset2, true);
|
|
11947
|
-
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 ||
|
|
12194
|
+
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.
|
|
12195
|
+
replacement && view2.getUint16(28, true) !== 65534)
|
|
11948
12196
|
return reject2();
|
|
11949
12197
|
const major = view2.getUint16(26, true), shift = view2.getUint16(30, true), miniShift = view2.getUint16(32, true);
|
|
11950
12198
|
if (major !== 3 && major !== 4 || shift !== (major === 3 ? 9 : 12) || miniShift !== 6)
|
|
11951
12199
|
return reject2();
|
|
11952
12200
|
const sectorSize = 1 << shift, miniSize = 1 << miniShift;
|
|
11953
|
-
if (input.length % sectorSize !== 0)
|
|
12201
|
+
if (input.length < sectorSize || replacement && input.length % sectorSize !== 0)
|
|
11954
12202
|
return reject2();
|
|
11955
|
-
const sectorCount = input.length / sectorSize - 1;
|
|
12203
|
+
const sectorCount = Math.ceil(input.length / sectorSize) - 1;
|
|
11956
12204
|
const offset = (id3) => (id3 + 1) * sectorSize;
|
|
11957
12205
|
const sector = (id3) => {
|
|
11958
|
-
if (id3 > MAX || id3 >= sectorCount)
|
|
12206
|
+
if (id3 > MAX || id3 >= sectorCount || offset(id3) + sectorSize > input.length)
|
|
11959
12207
|
throw new Error("Invalid sector");
|
|
11960
12208
|
return input.subarray(offset(id3), offset(id3) + sectorSize);
|
|
11961
12209
|
};
|
|
@@ -12005,7 +12253,7 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12005
12253
|
for (let i = 0; i < nameLength - 2; i += 2)
|
|
12006
12254
|
name3 += String.fromCharCode(dvDir.getUint16(p + i, true));
|
|
12007
12255
|
const sizeLow = dvDir.getUint32(p + 120, true), sizeHigh = dvDir.getUint32(p + 124, true);
|
|
12008
|
-
if (sizeHigh !== 0)
|
|
12256
|
+
if (sizeHigh !== 0 && (replacement || major === 4))
|
|
12009
12257
|
return reject2();
|
|
12010
12258
|
entries.push({
|
|
12011
12259
|
id: id3,
|
|
@@ -12052,6 +12300,8 @@ function processCompoundFileStream(input, path, replacement) {
|
|
|
12052
12300
|
}
|
|
12053
12301
|
if (!target2)
|
|
12054
12302
|
return reject2();
|
|
12303
|
+
if (!replacement)
|
|
12304
|
+
return readTarget(input, target2, root2, fat, sector, sectorCount, sectorSize, miniSize, read32);
|
|
12055
12305
|
const names = entries.map((e) => e.name.toLowerCase());
|
|
12056
12306
|
if (replacement && (names.includes("encryptioninfo") || names.includes("encryptedpackage")))
|
|
12057
12307
|
return reject2();
|
|
@@ -12175,7 +12425,7 @@ function replaceCompoundFileStream(input, path, replacement) {
|
|
|
12175
12425
|
return processCompoundFileStream(input, path, replacement) ?? input;
|
|
12176
12426
|
}
|
|
12177
12427
|
|
|
12178
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12428
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-v4.js
|
|
12179
12429
|
var END2 = 4294967294;
|
|
12180
12430
|
var FREE = 4294967295;
|
|
12181
12431
|
var FAT = 4294967293;
|
|
@@ -12363,7 +12613,7 @@ function resizeCompoundFileStreamV4(input, path, replacement) {
|
|
|
12363
12613
|
}
|
|
12364
12614
|
}
|
|
12365
12615
|
|
|
12366
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12616
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-allocation.js
|
|
12367
12617
|
function appendCompoundAllocations(input, existingFatIds, payloads, sectorSize = 512) {
|
|
12368
12618
|
const sectorCount = input.length / sectorSize - 1;
|
|
12369
12619
|
const entriesPerFat = sectorSize / 4;
|
|
@@ -12410,7 +12660,7 @@ function followCompoundAllocation(table2, start) {
|
|
|
12410
12660
|
return ids;
|
|
12411
12661
|
}
|
|
12412
12662
|
|
|
12413
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12663
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize-mini.js
|
|
12414
12664
|
var END3 = 4294967294;
|
|
12415
12665
|
var FREE2 = 4294967295;
|
|
12416
12666
|
var SECTOR = 512;
|
|
@@ -12482,7 +12732,7 @@ function resizeMiniCompoundStream(input, fat, fatIds, root2, target2, replacemen
|
|
|
12482
12732
|
return output.bytes;
|
|
12483
12733
|
}
|
|
12484
12734
|
|
|
12485
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12735
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-stream-resize.js
|
|
12486
12736
|
var END4 = 4294967294;
|
|
12487
12737
|
var FREE3 = 4294967295;
|
|
12488
12738
|
var FAT2 = 4294967293;
|
|
@@ -12647,7 +12897,7 @@ function resizeCompoundFileStream(input, path, replacement) {
|
|
|
12647
12897
|
}
|
|
12648
12898
|
}
|
|
12649
12899
|
|
|
12650
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12900
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fib.js
|
|
12651
12901
|
var FC_LCB_INDEX = {
|
|
12652
12902
|
plcfbteChpx: 12,
|
|
12653
12903
|
plcfbtePapx: 13,
|
|
@@ -12743,7 +12993,7 @@ function patchDocFib(wordDoc, fib, patch) {
|
|
|
12743
12993
|
view2.setUint32(papxOff + 4, patch.plcfbtePapx.lcb, true);
|
|
12744
12994
|
}
|
|
12745
12995
|
|
|
12746
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
12996
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cfb.js
|
|
12747
12997
|
var DocCfbRewriteError = class extends Error {
|
|
12748
12998
|
constructor(message) {
|
|
12749
12999
|
super(message);
|
|
@@ -12798,7 +13048,7 @@ function unwrapDocBytes(bytes) {
|
|
|
12798
13048
|
}
|
|
12799
13049
|
}
|
|
12800
13050
|
|
|
12801
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13051
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fkp.js
|
|
12802
13052
|
var PAGE_SIZE = 512;
|
|
12803
13053
|
function parseBteTable(tableStream, at2) {
|
|
12804
13054
|
const view2 = new DataView(tableStream.buffer, tableStream.byteOffset, tableStream.byteLength);
|
|
@@ -12939,7 +13189,7 @@ function buildSingleRunChpxPage(fcStart, fcEnd, blob) {
|
|
|
12939
13189
|
return page;
|
|
12940
13190
|
}
|
|
12941
13191
|
|
|
12942
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13192
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
|
|
12943
13193
|
var CP1252_HIGH_BLOCK = [
|
|
12944
13194
|
8364,
|
|
12945
13195
|
129,
|
|
@@ -13007,7 +13257,7 @@ function encodeCp1252(text3) {
|
|
|
13007
13257
|
return Uint8Array.from(bytes);
|
|
13008
13258
|
}
|
|
13009
13259
|
|
|
13010
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13260
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-pieces.js
|
|
13011
13261
|
var CLXT_PRC = 1;
|
|
13012
13262
|
var CLXT_PCDT = 2;
|
|
13013
13263
|
var DocResourceLimitError = class extends Error {
|
|
@@ -13219,7 +13469,7 @@ function buildClxBytes(pieces, prcBytes = new Uint8Array()) {
|
|
|
13219
13469
|
return result;
|
|
13220
13470
|
}
|
|
13221
13471
|
|
|
13222
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13472
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-fields.js
|
|
13223
13473
|
var UnsupportedDocFieldEditError = class extends Error {
|
|
13224
13474
|
constructor(message) {
|
|
13225
13475
|
super(message);
|
|
@@ -13303,7 +13553,7 @@ function shiftDocMainFieldCps(table2, at2, body, editStart, editEnd, delta, maxF
|
|
|
13303
13553
|
return result;
|
|
13304
13554
|
}
|
|
13305
13555
|
|
|
13306
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13556
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-editor.js
|
|
13307
13557
|
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];
|
|
13308
13558
|
var RISKY_STTB_INDICES = [21, 22, 23];
|
|
13309
13559
|
var SAFE_EXTENDED_FC_LCB_INDICES = /* @__PURE__ */ new Set([93, 94, 113, 181, 182]);
|
|
@@ -13572,7 +13822,7 @@ function tryWriteOleDocParagraphEdit(docBytes, paragraphIndex, text3, limits) {
|
|
|
13572
13822
|
}
|
|
13573
13823
|
}
|
|
13574
13824
|
|
|
13575
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
13825
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-runs.js
|
|
13576
13826
|
var LIMIT = 65536;
|
|
13577
13827
|
var SAFE_OPERANDS = /* @__PURE__ */ new Set([
|
|
13578
13828
|
2101,
|
|
@@ -13810,7 +14060,7 @@ function writeExclusiveOperand(input, cpStart, cpEnd, opcode, value) {
|
|
|
13810
14060
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13811
14061
|
}
|
|
13812
14062
|
|
|
13813
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14063
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole-document-doc-paragraph-format.js
|
|
13814
14064
|
var LIMIT2 = 65536;
|
|
13815
14065
|
var SPRM_LIMIT = 262144;
|
|
13816
14066
|
var PAGE_NUMBER_MASK = 4194303;
|
|
@@ -13998,7 +14248,7 @@ function writeDocParagraphAlignment(input, index, alignment) {
|
|
|
13998
14248
|
return parsed.doc.rewrap(word, parsed.doc.tableBytes);
|
|
13999
14249
|
}
|
|
14000
14250
|
|
|
14001
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14251
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/doc-document.js
|
|
14002
14252
|
var DOC_CAPABILITIES = Object.freeze({
|
|
14003
14253
|
read: Object.freeze(["paragraph-text", "character-runs", "direct-character-formatting", "paragraph-style-index", "direct-paragraph-alignment", "compound-streams"]),
|
|
14004
14254
|
write: Object.freeze(["paragraph-text", "existing-direct-bold-italic", "existing-direct-font-size", "existing-direct-underline", "existing-direct-paragraph-alignment"]),
|
|
@@ -14194,7 +14444,7 @@ var DocDocument = class extends Ole2DocumentBase {
|
|
|
14194
14444
|
}
|
|
14195
14445
|
};
|
|
14196
14446
|
|
|
14197
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14447
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
|
|
14198
14448
|
function compareDirEntryNames(a, b) {
|
|
14199
14449
|
const ua = a.toUpperCase();
|
|
14200
14450
|
const ub = b.toUpperCase();
|
|
@@ -14261,7 +14511,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
|
|
|
14261
14511
|
}
|
|
14262
14512
|
}
|
|
14263
14513
|
|
|
14264
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14514
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
|
|
14265
14515
|
function writeHeader(outView, outBytes, params) {
|
|
14266
14516
|
outBytes.set(OLE_MAGIC, 0);
|
|
14267
14517
|
outView.setUint16(24, 62, true);
|
|
@@ -14354,7 +14604,7 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
|
|
|
14354
14604
|
}
|
|
14355
14605
|
}
|
|
14356
14606
|
|
|
14357
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14607
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
|
|
14358
14608
|
function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
14359
14609
|
const sectorSize = 512;
|
|
14360
14610
|
const miniSectorSize = 64;
|
|
@@ -14535,7 +14785,7 @@ function buildOle2(streams, rootClsid, miniStreamCutoff = 4096) {
|
|
|
14535
14785
|
return output;
|
|
14536
14786
|
}
|
|
14537
14787
|
|
|
14538
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14788
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
|
|
14539
14789
|
var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
|
|
14540
14790
|
function unwrapXlsBytes(bytes) {
|
|
14541
14791
|
if (!isCfb(bytes)) {
|
|
@@ -14602,7 +14852,7 @@ function isCfb(bytes) {
|
|
|
14602
14852
|
return OLE_MAGIC.every((value, index) => bytes[index] === value);
|
|
14603
14853
|
}
|
|
14604
14854
|
|
|
14605
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14855
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
|
|
14606
14856
|
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`;
|
|
14607
14857
|
var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
14608
14858
|
const [id3, name3, argc] = entry.split(" ");
|
|
@@ -14610,7 +14860,7 @@ var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
|
|
|
14610
14860
|
}));
|
|
14611
14861
|
var XLS_USER_FUNCTION_ID = 255;
|
|
14612
14862
|
|
|
14613
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14863
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
|
|
14614
14864
|
var BIFF_ERRORS = {
|
|
14615
14865
|
0: "#NULL!",
|
|
14616
14866
|
7: "#DIV/0!",
|
|
@@ -14705,7 +14955,7 @@ function readArrayConstant(extra) {
|
|
|
14705
14955
|
return `{${lines2.join(";")}}`;
|
|
14706
14956
|
}
|
|
14707
14957
|
|
|
14708
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
14958
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
|
|
14709
14959
|
var RT_CONTINUE = 60;
|
|
14710
14960
|
function readXlsRecords(bytes, start = 0, end = bytes.length) {
|
|
14711
14961
|
const records = [];
|
|
@@ -14871,7 +15121,7 @@ function joinedData(record5) {
|
|
|
14871
15121
|
return out;
|
|
14872
15122
|
}
|
|
14873
15123
|
|
|
14874
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15124
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
|
|
14875
15125
|
function decodeFormula(rgce, extra, context, options) {
|
|
14876
15126
|
try {
|
|
14877
15127
|
return decode(rgce, new ByteReader(extra), context, options);
|
|
@@ -15102,7 +15352,7 @@ function readAttr(reader, stack, whitespace) {
|
|
|
15102
15352
|
}
|
|
15103
15353
|
}
|
|
15104
15354
|
|
|
15105
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15355
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
|
|
15106
15356
|
function parseSharedStrings(record5) {
|
|
15107
15357
|
const reader = SegmentReader.of(record5);
|
|
15108
15358
|
reader.u32();
|
|
@@ -15119,7 +15369,7 @@ function parseSharedStrings(record5) {
|
|
|
15119
15369
|
return strings;
|
|
15120
15370
|
}
|
|
15121
15371
|
|
|
15122
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15372
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
|
|
15123
15373
|
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(" ");
|
|
15124
15374
|
var XLS_BUILTIN_FORMATS = {
|
|
15125
15375
|
0: "General",
|
|
@@ -15376,7 +15626,7 @@ function applyXfExt(data, xfs, palette) {
|
|
|
15376
15626
|
}
|
|
15377
15627
|
}
|
|
15378
15628
|
|
|
15379
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15629
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
|
|
15380
15630
|
var XlsReadError = class extends Error {
|
|
15381
15631
|
code;
|
|
15382
15632
|
constructor(code, message) {
|
|
@@ -15386,7 +15636,7 @@ var XlsReadError = class extends Error {
|
|
|
15386
15636
|
}
|
|
15387
15637
|
};
|
|
15388
15638
|
|
|
15389
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15639
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
|
|
15390
15640
|
var RT = {
|
|
15391
15641
|
BOF: 2057,
|
|
15392
15642
|
EOF: 10,
|
|
@@ -15624,7 +15874,7 @@ function parseGlobals(records) {
|
|
|
15624
15874
|
return out;
|
|
15625
15875
|
}
|
|
15626
15876
|
|
|
15627
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
15877
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8-edit.js
|
|
15628
15878
|
function encodeRkExact(value) {
|
|
15629
15879
|
if (!Number.isFinite(value))
|
|
15630
15880
|
return void 0;
|
|
@@ -15789,7 +16039,7 @@ function editXlsNumericCell(input, edit) {
|
|
|
15789
16039
|
}
|
|
15790
16040
|
}
|
|
15791
16041
|
|
|
15792
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16042
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
|
|
15793
16043
|
var OPCODE_BOF = 2057;
|
|
15794
16044
|
var OPCODE_EOF = 10;
|
|
15795
16045
|
var OPCODE_FILEPASS = 47;
|
|
@@ -15836,7 +16086,7 @@ function decodeRk(rk) {
|
|
|
15836
16086
|
return isDiv100 ? value / 100 : value;
|
|
15837
16087
|
}
|
|
15838
16088
|
|
|
15839
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16089
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
|
|
15840
16090
|
function readRefU(r) {
|
|
15841
16091
|
return { firstRow: r.u16(), lastRow: r.u16(), firstCol: r.u8(), lastCol: r.u8() };
|
|
15842
16092
|
}
|
|
@@ -15894,7 +16144,7 @@ function resolveFormulas(formulas, shared, arrays, globals) {
|
|
|
15894
16144
|
}
|
|
15895
16145
|
}
|
|
15896
16146
|
|
|
15897
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16147
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
|
|
15898
16148
|
function parseMergedCells(data) {
|
|
15899
16149
|
const r = new ByteReader(data);
|
|
15900
16150
|
const count = r.u16();
|
|
@@ -16089,7 +16339,7 @@ function parseNote(data) {
|
|
|
16089
16339
|
return { row: row2, col, visible: (flags & 2) !== 0, id: id3, author: r.xlString() };
|
|
16090
16340
|
}
|
|
16091
16341
|
|
|
16092
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16342
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
|
|
16093
16343
|
var UNSUPPORTED = {
|
|
16094
16344
|
432: "conditional formatting",
|
|
16095
16345
|
2169: "conditional formatting",
|
|
@@ -16345,7 +16595,7 @@ function parseSheet(bound2, records, start, globals) {
|
|
|
16345
16595
|
return sheet;
|
|
16346
16596
|
}
|
|
16347
16597
|
|
|
16348
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16598
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
|
|
16349
16599
|
function compoundStreamNames(bytes) {
|
|
16350
16600
|
if (!OLE_MAGIC.every((value, index) => bytes[index] === value))
|
|
16351
16601
|
return [];
|
|
@@ -16415,7 +16665,7 @@ function readXlsWorkbook(bytes) {
|
|
|
16415
16665
|
};
|
|
16416
16666
|
}
|
|
16417
16667
|
|
|
16418
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16668
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-sst.js
|
|
16419
16669
|
var SstCursor = class {
|
|
16420
16670
|
segments;
|
|
16421
16671
|
segment = 0;
|
|
@@ -16538,7 +16788,7 @@ function appendXlsSstString(value) {
|
|
|
16538
16788
|
return Uint8Array.from(records);
|
|
16539
16789
|
}
|
|
16540
16790
|
|
|
16541
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16791
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-cell-record-splices.js
|
|
16542
16792
|
var CELL_OPS = /* @__PURE__ */ new Set([6, 513, 515, 516, 517, 638, 253, 189, 190, 214]);
|
|
16543
16793
|
function record2(opcode, data) {
|
|
16544
16794
|
const out = new Uint8Array(data.length + 4), view2 = new DataView(out.buffer);
|
|
@@ -16630,7 +16880,7 @@ function relocateXlsDbCells(input, out, records, replacement, map) {
|
|
|
16630
16880
|
}
|
|
16631
16881
|
}
|
|
16632
16882
|
|
|
16633
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
16883
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-known-records.js
|
|
16634
16884
|
var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
16635
16885
|
6,
|
|
16636
16886
|
10,
|
|
@@ -16988,7 +17238,7 @@ var KNOWN_XLS_RECORDS = /* @__PURE__ */ new Set([
|
|
|
16988
17238
|
]);
|
|
16989
17239
|
var XLS_FRT_WRAPPER = 2129;
|
|
16990
17240
|
|
|
16991
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17241
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-record-edit-model.js
|
|
16992
17242
|
var EditError = class extends Error {
|
|
16993
17243
|
reason;
|
|
16994
17244
|
constructor(reason) {
|
|
@@ -17112,7 +17362,7 @@ function findTarget(bytes, m, edit, allowed = [253, 638, 515, 189]) {
|
|
|
17112
17362
|
return target2;
|
|
17113
17363
|
}
|
|
17114
17364
|
|
|
17115
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17365
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-edit.js
|
|
17116
17366
|
function extSst(entries, map) {
|
|
17117
17367
|
const interval = Math.max(Math.floor(entries.length / 128) + 1, 8);
|
|
17118
17368
|
const count = Math.ceil(entries.length / interval);
|
|
@@ -17248,7 +17498,7 @@ function editXlsStringWorkbookStream(input, edit) {
|
|
|
17248
17498
|
}
|
|
17249
17499
|
}
|
|
17250
17500
|
|
|
17251
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17501
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-preserved-string-cell.js
|
|
17252
17502
|
function editXlsPreservedStringCell(input, edit) {
|
|
17253
17503
|
if (!OLE_MAGIC.every((value, index) => input[index] === value))
|
|
17254
17504
|
return editXlsStringWorkbookStream(input, edit);
|
|
@@ -17267,7 +17517,7 @@ function editXlsPreservedStringCell(input, edit) {
|
|
|
17267
17517
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17268
17518
|
}
|
|
17269
17519
|
|
|
17270
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17520
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-edit.js
|
|
17271
17521
|
var ERRORS = Object.freeze({
|
|
17272
17522
|
"#NULL!": 0,
|
|
17273
17523
|
"#DIV/0!": 7,
|
|
@@ -17385,7 +17635,7 @@ function editXlsBoolErrorCell(input, edit) {
|
|
|
17385
17635
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17386
17636
|
}
|
|
17387
17637
|
|
|
17388
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17638
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-record.js
|
|
17389
17639
|
function record3(opcode, data) {
|
|
17390
17640
|
const out = new Uint8Array(4 + data.length), view2 = new DataView(out.buffer);
|
|
17391
17641
|
view2.setUint16(0, opcode, true);
|
|
@@ -17431,7 +17681,7 @@ function replaceXlsBlankRecord(input, target2, col, value) {
|
|
|
17431
17681
|
return { start: target2.headerOffset, end: p + target2.length, bytes };
|
|
17432
17682
|
}
|
|
17433
17683
|
|
|
17434
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17684
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-stored-cell-edit.js
|
|
17435
17685
|
function applyXlsCellRecordReplacement(input, m, replacement) {
|
|
17436
17686
|
if (!Number.isSafeInteger(replacement.start) || !Number.isSafeInteger(replacement.end) || replacement.start < 0 || replacement.end <= replacement.start || replacement.end > input.length || !(replacement.bytes instanceof Uint8Array))
|
|
17437
17687
|
reject("malformed-records");
|
|
@@ -17543,17 +17793,17 @@ function editXlsStoredCell(input, edit, sourceKind) {
|
|
|
17543
17793
|
return resized.ok ? { ...result, bytes: resized.bytes } : { status: "unchanged", bytes: input, reason: "container-not-writable" };
|
|
17544
17794
|
}
|
|
17545
17795
|
|
|
17546
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17796
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-blank-edit.js
|
|
17547
17797
|
function editXlsBlankCell(input, edit) {
|
|
17548
17798
|
return editXlsStoredCell(input, edit, "blank");
|
|
17549
17799
|
}
|
|
17550
17800
|
|
|
17551
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17801
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-excel-bool-error-conversion.js
|
|
17552
17802
|
function editXlsBoolErrorScalarCell(input, edit) {
|
|
17553
17803
|
return editXlsStoredCell(input, edit, "bool-error");
|
|
17554
17804
|
}
|
|
17555
17805
|
|
|
17556
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
17806
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/xls-document.js
|
|
17557
17807
|
function cellType(cell) {
|
|
17558
17808
|
if (cell.formula !== void 0 || cell.formulaUndecoded || cell.arrayRange || cell.sharedFormula)
|
|
17559
17809
|
return "formula";
|
|
@@ -17750,7 +18000,7 @@ var XlsDocument = class extends Ole2DocumentBase {
|
|
|
17750
18000
|
}
|
|
17751
18001
|
};
|
|
17752
18002
|
|
|
17753
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18003
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
|
|
17754
18004
|
var PptParseError = class extends Error {
|
|
17755
18005
|
constructor(message) {
|
|
17756
18006
|
super(message);
|
|
@@ -17784,7 +18034,7 @@ function readRecordOrThrow(view2, offset) {
|
|
|
17784
18034
|
return rec;
|
|
17785
18035
|
}
|
|
17786
18036
|
|
|
17787
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18037
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
|
|
17788
18038
|
var RT2 = {
|
|
17789
18039
|
Document: 1e3,
|
|
17790
18040
|
DocumentAtom: 1001,
|
|
@@ -17879,7 +18129,7 @@ var OA = {
|
|
|
17879
18129
|
var HEADER_TOKEN_PLAIN = 3817979999;
|
|
17880
18130
|
var HEADER_TOKEN_ENCRYPTED = 4090610911;
|
|
17881
18131
|
|
|
17882
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18132
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
|
|
17883
18133
|
var DEFAULT_MAX_EDITS = 1e4;
|
|
17884
18134
|
var DEFAULT_MAX_ENTRIES = 1e6;
|
|
17885
18135
|
function checkedLimit(value) {
|
|
@@ -17996,7 +18246,7 @@ function buildPersistDirectory(view2, offsetToCurrentEdit, limits = {}) {
|
|
|
17996
18246
|
return { currentEdit: edits[0], directory };
|
|
17997
18247
|
}
|
|
17998
18248
|
|
|
17999
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18249
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text.js
|
|
18000
18250
|
var PptTextError = class extends PptParseError {
|
|
18001
18251
|
code;
|
|
18002
18252
|
constructor(code, message) {
|
|
@@ -18251,7 +18501,7 @@ function editPptSlideText(input, edit) {
|
|
|
18251
18501
|
}
|
|
18252
18502
|
}
|
|
18253
18503
|
|
|
18254
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18504
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-reader.js
|
|
18255
18505
|
var DEFAULT_LIMITS = { maxRecords: 1e5, maxShapes: 1e4, maxProperties: 1e5, maxNameChars: 1e6, maxTextBytes: 16 * 1024 * 1024 };
|
|
18256
18506
|
var GEOMETRY_PROPERTY_IDS = /* @__PURE__ */ new Set([4, 127, 128, 191, 385, 447, 448, 459, 511, 896, 959]);
|
|
18257
18507
|
function pptShapeChildren(view2, parent) {
|
|
@@ -18331,8 +18581,8 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18331
18581
|
}
|
|
18332
18582
|
}
|
|
18333
18583
|
if (rec.recVer === 15 || rec.recType === OA.ClientTextbox)
|
|
18334
|
-
for (const
|
|
18335
|
-
preflight.push({ rec:
|
|
18584
|
+
for (const child3 of pptShapeChildren(view2, rec))
|
|
18585
|
+
preflight.push({ rec: child3, depth: depth + 1 });
|
|
18336
18586
|
}
|
|
18337
18587
|
const textModel = readPptSlideTexts(input);
|
|
18338
18588
|
return textModel.slides.map((slide) => {
|
|
@@ -18470,7 +18720,7 @@ function readPptSlideShapes(input, limits = {}) {
|
|
|
18470
18720
|
});
|
|
18471
18721
|
}
|
|
18472
18722
|
|
|
18473
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18723
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-shape-edit.js
|
|
18474
18724
|
function equalPptShapeBounds(a, b) {
|
|
18475
18725
|
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
18476
18726
|
}
|
|
@@ -18559,7 +18809,7 @@ function editPptShapeBounds(input, edit) {
|
|
|
18559
18809
|
}
|
|
18560
18810
|
}
|
|
18561
18811
|
|
|
18562
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
18812
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-notes.js
|
|
18563
18813
|
var viewOf2 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18564
18814
|
function fail2(message) {
|
|
18565
18815
|
throw new PptTextError("corrupt", message);
|
|
@@ -18598,11 +18848,11 @@ function inspect5(input, limits = {}) {
|
|
|
18598
18848
|
fail2("Notes record budget exceeded");
|
|
18599
18849
|
if (end - pos < 8)
|
|
18600
18850
|
fail2("Truncated notes child header");
|
|
18601
|
-
const
|
|
18602
|
-
if (
|
|
18851
|
+
const child3 = record5(pos);
|
|
18852
|
+
if (child3.dataOffset + child3.recLen > end)
|
|
18603
18853
|
fail2("Notes child exceeds parent");
|
|
18604
|
-
result.push(
|
|
18605
|
-
pos =
|
|
18854
|
+
result.push(child3);
|
|
18855
|
+
pos = child3.dataOffset + child3.recLen;
|
|
18606
18856
|
}
|
|
18607
18857
|
return result;
|
|
18608
18858
|
};
|
|
@@ -18845,7 +19095,7 @@ function editPptNotesText(input, edit) {
|
|
|
18845
19095
|
}
|
|
18846
19096
|
}
|
|
18847
19097
|
|
|
18848
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19098
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/legacy-ppt-text-style.js
|
|
18849
19099
|
var viewOf3 = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
18850
19100
|
var MAX_RECORDS = 1e5;
|
|
18851
19101
|
var MAX_RUNS = 2e4;
|
|
@@ -19028,22 +19278,22 @@ function readPptCharacterRuns(input, limits = {}) {
|
|
|
19028
19278
|
associations.set(atom, { styles: group.styles, textCount: group.atoms.length });
|
|
19029
19279
|
}
|
|
19030
19280
|
};
|
|
19031
|
-
for (const
|
|
19032
|
-
if (textParent && (
|
|
19281
|
+
for (const child3 of list2) {
|
|
19282
|
+
if (textParent && (child3.recType === RT2.TextHeaderAtom || child3.recType === RT2.SlidePersistAtom)) {
|
|
19033
19283
|
finish();
|
|
19034
|
-
group =
|
|
19035
|
-
if (group && (
|
|
19284
|
+
group = child3.recType === RT2.TextHeaderAtom ? { atoms: [], styles: [] } : void 0;
|
|
19285
|
+
if (group && (child3.recVer !== 0 || child3.recInstance > (record5.recType === OA.ClientTextbox ? 0 : 5) || child3.recLen !== 4))
|
|
19036
19286
|
throw new Error("Invalid formatting TextHeaderAtom");
|
|
19037
|
-
} else if (group && (
|
|
19038
|
-
group.atoms.push(
|
|
19039
|
-
else if (group &&
|
|
19040
|
-
styleBytes +=
|
|
19287
|
+
} else if (group && (child3.recType === RT2.TextCharsAtom || child3.recType === RT2.TextBytesAtom))
|
|
19288
|
+
group.atoms.push(child3.headerOffset);
|
|
19289
|
+
else if (group && child3.recType === RT2.StyleTextPropAtom) {
|
|
19290
|
+
styleBytes += child3.recLen;
|
|
19041
19291
|
if (styleBytes > maxStyleBytes)
|
|
19042
19292
|
throw new Error("Formatting payload budget exceeded");
|
|
19043
|
-
group.styles.push(
|
|
19293
|
+
group.styles.push(child3);
|
|
19044
19294
|
}
|
|
19045
|
-
if (
|
|
19046
|
-
stack.push({ record:
|
|
19295
|
+
if (child3.recVer === 15 || child3.recType === OA.ClientTextbox)
|
|
19296
|
+
stack.push({ record: child3, depth: depth + 1 });
|
|
19047
19297
|
}
|
|
19048
19298
|
finish();
|
|
19049
19299
|
}
|
|
@@ -19131,7 +19381,7 @@ function editPptCharacterFontSize(input, edit) {
|
|
|
19131
19381
|
}
|
|
19132
19382
|
}
|
|
19133
19383
|
|
|
19134
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19384
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ppt-document.js
|
|
19135
19385
|
var PPT_CAPABILITIES = Object.freeze({
|
|
19136
19386
|
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"]),
|
|
19137
19387
|
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"]),
|
|
@@ -19567,7 +19817,7 @@ var PptDocument = class extends Ole2DocumentBase {
|
|
|
19567
19817
|
}
|
|
19568
19818
|
};
|
|
19569
19819
|
|
|
19570
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19820
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression.js
|
|
19571
19821
|
function decodeVsdBlock(input, limit3 = 32 * 1024 * 1024) {
|
|
19572
19822
|
if (!Number.isSafeInteger(limit3) || limit3 < 0 || limit3 > 64 * 1024 * 1024)
|
|
19573
19823
|
throw new Error("Invalid VSD decompression limit");
|
|
@@ -19614,7 +19864,7 @@ function encodeVsdBlock(input) {
|
|
|
19614
19864
|
return output;
|
|
19615
19865
|
}
|
|
19616
19866
|
|
|
19617
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
19867
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-reader.js
|
|
19618
19868
|
var VsdError = class extends Error {
|
|
19619
19869
|
reason;
|
|
19620
19870
|
constructor(reason) {
|
|
@@ -19988,7 +20238,7 @@ function readVsdDrawing(input) {
|
|
|
19988
20238
|
return data;
|
|
19989
20239
|
}
|
|
19990
20240
|
|
|
19991
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20241
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-compression-fit.js
|
|
19992
20242
|
var VSD_COMPRESSION_FIT_MAX_BYTES = 8 * 1024 * 1024;
|
|
19993
20243
|
var MAX_INPUT = VSD_COMPRESSION_FIT_MAX_BYTES;
|
|
19994
20244
|
var MAX_GAP = 4096;
|
|
@@ -20163,7 +20413,7 @@ function encodeVsdBlockToSize(input, capacity) {
|
|
|
20163
20413
|
return { bytes: output, paddingBytes: 0 };
|
|
20164
20414
|
}
|
|
20165
20415
|
|
|
20166
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20416
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-writer.js
|
|
20167
20417
|
function replaceRecord(input, drawing, record5, replacement) {
|
|
20168
20418
|
if (!drawing.writable)
|
|
20169
20419
|
throw new VsdError("shared-or-overlapping-allocation");
|
|
@@ -20247,7 +20497,7 @@ function replaceVsdShapeTransform(input, pageId2, shapeId2, transform2) {
|
|
|
20247
20497
|
return candidate;
|
|
20248
20498
|
}
|
|
20249
20499
|
|
|
20250
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20500
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/vsd-document.js
|
|
20251
20501
|
var VsdShape = class {
|
|
20252
20502
|
id;
|
|
20253
20503
|
#read;
|
|
@@ -20398,7 +20648,7 @@ var VsdDocument = class extends Ole2DocumentBase {
|
|
|
20398
20648
|
}
|
|
20399
20649
|
};
|
|
20400
20650
|
|
|
20401
|
-
// ../../node_modules/.bun/@christophervr+ole2@0.
|
|
20651
|
+
// ../../node_modules/.bun/@christophervr+ole2@0.13.0/node_modules/@christophervr/ole2/dist/ole2-document.js
|
|
20402
20652
|
var CfbDocument = class extends Ole2DocumentBase {
|
|
20403
20653
|
get kind() {
|
|
20404
20654
|
return "cfb";
|
|
@@ -24396,8 +24646,8 @@ async function assertShapeOrderPackageScope(pkg, check) {
|
|
|
24396
24646
|
);
|
|
24397
24647
|
}
|
|
24398
24648
|
}
|
|
24399
|
-
for (const
|
|
24400
|
-
if (
|
|
24649
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
24650
|
+
if (child3.nodeType === 1) pending.push(child3);
|
|
24401
24651
|
}
|
|
24402
24652
|
}
|
|
24403
24653
|
}
|
|
@@ -25054,10 +25304,10 @@ async function assertGeometryPackageScope(pkg, pagePaths, commands, check, roots
|
|
|
25054
25304
|
))
|
|
25055
25305
|
fail("EDIT_REFERENCED_DELETE", "Scoped metadata references the deleted shape.");
|
|
25056
25306
|
}
|
|
25057
|
-
for (const
|
|
25058
|
-
if (
|
|
25307
|
+
for (const child3 of Array.from(node2.childNodes))
|
|
25308
|
+
if (child3.nodeType === 1)
|
|
25059
25309
|
pending.push({
|
|
25060
|
-
node:
|
|
25310
|
+
node: child3,
|
|
25061
25311
|
style: style2,
|
|
25062
25312
|
...pageId2 === void 0 ? {} : { pageId: pageId2 }
|
|
25063
25313
|
});
|
|
@@ -27256,7 +27506,7 @@ function changeVisioShape(roots, document, edit, check) {
|
|
|
27256
27506
|
const outline = target2 === "ellipse" || target2 === "circle" ? void 0 : visioBasicShapeOutline(target2);
|
|
27257
27507
|
const replacement = outline ? outlineGeometrySections(shape, outline) : [ellipseGeometrySection(shape, width, height)];
|
|
27258
27508
|
const old = geometrySections(shape);
|
|
27259
|
-
const anchor = old[0] ?? Array.from(shape.children).find((
|
|
27509
|
+
const anchor = old[0] ?? Array.from(shape.children).find((child3) => AFTER_SECTIONS.has(child3.localName)) ?? null;
|
|
27260
27510
|
const changed = [];
|
|
27261
27511
|
const rounding = outline?.rounding ? outline.rounding * Math.min(width, height) : 0;
|
|
27262
27512
|
const roundingCell = local.get("Rounding");
|
|
@@ -28555,7 +28805,7 @@ function valueCell2(parent, name3, value, unit2) {
|
|
|
28555
28805
|
cell.setAttribute("V", value);
|
|
28556
28806
|
if (unit2) cell.setAttribute("U", unit2);
|
|
28557
28807
|
const before = Array.from(parent.childNodes).find(
|
|
28558
|
-
(
|
|
28808
|
+
(child3) => child3.nodeType === 1 && child3.localName !== "Cell"
|
|
28559
28809
|
);
|
|
28560
28810
|
parent.insertBefore(cell, before ?? null);
|
|
28561
28811
|
}
|
|
@@ -29390,10 +29640,10 @@ function buildContentTypesXml(types) {
|
|
|
29390
29640
|
|
|
29391
29641
|
// visio/create-document.ts
|
|
29392
29642
|
function element(parent, name3, attributes = {}) {
|
|
29393
|
-
const
|
|
29394
|
-
for (const [key2, value] of Object.entries(attributes))
|
|
29395
|
-
parent.appendChild(
|
|
29396
|
-
return
|
|
29643
|
+
const child3 = parent.ownerDocument.createElementNS(VISIO_NS, name3);
|
|
29644
|
+
for (const [key2, value] of Object.entries(attributes)) child3.setAttribute(key2, value);
|
|
29645
|
+
parent.appendChild(child3);
|
|
29646
|
+
return child3;
|
|
29397
29647
|
}
|
|
29398
29648
|
function root(name3) {
|
|
29399
29649
|
const result = parseXml(`<${name3} xmlns="${VISIO_NS}"/>`).documentElement;
|