xls-codec 4.7.6 → 4.9.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.
Files changed (110) hide show
  1. package/README.md +11 -5
  2. package/dist/biff/cursor.cjs +12 -1
  3. package/dist/biff/cursor.d.cts +1 -1
  4. package/dist/biff/cursor.d.ts +1 -1
  5. package/dist/biff/cursor.js +12 -1
  6. package/dist/biff/ptg.cjs +16 -2
  7. package/dist/biff/ptg.d.cts +2 -2
  8. package/dist/biff/ptg.d.ts +2 -2
  9. package/dist/biff/ptg.js +16 -3
  10. package/dist/biff/record-types.cjs +25 -1
  11. package/dist/biff/record-types.d.cts +18 -2
  12. package/dist/biff/record-types.d.ts +18 -2
  13. package/dist/biff/record-types.js +18 -2
  14. package/dist/biff/strings.d.cts +1 -1
  15. package/dist/biff/strings.d.ts +1 -1
  16. package/dist/biff/substreams.cjs +7 -8
  17. package/dist/biff/substreams.d.cts +1 -1
  18. package/dist/biff/substreams.d.ts +1 -1
  19. package/dist/biff/substreams.js +7 -8
  20. package/dist/biff/xf-colors.d.cts +1 -1
  21. package/dist/biff/xf-colors.d.ts +1 -1
  22. package/dist/biff/xf-writer.d.cts +1 -1
  23. package/dist/biff/xf-writer.d.ts +1 -1
  24. package/dist/{conditional-format-12-D-X5g_O3.d.ts → conditional-format-12-C3nwy1f8.d.ts} +10 -5
  25. package/dist/{conditional-format-12-DBhe7Zo6.d.cts → conditional-format-12-D65-ruTq.d.cts} +10 -5
  26. package/dist/conditional-format-BRMUTRP1.d.ts +41 -0
  27. package/dist/conditional-format-Cth_afMy.d.cts +41 -0
  28. package/dist/content.cjs +50 -18
  29. package/dist/content.js +50 -18
  30. package/dist/{cursor-VMtw9uVP.d.cts → cursor-CnEuX5qE.d.cts} +3 -1
  31. package/dist/{cursor-VMtw9uVP.d.ts → cursor-CnEuX5qE.d.ts} +3 -1
  32. package/dist/{data-validation-DfpjUN-N.d.cts → data-validation-BgUt8CbE.d.cts} +2 -2
  33. package/dist/{data-validation-BXvIVU0e.d.ts → data-validation-Cq6iD8lB.d.ts} +2 -2
  34. package/dist/drawing/blips.cjs +83 -0
  35. package/dist/drawing/blips.d.cts +10 -0
  36. package/dist/drawing/blips.d.ts +10 -0
  37. package/dist/drawing/blips.js +82 -0
  38. package/dist/drawing/bytes.cjs +15 -0
  39. package/dist/drawing/bytes.d.cts +5 -0
  40. package/dist/drawing/bytes.d.ts +5 -0
  41. package/dist/drawing/bytes.js +14 -0
  42. package/dist/drawing/escher-constants.cjs +52 -0
  43. package/dist/drawing/escher-constants.d.cts +34 -0
  44. package/dist/drawing/escher-constants.d.ts +34 -0
  45. package/dist/drawing/escher-constants.js +34 -0
  46. package/dist/drawing/escher.cjs +84 -0
  47. package/dist/drawing/escher.d.cts +30 -0
  48. package/dist/drawing/escher.d.ts +30 -0
  49. package/dist/drawing/escher.js +80 -0
  50. package/dist/drawing/shapes.cjs +80 -0
  51. package/dist/drawing/shapes.d.cts +24 -0
  52. package/dist/drawing/shapes.d.ts +24 -0
  53. package/dist/drawing/shapes.js +79 -0
  54. package/dist/index.cjs +11 -1
  55. package/dist/index.d.cts +5 -5
  56. package/dist/index.d.ts +5 -5
  57. package/dist/index.js +4 -4
  58. package/dist/{print-names-CCwUHAoL.d.cts → print-names-B2OR0fvs.d.cts} +1 -1
  59. package/dist/{print-names-CxAbgcjB.d.ts → print-names-BXcmmwVi.d.ts} +1 -1
  60. package/dist/{ptg-CCBbJLZJ.d.cts → ptg-75v7MhaA.d.cts} +7 -1
  61. package/dist/{ptg-CCBbJLZJ.d.ts → ptg-75v7MhaA.d.ts} +7 -1
  62. package/dist/{substreams-Dp5cZoUo.d.ts → substreams-CgTHx5kX.d.ts} +1 -1
  63. package/dist/{substreams-CHv3oWmn.d.cts → substreams-XDNgDvRJ.d.cts} +1 -1
  64. package/dist/units.cjs +7 -0
  65. package/dist/units.d.cts +6 -1
  66. package/dist/units.d.ts +6 -1
  67. package/dist/units.js +6 -1
  68. package/dist/workbook/chart.cjs +230 -0
  69. package/dist/workbook/chart.d.cts +19 -0
  70. package/dist/workbook/chart.d.ts +19 -0
  71. package/dist/workbook/chart.js +229 -0
  72. package/dist/workbook/comments.cjs +2 -1
  73. package/dist/workbook/comments.d.cts +7 -2
  74. package/dist/workbook/comments.d.ts +7 -2
  75. package/dist/workbook/comments.js +2 -2
  76. package/dist/workbook/conditional-format-12.cjs +32 -1
  77. package/dist/workbook/conditional-format-12.d.cts +2 -2
  78. package/dist/workbook/conditional-format-12.d.ts +2 -2
  79. package/dist/workbook/conditional-format-12.js +33 -3
  80. package/dist/workbook/conditional-format-ex.cjs +53 -0
  81. package/dist/workbook/conditional-format-ex.d.cts +13 -0
  82. package/dist/workbook/conditional-format-ex.d.ts +13 -0
  83. package/dist/workbook/conditional-format-ex.js +52 -0
  84. package/dist/workbook/conditional-format.cjs +46 -23
  85. package/dist/workbook/conditional-format.d.cts +2 -2
  86. package/dist/workbook/conditional-format.d.ts +2 -2
  87. package/dist/workbook/conditional-format.js +46 -23
  88. package/dist/workbook/data-validation.d.cts +1 -1
  89. package/dist/workbook/data-validation.d.ts +1 -1
  90. package/dist/workbook/drawing.cjs +270 -0
  91. package/dist/workbook/drawing.d.cts +31 -0
  92. package/dist/workbook/drawing.d.ts +31 -0
  93. package/dist/workbook/drawing.js +268 -0
  94. package/dist/workbook/globals-writer.d.cts +2 -2
  95. package/dist/workbook/globals-writer.d.ts +2 -2
  96. package/dist/workbook/globals.d.cts +4 -4
  97. package/dist/workbook/globals.d.ts +4 -4
  98. package/dist/workbook/print-names.d.cts +1 -1
  99. package/dist/workbook/print-names.d.ts +1 -1
  100. package/dist/workbook/sheet-writer.cjs +1 -1
  101. package/dist/workbook/sheet-writer.js +1 -1
  102. package/dist/workbook/sheet.cjs +11 -0
  103. package/dist/workbook/sheet.d.cts +5 -5
  104. package/dist/workbook/sheet.d.ts +5 -5
  105. package/dist/workbook/sheet.js +12 -1
  106. package/dist/{xf-colors-mqerVt2O.d.cts → xf-colors-aeH9Ax3Q.d.cts} +1 -1
  107. package/dist/{xf-colors-d3OvRw76.d.ts → xf-colors-kdNsiNYt.d.ts} +1 -1
  108. package/package.json +1 -1
  109. package/dist/conditional-format-Czh2oTzQ.d.cts +0 -29
  110. package/dist/conditional-format-DOdazxWe.d.ts +0 -29
@@ -1,2 +1,2 @@
1
- import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-mqerVt2O.cjs";
1
+ import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-aeH9Ax3Q.cjs";
2
2
  export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, applyTint, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
@@ -1,2 +1,2 @@
1
- import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-d3OvRw76.js";
1
+ import { A as longRgbBytesOf, B as vertAlignTokenFor, C as UNDECORATED_XF_FIELDS, D as applyTint, E as XfDecorationFields, F as resolveHorizontalAlignment, I as resolveIcvColor, L as resolveVerticalAlignment, M as readLongRgbColor, N as resolveBorderEdge, O as borderStyleTokenFor, P as resolveFillBackground, R as unpackXfAlignment, S as PATTERN_TYPE_TO_FILL_PATTERN, T as XfBorderEdge, _ as FILL_PATTERN_SOLID, a as BORDER_STYLE_DOUBLE, b as PALETTE_BASE_ICV, c as BORDER_STYLE_MEDIUM_DASHDOT, d as BORDER_STYLE_NONE, f as BORDER_STYLE_SLANT_DASHDOT, g as FILL_PATTERN_NONE, h as DEFAULT_PALETTE_HEX_TO_ICV, i as BORDER_STYLE_DOTTED, j as packXfDecorationWords, k as horizAlignTokenFor, l as BORDER_STYLE_MEDIUM_DASHDOTDOT, m as BORDER_STYLE_THIN, n as BORDER_STYLE_DASHDOTDOT, o as BORDER_STYLE_HAIR, p as BORDER_STYLE_THICK, r as BORDER_STYLE_DASHED, s as BORDER_STYLE_MEDIUM, t as BORDER_STYLE_DASHDOT, u as BORDER_STYLE_MEDIUM_DASHED, v as ICV_AUTOMATIC_BACKGROUND, w as XfAlignmentFields, x as PALETTE_ENTRY_COUNT, y as ICV_AUTOMATIC_FOREGROUND, z as unpackXfDecoration } from "../xf-colors-kdNsiNYt.js";
2
2
  export { BORDER_STYLE_DASHDOT, BORDER_STYLE_DASHDOTDOT, BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_HAIR, BORDER_STYLE_MEDIUM, BORDER_STYLE_MEDIUM_DASHDOT, BORDER_STYLE_MEDIUM_DASHDOTDOT, BORDER_STYLE_MEDIUM_DASHED, BORDER_STYLE_NONE, BORDER_STYLE_SLANT_DASHDOT, BORDER_STYLE_THICK, BORDER_STYLE_THIN, DEFAULT_PALETTE_HEX_TO_ICV, FILL_PATTERN_NONE, FILL_PATTERN_SOLID, ICV_AUTOMATIC_BACKGROUND, ICV_AUTOMATIC_FOREGROUND, PALETTE_BASE_ICV, PALETTE_ENTRY_COUNT, PATTERN_TYPE_TO_FILL_PATTERN, UNDECORATED_XF_FIELDS, XfAlignmentFields, XfBorderEdge, XfDecorationFields, applyTint, borderStyleTokenFor, horizAlignTokenFor, longRgbBytesOf, packXfDecorationWords, readLongRgbColor, resolveBorderEdge, resolveFillBackground, resolveHorizontalAlignment, resolveIcvColor, resolveVerticalAlignment, unpackXfAlignment, unpackXfDecoration, vertAlignTokenFor };
@@ -1,4 +1,4 @@
1
- import { E as XfDecorationFields } from "../xf-colors-mqerVt2O.cjs";
1
+ import { E as XfDecorationFields } from "../xf-colors-aeH9Ax3Q.cjs";
2
2
  import { Alignment, Color } from "document-schema.js";
3
3
  //#region src/biff/xf-writer.d.ts
4
4
  /** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
@@ -1,4 +1,4 @@
1
- import { E as XfDecorationFields } from "../xf-colors-d3OvRw76.js";
1
+ import { E as XfDecorationFields } from "../xf-colors-kdNsiNYt.js";
2
2
  import { Alignment, Color } from "document-schema.js";
3
3
  //#region src/biff/xf-writer.d.ts
4
4
  /** Writes one cell-format XF record (fStyle=0): ifnt/ifmt as given, ixfParent pointing at the Normal cell-style XF (index 0), a CellXF payload carrying `alignment`/`verticalAlignment`/`decoration`'s own fields -- general alignment, bottom vertical alignment, and no fill/border (the same bytes this always wrote before either existed) for whatever is omitted. Twenty bytes total ([MS-XLS] 2.4.353). */
@@ -1,6 +1,6 @@
1
- import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
2
- import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
3
- import { i as RawConditionalFormatStyle } from "./conditional-format-DOdazxWe.js";
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.js";
2
+ import { t as RecordGroup } from "./substreams-CgTHx5kX.js";
3
+ import { a as RawConditionalFormatStyle } from "./conditional-format-BRMUTRP1.js";
4
4
  import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
5
5
  //#region src/workbook/conditional-format-12.d.ts
6
6
  type RawCfColor = {
@@ -65,7 +65,12 @@ interface RawTimePeriodFormat extends RawFilterFormatCommon {
65
65
  interface RawSimpleFilterFormat extends RawFilterFormatCommon {
66
66
  readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
67
67
  }
68
- type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
68
+ interface RawTextFilterFormat extends RawFilterFormatCommon {
69
+ readonly kind: "containsText" | "notContainsText" | "beginsWith" | "endsWith";
70
+ readonly text: string;
71
+ }
72
+ type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat | RawTextFilterFormat;
73
+ declare function readCfTextFilterRule(icfTemplate: number, templateParams: Uint8Array<ArrayBuffer>, rgce1: Uint8Array<ArrayBuffer>, formulaSheets: FormulaSheetContext): Omit<RawTextFilterFormat, keyof RawFilterFormatCommon> | undefined;
69
74
  interface CondFmt12GroupResult {
70
75
  readonly formats: RawConditionalFormat12[];
71
76
  /** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
@@ -73,4 +78,4 @@ interface CondFmt12GroupResult {
73
78
  }
74
79
  declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
75
80
  //#endregion
76
- export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
81
+ export { RawConditionalFormat12 as a, RawIconSetFormat as c, RawTimePeriod as d, RawTimePeriodFormat as f, readCondFmt12Group as h, RawColorScaleFormat as i, RawSimpleFilterFormat as l, readCfTextFilterRule as m, RawAboveAverageFormat as n, RawConditionalFormat12Common as o, RawTop10Format as p, RawCfColor as r, RawDataBarFormat as s, CondFmt12GroupResult as t, RawTextFilterFormat as u };
@@ -1,6 +1,6 @@
1
- import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
2
- import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
3
- import { i as RawConditionalFormatStyle } from "./conditional-format-Czh2oTzQ.cjs";
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.cjs";
2
+ import { t as RecordGroup } from "./substreams-XDNgDvRJ.cjs";
3
+ import { a as RawConditionalFormatStyle } from "./conditional-format-Cth_afMy.cjs";
4
4
  import { Color, ContentSheetConditionalFormat, ContentSheetConditionalFormatValue, ContentSheetRange } from "document-schema.js";
5
5
  //#region src/workbook/conditional-format-12.d.ts
6
6
  type RawCfColor = {
@@ -65,7 +65,12 @@ interface RawTimePeriodFormat extends RawFilterFormatCommon {
65
65
  interface RawSimpleFilterFormat extends RawFilterFormatCommon {
66
66
  readonly kind: "containsBlanks" | "notContainsBlanks" | "containsErrors" | "notContainsErrors" | "uniqueValues" | "duplicateValues";
67
67
  }
68
- type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat;
68
+ interface RawTextFilterFormat extends RawFilterFormatCommon {
69
+ readonly kind: "containsText" | "notContainsText" | "beginsWith" | "endsWith";
70
+ readonly text: string;
71
+ }
72
+ type RawConditionalFormat12 = RawColorScaleFormat | RawDataBarFormat | RawIconSetFormat | RawTop10Format | RawAboveAverageFormat | RawTimePeriodFormat | RawSimpleFilterFormat | RawTextFilterFormat;
73
+ declare function readCfTextFilterRule(icfTemplate: number, templateParams: Uint8Array<ArrayBuffer>, rgce1: Uint8Array<ArrayBuffer>, formulaSheets: FormulaSheetContext): Omit<RawTextFilterFormat, keyof RawFilterFormatCommon> | undefined;
69
74
  interface CondFmt12GroupResult {
70
75
  readonly formats: RawConditionalFormat12[];
71
76
  /** How many records (the CondFmt12 itself plus every CF12 it claimed) the caller should advance past, regardless of how many rules actually promoted. */
@@ -73,4 +78,4 @@ interface CondFmt12GroupResult {
73
78
  }
74
79
  declare function readCondFmt12Group(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmt12GroupResult;
75
80
  //#endregion
76
- export { RawConditionalFormat12 as a, RawSimpleFilterFormat as c, RawTop10Format as d, readCondFmt12Group as f, RawColorScaleFormat as i, RawTimePeriod as l, RawAboveAverageFormat as n, RawDataBarFormat as o, RawCfColor as r, RawIconSetFormat as s, CondFmt12GroupResult as t, RawTimePeriodFormat as u };
81
+ export { RawConditionalFormat12 as a, RawIconSetFormat as c, RawTimePeriod as d, RawTimePeriodFormat as f, readCondFmt12Group as h, RawColorScaleFormat as i, RawSimpleFilterFormat as l, readCfTextFilterRule as m, RawAboveAverageFormat as n, RawConditionalFormat12Common as o, RawTop10Format as p, RawCfColor as r, RawDataBarFormat as s, CondFmt12GroupResult as t, RawTextFilterFormat as u };
@@ -0,0 +1,41 @@
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.js";
2
+ import { t as RecordGroup } from "./substreams-CgTHx5kX.js";
3
+ import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
+ //#region src/workbook/conditional-format.d.ts
5
+ interface RawConditionalFormatFill {
6
+ readonly fillPattern: number;
7
+ readonly fillForegroundIcv: number;
8
+ readonly fillBackgroundIcv: number;
9
+ }
10
+ interface RawConditionalFormatStyle {
11
+ readonly fontColorIcv: number | undefined;
12
+ readonly fill: RawConditionalFormatFill | undefined;
13
+ }
14
+ interface RawConditionalFormat {
15
+ readonly operator: SheetRuleOperator;
16
+ readonly formula1: string;
17
+ readonly formula2: string | undefined;
18
+ readonly style: RawConditionalFormatStyle | undefined;
19
+ readonly ranges: ContentSheetRange[];
20
+ }
21
+ declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
22
+ /** A CF record's own operand, in its rawest usable form -- the pieces conditional-format-ex.ts needs to resolve a CFEx that extends this specific CF (by icf, a positional index into a CondFmt's own CF children), independent of whether readCf below can promote this CF into a 'cellIs' rule at all. A ct 0x02 formula condition, exactly the kind readCf itself never promotes, is the one CFEx actually cares about (see conditional-format-ex.ts's own top comment for why). */
23
+ interface RawCfOperand {
24
+ readonly ct: number;
25
+ readonly cp: number;
26
+ readonly rgce1: Uint8Array<ArrayBuffer>;
27
+ }
28
+ interface CondFmtGroupResult {
29
+ readonly formats: RawConditionalFormat[];
30
+ /** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
31
+ readonly recordsConsumed: number;
32
+ /** CondFmt's own nID ([MS-XLS] 2.5.56's own CondFmtStructure) -- the identifier a later CFEx record's own nID field cross-references to extend one specific CF child of this group (conditional-format-ex.ts). 0 on a malformed group, alongside an empty rawCfs -- a real CFEx can legitimately name nID 0, but never resolves anything through an empty rawCfs, so the two degraded groups can never be confused for one another by a lookup. */
33
+ readonly nID: number;
34
+ /** This group's own shared ranges, exposed independently of `formats` since a CFEx-promoted rule needs them too and a CF this reader could not promote into `formats` still shares them. */
35
+ readonly ranges: ContentSheetRange[];
36
+ /** Every one of this group's CF children, in declared (icf) order, each parsed to its raw operand or undefined for one this reader could not even parse -- CFExNonCF12's own icf field indexes into exactly this collection, regardless of which entries readCf itself went on to promote into `formats`. */
37
+ readonly rawCfs: readonly (RawCfOperand | undefined)[];
38
+ }
39
+ declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
40
+ //#endregion
41
+ export { RawConditionalFormatStyle as a, RawConditionalFormatFill as i, RawCfOperand as n, parseDxfStyle as o, RawConditionalFormat as r, readCondFmtGroup as s, CondFmtGroupResult as t };
@@ -0,0 +1,41 @@
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.cjs";
2
+ import { t as RecordGroup } from "./substreams-XDNgDvRJ.cjs";
3
+ import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
+ //#region src/workbook/conditional-format.d.ts
5
+ interface RawConditionalFormatFill {
6
+ readonly fillPattern: number;
7
+ readonly fillForegroundIcv: number;
8
+ readonly fillBackgroundIcv: number;
9
+ }
10
+ interface RawConditionalFormatStyle {
11
+ readonly fontColorIcv: number | undefined;
12
+ readonly fill: RawConditionalFormatFill | undefined;
13
+ }
14
+ interface RawConditionalFormat {
15
+ readonly operator: SheetRuleOperator;
16
+ readonly formula1: string;
17
+ readonly formula2: string | undefined;
18
+ readonly style: RawConditionalFormatStyle | undefined;
19
+ readonly ranges: ContentSheetRange[];
20
+ }
21
+ declare function parseDxfStyle(dxfBytes: Uint8Array<ArrayBuffer>): RawConditionalFormatStyle | undefined;
22
+ /** A CF record's own operand, in its rawest usable form -- the pieces conditional-format-ex.ts needs to resolve a CFEx that extends this specific CF (by icf, a positional index into a CondFmt's own CF children), independent of whether readCf below can promote this CF into a 'cellIs' rule at all. A ct 0x02 formula condition, exactly the kind readCf itself never promotes, is the one CFEx actually cares about (see conditional-format-ex.ts's own top comment for why). */
23
+ interface RawCfOperand {
24
+ readonly ct: number;
25
+ readonly cp: number;
26
+ readonly rgce1: Uint8Array<ArrayBuffer>;
27
+ }
28
+ interface CondFmtGroupResult {
29
+ readonly formats: RawConditionalFormat[];
30
+ /** How many records (the CondFmt itself plus every CF it claimed) the caller should advance past, regardless of how many rules actually promoted. */
31
+ readonly recordsConsumed: number;
32
+ /** CondFmt's own nID ([MS-XLS] 2.5.56's own CondFmtStructure) -- the identifier a later CFEx record's own nID field cross-references to extend one specific CF child of this group (conditional-format-ex.ts). 0 on a malformed group, alongside an empty rawCfs -- a real CFEx can legitimately name nID 0, but never resolves anything through an empty rawCfs, so the two degraded groups can never be confused for one another by a lookup. */
33
+ readonly nID: number;
34
+ /** This group's own shared ranges, exposed independently of `formats` since a CFEx-promoted rule needs them too and a CF this reader could not promote into `formats` still shares them. */
35
+ readonly ranges: ContentSheetRange[];
36
+ /** Every one of this group's CF children, in declared (icf) order, each parsed to its raw operand or undefined for one this reader could not even parse -- CFExNonCF12's own icf field indexes into exactly this collection, regardless of which entries readCf itself went on to promote into `formats`. */
37
+ readonly rawCfs: readonly (RawCfOperand | undefined)[];
38
+ }
39
+ declare function readCondFmtGroup(records: readonly RecordGroup[], startIndex: number, formulaSheets: FormulaSheetContext): CondFmtGroupResult;
40
+ //#endregion
41
+ export { RawConditionalFormatStyle as a, RawConditionalFormatFill as i, RawCfOperand as n, parseDxfStyle as o, RawConditionalFormat as r, readCondFmtGroup as s, CondFmtGroupResult as t };
package/dist/content.cjs CHANGED
@@ -6,7 +6,10 @@ const require_units = require("./units.cjs");
6
6
  const require_biff_print_setup = require("./biff/print-setup.cjs");
7
7
  const require_biff_substreams = require("./biff/substreams.cjs");
8
8
  const require_biff_xf_colors = require("./biff/xf-colors.cjs");
9
+ const require_drawing_blips = require("./drawing/blips.cjs");
10
+ const require_drawing_bytes = require("./drawing/bytes.cjs");
9
11
  const require_workbook_comments = require("./workbook/comments.cjs");
12
+ const require_workbook_drawing = require("./workbook/drawing.cjs");
10
13
  const require_serial = require("./serial.cjs");
11
14
  const require_workbook_globals = require("./workbook/globals.cjs");
12
15
  const require_workbook_sheet = require("./workbook/sheet.cjs");
@@ -91,16 +94,22 @@ function readXlsContent(bytes, password) {
91
94
  const globalsSubstream = substreams[0];
92
95
  if (globalsSubstream === void 0) throw new require_biff_records.BiffFormatError("workbook stream holds no substreams, so it carries no globals substream");
93
96
  const globals = require_workbook_globals.readWorkbookGlobals(globalsSubstream.records);
94
- const sheets = globals.sheets.map((entry, sheetIndex) => ({
95
- entry,
96
- sheetIndex
97
- })).filter(({ entry }) => entry.sheetType === SHEET_TYPE_WORKSHEET).map(({ entry, sheetIndex }) => readSheet(entry, sheetIndex, substreams, globals));
97
+ const blipStore = require_drawing_blips.readBlipStore(concatDrawingGroupBytes(globalsSubstream.records));
98
+ const documentMetadata = metadata === void 0 ? {} : (0, archive_codec.summaryInformationToLayoutMetadata)((0, archive_codec.readSummaryInformation)(metadata));
98
99
  return {
99
100
  kind: "spreadsheet",
100
- metadata: metadata === void 0 ? {} : (0, archive_codec.summaryInformationToLayoutMetadata)((0, archive_codec.readSummaryInformation)(metadata)),
101
- sheets
101
+ metadata: documentMetadata,
102
+ sheets: globals.sheets.map((entry, sheetIndex) => ({
103
+ entry,
104
+ sheetIndex
105
+ })).filter(({ entry }) => entry.sheetType === SHEET_TYPE_WORKSHEET).map(({ entry, sheetIndex }) => readSheet(entry, sheetIndex, substreams, globals, blipStore, documentMetadata))
102
106
  };
103
107
  }
108
+ /** Every MsoDrawingGroup record's own data, in stream order, concatenated into one Escher byte stream -- the workbook-wide counterpart of a worksheet's own MsoDrawing concatenation (drawing/shapes.ts's own readSheetShapes), carrying the Blip Store rather than any one sheet's shape tree. */
109
+ function concatDrawingGroupBytes(records) {
110
+ const chunks = records.filter((record) => record.type === 235).map((record) => record.blocks[0]).filter((block) => block !== void 0);
111
+ return require_drawing_bytes.concatBytes(chunks);
112
+ }
104
113
  /** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
105
114
  function readXls(bytes, password) {
106
115
  return (0, document_schema_js.assembleTree)(readXlsContent(bytes, password));
@@ -110,8 +119,17 @@ function readXls(bytes, password) {
110
119
  *
111
120
  * The substream is found by the byte offset BoundSheet8's lbPlyPos names, not by position: the order sheets appear in the workbook (which is BoundSheet8 order, and therefore the order of `globals.sheets`) is not required to match the order their substreams were written in. A sheet whose substream cannot be found still produces a ContentSheet, empty -- losing the sheet entirely would be a worse answer than losing its cells, since its name and position are real information the workbook did state.
112
121
  */
113
- function readSheet(entry, sheetIndex, substreams, globals) {
122
+ function readSheet(entry, sheetIndex, substreams, globals, blipStore, documentMetadata) {
114
123
  const substream = substreams.find((candidate) => candidate.offset === entry.bofPosition && candidate.documentType === 16);
124
+ const emptyPrint = {
125
+ marginsPt: {},
126
+ rowBreaks: [],
127
+ columnBreaks: []
128
+ };
129
+ const formulaSheets = {
130
+ sheets: globals.sheets,
131
+ sheetRanges: globals.sheetRanges
132
+ };
115
133
  const raw = substream === void 0 ? {
116
134
  cells: [],
117
135
  rows: [],
@@ -120,29 +138,33 @@ function readSheet(entry, sheetIndex, substreams, globals) {
120
138
  dataValidations: [],
121
139
  conditionalFormats: [],
122
140
  conditionalFormats12: [],
123
- print: {
124
- marginsPt: {},
125
- rowBreaks: [],
126
- columnBreaks: []
127
- }
128
- } : require_workbook_sheet.readSheetRecords(substream.records, globals.sharedStrings, {
129
- sheets: globals.sheets,
130
- sheetRanges: globals.sheetRanges
131
- });
141
+ print: emptyPrint
142
+ } : require_workbook_sheet.readSheetRecords(substream.records, globals.sharedStrings, formulaSheets);
132
143
  const comments = substream === void 0 ? /* @__PURE__ */ new Map() : require_workbook_comments.readSheetComments(substream.records);
133
144
  const cells = mapCells(raw, globals);
134
145
  applyCellComments(comments, cells);
135
146
  const dataValidations = mapDataValidations(raw.dataValidations);
136
147
  const conditionalFormats = [...mapConditionalFormats(raw.conditionalFormats, globals.palette), ...mapConditionalFormats12(raw.conditionalFormats12, globals.palette)];
148
+ const drawing = require_workbook_drawing.readSheetDrawing(substream?.records ?? [], {
149
+ blipStore,
150
+ columns: raw.columns,
151
+ rows: raw.rows,
152
+ ownSheetIndex: sheetIndex,
153
+ formulaSheets,
154
+ ownSheetCells: cells,
155
+ metadata: documentMetadata,
156
+ allSubstreams: substreams
157
+ });
137
158
  return {
138
159
  name: entry.name,
139
160
  cells,
140
161
  columns: mapColumns(raw),
141
162
  rows: mapRows(raw),
142
- images: [],
163
+ images: [...drawing.images],
143
164
  printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
144
165
  ...dataValidations.length > 0 ? { dataValidations } : {},
145
- ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
166
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {},
167
+ ...drawing.embeddedObjects.length > 0 ? { embeddedObjects: [...drawing.embeddedObjects] } : {}
146
168
  };
147
169
  }
148
170
  function mapConditionalFormats(raw, palette) {
@@ -234,6 +256,16 @@ function mapConditionalFormats12(raw, palette) {
234
256
  });
235
257
  continue;
236
258
  }
259
+ if (format.kind === "containsText" || format.kind === "notContainsText" || format.kind === "beginsWith" || format.kind === "endsWith") {
260
+ const style = mapConditionalFormatStyle(format.style, palette);
261
+ results.push({
262
+ type: format.kind,
263
+ text: format.text,
264
+ ...style !== void 0 ? { style } : {},
265
+ ...common
266
+ });
267
+ continue;
268
+ }
237
269
  const style = mapConditionalFormatStyle(format.style, palette);
238
270
  results.push({
239
271
  type: format.kind,
package/dist/content.js CHANGED
@@ -5,7 +5,10 @@ import { inchesToPoints } from "./units.js";
5
5
  import { pageSizeFromSetup } from "./biff/print-setup.js";
6
6
  import { groupRecords, splitSubstreams } from "./biff/substreams.js";
7
7
  import { applyTint, resolveBorderEdge, resolveFillBackground, resolveIcvColor } from "./biff/xf-colors.js";
8
+ import { readBlipStore } from "./drawing/blips.js";
9
+ import { concatBytes } from "./drawing/bytes.js";
8
10
  import { readSheetComments } from "./workbook/comments.js";
11
+ import { readSheetDrawing } from "./workbook/drawing.js";
9
12
  import { serialToIsoDate, serialToIsoDateTime, serialToIsoTime } from "./serial.js";
10
13
  import { formatCodeOf, readWorkbookGlobals } from "./workbook/globals.js";
11
14
  import { readSheetRecords } from "./workbook/sheet.js";
@@ -90,16 +93,22 @@ function readXlsContent(bytes, password) {
90
93
  const globalsSubstream = substreams[0];
91
94
  if (globalsSubstream === void 0) throw new BiffFormatError("workbook stream holds no substreams, so it carries no globals substream");
92
95
  const globals = readWorkbookGlobals(globalsSubstream.records);
93
- const sheets = globals.sheets.map((entry, sheetIndex) => ({
94
- entry,
95
- sheetIndex
96
- })).filter(({ entry }) => entry.sheetType === SHEET_TYPE_WORKSHEET).map(({ entry, sheetIndex }) => readSheet(entry, sheetIndex, substreams, globals));
96
+ const blipStore = readBlipStore(concatDrawingGroupBytes(globalsSubstream.records));
97
+ const documentMetadata = metadata === void 0 ? {} : summaryInformationToLayoutMetadata(readSummaryInformation(metadata));
97
98
  return {
98
99
  kind: "spreadsheet",
99
- metadata: metadata === void 0 ? {} : summaryInformationToLayoutMetadata(readSummaryInformation(metadata)),
100
- sheets
100
+ metadata: documentMetadata,
101
+ sheets: globals.sheets.map((entry, sheetIndex) => ({
102
+ entry,
103
+ sheetIndex
104
+ })).filter(({ entry }) => entry.sheetType === SHEET_TYPE_WORKSHEET).map(({ entry, sheetIndex }) => readSheet(entry, sheetIndex, substreams, globals, blipStore, documentMetadata))
101
105
  };
102
106
  }
107
+ /** Every MsoDrawingGroup record's own data, in stream order, concatenated into one Escher byte stream -- the workbook-wide counterpart of a worksheet's own MsoDrawing concatenation (drawing/shapes.ts's own readSheetShapes), carrying the Blip Store rather than any one sheet's shape tree. */
108
+ function concatDrawingGroupBytes(records) {
109
+ const chunks = records.filter((record) => record.type === 235).map((record) => record.blocks[0]).filter((block) => block !== void 0);
110
+ return concatBytes(chunks);
111
+ }
103
112
  /** The tree-form read: readXlsContent composed with the schema's own structural transform, exactly as ooxml.js's readXlsx wraps readXlsxContent. */
104
113
  function readXls(bytes, password) {
105
114
  return assembleTree(readXlsContent(bytes, password));
@@ -109,8 +118,17 @@ function readXls(bytes, password) {
109
118
  *
110
119
  * The substream is found by the byte offset BoundSheet8's lbPlyPos names, not by position: the order sheets appear in the workbook (which is BoundSheet8 order, and therefore the order of `globals.sheets`) is not required to match the order their substreams were written in. A sheet whose substream cannot be found still produces a ContentSheet, empty -- losing the sheet entirely would be a worse answer than losing its cells, since its name and position are real information the workbook did state.
111
120
  */
112
- function readSheet(entry, sheetIndex, substreams, globals) {
121
+ function readSheet(entry, sheetIndex, substreams, globals, blipStore, documentMetadata) {
113
122
  const substream = substreams.find((candidate) => candidate.offset === entry.bofPosition && candidate.documentType === 16);
123
+ const emptyPrint = {
124
+ marginsPt: {},
125
+ rowBreaks: [],
126
+ columnBreaks: []
127
+ };
128
+ const formulaSheets = {
129
+ sheets: globals.sheets,
130
+ sheetRanges: globals.sheetRanges
131
+ };
114
132
  const raw = substream === void 0 ? {
115
133
  cells: [],
116
134
  rows: [],
@@ -119,29 +137,33 @@ function readSheet(entry, sheetIndex, substreams, globals) {
119
137
  dataValidations: [],
120
138
  conditionalFormats: [],
121
139
  conditionalFormats12: [],
122
- print: {
123
- marginsPt: {},
124
- rowBreaks: [],
125
- columnBreaks: []
126
- }
127
- } : readSheetRecords(substream.records, globals.sharedStrings, {
128
- sheets: globals.sheets,
129
- sheetRanges: globals.sheetRanges
130
- });
140
+ print: emptyPrint
141
+ } : readSheetRecords(substream.records, globals.sharedStrings, formulaSheets);
131
142
  const comments = substream === void 0 ? /* @__PURE__ */ new Map() : readSheetComments(substream.records);
132
143
  const cells = mapCells(raw, globals);
133
144
  applyCellComments(comments, cells);
134
145
  const dataValidations = mapDataValidations(raw.dataValidations);
135
146
  const conditionalFormats = [...mapConditionalFormats(raw.conditionalFormats, globals.palette), ...mapConditionalFormats12(raw.conditionalFormats12, globals.palette)];
147
+ const drawing = readSheetDrawing(substream?.records ?? [], {
148
+ blipStore,
149
+ columns: raw.columns,
150
+ rows: raw.rows,
151
+ ownSheetIndex: sheetIndex,
152
+ formulaSheets,
153
+ ownSheetCells: cells,
154
+ metadata: documentMetadata,
155
+ allSubstreams: substreams
156
+ });
136
157
  return {
137
158
  name: entry.name,
138
159
  cells,
139
160
  columns: mapColumns(raw),
140
161
  rows: mapRows(raw),
141
- images: [],
162
+ images: [...drawing.images],
142
163
  printSettings: mapPrintSettings(raw.print, globals.printNames.get(sheetIndex)),
143
164
  ...dataValidations.length > 0 ? { dataValidations } : {},
144
- ...conditionalFormats.length > 0 ? { conditionalFormats } : {}
165
+ ...conditionalFormats.length > 0 ? { conditionalFormats } : {},
166
+ ...drawing.embeddedObjects.length > 0 ? { embeddedObjects: [...drawing.embeddedObjects] } : {}
145
167
  };
146
168
  }
147
169
  function mapConditionalFormats(raw, palette) {
@@ -233,6 +255,16 @@ function mapConditionalFormats12(raw, palette) {
233
255
  });
234
256
  continue;
235
257
  }
258
+ if (format.kind === "containsText" || format.kind === "notContainsText" || format.kind === "beginsWith" || format.kind === "endsWith") {
259
+ const style = mapConditionalFormatStyle(format.style, palette);
260
+ results.push({
261
+ type: format.kind,
262
+ text: format.text,
263
+ ...style !== void 0 ? { style } : {},
264
+ ...common
265
+ });
266
+ continue;
267
+ }
236
268
  const style = mapConditionalFormatStyle(format.style, palette);
237
269
  results.push({
238
270
  type: format.kind,
@@ -21,7 +21,9 @@ declare class BlockCursor {
21
21
  i16(): number;
22
22
  /** An Xnum ([MS-XLS] 2.5.342): a little-endian IEEE 754 double. */
23
23
  f64(): number;
24
- /** The next `count` bytes, copied out. Spans block boundaries. */
24
+ /** Total unread bytes across the current block and every block after it -- what a length-prefixed field's own prefix must be checked against before that many bytes are allocated, so a record cannot claim a length far larger than the data actually behind it. */
25
+ private remainingTotal;
26
+ /** The next `count` bytes, copied out. Spans block boundaries. Rejects a `count` larger than the data actually remaining before allocating, so a length-prefixed field taken from untrusted input (e.g. CFEx's own `cbDxf`) cannot force a multi-gigabyte allocation from a tiny record. */
25
27
  take(count: number): Uint8Array<ArrayBuffer>;
26
28
  /** Advances `count` bytes without materialising them -- for a field this package reads past rather than reads. */
27
29
  skip(count: number): void;
@@ -21,7 +21,9 @@ declare class BlockCursor {
21
21
  i16(): number;
22
22
  /** An Xnum ([MS-XLS] 2.5.342): a little-endian IEEE 754 double. */
23
23
  f64(): number;
24
- /** The next `count` bytes, copied out. Spans block boundaries. */
24
+ /** Total unread bytes across the current block and every block after it -- what a length-prefixed field's own prefix must be checked against before that many bytes are allocated, so a record cannot claim a length far larger than the data actually behind it. */
25
+ private remainingTotal;
26
+ /** The next `count` bytes, copied out. Spans block boundaries. Rejects a `count` larger than the data actually remaining before allocating, so a length-prefixed field taken from untrusted input (e.g. CFEx's own `cbDxf`) cannot force a multi-gigabyte allocation from a tiny record. */
25
27
  take(count: number): Uint8Array<ArrayBuffer>;
26
28
  /** Advances `count` bytes without materialising them -- for a field this package reads past rather than reads. */
27
29
  skip(count: number): void;
@@ -1,5 +1,5 @@
1
- import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.cjs";
2
- import { t as RecordGroup } from "./substreams-CHv3oWmn.cjs";
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.cjs";
2
+ import { t as RecordGroup } from "./substreams-XDNgDvRJ.cjs";
3
3
  import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
4
  //#region src/workbook/data-validation.d.ts
5
5
  interface RawDataValidation {
@@ -1,5 +1,5 @@
1
- import { r as FormulaSheetContext } from "./ptg-CCBbJLZJ.js";
2
- import { t as RecordGroup } from "./substreams-Dp5cZoUo.js";
1
+ import { r as FormulaSheetContext } from "./ptg-75v7MhaA.js";
2
+ import { t as RecordGroup } from "./substreams-CgTHx5kX.js";
3
3
  import { ContentSheetRange, SheetRuleOperator } from "document-schema.js";
4
4
  //#region src/workbook/data-validation.d.ts
5
5
  interface RawDataValidation {
@@ -0,0 +1,83 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_biff_cursor = require("../biff/cursor.cjs");
3
+ const require_drawing_escher_constants = require("./escher-constants.cjs");
4
+ const require_drawing_escher = require("./escher.cjs");
5
+ //#region src/drawing/blips.ts
6
+ const RGB_UID_SIZE = 16;
7
+ const BLIP_TAG_SIZE = 1;
8
+ /** [MS-ODRAW] OfficeArtFBSE's own fixed fields up to and including unused3, before the optional nameData and the nested embedded blip -- btWin32(1) + btMacOS(1) + rgbUid(16) + tag(2) + size(4) + cRef(4) + foDelay(4) + unused1(1) + cbName(1) + unused2(1) + unused3(1). */
9
+ const BSE_FIXED_SIZE = 36;
10
+ /** A Blip record's own recInstance, mapped to how many 16-byte rgbUid fields precede its `tag` byte and the raw file bytes -- one UID for a blip embedded once, two when [MS-ODRAW] also records a second, "printer" representation's own hash. Only PNG/JPEG instances are named: every other blip type resolves to no image at all (see readBlipImage), so its own UID count is never needed. */
11
+ const BLIP_UID_COUNTS = /* @__PURE__ */ new Map([
12
+ [1760, 1],
13
+ [1761, 2],
14
+ [1130, 1],
15
+ [1131, 2],
16
+ [1762, 1],
17
+ [1763, 2]
18
+ ]);
19
+ /** Reads every BSE entry the workbook's own drawing-group Escher stream declares, keyed by its 1-based position in the Blip Store array -- the same index a picture shape's `pib` property names. A BSE this reader cannot turn into a real image (no embedded blip, or a blip type document-schema.js's ContentImageBlockSchema has no lossless slot for -- DIB, EMF, WMF, PICT, TIFF) is simply absent from the map, exactly like any other unsupported construct elsewhere in this package: a picture shape whose `pib` resolves to one of these is recognised as a picture but produces no ContentSheetImage, rather than a fabricated or mistranscoded one. */
20
+ function readBlipStore(drawingGroupBytes) {
21
+ const store = /* @__PURE__ */ new Map();
22
+ if (drawingGroupBytes.length === 0) return store;
23
+ const dgg = require_drawing_escher.readEscherRecords(drawingGroupBytes).find((record) => record.kind === "container" && record.recType === 61440);
24
+ if (dgg === void 0) return store;
25
+ const bstore = require_drawing_escher.childrenOfType(dgg, require_drawing_escher_constants.ESCHER_BSTORE_CONTAINER)[0];
26
+ if (bstore?.kind !== "container") return store;
27
+ require_drawing_escher.childrenOfType(bstore, require_drawing_escher_constants.ESCHER_BSE).forEach((bse, index) => {
28
+ if (bse.kind !== "atom") return;
29
+ const image = readBseImage(bse.data);
30
+ if (image !== void 0) store.set(index + 1, image);
31
+ });
32
+ return store;
33
+ }
34
+ /** One BSE atom's own body ([MS-ODRAW] OfficeArtFBSE): the fixed fields, an optional nameData string, then the nested embedded blip record -- present whenever the image is stored inline rather than only linked externally (foDelay !== 0xFFFFFFFF), which is the only case this reader can recover bytes for at all. */
35
+ function readBseImage(data) {
36
+ if (data.length < BSE_FIXED_SIZE) return;
37
+ const cursor = new require_biff_cursor.BlockCursor([data]);
38
+ cursor.skip(1);
39
+ cursor.skip(1);
40
+ cursor.skip(RGB_UID_SIZE);
41
+ cursor.skip(2);
42
+ cursor.skip(4);
43
+ cursor.skip(4);
44
+ cursor.skip(4);
45
+ cursor.skip(1);
46
+ const cbName = cursor.u8();
47
+ cursor.skip(1);
48
+ cursor.skip(1);
49
+ const embeddedStart = BSE_FIXED_SIZE + (cbName > 0 ? cbName : 0);
50
+ if (embeddedStart >= data.length) return;
51
+ const embeddedBytes = data.subarray(embeddedStart);
52
+ const blip = require_drawing_escher.readEscherRecords(embeddedBytes)[0];
53
+ if (blip?.kind !== "atom") return;
54
+ return readBlipImage(blip.recType, blip.recInstance, blip.data);
55
+ }
56
+ /** One embedded OfficeArtBlip record's own body -- one or two 16-byte rgbUid fields, a one-byte tag, then the literal image file bytes to the end of the record. PNG and JPEG blips carry their literal file bytes verbatim ([MS-ODRAW] OfficeArtBlipPNG/OfficeArtBlipJPEG); every other recognised blip type (DIB -- an in-memory Windows DIB, not a standalone .bmp file, and carrying no BITMAPFILEHEADER of its own to become one) has no lossless target in document-schema.js's ContentImageBlockSchema (png/jpeg/svg/gif only) and resolves to undefined rather than a mistranscoded image. */
57
+ function readBlipImage(recType, recInstance, data) {
58
+ const format = blipFormatOf(recType);
59
+ if (format === void 0) return;
60
+ const uidCount = BLIP_UID_COUNTS.get(recInstance);
61
+ if (uidCount === void 0) return;
62
+ const headerSize = uidCount * RGB_UID_SIZE + BLIP_TAG_SIZE;
63
+ if (data.length < headerSize) return;
64
+ return {
65
+ format,
66
+ base64: bytesToBase64(data.subarray(headerSize))
67
+ };
68
+ }
69
+ function blipFormatOf(recType) {
70
+ if (recType === 61470) return "png";
71
+ if (recType === 61469 || recType === 61482) return "jpeg";
72
+ }
73
+ function bytesToBase64(bytes) {
74
+ let binary = "";
75
+ const chunkSize = 32768;
76
+ for (let offset = 0; offset < bytes.length; offset += chunkSize) {
77
+ const chunk = bytes.subarray(offset, offset + chunkSize);
78
+ binary += String.fromCharCode(...chunk);
79
+ }
80
+ return btoa(binary);
81
+ }
82
+ //#endregion
83
+ exports.readBlipStore = readBlipStore;
@@ -0,0 +1,10 @@
1
+ //#region src/drawing/blips.d.ts
2
+ /** One resolved image: the bytes document-schema.js's ContentImageBlockSchema can actually carry (png/jpeg only -- see readBlipImage below), base64-encoded. */
3
+ interface BlipImage {
4
+ readonly format: "png" | "jpeg";
5
+ readonly base64: string;
6
+ }
7
+ /** Reads every BSE entry the workbook's own drawing-group Escher stream declares, keyed by its 1-based position in the Blip Store array -- the same index a picture shape's `pib` property names. A BSE this reader cannot turn into a real image (no embedded blip, or a blip type document-schema.js's ContentImageBlockSchema has no lossless slot for -- DIB, EMF, WMF, PICT, TIFF) is simply absent from the map, exactly like any other unsupported construct elsewhere in this package: a picture shape whose `pib` resolves to one of these is recognised as a picture but produces no ContentSheetImage, rather than a fabricated or mistranscoded one. */
8
+ declare function readBlipStore(drawingGroupBytes: Uint8Array<ArrayBuffer>): ReadonlyMap<number, BlipImage>;
9
+ //#endregion
10
+ export { BlipImage, readBlipStore };
@@ -0,0 +1,10 @@
1
+ //#region src/drawing/blips.d.ts
2
+ /** One resolved image: the bytes document-schema.js's ContentImageBlockSchema can actually carry (png/jpeg only -- see readBlipImage below), base64-encoded. */
3
+ interface BlipImage {
4
+ readonly format: "png" | "jpeg";
5
+ readonly base64: string;
6
+ }
7
+ /** Reads every BSE entry the workbook's own drawing-group Escher stream declares, keyed by its 1-based position in the Blip Store array -- the same index a picture shape's `pib` property names. A BSE this reader cannot turn into a real image (no embedded blip, or a blip type document-schema.js's ContentImageBlockSchema has no lossless slot for -- DIB, EMF, WMF, PICT, TIFF) is simply absent from the map, exactly like any other unsupported construct elsewhere in this package: a picture shape whose `pib` resolves to one of these is recognised as a picture but produces no ContentSheetImage, rather than a fabricated or mistranscoded one. */
8
+ declare function readBlipStore(drawingGroupBytes: Uint8Array<ArrayBuffer>): ReadonlyMap<number, BlipImage>;
9
+ //#endregion
10
+ export { BlipImage, readBlipStore };