ooxml-core 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ import type { ParseVsdxOptions } from './parser.js';
2
+ import type { VisioDocument } from './model.js';
3
+ export type ParseLegacyVsdOptions = Pick<ParseVsdxOptions, 'maxShapes' | 'maxGeometryCommands' | 'maxTextCharacters' | 'maxDiagnostics'> & {
4
+ limits?: Pick<NonNullable<ParseVsdxOptions['limits']>, 'maxInputBytes' | 'maxRuntimeMs'>;
5
+ };
6
+ /** Read-only preview. The shared decoder performs bounded binary traversal.
7
+ * Runtime checks surround synchronous decoding; they cannot preempt that call.
8
+ */
9
+ export declare function parseLegacyVsd(input: Uint8Array | ArrayBuffer, options?: ParseLegacyVsdOptions): VisioDocument;
10
+ //# sourceMappingURL=legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["../../src/visio/legacy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAwC,MAAM,YAAY,CAAC;AAEtF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACvC,gBAAgB,EAChB,WAAW,GAAG,qBAAqB,GAAG,mBAAmB,GAAG,gBAAgB,CAC5E,GAAG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAAE,eAAe,GAAG,cAAc,CAAC,CAAC;CACzF,CAAC;AAmMF;;GAEG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,OAAO,GAAE,qBAA0B,GACjC,aAAa,CAoBf"}
@@ -0,0 +1,5 @@
1
+ import { type ParseVsdxOptions } from './parser.js';
2
+ import type { VisioDocument } from './model.js';
3
+ /** Dispatch on container bytes, keeping the VSDX parser and its options intact. */
4
+ export declare function loadVisio(input: Uint8Array | ArrayBuffer, options?: ParseVsdxOptions): Promise<VisioDocument>;
5
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/visio/load.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,mFAAmF;AACnF,wBAAsB,SAAS,CAC9B,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,OAAO,GAAE,gBAAqB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAWxB"}
@@ -196,7 +196,7 @@ export interface VisioPage {
196
196
  layers?: VisioLayer[];
197
197
  }
198
198
  export interface VisioDocument {
199
- format: 'vsdx';
199
+ format: 'vsdx' | 'vsd';
200
200
  pages: VisioPage[];
201
201
  diagnostics: VisioDiagnostic[];
202
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/visio/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,sEAAsE;AACtE,MAAM,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACpF,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WA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CAAC;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,eAAe,EAAE,CAAC;CAC/B"}
@@ -35,7 +35,7 @@ function isOoxmlCryptoError(error) {
35
35
  return code === "password-required" || code === "incorrect-password" || code === "data-integrity";
36
36
  }
37
37
 
38
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
38
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
39
39
  var OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
40
40
  var ENDOFCHAIN = 4294967294;
41
41
  var FREESECT = 4294967295;
@@ -53,10 +53,13 @@ var Ole2ParseError = class extends Error {
53
53
  }
54
54
  };
55
55
 
56
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
56
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
57
57
  function parseOle2(buffer) {
58
58
  const data = new Uint8Array(buffer);
59
59
  const view = new DataView(buffer);
60
+ if (data.length < 512) {
61
+ throw new Ole2ParseError("Truncated OLE2 compound file header");
62
+ }
60
63
  for (let i = 0; i < OLE_MAGIC.length; i++) {
61
64
  if (data[i] !== OLE_MAGIC[i]) {
62
65
  throw new Ole2ParseError("Not a valid OLE2 compound file");
@@ -70,8 +73,15 @@ function parseOle2(buffer) {
70
73
  }
71
74
  const sectorSizePower = view.getUint16(30, true);
72
75
  const miniSectorSizePower = view.getUint16(32, true);
76
+ if (majorVersion !== 3 && majorVersion !== 4 || sectorSizePower !== (majorVersion === 3 ? 9 : 12) || miniSectorSizePower !== 6) {
77
+ throw new Ole2ParseError("Unsupported OLE2 version or sector size");
78
+ }
73
79
  const sectorSize = 1 << sectorSizePower;
74
80
  const miniSectorSize = 1 << miniSectorSizePower;
81
+ if (data.length < sectorSize || data.length % sectorSize !== 0) {
82
+ throw new Ole2ParseError("Truncated OLE2 sector");
83
+ }
84
+ const sectorCount = data.length / sectorSize - 1;
75
85
  const totalFATSectors = view.getUint32(44, true);
76
86
  const firstDirectorySector = view.getUint32(48, true);
77
87
  const miniStreamCutoff = view.getUint32(56, true);
@@ -79,6 +89,9 @@ function parseOle2(buffer) {
79
89
  const totalMiniFATSectors = view.getUint32(64, true);
80
90
  const firstDIFATSector = view.getUint32(68, true);
81
91
  const totalDIFATSectors = view.getUint32(72, true);
92
+ if (totalFATSectors > sectorCount || totalMiniFATSectors > sectorCount || totalDIFATSectors > sectorCount) {
93
+ throw new Ole2ParseError("Allocation table count exceeds file size");
94
+ }
82
95
  function sectorOffset(sector) {
83
96
  return (sector + 1) * sectorSize;
84
97
  }
@@ -97,7 +110,11 @@ function parseOle2(buffer) {
97
110
  }
98
111
  }
99
112
  let difatSector = firstDIFATSector;
113
+ const difatSeen = /* @__PURE__ */ new Set();
100
114
  for (let d = 0; d < totalDIFATSectors && difatSector <= MAXREGSECT; d++) {
115
+ if (difatSeen.has(difatSector))
116
+ throw new Ole2ParseError("Circular DIFAT chain");
117
+ difatSeen.add(difatSector);
101
118
  const difatData = readSector(difatSector);
102
119
  const difatView = new DataView(difatData.buffer, difatData.byteOffset, difatData.byteLength);
103
120
  const entriesPerSector = (sectorSize - 4) / 4;
@@ -109,11 +126,14 @@ function parseOle2(buffer) {
109
126
  }
110
127
  difatSector = difatView.getUint32(sectorSize - 4, true);
111
128
  }
129
+ if (difatSeen.size !== totalDIFATSectors || fatSectors.length !== totalFATSectors || new Set(fatSectors).size !== fatSectors.length || fatSectors.some((id) => difatSeen.has(id))) {
130
+ throw new Ole2ParseError("Invalid DIFAT allocation table");
131
+ }
112
132
  const fatEntries = [];
113
133
  for (const fatSector of fatSectors) {
114
134
  const fatData = readSector(fatSector);
115
135
  const fatView = new DataView(fatData.buffer, fatData.byteOffset, fatData.byteLength);
116
- for (let i = 0; i < sectorSize / 4; i++) {
136
+ for (let i = 0; i < sectorSize / 4 && fatEntries.length < sectorCount; i++) {
117
137
  fatEntries.push(fatView.getUint32(i * 4, true));
118
138
  }
119
139
  }
@@ -127,8 +147,12 @@ function parseOle2(buffer) {
127
147
  }
128
148
  visited.add(current);
129
149
  sectors.push(readSector(current));
130
- current = fatEntries[current] ?? ENDOFCHAIN;
150
+ if (fatEntries[current] === void 0)
151
+ throw new Ole2ParseError("Missing FAT chain entry");
152
+ current = fatEntries[current];
131
153
  }
154
+ if (current !== ENDOFCHAIN)
155
+ throw new Ole2ParseError("Invalid FAT chain terminator");
132
156
  const totalLength = sectors.length * sectorSize;
133
157
  const result2 = new Uint8Array(totalLength);
134
158
  let offset2 = 0;
@@ -139,16 +163,14 @@ function parseOle2(buffer) {
139
163
  return result2;
140
164
  }
141
165
  function readStream(startSector, size) {
166
+ if (size === 0)
167
+ return new Uint8Array(0);
168
+ if (size > sectorCount * sectorSize)
169
+ throw new Ole2ParseError("Stream size exceeds file size");
142
170
  const raw = readSectorChain(startSector);
143
- return raw.subarray(0, Math.min(size, raw.length));
144
- }
145
- const miniFatEntries = [];
146
- if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
147
- const miniFatRaw = readSectorChain(firstMiniFATSector);
148
- const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
149
- for (let i = 0; i < miniFatRaw.length / 4; i++) {
150
- miniFatEntries.push(miniFatView.getUint32(i * 4, true));
151
- }
171
+ if (raw.length < size)
172
+ throw new Ole2ParseError("Truncated stream sector chain");
173
+ return raw.subarray(0, size);
152
174
  }
153
175
  const dirRaw = readSectorChain(firstDirectorySector);
154
176
  const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
@@ -161,6 +183,9 @@ function parseOle2(buffer) {
161
183
  if (objectType === ENTRY_TYPE_EMPTY) {
162
184
  continue;
163
185
  }
186
+ if (nameLen < 2 || nameLen > 64 || nameLen % 2 !== 0 || entryView.getUint16(nameLen - 2, true) !== 0) {
187
+ throw new Ole2ParseError("Invalid directory entry name");
188
+ }
164
189
  const nameBytes = Math.max(0, nameLen - 2);
165
190
  let name = "";
166
191
  for (let j = 0; j < nameBytes; j += 2) {
@@ -174,8 +199,11 @@ function parseOle2(buffer) {
174
199
  const sizeLow = entryView.getUint32(120, true);
175
200
  let size = sizeLow;
176
201
  if (majorVersion === 4) {
177
- entryView.getUint32(124, true);
178
- size = sizeLow;
202
+ const sizeHigh = entryView.getUint32(124, true);
203
+ size = sizeLow + sizeHigh * 4294967296;
204
+ if (!Number.isSafeInteger(size) || size > sectorCount * sectorSize) {
205
+ throw new Ole2ParseError("Stream size exceeds supported file bounds");
206
+ }
179
207
  }
180
208
  entries.push({
181
209
  name,
@@ -189,11 +217,28 @@ function parseOle2(buffer) {
189
217
  });
190
218
  }
191
219
  const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
220
+ if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
221
+ throw new Ole2ParseError("Invalid root directory entry");
222
+ }
192
223
  let miniStreamData;
193
224
  if (rootEntry && rootEntry.startSector <= MAXREGSECT) {
194
- miniStreamData = readSectorChain(rootEntry.startSector);
225
+ miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
226
+ }
227
+ const miniFatEntries = [];
228
+ if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
229
+ const miniFatRaw = readSectorChain(firstMiniFATSector);
230
+ if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
231
+ throw new Ole2ParseError("Unexpected mini FAT chain length");
232
+ }
233
+ const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
234
+ const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
235
+ for (let i = 0; i < miniFatRaw.length / 4 && i < miniCapacity; i++) {
236
+ miniFatEntries.push(miniFatView.getUint32(i * 4, true));
237
+ }
195
238
  }
196
239
  function readMiniStream(startSector, size) {
240
+ if (size === 0)
241
+ return new Uint8Array(0);
197
242
  if (!miniStreamData) {
198
243
  throw new Ole2ParseError("Mini stream container not found");
199
244
  }
@@ -206,17 +251,24 @@ function parseOle2(buffer) {
206
251
  }
207
252
  visited.add(current);
208
253
  const offset3 = current * miniSectorSize;
254
+ if (offset3 + miniSectorSize > miniStreamData.length || miniFatEntries[current] === void 0) {
255
+ throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
256
+ }
209
257
  sectors.push(miniStreamData.subarray(offset3, offset3 + miniSectorSize));
210
- current = miniFatEntries[current] ?? ENDOFCHAIN;
258
+ current = miniFatEntries[current];
211
259
  }
260
+ if (current !== ENDOFCHAIN)
261
+ throw new Ole2ParseError("Invalid mini FAT chain terminator");
212
262
  const totalLength = sectors.length * miniSectorSize;
263
+ if (totalLength < size)
264
+ throw new Ole2ParseError("Truncated mini stream sector chain");
213
265
  const result2 = new Uint8Array(totalLength);
214
266
  let offset2 = 0;
215
267
  for (const sector of sectors) {
216
268
  result2.set(sector, offset2);
217
269
  offset2 += miniSectorSize;
218
270
  }
219
- return result2.subarray(0, Math.min(size, result2.length));
271
+ return result2.subarray(0, size);
220
272
  }
221
273
  function getStream(name) {
222
274
  const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name);
@@ -231,7 +283,7 @@ function parseOle2(buffer) {
231
283
  return { entries, getStream };
232
284
  }
233
285
 
234
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
286
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
235
287
  function getSubtle() {
236
288
  if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
237
289
  return globalThis.crypto.subtle;
@@ -1117,13 +1169,16 @@ function isEncryptedOoxmlPackage(input) {
1117
1169
  }
1118
1170
  }
1119
1171
 
1120
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
1172
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
1121
1173
  function compareDirEntryNames(a, b) {
1174
+ const ua = a.toUpperCase();
1175
+ const ub = b.toUpperCase();
1176
+ if (ua.length !== a.length || ub.length !== b.length) {
1177
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
1178
+ }
1122
1179
  if (a.length !== b.length) {
1123
1180
  return a.length - b.length;
1124
1181
  }
1125
- const ua = a.toUpperCase();
1126
- const ub = b.toUpperCase();
1127
1182
  for (let i = 0; i < ua.length; i++) {
1128
1183
  const diff = ua.charCodeAt(i) - ub.charCodeAt(i);
1129
1184
  if (diff !== 0) {
@@ -1140,6 +1195,24 @@ function encodeName(name) {
1140
1195
  }
1141
1196
  return bytes;
1142
1197
  }
1198
+ function buildDirectoryTree(entryCount) {
1199
+ const links = /* @__PURE__ */ new Map();
1200
+ let redLevel = 0;
1201
+ for (let remaining = entryCount - 2; remaining >= 0; remaining = Math.floor(remaining / 2) - 1)
1202
+ redLevel++;
1203
+ const build = (low, high, level) => {
1204
+ if (low > high)
1205
+ return 4294967295;
1206
+ const id = Math.floor((low + high) / 2);
1207
+ links.set(id, {
1208
+ left: build(low, id - 1, level + 1),
1209
+ right: build(id + 1, high, level + 1),
1210
+ color: level === redLevel ? 0 : 1
1211
+ });
1212
+ return id;
1213
+ };
1214
+ return { root: build(1, entryCount - 1, 0), links };
1215
+ }
1143
1216
  function writeFatChain(fat, chain2) {
1144
1217
  for (let i = 0; i < chain2.sectors.length; i++) {
1145
1218
  fat[chain2.sectors[i]] = i < chain2.sectors.length - 1 ? chain2.sectors[i + 1] : ENDOFCHAIN;
@@ -1163,7 +1236,7 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
1163
1236
  }
1164
1237
  }
1165
1238
 
1166
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
1239
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
1167
1240
  function writeHeader(outView, outBytes, params) {
1168
1241
  outBytes.set(OLE_MAGIC, 0);
1169
1242
  outView.setUint16(24, 62, true);
@@ -1221,6 +1294,7 @@ function writeDifatSectors(outView, params) {
1221
1294
  function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
1222
1295
  const dirData = new Uint8Array(numDirSectors * sectorSize);
1223
1296
  const dirView = new DataView(dirData.buffer);
1297
+ const tree = buildDirectoryTree(dirEntries.length);
1224
1298
  for (let i = 0; i < dirEntries.length; i++) {
1225
1299
  const entry = dirEntries[i];
1226
1300
  const entryOffset = i * DIR_ENTRY_SIZE;
@@ -1228,17 +1302,17 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
1228
1302
  dirData.set(nameBytes.subarray(0, Math.min(nameBytes.length, 64)), entryOffset);
1229
1303
  dirView.setUint16(entryOffset + 64, Math.min((entry.name.length + 1) * 2, 64), true);
1230
1304
  dirData[entryOffset + 66] = entry.type;
1231
- dirData[entryOffset + 67] = 1;
1305
+ dirData[entryOffset + 67] = i === 0 ? 1 : tree.links.get(i).color;
1232
1306
  if (entry.clsid) {
1233
1307
  dirData.set(entry.clsid.subarray(0, 16), entryOffset + 80);
1234
1308
  }
1235
1309
  if (i === 0) {
1236
1310
  dirView.setUint32(entryOffset + 68, 4294967295, true);
1237
1311
  dirView.setUint32(entryOffset + 72, 4294967295, true);
1238
- dirView.setUint32(entryOffset + 76, dirEntries.length > 1 ? 1 : 4294967295, true);
1312
+ dirView.setUint32(entryOffset + 76, tree.root, true);
1239
1313
  } else {
1240
- dirView.setUint32(entryOffset + 68, 4294967295, true);
1241
- dirView.setUint32(entryOffset + 72, i + 1 < dirEntries.length ? i + 1 : 4294967295, true);
1314
+ dirView.setUint32(entryOffset + 68, tree.links.get(i).left, true);
1315
+ dirView.setUint32(entryOffset + 72, tree.links.get(i).right, true);
1242
1316
  dirView.setUint32(entryOffset + 76, 4294967295, true);
1243
1317
  }
1244
1318
  dirView.setUint32(entryOffset + 116, entry.startSector, true);
@@ -1255,10 +1329,25 @@ function writeStreamSectors(outBytes, streamData, chain2, sectorSize) {
1255
1329
  }
1256
1330
  }
1257
1331
 
1258
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
1332
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
1259
1333
  function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
1260
1334
  const sectorSize = 512;
1261
1335
  const miniSectorSize = 64;
1336
+ if (rootClsid && rootClsid.length !== 16)
1337
+ throw new Error("Root CLSID must contain 16 bytes");
1338
+ const names = [...streams2.keys()].sort(compareDirEntryNames);
1339
+ for (let i = 0; i < names.length; i++) {
1340
+ const name = names[i];
1341
+ if (name.toUpperCase().length !== name.length) {
1342
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
1343
+ }
1344
+ if (!name.length || name.length > 31 || /[\x00\\/:!]/.test(name)) {
1345
+ throw new Error("CFB stream names must be 1-31 UTF-16 code units without NUL, \\, /, :, or !");
1346
+ }
1347
+ if (i > 0 && compareDirEntryNames(names[i - 1], name) === 0) {
1348
+ throw new Error("Duplicate CFB stream names");
1349
+ }
1350
+ }
1262
1351
  const regularStreams = [];
1263
1352
  const miniStreams = [];
1264
1353
  for (const [name, data] of streams2) {
@@ -1276,7 +1365,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
1276
1365
  for (let i = 0; i < numSectors; i++) {
1277
1366
  sectors.push(nextSector++);
1278
1367
  }
1279
- fatChains.set(stream.name, { start: sectors[0] ?? 0, sectors });
1368
+ fatChains.set(stream.name, { start: sectors[0] ?? ENDOFCHAIN, sectors });
1280
1369
  }
1281
1370
  let miniStreamContainer = new Uint8Array(0);
1282
1371
  const miniFatChains = /* @__PURE__ */ new Map();
@@ -1299,7 +1388,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
1299
1388
  miniOffset += miniSectorSize;
1300
1389
  }
1301
1390
  miniFatChains.set(stream.name, {
1302
- start: miniSectors[0] ?? 0,
1391
+ start: miniSectors[0] ?? ENDOFCHAIN,
1303
1392
  sectors: miniSectors
1304
1393
  });
1305
1394
  }
@@ -1347,7 +1436,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
1347
1436
  nextSector += numDirSectors;
1348
1437
  let firstMiniFATSector = ENDOFCHAIN;
1349
1438
  let numMiniFATSectors = 0;
1350
- if (miniStreams.length > 0) {
1439
+ if (nextMiniSector > 0) {
1351
1440
  numMiniFATSectors = Math.ceil(nextMiniSector * 4 / sectorSize);
1352
1441
  firstMiniFATSector = nextSector;
1353
1442
  nextSector += numMiniFATSectors;
@@ -17115,7 +17204,7 @@ var xlsbUnsupported = () => new UnsupportedWorkbookError(
17115
17204
  "Excel Binary Workbook (.xlsb) files are not supported; save as .xlsx in Excel."
17116
17205
  );
17117
17206
 
17118
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
17207
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-stream-edit.js
17119
17208
  var END = 4294967294;
17120
17209
  var MAX = 4294967290;
17121
17210
  var NIL = 4294967295;
@@ -17198,7 +17287,7 @@ function processCompoundFileStream(input, path, replacement) {
17198
17287
  const fat = [];
17199
17288
  for (const id of fatIds) {
17200
17289
  const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17201
- for (let j = 0; j < sectorSize / 4; j++)
17290
+ for (let j = 0; j < sectorSize / 4 && fat.length < sectorCount; j++)
17202
17291
  fat.push(dv.getUint32(j * 4, true));
17203
17292
  }
17204
17293
  const exactChain = (table, start, bytes, unit) => chain(table, start, Math.ceil(bytes / unit));
@@ -17295,9 +17384,10 @@ function processCompoundFileStream(input, path, replacement) {
17295
17384
  if (new Set(metadataSectors).size !== metadataSectors.length)
17296
17385
  return reject();
17297
17386
  const miniFat = [];
17387
+ const miniCapacity = Math.floor(Math.min(root.size, sectorCount * sectorSize) / miniSize);
17298
17388
  for (const id of miniFatSectors) {
17299
17389
  const bytes = sector(id), dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
17300
- for (let j = 0; j < sectorSize / 4; j++)
17390
+ for (let j = 0; j < sectorSize / 4 && miniFat.length < miniCapacity; j++)
17301
17391
  miniFat.push(dv.getUint32(j * 4, true));
17302
17392
  }
17303
17393
  const reserved = /* @__PURE__ */ new Set([...fatIds, ...difatIds, ...dirSectors, ...miniFatSectors]);
@@ -17321,7 +17411,7 @@ function processCompoundFileStream(input, path, replacement) {
17321
17411
  continue;
17322
17412
  const ids = exactChain(miniFat, entry.start, entry.size, miniSize);
17323
17413
  for (const id of ids) {
17324
- if (id * miniSize >= rootMini.size || miniUsed.has(id))
17414
+ if ((id + 1) * miniSize > rootMini.size || miniUsed.has(id))
17325
17415
  return reject();
17326
17416
  miniUsed.add(id);
17327
17417
  }
@@ -17346,6 +17436,8 @@ function processCompoundFileStream(input, path, replacement) {
17346
17436
  });
17347
17437
  return result2.slice(0, target.size);
17348
17438
  }
17439
+ if (replacement.length === 0)
17440
+ return input.slice();
17349
17441
  const output = input.slice();
17350
17442
  if (target.size >= miniCutoff) {
17351
17443
  const sectors = exactChain(fat, target.start, target.size, sectorSize);
@@ -17385,7 +17477,7 @@ function replaceCompoundFileStream(input, path, replacement) {
17385
17477
  return processCompoundFileStream(input, path, replacement) ?? input;
17386
17478
  }
17387
17479
 
17388
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
17480
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-cfb.js
17389
17481
  var WORKBOOK_STREAM_NAMES = ["workbook", "book"];
17390
17482
  function unwrapXlsBytes(bytes) {
17391
17483
  if (!isCfb(bytes)) {
@@ -17452,7 +17544,7 @@ function isCfb(bytes) {
17452
17544
  return OLE_MAGIC.every((value, index2) => bytes[index2] === value);
17453
17545
  }
17454
17546
 
17455
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
17547
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-functions.js
17456
17548
  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`;
17457
17549
  var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
17458
17550
  const [id, name, argc] = entry.split(" ");
@@ -17460,7 +17552,7 @@ var XLS_FUNCTIONS = new Map(TABLE.split("|").map((entry) => {
17460
17552
  }));
17461
17553
  var XLS_USER_FUNCTION_ID = 255;
17462
17554
 
17463
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
17555
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg-text.js
17464
17556
  var BIFF_ERRORS = {
17465
17557
  0: "#NULL!",
17466
17558
  7: "#DIV/0!",
@@ -17555,7 +17647,7 @@ function readArrayConstant(extra) {
17555
17647
  return `{${lines.join(";")}}`;
17556
17648
  }
17557
17649
 
17558
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
17650
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-records.js
17559
17651
  var RT_CONTINUE = 60;
17560
17652
  function readXlsRecords(bytes, start = 0, end = bytes.length) {
17561
17653
  const records = [];
@@ -17721,7 +17813,7 @@ function joinedData(record) {
17721
17813
  return out;
17722
17814
  }
17723
17815
 
17724
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
17816
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-ptg.js
17725
17817
  function decodeFormula(rgce, extra, context, options) {
17726
17818
  try {
17727
17819
  return decode(rgce, new ByteReader(extra), context, options);
@@ -17952,7 +18044,7 @@ function readAttr(reader, stack2, whitespace) {
17952
18044
  }
17953
18045
  }
17954
18046
 
17955
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
18047
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sst.js
17956
18048
  function parseSharedStrings2(record) {
17957
18049
  const reader = SegmentReader.of(record);
17958
18050
  reader.u32();
@@ -17969,7 +18061,7 @@ function parseSharedStrings2(record) {
17969
18061
  return strings;
17970
18062
  }
17971
18063
 
17972
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
18064
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-styles.js
17973
18065
  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(" ");
17974
18066
  var XLS_BUILTIN_FORMATS = {
17975
18067
  0: "General",
@@ -18226,7 +18318,7 @@ function applyXfExt(data, xfs, palette) {
18226
18318
  }
18227
18319
  }
18228
18320
 
18229
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
18321
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-types.js
18230
18322
  var XlsReadError = class extends Error {
18231
18323
  code;
18232
18324
  constructor(code, message) {
@@ -18236,7 +18328,7 @@ var XlsReadError = class extends Error {
18236
18328
  }
18237
18329
  };
18238
18330
 
18239
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
18331
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-globals.js
18240
18332
  var RT = {
18241
18333
  BOF: 2057,
18242
18334
  EOF: 10,
@@ -18474,7 +18566,7 @@ function parseGlobals(records) {
18474
18566
  return out;
18475
18567
  }
18476
18568
 
18477
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
18569
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-biff8.js
18478
18570
  function decodeRk(rk) {
18479
18571
  const isInt = (rk & 2) !== 0;
18480
18572
  const isDiv100 = (rk & 1) !== 0;
@@ -18491,7 +18583,7 @@ function decodeRk(rk) {
18491
18583
  return isDiv100 ? value / 100 : value;
18492
18584
  }
18493
18585
 
18494
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
18586
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-formulas.js
18495
18587
  function readRefU(r) {
18496
18588
  return { firstRow: r.u16(), lastRow: r.u16(), firstCol: r.u8(), lastCol: r.u8() };
18497
18589
  }
@@ -18549,7 +18641,7 @@ function resolveFormulas(formulas, shared, arrays, globals) {
18549
18641
  }
18550
18642
  }
18551
18643
 
18552
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
18644
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet-extras.js
18553
18645
  function parseMergedCells(data) {
18554
18646
  const r = new ByteReader(data);
18555
18647
  const count2 = r.u16();
@@ -18744,7 +18836,7 @@ function parseNote(data) {
18744
18836
  return { row, col, visible: (flags & 2) !== 0, id, author: r.xlString() };
18745
18837
  }
18746
18838
 
18747
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
18839
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook-sheet.js
18748
18840
  var UNSUPPORTED = {
18749
18841
  432: "conditional formatting",
18750
18842
  2169: "conditional formatting",
@@ -19000,7 +19092,7 @@ function parseSheet(bound, records, start, globals) {
19000
19092
  return sheet;
19001
19093
  }
19002
19094
 
19003
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
19095
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-excel-workbook.js
19004
19096
  function compoundStreamNames(bytes) {
19005
19097
  if (!OLE_MAGIC.every((value, index2) => bytes[index2] === value))
19006
19098
  return [];
@@ -19070,7 +19162,7 @@ function readXlsWorkbook(bytes) {
19070
19162
  };
19071
19163
  }
19072
19164
 
19073
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
19165
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole-document-doc-cp1252.js
19074
19166
  var CP1252_HIGH_BLOCK = [
19075
19167
  8364,
19076
19168
  129,
@@ -19120,7 +19212,7 @@ function decodeCp1252(bytes) {
19120
19212
  return out;
19121
19213
  }
19122
19214
 
19123
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole-summary-properties.js
19215
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole-summary-properties.js
19124
19216
  var SUMMARY_STREAM_NAME = "SummaryInformation";
19125
19217
  var SUMMARY_TEXT_PROPERTIES = {
19126
19218
  title: 2,
@@ -19235,7 +19327,7 @@ function readSummaryProperties(bytes) {
19235
19327
  return result2;
19236
19328
  }
19237
19329
 
19238
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-office-metadata.js
19330
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-office-metadata.js
19239
19331
  function summaryStream(bytes) {
19240
19332
  return readCompoundFileStream(bytes, [SUMMARY_STREAM_NAME]);
19241
19333
  }