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.
@@ -13641,10 +13641,10 @@ var init_ole_utils = __esm({
13641
13641
  }
13642
13642
  });
13643
13643
 
13644
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
13644
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
13645
13645
  var OLE_MAGIC, ENDOFCHAIN, FREESECT, FATSECT, DIFSECT, MAXREGSECT, ENTRY_TYPE_EMPTY, ENTRY_TYPE_STREAM, ENTRY_TYPE_ROOT, DIR_ENTRY_SIZE, Ole2ParseError;
13646
13646
  var init_ole2_parser_types = __esm({
13647
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
13647
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
13648
13648
  OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
13649
13649
  ENDOFCHAIN = 4294967294;
13650
13650
  FREESECT = 4294967295;
@@ -13664,10 +13664,13 @@ var init_ole2_parser_types = __esm({
13664
13664
  }
13665
13665
  });
13666
13666
 
13667
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
13667
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
13668
13668
  function parseOle2(buffer) {
13669
13669
  const data = new Uint8Array(buffer);
13670
13670
  const view = new DataView(buffer);
13671
+ if (data.length < 512) {
13672
+ throw new Ole2ParseError("Truncated OLE2 compound file header");
13673
+ }
13671
13674
  for (let i = 0; i < OLE_MAGIC.length; i++) {
13672
13675
  if (data[i] !== OLE_MAGIC[i]) {
13673
13676
  throw new Ole2ParseError("Not a valid OLE2 compound file");
@@ -13681,8 +13684,15 @@ function parseOle2(buffer) {
13681
13684
  }
13682
13685
  const sectorSizePower = view.getUint16(30, true);
13683
13686
  const miniSectorSizePower = view.getUint16(32, true);
13687
+ if (majorVersion !== 3 && majorVersion !== 4 || sectorSizePower !== (majorVersion === 3 ? 9 : 12) || miniSectorSizePower !== 6) {
13688
+ throw new Ole2ParseError("Unsupported OLE2 version or sector size");
13689
+ }
13684
13690
  const sectorSize = 1 << sectorSizePower;
13685
13691
  const miniSectorSize = 1 << miniSectorSizePower;
13692
+ if (data.length < sectorSize || data.length % sectorSize !== 0) {
13693
+ throw new Ole2ParseError("Truncated OLE2 sector");
13694
+ }
13695
+ const sectorCount = data.length / sectorSize - 1;
13686
13696
  const totalFATSectors = view.getUint32(44, true);
13687
13697
  const firstDirectorySector = view.getUint32(48, true);
13688
13698
  const miniStreamCutoff = view.getUint32(56, true);
@@ -13690,6 +13700,9 @@ function parseOle2(buffer) {
13690
13700
  const totalMiniFATSectors = view.getUint32(64, true);
13691
13701
  const firstDIFATSector = view.getUint32(68, true);
13692
13702
  const totalDIFATSectors = view.getUint32(72, true);
13703
+ if (totalFATSectors > sectorCount || totalMiniFATSectors > sectorCount || totalDIFATSectors > sectorCount) {
13704
+ throw new Ole2ParseError("Allocation table count exceeds file size");
13705
+ }
13693
13706
  function sectorOffset(sector) {
13694
13707
  return (sector + 1) * sectorSize;
13695
13708
  }
@@ -13708,7 +13721,11 @@ function parseOle2(buffer) {
13708
13721
  }
13709
13722
  }
13710
13723
  let difatSector = firstDIFATSector;
13724
+ const difatSeen = /* @__PURE__ */ new Set();
13711
13725
  for (let d = 0; d < totalDIFATSectors && difatSector <= MAXREGSECT; d++) {
13726
+ if (difatSeen.has(difatSector))
13727
+ throw new Ole2ParseError("Circular DIFAT chain");
13728
+ difatSeen.add(difatSector);
13712
13729
  const difatData = readSector(difatSector);
13713
13730
  const difatView = new DataView(difatData.buffer, difatData.byteOffset, difatData.byteLength);
13714
13731
  const entriesPerSector = (sectorSize - 4) / 4;
@@ -13720,11 +13737,14 @@ function parseOle2(buffer) {
13720
13737
  }
13721
13738
  difatSector = difatView.getUint32(sectorSize - 4, true);
13722
13739
  }
13740
+ if (difatSeen.size !== totalDIFATSectors || fatSectors.length !== totalFATSectors || new Set(fatSectors).size !== fatSectors.length || fatSectors.some((id) => difatSeen.has(id))) {
13741
+ throw new Ole2ParseError("Invalid DIFAT allocation table");
13742
+ }
13723
13743
  const fatEntries = [];
13724
13744
  for (const fatSector of fatSectors) {
13725
13745
  const fatData = readSector(fatSector);
13726
13746
  const fatView = new DataView(fatData.buffer, fatData.byteOffset, fatData.byteLength);
13727
- for (let i = 0; i < sectorSize / 4; i++) {
13747
+ for (let i = 0; i < sectorSize / 4 && fatEntries.length < sectorCount; i++) {
13728
13748
  fatEntries.push(fatView.getUint32(i * 4, true));
13729
13749
  }
13730
13750
  }
@@ -13738,8 +13758,12 @@ function parseOle2(buffer) {
13738
13758
  }
13739
13759
  visited.add(current);
13740
13760
  sectors.push(readSector(current));
13741
- current = fatEntries[current] ?? ENDOFCHAIN;
13761
+ if (fatEntries[current] === void 0)
13762
+ throw new Ole2ParseError("Missing FAT chain entry");
13763
+ current = fatEntries[current];
13742
13764
  }
13765
+ if (current !== ENDOFCHAIN)
13766
+ throw new Ole2ParseError("Invalid FAT chain terminator");
13743
13767
  const totalLength = sectors.length * sectorSize;
13744
13768
  const result = new Uint8Array(totalLength);
13745
13769
  let offset = 0;
@@ -13750,16 +13774,14 @@ function parseOle2(buffer) {
13750
13774
  return result;
13751
13775
  }
13752
13776
  function readStream(startSector, size) {
13777
+ if (size === 0)
13778
+ return new Uint8Array(0);
13779
+ if (size > sectorCount * sectorSize)
13780
+ throw new Ole2ParseError("Stream size exceeds file size");
13753
13781
  const raw = readSectorChain(startSector);
13754
- return raw.subarray(0, Math.min(size, raw.length));
13755
- }
13756
- const miniFatEntries = [];
13757
- if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
13758
- const miniFatRaw = readSectorChain(firstMiniFATSector);
13759
- const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
13760
- for (let i = 0; i < miniFatRaw.length / 4; i++) {
13761
- miniFatEntries.push(miniFatView.getUint32(i * 4, true));
13762
- }
13782
+ if (raw.length < size)
13783
+ throw new Ole2ParseError("Truncated stream sector chain");
13784
+ return raw.subarray(0, size);
13763
13785
  }
13764
13786
  const dirRaw = readSectorChain(firstDirectorySector);
13765
13787
  const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
@@ -13772,6 +13794,9 @@ function parseOle2(buffer) {
13772
13794
  if (objectType === ENTRY_TYPE_EMPTY) {
13773
13795
  continue;
13774
13796
  }
13797
+ if (nameLen < 2 || nameLen > 64 || nameLen % 2 !== 0 || entryView.getUint16(nameLen - 2, true) !== 0) {
13798
+ throw new Ole2ParseError("Invalid directory entry name");
13799
+ }
13775
13800
  const nameBytes = Math.max(0, nameLen - 2);
13776
13801
  let name = "";
13777
13802
  for (let j = 0; j < nameBytes; j += 2) {
@@ -13785,8 +13810,11 @@ function parseOle2(buffer) {
13785
13810
  const sizeLow = entryView.getUint32(120, true);
13786
13811
  let size = sizeLow;
13787
13812
  if (majorVersion === 4) {
13788
- entryView.getUint32(124, true);
13789
- size = sizeLow;
13813
+ const sizeHigh = entryView.getUint32(124, true);
13814
+ size = sizeLow + sizeHigh * 4294967296;
13815
+ if (!Number.isSafeInteger(size) || size > sectorCount * sectorSize) {
13816
+ throw new Ole2ParseError("Stream size exceeds supported file bounds");
13817
+ }
13790
13818
  }
13791
13819
  entries.push({
13792
13820
  name,
@@ -13800,11 +13828,28 @@ function parseOle2(buffer) {
13800
13828
  });
13801
13829
  }
13802
13830
  const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
13831
+ if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
13832
+ throw new Ole2ParseError("Invalid root directory entry");
13833
+ }
13803
13834
  let miniStreamData;
13804
13835
  if (rootEntry && rootEntry.startSector <= MAXREGSECT) {
13805
- miniStreamData = readSectorChain(rootEntry.startSector);
13836
+ miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
13837
+ }
13838
+ const miniFatEntries = [];
13839
+ if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
13840
+ const miniFatRaw = readSectorChain(firstMiniFATSector);
13841
+ if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
13842
+ throw new Ole2ParseError("Unexpected mini FAT chain length");
13843
+ }
13844
+ const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
13845
+ const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
13846
+ for (let i = 0; i < miniFatRaw.length / 4 && i < miniCapacity; i++) {
13847
+ miniFatEntries.push(miniFatView.getUint32(i * 4, true));
13848
+ }
13806
13849
  }
13807
13850
  function readMiniStream(startSector, size) {
13851
+ if (size === 0)
13852
+ return new Uint8Array(0);
13808
13853
  if (!miniStreamData) {
13809
13854
  throw new Ole2ParseError("Mini stream container not found");
13810
13855
  }
@@ -13817,17 +13862,24 @@ function parseOle2(buffer) {
13817
13862
  }
13818
13863
  visited.add(current);
13819
13864
  const offset2 = current * miniSectorSize;
13865
+ if (offset2 + miniSectorSize > miniStreamData.length || miniFatEntries[current] === void 0) {
13866
+ throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
13867
+ }
13820
13868
  sectors.push(miniStreamData.subarray(offset2, offset2 + miniSectorSize));
13821
- current = miniFatEntries[current] ?? ENDOFCHAIN;
13869
+ current = miniFatEntries[current];
13822
13870
  }
13871
+ if (current !== ENDOFCHAIN)
13872
+ throw new Ole2ParseError("Invalid mini FAT chain terminator");
13823
13873
  const totalLength = sectors.length * miniSectorSize;
13874
+ if (totalLength < size)
13875
+ throw new Ole2ParseError("Truncated mini stream sector chain");
13824
13876
  const result = new Uint8Array(totalLength);
13825
13877
  let offset = 0;
13826
13878
  for (const sector of sectors) {
13827
13879
  result.set(sector, offset);
13828
13880
  offset += miniSectorSize;
13829
13881
  }
13830
- return result.subarray(0, Math.min(size, result.length));
13882
+ return result.subarray(0, size);
13831
13883
  }
13832
13884
  function getStream(name) {
13833
13885
  const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name);
@@ -13842,7 +13894,7 @@ function parseOle2(buffer) {
13842
13894
  return { entries, getStream };
13843
13895
  }
13844
13896
  var init_ole2_parser_read = __esm({
13845
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
13897
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
13846
13898
  init_ole2_parser_types();
13847
13899
  }
13848
13900
  });
@@ -13982,13 +14034,16 @@ var init_ole_embedded_extract = __esm({
13982
14034
  }
13983
14035
  });
13984
14036
 
13985
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
14037
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
13986
14038
  function compareDirEntryNames(a, b) {
14039
+ const ua = a.toUpperCase();
14040
+ const ub = b.toUpperCase();
14041
+ if (ua.length !== a.length || ub.length !== b.length) {
14042
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
14043
+ }
13987
14044
  if (a.length !== b.length) {
13988
14045
  return a.length - b.length;
13989
14046
  }
13990
- const ua = a.toUpperCase();
13991
- const ub = b.toUpperCase();
13992
14047
  for (let i = 0; i < ua.length; i++) {
13993
14048
  const diff = ua.charCodeAt(i) - ub.charCodeAt(i);
13994
14049
  if (diff !== 0) {
@@ -14005,6 +14060,24 @@ function encodeName(name) {
14005
14060
  }
14006
14061
  return bytes;
14007
14062
  }
14063
+ function buildDirectoryTree(entryCount) {
14064
+ const links = /* @__PURE__ */ new Map();
14065
+ let redLevel = 0;
14066
+ for (let remaining = entryCount - 2; remaining >= 0; remaining = Math.floor(remaining / 2) - 1)
14067
+ redLevel++;
14068
+ const build = (low, high, level2) => {
14069
+ if (low > high)
14070
+ return 4294967295;
14071
+ const id = Math.floor((low + high) / 2);
14072
+ links.set(id, {
14073
+ left: build(low, id - 1, level2 + 1),
14074
+ right: build(id + 1, high, level2 + 1),
14075
+ color: level2 === redLevel ? 0 : 1
14076
+ });
14077
+ return id;
14078
+ };
14079
+ return { root: build(1, entryCount - 1, 0), links };
14080
+ }
14008
14081
  function writeFatChain(fat, chain) {
14009
14082
  for (let i = 0; i < chain.sectors.length; i++) {
14010
14083
  fat[chain.sectors[i]] = i < chain.sectors.length - 1 ? chain.sectors[i + 1] : ENDOFCHAIN;
@@ -14028,12 +14101,12 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
14028
14101
  }
14029
14102
  }
14030
14103
  var init_ole2_parser_write_helpers = __esm({
14031
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
14104
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
14032
14105
  init_ole2_parser_types();
14033
14106
  }
14034
14107
  });
14035
14108
 
14036
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
14109
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
14037
14110
  function writeHeader(outView, outBytes, params) {
14038
14111
  outBytes.set(OLE_MAGIC, 0);
14039
14112
  outView.setUint16(24, 62, true);
@@ -14090,6 +14163,7 @@ function writeDifatSectors(outView, params) {
14090
14163
  function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
14091
14164
  const dirData = new Uint8Array(numDirSectors * sectorSize);
14092
14165
  const dirView = new DataView(dirData.buffer);
14166
+ const tree = buildDirectoryTree(dirEntries.length);
14093
14167
  for (let i = 0; i < dirEntries.length; i++) {
14094
14168
  const entry = dirEntries[i];
14095
14169
  const entryOffset = i * DIR_ENTRY_SIZE;
@@ -14097,17 +14171,17 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
14097
14171
  dirData.set(nameBytes.subarray(0, Math.min(nameBytes.length, 64)), entryOffset);
14098
14172
  dirView.setUint16(entryOffset + 64, Math.min((entry.name.length + 1) * 2, 64), true);
14099
14173
  dirData[entryOffset + 66] = entry.type;
14100
- dirData[entryOffset + 67] = 1;
14174
+ dirData[entryOffset + 67] = i === 0 ? 1 : tree.links.get(i).color;
14101
14175
  if (entry.clsid) {
14102
14176
  dirData.set(entry.clsid.subarray(0, 16), entryOffset + 80);
14103
14177
  }
14104
14178
  if (i === 0) {
14105
14179
  dirView.setUint32(entryOffset + 68, 4294967295, true);
14106
14180
  dirView.setUint32(entryOffset + 72, 4294967295, true);
14107
- dirView.setUint32(entryOffset + 76, dirEntries.length > 1 ? 1 : 4294967295, true);
14181
+ dirView.setUint32(entryOffset + 76, tree.root, true);
14108
14182
  } else {
14109
- dirView.setUint32(entryOffset + 68, 4294967295, true);
14110
- dirView.setUint32(entryOffset + 72, i + 1 < dirEntries.length ? i + 1 : 4294967295, true);
14183
+ dirView.setUint32(entryOffset + 68, tree.links.get(i).left, true);
14184
+ dirView.setUint32(entryOffset + 72, tree.links.get(i).right, true);
14111
14185
  dirView.setUint32(entryOffset + 76, 4294967295, true);
14112
14186
  }
14113
14187
  dirView.setUint32(entryOffset + 116, entry.startSector, true);
@@ -14125,17 +14199,32 @@ function writeStreamSectors(outBytes, streamData, chain, sectorSize) {
14125
14199
  }
14126
14200
  var HEADER_DIFAT_ENTRIES;
14127
14201
  var init_ole2_parser_write_serialize = __esm({
14128
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
14202
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
14129
14203
  init_ole2_parser_types();
14130
14204
  init_ole2_parser_write_helpers();
14131
14205
  HEADER_DIFAT_ENTRIES = 109;
14132
14206
  }
14133
14207
  });
14134
14208
 
14135
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
14209
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
14136
14210
  function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14137
14211
  const sectorSize = 512;
14138
14212
  const miniSectorSize = 64;
14213
+ if (rootClsid && rootClsid.length !== 16)
14214
+ throw new Error("Root CLSID must contain 16 bytes");
14215
+ const names = [...streams2.keys()].sort(compareDirEntryNames);
14216
+ for (let i = 0; i < names.length; i++) {
14217
+ const name = names[i];
14218
+ if (name.toUpperCase().length !== name.length) {
14219
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
14220
+ }
14221
+ if (!name.length || name.length > 31 || /[\x00\\/:!]/.test(name)) {
14222
+ throw new Error("CFB stream names must be 1-31 UTF-16 code units without NUL, \\, /, :, or !");
14223
+ }
14224
+ if (i > 0 && compareDirEntryNames(names[i - 1], name) === 0) {
14225
+ throw new Error("Duplicate CFB stream names");
14226
+ }
14227
+ }
14139
14228
  const regularStreams = [];
14140
14229
  const miniStreams = [];
14141
14230
  for (const [name, data] of streams2) {
@@ -14153,7 +14242,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14153
14242
  for (let i = 0; i < numSectors; i++) {
14154
14243
  sectors.push(nextSector++);
14155
14244
  }
14156
- fatChains.set(stream.name, { start: sectors[0] ?? 0, sectors });
14245
+ fatChains.set(stream.name, { start: sectors[0] ?? ENDOFCHAIN, sectors });
14157
14246
  }
14158
14247
  let miniStreamContainer = new Uint8Array(0);
14159
14248
  const miniFatChains = /* @__PURE__ */ new Map();
@@ -14176,7 +14265,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14176
14265
  miniOffset += miniSectorSize;
14177
14266
  }
14178
14267
  miniFatChains.set(stream.name, {
14179
- start: miniSectors[0] ?? 0,
14268
+ start: miniSectors[0] ?? ENDOFCHAIN,
14180
14269
  sectors: miniSectors
14181
14270
  });
14182
14271
  }
@@ -14224,7 +14313,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14224
14313
  nextSector += numDirSectors;
14225
14314
  let firstMiniFATSector = ENDOFCHAIN;
14226
14315
  let numMiniFATSectors = 0;
14227
- if (miniStreams.length > 0) {
14316
+ if (nextMiniSector > 0) {
14228
14317
  numMiniFATSectors = Math.ceil(nextMiniSector * 4 / sectorSize);
14229
14318
  firstMiniFATSector = nextSector;
14230
14319
  nextSector += numMiniFATSectors;
@@ -14298,7 +14387,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14298
14387
  return output;
14299
14388
  }
14300
14389
  var init_ole2_parser_write = __esm({
14301
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
14390
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
14302
14391
  init_ole2_parser_types();
14303
14392
  init_ole2_parser_write_helpers();
14304
14393
  init_ole2_parser_write_serialize();
@@ -14760,7 +14849,7 @@ var init_xml_whitespace = __esm({
14760
14849
  }
14761
14850
  });
14762
14851
 
14763
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
14852
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
14764
14853
  function adler32(bytes) {
14765
14854
  let a = 1;
14766
14855
  let b = 0;
@@ -14809,7 +14898,7 @@ function zlibStore(data) {
14809
14898
  return concatBytes([zlibHeader, ...blocks, adlerBytes]);
14810
14899
  }
14811
14900
  var init_png_encoder = __esm({
14812
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
14901
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
14813
14902
  (() => {
14814
14903
  const table = new Uint32Array(256);
14815
14904
  for (let n = 0; n < 256; n++) {
@@ -33343,7 +33432,7 @@ var init_encryption_detection = __esm({
33343
33432
  }
33344
33433
  });
33345
33434
 
33346
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
33435
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
33347
33436
  function getSubtle() {
33348
33437
  if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
33349
33438
  return globalThis.crypto.subtle;
@@ -33461,7 +33550,7 @@ async function hmac(algorithm, key2, data) {
33461
33550
  return new Uint8Array(result);
33462
33551
  }
33463
33552
  var init_ooxml_crypto_primitives = __esm({
33464
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
33553
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
33465
33554
  }
33466
33555
  });
33467
33556
 
@@ -34659,7 +34748,7 @@ var init_ole2_parser = __esm({
34659
34748
  }
34660
34749
  });
34661
34750
 
34662
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
34751
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
34663
34752
  function rotl32(x, n) {
34664
34753
  return (x << n | x >>> 32 - n) >>> 0;
34665
34754
  }
@@ -34708,11 +34797,11 @@ function mdStyleDigest(message, initialState, transform2) {
34708
34797
  return out;
34709
34798
  }
34710
34799
  var init_bit_ops = __esm({
34711
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
34800
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
34712
34801
  }
34713
34802
  });
34714
34803
 
34715
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
34804
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
34716
34805
  function f1(x, y, z) {
34717
34806
  return x & y | ~x & z;
34718
34807
  }
@@ -34736,7 +34825,7 @@ function md4(message) {
34736
34825
  }
34737
34826
  var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
34738
34827
  var init_md4 = __esm({
34739
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
34828
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
34740
34829
  init_bit_ops();
34741
34830
  INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
34742
34831
  K22 = 1518500249;
@@ -90751,7 +90840,7 @@ var init_metro_blob_collect = __esm({
90751
90840
  }
90752
90841
  });
90753
90842
 
90754
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
90843
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
90755
90844
  function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
90756
90845
  const header = new Uint8Array(8);
90757
90846
  const view = new DataView(header.buffer);
@@ -90766,7 +90855,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
90766
90855
  }
90767
90856
  var ByteWriter;
90768
90857
  var init_byte_writer = __esm({
90769
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
90858
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
90770
90859
  ByteWriter = class {
90771
90860
  chunks = [];
90772
90861
  length = 0;
@@ -90849,13 +90938,13 @@ var init_byte_writer = __esm({
90849
90938
  }
90850
90939
  });
90851
90940
 
90852
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
90941
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
90853
90942
  function masterToEmu(mu) {
90854
90943
  return Math.round(mu * EMU_PER_MASTER);
90855
90944
  }
90856
90945
  var RT, OA, TEXT_TYPE, HEADER_TOKEN_PLAIN, HEADER_TOKEN_ENCRYPTED, EMU_PER_MASTER;
90857
90946
  var init_legacy_ppt_record_types = __esm({
90858
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
90947
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
90859
90948
  RT = {
90860
90949
  Document: 1e3,
90861
90950
  DocumentAtom: 1001,
@@ -90984,14 +91073,14 @@ var init_legacy_ppt_record_types = __esm({
90984
91073
  }
90985
91074
  });
90986
91075
 
90987
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
91076
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
90988
91077
  var init_record_types = __esm({
90989
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
91078
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
90990
91079
  init_legacy_ppt_record_types();
90991
91080
  }
90992
91081
  });
90993
91082
 
90994
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
91083
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
90995
91084
  function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
90996
91085
  const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
90997
91086
  const data = new ByteWriter().u32(20).u32(encrypted ? HEADER_TOKEN_ENCRYPTED : HEADER_TOKEN_PLAIN).u32(offsetToCurrentEdit).u16(nameBytes.length).u16(1012).u8(3).u8(0).bytes(new Uint8Array(2)).bytes(nameBytes).u32(8).toBytes();
@@ -91005,7 +91094,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
91005
91094
  }
91006
91095
  var USER_NAME, CURRENT_USER_STREAM_SIZE;
91007
91096
  var init_current_user_writer = __esm({
91008
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
91097
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
91009
91098
  init_record_types();
91010
91099
  init_byte_writer();
91011
91100
  USER_NAME = "pptx-viewer";
@@ -91013,7 +91102,7 @@ var init_current_user_writer = __esm({
91013
91102
  }
91014
91103
  });
91015
91104
 
91016
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
91105
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
91017
91106
  function pictureUid(picture) {
91018
91107
  return md4(picture.bytes);
91019
91108
  }
@@ -91036,7 +91125,7 @@ function buildFbse(picture, uid, foDelay, size) {
91036
91125
  }
91037
91126
  var MSOBLIP_PICT, BLIP_INFO;
91038
91127
  var init_blip_writer = __esm({
91039
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
91128
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
91040
91129
  init_md4();
91041
91130
  init_png_encoder();
91042
91131
  init_record_types();
@@ -91052,7 +91141,7 @@ var init_blip_writer = __esm({
91052
91141
  }
91053
91142
  });
91054
91143
 
91055
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
91144
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
91056
91145
  function boolPropValue(flag, bit, useBit) {
91057
91146
  return useBit | (flag ? bit : 0);
91058
91147
  }
@@ -91088,7 +91177,7 @@ function buildMetroBlobTertiaryFopt(metroBlob) {
91088
91177
  }
91089
91178
  var OPT, FBID_FLAG, METRO_BLOB_OPID;
91090
91179
  var init_fopt_writer = __esm({
91091
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
91180
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
91092
91181
  init_record_types();
91093
91182
  init_byte_writer();
91094
91183
  OPT = {
@@ -91116,7 +91205,7 @@ var init_fopt_writer = __esm({
91116
91205
  }
91117
91206
  });
91118
91207
 
91119
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
91208
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
91120
91209
  function buildDggDefaultProperties() {
91121
91210
  return buildFopt([
91122
91211
  { id: 385, value: 134217732 },
@@ -91174,7 +91263,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
91174
91263
  }
91175
91264
  var SHAPE_ID_CLUSTER_SIZE;
91176
91265
  var init_bstore_writer = __esm({
91177
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
91266
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
91178
91267
  init_record_types();
91179
91268
  init_blip_writer();
91180
91269
  init_byte_writer();
@@ -91183,7 +91272,7 @@ var init_bstore_writer = __esm({
91183
91272
  }
91184
91273
  });
91185
91274
 
91186
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
91275
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
91187
91276
  function buildFontEntityAtom(name, index) {
91188
91277
  const nameBytes = new ByteWriter().utf16(name.slice(0, 31)).u16(0).toBytes();
91189
91278
  const padded = new Uint8Array(LF_FACE_NAME_BYTES);
@@ -91211,14 +91300,14 @@ function buildEnvironment(fonts, otherTextStyle) {
91211
91300
  }
91212
91301
  var LF_FACE_NAME_BYTES;
91213
91302
  var init_font_collection_writer = __esm({
91214
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
91303
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
91215
91304
  init_record_types();
91216
91305
  init_byte_writer();
91217
91306
  LF_FACE_NAME_BYTES = 64;
91218
91307
  }
91219
91308
  });
91220
91309
 
91221
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
91310
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
91222
91311
  function emuToMaster(emu2) {
91223
91312
  return Math.round(emu2 / EMU_PER_MASTER);
91224
91313
  }
@@ -91274,7 +91363,7 @@ function buildDocumentContainer(input) {
91274
91363
  }
91275
91364
  var MASTER_SLIDE_ID_SENTINEL, RT_CSTRING, RT_BINARY_TAG_DATA_BLOB;
91276
91365
  var init_document_writer = __esm({
91277
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
91366
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
91278
91367
  init_record_types();
91279
91368
  init_byte_writer();
91280
91369
  init_font_collection_writer();
@@ -91284,7 +91373,7 @@ var init_document_writer = __esm({
91284
91373
  }
91285
91374
  });
91286
91375
 
91287
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
91376
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
91288
91377
  function buildCString(text2, recInstance) {
91289
91378
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
91290
91379
  }
@@ -91420,7 +91509,7 @@ function buildTextInteractiveInfoAtom(beginChar, endChar) {
91420
91509
  }
91421
91510
  var II_ACTION, II_JUMP, LT, FLAG_CUSTOM_SHOW_RETURN, HyperlinkCollector;
91422
91511
  var init_hyperlink_writer = __esm({
91423
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
91512
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
91424
91513
  init_record_types();
91425
91514
  init_byte_writer();
91426
91515
  II_ACTION = {
@@ -91483,7 +91572,7 @@ var init_hyperlink_writer = __esm({
91483
91572
  }
91484
91573
  });
91485
91574
 
91486
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
91575
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
91487
91576
  function buildCString2(text2, recInstance) {
91488
91577
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
91489
91578
  }
@@ -91519,7 +91608,7 @@ function buildMediaExObjEntries(media) {
91519
91608
  }
91520
91609
  var MediaCollector, SOUND_EXTENSION_WAV, SOUND_LENGTH_UNKNOWN;
91521
91610
  var init_media_writer = __esm({
91522
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
91611
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
91523
91612
  init_record_types();
91524
91613
  init_byte_writer();
91525
91614
  MediaCollector = class {
@@ -91555,7 +91644,7 @@ var init_media_writer = __esm({
91555
91644
  }
91556
91645
  });
91557
91646
 
91558
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
91647
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
91559
91648
  function hexToBytes(hex3) {
91560
91649
  const out = new Uint8Array(hex3.length / 2);
91561
91650
  for (let i = 0; i < out.length; i++) {
@@ -91617,7 +91706,7 @@ function buildExObjRefAtom(exObjId) {
91617
91706
  }
91618
91707
  var PACKAGE_ROOT_CLSID, COMP_OBJ_HEX, EX_OLE_EMBEDDED, DV_ASPECT_ICON, EX_OLE_SUB_DEFAULT, PACKAGER_MENU_NAME, OleCollector;
91619
91708
  var init_ole_writer = __esm({
91620
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
91709
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
91621
91710
  init_ole2_parser_write();
91622
91711
  init_record_types();
91623
91712
  init_byte_writer();
@@ -91677,7 +91766,7 @@ var init_ole_writer = __esm({
91677
91766
  }
91678
91767
  });
91679
91768
 
91680
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
91769
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
91681
91770
  function buildExObjList(hyperlinks, ole, media) {
91682
91771
  const oleEntries = ole?.all ?? [];
91683
91772
  const mediaEntries = media?.all ?? [];
@@ -91704,7 +91793,7 @@ function buildExObjList(hyperlinks, ole, media) {
91704
91793
  return record(RT.ExternalObjectList, w.toBytes(), 0, true);
91705
91794
  }
91706
91795
  var init_ex_obj_list_writer = __esm({
91707
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
91796
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
91708
91797
  init_record_types();
91709
91798
  init_byte_writer();
91710
91799
  init_hyperlink_writer();
@@ -91713,7 +91802,7 @@ var init_ex_obj_list_writer = __esm({
91713
91802
  }
91714
91803
  });
91715
91804
 
91716
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
91805
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
91717
91806
  function emuToMaster2(emu2) {
91718
91807
  return Math.round(emu2 / EMU_PER_MASTER);
91719
91808
  }
@@ -91758,7 +91847,7 @@ function buildChildAnchor(rect2) {
91758
91847
  }
91759
91848
  var INT16_MIN, INT16_MAX;
91760
91849
  var init_anchor_writer = __esm({
91761
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
91850
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
91762
91851
  init_record_types();
91763
91852
  init_byte_writer();
91764
91853
  INT16_MIN = -32768;
@@ -91766,7 +91855,7 @@ var init_anchor_writer = __esm({
91766
91855
  }
91767
91856
  });
91768
91857
 
91769
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
91858
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
91770
91859
  function parseHex(rgb) {
91771
91860
  const hex3 = (rgb ?? DEFAULT_RGB).replace(/^#/u, "");
91772
91861
  if (!/^[0-9a-fA-F]{6}$/u.test(hex3)) {
@@ -91788,12 +91877,12 @@ function encodeColorIndex(rgb) {
91788
91877
  }
91789
91878
  var DEFAULT_RGB;
91790
91879
  var init_colors = __esm({
91791
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
91880
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
91792
91881
  DEFAULT_RGB = "000000";
91793
91882
  }
91794
91883
  });
91795
91884
 
91796
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
91885
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
91797
91886
  function writePfException(w, para) {
91798
91887
  let mask = 0;
91799
91888
  if (para.hasBullet !== void 0) {
@@ -91883,7 +91972,7 @@ function writeCfException(w, run, fontIndex) {
91883
91972
  }
91884
91973
  var ALIGN_CODE, EMU_PER_MASTER_UNIT;
91885
91974
  var init_text_exception_writer = __esm({
91886
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
91975
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
91887
91976
  init_colors();
91888
91977
  ALIGN_CODE = {
91889
91978
  l: 0,
@@ -91895,7 +91984,7 @@ var init_text_exception_writer = __esm({
91895
91984
  }
91896
91985
  });
91897
91986
 
91898
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
91987
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
91899
91988
  function joinParagraphText(body) {
91900
91989
  return body.paragraphs.map((p) => p.runs.map((r) => r.text).join("")).join("\r");
91901
91990
  }
@@ -91956,7 +92045,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
91956
92045
  return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text2)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
91957
92046
  }
91958
92047
  var init_text_atom_writer = __esm({
91959
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
92048
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
91960
92049
  init_record_types();
91961
92050
  init_byte_writer();
91962
92051
  init_hyperlink_writer();
@@ -91964,7 +92053,7 @@ var init_text_atom_writer = __esm({
91964
92053
  }
91965
92054
  });
91966
92055
 
91967
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
92056
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
91968
92057
  function utf16z(text2) {
91969
92058
  return new ByteWriter().utf16(text2).u16(0).toBytes();
91970
92059
  }
@@ -92061,7 +92150,7 @@ function buildMasterPlaceholders(placeholders, allocator, fieldFontIndex) {
92061
92150
  }
92062
92151
  var FSP_FLAGS, RECTANGLE_SPT, TEXT_TYPE_TITLE, TEXT_TYPE_BODY, TEXT_TYPE_OTHER, SPECS, MASTER_PLACEHOLDER_ORDER, TITLE_PROMPT, BODY_PROMPT, DEFAULT_FRAMES;
92063
92152
  var init_master_placeholders_writer = __esm({
92064
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
92153
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
92065
92154
  init_record_types();
92066
92155
  init_anchor_writer();
92067
92156
  init_byte_writer();
@@ -92128,18 +92217,18 @@ var init_master_placeholders_writer = __esm({
92128
92217
  }
92129
92218
  });
92130
92219
 
92131
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
92220
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
92132
92221
  function masterStyleFonts(styles) {
92133
92222
  if (!styles)
92134
92223
  return [];
92135
92224
  return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
92136
92225
  }
92137
92226
  var init_master_style_fonts = __esm({
92138
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
92227
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
92139
92228
  }
92140
92229
  });
92141
92230
 
92142
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
92231
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
92143
92232
  function buildMasterStyleAtom(recInstance, levels, fontIndex) {
92144
92233
  const w = new ByteWriter().u16(levels.length);
92145
92234
  for (const level2 of levels) {
@@ -92170,7 +92259,7 @@ function buildMasterTextStyles(styles, fontIndex) {
92170
92259
  }
92171
92260
  var EMPTY_LEVELS, FIXED_INSTANCE_DATA;
92172
92261
  var init_master_text_styles_writer = __esm({
92173
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
92262
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
92174
92263
  init_record_types();
92175
92264
  init_byte_writer();
92176
92265
  init_text_exception_writer();
@@ -92186,7 +92275,7 @@ var init_master_text_styles_writer = __esm({
92186
92275
  }
92187
92276
  });
92188
92277
 
92189
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
92278
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
92190
92279
  function fillEntries(fill) {
92191
92280
  if (!fill || fill.kind === "none") {
92192
92281
  return [{ id: OPT.fNoFillHitTest, value: boolPropValue(false, 16, 1048576) }];
@@ -92241,7 +92330,7 @@ function buildShapeFoptProps(input) {
92241
92330
  }
92242
92331
  var DASH_CODE;
92243
92332
  var init_shape_props_writer = __esm({
92244
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
92333
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
92245
92334
  init_colors();
92246
92335
  init_fopt_writer();
92247
92336
  DASH_CODE = {
@@ -92256,7 +92345,7 @@ var init_shape_props_writer = __esm({
92256
92345
  }
92257
92346
  });
92258
92347
 
92259
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
92348
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
92260
92349
  function buildShapeAnchor(rect2, inGroup) {
92261
92350
  return inGroup ? buildChildAnchor(rect2) : buildClientAnchor(rect2);
92262
92351
  }
@@ -92358,7 +92447,7 @@ function buildMediaShapeContainer(media, allocator, hyperlinks, mediaEmbeds, inG
92358
92447
  }
92359
92448
  var FSP_FLAG_FLIPH, FSP_FLAG_FLIPV, FSP_FLAG_OLE_SHAPE, FSP_FLAG_CHILD, PLACEHOLDER_ID;
92360
92449
  var init_shape_writer = __esm({
92361
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
92450
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
92362
92451
  init_record_types();
92363
92452
  init_anchor_writer();
92364
92453
  init_byte_writer();
@@ -92380,7 +92469,7 @@ var init_shape_writer = __esm({
92380
92469
  }
92381
92470
  });
92382
92471
 
92383
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
92472
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
92384
92473
  function buildFspgr(childRect) {
92385
92474
  return record(OA.FSPGR, buildChildAnchorData(childRect), 0, false, 1);
92386
92475
  }
@@ -92421,7 +92510,7 @@ function buildGroupContainer(group, fonts, allocator, hyperlinks, oleEmbeds, med
92421
92510
  }
92422
92511
  var FSP_FLAG_GROUP, FSP_FLAG_PATRIARCH, FSP_FLAG_HAVE_ANCHOR, ZERO_RECT;
92423
92512
  var init_group_writer = __esm({
92424
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
92513
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
92425
92514
  init_record_types();
92426
92515
  init_anchor_writer();
92427
92516
  init_byte_writer();
@@ -92433,10 +92522,10 @@ var init_group_writer = __esm({
92433
92522
  }
92434
92523
  });
92435
92524
 
92436
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
92525
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
92437
92526
  var ShapeIdAllocator2;
92438
92527
  var init_shape_id_allocator = __esm({
92439
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
92528
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
92440
92529
  ShapeIdAllocator2 = class {
92441
92530
  current;
92442
92531
  constructor(drawingId, clusterSize) {
@@ -92462,7 +92551,7 @@ var init_shape_id_allocator = __esm({
92462
92551
  }
92463
92552
  });
92464
92553
 
92465
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
92554
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
92466
92555
  function buildDg(drawingId, shapeCount, lastShapeId) {
92467
92556
  const data = new ByteWriter().u32(shapeCount + 1).u32(lastShapeId).toBytes();
92468
92557
  return record(OA.Dg, data, drawingId, false, 0);
@@ -92493,7 +92582,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
92493
92582
  }
92494
92583
  var FSP_FLAG_BACKGROUND, BACKGROUND_RECT_SPT, SHAPE_ID_CLUSTER_SIZE2;
92495
92584
  var init_drawing_writer = __esm({
92496
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
92585
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
92497
92586
  init_record_types();
92498
92587
  init_byte_writer();
92499
92588
  init_colors();
@@ -92506,7 +92595,7 @@ var init_drawing_writer = __esm({
92506
92595
  }
92507
92596
  });
92508
92597
 
92509
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
92598
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
92510
92599
  function buildNotesAtom(slidePersistIdRef) {
92511
92600
  const data = new ByteWriter().i32(slidePersistIdRef).u16(0).u16(0).toBytes();
92512
92601
  return record(RT.NotesAtom, data, 0, false, 1);
@@ -92524,16 +92613,16 @@ function buildNotesContainer(paragraphs, notesRect, slidePersistIdRef, fonts, dr
92524
92613
  return record(RT.Notes, data, 0, true);
92525
92614
  }
92526
92615
  var init_notes_writer = __esm({
92527
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
92616
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
92528
92617
  init_record_types();
92529
92618
  init_byte_writer();
92530
92619
  init_drawing_writer();
92531
92620
  }
92532
92621
  });
92533
92622
 
92534
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
92623
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
92535
92624
  function readRecord(view, offset) {
92536
- if (offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
92625
+ if (!Number.isSafeInteger(offset) || offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
92537
92626
  return void 0;
92538
92627
  }
92539
92628
  const verAndInstance = view.getUint16(offset, true);
@@ -92561,6 +92650,9 @@ function isContainer(rec) {
92561
92650
  return rec.recVer === 15;
92562
92651
  }
92563
92652
  function* iterateRecords(view, start, end) {
92653
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end < start) {
92654
+ return;
92655
+ }
92564
92656
  let offset = start;
92565
92657
  const limit = Math.min(end, view.byteLength);
92566
92658
  while (offset + RECORD_HEADER_SIZE <= limit) {
@@ -92587,16 +92679,19 @@ function findChild4(view, container2, recType, recInstance) {
92587
92679
  return void 0;
92588
92680
  }
92589
92681
  function findDescendant(view, container2, recType, recInstance) {
92590
- for (const child27 of iterateChildren(view, container2)) {
92682
+ const stack = [iterateChildren(view, container2)];
92683
+ while (stack.length > 0) {
92684
+ const next = stack[stack.length - 1].next();
92685
+ if (next.done) {
92686
+ stack.pop();
92687
+ continue;
92688
+ }
92689
+ const child27 = next.value;
92591
92690
  if (child27.recType === recType && (recInstance === void 0)) {
92592
92691
  return child27;
92593
92692
  }
92594
- if (isContainer(child27)) {
92595
- const found = findDescendant(view, child27, recType, recInstance);
92596
- if (found) {
92597
- return found;
92598
- }
92599
- }
92693
+ if (isContainer(child27))
92694
+ stack.push(iterateChildren(view, child27));
92600
92695
  }
92601
92696
  return void 0;
92602
92697
  }
@@ -92605,7 +92700,7 @@ function recordBytes(data, rec) {
92605
92700
  }
92606
92701
  var PptParseError, RECORD_HEADER_SIZE;
92607
92702
  var init_legacy_ppt_record_stream = __esm({
92608
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
92703
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
92609
92704
  PptParseError = class extends Error {
92610
92705
  constructor(message) {
92611
92706
  super(message);
@@ -92616,14 +92711,14 @@ var init_legacy_ppt_record_stream = __esm({
92616
92711
  }
92617
92712
  });
92618
92713
 
92619
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
92714
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
92620
92715
  var init_record_stream = __esm({
92621
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
92716
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
92622
92717
  init_legacy_ppt_record_stream();
92623
92718
  }
92624
92719
  });
92625
92720
 
92626
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
92721
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
92627
92722
  function toHex3(r, g, b) {
92628
92723
  return [r, g, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
92629
92724
  }
@@ -92674,7 +92769,7 @@ function resolveEscherColor(colorRef, scheme) {
92674
92769
  }
92675
92770
  var SCHEME, DEFAULT_SCHEME;
92676
92771
  var init_color_scheme = __esm({
92677
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
92772
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
92678
92773
  init_record_stream();
92679
92774
  init_record_types();
92680
92775
  SCHEME = {
@@ -92700,7 +92795,7 @@ var init_color_scheme = __esm({
92700
92795
  }
92701
92796
  });
92702
92797
 
92703
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
92798
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
92704
92799
  function buildColorSchemeAtom(recInstance = 1, colors) {
92705
92800
  const w = new ByteWriter();
92706
92801
  for (const rgb of colors?.length === 8 ? colors : DEFAULT_SCHEME) {
@@ -92709,7 +92804,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
92709
92804
  return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
92710
92805
  }
92711
92806
  var init_color_scheme_writer = __esm({
92712
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
92807
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
92713
92808
  init_color_scheme();
92714
92809
  init_record_types();
92715
92810
  init_byte_writer();
@@ -92717,7 +92812,7 @@ var init_color_scheme_writer = __esm({
92717
92812
  }
92718
92813
  });
92719
92814
 
92720
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
92815
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
92721
92816
  function buildSlideAtomRaw(geom, masterIdRef, notesIdRef, flags) {
92722
92817
  const data = new ByteWriter().i32(geom).bytes(new Uint8Array(8)).u32(masterIdRef).i32(notesIdRef).u16(flags).u16(0).toBytes();
92723
92818
  return record(RT.SlideAtom, data, 0, false, 2);
@@ -92754,7 +92849,7 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
92754
92849
  }
92755
92850
  var SLIDE_FLAG_MASTER_OBJECTS, SLIDE_FLAG_MASTER_SCHEME, SLIDE_FLAG_MASTER_BACKGROUND, SLIDE_MASTER_ID_SENTINEL, MASTER_FIRST_COLOR_SCHEME_INSTANCE;
92756
92851
  var init_slide_writer = __esm({
92757
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
92852
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
92758
92853
  init_record_types();
92759
92854
  init_byte_writer();
92760
92855
  init_color_scheme_writer();
@@ -92769,7 +92864,7 @@ var init_slide_writer = __esm({
92769
92864
  }
92770
92865
  });
92771
92866
 
92772
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
92867
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
92773
92868
  function masterSlideId(index) {
92774
92869
  return MASTER_SLIDE_ID_SENTINEL + index;
92775
92870
  }
@@ -92893,7 +92988,7 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
92893
92988
  }
92894
92989
  var DOC_ID, MASTER_ID;
92895
92990
  var init_document_stream_layout = __esm({
92896
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
92991
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
92897
92992
  init_bstore_writer();
92898
92993
  init_byte_writer();
92899
92994
  init_document_writer();
@@ -92911,15 +93006,15 @@ var init_document_stream_layout = __esm({
92911
93006
  }
92912
93007
  });
92913
93008
 
92914
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
93009
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
92915
93010
  var RC4_ALG_ID2;
92916
93011
  var init_crypto_constants = __esm({
92917
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
93012
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
92918
93013
  RC4_ALG_ID2 = 26625;
92919
93014
  }
92920
93015
  });
92921
93016
 
92922
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
93017
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
92923
93018
  function rc4Cipher(key2, data) {
92924
93019
  if (key2.length === 0) {
92925
93020
  throw new Error("RC4 key must not be empty.");
@@ -92950,11 +93045,11 @@ function rc4Cipher(key2, data) {
92950
93045
  return out;
92951
93046
  }
92952
93047
  var init_rc4_cipher = __esm({
92953
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
93048
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
92954
93049
  }
92955
93050
  });
92956
93051
 
92957
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
93052
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
92958
93053
  async function rc4CryptoApiKeyBase(password, salt) {
92959
93054
  return hash("SHA-1", concatArrays(salt, encodePasswordUtf16LE(password)));
92960
93055
  }
@@ -92995,14 +93090,14 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
92995
93090
  }
92996
93091
  var PADDED_40_BIT_KEY_BYTES;
92997
93092
  var init_rc4_cryptoapi_key = __esm({
92998
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
93093
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
92999
93094
  init_ooxml_crypto_primitives();
93000
93095
  init_rc4_cipher();
93001
93096
  PADDED_40_BIT_KEY_BYTES = 16;
93002
93097
  }
93003
93098
  });
93004
93099
 
93005
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
93100
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
93006
93101
  function readHeader(bytes) {
93007
93102
  const view = new DataView(bytes.buffer, bytes.byteOffset, RECORD_HEADER_SIZE);
93008
93103
  return {
@@ -93071,7 +93166,7 @@ async function cipherPicturesStream(stream, keyFor2, mode) {
93071
93166
  }
93072
93167
  var UID_SIZE, METAFILE_HEADER_SIZE, BITMAP_TAG_SIZE, METAFILE_BLIPS, BITMAP_BLIPS;
93073
93168
  var init_rc4_cryptoapi_streams = __esm({
93074
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
93169
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
93075
93170
  init_rc4_cipher();
93076
93171
  init_record_stream();
93077
93172
  UID_SIZE = 16;
@@ -93082,7 +93177,7 @@ var init_rc4_cryptoapi_streams = __esm({
93082
93177
  }
93083
93178
  });
93084
93179
 
93085
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
93180
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
93086
93181
  async function buildCryptSession(password) {
93087
93182
  const salt = new Uint8Array(SALT_SIZE);
93088
93183
  crypto.getRandomValues(salt);
@@ -93110,7 +93205,7 @@ async function encryptPicturesStream(stream, ctx) {
93110
93205
  }
93111
93206
  var CSP_NAME, KEY_SIZE_BITS, SALT_SIZE, VERIFIER_SIZE, VERIFIER_HASH_SIZE, ENCRYPTION_FLAGS;
93112
93207
  var init_encrypt_writer = __esm({
93113
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
93208
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
93114
93209
  init_crypto_constants();
93115
93210
  init_rc4_cryptoapi_key();
93116
93211
  init_rc4_cryptoapi_streams();
@@ -93125,7 +93220,7 @@ var init_encrypt_writer = __esm({
93125
93220
  }
93126
93221
  });
93127
93222
 
93128
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
93223
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
93129
93224
  function levelsFor(styles, textType) {
93130
93225
  switch (textType) {
93131
93226
  case 0:
@@ -93191,12 +93286,12 @@ function withMasterRelativeRunStyles(deck) {
93191
93286
  }
93192
93287
  var STYLE_KEYS;
93193
93288
  var init_master_relative_runs = __esm({
93194
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
93289
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
93195
93290
  STYLE_KEYS = ["bold", "italic", "underline"];
93196
93291
  }
93197
93292
  });
93198
93293
 
93199
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
93294
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
93200
93295
  function buildPersistDirectoryAtom(entries) {
93201
93296
  const sorted = [...entries].sort((a, b) => a[0] - b[0]);
93202
93297
  const w = new ByteWriter();
@@ -93226,17 +93321,17 @@ function buildEncryptedUserEditAtom(input) {
93226
93321
  }
93227
93322
  var MAX_RUN;
93228
93323
  var init_persist_writer = __esm({
93229
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
93324
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
93230
93325
  init_record_types();
93231
93326
  init_byte_writer();
93232
93327
  MAX_RUN = 4095;
93233
93328
  }
93234
93329
  });
93235
93330
 
93236
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
93331
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
93237
93332
  var PPT_STORAGE_CLSID;
93238
93333
  var init_ppt_clsid = __esm({
93239
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
93334
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
93240
93335
  PPT_STORAGE_CLSID = new Uint8Array([
93241
93336
  16,
93242
93337
  141,
@@ -93258,7 +93353,7 @@ var init_ppt_clsid = __esm({
93258
93353
  }
93259
93354
  });
93260
93355
 
93261
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
93356
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
93262
93357
  async function finishUnencrypted(layout, lastSlideId) {
93263
93358
  const w = new ByteWriter().append(layout.bytes);
93264
93359
  const dirAtom = buildPersistDirectoryAtom(layout.offsets);
@@ -93312,7 +93407,7 @@ async function buildPptFile(deck, options = {}) {
93312
93407
  return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
93313
93408
  }
93314
93409
  var init_write_ppt = __esm({
93315
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
93410
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
93316
93411
  init_ole2_parser_write();
93317
93412
  init_byte_writer();
93318
93413
  init_current_user_writer();
@@ -93324,9 +93419,9 @@ var init_write_ppt = __esm({
93324
93419
  }
93325
93420
  });
93326
93421
 
93327
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
93422
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
93328
93423
  var init_legacy_ppt_writer = __esm({
93329
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
93424
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
93330
93425
  init_write_ppt();
93331
93426
  init_master_style_fonts();
93332
93427
  }
@@ -131693,61 +131788,115 @@ var init_deflate_utils = __esm({
131693
131788
  }
131694
131789
  });
131695
131790
 
131696
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
131697
- function parseUserEditAtom(view, offset) {
131791
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
131792
+ function checkedLimit(value) {
131793
+ if (!Number.isSafeInteger(value) || value < 1)
131794
+ throw new PptParseError("Invalid persist directory resource limit");
131795
+ return value;
131796
+ }
131797
+ function boundedAtom(view, offset, type) {
131698
131798
  const rec = readRecordOrThrow(view, offset);
131699
- if (rec.recType !== RT.UserEditAtom) {
131700
- throw new PptParseError(`Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
131799
+ if (rec.recType !== type || rec.recVer !== 0 || rec.recInstance !== 0) {
131800
+ throw new PptParseError(`Invalid persist atom header at offset ${offset}`);
131701
131801
  }
131802
+ if (rec.recLen > view.byteLength - rec.dataOffset) {
131803
+ throw new PptParseError(`Persist atom payload out of bounds at offset ${offset}`);
131804
+ }
131805
+ return rec;
131806
+ }
131807
+ function parseUserEditAtom(view, offset) {
131808
+ const rec = boundedAtom(view, offset, RT.UserEditAtom);
131702
131809
  if (rec.recLen !== 28 && rec.recLen !== 32) {
131703
131810
  throw new PptParseError(`UserEditAtom has invalid length ${rec.recLen}`);
131704
131811
  }
131705
131812
  const d = rec.dataOffset;
131706
- return {
131813
+ const edit = {
131707
131814
  offsetLastEdit: view.getUint32(d + 8, true),
131708
131815
  offsetPersistDirectory: view.getUint32(d + 12, true),
131709
131816
  docPersistIdRef: view.getUint32(d + 16, true),
131710
131817
  encryptSessionPersistIdRef: rec.recLen === 32 ? view.getUint32(d + 28, true) : void 0
131711
131818
  };
131712
- }
131713
- function parsePersistDirectoryAtom(view, offset) {
131714
- const rec = readRecordOrThrow(view, offset);
131715
- if (rec.recType !== RT.PersistDirectoryAtom) {
131716
- throw new PptParseError(`Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
131819
+ if (view.getUint8(d + 6) !== 0 || view.getUint8(d + 7) !== 3) {
131820
+ throw new PptParseError("Unsupported UserEditAtom storage version");
131821
+ }
131822
+ if (edit.offsetLastEdit >= offset || edit.offsetPersistDirectory <= edit.offsetLastEdit || edit.offsetPersistDirectory >= offset) {
131823
+ throw new PptParseError("Invalid UserEditAtom save history offsets");
131717
131824
  }
131825
+ if (edit.docPersistIdRef !== 1)
131826
+ throw new PptParseError("Invalid document persist identifier");
131827
+ return edit;
131828
+ }
131829
+ function parsePersistDirectoryAtom(view, offset, maxEntries = DEFAULT_MAX_ENTRIES) {
131830
+ checkedLimit(maxEntries);
131831
+ const rec = boundedAtom(view, offset, RT.PersistDirectoryAtom);
131718
131832
  const pairs = [];
131719
131833
  let pos2 = rec.dataOffset;
131720
131834
  const end = rec.dataOffset + rec.recLen;
131721
- while (pos2 + 4 <= end) {
131835
+ const seen = /* @__PURE__ */ new Set();
131836
+ while (pos2 < end) {
131837
+ if (end - pos2 < 4)
131838
+ throw new PptParseError("Truncated persist directory entry");
131722
131839
  const packed = view.getUint32(pos2, true);
131723
131840
  const persistId = packed & 1048575;
131724
131841
  const cPersist = packed >>> 20 & 4095;
131725
131842
  pos2 += 4;
131726
- for (let i = 0; i < cPersist && pos2 + 4 <= end; i++, pos2 += 4) {
131727
- pairs.push([persistId + i, view.getUint32(pos2, true)]);
131843
+ if (persistId > 1048574 || cPersist === 0 || persistId + cPersist - 1 > 1048575) {
131844
+ throw new PptParseError("Invalid persist identifier run");
131845
+ }
131846
+ if (cPersist * 4 > end - pos2)
131847
+ throw new PptParseError("Truncated persist offset run");
131848
+ if (pairs.length + cPersist > maxEntries)
131849
+ throw new PptParseError("Persist directory entry limit exceeded");
131850
+ for (let i = 0; i < cPersist; i++, pos2 += 4) {
131851
+ const id = persistId + i;
131852
+ if (seen.has(id))
131853
+ throw new PptParseError("Duplicate persist identifier");
131854
+ seen.add(id);
131855
+ const objectOffset = view.getUint32(pos2, true);
131856
+ if (objectOffset >= offset || objectOffset + 8 > view.byteLength)
131857
+ throw new PptParseError("Persist object offset out of bounds");
131858
+ pairs.push([id, objectOffset]);
131728
131859
  }
131729
131860
  }
131730
131861
  return pairs;
131731
131862
  }
131732
- function buildPersistDirectory(view, offsetToCurrentEdit) {
131863
+ function buildPersistDirectory(view, offsetToCurrentEdit, limits = {}) {
131864
+ const maxEdits = checkedLimit(limits.maxEdits ?? DEFAULT_MAX_EDITS);
131865
+ const maxEntries = checkedLimit(limits.maxEntries ?? DEFAULT_MAX_ENTRIES);
131733
131866
  const edits = [];
131867
+ const editOffsets = [];
131734
131868
  const seen = /* @__PURE__ */ new Set();
131735
131869
  let offset = offsetToCurrentEdit;
131736
131870
  while (offset !== 0) {
131871
+ if (edits.length >= maxEdits)
131872
+ throw new PptParseError("User edit chain limit exceeded");
131737
131873
  if (seen.has(offset)) {
131738
131874
  throw new PptParseError(`Circular UserEditAtom chain at offset ${offset}`);
131739
131875
  }
131740
131876
  seen.add(offset);
131741
131877
  const edit = parseUserEditAtom(view, offset);
131742
131878
  edits.push(edit);
131879
+ editOffsets.push(offset);
131743
131880
  offset = edit.offsetLastEdit;
131744
131881
  }
131745
131882
  if (edits.length === 0) {
131746
131883
  throw new PptParseError("No UserEditAtom found");
131747
131884
  }
131748
131885
  const directory = /* @__PURE__ */ new Map();
131886
+ let entryCount = 0;
131749
131887
  for (let i = edits.length - 1; i >= 0; i--) {
131750
- for (const [id, off] of parsePersistDirectoryAtom(view, edits[i].offsetPersistDirectory)) {
131888
+ const edit = edits[i];
131889
+ const dirAtom = boundedAtom(view, edit.offsetPersistDirectory, RT.PersistDirectoryAtom);
131890
+ const editOffset = editOffsets[i];
131891
+ if (dirAtom.dataOffset + dirAtom.recLen > editOffset)
131892
+ throw new PptParseError("Persist directory overlaps user edit");
131893
+ const entries = parsePersistDirectoryAtom(view, edit.offsetPersistDirectory, maxEntries);
131894
+ entryCount += entries.length;
131895
+ if (entryCount > maxEntries)
131896
+ throw new PptParseError("Save history persist entry limit exceeded");
131897
+ for (const [id, off] of entries) {
131898
+ if (off < edit.offsetLastEdit)
131899
+ throw new PptParseError("Persist object precedes corresponding user edit");
131751
131900
  directory.set(id, off);
131752
131901
  }
131753
131902
  }
@@ -131758,12 +131907,18 @@ function readPersistRecord(view, directory, persistId) {
131758
131907
  if (offset === void 0) {
131759
131908
  return void 0;
131760
131909
  }
131761
- return readRecordOrThrow(view, offset);
131910
+ const rec = readRecordOrThrow(view, offset);
131911
+ if (rec.recLen > view.byteLength - rec.dataOffset)
131912
+ throw new PptParseError("Persist object payload out of bounds");
131913
+ return rec;
131762
131914
  }
131915
+ var DEFAULT_MAX_EDITS, DEFAULT_MAX_ENTRIES;
131763
131916
  var init_persist_directory = __esm({
131764
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
131917
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
131765
131918
  init_record_stream();
131766
131919
  init_record_types();
131920
+ DEFAULT_MAX_EDITS = 1e4;
131921
+ DEFAULT_MAX_ENTRIES = 1e6;
131767
131922
  }
131768
131923
  });
131769
131924