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.
@@ -13615,10 +13615,10 @@ var init_ole_utils = __esm({
13615
13615
  }
13616
13616
  });
13617
13617
 
13618
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
13618
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js
13619
13619
  var OLE_MAGIC, ENDOFCHAIN, FREESECT, FATSECT, DIFSECT, MAXREGSECT, ENTRY_TYPE_EMPTY, ENTRY_TYPE_STREAM, ENTRY_TYPE_ROOT, DIR_ENTRY_SIZE, Ole2ParseError;
13620
13620
  var init_ole2_parser_types = __esm({
13621
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
13621
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-types.js"() {
13622
13622
  OLE_MAGIC = new Uint8Array([208, 207, 17, 224, 161, 177, 26, 225]);
13623
13623
  ENDOFCHAIN = 4294967294;
13624
13624
  FREESECT = 4294967295;
@@ -13638,10 +13638,13 @@ var init_ole2_parser_types = __esm({
13638
13638
  }
13639
13639
  });
13640
13640
 
13641
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
13641
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js
13642
13642
  function parseOle2(buffer) {
13643
13643
  const data = new Uint8Array(buffer);
13644
13644
  const view = new DataView(buffer);
13645
+ if (data.length < 512) {
13646
+ throw new Ole2ParseError("Truncated OLE2 compound file header");
13647
+ }
13645
13648
  for (let i = 0; i < OLE_MAGIC.length; i++) {
13646
13649
  if (data[i] !== OLE_MAGIC[i]) {
13647
13650
  throw new Ole2ParseError("Not a valid OLE2 compound file");
@@ -13655,8 +13658,15 @@ function parseOle2(buffer) {
13655
13658
  }
13656
13659
  const sectorSizePower = view.getUint16(30, true);
13657
13660
  const miniSectorSizePower = view.getUint16(32, true);
13661
+ if (majorVersion !== 3 && majorVersion !== 4 || sectorSizePower !== (majorVersion === 3 ? 9 : 12) || miniSectorSizePower !== 6) {
13662
+ throw new Ole2ParseError("Unsupported OLE2 version or sector size");
13663
+ }
13658
13664
  const sectorSize = 1 << sectorSizePower;
13659
13665
  const miniSectorSize = 1 << miniSectorSizePower;
13666
+ if (data.length < sectorSize || data.length % sectorSize !== 0) {
13667
+ throw new Ole2ParseError("Truncated OLE2 sector");
13668
+ }
13669
+ const sectorCount = data.length / sectorSize - 1;
13660
13670
  const totalFATSectors = view.getUint32(44, true);
13661
13671
  const firstDirectorySector = view.getUint32(48, true);
13662
13672
  const miniStreamCutoff = view.getUint32(56, true);
@@ -13664,6 +13674,9 @@ function parseOle2(buffer) {
13664
13674
  const totalMiniFATSectors = view.getUint32(64, true);
13665
13675
  const firstDIFATSector = view.getUint32(68, true);
13666
13676
  const totalDIFATSectors = view.getUint32(72, true);
13677
+ if (totalFATSectors > sectorCount || totalMiniFATSectors > sectorCount || totalDIFATSectors > sectorCount) {
13678
+ throw new Ole2ParseError("Allocation table count exceeds file size");
13679
+ }
13667
13680
  function sectorOffset(sector) {
13668
13681
  return (sector + 1) * sectorSize;
13669
13682
  }
@@ -13682,7 +13695,11 @@ function parseOle2(buffer) {
13682
13695
  }
13683
13696
  }
13684
13697
  let difatSector = firstDIFATSector;
13698
+ const difatSeen = /* @__PURE__ */ new Set();
13685
13699
  for (let d = 0; d < totalDIFATSectors && difatSector <= MAXREGSECT; d++) {
13700
+ if (difatSeen.has(difatSector))
13701
+ throw new Ole2ParseError("Circular DIFAT chain");
13702
+ difatSeen.add(difatSector);
13686
13703
  const difatData = readSector(difatSector);
13687
13704
  const difatView = new DataView(difatData.buffer, difatData.byteOffset, difatData.byteLength);
13688
13705
  const entriesPerSector = (sectorSize - 4) / 4;
@@ -13694,11 +13711,14 @@ function parseOle2(buffer) {
13694
13711
  }
13695
13712
  difatSector = difatView.getUint32(sectorSize - 4, true);
13696
13713
  }
13714
+ if (difatSeen.size !== totalDIFATSectors || fatSectors.length !== totalFATSectors || new Set(fatSectors).size !== fatSectors.length || fatSectors.some((id) => difatSeen.has(id))) {
13715
+ throw new Ole2ParseError("Invalid DIFAT allocation table");
13716
+ }
13697
13717
  const fatEntries = [];
13698
13718
  for (const fatSector of fatSectors) {
13699
13719
  const fatData = readSector(fatSector);
13700
13720
  const fatView = new DataView(fatData.buffer, fatData.byteOffset, fatData.byteLength);
13701
- for (let i = 0; i < sectorSize / 4; i++) {
13721
+ for (let i = 0; i < sectorSize / 4 && fatEntries.length < sectorCount; i++) {
13702
13722
  fatEntries.push(fatView.getUint32(i * 4, true));
13703
13723
  }
13704
13724
  }
@@ -13712,8 +13732,12 @@ function parseOle2(buffer) {
13712
13732
  }
13713
13733
  visited.add(current);
13714
13734
  sectors.push(readSector(current));
13715
- current = fatEntries[current] ?? ENDOFCHAIN;
13735
+ if (fatEntries[current] === void 0)
13736
+ throw new Ole2ParseError("Missing FAT chain entry");
13737
+ current = fatEntries[current];
13716
13738
  }
13739
+ if (current !== ENDOFCHAIN)
13740
+ throw new Ole2ParseError("Invalid FAT chain terminator");
13717
13741
  const totalLength = sectors.length * sectorSize;
13718
13742
  const result = new Uint8Array(totalLength);
13719
13743
  let offset = 0;
@@ -13724,16 +13748,14 @@ function parseOle2(buffer) {
13724
13748
  return result;
13725
13749
  }
13726
13750
  function readStream(startSector, size) {
13751
+ if (size === 0)
13752
+ return new Uint8Array(0);
13753
+ if (size > sectorCount * sectorSize)
13754
+ throw new Ole2ParseError("Stream size exceeds file size");
13727
13755
  const raw = readSectorChain(startSector);
13728
- return raw.subarray(0, Math.min(size, raw.length));
13729
- }
13730
- const miniFatEntries = [];
13731
- if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
13732
- const miniFatRaw = readSectorChain(firstMiniFATSector);
13733
- const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
13734
- for (let i = 0; i < miniFatRaw.length / 4; i++) {
13735
- miniFatEntries.push(miniFatView.getUint32(i * 4, true));
13736
- }
13756
+ if (raw.length < size)
13757
+ throw new Ole2ParseError("Truncated stream sector chain");
13758
+ return raw.subarray(0, size);
13737
13759
  }
13738
13760
  const dirRaw = readSectorChain(firstDirectorySector);
13739
13761
  const numEntries = Math.floor(dirRaw.length / DIR_ENTRY_SIZE);
@@ -13746,6 +13768,9 @@ function parseOle2(buffer) {
13746
13768
  if (objectType === ENTRY_TYPE_EMPTY) {
13747
13769
  continue;
13748
13770
  }
13771
+ if (nameLen < 2 || nameLen > 64 || nameLen % 2 !== 0 || entryView.getUint16(nameLen - 2, true) !== 0) {
13772
+ throw new Ole2ParseError("Invalid directory entry name");
13773
+ }
13749
13774
  const nameBytes = Math.max(0, nameLen - 2);
13750
13775
  let name = "";
13751
13776
  for (let j = 0; j < nameBytes; j += 2) {
@@ -13759,8 +13784,11 @@ function parseOle2(buffer) {
13759
13784
  const sizeLow = entryView.getUint32(120, true);
13760
13785
  let size = sizeLow;
13761
13786
  if (majorVersion === 4) {
13762
- entryView.getUint32(124, true);
13763
- size = sizeLow;
13787
+ const sizeHigh = entryView.getUint32(124, true);
13788
+ size = sizeLow + sizeHigh * 4294967296;
13789
+ if (!Number.isSafeInteger(size) || size > sectorCount * sectorSize) {
13790
+ throw new Ole2ParseError("Stream size exceeds supported file bounds");
13791
+ }
13764
13792
  }
13765
13793
  entries.push({
13766
13794
  name,
@@ -13774,11 +13802,28 @@ function parseOle2(buffer) {
13774
13802
  });
13775
13803
  }
13776
13804
  const rootEntry = entries.find((e) => e.type === ENTRY_TYPE_ROOT);
13805
+ if (!rootEntry || entries.filter((e) => e.type === ENTRY_TYPE_ROOT).length !== 1) {
13806
+ throw new Ole2ParseError("Invalid root directory entry");
13807
+ }
13777
13808
  let miniStreamData;
13778
13809
  if (rootEntry && rootEntry.startSector <= MAXREGSECT) {
13779
- miniStreamData = readSectorChain(rootEntry.startSector);
13810
+ miniStreamData = readStream(rootEntry.startSector, rootEntry.size);
13811
+ }
13812
+ const miniFatEntries = [];
13813
+ if (firstMiniFATSector <= MAXREGSECT && totalMiniFATSectors > 0) {
13814
+ const miniFatRaw = readSectorChain(firstMiniFATSector);
13815
+ if (miniFatRaw.length !== totalMiniFATSectors * sectorSize) {
13816
+ throw new Ole2ParseError("Unexpected mini FAT chain length");
13817
+ }
13818
+ const miniFatView = new DataView(miniFatRaw.buffer, miniFatRaw.byteOffset, miniFatRaw.byteLength);
13819
+ const miniCapacity = Math.floor((miniStreamData?.length ?? 0) / miniSectorSize);
13820
+ for (let i = 0; i < miniFatRaw.length / 4 && i < miniCapacity; i++) {
13821
+ miniFatEntries.push(miniFatView.getUint32(i * 4, true));
13822
+ }
13780
13823
  }
13781
13824
  function readMiniStream(startSector, size) {
13825
+ if (size === 0)
13826
+ return new Uint8Array(0);
13782
13827
  if (!miniStreamData) {
13783
13828
  throw new Ole2ParseError("Mini stream container not found");
13784
13829
  }
@@ -13791,17 +13836,24 @@ function parseOle2(buffer) {
13791
13836
  }
13792
13837
  visited.add(current);
13793
13838
  const offset2 = current * miniSectorSize;
13839
+ if (offset2 + miniSectorSize > miniStreamData.length || miniFatEntries[current] === void 0) {
13840
+ throw new Ole2ParseError("Mini stream sector exceeds allocation bounds");
13841
+ }
13794
13842
  sectors.push(miniStreamData.subarray(offset2, offset2 + miniSectorSize));
13795
- current = miniFatEntries[current] ?? ENDOFCHAIN;
13843
+ current = miniFatEntries[current];
13796
13844
  }
13845
+ if (current !== ENDOFCHAIN)
13846
+ throw new Ole2ParseError("Invalid mini FAT chain terminator");
13797
13847
  const totalLength = sectors.length * miniSectorSize;
13848
+ if (totalLength < size)
13849
+ throw new Ole2ParseError("Truncated mini stream sector chain");
13798
13850
  const result = new Uint8Array(totalLength);
13799
13851
  let offset = 0;
13800
13852
  for (const sector of sectors) {
13801
13853
  result.set(sector, offset);
13802
13854
  offset += miniSectorSize;
13803
13855
  }
13804
- return result.subarray(0, Math.min(size, result.length));
13856
+ return result.subarray(0, size);
13805
13857
  }
13806
13858
  function getStream(name) {
13807
13859
  const entry = entries.find((e) => (e.type === ENTRY_TYPE_STREAM || e.type === ENTRY_TYPE_ROOT) && e.name === name);
@@ -13816,7 +13868,7 @@ function parseOle2(buffer) {
13816
13868
  return { entries, getStream };
13817
13869
  }
13818
13870
  var init_ole2_parser_read = __esm({
13819
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
13871
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-read.js"() {
13820
13872
  init_ole2_parser_types();
13821
13873
  }
13822
13874
  });
@@ -13956,13 +14008,16 @@ var init_ole_embedded_extract = __esm({
13956
14008
  }
13957
14009
  });
13958
14010
 
13959
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
14011
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js
13960
14012
  function compareDirEntryNames(a, b) {
14013
+ const ua = a.toUpperCase();
14014
+ const ub = b.toUpperCase();
14015
+ if (ua.length !== a.length || ub.length !== b.length) {
14016
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
14017
+ }
13961
14018
  if (a.length !== b.length) {
13962
14019
  return a.length - b.length;
13963
14020
  }
13964
- const ua = a.toUpperCase();
13965
- const ub = b.toUpperCase();
13966
14021
  for (let i = 0; i < ua.length; i++) {
13967
14022
  const diff = ua.charCodeAt(i) - ub.charCodeAt(i);
13968
14023
  if (diff !== 0) {
@@ -13979,6 +14034,24 @@ function encodeName(name) {
13979
14034
  }
13980
14035
  return bytes;
13981
14036
  }
14037
+ function buildDirectoryTree(entryCount) {
14038
+ const links = /* @__PURE__ */ new Map();
14039
+ let redLevel = 0;
14040
+ for (let remaining = entryCount - 2; remaining >= 0; remaining = Math.floor(remaining / 2) - 1)
14041
+ redLevel++;
14042
+ const build = (low, high, level2) => {
14043
+ if (low > high)
14044
+ return 4294967295;
14045
+ const id = Math.floor((low + high) / 2);
14046
+ links.set(id, {
14047
+ left: build(low, id - 1, level2 + 1),
14048
+ right: build(id + 1, high, level2 + 1),
14049
+ color: level2 === redLevel ? 0 : 1
14050
+ });
14051
+ return id;
14052
+ };
14053
+ return { root: build(1, entryCount - 1, 0), links };
14054
+ }
13982
14055
  function writeFatChain(fat, chain) {
13983
14056
  for (let i = 0; i < chain.sectors.length; i++) {
13984
14057
  fat[chain.sectors[i]] = i < chain.sectors.length - 1 ? chain.sectors[i + 1] : ENDOFCHAIN;
@@ -14002,12 +14075,12 @@ function writeInt32Sectors(outBytes, int32Data, firstSector, numSectors, sectorS
14002
14075
  }
14003
14076
  }
14004
14077
  var init_ole2_parser_write_helpers = __esm({
14005
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
14078
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-helpers.js"() {
14006
14079
  init_ole2_parser_types();
14007
14080
  }
14008
14081
  });
14009
14082
 
14010
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
14083
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js
14011
14084
  function writeHeader(outView, outBytes, params) {
14012
14085
  outBytes.set(OLE_MAGIC, 0);
14013
14086
  outView.setUint16(24, 62, true);
@@ -14064,6 +14137,7 @@ function writeDifatSectors(outView, params) {
14064
14137
  function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
14065
14138
  const dirData = new Uint8Array(numDirSectors * sectorSize);
14066
14139
  const dirView = new DataView(dirData.buffer);
14140
+ const tree = buildDirectoryTree(dirEntries.length);
14067
14141
  for (let i = 0; i < dirEntries.length; i++) {
14068
14142
  const entry = dirEntries[i];
14069
14143
  const entryOffset = i * DIR_ENTRY_SIZE;
@@ -14071,17 +14145,17 @@ function serializeDirectoryEntries(dirEntries, numDirSectors, sectorSize) {
14071
14145
  dirData.set(nameBytes.subarray(0, Math.min(nameBytes.length, 64)), entryOffset);
14072
14146
  dirView.setUint16(entryOffset + 64, Math.min((entry.name.length + 1) * 2, 64), true);
14073
14147
  dirData[entryOffset + 66] = entry.type;
14074
- dirData[entryOffset + 67] = 1;
14148
+ dirData[entryOffset + 67] = i === 0 ? 1 : tree.links.get(i).color;
14075
14149
  if (entry.clsid) {
14076
14150
  dirData.set(entry.clsid.subarray(0, 16), entryOffset + 80);
14077
14151
  }
14078
14152
  if (i === 0) {
14079
14153
  dirView.setUint32(entryOffset + 68, 4294967295, true);
14080
14154
  dirView.setUint32(entryOffset + 72, 4294967295, true);
14081
- dirView.setUint32(entryOffset + 76, dirEntries.length > 1 ? 1 : 4294967295, true);
14155
+ dirView.setUint32(entryOffset + 76, tree.root, true);
14082
14156
  } else {
14083
- dirView.setUint32(entryOffset + 68, 4294967295, true);
14084
- dirView.setUint32(entryOffset + 72, i + 1 < dirEntries.length ? i + 1 : 4294967295, true);
14157
+ dirView.setUint32(entryOffset + 68, tree.links.get(i).left, true);
14158
+ dirView.setUint32(entryOffset + 72, tree.links.get(i).right, true);
14085
14159
  dirView.setUint32(entryOffset + 76, 4294967295, true);
14086
14160
  }
14087
14161
  dirView.setUint32(entryOffset + 116, entry.startSector, true);
@@ -14099,17 +14173,32 @@ function writeStreamSectors(outBytes, streamData, chain, sectorSize) {
14099
14173
  }
14100
14174
  var HEADER_DIFAT_ENTRIES;
14101
14175
  var init_ole2_parser_write_serialize = __esm({
14102
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
14176
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write-serialize.js"() {
14103
14177
  init_ole2_parser_types();
14104
14178
  init_ole2_parser_write_helpers();
14105
14179
  HEADER_DIFAT_ENTRIES = 109;
14106
14180
  }
14107
14181
  });
14108
14182
 
14109
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
14183
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js
14110
14184
  function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14111
14185
  const sectorSize = 512;
14112
14186
  const miniSectorSize = 64;
14187
+ if (rootClsid && rootClsid.length !== 16)
14188
+ throw new Error("Root CLSID must contain 16 bytes");
14189
+ const names = [...streams2.keys()].sort(compareDirEntryNames);
14190
+ for (let i = 0; i < names.length; i++) {
14191
+ const name = names[i];
14192
+ if (name.toUpperCase().length !== name.length) {
14193
+ throw new Error("CFB stream names with expanding uppercase mappings are unsupported");
14194
+ }
14195
+ if (!name.length || name.length > 31 || /[\x00\\/:!]/.test(name)) {
14196
+ throw new Error("CFB stream names must be 1-31 UTF-16 code units without NUL, \\, /, :, or !");
14197
+ }
14198
+ if (i > 0 && compareDirEntryNames(names[i - 1], name) === 0) {
14199
+ throw new Error("Duplicate CFB stream names");
14200
+ }
14201
+ }
14113
14202
  const regularStreams = [];
14114
14203
  const miniStreams = [];
14115
14204
  for (const [name, data] of streams2) {
@@ -14127,7 +14216,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14127
14216
  for (let i = 0; i < numSectors; i++) {
14128
14217
  sectors.push(nextSector++);
14129
14218
  }
14130
- fatChains.set(stream.name, { start: sectors[0] ?? 0, sectors });
14219
+ fatChains.set(stream.name, { start: sectors[0] ?? ENDOFCHAIN, sectors });
14131
14220
  }
14132
14221
  let miniStreamContainer = new Uint8Array(0);
14133
14222
  const miniFatChains = /* @__PURE__ */ new Map();
@@ -14150,7 +14239,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14150
14239
  miniOffset += miniSectorSize;
14151
14240
  }
14152
14241
  miniFatChains.set(stream.name, {
14153
- start: miniSectors[0] ?? 0,
14242
+ start: miniSectors[0] ?? ENDOFCHAIN,
14154
14243
  sectors: miniSectors
14155
14244
  });
14156
14245
  }
@@ -14198,7 +14287,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14198
14287
  nextSector += numDirSectors;
14199
14288
  let firstMiniFATSector = ENDOFCHAIN;
14200
14289
  let numMiniFATSectors = 0;
14201
- if (miniStreams.length > 0) {
14290
+ if (nextMiniSector > 0) {
14202
14291
  numMiniFATSectors = Math.ceil(nextMiniSector * 4 / sectorSize);
14203
14292
  firstMiniFATSector = nextSector;
14204
14293
  nextSector += numMiniFATSectors;
@@ -14272,7 +14361,7 @@ function buildOle2(streams2, rootClsid, miniStreamCutoff = 4096) {
14272
14361
  return output;
14273
14362
  }
14274
14363
  var init_ole2_parser_write = __esm({
14275
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
14364
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ole2-parser-write.js"() {
14276
14365
  init_ole2_parser_types();
14277
14366
  init_ole2_parser_write_helpers();
14278
14367
  init_ole2_parser_write_serialize();
@@ -14734,7 +14823,7 @@ var init_xml_whitespace = __esm({
14734
14823
  }
14735
14824
  });
14736
14825
 
14737
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
14826
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js
14738
14827
  function adler32(bytes) {
14739
14828
  let a = 1;
14740
14829
  let b = 0;
@@ -14783,7 +14872,7 @@ function zlibStore(data) {
14783
14872
  return concatBytes([zlibHeader, ...blocks, adlerBytes]);
14784
14873
  }
14785
14874
  var init_png_encoder = __esm({
14786
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
14875
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/png-encoder.js"() {
14787
14876
  (() => {
14788
14877
  const table = new Uint32Array(256);
14789
14878
  for (let n = 0; n < 256; n++) {
@@ -33317,7 +33406,7 @@ var init_encryption_detection = __esm({
33317
33406
  }
33318
33407
  });
33319
33408
 
33320
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
33409
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js
33321
33410
  function getSubtle() {
33322
33411
  if (typeof globalThis.crypto !== "undefined" && globalThis.crypto.subtle) {
33323
33412
  return globalThis.crypto.subtle;
@@ -33435,7 +33524,7 @@ async function hmac(algorithm, key2, data) {
33435
33524
  return new Uint8Array(result);
33436
33525
  }
33437
33526
  var init_ooxml_crypto_primitives = __esm({
33438
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
33527
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/ooxml-crypto-primitives.js"() {
33439
33528
  }
33440
33529
  });
33441
33530
 
@@ -34633,7 +34722,7 @@ var init_ole2_parser = __esm({
34633
34722
  }
34634
34723
  });
34635
34724
 
34636
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
34725
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js
34637
34726
  function rotl32(x, n) {
34638
34727
  return (x << n | x >>> 32 - n) >>> 0;
34639
34728
  }
@@ -34682,11 +34771,11 @@ function mdStyleDigest(message, initialState, transform2) {
34682
34771
  return out;
34683
34772
  }
34684
34773
  var init_bit_ops = __esm({
34685
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
34774
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/bit-ops.js"() {
34686
34775
  }
34687
34776
  });
34688
34777
 
34689
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
34778
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js
34690
34779
  function f1(x, y, z) {
34691
34780
  return x & y | ~x & z;
34692
34781
  }
@@ -34710,7 +34799,7 @@ function md4(message) {
34710
34799
  }
34711
34800
  var INITIAL_STATE, K22, K3, ROUND1, ROUND2, ROUND3;
34712
34801
  var init_md4 = __esm({
34713
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
34802
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/digests/md4.js"() {
34714
34803
  init_bit_ops();
34715
34804
  INITIAL_STATE = [1732584193, 4023233417, 2562383102, 271733878];
34716
34805
  K22 = 1518500249;
@@ -90725,7 +90814,7 @@ var init_metro_blob_collect = __esm({
90725
90814
  }
90726
90815
  });
90727
90816
 
90728
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
90817
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js
90729
90818
  function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0) {
90730
90819
  const header = new Uint8Array(8);
90731
90820
  const view = new DataView(header.buffer);
@@ -90740,7 +90829,7 @@ function record(recType, data, recInstance = 0, isContainer2 = false, recVer = 0
90740
90829
  }
90741
90830
  var ByteWriter;
90742
90831
  var init_byte_writer = __esm({
90743
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
90832
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/byte-writer.js"() {
90744
90833
  ByteWriter = class {
90745
90834
  chunks = [];
90746
90835
  length = 0;
@@ -90823,13 +90912,13 @@ var init_byte_writer = __esm({
90823
90912
  }
90824
90913
  });
90825
90914
 
90826
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
90915
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js
90827
90916
  function masterToEmu(mu) {
90828
90917
  return Math.round(mu * EMU_PER_MASTER);
90829
90918
  }
90830
90919
  var RT, OA, TEXT_TYPE, HEADER_TOKEN_PLAIN, HEADER_TOKEN_ENCRYPTED, EMU_PER_MASTER;
90831
90920
  var init_legacy_ppt_record_types = __esm({
90832
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
90921
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-types.js"() {
90833
90922
  RT = {
90834
90923
  Document: 1e3,
90835
90924
  DocumentAtom: 1001,
@@ -90958,14 +91047,14 @@ var init_legacy_ppt_record_types = __esm({
90958
91047
  }
90959
91048
  });
90960
91049
 
90961
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
91050
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js
90962
91051
  var init_record_types = __esm({
90963
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
91052
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-types.js"() {
90964
91053
  init_legacy_ppt_record_types();
90965
91054
  }
90966
91055
  });
90967
91056
 
90968
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
91057
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js
90969
91058
  function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
90970
91059
  const nameBytes = new ByteWriter().ansi(USER_NAME).toBytes();
90971
91060
  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();
@@ -90979,7 +91068,7 @@ function buildCurrentUserStream(offsetToCurrentEdit, encrypted) {
90979
91068
  }
90980
91069
  var USER_NAME, CURRENT_USER_STREAM_SIZE;
90981
91070
  var init_current_user_writer = __esm({
90982
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
91071
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/current-user-writer.js"() {
90983
91072
  init_record_types();
90984
91073
  init_byte_writer();
90985
91074
  USER_NAME = "pptx-viewer";
@@ -90987,7 +91076,7 @@ var init_current_user_writer = __esm({
90987
91076
  }
90988
91077
  });
90989
91078
 
90990
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
91079
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js
90991
91080
  function pictureUid(picture) {
90992
91081
  return md4(picture.bytes);
90993
91082
  }
@@ -91010,7 +91099,7 @@ function buildFbse(picture, uid, foDelay, size) {
91010
91099
  }
91011
91100
  var MSOBLIP_PICT, BLIP_INFO;
91012
91101
  var init_blip_writer = __esm({
91013
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
91102
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/blip-writer.js"() {
91014
91103
  init_md4();
91015
91104
  init_png_encoder();
91016
91105
  init_record_types();
@@ -91026,7 +91115,7 @@ var init_blip_writer = __esm({
91026
91115
  }
91027
91116
  });
91028
91117
 
91029
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
91118
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js
91030
91119
  function boolPropValue(flag, bit, useBit) {
91031
91120
  return useBit | (flag ? bit : 0);
91032
91121
  }
@@ -91062,7 +91151,7 @@ function buildMetroBlobTertiaryFopt(metroBlob) {
91062
91151
  }
91063
91152
  var OPT, FBID_FLAG, METRO_BLOB_OPID;
91064
91153
  var init_fopt_writer = __esm({
91065
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
91154
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/fopt-writer.js"() {
91066
91155
  init_record_types();
91067
91156
  init_byte_writer();
91068
91157
  OPT = {
@@ -91090,7 +91179,7 @@ var init_fopt_writer = __esm({
91090
91179
  }
91091
91180
  });
91092
91181
 
91093
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
91182
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js
91094
91183
  function buildDggDefaultProperties() {
91095
91184
  return buildFopt([
91096
91185
  { id: 385, value: 134217732 },
@@ -91148,7 +91237,7 @@ function buildPictureStore(pictures, shapesPerDrawing) {
91148
91237
  }
91149
91238
  var SHAPE_ID_CLUSTER_SIZE;
91150
91239
  var init_bstore_writer = __esm({
91151
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
91240
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/bstore-writer.js"() {
91152
91241
  init_record_types();
91153
91242
  init_blip_writer();
91154
91243
  init_byte_writer();
@@ -91157,7 +91246,7 @@ var init_bstore_writer = __esm({
91157
91246
  }
91158
91247
  });
91159
91248
 
91160
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
91249
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js
91161
91250
  function buildFontEntityAtom(name, index) {
91162
91251
  const nameBytes = new ByteWriter().utf16(name.slice(0, 31)).u16(0).toBytes();
91163
91252
  const padded = new Uint8Array(LF_FACE_NAME_BYTES);
@@ -91185,14 +91274,14 @@ function buildEnvironment(fonts, otherTextStyle) {
91185
91274
  }
91186
91275
  var LF_FACE_NAME_BYTES;
91187
91276
  var init_font_collection_writer = __esm({
91188
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
91277
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/font-collection-writer.js"() {
91189
91278
  init_record_types();
91190
91279
  init_byte_writer();
91191
91280
  LF_FACE_NAME_BYTES = 64;
91192
91281
  }
91193
91282
  });
91194
91283
 
91195
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
91284
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js
91196
91285
  function emuToMaster(emu2) {
91197
91286
  return Math.round(emu2 / EMU_PER_MASTER);
91198
91287
  }
@@ -91248,7 +91337,7 @@ function buildDocumentContainer(input) {
91248
91337
  }
91249
91338
  var MASTER_SLIDE_ID_SENTINEL, RT_CSTRING, RT_BINARY_TAG_DATA_BLOB;
91250
91339
  var init_document_writer = __esm({
91251
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
91340
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-writer.js"() {
91252
91341
  init_record_types();
91253
91342
  init_byte_writer();
91254
91343
  init_font_collection_writer();
@@ -91258,7 +91347,7 @@ var init_document_writer = __esm({
91258
91347
  }
91259
91348
  });
91260
91349
 
91261
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
91350
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js
91262
91351
  function buildCString(text2, recInstance) {
91263
91352
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
91264
91353
  }
@@ -91394,7 +91483,7 @@ function buildTextInteractiveInfoAtom(beginChar, endChar) {
91394
91483
  }
91395
91484
  var II_ACTION, II_JUMP, LT, FLAG_CUSTOM_SHOW_RETURN, HyperlinkCollector;
91396
91485
  var init_hyperlink_writer = __esm({
91397
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
91486
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/hyperlink-writer.js"() {
91398
91487
  init_record_types();
91399
91488
  init_byte_writer();
91400
91489
  II_ACTION = {
@@ -91457,7 +91546,7 @@ var init_hyperlink_writer = __esm({
91457
91546
  }
91458
91547
  });
91459
91548
 
91460
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
91549
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js
91461
91550
  function buildCString2(text2, recInstance) {
91462
91551
  return record(RT.CString, new ByteWriter().utf16(text2).toBytes(), recInstance, false, 0);
91463
91552
  }
@@ -91493,7 +91582,7 @@ function buildMediaExObjEntries(media) {
91493
91582
  }
91494
91583
  var MediaCollector, SOUND_EXTENSION_WAV, SOUND_LENGTH_UNKNOWN;
91495
91584
  var init_media_writer = __esm({
91496
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
91585
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/media-writer.js"() {
91497
91586
  init_record_types();
91498
91587
  init_byte_writer();
91499
91588
  MediaCollector = class {
@@ -91529,7 +91618,7 @@ var init_media_writer = __esm({
91529
91618
  }
91530
91619
  });
91531
91620
 
91532
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
91621
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js
91533
91622
  function hexToBytes(hex3) {
91534
91623
  const out = new Uint8Array(hex3.length / 2);
91535
91624
  for (let i = 0; i < out.length; i++) {
@@ -91591,7 +91680,7 @@ function buildExObjRefAtom(exObjId) {
91591
91680
  }
91592
91681
  var PACKAGE_ROOT_CLSID, COMP_OBJ_HEX, EX_OLE_EMBEDDED, DV_ASPECT_ICON, EX_OLE_SUB_DEFAULT, PACKAGER_MENU_NAME, OleCollector;
91593
91682
  var init_ole_writer = __esm({
91594
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
91683
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ole-writer.js"() {
91595
91684
  init_ole2_parser_write();
91596
91685
  init_record_types();
91597
91686
  init_byte_writer();
@@ -91651,7 +91740,7 @@ var init_ole_writer = __esm({
91651
91740
  }
91652
91741
  });
91653
91742
 
91654
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
91743
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js
91655
91744
  function buildExObjList(hyperlinks, ole, media) {
91656
91745
  const oleEntries = ole?.all ?? [];
91657
91746
  const mediaEntries = media?.all ?? [];
@@ -91678,7 +91767,7 @@ function buildExObjList(hyperlinks, ole, media) {
91678
91767
  return record(RT.ExternalObjectList, w.toBytes(), 0, true);
91679
91768
  }
91680
91769
  var init_ex_obj_list_writer = __esm({
91681
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
91770
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ex-obj-list-writer.js"() {
91682
91771
  init_record_types();
91683
91772
  init_byte_writer();
91684
91773
  init_hyperlink_writer();
@@ -91687,7 +91776,7 @@ var init_ex_obj_list_writer = __esm({
91687
91776
  }
91688
91777
  });
91689
91778
 
91690
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
91779
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js
91691
91780
  function emuToMaster2(emu2) {
91692
91781
  return Math.round(emu2 / EMU_PER_MASTER);
91693
91782
  }
@@ -91732,7 +91821,7 @@ function buildChildAnchor(rect2) {
91732
91821
  }
91733
91822
  var INT16_MIN, INT16_MAX;
91734
91823
  var init_anchor_writer = __esm({
91735
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
91824
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/anchor-writer.js"() {
91736
91825
  init_record_types();
91737
91826
  init_byte_writer();
91738
91827
  INT16_MIN = -32768;
@@ -91740,7 +91829,7 @@ var init_anchor_writer = __esm({
91740
91829
  }
91741
91830
  });
91742
91831
 
91743
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
91832
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js
91744
91833
  function parseHex(rgb) {
91745
91834
  const hex3 = (rgb ?? DEFAULT_RGB).replace(/^#/u, "");
91746
91835
  if (!/^[0-9a-fA-F]{6}$/u.test(hex3)) {
@@ -91762,12 +91851,12 @@ function encodeColorIndex(rgb) {
91762
91851
  }
91763
91852
  var DEFAULT_RGB;
91764
91853
  var init_colors = __esm({
91765
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
91854
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/colors.js"() {
91766
91855
  DEFAULT_RGB = "000000";
91767
91856
  }
91768
91857
  });
91769
91858
 
91770
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
91859
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js
91771
91860
  function writePfException(w, para) {
91772
91861
  let mask = 0;
91773
91862
  if (para.hasBullet !== void 0) {
@@ -91857,7 +91946,7 @@ function writeCfException(w, run, fontIndex) {
91857
91946
  }
91858
91947
  var ALIGN_CODE, EMU_PER_MASTER_UNIT;
91859
91948
  var init_text_exception_writer = __esm({
91860
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
91949
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-exception-writer.js"() {
91861
91950
  init_colors();
91862
91951
  ALIGN_CODE = {
91863
91952
  l: 0,
@@ -91869,7 +91958,7 @@ var init_text_exception_writer = __esm({
91869
91958
  }
91870
91959
  });
91871
91960
 
91872
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
91961
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js
91873
91962
  function joinParagraphText(body) {
91874
91963
  return body.paragraphs.map((p) => p.runs.map((r) => r.text).join("")).join("\r");
91875
91964
  }
@@ -91930,7 +92019,7 @@ function buildTextAtoms(body, fonts, hyperlinks) {
91930
92019
  return new ByteWriter().bytes(buildTextHeaderAtom(body.textType)).bytes(buildTextCharsAtom(text2)).bytes(buildStyleTextPropAtom(body, fontIndex)).bytes(buildRunHyperlinks(body, hyperlinks)).toBytes();
91931
92020
  }
91932
92021
  var init_text_atom_writer = __esm({
91933
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
92022
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/text-atom-writer.js"() {
91934
92023
  init_record_types();
91935
92024
  init_byte_writer();
91936
92025
  init_hyperlink_writer();
@@ -91938,7 +92027,7 @@ var init_text_atom_writer = __esm({
91938
92027
  }
91939
92028
  });
91940
92029
 
91941
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
92030
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js
91942
92031
  function utf16z(text2) {
91943
92032
  return new ByteWriter().utf16(text2).u16(0).toBytes();
91944
92033
  }
@@ -92035,7 +92124,7 @@ function buildMasterPlaceholders(placeholders, allocator, fieldFontIndex) {
92035
92124
  }
92036
92125
  var FSP_FLAGS, RECTANGLE_SPT, TEXT_TYPE_TITLE, TEXT_TYPE_BODY, TEXT_TYPE_OTHER, SPECS, MASTER_PLACEHOLDER_ORDER, TITLE_PROMPT, BODY_PROMPT, DEFAULT_FRAMES;
92037
92126
  var init_master_placeholders_writer = __esm({
92038
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
92127
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-placeholders-writer.js"() {
92039
92128
  init_record_types();
92040
92129
  init_anchor_writer();
92041
92130
  init_byte_writer();
@@ -92102,18 +92191,18 @@ var init_master_placeholders_writer = __esm({
92102
92191
  }
92103
92192
  });
92104
92193
 
92105
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
92194
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js
92106
92195
  function masterStyleFonts(styles) {
92107
92196
  if (!styles)
92108
92197
  return [];
92109
92198
  return [styles.title, styles.body, styles.other].flatMap((levels) => levels ?? []).map((level2) => level2.run.fontName).filter((name) => Boolean(name));
92110
92199
  }
92111
92200
  var init_master_style_fonts = __esm({
92112
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
92201
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-style-fonts.js"() {
92113
92202
  }
92114
92203
  });
92115
92204
 
92116
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
92205
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js
92117
92206
  function buildMasterStyleAtom(recInstance, levels, fontIndex) {
92118
92207
  const w = new ByteWriter().u16(levels.length);
92119
92208
  for (const level2 of levels) {
@@ -92144,7 +92233,7 @@ function buildMasterTextStyles(styles, fontIndex) {
92144
92233
  }
92145
92234
  var EMPTY_LEVELS, FIXED_INSTANCE_DATA;
92146
92235
  var init_master_text_styles_writer = __esm({
92147
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
92236
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-text-styles-writer.js"() {
92148
92237
  init_record_types();
92149
92238
  init_byte_writer();
92150
92239
  init_text_exception_writer();
@@ -92160,7 +92249,7 @@ var init_master_text_styles_writer = __esm({
92160
92249
  }
92161
92250
  });
92162
92251
 
92163
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
92252
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js
92164
92253
  function fillEntries(fill) {
92165
92254
  if (!fill || fill.kind === "none") {
92166
92255
  return [{ id: OPT.fNoFillHitTest, value: boolPropValue(false, 16, 1048576) }];
@@ -92215,7 +92304,7 @@ function buildShapeFoptProps(input) {
92215
92304
  }
92216
92305
  var DASH_CODE;
92217
92306
  var init_shape_props_writer = __esm({
92218
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
92307
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-props-writer.js"() {
92219
92308
  init_colors();
92220
92309
  init_fopt_writer();
92221
92310
  DASH_CODE = {
@@ -92230,7 +92319,7 @@ var init_shape_props_writer = __esm({
92230
92319
  }
92231
92320
  });
92232
92321
 
92233
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
92322
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js
92234
92323
  function buildShapeAnchor(rect2, inGroup) {
92235
92324
  return inGroup ? buildChildAnchor(rect2) : buildClientAnchor(rect2);
92236
92325
  }
@@ -92332,7 +92421,7 @@ function buildMediaShapeContainer(media, allocator, hyperlinks, mediaEmbeds, inG
92332
92421
  }
92333
92422
  var FSP_FLAG_FLIPH, FSP_FLAG_FLIPV, FSP_FLAG_OLE_SHAPE, FSP_FLAG_CHILD, PLACEHOLDER_ID;
92334
92423
  var init_shape_writer = __esm({
92335
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
92424
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-writer.js"() {
92336
92425
  init_record_types();
92337
92426
  init_anchor_writer();
92338
92427
  init_byte_writer();
@@ -92354,7 +92443,7 @@ var init_shape_writer = __esm({
92354
92443
  }
92355
92444
  });
92356
92445
 
92357
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
92446
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js
92358
92447
  function buildFspgr(childRect) {
92359
92448
  return record(OA.FSPGR, buildChildAnchorData(childRect), 0, false, 1);
92360
92449
  }
@@ -92395,7 +92484,7 @@ function buildGroupContainer(group, fonts, allocator, hyperlinks, oleEmbeds, med
92395
92484
  }
92396
92485
  var FSP_FLAG_GROUP, FSP_FLAG_PATRIARCH, FSP_FLAG_HAVE_ANCHOR, ZERO_RECT;
92397
92486
  var init_group_writer = __esm({
92398
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
92487
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/group-writer.js"() {
92399
92488
  init_record_types();
92400
92489
  init_anchor_writer();
92401
92490
  init_byte_writer();
@@ -92407,10 +92496,10 @@ var init_group_writer = __esm({
92407
92496
  }
92408
92497
  });
92409
92498
 
92410
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
92499
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js
92411
92500
  var ShapeIdAllocator2;
92412
92501
  var init_shape_id_allocator = __esm({
92413
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
92502
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/shape-id-allocator.js"() {
92414
92503
  ShapeIdAllocator2 = class {
92415
92504
  current;
92416
92505
  constructor(drawingId, clusterSize) {
@@ -92436,7 +92525,7 @@ var init_shape_id_allocator = __esm({
92436
92525
  }
92437
92526
  });
92438
92527
 
92439
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
92528
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js
92440
92529
  function buildDg(drawingId, shapeCount, lastShapeId) {
92441
92530
  const data = new ByteWriter().u32(shapeCount + 1).u32(lastShapeId).toBytes();
92442
92531
  return record(OA.Dg, data, drawingId, false, 0);
@@ -92467,7 +92556,7 @@ function buildDrawing(canvasRect, shapes, backgroundRgb, fonts, drawingId, hyper
92467
92556
  }
92468
92557
  var FSP_FLAG_BACKGROUND, BACKGROUND_RECT_SPT, SHAPE_ID_CLUSTER_SIZE2;
92469
92558
  var init_drawing_writer = __esm({
92470
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
92559
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/drawing-writer.js"() {
92471
92560
  init_record_types();
92472
92561
  init_byte_writer();
92473
92562
  init_colors();
@@ -92480,7 +92569,7 @@ var init_drawing_writer = __esm({
92480
92569
  }
92481
92570
  });
92482
92571
 
92483
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
92572
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js
92484
92573
  function buildNotesAtom(slidePersistIdRef) {
92485
92574
  const data = new ByteWriter().i32(slidePersistIdRef).u16(0).u16(0).toBytes();
92486
92575
  return record(RT.NotesAtom, data, 0, false, 1);
@@ -92498,16 +92587,16 @@ function buildNotesContainer(paragraphs, notesRect, slidePersistIdRef, fonts, dr
92498
92587
  return record(RT.Notes, data, 0, true);
92499
92588
  }
92500
92589
  var init_notes_writer = __esm({
92501
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
92590
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/notes-writer.js"() {
92502
92591
  init_record_types();
92503
92592
  init_byte_writer();
92504
92593
  init_drawing_writer();
92505
92594
  }
92506
92595
  });
92507
92596
 
92508
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
92597
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js
92509
92598
  function readRecord(view, offset) {
92510
- if (offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
92599
+ if (!Number.isSafeInteger(offset) || offset < 0 || offset + RECORD_HEADER_SIZE > view.byteLength) {
92511
92600
  return void 0;
92512
92601
  }
92513
92602
  const verAndInstance = view.getUint16(offset, true);
@@ -92535,6 +92624,9 @@ function isContainer(rec) {
92535
92624
  return rec.recVer === 15;
92536
92625
  }
92537
92626
  function* iterateRecords(view, start, end) {
92627
+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || end < start) {
92628
+ return;
92629
+ }
92538
92630
  let offset = start;
92539
92631
  const limit = Math.min(end, view.byteLength);
92540
92632
  while (offset + RECORD_HEADER_SIZE <= limit) {
@@ -92561,16 +92653,19 @@ function findChild4(view, container2, recType, recInstance) {
92561
92653
  return void 0;
92562
92654
  }
92563
92655
  function findDescendant(view, container2, recType, recInstance) {
92564
- for (const child27 of iterateChildren(view, container2)) {
92656
+ const stack = [iterateChildren(view, container2)];
92657
+ while (stack.length > 0) {
92658
+ const next = stack[stack.length - 1].next();
92659
+ if (next.done) {
92660
+ stack.pop();
92661
+ continue;
92662
+ }
92663
+ const child27 = next.value;
92565
92664
  if (child27.recType === recType && (recInstance === void 0)) {
92566
92665
  return child27;
92567
92666
  }
92568
- if (isContainer(child27)) {
92569
- const found = findDescendant(view, child27, recType, recInstance);
92570
- if (found) {
92571
- return found;
92572
- }
92573
- }
92667
+ if (isContainer(child27))
92668
+ stack.push(iterateChildren(view, child27));
92574
92669
  }
92575
92670
  return void 0;
92576
92671
  }
@@ -92579,7 +92674,7 @@ function recordBytes(data, rec) {
92579
92674
  }
92580
92675
  var PptParseError, RECORD_HEADER_SIZE;
92581
92676
  var init_legacy_ppt_record_stream = __esm({
92582
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
92677
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-record-stream.js"() {
92583
92678
  PptParseError = class extends Error {
92584
92679
  constructor(message) {
92585
92680
  super(message);
@@ -92590,14 +92685,14 @@ var init_legacy_ppt_record_stream = __esm({
92590
92685
  }
92591
92686
  });
92592
92687
 
92593
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
92688
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js
92594
92689
  var init_record_stream = __esm({
92595
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
92690
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/record-stream.js"() {
92596
92691
  init_legacy_ppt_record_stream();
92597
92692
  }
92598
92693
  });
92599
92694
 
92600
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
92695
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js
92601
92696
  function toHex3(r, g, b) {
92602
92697
  return [r, g, b].map((v) => (v & 255).toString(16).padStart(2, "0").toUpperCase()).join("");
92603
92698
  }
@@ -92648,7 +92743,7 @@ function resolveEscherColor(colorRef, scheme) {
92648
92743
  }
92649
92744
  var SCHEME, DEFAULT_SCHEME;
92650
92745
  var init_color_scheme = __esm({
92651
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
92746
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/color-scheme.js"() {
92652
92747
  init_record_stream();
92653
92748
  init_record_types();
92654
92749
  SCHEME = {
@@ -92674,7 +92769,7 @@ var init_color_scheme = __esm({
92674
92769
  }
92675
92770
  });
92676
92771
 
92677
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
92772
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js
92678
92773
  function buildColorSchemeAtom(recInstance = 1, colors) {
92679
92774
  const w = new ByteWriter();
92680
92775
  for (const rgb of colors?.length === 8 ? colors : DEFAULT_SCHEME) {
@@ -92683,7 +92778,7 @@ function buildColorSchemeAtom(recInstance = 1, colors) {
92683
92778
  return record(RT.ColorSchemeAtom, w.toBytes(), recInstance, false, 0);
92684
92779
  }
92685
92780
  var init_color_scheme_writer = __esm({
92686
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
92781
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/color-scheme-writer.js"() {
92687
92782
  init_color_scheme();
92688
92783
  init_record_types();
92689
92784
  init_byte_writer();
@@ -92691,7 +92786,7 @@ var init_color_scheme_writer = __esm({
92691
92786
  }
92692
92787
  });
92693
92788
 
92694
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
92789
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js
92695
92790
  function buildSlideAtomRaw(geom, masterIdRef, notesIdRef, flags) {
92696
92791
  const data = new ByteWriter().i32(geom).bytes(new Uint8Array(8)).u32(masterIdRef).i32(notesIdRef).u16(flags).u16(0).toBytes();
92697
92792
  return record(RT.SlideAtom, data, 0, false, 2);
@@ -92728,7 +92823,7 @@ function buildMainMasterContainer(slideRect, drawingId, hyperlinks, oleEmbeds, m
92728
92823
  }
92729
92824
  var SLIDE_FLAG_MASTER_OBJECTS, SLIDE_FLAG_MASTER_SCHEME, SLIDE_FLAG_MASTER_BACKGROUND, SLIDE_MASTER_ID_SENTINEL, MASTER_FIRST_COLOR_SCHEME_INSTANCE;
92730
92825
  var init_slide_writer = __esm({
92731
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
92826
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/slide-writer.js"() {
92732
92827
  init_record_types();
92733
92828
  init_byte_writer();
92734
92829
  init_color_scheme_writer();
@@ -92743,7 +92838,7 @@ var init_slide_writer = __esm({
92743
92838
  }
92744
92839
  });
92745
92840
 
92746
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
92841
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js
92747
92842
  function masterSlideId(index) {
92748
92843
  return MASTER_SLIDE_ID_SENTINEL + index;
92749
92844
  }
@@ -92867,7 +92962,7 @@ function ensureMinimumDocumentStreamSize(contentSizeWithoutPadding, maxPersistId
92867
92962
  }
92868
92963
  var DOC_ID, MASTER_ID;
92869
92964
  var init_document_stream_layout = __esm({
92870
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
92965
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/document-stream-layout.js"() {
92871
92966
  init_bstore_writer();
92872
92967
  init_byte_writer();
92873
92968
  init_document_writer();
@@ -92885,15 +92980,15 @@ var init_document_stream_layout = __esm({
92885
92980
  }
92886
92981
  });
92887
92982
 
92888
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
92983
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js
92889
92984
  var RC4_ALG_ID2;
92890
92985
  var init_crypto_constants = __esm({
92891
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
92986
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/crypto-constants.js"() {
92892
92987
  RC4_ALG_ID2 = 26625;
92893
92988
  }
92894
92989
  });
92895
92990
 
92896
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
92991
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js
92897
92992
  function rc4Cipher(key2, data) {
92898
92993
  if (key2.length === 0) {
92899
92994
  throw new Error("RC4 key must not be empty.");
@@ -92924,11 +93019,11 @@ function rc4Cipher(key2, data) {
92924
93019
  return out;
92925
93020
  }
92926
93021
  var init_rc4_cipher = __esm({
92927
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
93022
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/utils/rc4-cipher.js"() {
92928
93023
  }
92929
93024
  });
92930
93025
 
92931
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
93026
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js
92932
93027
  async function rc4CryptoApiKeyBase(password, salt) {
92933
93028
  return hash("SHA-1", concatArrays(salt, encodePasswordUtf16LE(password)));
92934
93029
  }
@@ -92969,14 +93064,14 @@ async function rc4CryptoApiEncryptVerifier(key0, verifier) {
92969
93064
  }
92970
93065
  var PADDED_40_BIT_KEY_BYTES;
92971
93066
  var init_rc4_cryptoapi_key = __esm({
92972
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
93067
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-key.js"() {
92973
93068
  init_ooxml_crypto_primitives();
92974
93069
  init_rc4_cipher();
92975
93070
  PADDED_40_BIT_KEY_BYTES = 16;
92976
93071
  }
92977
93072
  });
92978
93073
 
92979
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
93074
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js
92980
93075
  function readHeader(bytes) {
92981
93076
  const view = new DataView(bytes.buffer, bytes.byteOffset, RECORD_HEADER_SIZE);
92982
93077
  return {
@@ -93045,7 +93140,7 @@ async function cipherPicturesStream(stream, keyFor2, mode) {
93045
93140
  }
93046
93141
  var UID_SIZE, METAFILE_HEADER_SIZE, BITMAP_TAG_SIZE, METAFILE_BLIPS, BITMAP_BLIPS;
93047
93142
  var init_rc4_cryptoapi_streams = __esm({
93048
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
93143
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/rc4-cryptoapi-streams.js"() {
93049
93144
  init_rc4_cipher();
93050
93145
  init_record_stream();
93051
93146
  UID_SIZE = 16;
@@ -93056,7 +93151,7 @@ var init_rc4_cryptoapi_streams = __esm({
93056
93151
  }
93057
93152
  });
93058
93153
 
93059
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
93154
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js
93060
93155
  async function buildCryptSession(password) {
93061
93156
  const salt = new Uint8Array(SALT_SIZE);
93062
93157
  crypto.getRandomValues(salt);
@@ -93084,7 +93179,7 @@ async function encryptPicturesStream(stream, ctx) {
93084
93179
  }
93085
93180
  var CSP_NAME, KEY_SIZE_BITS, SALT_SIZE, VERIFIER_SIZE, VERIFIER_HASH_SIZE, ENCRYPTION_FLAGS;
93086
93181
  var init_encrypt_writer = __esm({
93087
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
93182
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/encrypt-writer.js"() {
93088
93183
  init_crypto_constants();
93089
93184
  init_rc4_cryptoapi_key();
93090
93185
  init_rc4_cryptoapi_streams();
@@ -93099,7 +93194,7 @@ var init_encrypt_writer = __esm({
93099
93194
  }
93100
93195
  });
93101
93196
 
93102
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
93197
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js
93103
93198
  function levelsFor(styles, textType) {
93104
93199
  switch (textType) {
93105
93200
  case 0:
@@ -93165,12 +93260,12 @@ function withMasterRelativeRunStyles(deck) {
93165
93260
  }
93166
93261
  var STYLE_KEYS;
93167
93262
  var init_master_relative_runs = __esm({
93168
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
93263
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/master-relative-runs.js"() {
93169
93264
  STYLE_KEYS = ["bold", "italic", "underline"];
93170
93265
  }
93171
93266
  });
93172
93267
 
93173
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
93268
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js
93174
93269
  function buildPersistDirectoryAtom(entries) {
93175
93270
  const sorted = [...entries].sort((a, b) => a[0] - b[0]);
93176
93271
  const w = new ByteWriter();
@@ -93200,17 +93295,17 @@ function buildEncryptedUserEditAtom(input) {
93200
93295
  }
93201
93296
  var MAX_RUN;
93202
93297
  var init_persist_writer = __esm({
93203
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
93298
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/persist-writer.js"() {
93204
93299
  init_record_types();
93205
93300
  init_byte_writer();
93206
93301
  MAX_RUN = 4095;
93207
93302
  }
93208
93303
  });
93209
93304
 
93210
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
93305
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js
93211
93306
  var PPT_STORAGE_CLSID;
93212
93307
  var init_ppt_clsid = __esm({
93213
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
93308
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/ppt-clsid.js"() {
93214
93309
  PPT_STORAGE_CLSID = new Uint8Array([
93215
93310
  16,
93216
93311
  141,
@@ -93232,7 +93327,7 @@ var init_ppt_clsid = __esm({
93232
93327
  }
93233
93328
  });
93234
93329
 
93235
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
93330
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js
93236
93331
  async function finishUnencrypted(layout, lastSlideId) {
93237
93332
  const w = new ByteWriter().append(layout.bytes);
93238
93333
  const dirAtom = buildPersistDirectoryAtom(layout.offsets);
@@ -93286,7 +93381,7 @@ async function buildPptFile(deck, options = {}) {
93286
93381
  return new Uint8Array(buildOle2(streams2, PPT_STORAGE_CLSID, 0));
93287
93382
  }
93288
93383
  var init_write_ppt = __esm({
93289
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
93384
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/writer/write-ppt.js"() {
93290
93385
  init_ole2_parser_write();
93291
93386
  init_byte_writer();
93292
93387
  init_current_user_writer();
@@ -93298,9 +93393,9 @@ var init_write_ppt = __esm({
93298
93393
  }
93299
93394
  });
93300
93395
 
93301
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
93396
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js
93302
93397
  var init_legacy_ppt_writer = __esm({
93303
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
93398
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/legacy-ppt-writer.js"() {
93304
93399
  init_write_ppt();
93305
93400
  init_master_style_fonts();
93306
93401
  }
@@ -131667,61 +131762,115 @@ var init_deflate_utils = __esm({
131667
131762
  }
131668
131763
  });
131669
131764
 
131670
- // node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
131671
- function parseUserEditAtom(view, offset) {
131765
+ // node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js
131766
+ function checkedLimit(value) {
131767
+ if (!Number.isSafeInteger(value) || value < 1)
131768
+ throw new PptParseError("Invalid persist directory resource limit");
131769
+ return value;
131770
+ }
131771
+ function boundedAtom(view, offset, type) {
131672
131772
  const rec = readRecordOrThrow(view, offset);
131673
- if (rec.recType !== RT.UserEditAtom) {
131674
- throw new PptParseError(`Expected UserEditAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
131773
+ if (rec.recType !== type || rec.recVer !== 0 || rec.recInstance !== 0) {
131774
+ throw new PptParseError(`Invalid persist atom header at offset ${offset}`);
131675
131775
  }
131776
+ if (rec.recLen > view.byteLength - rec.dataOffset) {
131777
+ throw new PptParseError(`Persist atom payload out of bounds at offset ${offset}`);
131778
+ }
131779
+ return rec;
131780
+ }
131781
+ function parseUserEditAtom(view, offset) {
131782
+ const rec = boundedAtom(view, offset, RT.UserEditAtom);
131676
131783
  if (rec.recLen !== 28 && rec.recLen !== 32) {
131677
131784
  throw new PptParseError(`UserEditAtom has invalid length ${rec.recLen}`);
131678
131785
  }
131679
131786
  const d = rec.dataOffset;
131680
- return {
131787
+ const edit = {
131681
131788
  offsetLastEdit: view.getUint32(d + 8, true),
131682
131789
  offsetPersistDirectory: view.getUint32(d + 12, true),
131683
131790
  docPersistIdRef: view.getUint32(d + 16, true),
131684
131791
  encryptSessionPersistIdRef: rec.recLen === 32 ? view.getUint32(d + 28, true) : void 0
131685
131792
  };
131686
- }
131687
- function parsePersistDirectoryAtom(view, offset) {
131688
- const rec = readRecordOrThrow(view, offset);
131689
- if (rec.recType !== RT.PersistDirectoryAtom) {
131690
- throw new PptParseError(`Expected PersistDirectoryAtom at offset ${offset}, found recType 0x${rec.recType.toString(16)}`);
131793
+ if (view.getUint8(d + 6) !== 0 || view.getUint8(d + 7) !== 3) {
131794
+ throw new PptParseError("Unsupported UserEditAtom storage version");
131795
+ }
131796
+ if (edit.offsetLastEdit >= offset || edit.offsetPersistDirectory <= edit.offsetLastEdit || edit.offsetPersistDirectory >= offset) {
131797
+ throw new PptParseError("Invalid UserEditAtom save history offsets");
131691
131798
  }
131799
+ if (edit.docPersistIdRef !== 1)
131800
+ throw new PptParseError("Invalid document persist identifier");
131801
+ return edit;
131802
+ }
131803
+ function parsePersistDirectoryAtom(view, offset, maxEntries = DEFAULT_MAX_ENTRIES) {
131804
+ checkedLimit(maxEntries);
131805
+ const rec = boundedAtom(view, offset, RT.PersistDirectoryAtom);
131692
131806
  const pairs = [];
131693
131807
  let pos2 = rec.dataOffset;
131694
131808
  const end = rec.dataOffset + rec.recLen;
131695
- while (pos2 + 4 <= end) {
131809
+ const seen = /* @__PURE__ */ new Set();
131810
+ while (pos2 < end) {
131811
+ if (end - pos2 < 4)
131812
+ throw new PptParseError("Truncated persist directory entry");
131696
131813
  const packed = view.getUint32(pos2, true);
131697
131814
  const persistId = packed & 1048575;
131698
131815
  const cPersist = packed >>> 20 & 4095;
131699
131816
  pos2 += 4;
131700
- for (let i = 0; i < cPersist && pos2 + 4 <= end; i++, pos2 += 4) {
131701
- pairs.push([persistId + i, view.getUint32(pos2, true)]);
131817
+ if (persistId > 1048574 || cPersist === 0 || persistId + cPersist - 1 > 1048575) {
131818
+ throw new PptParseError("Invalid persist identifier run");
131819
+ }
131820
+ if (cPersist * 4 > end - pos2)
131821
+ throw new PptParseError("Truncated persist offset run");
131822
+ if (pairs.length + cPersist > maxEntries)
131823
+ throw new PptParseError("Persist directory entry limit exceeded");
131824
+ for (let i = 0; i < cPersist; i++, pos2 += 4) {
131825
+ const id = persistId + i;
131826
+ if (seen.has(id))
131827
+ throw new PptParseError("Duplicate persist identifier");
131828
+ seen.add(id);
131829
+ const objectOffset = view.getUint32(pos2, true);
131830
+ if (objectOffset >= offset || objectOffset + 8 > view.byteLength)
131831
+ throw new PptParseError("Persist object offset out of bounds");
131832
+ pairs.push([id, objectOffset]);
131702
131833
  }
131703
131834
  }
131704
131835
  return pairs;
131705
131836
  }
131706
- function buildPersistDirectory(view, offsetToCurrentEdit) {
131837
+ function buildPersistDirectory(view, offsetToCurrentEdit, limits = {}) {
131838
+ const maxEdits = checkedLimit(limits.maxEdits ?? DEFAULT_MAX_EDITS);
131839
+ const maxEntries = checkedLimit(limits.maxEntries ?? DEFAULT_MAX_ENTRIES);
131707
131840
  const edits = [];
131841
+ const editOffsets = [];
131708
131842
  const seen = /* @__PURE__ */ new Set();
131709
131843
  let offset = offsetToCurrentEdit;
131710
131844
  while (offset !== 0) {
131845
+ if (edits.length >= maxEdits)
131846
+ throw new PptParseError("User edit chain limit exceeded");
131711
131847
  if (seen.has(offset)) {
131712
131848
  throw new PptParseError(`Circular UserEditAtom chain at offset ${offset}`);
131713
131849
  }
131714
131850
  seen.add(offset);
131715
131851
  const edit = parseUserEditAtom(view, offset);
131716
131852
  edits.push(edit);
131853
+ editOffsets.push(offset);
131717
131854
  offset = edit.offsetLastEdit;
131718
131855
  }
131719
131856
  if (edits.length === 0) {
131720
131857
  throw new PptParseError("No UserEditAtom found");
131721
131858
  }
131722
131859
  const directory = /* @__PURE__ */ new Map();
131860
+ let entryCount = 0;
131723
131861
  for (let i = edits.length - 1; i >= 0; i--) {
131724
- for (const [id, off] of parsePersistDirectoryAtom(view, edits[i].offsetPersistDirectory)) {
131862
+ const edit = edits[i];
131863
+ const dirAtom = boundedAtom(view, edit.offsetPersistDirectory, RT.PersistDirectoryAtom);
131864
+ const editOffset = editOffsets[i];
131865
+ if (dirAtom.dataOffset + dirAtom.recLen > editOffset)
131866
+ throw new PptParseError("Persist directory overlaps user edit");
131867
+ const entries = parsePersistDirectoryAtom(view, edit.offsetPersistDirectory, maxEntries);
131868
+ entryCount += entries.length;
131869
+ if (entryCount > maxEntries)
131870
+ throw new PptParseError("Save history persist entry limit exceeded");
131871
+ for (const [id, off] of entries) {
131872
+ if (off < edit.offsetLastEdit)
131873
+ throw new PptParseError("Persist object precedes corresponding user edit");
131725
131874
  directory.set(id, off);
131726
131875
  }
131727
131876
  }
@@ -131732,12 +131881,18 @@ function readPersistRecord(view, directory, persistId) {
131732
131881
  if (offset === void 0) {
131733
131882
  return void 0;
131734
131883
  }
131735
- return readRecordOrThrow(view, offset);
131884
+ const rec = readRecordOrThrow(view, offset);
131885
+ if (rec.recLen > view.byteLength - rec.dataOffset)
131886
+ throw new PptParseError("Persist object payload out of bounds");
131887
+ return rec;
131736
131888
  }
131889
+ var DEFAULT_MAX_EDITS, DEFAULT_MAX_ENTRIES;
131737
131890
  var init_persist_directory = __esm({
131738
- "node_modules/.bun/@christophervr+ole2@0.4.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
131891
+ "node_modules/.bun/@christophervr+ole2@0.8.0/node_modules/@christophervr/ole2/dist/ppt/persist-directory.js"() {
131739
131892
  init_record_stream();
131740
131893
  init_record_types();
131894
+ DEFAULT_MAX_EDITS = 1e4;
131895
+ DEFAULT_MAX_ENTRIES = 1e6;
131741
131896
  }
131742
131897
  });
131743
131898