@poe-platform/safe-bash 0.1.754 → 0.1.755

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.
Files changed (51) hide show
  1. package/dist/image-ast/index.browser.js +13 -1
  2. package/dist/image-ast/index.js +13 -1
  3. package/dist/pdf-ast/fonts/truetype.d.ts +1 -0
  4. package/dist/pdf-ast/index.js +13 -1
  5. package/dist/safe-bash/chunks/{chunk-R2WG64VB.js → chunk-6XDKK63A.js} +14 -2
  6. package/dist/safe-bash/chunks/{chunk-3W6CRM25.js → chunk-JEFBTRY7.js} +553 -289
  7. package/dist/safe-bash/chunks/{chunk-WNB4XH45.js → chunk-QHB7HBLA.js} +3 -3
  8. package/dist/safe-bash/chunks/{chunk-37Y7GZTK.js → chunk-RSAWYAEH.js} +2 -2
  9. package/dist/safe-bash/chunks/{pdf-renderer-DHQDZC6N.js → pdf-renderer-XIFUTX34.js} +3 -3
  10. package/dist/safe-bash/chunks/{src-S52LORVD.js → src-V4VCM5OX.js} +5 -3
  11. package/dist/safe-bash/command-chunks/{chunk-IJHV6I6X.js → chunk-3DOHQQJR.js} +8 -6
  12. package/dist/safe-bash/command-chunks/chunk-IDR3WWKI.js +46 -0
  13. package/dist/safe-bash/command-chunks/{chunk-XAZ3NTJ4.js → chunk-KB2LQ4HG.js} +2 -2
  14. package/dist/safe-bash/command-chunks/{chunk-YY7HJMBG.js → chunk-KOM3FNCE.js} +1 -37
  15. package/dist/safe-bash/command-chunks/{chunk-CM4SVTIA.js → chunk-MENC7RPR.js} +1 -1
  16. package/dist/safe-bash/command-chunks/chunk-QQOAK7JQ.js +888 -0
  17. package/dist/safe-bash/command-chunks/{chunk-BE4AM2JW.js → chunk-UGX6MXDD.js} +5 -3
  18. package/dist/safe-bash/command-chunks/{chunk-PUOJAS3O.js → chunk-XRVNFK7Z.js} +13 -1
  19. package/dist/safe-bash/commands/ssconvert/index.d.ts +1 -2
  20. package/dist/safe-bash/commands/ssconvert/index.js +6 -260
  21. package/dist/safe-bash/core.browser.js +5 -207
  22. package/dist/safe-bash-command-csvkit/index.js +277 -49
  23. package/dist/safe-bash-command-ffmpeg/index.js +1723 -1717
  24. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  25. package/dist/safe-bash-command-pandoc/command.js +3 -3
  26. package/dist/safe-bash-command-pandoc/index.js +3 -3
  27. package/dist/safe-bash-command-pdfimages/index.js +13 -1
  28. package/dist/safe-bash-command-pdfinfo/index.js +13 -1
  29. package/dist/safe-bash-command-pdftk/index.js +13 -1
  30. package/dist/safe-bash-command-pdftoppm/index.js +13 -1
  31. package/dist/safe-bash-command-pdftotext/index.js +13 -1
  32. package/dist/safe-bash-command-qpdf/index.js +13 -1
  33. package/dist/safe-bash-command-sips/index.js +2 -2
  34. package/dist/safe-bash-command-soffice/index.js +5 -4
  35. package/dist/safe-bash-command-ssconvert/formats/csv.js +4 -3
  36. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +4 -2
  37. package/dist/safe-bash-command-ssconvert/formats/xls.js +10 -666
  38. package/dist/safe-bash-command-ssconvert/index.d.ts +1 -0
  39. package/dist/safe-bash-command-ssconvert/index.js +680 -390
  40. package/dist/safe-bash-command-ssconvert/sync.d.ts +7 -0
  41. package/dist/safe-bash-command-timeout/index.js +1 -1
  42. package/dist/safe-bash-command-wkhtmltopdf/index.js +13 -1
  43. package/dist/spreadsheet-format-csv/text-export.d.ts +14 -0
  44. package/dist/spreadsheet-format-csv/text-export.js +2 -2
  45. package/dist/spreadsheet-format-xls/biff-binary.d.ts +7 -2
  46. package/dist/spreadsheet-format-xls/biff-binary.js +10 -1
  47. package/dist/spreadsheet-format-xls/biff-strings.d.ts +2 -3
  48. package/dist/spreadsheet-format-xls/biff-strings.js +14 -2
  49. package/package.json +2 -3
  50. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +7 -0
  51. package/dist/safe-bash/command-chunks/chunk-MPUNHXWI.js +0 -205
@@ -1,14 +1,21 @@
1
1
  import {
2
+ BiffStrings,
3
+ Binary,
4
+ invalidBiff,
5
+ isCfb,
6
+ readBiffRecords,
2
7
  readCfb
3
- } from "../safe-bash/command-chunks/chunk-MPUNHXWI.js";
8
+ } from "../safe-bash/command-chunks/chunk-QQOAK7JQ.js";
4
9
  import "../safe-bash/command-chunks/chunk-5VSGEE6J.js";
5
10
  import "../safe-bash/command-chunks/chunk-SG3ZDZCX.js";
11
+ import "../safe-bash/command-chunks/chunk-KOM3FNCE.js";
6
12
  import "../safe-bash/command-chunks/chunk-CT3FB722.js";
7
13
  import "../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
8
14
  import "../safe-bash/command-chunks/chunk-WOPU2VWF.js";
9
15
  import "../safe-bash/command-chunks/chunk-A6NFLWZI.js";
10
16
  import "../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
11
17
  import {
18
+ SsconvertError,
12
19
  formatA1,
13
20
  parseA1
14
21
  } from "../safe-bash/command-chunks/chunk-F5MORDSU.js";
@@ -15454,8 +15461,244 @@ var formats = Object.freeze([csv, dbf, fixed, geojson, json3, ndjson, xls, xlsx]
15454
15461
 
15455
15462
  // packages/safe-bash-command-csvkit/dist/operations/workbook-input.js
15456
15463
  init_buffer();
15457
- import { read, set_cptable } from "@e965/xlsx";
15458
- import * as codepages from "@e965/xlsx/dist/cpexcel";
15464
+
15465
+ // packages/spreadsheet-format-xls/src/cached.ts
15466
+ init_buffer();
15467
+ function readCachedBiff(bytes, options) {
15468
+ options.signal.throwIfAborted();
15469
+ options.work();
15470
+ const streams = isCfb(bytes) ? readCfb(bytes, options) : void 0;
15471
+ const stream = streams ? streams.get("Workbook") ?? streams.get("Book") : bytes;
15472
+ if (!stream) invalidBiff("No Workbook or Book streams found");
15473
+ const records = readBiffRecords(stream, options);
15474
+ const first = records[0];
15475
+ if (!first || ![9, 521, 1033, 2057].includes(first.opcode)) invalidBiff("missing BOF");
15476
+ let revision = 8, codepage = 28591, date1904 = false, cells = 0, legacyFormats = 0, ixfe;
15477
+ const formats2 = /* @__PURE__ */ new Map(), xfs = [], strings = [];
15478
+ const bounds = /* @__PURE__ */ new Map();
15479
+ const legacyNames = [];
15480
+ const sheets = [];
15481
+ const sheetOffsets = /* @__PURE__ */ new Map();
15482
+ const scopes = [];
15483
+ let pending;
15484
+ const checkPending = () => {
15485
+ if (pending) invalidBiff("Expected STRING record after FORMULA");
15486
+ };
15487
+ const parts = (index, offset2) => {
15488
+ const data = records[index].data;
15489
+ options.retain(64);
15490
+ const chunks = [new Binary(data.slice(offset2, data.bytes.length - offset2))];
15491
+ while (records[index + 1]?.opcode === 60) {
15492
+ options.work();
15493
+ options.retain(64);
15494
+ chunks.push(records[++index].data);
15495
+ }
15496
+ return { chunks, next: index };
15497
+ };
15498
+ let override;
15499
+ const cursor = (chunks) => {
15500
+ if (revision < 8 && override === void 0 && options.encoding !== void 0)
15501
+ override = typeof options.encoding === "number" ? options.encoding : options.encoding();
15502
+ return new BiffStrings(chunks, options, revision < 8 ? override ?? codepage : codepage);
15503
+ };
15504
+ const add = (sheet, row, column, xf, type, value, directFormat) => {
15505
+ options.work();
15506
+ if (row >= (revision >= 8 ? 65536 : 16384) || column >= 256) invalidBiff("cell outside worksheet");
15507
+ if (++cells > options.limits.cells) throw new SsconvertError("resource-limit", "BIFF cells limit exceeded");
15508
+ options.retain(128);
15509
+ const format3 = directFormat ?? xfs[xf] ?? 0;
15510
+ sheet.cells.push({ row, column, type, value, format: formats2.get(format3) ?? format3 });
15511
+ };
15512
+ for (let index = 0; index < records.length; index++) {
15513
+ options.signal.throwIfAborted();
15514
+ options.work();
15515
+ const { opcode, data, offset: offset2 } = records[index];
15516
+ if ([9, 521, 1033, 2057].includes(opcode)) {
15517
+ checkPending();
15518
+ revision = opcode === 9 ? 2 : opcode === 521 ? 3 : opcode === 1033 ? 4 : data.u16(0) === 1536 ? 8 : data.u16(0) === 1280 ? 5 : 0;
15519
+ if (!revision) invalidBiff("unsupported cached BIFF revision");
15520
+ const type2 = data.u16(2), bound = bounds.get(offset2);
15521
+ let sheet2;
15522
+ if (type2 === 16 && (!scopes.length || scopes[scopes.length - 1].type === 256) && (bound === void 0 || bound.type === 0)) {
15523
+ if (sheets.length >= options.limits.sheets) throw new SsconvertError("resource-limit", "BIFF sheets limit exceeded");
15524
+ const name = bound?.name ?? `Sheet${sheets.length + 1}`;
15525
+ options.retain(192 + name.length * 2);
15526
+ sheet2 = { name, cells: [] };
15527
+ sheets.push(sheet2);
15528
+ sheetOffsets.set(offset2, sheet2);
15529
+ }
15530
+ options.retain(64);
15531
+ scopes.push({ ...sheet2 ? { sheet: sheet2 } : {}, revision, type: type2 });
15532
+ continue;
15533
+ }
15534
+ if (opcode === 10) {
15535
+ checkPending();
15536
+ if (!scopes.length) invalidBiff("EOF without BOF");
15537
+ scopes.pop();
15538
+ revision = scopes[scopes.length - 1]?.revision ?? revision;
15539
+ continue;
15540
+ }
15541
+ const scope = scopes[scopes.length - 1];
15542
+ if (!scope) invalidBiff("record outside BOF/EOF");
15543
+ if (!scope.sheet && scope.type !== 5 && scope.type !== 256) continue;
15544
+ if (opcode === 47) throw new SsconvertError("unsupported-feature", "Workbook is encrypted");
15545
+ if (opcode === 66) {
15546
+ codepage = data.u16(0);
15547
+ continue;
15548
+ }
15549
+ if (opcode === 34) {
15550
+ date1904 = data.u16(0) !== 0;
15551
+ continue;
15552
+ }
15553
+ if (opcode === 133) {
15554
+ if (revision === 4 && scope.type === 256) {
15555
+ const text3 = cursor([new Binary(data.slice(1, data.bytes.length - 1))]);
15556
+ options.retain(16);
15557
+ legacyNames.push(text3.legacy(data.u8(0)));
15558
+ continue;
15559
+ }
15560
+ const target = data.u32(0), length = data.u8(6), type2 = data.u8(5);
15561
+ if (target >= stream.length || bounds.has(target)) invalidBiff("invalid BOUNDSHEET offset");
15562
+ const text2 = cursor([new Binary(data.slice(7, data.bytes.length - 7))]);
15563
+ const name = revision >= 8 ? text2.unicode(length).text : text2.legacy(length);
15564
+ options.retain(96);
15565
+ bounds.set(target, { name, type: type2 });
15566
+ continue;
15567
+ }
15568
+ if (opcode === 143 && revision === 4 && scope.type === 256) {
15569
+ const target = offset2 + 4 + data.bytes.length, length = data.u32(0);
15570
+ if (target + length > stream.length || !length) invalidBiff("invalid SHEETHDR length");
15571
+ const name = cursor([new Binary(data.slice(5, data.bytes.length - 5))]).legacy(data.u8(4));
15572
+ if (name !== legacyNames[bounds.size]) invalidBiff("SHEETHDR name differs from BOUNDSHEET");
15573
+ options.retain(96);
15574
+ bounds.set(target, { name, type: 0 });
15575
+ formats2.clear();
15576
+ xfs.length = 0;
15577
+ legacyFormats = 0;
15578
+ ixfe = void 0;
15579
+ continue;
15580
+ }
15581
+ if (opcode === 252) {
15582
+ const count = data.u32(4);
15583
+ if (count > data.u32(0)) invalidBiff("invalid SST count");
15584
+ if (options.namesOnly) continue;
15585
+ const joined = parts(index, 8);
15586
+ index = joined.next;
15587
+ const text2 = cursor(joined.chunks);
15588
+ for (let entry = 0; entry < count; entry++) {
15589
+ options.work();
15590
+ options.retain(16);
15591
+ strings.push(text2.unicode(text2.word()).text);
15592
+ }
15593
+ continue;
15594
+ }
15595
+ if (options.namesOnly) continue;
15596
+ if (opcode === 30 || opcode === 1054) {
15597
+ const id = revision >= 5 ? data.u16(0) : legacyFormats++;
15598
+ const at = revision >= 4 ? 2 : 0, length = revision >= 8 ? data.u16(at) : data.u8(at);
15599
+ const joined = parts(index, at + (revision >= 8 ? 2 : 1));
15600
+ index = joined.next;
15601
+ const text2 = cursor(joined.chunks);
15602
+ options.retain(64);
15603
+ formats2.set(id, revision >= 8 ? text2.unicode(length).text : text2.legacy(length));
15604
+ continue;
15605
+ }
15606
+ if ([224, 67, 579, 1091].includes(opcode)) {
15607
+ options.retain(8);
15608
+ xfs.push(revision >= 5 ? data.u16(2) : revision >= 3 ? data.u8(1) : data.u8(2) & 63);
15609
+ continue;
15610
+ }
15611
+ if (opcode === 68) {
15612
+ ixfe = data.u16(0);
15613
+ continue;
15614
+ }
15615
+ const sheet = scope.sheet;
15616
+ if (!sheet) continue;
15617
+ if (opcode === 7 || opcode === 519) {
15618
+ if (!pending || pending.sheet !== sheet) invalidBiff("STRING without FORMULA");
15619
+ const length = revision === 2 ? data.u8(0) : data.u16(0);
15620
+ const joined = parts(index, revision === 2 ? 1 : 2);
15621
+ index = joined.next;
15622
+ const text2 = cursor(joined.chunks);
15623
+ const value2 = length === 0 ? "" : revision >= 8 ? text2.unicode(length).text : text2.legacy(length);
15624
+ sheet.cells[pending.index] = { ...sheet.cells[pending.index], value: value2 };
15625
+ pending = void 0;
15626
+ continue;
15627
+ }
15628
+ if (opcode === 189) {
15629
+ checkPending();
15630
+ const row2 = data.u16(0), start2 = data.u16(2), end = data.u16(data.bytes.length - 2);
15631
+ if (end < start2 || end >= 256 || data.bytes.length !== 6 + (end - start2 + 1) * 6) invalidBiff("invalid MULRK");
15632
+ for (let column2 = start2; column2 <= end; column2++) {
15633
+ const at = 4 + (column2 - start2) * 6;
15634
+ add(sheet, row2, column2, data.u16(at), "n", rk(data.u32(at + 2)));
15635
+ }
15636
+ continue;
15637
+ }
15638
+ if (![2, 3, 4, 5, 6, 515, 516, 517, 518, 1030, 638, 253, 214].includes(opcode)) continue;
15639
+ checkPending();
15640
+ const row = data.u16(0), column = data.u16(2), start = revision === 2 ? 7 : 6;
15641
+ let xf = revision === 2 ? data.u8(4) & 63 : data.u16(4);
15642
+ if (revision === 2 && xfs.length && xf === 63) {
15643
+ if (ixfe === void 0) invalidBiff("BIFF2 XF index 63 without IXFE");
15644
+ xf = ixfe;
15645
+ }
15646
+ const directFormat = revision === 2 && !xfs.length ? data.u8(5) & 63 : void 0;
15647
+ let type = "n", value;
15648
+ if (opcode === 2) value = data.u16(7);
15649
+ else if (opcode === 3 || opcode === 515) value = data.f64(start);
15650
+ else if (opcode === 638) value = rk(data.u32(6));
15651
+ else if (opcode === 5 || opcode === 517) {
15652
+ type = data.u8(start + 1) ? "e" : "b";
15653
+ value = type === "e" ? data.u8(start) : !!data.u8(start);
15654
+ } else if (opcode === 253) {
15655
+ const entry = strings[data.u32(6)];
15656
+ if (entry === void 0) invalidBiff("invalid shared string index");
15657
+ type = "s";
15658
+ value = entry;
15659
+ } else if (opcode === 6 || opcode === 518 || opcode === 1030) {
15660
+ if (data.u16(start + 6) !== 65535) value = data.f64(start);
15661
+ else {
15662
+ const tag = data.u8(start);
15663
+ if (tag > 3) invalidBiff("invalid formula cache tag");
15664
+ type = tag === 1 ? "b" : tag === 2 ? "e" : "s";
15665
+ value = tag === 1 ? !!data.u8(start + 2) : tag === 2 ? data.u8(start + 2) : "";
15666
+ if (tag === 0) pending = { sheet, index: sheet.cells.length };
15667
+ }
15668
+ } else {
15669
+ const length = revision === 2 ? data.u8(7) : data.u16(6);
15670
+ const joined = parts(index, 8);
15671
+ index = joined.next;
15672
+ const text2 = cursor(joined.chunks);
15673
+ type = "s";
15674
+ value = revision >= 8 ? text2.unicode(length).text : text2.legacy(length);
15675
+ }
15676
+ add(sheet, row, column, xf, type, value, directFormat);
15677
+ }
15678
+ checkPending();
15679
+ if (scopes.length) invalidBiff("missing EOF");
15680
+ if (!bounds.size) return { sheets, date1904 };
15681
+ const ordered = [];
15682
+ for (const [offset2, bound] of bounds) {
15683
+ options.work();
15684
+ if (bound.type !== 0) continue;
15685
+ const sheet = sheetOffsets.get(offset2);
15686
+ if (!sheet) invalidBiff("missing bound worksheet");
15687
+ options.retain(8);
15688
+ ordered.push(sheet);
15689
+ }
15690
+ return { sheets: ordered, date1904 };
15691
+ }
15692
+ function rk(bits) {
15693
+ let value;
15694
+ if (bits & 2) value = bits >> 2;
15695
+ else {
15696
+ const data = new DataView(new ArrayBuffer(8));
15697
+ data.setUint32(4, bits & 4294967292, true);
15698
+ value = data.getFloat64(0, true);
15699
+ }
15700
+ return bits & 1 ? value / 100 : value;
15701
+ }
15459
15702
 
15460
15703
  // packages/xlsx-ast/src/index.ts
15461
15704
  init_buffer();
@@ -15761,7 +16004,6 @@ function legacyWorkbookDateFormat(format3, step) {
15761
16004
 
15762
16005
  // packages/safe-bash-command-csvkit/dist/operations/workbook-input.js
15763
16006
  var workbookAddressBounds = { rows: Number.MAX_SAFE_INTEGER, columns: Number.MAX_SAFE_INTEGER };
15764
- set_cptable(codepages);
15765
16007
  var WorkbookInput = class {
15766
16008
  runtime;
15767
16009
  format;
@@ -15878,46 +16120,46 @@ var WorkbookInput = class {
15878
16120
  } else if (!(bytes[0] === 208 && bytes[1] === 207 || bytes[0] === 9 && [0, 2, 4, 8].includes(bytes[1]))) {
15879
16121
  throw new CsvkitBlocked("XLS non-OLE/non-BIFF input");
15880
16122
  }
15881
- let book;
15882
16123
  try {
15883
- let readerBytes = bytes;
15884
- let codepage;
15885
- const stream = !namesOnly && r.options.encoding_xls ? workbookBiffStream(bytes, r) : void 0;
15886
- if (stream && !unicodeBiff(stream)) {
15887
- codepage = xlsCodepage(String(r.options.encoding_xls));
15888
- r.retain(stream.length);
15889
- readerBytes = Uint8Array.from(stream);
15890
- for (let offset2 = 0; offset2 + 4 <= readerBytes.length; ) {
16124
+ const limits = r.context.limits;
16125
+ const cached = readCachedBiff(bytes, {
16126
+ signal: r.context.signal,
16127
+ work: r.step,
16128
+ retain: (bytes2) => r.retain(bytes2),
16129
+ namesOnly,
16130
+ limits: {
16131
+ inputBytes: limits.maxInputBytes,
16132
+ workbookNodes: limits.maxWork,
16133
+ workbookTextBytes: limits.maxRetainedBytes,
16134
+ cells: limits.maxWork,
16135
+ sheets: limits.maxArchiveMembers
16136
+ },
16137
+ ...r.options.encoding_xls ? { encoding: () => xlsCodepage(String(r.options.encoding_xls)) } : {}
16138
+ });
16139
+ const sheets = /* @__PURE__ */ Object.create(null);
16140
+ for (const sheet of cached.sheets) {
16141
+ r.step();
16142
+ r.retain(128 + sheet.name.length * 2);
16143
+ const cells = /* @__PURE__ */ Object.create(null);
16144
+ let maxRow = -1, maxColumn = -1;
16145
+ for (const cell2 of sheet.cells) {
15891
16146
  r.step();
15892
- const type = readerBytes[offset2] | readerBytes[offset2 + 1] << 8;
15893
- const length = readerBytes[offset2 + 2] | readerBytes[offset2 + 3] << 8;
15894
- if (offset2 + 4 + length > readerBytes.length)
15895
- throw new CsvkitBlocked("truncated XLS BIFF record");
15896
- if (type === 66 && length === 2) {
15897
- readerBytes[offset2 + 4] = codepage & 255;
15898
- readerBytes[offset2 + 5] = codepage >> 8;
15899
- }
15900
- offset2 += 4 + length;
16147
+ r.retain(128);
16148
+ cells[formatA1(cell2.row, cell2.column, workbookAddressBounds)] = { t: cell2.type, v: cell2.value, z: cell2.format };
16149
+ maxRow = Math.max(maxRow, cell2.row);
16150
+ maxColumn = Math.max(maxColumn, cell2.column);
15901
16151
  }
16152
+ if (maxRow >= 0)
16153
+ cells["!ref"] = `A1:${formatA1(maxRow, maxColumn, workbookAddressBounds)}`;
16154
+ sheets[sheet.name] = cells;
15902
16155
  }
15903
- book = read(readerBytes, {
15904
- type: "array",
15905
- cellDates: false,
15906
- cellNF: true,
15907
- cellFormula: false,
15908
- sheetStubs: true,
15909
- ...namesOnly ? { bookSheets: true } : {},
15910
- ...codepage === void 0 ? {} : { codepage }
15911
- });
16156
+ return { SheetNames: cached.sheets.map((sheet) => sheet.name), Sheets: sheets, Workbook: { WBProps: { date1904: cached.date1904 } } };
15912
16157
  } catch (failure) {
16158
+ r.context.signal.throwIfAborted();
15913
16159
  if (failure instanceof CsvkitDiagnostic)
15914
16160
  throw failure;
15915
16161
  throw new CsvkitBlocked(`in2csv ${this.format} parser: ${failure instanceof Error ? failure.message : String(failure)}`);
15916
16162
  }
15917
- r.step();
15918
- if (book.SheetNames.length > r.context.limits.maxArchiveMembers)
15919
- throw new CsvkitBlocked("workbook sheet budget exceeded");
15920
- return book;
15921
16163
  }
15922
16164
  async table(book, selection) {
15923
16165
  const r = this.runtime;
@@ -16143,20 +16385,6 @@ function xlsxDateFormat(format3, runtime) {
16143
16385
  }
16144
16386
  return false;
16145
16387
  }
16146
- function unicodeBiff(bytes) {
16147
- return bytes.length >= 6 && (bytes[4] | bytes[5] << 8) === 1536;
16148
- }
16149
- function workbookBiffStream(bytes, runtime) {
16150
- if (bytes[0] !== 208)
16151
- return bytes;
16152
- const streams = readCfb(bytes, {
16153
- signal: runtime.context.signal,
16154
- limits: { inputBytes: runtime.context.limits.maxInputBytes },
16155
- work: runtime.step,
16156
- retain: (size) => runtime.retain(size)
16157
- });
16158
- return streams.get("Workbook") ?? streams.get("Book") ?? bytes;
16159
- }
16160
16388
  function xlsCodepage(encoding) {
16161
16389
  const names = { "ascii": 20127, "utf-8": 65001, "utf8": 65001, "latin1": 28591, "latin-1": 28591, "cp1252": 1252, "windows-1252": 1252, "cp437": 437, "cp850": 850, "cp932": 932 };
16162
16390
  const codepage = names[encoding.toLowerCase()];