@office-open/xlsx 0.6.8 → 0.6.9
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.
- package/README.md +11 -11
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -69,27 +69,27 @@ DEFLATE = compressed (default), STORE = no compression.
|
|
|
69
69
|
|
|
70
70
|
| Scenario | DEFLATE sync | STORE sync | DEFLATE async | STORE async | hucre |
|
|
71
71
|
| ---------------- | -----------: | -----------: | ------------: | -----------: | --------: |
|
|
72
|
-
| Simple (3 rows) |
|
|
73
|
-
| Styled rows (20) |
|
|
74
|
-
| Table (10×5) |
|
|
72
|
+
| Simple (3 rows) | 551 ops/s | 12,909 ops/s | 597 ops/s | 14,019 ops/s | 773 ops/s |
|
|
73
|
+
| Styled rows (20) | 759 ops/s | 11,510 ops/s | 857 ops/s | 11,225 ops/s | 877 ops/s |
|
|
74
|
+
| Table (10×5) | 868 ops/s | 12,101 ops/s | 937 ops/s | 10,705 ops/s | 949 ops/s |
|
|
75
75
|
|
|
76
76
|
**Large Files — Create + toBuffer**
|
|
77
77
|
|
|
78
78
|
| Scenario | DEFLATE sync | STORE sync | DEFLATE async | STORE async | hucre |
|
|
79
79
|
| -------------------- | -----------: | ----------: | ------------: | ----------: | ----------: |
|
|
80
|
-
| 2000 rows |
|
|
81
|
-
| 200×10 table |
|
|
82
|
-
| 20 sheets × 100 rows |
|
|
80
|
+
| 2000 rows | 58.0 ops/s | 192.5 ops/s | 21.2 ops/s | 201.5 ops/s | 80.3 ops/s |
|
|
81
|
+
| 200×10 table | 178.4 ops/s | 589.1 ops/s | 196.6 ops/s | 811.0 ops/s | 213.7 ops/s |
|
|
82
|
+
| 20 sheets × 100 rows | 89.8 ops/s | 192.9 ops/s | 93.4 ops/s | 243.5 ops/s | 83.1 ops/s |
|
|
83
83
|
|
|
84
84
|
**Large Data — 100,000 rows × 20 columns (2M cells)**
|
|
85
85
|
|
|
86
86
|
| Method | Speed | Speedup |
|
|
87
87
|
| ------------- | ----------: | --------: |
|
|
88
|
-
| DEFLATE sync | 0.
|
|
89
|
-
| STORE sync | 0.
|
|
90
|
-
| DEFLATE async | 0.
|
|
91
|
-
| STORE async | 0.
|
|
92
|
-
| hucre | 0.
|
|
88
|
+
| DEFLATE sync | 0.290 ops/s | 0.75x |
|
|
89
|
+
| STORE sync | 0.537 ops/s | **1.39x** |
|
|
90
|
+
| DEFLATE async | 0.322 ops/s | 0.83x |
|
|
91
|
+
| STORE async | 0.649 ops/s | **1.68x** |
|
|
92
|
+
| hucre | 0.386 ops/s | |
|
|
93
93
|
|
|
94
94
|
## License
|
|
95
95
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_office_open_core0 from "@office-open/core";
|
|
2
1
|
import { AppProperties, BaseXmlComponent, ChartCollection, ChartSpaceOptions, Context, IgnoreIfEmptyXmlComponent, OutputByType, OutputByType as OutputByType$1, OutputType, OutputType as OutputType$1, ParsedArchive, Relationships } from "@office-open/core";
|
|
3
2
|
import { Element } from "@office-open/xml";
|
|
4
3
|
import { DataType } from "undio";
|
|
@@ -295,7 +294,7 @@ declare class File {
|
|
|
295
294
|
}
|
|
296
295
|
//#endregion
|
|
297
296
|
//#region src/export/packer/packer.d.ts
|
|
298
|
-
declare const Packer:
|
|
297
|
+
declare const Packer: import("@office-open/core").Packer<File>;
|
|
299
298
|
//#endregion
|
|
300
299
|
//#region src/util/index.d.ts
|
|
301
300
|
declare function columnToLetter(col: number): string;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/file/content-types.ts","../src/file/core-properties.ts","../src/file/media/media.ts","../src/file/shared-strings.ts","../src/file/styles.ts","../src/file/theme.ts","../src/file/workbook.ts","../src/file/worksheet.ts","../src/file/file.ts","../src/export/packer/packer.ts","../src/util/index.ts","../src/parse.ts","../src/patcher.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/file/content-types.ts","../src/file/core-properties.ts","../src/file/media/media.ts","../src/file/shared-strings.ts","../src/file/styles.ts","../src/file/theme.ts","../src/file/workbook.ts","../src/file/worksheet.ts","../src/file/file.ts","../src/export/packer/packer.ts","../src/util/index.ts","../src/parse.ts","../src/patcher.ts"],"mappings":";;;;;;cAmDa,YAAA,SAAqB,gBAAgB;EAAA,iBAC/B,cAAA;;EAMV,YAAA,CAAa,KAAA;EAQb,SAAA,CAAA;EAQA,gBAAA,CAAA;EAQA,QAAA,CAAS,KAAA;EAQT,QAAA,CAAS,KAAA;EAQT,UAAA,CAAW,KAAA;EAQX,YAAA,CAAa,SAAA;EAOJ,KAAA,CAAM,QAAA,EAAU,OAAA;AAAA;;;UCxGjB,qBAAA;EAAA,SACN,KAAA;EAAA,SACA,OAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA;EAAA,SACA,WAAA;EAAA,SACA,cAAA;EAAA,SACA,QAAA;AAAA;AAAA,cAGE,cAAA,SAAuB,gBAAA;EAAA,iBACjB,OAAA;cAEE,OAAA,EAAS,qBAAA;EAKZ,KAAA,CAAM,QAAA,EAAU,OAAA;AAAA;;;UCrBjB,SAAA;EAAA,SACN,QAAA;EAAA,SACA,IAAA;EAAA,SACA,IAAA,EAAM,UAAU;EAAA,SAChB,KAAA;EAAA,SACA,MAAA;AAAA;AAAA,cAGE,KAAA;EAAA,iBACM,GAAA;EAEV,QAAA,CAAS,GAAA,UAAa,IAAA,EAAM,SAAA;EAAA,IAIxB,KAAA,CAAA,YAAkB,SAAS;AAAA;;;cCT3B,aAAA,SAAsB,gBAAgB;EAAA,iBAChC,OAAA;EAAA,iBACA,QAAA;;EAUV,QAAA,CAAS,CAAA;EAAA,IAUL,KAAA,CAAA;EAQK,KAAA,CAAM,QAAA,EAAU,OAAA;AAAA;;;UC5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M,QAAA,GAAW,YAAY;AAAA,iBAqPvC,aAAA,CAAc,IAAA,EAAM,QAAA,GAAW,eAAe;;;KChSlD,aAAA,GAAgB,MAAA,uBAA6B,UAAA,GAAa,WAAA,GAAc,IAAA;AAAA,KAExE,uBAAA,GAA0B,YAAU;AAAA,cAEnC,SAAA;EAAA,SAEH,IAAA;AAAA;AAAA,UAEO,SAAA;EAAA,SAEN,KAAA,8BAAmC,IAAI;AAAA;AAAA,KAGtC,MAAA,GAAS,SAAS;AAAA,UAEb,oBAAA,WAA+B,uBAAA,GAA0B,uBAAA;EAAA,SAC/D,UAAA,EAAY,CAAA;EAAA,SACZ,IAAA,EAAM,aAAA;EAAA,SACN,OAAA,EAAS,QAAA,CAAS,MAAA,SAAe,MAAA;EAAA,SACjC,qBAAA,GAAwB,QAAA;IAAA,SACtB,KAAA;IAAA,SACA,GAAA;EAAA;AAAA;AAAA,cAWA,aAAA,aAAiC,uBAAA,GAA0B,uBAAA;EAAyB,UAAA;EAAA,IAAA;EAAA,OAAA;EAAA;AAAA,GAK9F,oBAAA,CAAqB,CAAA,MAAK,OAAA,CAAQ,cAAA,CAAa,CAAA"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["localName"],"sources":["../src/file/content-types.ts","../src/file/core-properties.ts","../src/file/media/media.ts","../src/file/shared-strings.ts","../src/file/styles.ts","../src/file/theme.ts","../src/file/workbook.ts","../src/file/worksheet.ts","../src/file/file.ts","../src/file/drawing/drawing.ts","../src/export/packer/next-compiler.ts","../src/export/packer/packer.ts","../src/util/index.ts","../src/parse.ts","../src/patcher.ts"],"sourcesContent":["/**\n * Content Types module for XLSX packages.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\nconst XLSX_MAIN = \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\";\nconst XLSX_WORKSHEET = \"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\";\nconst XLSX_STYLES = \"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\";\nconst XLSX_SHARED_STRINGS =\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\";\nconst XLSX_THEME = \"application/vnd.openxmlformats-officedocument.theme+xml\";\nconst XLSX_CHART = \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\";\n\ntype EntryType = \"Default\" | \"Override\";\n\ninterface ContentEntry {\n readonly type: EntryType;\n readonly contentType: string;\n readonly key: string;\n}\n\nconst STATIC_ENTRIES: readonly ContentEntry[] = [\n {\n type: \"Default\",\n contentType: \"application/vnd.openxmlformats-package.relationships+xml\",\n key: \"rels\",\n },\n { type: \"Default\", contentType: \"application/xml\", key: \"xml\" },\n { type: \"Override\", contentType: XLSX_MAIN, key: \"/xl/workbook.xml\" },\n {\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n key: \"/docProps/core.xml\",\n },\n {\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n key: \"/docProps/app.xml\",\n },\n];\n\n// Pre-compiled static XML fragment (module-level constant)\nconst STATIC_XML = STATIC_ENTRIES.map((e) =>\n e.type === \"Default\"\n ? `<Default ContentType=\"${e.contentType}\" Extension=\"${e.key}\"/>`\n : `<Override ContentType=\"${e.contentType}\" PartName=\"${e.key}\"/>`,\n).join(\"\");\n\nexport class ContentTypes extends BaseXmlComponent {\n private readonly dynamicEntries: ContentEntry[] = [];\n\n public constructor() {\n super(\"Types\");\n }\n\n public addWorksheet(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_WORKSHEET,\n key: `/xl/worksheets/sheet${index}.xml`,\n });\n }\n\n public addStyles(): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_STYLES,\n key: \"/xl/styles.xml\",\n });\n }\n\n public addSharedStrings(): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_SHARED_STRINGS,\n key: \"/xl/sharedStrings.xml\",\n });\n }\n\n public addTheme(index: number = 1): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_THEME,\n key: `/xl/theme/theme${index}.xml`,\n });\n }\n\n public addChart(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_CHART,\n key: `/xl/charts/chart${index}.xml`,\n });\n }\n\n public addDrawing(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawing+xml\",\n key: `/xl/drawings/drawing${index}.xml`,\n });\n }\n\n public addImageType(extension: \"png\" | \"jpeg\"): void {\n const contentType = extension === \"png\" ? \"image/png\" : \"image/jpeg\";\n // Avoid duplicates\n if (this.dynamicEntries.some((e) => e.type === \"Default\" && e.key === extension)) return;\n this.dynamicEntries.push({ type: \"Default\", contentType, key: extension });\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">',\n STATIC_XML,\n ];\n for (const e of this.dynamicEntries) {\n if (e.type === \"Default\") {\n p.push(`<Default ContentType=\"${e.contentType}\" Extension=\"${e.key}\"/>`);\n } else {\n p.push(`<Override ContentType=\"${e.contentType}\" PartName=\"${e.key}\"/>`);\n }\n }\n p.push(\"</Types>\");\n return p.join(\"\");\n }\n}\n","/**\n * Core Properties module for SpreadsheetML documents.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { buildCorePropertiesXmlString } from \"@office-open/core\";\n\nexport interface CorePropertiesOptions {\n readonly title?: string;\n readonly subject?: string;\n readonly creator?: string;\n readonly keywords?: string;\n readonly description?: string;\n readonly lastModifiedBy?: string;\n readonly revision?: number;\n}\n\nexport class CoreProperties extends BaseXmlComponent {\n private readonly options: CorePropertiesOptions;\n\n public constructor(options: CorePropertiesOptions) {\n super(\"cp:coreProperties\");\n this.options = options;\n }\n\n public override toXml(_context: Context): string {\n return buildCorePropertiesXmlString(this.options);\n }\n}\n","/**\n * Media collection for XLSX files — stores image binary data.\n *\n * @module\n */\n\nexport interface MediaData {\n readonly fileName: string;\n readonly type: string;\n readonly data: Uint8Array;\n readonly width: number;\n readonly height: number;\n}\n\nexport class Media {\n private readonly map = new Map<string, MediaData>();\n\n public addImage(key: string, data: MediaData): void {\n this.map.set(key, data);\n }\n\n public get array(): readonly MediaData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * Shared Strings Table — generates xl/sharedStrings.xml.\n *\n * XLSX stores repeated string values in a central table to reduce file size.\n * Cells reference strings by index into this table.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { escapeXml } from \"@office-open/xml\";\n\nexport class SharedStrings extends BaseXmlComponent {\n private readonly strings: string[] = [];\n private readonly indexMap = new Map<string, number>();\n\n public constructor() {\n super(\"sst\");\n }\n\n /**\n * Register a string and return its index.\n * Returns existing index if the string is already registered.\n */\n public register(s: string): number {\n const existing = this.indexMap.get(s);\n if (existing !== undefined) return existing;\n\n const idx = this.strings.length;\n this.strings.push(s);\n this.indexMap.set(s, idx);\n return idx;\n }\n\n public get count(): number {\n return this.strings.length;\n }\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"',\n ` count=\"${this.strings.length}\" uniqueCount=\"${this.indexMap.size}\">`,\n ];\n for (const s of this.strings) {\n p.push(`<si><t>${escapeXml(s)}</t></si>`);\n }\n p.push(\"</sst>\");\n return p.join(\"\");\n }\n}\n","/**\n * Styles component — generates xl/styles.xml.\n *\n * XLSX uses an index-based style system: cells reference style entries\n * via the `s` attribute, which is an index into `cellXfs`.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { attrs, escapeXml } from \"@office-open/xml\";\n\n// ── Sub-style option interfaces ──\n\nexport interface FontOptions {\n readonly bold?: boolean;\n readonly italic?: boolean;\n readonly underline?: boolean;\n readonly strike?: boolean;\n readonly size?: number;\n readonly color?: string;\n readonly fontName?: string;\n}\n\nexport interface FillOptions {\n readonly type?: \"solid\" | \"pattern\";\n readonly color?: string;\n readonly patternType?: string;\n}\n\nexport interface BorderOptions {\n readonly style?: \"thin\" | \"medium\" | \"thick\" | \"dotted\" | \"dashed\" | \"hair\" | \"none\";\n readonly color?: string;\n}\n\nexport interface BorderSideOptions {\n readonly top?: BorderOptions;\n readonly bottom?: BorderOptions;\n readonly left?: BorderOptions;\n readonly right?: BorderOptions;\n readonly diagonal?: BorderOptions;\n}\n\nexport interface AlignmentOptions {\n readonly horizontal?: \"left\" | \"center\" | \"right\" | \"fill\" | \"justify\";\n readonly vertical?: \"top\" | \"center\" | \"bottom\";\n readonly wrapText?: boolean;\n readonly textRotation?: number;\n readonly indent?: number;\n}\n\nexport interface StyleOptions {\n readonly font?: FontOptions;\n readonly fill?: FillOptions;\n readonly border?: BorderSideOptions;\n readonly numFmt?: string;\n readonly alignment?: AlignmentOptions;\n}\n\n// ── Style key helpers for deduplication ──\n\nfunction fontKey(f: FontOptions): string {\n return `b${f.bold ? 1 : 0}i${f.italic ? 1 : 0}u${f.underline ? 1 : 0}s${f.strike ? 1 : 0}z${f.size ?? 0}c${f.color ?? \"\"}n${f.fontName ?? \"\"}`;\n}\n\nfunction fillKey(f: FillOptions): string {\n return `t${f.type ?? \"\"}c${f.color ?? \"\"}p${f.patternType ?? \"\"}`;\n}\n\nfunction borderKey(b: BorderSideOptions): string {\n const sk = (o?: BorderOptions) => `${o?.style ?? \"\"}_${o?.color ?? \"\"}`;\n return `t${sk(b.top)}b${sk(b.bottom)}l${sk(b.left)}r${sk(b.right)}d${sk(b.diagonal)}`;\n}\n\n// ── Built-in number format IDs ──\n\nconst BUILTIN_NUMFMTS: Record<string, number> = {\n General: 0,\n \"0\": 1,\n \"0.00\": 2,\n \"#,##0\": 3,\n \"#,##0.00\": 4,\n \"0%\": 9,\n \"0.00%\": 10,\n \"0.00E+00\": 11,\n \"mm-dd-yy\": 14,\n \"d-mmm-yy\": 15,\n \"d-mmm\": 16,\n \"mmm-yy\": 17,\n \"h:mm AM/PM\": 18,\n \"h:mm:ss AM/PM\": 19,\n \"h:mm\": 20,\n \"h:mm:ss\": 21,\n \"m/d/yy h:mm\": 22,\n \"#,##0 ;(#,##0)\": 37,\n \"#,##0 ;[Red](#,##0)\": 38,\n \"#,##0.00;(#,##0.00)\": 39,\n \"#,##0.00;[Red](#,##0.00)\": 40,\n \"mm:ss\": 45,\n \"[h]:mm:ss\": 46,\n \"mmss.0\": 47,\n \"##0.0E+0\": 48,\n \"@\": 49,\n};\n\nexport class Styles extends BaseXmlComponent {\n private readonly fonts: FontOptions[] = [\n { size: 11, fontName: \"Calibri\" }, // default font (index 0)\n ];\n private readonly fontKeys = new Map<string, number>();\n\n private readonly fills: FillOptions[] = [\n { patternType: \"none\" }, // default fill (index 0)\n { patternType: \"gray125\" }, // required fill (index 1)\n ];\n private readonly fillKeys = new Map<string, number>();\n\n private readonly borders: BorderSideOptions[] = [\n {}, // default empty border (index 0)\n ];\n private readonly borderKeys = new Map<string, number>();\n\n private readonly customNumFmts = new Map<string, number>();\n private nextCustomNumFmtId = 164; // custom numFmts start at 164\n\n private readonly cellXfs: Array<{\n readonly fontId: number;\n readonly fillId: number;\n readonly borderId: number;\n readonly numFmtId: number;\n readonly alignment?: AlignmentOptions;\n }> = [\n { fontId: 0, fillId: 0, borderId: 0, numFmtId: 0 }, // default xf (index 0)\n ];\n private readonly cellXfKeys = new Map<string, number>();\n\n public constructor() {\n super(\"styleSheet\");\n\n // Pre-register default font/fill/border keys\n this.fontKeys.set(fontKey(this.fonts[0]), 0);\n this.fillKeys.set(fillKey(this.fills[0]), 0);\n this.fillKeys.set(fillKey(this.fills[1]), 1);\n this.borderKeys.set(borderKey(this.borders[0]), 0);\n this.cellXfKeys.set(this.cellXfKey(this.cellXfs[0]), 0);\n }\n\n /**\n * Register a style and return its index (for the cell `s` attribute).\n * Deduplicates across fonts, fills, borders, numFmts, and cellXfs.\n */\n public register(opts: StyleOptions): number {\n const fontId = this.registerFont(opts.font);\n const fillId = this.registerFill(opts.fill);\n const borderId = this.registerBorder(opts.border);\n const numFmtId = this.registerNumFmt(opts.numFmt);\n\n const xf = {\n fontId,\n fillId,\n borderId,\n numFmtId,\n alignment: opts.alignment,\n };\n\n const key = this.cellXfKey(xf);\n const existing = this.cellXfKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.cellXfs.length;\n this.cellXfs.push(xf);\n this.cellXfKeys.set(key, idx);\n return idx;\n }\n\n private registerFont(opts?: FontOptions): number {\n if (!opts) return 0;\n const key = fontKey(opts);\n const existing = this.fontKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.fonts.length;\n this.fonts.push(opts);\n this.fontKeys.set(key, idx);\n return idx;\n }\n\n private registerFill(opts?: FillOptions): number {\n if (!opts) return 0;\n const key = fillKey(opts);\n const existing = this.fillKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.fills.length;\n this.fills.push(opts);\n this.fillKeys.set(key, idx);\n return idx;\n }\n\n private registerBorder(opts?: BorderSideOptions): number {\n if (!opts) return 0;\n const key = borderKey(opts);\n const existing = this.borderKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.borders.length;\n this.borders.push(opts);\n this.borderKeys.set(key, idx);\n return idx;\n }\n\n private registerNumFmt(fmt?: string): number {\n if (!fmt) return 0;\n const builtin = BUILTIN_NUMFMTS[fmt];\n if (builtin !== undefined) return builtin;\n\n const existing = this.customNumFmts.get(fmt);\n if (existing !== undefined) return existing;\n\n const id = this.nextCustomNumFmtId++;\n this.customNumFmts.set(fmt, id);\n return id;\n }\n\n private cellXfKey(xf: {\n readonly fontId: number;\n readonly fillId: number;\n readonly borderId: number;\n readonly numFmtId: number;\n readonly alignment?: AlignmentOptions;\n }): string {\n const a = xf.alignment;\n const ak = a\n ? `h${a.horizontal ?? \"\"}v${a.vertical ?? \"\"}w${a.wrapText ? 1 : 0}r${a.textRotation ?? \"\"}i${a.indent ?? \"\"}`\n : \"\";\n return `${xf.fontId}|${xf.fillId}|${xf.borderId}|${xf.numFmtId}|${ak}`;\n }\n\n // ── XML generation ──\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">',\n ];\n\n // numFmts\n if (this.customNumFmts.size > 0) {\n p.push(`<numFmts count=\"${this.customNumFmts.size}\">`);\n for (const [fmt, id] of this.customNumFmts) {\n p.push(`<numFmt numFmtId=\"${id}\" formatCode=\"${escapeXml(fmt)}\"/>`);\n }\n p.push(\"</numFmts>\");\n }\n\n // fonts\n p.push(`<fonts count=\"${this.fonts.length}\">`);\n for (const f of this.fonts) {\n p.push(`<font>${this.fontXmlStr(f)}</font>`);\n }\n p.push(\"</fonts>\");\n\n // fills\n p.push(`<fills count=\"${this.fills.length}\">`);\n for (const f of this.fills) {\n const patternAttrs = attrs({ patternType: f.patternType ?? \"solid\" });\n const fgColor = f.color ? `<fgColor rgb=\"FF${f.color}\"/>` : \"\";\n p.push(\n fgColor\n ? `<fill><patternFill${patternAttrs}>${fgColor}</patternFill></fill>`\n : `<fill><patternFill${patternAttrs}/></fill>`,\n );\n }\n p.push(\"</fills>\");\n\n // borders\n p.push(`<borders count=\"${this.borders.length}\">`);\n for (const b of this.borders) {\n p.push(`<border>${this.borderXmlStr(b)}</border>`);\n }\n p.push(\"</borders>\");\n\n // cellStyleXfs\n p.push(\n '<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>',\n );\n\n // cellXfs\n p.push(`<cellXfs count=\"${this.cellXfs.length}\">`);\n for (const xf of this.cellXfs) {\n const xAttrs: Record<string, string | number | boolean | undefined> = {\n numFmtId: xf.numFmtId,\n fontId: xf.fontId,\n fillId: xf.fillId,\n borderId: xf.borderId,\n xfId: 0,\n };\n if (xf.alignment) xAttrs.applyAlignment = 1;\n if (xf.fontId > 0) xAttrs.applyFont = 1;\n if (xf.fillId > 0) xAttrs.applyFill = 1;\n if (xf.borderId > 0) xAttrs.applyBorder = 1;\n\n const alignStr = xf.alignment ? this.alignmentXmlStr(xf.alignment) : \"\";\n p.push(alignStr ? `<xf${attrs(xAttrs)}>${alignStr}</xf>` : `<xf${attrs(xAttrs)}/>`);\n }\n p.push(\"</cellXfs>\");\n\n // cellStyles\n p.push('<cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles>');\n\n // dxfs and tableStyles (required by Excel)\n p.push('<dxfs count=\"0\"/>');\n p.push(\n '<tableStyles count=\"0\" defaultTableStyle=\"TableStyleMedium2\" defaultPivotStyle=\"PivotStyleLight16\"/>',\n );\n p.push(\"<extLst/>\");\n\n p.push(\"</styleSheet>\");\n return p.join(\"\");\n }\n\n private fontXmlStr(f: FontOptions): string {\n const parts: string[] = [];\n if (f.bold) parts.push(\"<b/>\");\n if (f.italic) parts.push(\"<i/>\");\n if (f.underline) parts.push(\"<u/>\");\n if (f.strike) parts.push(\"<strike/>\");\n if (f.size) parts.push(`<sz val=\"${f.size}\"/>`);\n if (f.color) parts.push(`<color rgb=\"FF${f.color}\"/>`);\n if (f.fontName) parts.push(`<name val=\"${escapeXml(f.fontName)}\"/>`);\n return parts.join(\"\");\n }\n\n private borderXmlStr(b: BorderSideOptions): string {\n const parts: string[] = [];\n for (const side of [\"left\", \"right\", \"top\", \"bottom\", \"diagonal\"] as const) {\n const opts = b[side] as BorderOptions | undefined;\n if (opts && opts.style && opts.style !== \"none\") {\n const colorStr = opts.color ? `<color rgb=\"FF${opts.color}\"/>` : \"\";\n parts.push(`<${side} style=\"${opts.style}\">${colorStr}</${side}>`);\n } else {\n parts.push(`<${side}/>`);\n }\n }\n return parts.join(\"\");\n }\n\n private alignmentXmlStr(a: AlignmentOptions): string {\n const aAttrs: Record<string, string | number | boolean | undefined> = {};\n if (a.horizontal) aAttrs.horizontal = a.horizontal;\n if (a.vertical) aAttrs.vertical = a.vertical;\n if (a.wrapText) aAttrs.wrapText = 1;\n if (a.textRotation !== undefined) aAttrs.textRotation = a.textRotation;\n if (a.indent !== undefined) aAttrs.indent = a.indent;\n return `<alignment${attrs(aAttrs)}/>`;\n }\n}\n","/**\n * Default theme for XLSX files — matches Microsoft Office's output structure.\n * Produces xl/theme/theme1.xml that Excel accepts without repair warnings.\n *\n * The theme XML is completely static — identical for every XLSX file.\n * Pre-serialized as a string constant to avoid building the IXmlableObject\n * tree and re-serializing on every compile.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\n// Pre-serialized theme XML. Generated once via xml(buildThemeObj()) and inlined.\n// To regenerate: run `pnpm tsx scripts/gen-theme.ts` from packages/xlsx.\nconst THEME_XML =\n '<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\"><a:themeElements><a:clrScheme name=\"Office\"><a:dk1><a:sysClr val=\"windowText\" lastClr=\"000000\"/></a:dk1><a:lt1><a:sysClr val=\"window\" lastClr=\"FFFFFF\"/></a:lt1><a:dk2><a:srgbClr val=\"44546A\"/></a:dk2><a:lt2><a:srgbClr val=\"E7E6E6\"/></a:lt2><a:accent1><a:srgbClr val=\"5B9BD5\"/></a:accent1><a:accent2><a:srgbClr val=\"ED7D31\"/></a:accent2><a:accent3><a:srgbClr val=\"A5A5A5\"/></a:accent3><a:accent4><a:srgbClr val=\"FFC000\"/></a:accent4><a:accent5><a:srgbClr val=\"4472C4\"/></a:accent5><a:accent6><a:srgbClr val=\"70AD47\"/></a:accent6><a:hlink><a:srgbClr val=\"0563C1\"/></a:hlink><a:folHlink><a:srgbClr val=\"954F72\"/></a:folHlink></a:clrScheme><a:fontScheme name=\"Office\"><a:majorFont><a:latin typeface=\"Calibri Light\" panose=\"020F0302020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont><a:minorFont><a:latin typeface=\"Calibri\" panose=\"020F0502020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont></a:fontScheme><a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/><a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/><a:satMod val=\"103000\"/><a:tint val=\"94000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"100000\"/><a:satMod val=\"110000\"/><a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/><a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/><a:satMod val=\"150000\"/><a:tint val=\"93000\"/><a:shade val=\"98000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"103000\"/><a:satMod val=\"130000\"/><a:tint val=\"98000\"/><a:shade val=\"90000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"120000\"/><a:shade val=\"63000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>';\n\nexport class DefaultTheme extends BaseXmlComponent {\n public constructor() {\n super(\"a:theme\");\n }\n\n /** Return pre-cached static theme XML — zero allocation. */\n public override toXml(_context: Context): string {\n return THEME_XML;\n }\n}\n","/**\n * Workbook component — generates xl/workbook.xml.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { escapeXml } from \"@office-open/xml\";\n\nexport interface SheetDefinition {\n readonly name: string;\n readonly sheetId: number;\n readonly rId: string;\n readonly state?: \"visible\" | \"hidden\" | \"veryHidden\";\n}\n\nexport class WorkbookXml extends BaseXmlComponent {\n private readonly sheets: readonly SheetDefinition[];\n\n public constructor(sheets: readonly SheetDefinition[]) {\n super(\"workbook\");\n this.sheets = sheets;\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">',\n '<bookViews><workbookView xWindow=\"0\" yWindow=\"0\" windowWidth=\"28800\" windowHeight=\"12300\"/></bookViews>',\n \"<sheets>\",\n ];\n for (const s of this.sheets) {\n const stateAttr = s.state && s.state !== \"visible\" ? ` state=\"${s.state}\"` : \"\";\n p.push(\n `<sheet name=\"${escapeXml(s.name)}\" sheetId=\"${s.sheetId}\" r:id=\"${s.rId}\"${stateAttr}/>`,\n );\n }\n p.push('</sheets><calcPr calcId=\"191029\"/></workbook>');\n return p.join(\"\");\n }\n}\n","import type { SharedStrings } from \"@file/shared-strings\";\nimport type { Styles, StyleOptions } from \"@file/styles\";\n/**\n * Worksheet component — generates xl/worksheets/sheet{n}.xml.\n *\n * @module\n */\nimport { IgnoreIfEmptyXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport type { ChartSpaceOptions } from \"@office-open/core\";\nimport { attrs, escapeXml, selfCloseElement } from \"@office-open/xml\";\n\nexport interface ColumnOptions {\n readonly min: number;\n readonly max: number;\n readonly width?: number;\n readonly hidden?: boolean;\n readonly customWidth?: boolean;\n}\n\nexport interface RowOptions {\n readonly cells?: readonly CellOptions[];\n readonly height?: number;\n readonly hidden?: boolean;\n readonly rowNumber?: number;\n}\n\nexport interface CellOptions {\n readonly value?: string | number | boolean | Date | null;\n readonly reference?: string;\n /** Direct style index (for pre-resolved styles) */\n readonly styleIndex?: number;\n /** Style options (resolved to index at compile time) */\n readonly style?: StyleOptions;\n /** Formula options. When set, value becomes the cached result. */\n readonly formula?: FormulaOptions;\n}\n\n/** Cell formula type (maps to ST_CellFormulaType). */\nexport const FormulaType = {\n NORMAL: \"normal\",\n ARRAY: \"array\",\n SHARED: \"shared\",\n} as const;\n\nexport type FormulaType = (typeof FormulaType)[keyof typeof FormulaType];\n\n/** Options for a cell formula (maps to CT_CellFormula). */\nexport interface FormulaOptions {\n /** Formula expression, e.g. \"SUM(A1:B1)\" */\n readonly formula: string;\n /** Formula type (default: \"normal\") */\n readonly type?: FormulaType;\n /** Reference range for array/shared formulas, e.g. \"C1:C10\" */\n readonly reference?: string;\n /** Shared formula group index (required for shared formulas) */\n readonly sharedIndex?: number;\n}\n\nexport interface MergeCellOptions {\n readonly from: { readonly row: number; readonly col: number };\n readonly to: { readonly row: number; readonly col: number };\n}\n\nexport interface FreezePaneOptions {\n /** Row split position (1-based, freezes rows above) */\n readonly row?: number;\n /** Column split position (1-based, freezes columns to the left) */\n readonly col?: number;\n}\n\nexport interface WorksheetImageOptions {\n readonly data: Uint8Array;\n readonly type: \"png\" | \"jpeg\" | \"jpg\";\n readonly col: number;\n readonly row: number;\n}\n\nexport interface WorksheetChartOptions extends ChartSpaceOptions {\n /** 1-based column position for the chart */\n readonly col: number;\n /** 1-based row position for the chart */\n readonly row: number;\n}\n\nexport type DataValidationType =\n | \"none\"\n | \"whole\"\n | \"decimal\"\n | \"list\"\n | \"date\"\n | \"time\"\n | \"textLength\"\n | \"custom\";\nexport type DataValidationOperator =\n | \"between\"\n | \"notBetween\"\n | \"equal\"\n | \"notEqual\"\n | \"greaterThan\"\n | \"lessThan\"\n | \"greaterThanOrEqual\"\n | \"lessThanOrEqual\";\n\nexport interface DataValidationOptions {\n /** Cell range, e.g. \"A1:A10\" */\n readonly sqref: string;\n readonly type?: DataValidationType;\n readonly operator?: DataValidationOperator;\n readonly formula1?: string;\n readonly formula2?: string;\n readonly allowBlank?: boolean;\n readonly showErrorMessage?: boolean;\n readonly errorTitle?: string;\n readonly error?: string;\n readonly showInputMessage?: boolean;\n readonly promptTitle?: string;\n readonly prompt?: string;\n}\n\nexport type ConditionalFormatType =\n | \"cellIs\"\n | \"containsText\"\n | \"expression\"\n | \"top10\"\n | \"aboveAverage\";\nexport type ConditionalFormatOperator =\n | \"lessThan\"\n | \"lessThanOrEqual\"\n | \"equal\"\n | \"notEqual\"\n | \"greaterThanOrEqual\"\n | \"greaterThan\"\n | \"between\"\n | \"notBetween\"\n | \"containsText\"\n | \"notContains\"\n | \"beginsWith\"\n | \"endsWith\";\n\nexport interface ConditionalFormatRule {\n readonly type: ConditionalFormatType;\n readonly operator?: ConditionalFormatOperator;\n /** Formula(s) — up to 3 */\n readonly formulas?: readonly string[];\n readonly priority?: number;\n /** Reference to a dxf (differential format) in the styles table */\n readonly dxfId?: number;\n}\n\nexport interface ConditionalFormatOptions {\n /** Cell range, e.g. \"A1:A10\" */\n readonly sqref: string;\n readonly rules: readonly ConditionalFormatRule[];\n}\n\nexport interface WorksheetOptions {\n readonly name?: string;\n readonly children?: readonly RowOptions[];\n readonly columns?: readonly ColumnOptions[];\n readonly mergeCells?: readonly MergeCellOptions[];\n readonly freezePanes?: FreezePaneOptions;\n /** Auto-filter range, e.g. \"A1:D10\" */\n readonly autoFilter?: string;\n readonly images?: readonly WorksheetImageOptions[];\n readonly charts?: readonly WorksheetChartOptions[];\n readonly dataValidations?: readonly DataValidationOptions[];\n readonly conditionalFormats?: readonly ConditionalFormatOptions[];\n}\n\nexport class Worksheet extends IgnoreIfEmptyXmlComponent {\n private readonly rows: readonly RowOptions[];\n private readonly columns: readonly ColumnOptions[];\n private readonly mergeCells: readonly MergeCellOptions[];\n private readonly freezePanes?: FreezePaneOptions;\n private readonly autoFilter?: string;\n private readonly images: readonly WorksheetImageOptions[];\n private readonly chartOptions: readonly WorksheetChartOptions[];\n private readonly dataValidations: readonly DataValidationOptions[];\n private readonly conditionalFormats: readonly ConditionalFormatOptions[];\n\n public constructor(options: WorksheetOptions) {\n super(\"worksheet\");\n this.rows = options.children ?? [];\n this.columns = options.columns ?? [];\n this.mergeCells = options.mergeCells ?? [];\n this.freezePanes = options.freezePanes;\n this.autoFilter = options.autoFilter;\n this.images = options.images ?? [];\n this.chartOptions = options.charts ?? [];\n this.dataValidations = options.dataValidations ?? [];\n this.conditionalFormats = options.conditionalFormats ?? [];\n }\n\n public get imageOptions(): readonly WorksheetImageOptions[] {\n return this.images;\n }\n\n public get charts(): readonly WorksheetChartOptions[] {\n return this.chartOptions;\n }\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(context: Context): string {\n const fileData = context.fileData as\n | { sharedStrings?: SharedStrings; styles?: Styles }\n | undefined;\n const sharedStrings = fileData?.sharedStrings;\n const styles = fileData?.styles;\n\n const p: string[] = [\n '<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">',\n ];\n\n // Dimension — defines the used range of the sheet\n const maxRow = this.rows.length;\n let maxCol = 0;\n for (const row of this.rows) {\n if (row.cells && row.cells.length > maxCol) maxCol = row.cells.length;\n }\n if (maxRow > 0 && maxCol > 0) {\n const dimRef = `A1:${this.defaultCellRef(maxRow, maxCol)}`;\n p.push(`<dimension ref=\"${dimRef}\"/>`);\n }\n\n // Sheet views\n if (this.freezePanes) {\n const fp = this.freezePanes;\n const ySplit = fp.row ? fp.row : 0;\n const xSplit = fp.col ? fp.col : 0;\n const topRow = fp.row ? fp.row + 1 : 1;\n const leftCol = fp.col ? fp.col + 1 : 1;\n const topLeftCell = this.defaultCellRef(topRow, leftCol);\n const activePane =\n ySplit > 0 && xSplit > 0 ? \"bottomRight\" : ySplit > 0 ? \"bottomLeft\" : \"topRight\";\n p.push(\n '<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\">',\n `<pane ySplit=\"${ySplit}\" xSplit=\"${xSplit}\" topLeftCell=\"${topLeftCell}\" activePane=\"${activePane}\" state=\"frozen\"/>`,\n \"</sheetView></sheetViews>\",\n );\n } else {\n // Default sheetView (required by Excel)\n p.push('<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\"/></sheetViews>');\n }\n\n // Sheet format — default row height\n p.push('<sheetFormatPr defaultRowHeight=\"15\"/>');\n\n // Column definitions\n if (this.columns.length > 0) {\n p.push(\"<cols>\");\n for (const col of this.columns) {\n const colAttrs: Record<string, string | number | boolean | undefined> = {\n min: col.min,\n max: col.max,\n };\n if (col.width !== undefined) {\n colAttrs.width = col.width;\n colAttrs.customWidth = 1;\n }\n if (col.hidden) {\n colAttrs.hidden = 1;\n }\n p.push(selfCloseElement(\"col\", attrs(colAttrs)));\n }\n p.push(\"</cols>\");\n }\n\n // Sheet data (rows + cells) — the hot path\n p.push(\"<sheetData>\");\n for (let i = 0; i < this.rows.length; i++) {\n const rowOpts = this.rows[i];\n const rowNumber = rowOpts.rowNumber ?? i + 1;\n const rowAttrs: Record<string, string | number | boolean | undefined> = { r: rowNumber };\n if (rowOpts.height !== undefined) {\n rowAttrs.ht = rowOpts.height;\n rowAttrs.customHeight = 1;\n }\n if (rowOpts.hidden) {\n rowAttrs.hidden = 1;\n }\n\n if (rowOpts.cells) {\n const rowParts: string[] = [];\n for (let j = 0; j < rowOpts.cells.length; j++) {\n const cell = rowOpts.cells[j];\n const ref = cell.reference ?? this.defaultCellRef(rowNumber, j + 1);\n const cellStr = this.buildCellString(ref, cell, sharedStrings, styles);\n if (cellStr) rowParts.push(cellStr);\n }\n p.push(`<row${attrs(rowAttrs)}>`, ...rowParts, \"</row>\");\n } else {\n p.push(`<row${attrs(rowAttrs)}/>`);\n }\n }\n p.push(\"</sheetData>\");\n\n // Auto filter\n if (this.autoFilter) {\n p.push(selfCloseElement(\"autoFilter\", attrs({ ref: this.autoFilter })));\n }\n\n // Merge cells\n if (this.mergeCells.length > 0) {\n p.push(`<mergeCells count=\"${this.mergeCells.length}\">`);\n for (const mc of this.mergeCells) {\n const fromRef = this.defaultCellRef(mc.from.row, mc.from.col);\n const toRef = this.defaultCellRef(mc.to.row, mc.to.col);\n p.push(selfCloseElement(\"mergeCell\", attrs({ ref: `${fromRef}:${toRef}` })));\n }\n p.push(\"</mergeCells>\");\n }\n\n // Conditional formatting\n if (this.conditionalFormats.length > 0) {\n for (const cf of this.conditionalFormats) {\n p.push(`<conditionalFormatting sqref=\"${cf.sqref}\">`);\n for (let ri = 0; ri < cf.rules.length; ri++) {\n const rule = cf.rules[ri];\n const ruleAttrs: Record<string, string | number | boolean | undefined> = {\n type: rule.type,\n priority: rule.priority ?? ri + 1,\n };\n if (rule.operator) ruleAttrs.operator = rule.operator;\n if (rule.dxfId !== undefined) ruleAttrs.dxfId = rule.dxfId;\n if (rule.formulas && rule.formulas.length > 0) {\n const formulaParts = rule.formulas.map((f) => `<formula>${escapeXml(f)}</formula>`);\n p.push(`<cfRule${attrs(ruleAttrs)}>`, ...formulaParts, \"</cfRule>\");\n } else {\n p.push(selfCloseElement(\"cfRule\", attrs(ruleAttrs)));\n }\n }\n p.push(\"</conditionalFormatting>\");\n }\n }\n\n // Data validations\n if (this.dataValidations.length > 0) {\n p.push(`<dataValidations count=\"${this.dataValidations.length}\">`);\n for (const dv of this.dataValidations) {\n const dvAttrs: Record<string, string | number | boolean | undefined> = { sqref: dv.sqref };\n if (dv.type && dv.type !== \"none\") dvAttrs.type = dv.type;\n if (dv.operator) dvAttrs.operator = dv.operator;\n if (dv.allowBlank) dvAttrs.allowBlank = 1;\n if (dv.showErrorMessage) dvAttrs.showErrorMessage = 1;\n if (dv.showInputMessage) dvAttrs.showInputMessage = 1;\n if (dv.errorTitle) dvAttrs.errorTitle = dv.errorTitle;\n if (dv.error) dvAttrs.error = dv.error;\n if (dv.promptTitle) dvAttrs.promptTitle = dv.promptTitle;\n if (dv.prompt) dvAttrs.prompt = dv.prompt;\n const inner: string[] = [];\n if (dv.formula1 !== undefined) inner.push(`<formula1>${escapeXml(dv.formula1)}</formula1>`);\n if (dv.formula2 !== undefined) inner.push(`<formula2>${escapeXml(dv.formula2)}</formula2>`);\n if (inner.length > 0) {\n p.push(`<dataValidation${attrs(dvAttrs)}>`, ...inner, \"</dataValidation>\");\n } else {\n p.push(selfCloseElement(\"dataValidation\", attrs(dvAttrs)));\n }\n }\n p.push(\"</dataValidations>\");\n }\n\n p.push('<pageMargins left=\"0.75\" right=\"0.75\" top=\"1\" bottom=\"1\" header=\"0.5\" footer=\"0.5\"/>');\n p.push(\"</worksheet>\");\n return p.join(\"\");\n }\n\n /**\n * Build the <f> element string for a cell formula.\n */\n private buildFormulaString(fOpts: FormulaOptions): string {\n const fAttrs: Record<string, string | number | boolean | undefined> = {};\n if (fOpts.type && fOpts.type !== FormulaType.NORMAL) fAttrs.t = fOpts.type;\n if (fOpts.reference) fAttrs.ref = fOpts.reference;\n if (fOpts.sharedIndex !== undefined) fAttrs.si = fOpts.sharedIndex;\n\n const hasContent = fOpts.formula !== undefined && fOpts.formula !== \"\";\n\n if (hasContent) {\n return `<f${attrs(fAttrs)}>${escapeXml(fOpts.formula)}</f>`;\n }\n if (Object.keys(fAttrs).length > 0) {\n return selfCloseElement(\"f\", attrs(fAttrs));\n }\n return \"\";\n }\n\n /**\n * Direct string serialization of a single cell — zero intermediate objects.\n */\n private buildCellString(\n ref: string,\n cell: CellOptions,\n sharedStrings?: SharedStrings,\n styles?: Styles,\n ): string {\n const cellAttrs: Record<string, string | number | boolean | undefined> = { r: ref };\n\n // Resolve style\n if (cell.style !== undefined && styles) {\n cellAttrs.s = styles.register(cell.style);\n } else if (cell.styleIndex !== undefined) {\n cellAttrs.s = cell.styleIndex;\n }\n\n const value = cell.value;\n\n // Formula path — formula takes precedence; value is the cached result.\n if (cell.formula) {\n const fStr = this.buildFormulaString(cell.formula);\n let vStr = \"\";\n if (value === null || value === undefined) {\n return `<c${attrs(cellAttrs)}>${fStr}</c>`;\n }\n if (typeof value === \"number\") {\n vStr = `<v>${value}</v>`;\n } else if (typeof value === \"boolean\") {\n cellAttrs.t = \"b\";\n vStr = `<v>${value ? 1 : 0}</v>`;\n } else if (typeof value === \"string\") {\n cellAttrs.t = \"str\";\n vStr = `<v>${escapeXml(value)}</v>`;\n } else if (value instanceof Date) {\n vStr = `<v>${this.dateToSerialNumber(value)}</v>`;\n }\n if (vStr) {\n return `<c${attrs(cellAttrs)}>${fStr}${vStr}</c>`;\n }\n return `<c${attrs(cellAttrs)}>${fStr}</c>`;\n }\n\n if (value === null || value === undefined) {\n if (cell.styleIndex !== undefined) {\n return selfCloseElement(\"c\", attrs(cellAttrs));\n }\n return \"\";\n }\n\n if (typeof value === \"string\") {\n if (sharedStrings) {\n cellAttrs.t = \"s\";\n const idx = sharedStrings.register(value);\n return `<c${attrs(cellAttrs)}><v>${idx}</v></c>`;\n }\n cellAttrs.t = \"inlineStr\";\n return `<c${attrs(cellAttrs)}><is><t>${escapeXml(value)}</t></is></c>`;\n }\n\n if (typeof value === \"number\") {\n return `<c${attrs(cellAttrs)}><v>${value}</v></c>`;\n }\n\n if (typeof value === \"boolean\") {\n cellAttrs.t = \"b\";\n return `<c${attrs(cellAttrs)}><v>${value ? 1 : 0}</v></c>`;\n }\n\n if (value instanceof Date) {\n const serial = this.dateToSerialNumber(value);\n return `<c${attrs(cellAttrs)}><v>${serial}</v></c>`;\n }\n\n return \"\";\n }\n\n private defaultCellRef(row: number, col: number): string {\n return this.columnToLetter(col) + row;\n }\n\n private columnToLetter(col: number): string {\n let result = \"\";\n let n = col;\n while (n > 0) {\n const remainder = (n - 1) % 26;\n result = String.fromCharCode(65 + remainder) + result;\n n = Math.floor((n - 1) / 26);\n }\n return result;\n }\n\n private dateToSerialNumber(date: Date): number {\n const epoch = new Date(1899, 11, 30);\n const msPerDay = 86400000;\n return (date.getTime() - epoch.getTime()) / msPerDay;\n }\n}\n","import { ContentTypes } from \"@file/content-types\";\nimport { CoreProperties, type CorePropertiesOptions } from \"@file/core-properties\";\nimport { Media } from \"@file/media/media\";\nimport { SharedStrings } from \"@file/shared-strings\";\nimport { Styles } from \"@file/styles\";\nimport { DefaultTheme } from \"@file/theme\";\nimport { WorkbookXml, type SheetDefinition } from \"@file/workbook\";\nimport { Worksheet, type WorksheetOptions } from \"@file/worksheet\";\n/**\n * File class (exported as Workbook) — the top-level container for XLSX documents.\n *\n * @module\n */\nimport { AppProperties, ChartCollection, Relationships } from \"@office-open/core\";\n\nexport interface WorkbookOptions extends CorePropertiesOptions {\n readonly worksheets?: readonly WorksheetOptions[];\n}\n\nexport class File {\n private readonly worksheetOptions: readonly WorksheetOptions[];\n private readonly corePropsOptions: CorePropertiesOptions;\n\n // Lazy components\n private _coreProperties?: CoreProperties;\n private _appProperties?: AppProperties;\n private _contentTypes?: ContentTypes;\n private _styles?: Styles;\n private _theme?: DefaultTheme;\n private _workbookXml?: WorkbookXml;\n private _worksheets?: Worksheet[];\n private _sharedStrings?: SharedStrings;\n private _media?: Media;\n private _fileRels?: Relationships;\n private _workbookRels?: Relationships;\n private _charts?: ChartCollection;\n\n public constructor(options: WorkbookOptions) {\n this.worksheetOptions = options.worksheets ?? [];\n this.corePropsOptions = options;\n }\n\n // ── Lazy getters ──\n\n public get coreProperties(): CoreProperties {\n return (this._coreProperties ??= new CoreProperties(this.corePropsOptions));\n }\n\n public get appProperties(): AppProperties {\n return (this._appProperties ??= new AppProperties());\n }\n\n public get contentTypes(): ContentTypes {\n if (!this._contentTypes) {\n this._contentTypes = new ContentTypes();\n for (let i = 0; i < this.worksheetOptions.length; i++) {\n this._contentTypes.addWorksheet(i + 1);\n }\n this._contentTypes.addStyles();\n this._contentTypes.addSharedStrings();\n this._contentTypes.addTheme();\n }\n return this._contentTypes;\n }\n\n public get styles(): Styles {\n return (this._styles ??= new Styles());\n }\n\n public get theme(): DefaultTheme {\n return (this._theme ??= new DefaultTheme());\n }\n\n public get workbookXml(): WorkbookXml {\n if (!this._workbookXml) {\n const sheets: SheetDefinition[] = this.worksheetOptions.map((ws, i) => ({\n name: ws.name ?? `Sheet${i + 1}`,\n sheetId: i + 1,\n rId: `rId${i + 1}`,\n }));\n this._workbookXml = new WorkbookXml(sheets);\n }\n return this._workbookXml;\n }\n\n public get sharedStrings(): SharedStrings {\n return (this._sharedStrings ??= new SharedStrings());\n }\n\n public get media(): Media {\n return (this._media ??= new Media());\n }\n\n public get charts(): ChartCollection {\n return (this._charts ??= new ChartCollection());\n }\n\n public get worksheets(): readonly Worksheet[] {\n if (!this._worksheets) {\n this._worksheets = this.worksheetOptions.map((ws) => new Worksheet(ws));\n }\n return this._worksheets;\n }\n\n public get fileRelationships(): Relationships {\n if (!this._fileRels) {\n this._fileRels = new Relationships();\n this._fileRels.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n \"xl/workbook.xml\",\n );\n this._fileRels.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n this._fileRels.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n }\n return this._fileRels;\n }\n\n public get workbookRelationships(): Relationships {\n if (!this._workbookRels) {\n this._workbookRels = new Relationships();\n let rid = 1;\n for (let i = 0; i < this.worksheetOptions.length; i++) {\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\",\n `worksheets/sheet${i + 1}.xml`,\n );\n }\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\",\n \"styles.xml\",\n );\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\",\n \"theme/theme1.xml\",\n );\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\",\n \"sharedStrings.xml\",\n );\n }\n return this._workbookRels;\n }\n}\n","/**\n * XLSX Drawing component — generates xl/drawings/drawing{n}.xml.\n *\n * Uses the spreadsheetDrawing namespace (default, no prefix) for anchoring\n * images and charts to worksheet cells.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\nexport interface ImageOptions {\n /** 1-based column */\n readonly col: number;\n /** Column offset in EMU (default 0) */\n readonly colOffset?: number;\n /** 1-based row */\n readonly row: number;\n /** Row offset in EMU (default 0) */\n readonly rowOffset?: number;\n /** Relationship ID for the image */\n readonly rId: string;\n}\n\nexport interface ChartAnchorOptions {\n /** 1-based column */\n readonly col: number;\n /** Column offset in EMU (default 0) */\n readonly colOffset?: number;\n /** 1-based row */\n readonly row: number;\n /** Row offset in EMU (default 0) */\n readonly rowOffset?: number;\n /** Relationship ID for the chart */\n readonly rId: string;\n}\n\nconst XDR_NS = \"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\";\nconst A_NS = \"http://schemas.openxmlformats.org/drawingml/2006/main\";\nconst R_NS = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\";\nconst C_URI = \"http://schemas.openxmlformats.org/drawingml/2006/chart\";\n\nexport class Drawing extends BaseXmlComponent {\n private readonly images: readonly ImageOptions[];\n private readonly charts: readonly ChartAnchorOptions[];\n\n public constructor(images: readonly ImageOptions[], charts: readonly ChartAnchorOptions[] = []) {\n super(\"wsDr\");\n this.images = images;\n this.charts = charts;\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [`<wsDr xmlns=\"${XDR_NS}\" xmlns:a=\"${A_NS}\" xmlns:r=\"${R_NS}\">`];\n let id = 1;\n for (const img of this.images) {\n p.push(\n `<twoCellAnchor editAs=\"oneCell\"><from><col>${img.col - 1}</col><colOff>${img.colOffset ?? 0}</colOff><row>${img.row - 1}</row><rowOff>${img.rowOffset ?? 0}</rowOff></from>`,\n `<to><col>${img.col}</col><colOff>0</colOff><row>${img.row}</row><rowOff>0</rowOff></to>`,\n `<pic><nvPicPr><cNvPr id=\"${id}\" name=\"Picture ${id}\"/><cNvPicPr preferRelativeResize=\"1\"/></nvPicPr>`,\n `<blipFill><a:blip r:embed=\"${img.rId}\"/><a:stretch><a:fillRect/></a:stretch></blipFill>`,\n `<spPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"400000\" cy=\"300000\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></spPr></pic>`,\n `<clientData/></twoCellAnchor>`,\n );\n id++;\n }\n for (const chart of this.charts) {\n p.push(\n `<twoCellAnchor editAs=\"oneCell\"><from><col>${chart.col - 1}</col><colOff>${chart.colOffset ?? 0}</colOff><row>${chart.row - 1}</row><rowOff>${chart.rowOffset ?? 0}</rowOff></from>`,\n `<to><col>${chart.col + 8}</col><colOff>0</colOff><row>${chart.row + 15}</row><rowOff>0</rowOff></to>`,\n `<graphicFrame><nvGraphicFramePr><cNvPr id=\"${id}\" name=\"Chart ${id}\"/><cNvGraphicFramePr><a:graphicFrameLocks noGrp=\"1\"/></cNvGraphicFramePr></nvGraphicFramePr>`,\n `<xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/></xfrm>`,\n `<a:graphic><a:graphicData uri=\"${C_URI}\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"${R_NS}\" r:id=\"${chart.rId}\"/></a:graphicData></a:graphic></graphicFrame>`,\n `<clientData/></twoCellAnchor>`,\n );\n id++;\n }\n p.push(\"</wsDr>\");\n return p.join(\"\");\n }\n}\n","/**\n * XLSX Compiler — compiles a File object into a Zippable structure.\n *\n * @module\n */\nimport { Formatter } from \"@export/formatter\";\nimport { Drawing, type ImageOptions, type ChartAnchorOptions } from \"@file/drawing/drawing\";\nimport type { File } from \"@file/file\";\nimport type { Context } from \"@file/xml-components\";\nimport {\n ChartSpace,\n Relationships,\n compileMapping,\n type XmlifyedFile,\n type Zippable,\n} from \"@office-open/core\";\n\nexport class Compiler {\n private readonly formatter = new Formatter();\n\n public compile(file: File, overrides: readonly XmlifyedFile[] = []): Zippable {\n const context: Context = { fileData: file, stack: [] };\n const f = this.formatter;\n\n const mapping: Record<string, { data: string; path: string }> = {};\n\n const fmt = (component: any) => f.formatToXml(component, context);\n\n // Core properties\n mapping[\"Properties\"] = {\n data: fmt(file.coreProperties),\n path: \"docProps/core.xml\",\n };\n\n // App properties\n mapping[\"AppProperties\"] = {\n data: fmt(file.appProperties),\n path: \"docProps/app.xml\",\n };\n\n // File-level relationships (_rels/.rels)\n mapping[\"FileRelationships\"] = {\n data: fmt(file.fileRelationships),\n path: \"_rels/.rels\",\n };\n\n // Workbook\n mapping[\"Workbook\"] = {\n data: fmt(file.workbookXml),\n path: \"xl/workbook.xml\",\n };\n\n // Workbook relationships\n mapping[\"WorkbookRelationships\"] = {\n data: fmt(file.workbookRelationships),\n path: \"xl/_rels/workbook.xml.rels\",\n };\n\n // Worksheets — formatted BEFORE SharedStrings so strings are registered\n const worksheets = file.worksheets;\n let globalMediaIdx = 0;\n let globalChartIdx = 0;\n\n for (let i = 0; i < worksheets.length; i++) {\n const ws = worksheets[i];\n const imgOpts = ws.imageOptions;\n const chartOpts = ws.charts;\n\n // Worksheet uses toXml() fast path (zero-allocation string concat)\n let sheetXml = fmt(ws);\n\n const hasMedia = imgOpts.length > 0 || chartOpts.length > 0;\n\n if (hasMedia) {\n const drawingImages: ImageOptions[] = [];\n const drawingCharts: ChartAnchorOptions[] = [];\n const drawingRels = new Relationships();\n let rid = 1;\n\n // Process images\n for (const img of imgOpts) {\n const mediaKey = `image_${globalMediaIdx}`;\n const ext = img.type === \"jpeg\" || img.type === \"jpg\" ? \"jpeg\" : \"png\";\n file.media.addImage(mediaKey, {\n fileName: `image${globalMediaIdx + 1}.${ext}`,\n type: ext,\n data: img.data,\n width: 0,\n height: 0,\n });\n\n drawingRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `../media/image${globalMediaIdx + 1}.${ext}`,\n );\n\n drawingImages.push({\n col: img.col,\n row: img.row,\n rId: `rId${rid}`,\n });\n rid++;\n globalMediaIdx++;\n }\n\n // Process charts\n for (const chart of chartOpts) {\n const chartKey = `chart_${globalChartIdx}`;\n file.charts.addChart(chartKey, {\n key: chartKey,\n chartSpace: new ChartSpace(chart),\n });\n\n drawingRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `../charts/chart${globalChartIdx + 1}.xml`,\n );\n\n drawingCharts.push({\n col: chart.col,\n row: chart.row,\n rId: `rId${rid}`,\n });\n rid++;\n globalChartIdx++;\n }\n\n // Generate drawing XML\n const drawing = new Drawing(drawingImages, drawingCharts);\n const drawingIdx = i + 1;\n mapping[`Drawing${i}`] = {\n data: fmt(drawing),\n path: `xl/drawings/drawing${drawingIdx}.xml`,\n };\n\n // Drawing relationships\n mapping[`DrawingRels${i}`] = {\n data: fmt(drawingRels),\n path: `xl/drawings/_rels/drawing${drawingIdx}.xml.rels`,\n };\n\n // Insert drawing reference before the closing </worksheet> tag.\n // Use slice instead of replace to avoid O(n) full-string scan.\n const closingTag = \"</worksheet>\";\n sheetXml =\n sheetXml.slice(0, -closingTag.length) + `<drawing r:id=\"rId${rid}\"/>` + closingTag;\n\n // Worksheet needs its own rels for drawing reference\n const wsRels = new Relationships();\n wsRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing\",\n `../drawings/drawing${drawingIdx}.xml`,\n );\n mapping[`WorksheetRels${i}`] = {\n data: fmt(wsRels),\n path: `xl/worksheets/_rels/sheet${i + 1}.xml.rels`,\n };\n\n file.contentTypes.addDrawing(drawingIdx);\n }\n\n mapping[`Worksheet${i}`] = {\n data: sheetXml,\n path: `xl/worksheets/sheet${i + 1}.xml`,\n };\n }\n\n // Shared Strings — AFTER worksheets so all strings are collected\n const sharedStrings = file.sharedStrings;\n if (sharedStrings.count > 0) {\n mapping[\"SharedStrings\"] = {\n data: fmt(sharedStrings),\n path: \"xl/sharedStrings.xml\",\n };\n }\n\n // Styles\n mapping[\"Styles\"] = {\n data: fmt(file.styles),\n path: \"xl/styles.xml\",\n };\n\n // Theme\n mapping[\"Theme\"] = {\n data: fmt(file.theme),\n path: \"xl/theme/theme1.xml\",\n };\n\n // Charts — AFTER worksheets so charts are registered\n for (let i = 0; i < file.charts.array.length; i++) {\n const chartData = file.charts.array[i];\n mapping[`Chart${i}`] = {\n data: fmt(chartData.chartSpace),\n path: `xl/charts/chart${i + 1}.xml`,\n };\n file.contentTypes.addChart(i + 1);\n }\n\n // Register image content types\n const imageExts = new Set<string>();\n for (const img of file.media.array) {\n const ext = img.fileName.endsWith(\".png\") ? \"png\" : \"jpeg\";\n if (!imageExts.has(ext)) {\n imageExts.add(ext);\n file.contentTypes.addImageType(ext as \"png\" | \"jpeg\");\n }\n }\n\n // Content Types — must be last\n mapping[\"ContentTypes\"] = {\n data: fmt(file.contentTypes),\n path: \"[Content_Types].xml\",\n };\n\n // Convert mapping to Zippable\n const mediaFiles: Array<{ data: Uint8Array; path: string }> = [];\n for (const img of file.media.array) {\n mediaFiles.push({ data: img.data, path: `xl/media/${img.fileName}` });\n }\n\n return compileMapping(mapping, overrides, mediaFiles);\n }\n}\n","import type { File } from \"@file/file\";\n/**\n * Packer module — export API for XLSX files.\n *\n * @module\n */\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\n\nimport { Compiler } from \"./next-compiler\";\n\nconst compiler = new Compiler();\n\nexport const Packer = createPacker<File>({\n compile: (file, overrides) => compiler.compile(file, overrides),\n mimeType: OoxmlMimeType.XLSX,\n});\n","/**\n * Convert a 1-based column number to Excel column letter(s).\n * 1 → \"A\", 26 → \"Z\", 27 → \"AA\", 28 → \"AB\"\n */\nexport function columnToLetter(col: number): string {\n let result = \"\";\n let n = col;\n while (n > 0) {\n const remainder = (n - 1) % 26;\n result = String.fromCharCode(65 + remainder) + result;\n n = Math.floor((n - 1) / 26);\n }\n return result;\n}\n\n/**\n * Convert Excel column letter(s) to a 1-based column number.\n * \"A\" → 1, \"Z\" → 26, \"AA\" → 27\n */\nexport function letterToColumn(s: string): number {\n let result = 0;\n for (let i = 0; i < s.length; i++) {\n result = result * 26 + (s.charCodeAt(i) - 64);\n }\n return result;\n}\n\n/**\n * Convert a JavaScript Date to an Excel serial number.\n * Excel epoch: January 1, 1900 = 1 (with the 1900 leap year bug).\n */\nexport function dateToSerialNumber(date: Date): number {\n // Excel treats 1900 as a leap year (bug inherited from Lotus 1-2-3).\n // The epoch is effectively December 30, 1899 = 0.\n const epoch = new Date(1899, 11, 30);\n const msPerDay = 86400000;\n const diff = date.getTime() - epoch.getTime();\n return diff / msPerDay;\n}\n","/**\n * XLSX parsing — parse .xlsx files into structured data.\n *\n * @module\n */\nimport { parseArchive, parseCorePropsElement } from \"@office-open/core\";\nimport type { ParsedArchive } from \"@office-open/core\";\nimport type { Element } from \"@office-open/xml\";\nimport { attr, attrNum, findChild, textOf } from \"@office-open/xml\";\nimport { toUint8Array } from \"undio\";\nimport type { DataType } from \"undio\";\n\nimport type { WorkbookOptions } from \"./file/file\";\nimport type {\n WorksheetOptions,\n RowOptions,\n CellOptions,\n ColumnOptions,\n MergeCellOptions,\n} from \"./file/worksheet\";\nimport { letterToColumn } from \"./util\";\n\nexport { parseArchive };\n\n// ── Low-level parse result ──\n\nexport interface XlsxPartRefs {\n worksheets: string[];\n charts: string[];\n media: string[];\n drawings: string[];\n}\n\nexport interface XlsxDocument {\n doc: ParsedArchive;\n /** xl/workbook.xml root element */\n workbook?: Element;\n /** Worksheet paths (xl/worksheets/sheet{n}.xml) */\n worksheets: string[];\n /** xl/styles.xml root element */\n styles?: Element;\n /** xl/sharedStrings.xml root element */\n sharedStrings?: Element;\n partRefs: XlsxPartRefs;\n /** docProps/core.xml path */\n coreProps?: string;\n /** docProps/app.xml path */\n appProps?: string;\n}\n\nfunction sortByNumber(paths: string[]): string[] {\n return paths.sort((a, b) => {\n const numA = parseInt(a.match(/(\\d+)/)?.[1] ?? \"0\", 10);\n const numB = parseInt(b.match(/(\\d+)/)?.[1] ?? \"0\", 10);\n return numA - numB;\n });\n}\n\n/**\n * Parse raw .xlsx data into a low-level XlsxDocument.\n */\nexport function parseXlsx(data: DataType): XlsxDocument {\n const uint8 = toUint8Array(data);\n const doc = parseArchive(uint8);\n\n const workbook = doc.get(\"xl/workbook.xml\");\n const styles = doc.get(\"xl/styles.xml\");\n const sharedStrings = doc.get(\"xl/sharedStrings.xml\");\n\n // Resolve worksheet paths from workbook rels\n const worksheets: string[] = [];\n const charts: string[] = [];\n const drawings: string[] = [];\n const media: string[] = [];\n\n const wbRels = doc.get(\"xl/_rels/workbook.xml.rels\");\n if (wbRels) {\n for (const child of wbRels.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (!target) continue;\n\n if (type.includes(\"/worksheet\")) {\n worksheets.push(target.startsWith(\"/\") ? target.slice(1) : `xl/${target}`);\n }\n }\n }\n sortByNumber(worksheets);\n\n // Scan for drawings, charts, media\n drawings.push(...doc.keys(\"xl/drawings/\").filter((k) => k.endsWith(\".xml\")));\n charts.push(...doc.keys(\"xl/charts/\").filter((k) => k.endsWith(\".xml\")));\n media.push(...doc.keys(\"xl/media/\"));\n sortByNumber(drawings);\n sortByNumber(charts);\n\n // Root rels → core/app props\n let coreProps: string | undefined;\n let appProps: string | undefined;\n const rootRels = doc.get(\"_rels/.rels\");\n if (rootRels) {\n for (const child of rootRels.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (type.includes(\"/core-properties\")) coreProps = target;\n else if (type.includes(\"/extended-properties\")) appProps = target;\n }\n }\n\n return {\n doc,\n workbook,\n worksheets,\n styles,\n sharedStrings,\n partRefs: { worksheets, charts, media, drawings },\n coreProps,\n appProps,\n };\n}\n\n// ── Shared strings helper ──\n\nfunction parseSharedStrings(el: Element | undefined): string[] {\n if (!el) return [];\n const strings: string[] = [];\n for (const si of el.elements ?? []) {\n if (si.name !== \"si\") continue;\n // Handle both <si><t>text</t></si> and <si><r><t>text</t></r>...</si>\n const t = findChild(si, \"t\");\n if (t) {\n strings.push(textOf(t) ?? \"\");\n } else {\n // Rich text: concatenate all <r><t> segments\n const parts: string[] = [];\n for (const r of si.elements ?? []) {\n if (r.name !== \"r\") continue;\n const rt = findChild(r, \"t\");\n if (rt) parts.push(textOf(rt) ?? \"\");\n }\n strings.push(parts.join(\"\"));\n }\n }\n return strings;\n}\n\n// ── Cell reference helpers ──\n\nfunction colFromRef(ref: string): number {\n const match = ref.match(/^([A-Z]+)/);\n return match ? letterToColumn(match[1]) : 1;\n}\n\nfunction rowFromRef(ref: string): number {\n const match = ref.match(/(\\d+)$/);\n return match ? parseInt(match[1], 10) : 1;\n}\n\n// ── Worksheet parsing ──\n\nfunction parseWorksheetElement(wsEl: Element, strings: string[]): WorksheetOptions {\n const opts: Record<string, unknown> = {};\n\n // Sheet name from the parent workbook's sheet element (not available here)\n // Caller should set it\n\n // Columns\n // Elements might be prefixed or unprefixed depending on how the XML parser handles default namespaces.\n const colsEl = findChild(wsEl, \"cols\") ?? findChildByLocalName(wsEl, \"cols\");\n if (colsEl) {\n const columns: ColumnOptions[] = [];\n for (const col of colsEl.elements ?? []) {\n if (localName(col) !== \"col\") continue;\n const min = attrNum(col, \"min\");\n const max = attrNum(col, \"max\");\n if (min === undefined || max === undefined) continue;\n const colOpts: Record<string, unknown> = { min, max };\n const width = attrNum(col, \"width\");\n if (width !== undefined) colOpts.width = width;\n if (attr(col, \"hidden\") === \"1\") colOpts.hidden = true;\n columns.push(colOpts as unknown as ColumnOptions);\n }\n if (columns.length > 0) opts.columns = columns;\n }\n\n // Freeze panes\n const sheetViews = findChildByLocalName(wsEl, \"sheetViews\");\n if (sheetViews) {\n const sheetView = findChildByLocalName(sheetViews, \"sheetView\");\n if (sheetView) {\n const pane = findChildByLocalName(sheetView, \"pane\");\n if (pane) {\n const state = attr(pane, \"state\");\n if (state === \"frozen\") {\n const freezePanes: Record<string, unknown> = {};\n const ySplit = attrNum(pane, \"ySplit\");\n const xSplit = attrNum(pane, \"xSplit\");\n if (ySplit && ySplit > 0) freezePanes.row = ySplit;\n if (xSplit && xSplit > 0) freezePanes.col = xSplit;\n if (Object.keys(freezePanes).length > 0) opts.freezePanes = freezePanes;\n }\n }\n }\n }\n\n // Sheet data (rows)\n const sheetData = findChildByLocalName(wsEl, \"sheetData\");\n const rows: RowOptions[] = [];\n if (sheetData) {\n for (const rowEl of sheetData.elements ?? []) {\n if (localName(rowEl) !== \"row\") continue;\n const rowNumber = attrNum(rowEl, \"r\");\n const rowOpts: Record<string, unknown> = {};\n if (rowNumber !== undefined) rowOpts.rowNumber = rowNumber;\n\n const ht = attrNum(rowEl, \"ht\");\n if (ht !== undefined) rowOpts.height = ht;\n if (attr(rowEl, \"hidden\") === \"1\") rowOpts.hidden = true;\n\n const cells: CellOptions[] = [];\n for (const cellEl of rowEl.elements ?? []) {\n if (localName(cellEl) !== \"c\") continue;\n const ref = attr(cellEl, \"r\");\n const type = attr(cellEl, \"t\");\n const cellOpts: Record<string, unknown> = {};\n if (ref) cellOpts.reference = ref;\n\n const styleIdx = attrNum(cellEl, \"s\");\n if (styleIdx !== undefined) cellOpts.styleIndex = styleIdx;\n\n // Cell value\n const vEl = findChildByLocalName(cellEl, \"v\");\n const isEl = findChildByLocalName(cellEl, \"is\");\n\n if (type === \"s\" && vEl) {\n // Shared string\n const idx = parseInt(textOf(vEl) ?? \"\", 10);\n cellOpts.value = strings[idx] ?? \"\";\n } else if (type === \"b\" && vEl) {\n cellOpts.value = textOf(vEl) === \"1\";\n } else if (type === \"inlineStr\" && isEl) {\n const t = findChildByLocalName(isEl, \"t\");\n cellOpts.value = textOf(t) ?? \"\";\n } else if (vEl) {\n const raw = textOf(vEl) ?? \"\";\n const num = Number(raw);\n cellOpts.value = isNaN(num) ? raw : num;\n }\n\n cells.push(cellOpts as CellOptions);\n }\n\n rowOpts.cells = cells;\n rows.push(rowOpts as RowOptions);\n }\n }\n opts.children = rows;\n\n // Merge cells\n const mergeCellsEl = findChildByLocalName(wsEl, \"mergeCells\");\n if (mergeCellsEl) {\n const mergeCells: MergeCellOptions[] = [];\n for (const mc of mergeCellsEl.elements ?? []) {\n if (localName(mc) !== \"mergeCell\") continue;\n const ref = attr(mc, \"ref\");\n if (!ref) continue;\n const parts = ref.split(\":\");\n if (parts.length === 2) {\n mergeCells.push({\n from: { row: rowFromRef(parts[0]), col: colFromRef(parts[0]) },\n to: { row: rowFromRef(parts[1]), col: colFromRef(parts[1]) },\n });\n }\n }\n if (mergeCells.length > 0) opts.mergeCells = mergeCells;\n }\n\n // Auto filter\n const autoFilterEl = findChildByLocalName(wsEl, \"autoFilter\");\n if (autoFilterEl) {\n const ref = attr(autoFilterEl, \"ref\");\n if (ref) opts.autoFilter = ref;\n }\n\n return opts as WorksheetOptions;\n}\n\n// ── Helpers ──\n\nfunction localName(el: Element): string {\n const name = el.name ?? \"\";\n const colonIdx = name.indexOf(\":\");\n return colonIdx >= 0 ? name.slice(colonIdx + 1) : name;\n}\n\nfunction findChildByLocalName(parent: Element, name: string): Element | undefined {\n return (parent.elements ?? []).find((el) => localName(el) === name);\n}\n\n/**\n * Parse a .xlsx file and convert it into WorkbookOptions.\n *\n * The returned options can be passed to `new Workbook(parsed)`.\n */\nexport function parseWorkbook(data: DataType): WorkbookOptions {\n const xlsx = parseXlsx(data);\n\n const opts: Record<string, unknown> = {};\n\n // Core properties\n if (xlsx.coreProps) {\n const corePropsEl = xlsx.doc.get(xlsx.coreProps);\n if (corePropsEl) {\n const cp = parseCorePropsElement(corePropsEl);\n if (cp.title) opts.title = cp.title;\n if (cp.subject) opts.subject = cp.subject;\n if (cp.creator) opts.creator = cp.creator;\n if (cp.keywords) opts.keywords = cp.keywords;\n if (cp.description) opts.description = cp.description;\n if (cp.lastModifiedBy) opts.lastModifiedBy = cp.lastModifiedBy;\n if (cp.revision) opts.revision = parseInt(cp.revision, 10);\n }\n }\n\n // Shared strings\n const strings = parseSharedStrings(xlsx.sharedStrings);\n\n // Sheet names from workbook\n const sheetNames: string[] = [];\n if (xlsx.workbook) {\n const sheetsEl = findChildByLocalName(xlsx.workbook, \"sheets\");\n if (sheetsEl) {\n for (const s of sheetsEl.elements ?? []) {\n if (localName(s) !== \"sheet\") continue;\n sheetNames.push(attr(s, \"name\") ?? \"\");\n }\n }\n }\n\n // Parse worksheets\n const worksheets: WorksheetOptions[] = [];\n for (let i = 0; i < xlsx.worksheets.length; i++) {\n const wsPath = xlsx.worksheets[i];\n const wsEl = xlsx.doc.get(wsPath);\n if (!wsEl) continue;\n\n const wsOpts = parseWorksheetElement(wsEl, strings) as Record<string, unknown>;\n if (sheetNames[i]) wsOpts.name = sheetNames[i];\n worksheets.push(wsOpts as WorksheetOptions);\n }\n\n opts.worksheets = worksheets;\n return opts as WorkbookOptions;\n}\n","/**\n * XLSX patching — replace placeholders in existing .xlsx files.\n *\n * Unlike DOCX/PPTX (paragraph-based), XLSX patching targets cell values:\n * - Replaces placeholders in the shared strings table (most common)\n * - Replaces placeholders in inline strings within worksheet cells\n *\n * @module\n */\nimport { OoxmlMimeType, unzipSync, zipAndConvert, strFromU8, toJson } from \"@office-open/core\";\nimport type { OutputByType, OutputType } from \"@office-open/core\";\nimport { js2xml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { toUint8Array } from \"undio\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\nexport type InputDataType = Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob;\n\nexport type PatchDocumentOutputType = OutputType;\n\nexport const PatchType = {\n CELL: \"cell\",\n} as const;\n\nexport interface CellPatch {\n /** Replacement value (string, number, boolean, or Date) */\n readonly value: string | number | boolean | Date;\n}\n\nexport type IPatch = CellPatch;\n\nexport interface PatchWorkbookOptions<T extends PatchDocumentOutputType = PatchDocumentOutputType> {\n readonly outputType: T;\n readonly data: InputDataType;\n readonly patches: Readonly<Record<string, IPatch>>;\n readonly placeholderDelimiters?: Readonly<{\n readonly start: string;\n readonly end: string;\n }>;\n}\n\n/**\n * Patch an existing .xlsx workbook by replacing placeholder text in cells.\n *\n * Placeholders are matched in shared strings and inline strings.\n * For string replacements, the shared string value is updated in-place.\n * For non-string replacements, the cell type and value are updated.\n */\nexport const patchWorkbook = async <T extends PatchDocumentOutputType = PatchDocumentOutputType>({\n outputType,\n data,\n patches,\n placeholderDelimiters = { start: \"{{\", end: \"}}\" } as const,\n}: PatchWorkbookOptions<T>): Promise<OutputByType[T]> => {\n const zipContent = unzipSync(toUint8Array(data));\n\n const xmlMap = new Map<string, Element>();\n const binaryMap = new Map<string, Uint8Array>();\n\n // Separate XML files from binary files\n for (const [key, value] of Object.entries(zipContent)) {\n if (key.endsWith(\".xml\") || key.endsWith(\".rels\")) {\n xmlMap.set(key, toJson(strFromU8(value)));\n } else {\n binaryMap.set(key, value);\n }\n }\n\n const { start, end } = placeholderDelimiters;\n\n // Build placeholder → patch map\n const patchMap = new Map<string, IPatch>();\n for (const [key, patch] of Object.entries(patches)) {\n patchMap.set(`${start}${key}${end}`, patch);\n }\n\n // 1. Patch shared strings\n const sst = xmlMap.get(\"xl/sharedStrings.xml\");\n if (sst) {\n patchSharedStrings(sst, patchMap);\n }\n\n // 2. Patch inline strings in worksheets\n const worksheetKeys = Object.keys(zipContent).filter(\n (k) => k.startsWith(\"xl/worksheets/sheet\") && k.endsWith(\".xml\"),\n );\n for (const wsKey of worksheetKeys) {\n const ws = xmlMap.get(wsKey);\n if (ws) patchWorksheetInlineStrings(ws, patchMap);\n }\n\n // Rebuild ZIP\n const files: Record<string, Uint8Array> = {};\n for (const [key, value] of xmlMap) {\n files[key] = encoder.encode(js2xml(value));\n }\n for (const [key, value] of binaryMap) {\n files[key] = value;\n }\n\n return await zipAndConvert(files, outputType, OoxmlMimeType.XLSX);\n};\n\nfunction patchSharedStrings(sst: Element, patchMap: Map<string, IPatch>): void {\n // toJson returns {elements: [{name: \"sst\", ...}]} — unwrap to actual root\n const root = sst.name ? sst : sst.elements?.[0];\n if (!root) return;\n\n for (const si of root.elements ?? []) {\n if (si.name !== \"si\") continue;\n\n // Simple: <si><t>text</t></si>\n const t = findLocalChild(si, \"t\");\n if (t) {\n patchTextElement(t, patchMap);\n } else {\n // Rich text: <si><r><t>text</t></r>...</si>\n for (const r of si.elements ?? []) {\n if (r.name !== \"r\") continue;\n const rt = findLocalChild(r, \"t\");\n if (rt) patchTextElement(rt, patchMap);\n }\n }\n }\n}\n\nfunction patchWorksheetInlineStrings(ws: Element, patchMap: Map<string, IPatch>): void {\n const root = ws.name ? ws : ws.elements?.[0];\n if (!root) return;\n\n const sheetData = findLocalChild(root, \"sheetData\");\n if (!sheetData) return;\n\n for (const row of sheetData.elements ?? []) {\n if (localName(row) !== \"row\") continue;\n for (const cell of row.elements ?? []) {\n if (localName(cell) !== \"c\") continue;\n\n // Check inline strings: <c t=\"inlineStr\"><is><t>text</t></is></c>\n const isEl = findLocalChild(cell, \"is\");\n if (isEl) {\n const t = findLocalChild(isEl, \"t\");\n if (t) patchTextElement(t, patchMap);\n }\n }\n }\n}\n\nfunction patchTextElement(tEl: Element, patchMap: Map<string, IPatch>): void {\n const text = tEl.elements?.[0]?.text;\n if (typeof text !== \"string\") return;\n\n for (const [placeholder, patch] of patchMap) {\n if (text.includes(placeholder)) {\n const newValue = String(patch.value);\n const replaced = text.replace(placeholder, newValue);\n if (tEl.elements) {\n tEl.elements[0] = { ...tEl.elements[0], text: replaced };\n }\n }\n }\n}\n\nfunction localName(el: Element): string {\n const name = el.name ?? \"\";\n const colonIdx = name.indexOf(\":\");\n return colonIdx >= 0 ? name.slice(colonIdx + 1) : name;\n}\n\nfunction findLocalChild(parent: Element, name: string): Element | undefined {\n return (parent.elements ?? []).find((el) => localName(el) === name);\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,YAAY;AAClB,MAAM,iBAAiB;AACvB,MAAM,cAAc;AACpB,MAAM,sBACJ;AACF,MAAM,aAAa;AACnB,MAAM,aAAa;AA+BnB,MAAM,aAAa;CApBjB;EACE,MAAM;EACN,aAAa;EACb,KAAK;EACN;CACD;EAAE,MAAM;EAAW,aAAa;EAAmB,KAAK;EAAO;CAC/D;EAAE,MAAM;EAAY,aAAa;EAAW,KAAK;EAAoB;CACrE;EACE,MAAM;EACN,aAAa;EACb,KAAK;EACN;CACD;EACE,MAAM;EACN,aAAa;EACb,KAAK;EACN;CAI8B,CAAC,KAAK,MACrC,EAAE,SAAS,YACP,yBAAyB,EAAE,YAAY,eAAe,EAAE,IAAI,OAC5D,0BAA0B,EAAE,YAAY,cAAc,EAAE,IAAI,KACjE,CAAC,KAAK,GAAG;AAEV,IAAa,eAAb,cAAkC,iBAAiB;CACjD,iBAAkD,EAAE;CAEpD,cAAqB;EACnB,MAAM,QAAQ;;CAGhB,aAAoB,OAAqB;EACvC,KAAK,eAAe,KAAK;GACvB,MAAM;GACN,aAAa;GACb,KAAK,uBAAuB,MAAM;GACnC,CAAC;;CAGJ,YAAyB;EACvB,KAAK,eAAe,KAAK;GACvB,MAAM;GACN,aAAa;GACb,KAAK;GACN,CAAC;;CAGJ,mBAAgC;EAC9B,KAAK,eAAe,KAAK;GACvB,MAAM;GACN,aAAa;GACb,KAAK;GACN,CAAC;;CAGJ,SAAgB,QAAgB,GAAS;EACvC,KAAK,eAAe,KAAK;GACvB,MAAM;GACN,aAAa;GACb,KAAK,kBAAkB,MAAM;GAC9B,CAAC;;CAGJ,SAAgB,OAAqB;EACnC,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eAAe,GAAG,IAAI;GACjC,IAAI,IAAI,iBAAiB,IAAI,SAAS;;;;AAM9C,SAAS,4BAA4B,IAAa,UAAqC;CACrF,MAAM,OAAO,GAAG,OAAO,KAAK,GAAG,WAAW;CAC1C,IAAI,CAAC,MAAM;CAEX,MAAM,YAAY,eAAe,MAAM,YAAY;CACnD,IAAI,CAAC,WAAW;CAEhB,KAAK,MAAM,OAAO,UAAU,YAAY,EAAE,EAAE;EAC1C,IAAI,UAAU,IAAI,KAAK,OAAO;EAC9B,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,EAAE;GACrC,IAAI,UAAU,KAAK,KAAK,KAAK;GAG7B,MAAM,OAAO,eAAe,MAAM,KAAK;GACvC,IAAI,MAAM;IACR,MAAM,IAAI,eAAe,MAAM,IAAI;IACnC,IAAI,GAAG,iBAAiB,GAAG,SAAS;;;;;AAM5C,SAAS,iBAAiB,KAAc,UAAqC;CAC3E,MAAM,OAAO,IAAI,WAAW,IAAI;CAChC,IAAI,OAAO,SAAS,UAAU;CAE9B,KAAK,MAAM,CAAC,aAAa,UAAU,UACjC,IAAI,KAAK,SAAS,YAAY,EAAE;EAC9B,MAAM,WAAW,OAAO,MAAM,MAAM;EACpC,MAAM,WAAW,KAAK,QAAQ,aAAa,SAAS;EACpD,IAAI,IAAI,UACN,IAAI,SAAS,KAAK;GAAE,GAAG,IAAI,SAAS;GAAI,MAAM;GAAU;;;AAMhE,SAAS,UAAU,IAAqB;CACtC,MAAM,OAAO,GAAG,QAAQ;CACxB,MAAM,WAAW,KAAK,QAAQ,IAAI;CAClC,OAAO,YAAY,IAAI,KAAK,MAAM,WAAW,EAAE,GAAG;;AAGpD,SAAS,eAAe,QAAiB,MAAmC;CAC1E,QAAQ,OAAO,YAAY,EAAE,EAAE,MAAM,OAAO,UAAU,GAAG,KAAK,KAAK"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["localName"],"sources":["../src/file/content-types.ts","../src/file/core-properties.ts","../src/file/media/media.ts","../src/file/shared-strings.ts","../src/file/styles.ts","../src/file/theme.ts","../src/file/workbook.ts","../src/file/worksheet.ts","../src/file/file.ts","../src/file/drawing/drawing.ts","../src/export/packer/next-compiler.ts","../src/export/packer/packer.ts","../src/util/index.ts","../src/parse.ts","../src/patcher.ts"],"sourcesContent":["/**\n * Content Types module for XLSX packages.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\nconst XLSX_MAIN = \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml\";\nconst XLSX_WORKSHEET = \"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml\";\nconst XLSX_STYLES = \"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml\";\nconst XLSX_SHARED_STRINGS =\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml\";\nconst XLSX_THEME = \"application/vnd.openxmlformats-officedocument.theme+xml\";\nconst XLSX_CHART = \"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\";\n\ntype EntryType = \"Default\" | \"Override\";\n\ninterface ContentEntry {\n readonly type: EntryType;\n readonly contentType: string;\n readonly key: string;\n}\n\nconst STATIC_ENTRIES: readonly ContentEntry[] = [\n {\n type: \"Default\",\n contentType: \"application/vnd.openxmlformats-package.relationships+xml\",\n key: \"rels\",\n },\n { type: \"Default\", contentType: \"application/xml\", key: \"xml\" },\n { type: \"Override\", contentType: XLSX_MAIN, key: \"/xl/workbook.xml\" },\n {\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-package.core-properties+xml\",\n key: \"/docProps/core.xml\",\n },\n {\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-officedocument.extended-properties+xml\",\n key: \"/docProps/app.xml\",\n },\n];\n\n// Pre-compiled static XML fragment (module-level constant)\nconst STATIC_XML = STATIC_ENTRIES.map((e) =>\n e.type === \"Default\"\n ? `<Default ContentType=\"${e.contentType}\" Extension=\"${e.key}\"/>`\n : `<Override ContentType=\"${e.contentType}\" PartName=\"${e.key}\"/>`,\n).join(\"\");\n\nexport class ContentTypes extends BaseXmlComponent {\n private readonly dynamicEntries: ContentEntry[] = [];\n\n public constructor() {\n super(\"Types\");\n }\n\n public addWorksheet(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_WORKSHEET,\n key: `/xl/worksheets/sheet${index}.xml`,\n });\n }\n\n public addStyles(): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_STYLES,\n key: \"/xl/styles.xml\",\n });\n }\n\n public addSharedStrings(): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_SHARED_STRINGS,\n key: \"/xl/sharedStrings.xml\",\n });\n }\n\n public addTheme(index: number = 1): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_THEME,\n key: `/xl/theme/theme${index}.xml`,\n });\n }\n\n public addChart(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: XLSX_CHART,\n key: `/xl/charts/chart${index}.xml`,\n });\n }\n\n public addDrawing(index: number): void {\n this.dynamicEntries.push({\n type: \"Override\",\n contentType: \"application/vnd.openxmlformats-officedocument.drawing+xml\",\n key: `/xl/drawings/drawing${index}.xml`,\n });\n }\n\n public addImageType(extension: \"png\" | \"jpeg\"): void {\n const contentType = extension === \"png\" ? \"image/png\" : \"image/jpeg\";\n // Avoid duplicates\n if (this.dynamicEntries.some((e) => e.type === \"Default\" && e.key === extension)) return;\n this.dynamicEntries.push({ type: \"Default\", contentType, key: extension });\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">',\n STATIC_XML,\n ];\n for (const e of this.dynamicEntries) {\n if (e.type === \"Default\") {\n p.push(`<Default ContentType=\"${e.contentType}\" Extension=\"${e.key}\"/>`);\n } else {\n p.push(`<Override ContentType=\"${e.contentType}\" PartName=\"${e.key}\"/>`);\n }\n }\n p.push(\"</Types>\");\n return p.join(\"\");\n }\n}\n","/**\n * Core Properties module for SpreadsheetML documents.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { buildCorePropertiesXmlString } from \"@office-open/core\";\n\nexport interface CorePropertiesOptions {\n readonly title?: string;\n readonly subject?: string;\n readonly creator?: string;\n readonly keywords?: string;\n readonly description?: string;\n readonly lastModifiedBy?: string;\n readonly revision?: number;\n}\n\nexport class CoreProperties extends BaseXmlComponent {\n private readonly options: CorePropertiesOptions;\n\n public constructor(options: CorePropertiesOptions) {\n super(\"cp:coreProperties\");\n this.options = options;\n }\n\n public override toXml(_context: Context): string {\n return buildCorePropertiesXmlString(this.options);\n }\n}\n","/**\n * Media collection for XLSX files — stores image binary data.\n *\n * @module\n */\n\nexport interface MediaData {\n readonly fileName: string;\n readonly type: string;\n readonly data: Uint8Array;\n readonly width: number;\n readonly height: number;\n}\n\nexport class Media {\n private readonly map = new Map<string, MediaData>();\n\n public addImage(key: string, data: MediaData): void {\n this.map.set(key, data);\n }\n\n public get array(): readonly MediaData[] {\n return [...this.map.values()];\n }\n}\n","/**\n * Shared Strings Table — generates xl/sharedStrings.xml.\n *\n * XLSX stores repeated string values in a central table to reduce file size.\n * Cells reference strings by index into this table.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { escapeXml } from \"@office-open/xml\";\n\nexport class SharedStrings extends BaseXmlComponent {\n private readonly strings: string[] = [];\n private readonly indexMap = new Map<string, number>();\n\n public constructor() {\n super(\"sst\");\n }\n\n /**\n * Register a string and return its index.\n * Returns existing index if the string is already registered.\n */\n public register(s: string): number {\n const existing = this.indexMap.get(s);\n if (existing !== undefined) return existing;\n\n const idx = this.strings.length;\n this.strings.push(s);\n this.indexMap.set(s, idx);\n return idx;\n }\n\n public get count(): number {\n return this.strings.length;\n }\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"',\n ` count=\"${this.strings.length}\" uniqueCount=\"${this.indexMap.size}\">`,\n ];\n for (const s of this.strings) {\n p.push(`<si><t>${escapeXml(s)}</t></si>`);\n }\n p.push(\"</sst>\");\n return p.join(\"\");\n }\n}\n","/**\n * Styles component — generates xl/styles.xml.\n *\n * XLSX uses an index-based style system: cells reference style entries\n * via the `s` attribute, which is an index into `cellXfs`.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { attrs, escapeXml } from \"@office-open/xml\";\n\n// ── Sub-style option interfaces ──\n\nexport interface FontOptions {\n readonly bold?: boolean;\n readonly italic?: boolean;\n readonly underline?: boolean;\n readonly strike?: boolean;\n readonly size?: number;\n readonly color?: string;\n readonly fontName?: string;\n}\n\nexport interface FillOptions {\n readonly type?: \"solid\" | \"pattern\";\n readonly color?: string;\n readonly patternType?: string;\n}\n\nexport interface BorderOptions {\n readonly style?: \"thin\" | \"medium\" | \"thick\" | \"dotted\" | \"dashed\" | \"hair\" | \"none\";\n readonly color?: string;\n}\n\nexport interface BorderSideOptions {\n readonly top?: BorderOptions;\n readonly bottom?: BorderOptions;\n readonly left?: BorderOptions;\n readonly right?: BorderOptions;\n readonly diagonal?: BorderOptions;\n}\n\nexport interface AlignmentOptions {\n readonly horizontal?: \"left\" | \"center\" | \"right\" | \"fill\" | \"justify\";\n readonly vertical?: \"top\" | \"center\" | \"bottom\";\n readonly wrapText?: boolean;\n readonly textRotation?: number;\n readonly indent?: number;\n}\n\nexport interface StyleOptions {\n readonly font?: FontOptions;\n readonly fill?: FillOptions;\n readonly border?: BorderSideOptions;\n readonly numFmt?: string;\n readonly alignment?: AlignmentOptions;\n}\n\n// ── Style key helpers for deduplication ──\n\nfunction fontKey(f: FontOptions): string {\n return `b${f.bold ? 1 : 0}i${f.italic ? 1 : 0}u${f.underline ? 1 : 0}s${f.strike ? 1 : 0}z${f.size ?? 0}c${f.color ?? \"\"}n${f.fontName ?? \"\"}`;\n}\n\nfunction fillKey(f: FillOptions): string {\n return `t${f.type ?? \"\"}c${f.color ?? \"\"}p${f.patternType ?? \"\"}`;\n}\n\nfunction borderKey(b: BorderSideOptions): string {\n const sk = (o?: BorderOptions) => `${o?.style ?? \"\"}_${o?.color ?? \"\"}`;\n return `t${sk(b.top)}b${sk(b.bottom)}l${sk(b.left)}r${sk(b.right)}d${sk(b.diagonal)}`;\n}\n\n// ── Built-in number format IDs ──\n\nconst BUILTIN_NUMFMTS: Record<string, number> = {\n General: 0,\n \"0\": 1,\n \"0.00\": 2,\n \"#,##0\": 3,\n \"#,##0.00\": 4,\n \"0%\": 9,\n \"0.00%\": 10,\n \"0.00E+00\": 11,\n \"mm-dd-yy\": 14,\n \"d-mmm-yy\": 15,\n \"d-mmm\": 16,\n \"mmm-yy\": 17,\n \"h:mm AM/PM\": 18,\n \"h:mm:ss AM/PM\": 19,\n \"h:mm\": 20,\n \"h:mm:ss\": 21,\n \"m/d/yy h:mm\": 22,\n \"#,##0 ;(#,##0)\": 37,\n \"#,##0 ;[Red](#,##0)\": 38,\n \"#,##0.00;(#,##0.00)\": 39,\n \"#,##0.00;[Red](#,##0.00)\": 40,\n \"mm:ss\": 45,\n \"[h]:mm:ss\": 46,\n \"mmss.0\": 47,\n \"##0.0E+0\": 48,\n \"@\": 49,\n};\n\nexport class Styles extends BaseXmlComponent {\n private readonly fonts: FontOptions[] = [\n { size: 11, fontName: \"Calibri\" }, // default font (index 0)\n ];\n private readonly fontKeys = new Map<string, number>();\n\n private readonly fills: FillOptions[] = [\n { patternType: \"none\" }, // default fill (index 0)\n { patternType: \"gray125\" }, // required fill (index 1)\n ];\n private readonly fillKeys = new Map<string, number>();\n\n private readonly borders: BorderSideOptions[] = [\n {}, // default empty border (index 0)\n ];\n private readonly borderKeys = new Map<string, number>();\n\n private readonly customNumFmts = new Map<string, number>();\n private nextCustomNumFmtId = 164; // custom numFmts start at 164\n\n private readonly cellXfs: Array<{\n readonly fontId: number;\n readonly fillId: number;\n readonly borderId: number;\n readonly numFmtId: number;\n readonly alignment?: AlignmentOptions;\n }> = [\n { fontId: 0, fillId: 0, borderId: 0, numFmtId: 0 }, // default xf (index 0)\n ];\n private readonly cellXfKeys = new Map<string, number>();\n\n public constructor() {\n super(\"styleSheet\");\n\n // Pre-register default font/fill/border keys\n this.fontKeys.set(fontKey(this.fonts[0]), 0);\n this.fillKeys.set(fillKey(this.fills[0]), 0);\n this.fillKeys.set(fillKey(this.fills[1]), 1);\n this.borderKeys.set(borderKey(this.borders[0]), 0);\n this.cellXfKeys.set(this.cellXfKey(this.cellXfs[0]), 0);\n }\n\n /**\n * Register a style and return its index (for the cell `s` attribute).\n * Deduplicates across fonts, fills, borders, numFmts, and cellXfs.\n */\n public register(opts: StyleOptions): number {\n const fontId = this.registerFont(opts.font);\n const fillId = this.registerFill(opts.fill);\n const borderId = this.registerBorder(opts.border);\n const numFmtId = this.registerNumFmt(opts.numFmt);\n\n const xf = {\n fontId,\n fillId,\n borderId,\n numFmtId,\n alignment: opts.alignment,\n };\n\n const key = this.cellXfKey(xf);\n const existing = this.cellXfKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.cellXfs.length;\n this.cellXfs.push(xf);\n this.cellXfKeys.set(key, idx);\n return idx;\n }\n\n private registerFont(opts?: FontOptions): number {\n if (!opts) return 0;\n const key = fontKey(opts);\n const existing = this.fontKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.fonts.length;\n this.fonts.push(opts);\n this.fontKeys.set(key, idx);\n return idx;\n }\n\n private registerFill(opts?: FillOptions): number {\n if (!opts) return 0;\n const key = fillKey(opts);\n const existing = this.fillKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.fills.length;\n this.fills.push(opts);\n this.fillKeys.set(key, idx);\n return idx;\n }\n\n private registerBorder(opts?: BorderSideOptions): number {\n if (!opts) return 0;\n const key = borderKey(opts);\n const existing = this.borderKeys.get(key);\n if (existing !== undefined) return existing;\n\n const idx = this.borders.length;\n this.borders.push(opts);\n this.borderKeys.set(key, idx);\n return idx;\n }\n\n private registerNumFmt(fmt?: string): number {\n if (!fmt) return 0;\n const builtin = BUILTIN_NUMFMTS[fmt];\n if (builtin !== undefined) return builtin;\n\n const existing = this.customNumFmts.get(fmt);\n if (existing !== undefined) return existing;\n\n const id = this.nextCustomNumFmtId++;\n this.customNumFmts.set(fmt, id);\n return id;\n }\n\n private cellXfKey(xf: {\n readonly fontId: number;\n readonly fillId: number;\n readonly borderId: number;\n readonly numFmtId: number;\n readonly alignment?: AlignmentOptions;\n }): string {\n const a = xf.alignment;\n const ak = a\n ? `h${a.horizontal ?? \"\"}v${a.vertical ?? \"\"}w${a.wrapText ? 1 : 0}r${a.textRotation ?? \"\"}i${a.indent ?? \"\"}`\n : \"\";\n return `${xf.fontId}|${xf.fillId}|${xf.borderId}|${xf.numFmtId}|${ak}`;\n }\n\n // ── XML generation ──\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">',\n ];\n\n // numFmts\n if (this.customNumFmts.size > 0) {\n p.push(`<numFmts count=\"${this.customNumFmts.size}\">`);\n for (const [fmt, id] of this.customNumFmts) {\n p.push(`<numFmt numFmtId=\"${id}\" formatCode=\"${escapeXml(fmt)}\"/>`);\n }\n p.push(\"</numFmts>\");\n }\n\n // fonts\n p.push(`<fonts count=\"${this.fonts.length}\">`);\n for (const f of this.fonts) {\n p.push(`<font>${this.fontXmlStr(f)}</font>`);\n }\n p.push(\"</fonts>\");\n\n // fills\n p.push(`<fills count=\"${this.fills.length}\">`);\n for (const f of this.fills) {\n const patternAttrs = attrs({ patternType: f.patternType ?? \"solid\" });\n const fgColor = f.color ? `<fgColor rgb=\"FF${f.color}\"/>` : \"\";\n p.push(\n fgColor\n ? `<fill><patternFill${patternAttrs}>${fgColor}</patternFill></fill>`\n : `<fill><patternFill${patternAttrs}/></fill>`,\n );\n }\n p.push(\"</fills>\");\n\n // borders\n p.push(`<borders count=\"${this.borders.length}\">`);\n for (const b of this.borders) {\n p.push(`<border>${this.borderXmlStr(b)}</border>`);\n }\n p.push(\"</borders>\");\n\n // cellStyleXfs\n p.push(\n '<cellStyleXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\"/></cellStyleXfs>',\n );\n\n // cellXfs\n p.push(`<cellXfs count=\"${this.cellXfs.length}\">`);\n for (const xf of this.cellXfs) {\n const xAttrs: Record<string, string | number | boolean | undefined> = {\n numFmtId: xf.numFmtId,\n fontId: xf.fontId,\n fillId: xf.fillId,\n borderId: xf.borderId,\n xfId: 0,\n };\n if (xf.alignment) xAttrs.applyAlignment = 1;\n if (xf.fontId > 0) xAttrs.applyFont = 1;\n if (xf.fillId > 0) xAttrs.applyFill = 1;\n if (xf.borderId > 0) xAttrs.applyBorder = 1;\n\n const alignStr = xf.alignment ? this.alignmentXmlStr(xf.alignment) : \"\";\n p.push(alignStr ? `<xf${attrs(xAttrs)}>${alignStr}</xf>` : `<xf${attrs(xAttrs)}/>`);\n }\n p.push(\"</cellXfs>\");\n\n // cellStyles\n p.push('<cellStyles count=\"1\"><cellStyle name=\"Normal\" xfId=\"0\" builtinId=\"0\"/></cellStyles>');\n\n // dxfs and tableStyles (required by Excel)\n p.push('<dxfs count=\"0\"/>');\n p.push(\n '<tableStyles count=\"0\" defaultTableStyle=\"TableStyleMedium2\" defaultPivotStyle=\"PivotStyleLight16\"/>',\n );\n p.push(\"<extLst/>\");\n\n p.push(\"</styleSheet>\");\n return p.join(\"\");\n }\n\n private fontXmlStr(f: FontOptions): string {\n const parts: string[] = [];\n if (f.bold) parts.push(\"<b/>\");\n if (f.italic) parts.push(\"<i/>\");\n if (f.underline) parts.push(\"<u/>\");\n if (f.strike) parts.push(\"<strike/>\");\n if (f.size) parts.push(`<sz val=\"${f.size}\"/>`);\n if (f.color) parts.push(`<color rgb=\"FF${f.color}\"/>`);\n if (f.fontName) parts.push(`<name val=\"${escapeXml(f.fontName)}\"/>`);\n return parts.join(\"\");\n }\n\n private borderXmlStr(b: BorderSideOptions): string {\n const parts: string[] = [];\n for (const side of [\"left\", \"right\", \"top\", \"bottom\", \"diagonal\"] as const) {\n const opts = b[side] as BorderOptions | undefined;\n if (opts && opts.style && opts.style !== \"none\") {\n const colorStr = opts.color ? `<color rgb=\"FF${opts.color}\"/>` : \"\";\n parts.push(`<${side} style=\"${opts.style}\">${colorStr}</${side}>`);\n } else {\n parts.push(`<${side}/>`);\n }\n }\n return parts.join(\"\");\n }\n\n private alignmentXmlStr(a: AlignmentOptions): string {\n const aAttrs: Record<string, string | number | boolean | undefined> = {};\n if (a.horizontal) aAttrs.horizontal = a.horizontal;\n if (a.vertical) aAttrs.vertical = a.vertical;\n if (a.wrapText) aAttrs.wrapText = 1;\n if (a.textRotation !== undefined) aAttrs.textRotation = a.textRotation;\n if (a.indent !== undefined) aAttrs.indent = a.indent;\n return `<alignment${attrs(aAttrs)}/>`;\n }\n}\n","/**\n * Default theme for XLSX files — matches Microsoft Office's output structure.\n * Produces xl/theme/theme1.xml that Excel accepts without repair warnings.\n *\n * The theme XML is completely static — identical for every XLSX file.\n * Pre-serialized as a string constant to avoid building the IXmlableObject\n * tree and re-serializing on every compile.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\n// Pre-serialized theme XML. Generated once via xml(buildThemeObj()) and inlined.\n// To regenerate: run `pnpm tsx scripts/gen-theme.ts` from packages/xlsx.\nconst THEME_XML =\n '<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\"><a:themeElements><a:clrScheme name=\"Office\"><a:dk1><a:sysClr val=\"windowText\" lastClr=\"000000\"/></a:dk1><a:lt1><a:sysClr val=\"window\" lastClr=\"FFFFFF\"/></a:lt1><a:dk2><a:srgbClr val=\"44546A\"/></a:dk2><a:lt2><a:srgbClr val=\"E7E6E6\"/></a:lt2><a:accent1><a:srgbClr val=\"5B9BD5\"/></a:accent1><a:accent2><a:srgbClr val=\"ED7D31\"/></a:accent2><a:accent3><a:srgbClr val=\"A5A5A5\"/></a:accent3><a:accent4><a:srgbClr val=\"FFC000\"/></a:accent4><a:accent5><a:srgbClr val=\"4472C4\"/></a:accent5><a:accent6><a:srgbClr val=\"70AD47\"/></a:accent6><a:hlink><a:srgbClr val=\"0563C1\"/></a:hlink><a:folHlink><a:srgbClr val=\"954F72\"/></a:folHlink></a:clrScheme><a:fontScheme name=\"Office\"><a:majorFont><a:latin typeface=\"Calibri Light\" panose=\"020F0302020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:majorFont><a:minorFont><a:latin typeface=\"Calibri\" panose=\"020F0502020204030204\"/><a:ea typeface=\"\"/><a:cs typeface=\"\"/></a:minorFont></a:fontScheme><a:fmtScheme name=\"Office\"><a:fillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"110000\"/><a:satMod val=\"105000\"/><a:tint val=\"67000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"103000\"/><a:tint val=\"73000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"105000\"/><a:satMod val=\"109000\"/><a:tint val=\"81000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/><a:satMod val=\"103000\"/><a:tint val=\"94000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"100000\"/><a:satMod val=\"110000\"/><a:shade val=\"100000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"99000\"/><a:satMod val=\"120000\"/><a:shade val=\"78000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:fillStyleLst><a:lnStyleLst><a:ln w=\"6350\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"12700\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln><a:ln w=\"19050\" cap=\"flat\" cmpd=\"sng\" algn=\"ctr\"><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:prstDash val=\"solid\"/><a:miter lim=\"800000\"/></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"57150\" dist=\"19050\" dir=\"5400000\" algn=\"ctr\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"63000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val=\"phClr\"/></a:solidFill><a:solidFill><a:schemeClr val=\"phClr\"><a:tint val=\"95000\"/><a:satMod val=\"170000\"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape=\"1\"><a:gsLst><a:gs pos=\"0\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"102000\"/><a:satMod val=\"150000\"/><a:tint val=\"93000\"/><a:shade val=\"98000\"/></a:schemeClr></a:gs><a:gs pos=\"50000\"><a:schemeClr val=\"phClr\"><a:lumMod val=\"103000\"/><a:satMod val=\"130000\"/><a:tint val=\"98000\"/><a:shade val=\"90000\"/></a:schemeClr></a:gs><a:gs pos=\"100000\"><a:schemeClr val=\"phClr\"><a:satMod val=\"120000\"/><a:shade val=\"63000\"/></a:schemeClr></a:gs></a:gsLst><a:lin ang=\"5400000\" scaled=\"0\"/></a:gradFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements><a:objectDefaults/><a:extraClrSchemeLst/></a:theme>';\n\nexport class DefaultTheme extends BaseXmlComponent {\n public constructor() {\n super(\"a:theme\");\n }\n\n /** Return pre-cached static theme XML — zero allocation. */\n public override toXml(_context: Context): string {\n return THEME_XML;\n }\n}\n","/**\n * Workbook component — generates xl/workbook.xml.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport { escapeXml } from \"@office-open/xml\";\n\nexport interface SheetDefinition {\n readonly name: string;\n readonly sheetId: number;\n readonly rId: string;\n readonly state?: \"visible\" | \"hidden\" | \"veryHidden\";\n}\n\nexport class WorkbookXml extends BaseXmlComponent {\n private readonly sheets: readonly SheetDefinition[];\n\n public constructor(sheets: readonly SheetDefinition[]) {\n super(\"workbook\");\n this.sheets = sheets;\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [\n '<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">',\n '<bookViews><workbookView xWindow=\"0\" yWindow=\"0\" windowWidth=\"28800\" windowHeight=\"12300\"/></bookViews>',\n \"<sheets>\",\n ];\n for (const s of this.sheets) {\n const stateAttr = s.state && s.state !== \"visible\" ? ` state=\"${s.state}\"` : \"\";\n p.push(\n `<sheet name=\"${escapeXml(s.name)}\" sheetId=\"${s.sheetId}\" r:id=\"${s.rId}\"${stateAttr}/>`,\n );\n }\n p.push('</sheets><calcPr calcId=\"191029\"/></workbook>');\n return p.join(\"\");\n }\n}\n","import type { SharedStrings } from \"@file/shared-strings\";\nimport type { Styles, StyleOptions } from \"@file/styles\";\n/**\n * Worksheet component — generates xl/worksheets/sheet{n}.xml.\n *\n * @module\n */\nimport { IgnoreIfEmptyXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\nimport type { ChartSpaceOptions } from \"@office-open/core\";\nimport { attrs, escapeXml, selfCloseElement } from \"@office-open/xml\";\n\nexport interface ColumnOptions {\n readonly min: number;\n readonly max: number;\n readonly width?: number;\n readonly hidden?: boolean;\n readonly customWidth?: boolean;\n}\n\nexport interface RowOptions {\n readonly cells?: readonly CellOptions[];\n readonly height?: number;\n readonly hidden?: boolean;\n readonly rowNumber?: number;\n}\n\nexport interface CellOptions {\n readonly value?: string | number | boolean | Date | null;\n readonly reference?: string;\n /** Direct style index (for pre-resolved styles) */\n readonly styleIndex?: number;\n /** Style options (resolved to index at compile time) */\n readonly style?: StyleOptions;\n /** Formula options. When set, value becomes the cached result. */\n readonly formula?: FormulaOptions;\n}\n\n/** Cell formula type (maps to ST_CellFormulaType). */\nexport const FormulaType = {\n NORMAL: \"normal\",\n ARRAY: \"array\",\n SHARED: \"shared\",\n} as const;\n\nexport type FormulaType = (typeof FormulaType)[keyof typeof FormulaType];\n\n/** Options for a cell formula (maps to CT_CellFormula). */\nexport interface FormulaOptions {\n /** Formula expression, e.g. \"SUM(A1:B1)\" */\n readonly formula: string;\n /** Formula type (default: \"normal\") */\n readonly type?: FormulaType;\n /** Reference range for array/shared formulas, e.g. \"C1:C10\" */\n readonly reference?: string;\n /** Shared formula group index (required for shared formulas) */\n readonly sharedIndex?: number;\n}\n\nexport interface MergeCellOptions {\n readonly from: { readonly row: number; readonly col: number };\n readonly to: { readonly row: number; readonly col: number };\n}\n\nexport interface FreezePaneOptions {\n /** Row split position (1-based, freezes rows above) */\n readonly row?: number;\n /** Column split position (1-based, freezes columns to the left) */\n readonly col?: number;\n}\n\nexport interface WorksheetImageOptions {\n readonly data: Uint8Array;\n readonly type: \"png\" | \"jpeg\" | \"jpg\";\n readonly col: number;\n readonly row: number;\n}\n\nexport interface WorksheetChartOptions extends ChartSpaceOptions {\n /** 1-based column position for the chart */\n readonly col: number;\n /** 1-based row position for the chart */\n readonly row: number;\n}\n\nexport type DataValidationType =\n | \"none\"\n | \"whole\"\n | \"decimal\"\n | \"list\"\n | \"date\"\n | \"time\"\n | \"textLength\"\n | \"custom\";\nexport type DataValidationOperator =\n | \"between\"\n | \"notBetween\"\n | \"equal\"\n | \"notEqual\"\n | \"greaterThan\"\n | \"lessThan\"\n | \"greaterThanOrEqual\"\n | \"lessThanOrEqual\";\n\nexport interface DataValidationOptions {\n /** Cell range, e.g. \"A1:A10\" */\n readonly sqref: string;\n readonly type?: DataValidationType;\n readonly operator?: DataValidationOperator;\n readonly formula1?: string;\n readonly formula2?: string;\n readonly allowBlank?: boolean;\n readonly showErrorMessage?: boolean;\n readonly errorTitle?: string;\n readonly error?: string;\n readonly showInputMessage?: boolean;\n readonly promptTitle?: string;\n readonly prompt?: string;\n}\n\nexport type ConditionalFormatType =\n | \"cellIs\"\n | \"containsText\"\n | \"expression\"\n | \"top10\"\n | \"aboveAverage\";\nexport type ConditionalFormatOperator =\n | \"lessThan\"\n | \"lessThanOrEqual\"\n | \"equal\"\n | \"notEqual\"\n | \"greaterThanOrEqual\"\n | \"greaterThan\"\n | \"between\"\n | \"notBetween\"\n | \"containsText\"\n | \"notContains\"\n | \"beginsWith\"\n | \"endsWith\";\n\nexport interface ConditionalFormatRule {\n readonly type: ConditionalFormatType;\n readonly operator?: ConditionalFormatOperator;\n /** Formula(s) — up to 3 */\n readonly formulas?: readonly string[];\n readonly priority?: number;\n /** Reference to a dxf (differential format) in the styles table */\n readonly dxfId?: number;\n}\n\nexport interface ConditionalFormatOptions {\n /** Cell range, e.g. \"A1:A10\" */\n readonly sqref: string;\n readonly rules: readonly ConditionalFormatRule[];\n}\n\nexport interface WorksheetOptions {\n readonly name?: string;\n readonly children?: readonly RowOptions[];\n readonly columns?: readonly ColumnOptions[];\n readonly mergeCells?: readonly MergeCellOptions[];\n readonly freezePanes?: FreezePaneOptions;\n /** Auto-filter range, e.g. \"A1:D10\" */\n readonly autoFilter?: string;\n readonly images?: readonly WorksheetImageOptions[];\n readonly charts?: readonly WorksheetChartOptions[];\n readonly dataValidations?: readonly DataValidationOptions[];\n readonly conditionalFormats?: readonly ConditionalFormatOptions[];\n}\n\nexport class Worksheet extends IgnoreIfEmptyXmlComponent {\n private readonly rows: readonly RowOptions[];\n private readonly columns: readonly ColumnOptions[];\n private readonly mergeCells: readonly MergeCellOptions[];\n private readonly freezePanes?: FreezePaneOptions;\n private readonly autoFilter?: string;\n private readonly images: readonly WorksheetImageOptions[];\n private readonly chartOptions: readonly WorksheetChartOptions[];\n private readonly dataValidations: readonly DataValidationOptions[];\n private readonly conditionalFormats: readonly ConditionalFormatOptions[];\n\n public constructor(options: WorksheetOptions) {\n super(\"worksheet\");\n this.rows = options.children ?? [];\n this.columns = options.columns ?? [];\n this.mergeCells = options.mergeCells ?? [];\n this.freezePanes = options.freezePanes;\n this.autoFilter = options.autoFilter;\n this.images = options.images ?? [];\n this.chartOptions = options.charts ?? [];\n this.dataValidations = options.dataValidations ?? [];\n this.conditionalFormats = options.conditionalFormats ?? [];\n }\n\n public get imageOptions(): readonly WorksheetImageOptions[] {\n return this.images;\n }\n\n public get charts(): readonly WorksheetChartOptions[] {\n return this.chartOptions;\n }\n\n /**\n * Zero-allocation fast path: directly concatenate XML string.\n * Bypasses the IXmlableObject intermediate tree entirely.\n */\n public override toXml(context: Context): string {\n const fileData = context.fileData as\n | { sharedStrings?: SharedStrings; styles?: Styles }\n | undefined;\n const sharedStrings = fileData?.sharedStrings;\n const styles = fileData?.styles;\n\n const p: string[] = [\n '<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">',\n ];\n\n // Dimension — defines the used range of the sheet\n const maxRow = this.rows.length;\n let maxCol = 0;\n for (const row of this.rows) {\n if (row.cells && row.cells.length > maxCol) maxCol = row.cells.length;\n }\n if (maxRow > 0 && maxCol > 0) {\n const dimRef = `A1:${this.defaultCellRef(maxRow, maxCol)}`;\n p.push(`<dimension ref=\"${dimRef}\"/>`);\n }\n\n // Sheet views\n if (this.freezePanes) {\n const fp = this.freezePanes;\n const ySplit = fp.row ? fp.row : 0;\n const xSplit = fp.col ? fp.col : 0;\n const topRow = fp.row ? fp.row + 1 : 1;\n const leftCol = fp.col ? fp.col + 1 : 1;\n const topLeftCell = this.defaultCellRef(topRow, leftCol);\n const activePane =\n ySplit > 0 && xSplit > 0 ? \"bottomRight\" : ySplit > 0 ? \"bottomLeft\" : \"topRight\";\n p.push(\n '<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\">',\n `<pane ySplit=\"${ySplit}\" xSplit=\"${xSplit}\" topLeftCell=\"${topLeftCell}\" activePane=\"${activePane}\" state=\"frozen\"/>`,\n \"</sheetView></sheetViews>\",\n );\n } else {\n // Default sheetView (required by Excel)\n p.push('<sheetViews><sheetView tabSelected=\"1\" workbookViewId=\"0\"/></sheetViews>');\n }\n\n // Sheet format — default row height\n p.push('<sheetFormatPr defaultRowHeight=\"15\"/>');\n\n // Column definitions\n if (this.columns.length > 0) {\n p.push(\"<cols>\");\n for (const col of this.columns) {\n const colAttrs: Record<string, string | number | boolean | undefined> = {\n min: col.min,\n max: col.max,\n };\n if (col.width !== undefined) {\n colAttrs.width = col.width;\n colAttrs.customWidth = 1;\n }\n if (col.hidden) {\n colAttrs.hidden = 1;\n }\n p.push(selfCloseElement(\"col\", attrs(colAttrs)));\n }\n p.push(\"</cols>\");\n }\n\n // Sheet data (rows + cells) — the hot path\n p.push(\"<sheetData>\");\n for (let i = 0; i < this.rows.length; i++) {\n const rowOpts = this.rows[i];\n const rowNumber = rowOpts.rowNumber ?? i + 1;\n const rowAttrs: Record<string, string | number | boolean | undefined> = { r: rowNumber };\n if (rowOpts.height !== undefined) {\n rowAttrs.ht = rowOpts.height;\n rowAttrs.customHeight = 1;\n }\n if (rowOpts.hidden) {\n rowAttrs.hidden = 1;\n }\n\n if (rowOpts.cells) {\n const rowParts: string[] = [];\n for (let j = 0; j < rowOpts.cells.length; j++) {\n const cell = rowOpts.cells[j];\n const ref = cell.reference ?? this.defaultCellRef(rowNumber, j + 1);\n const cellStr = this.buildCellString(ref, cell, sharedStrings, styles);\n if (cellStr) rowParts.push(cellStr);\n }\n p.push(`<row${attrs(rowAttrs)}>`, ...rowParts, \"</row>\");\n } else {\n p.push(`<row${attrs(rowAttrs)}/>`);\n }\n }\n p.push(\"</sheetData>\");\n\n // Auto filter\n if (this.autoFilter) {\n p.push(selfCloseElement(\"autoFilter\", attrs({ ref: this.autoFilter })));\n }\n\n // Merge cells\n if (this.mergeCells.length > 0) {\n p.push(`<mergeCells count=\"${this.mergeCells.length}\">`);\n for (const mc of this.mergeCells) {\n const fromRef = this.defaultCellRef(mc.from.row, mc.from.col);\n const toRef = this.defaultCellRef(mc.to.row, mc.to.col);\n p.push(selfCloseElement(\"mergeCell\", attrs({ ref: `${fromRef}:${toRef}` })));\n }\n p.push(\"</mergeCells>\");\n }\n\n // Conditional formatting\n if (this.conditionalFormats.length > 0) {\n for (const cf of this.conditionalFormats) {\n p.push(`<conditionalFormatting sqref=\"${cf.sqref}\">`);\n for (let ri = 0; ri < cf.rules.length; ri++) {\n const rule = cf.rules[ri];\n const ruleAttrs: Record<string, string | number | boolean | undefined> = {\n type: rule.type,\n priority: rule.priority ?? ri + 1,\n };\n if (rule.operator) ruleAttrs.operator = rule.operator;\n if (rule.dxfId !== undefined) ruleAttrs.dxfId = rule.dxfId;\n if (rule.formulas && rule.formulas.length > 0) {\n const formulaParts = rule.formulas.map((f) => `<formula>${escapeXml(f)}</formula>`);\n p.push(`<cfRule${attrs(ruleAttrs)}>`, ...formulaParts, \"</cfRule>\");\n } else {\n p.push(selfCloseElement(\"cfRule\", attrs(ruleAttrs)));\n }\n }\n p.push(\"</conditionalFormatting>\");\n }\n }\n\n // Data validations\n if (this.dataValidations.length > 0) {\n p.push(`<dataValidations count=\"${this.dataValidations.length}\">`);\n for (const dv of this.dataValidations) {\n const dvAttrs: Record<string, string | number | boolean | undefined> = { sqref: dv.sqref };\n if (dv.type && dv.type !== \"none\") dvAttrs.type = dv.type;\n if (dv.operator) dvAttrs.operator = dv.operator;\n if (dv.allowBlank) dvAttrs.allowBlank = 1;\n if (dv.showErrorMessage) dvAttrs.showErrorMessage = 1;\n if (dv.showInputMessage) dvAttrs.showInputMessage = 1;\n if (dv.errorTitle) dvAttrs.errorTitle = dv.errorTitle;\n if (dv.error) dvAttrs.error = dv.error;\n if (dv.promptTitle) dvAttrs.promptTitle = dv.promptTitle;\n if (dv.prompt) dvAttrs.prompt = dv.prompt;\n const inner: string[] = [];\n if (dv.formula1 !== undefined) inner.push(`<formula1>${escapeXml(dv.formula1)}</formula1>`);\n if (dv.formula2 !== undefined) inner.push(`<formula2>${escapeXml(dv.formula2)}</formula2>`);\n if (inner.length > 0) {\n p.push(`<dataValidation${attrs(dvAttrs)}>`, ...inner, \"</dataValidation>\");\n } else {\n p.push(selfCloseElement(\"dataValidation\", attrs(dvAttrs)));\n }\n }\n p.push(\"</dataValidations>\");\n }\n\n p.push('<pageMargins left=\"0.75\" right=\"0.75\" top=\"1\" bottom=\"1\" header=\"0.5\" footer=\"0.5\"/>');\n p.push(\"</worksheet>\");\n return p.join(\"\");\n }\n\n /**\n * Build the <f> element string for a cell formula.\n */\n private buildFormulaString(fOpts: FormulaOptions): string {\n const fAttrs: Record<string, string | number | boolean | undefined> = {};\n if (fOpts.type && fOpts.type !== FormulaType.NORMAL) fAttrs.t = fOpts.type;\n if (fOpts.reference) fAttrs.ref = fOpts.reference;\n if (fOpts.sharedIndex !== undefined) fAttrs.si = fOpts.sharedIndex;\n\n const hasContent = fOpts.formula !== undefined && fOpts.formula !== \"\";\n\n if (hasContent) {\n return `<f${attrs(fAttrs)}>${escapeXml(fOpts.formula)}</f>`;\n }\n if (Object.keys(fAttrs).length > 0) {\n return selfCloseElement(\"f\", attrs(fAttrs));\n }\n return \"\";\n }\n\n /**\n * Direct string serialization of a single cell — zero intermediate objects.\n */\n private buildCellString(\n ref: string,\n cell: CellOptions,\n sharedStrings?: SharedStrings,\n styles?: Styles,\n ): string {\n const cellAttrs: Record<string, string | number | boolean | undefined> = { r: ref };\n\n // Resolve style\n if (cell.style !== undefined && styles) {\n cellAttrs.s = styles.register(cell.style);\n } else if (cell.styleIndex !== undefined) {\n cellAttrs.s = cell.styleIndex;\n }\n\n const value = cell.value;\n\n // Formula path — formula takes precedence; value is the cached result.\n if (cell.formula) {\n const fStr = this.buildFormulaString(cell.formula);\n let vStr = \"\";\n if (value === null || value === undefined) {\n return `<c${attrs(cellAttrs)}>${fStr}</c>`;\n }\n if (typeof value === \"number\") {\n vStr = `<v>${value}</v>`;\n } else if (typeof value === \"boolean\") {\n cellAttrs.t = \"b\";\n vStr = `<v>${value ? 1 : 0}</v>`;\n } else if (typeof value === \"string\") {\n cellAttrs.t = \"str\";\n vStr = `<v>${escapeXml(value)}</v>`;\n } else if (value instanceof Date) {\n vStr = `<v>${this.dateToSerialNumber(value)}</v>`;\n }\n if (vStr) {\n return `<c${attrs(cellAttrs)}>${fStr}${vStr}</c>`;\n }\n return `<c${attrs(cellAttrs)}>${fStr}</c>`;\n }\n\n if (value === null || value === undefined) {\n if (cell.styleIndex !== undefined) {\n return selfCloseElement(\"c\", attrs(cellAttrs));\n }\n return \"\";\n }\n\n if (typeof value === \"string\") {\n if (sharedStrings) {\n cellAttrs.t = \"s\";\n const idx = sharedStrings.register(value);\n return `<c${attrs(cellAttrs)}><v>${idx}</v></c>`;\n }\n cellAttrs.t = \"inlineStr\";\n return `<c${attrs(cellAttrs)}><is><t>${escapeXml(value)}</t></is></c>`;\n }\n\n if (typeof value === \"number\") {\n return `<c${attrs(cellAttrs)}><v>${value}</v></c>`;\n }\n\n if (typeof value === \"boolean\") {\n cellAttrs.t = \"b\";\n return `<c${attrs(cellAttrs)}><v>${value ? 1 : 0}</v></c>`;\n }\n\n if (value instanceof Date) {\n const serial = this.dateToSerialNumber(value);\n return `<c${attrs(cellAttrs)}><v>${serial}</v></c>`;\n }\n\n return \"\";\n }\n\n private defaultCellRef(row: number, col: number): string {\n return this.columnToLetter(col) + row;\n }\n\n private columnToLetter(col: number): string {\n let result = \"\";\n let n = col;\n while (n > 0) {\n const remainder = (n - 1) % 26;\n result = String.fromCharCode(65 + remainder) + result;\n n = Math.floor((n - 1) / 26);\n }\n return result;\n }\n\n private dateToSerialNumber(date: Date): number {\n const epoch = new Date(1899, 11, 30);\n const msPerDay = 86400000;\n return (date.getTime() - epoch.getTime()) / msPerDay;\n }\n}\n","import { ContentTypes } from \"@file/content-types\";\nimport { CoreProperties, type CorePropertiesOptions } from \"@file/core-properties\";\nimport { Media } from \"@file/media/media\";\nimport { SharedStrings } from \"@file/shared-strings\";\nimport { Styles } from \"@file/styles\";\nimport { DefaultTheme } from \"@file/theme\";\nimport { WorkbookXml, type SheetDefinition } from \"@file/workbook\";\nimport { Worksheet, type WorksheetOptions } from \"@file/worksheet\";\n/**\n * File class (exported as Workbook) — the top-level container for XLSX documents.\n *\n * @module\n */\nimport { AppProperties, ChartCollection, Relationships } from \"@office-open/core\";\n\nexport interface WorkbookOptions extends CorePropertiesOptions {\n readonly worksheets?: readonly WorksheetOptions[];\n}\n\nexport class File {\n private readonly worksheetOptions: readonly WorksheetOptions[];\n private readonly corePropsOptions: CorePropertiesOptions;\n\n // Lazy components\n private _coreProperties?: CoreProperties;\n private _appProperties?: AppProperties;\n private _contentTypes?: ContentTypes;\n private _styles?: Styles;\n private _theme?: DefaultTheme;\n private _workbookXml?: WorkbookXml;\n private _worksheets?: Worksheet[];\n private _sharedStrings?: SharedStrings;\n private _media?: Media;\n private _fileRels?: Relationships;\n private _workbookRels?: Relationships;\n private _charts?: ChartCollection;\n\n public constructor(options: WorkbookOptions) {\n this.worksheetOptions = options.worksheets ?? [];\n this.corePropsOptions = options;\n }\n\n // ── Lazy getters ──\n\n public get coreProperties(): CoreProperties {\n return (this._coreProperties ??= new CoreProperties(this.corePropsOptions));\n }\n\n public get appProperties(): AppProperties {\n return (this._appProperties ??= new AppProperties());\n }\n\n public get contentTypes(): ContentTypes {\n if (!this._contentTypes) {\n this._contentTypes = new ContentTypes();\n for (let i = 0; i < this.worksheetOptions.length; i++) {\n this._contentTypes.addWorksheet(i + 1);\n }\n this._contentTypes.addStyles();\n this._contentTypes.addSharedStrings();\n this._contentTypes.addTheme();\n }\n return this._contentTypes;\n }\n\n public get styles(): Styles {\n return (this._styles ??= new Styles());\n }\n\n public get theme(): DefaultTheme {\n return (this._theme ??= new DefaultTheme());\n }\n\n public get workbookXml(): WorkbookXml {\n if (!this._workbookXml) {\n const sheets: SheetDefinition[] = this.worksheetOptions.map((ws, i) => ({\n name: ws.name ?? `Sheet${i + 1}`,\n sheetId: i + 1,\n rId: `rId${i + 1}`,\n }));\n this._workbookXml = new WorkbookXml(sheets);\n }\n return this._workbookXml;\n }\n\n public get sharedStrings(): SharedStrings {\n return (this._sharedStrings ??= new SharedStrings());\n }\n\n public get media(): Media {\n return (this._media ??= new Media());\n }\n\n public get charts(): ChartCollection {\n return (this._charts ??= new ChartCollection());\n }\n\n public get worksheets(): readonly Worksheet[] {\n if (!this._worksheets) {\n this._worksheets = this.worksheetOptions.map((ws) => new Worksheet(ws));\n }\n return this._worksheets;\n }\n\n public get fileRelationships(): Relationships {\n if (!this._fileRels) {\n this._fileRels = new Relationships();\n this._fileRels.addRelationship(\n 1,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument\",\n \"xl/workbook.xml\",\n );\n this._fileRels.addRelationship(\n 2,\n \"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties\",\n \"docProps/core.xml\",\n );\n this._fileRels.addRelationship(\n 3,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\",\n \"docProps/app.xml\",\n );\n }\n return this._fileRels;\n }\n\n public get workbookRelationships(): Relationships {\n if (!this._workbookRels) {\n this._workbookRels = new Relationships();\n let rid = 1;\n for (let i = 0; i < this.worksheetOptions.length; i++) {\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\",\n `worksheets/sheet${i + 1}.xml`,\n );\n }\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\",\n \"styles.xml\",\n );\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme\",\n \"theme/theme1.xml\",\n );\n this._workbookRels.addRelationship(\n rid++,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\",\n \"sharedStrings.xml\",\n );\n }\n return this._workbookRels;\n }\n}\n","/**\n * XLSX Drawing component — generates xl/drawings/drawing{n}.xml.\n *\n * Uses the spreadsheetDrawing namespace (default, no prefix) for anchoring\n * images and charts to worksheet cells.\n *\n * @module\n */\nimport { BaseXmlComponent } from \"@file/xml-components\";\nimport type { Context } from \"@file/xml-components\";\n\nexport interface ImageOptions {\n /** 1-based column */\n readonly col: number;\n /** Column offset in EMU (default 0) */\n readonly colOffset?: number;\n /** 1-based row */\n readonly row: number;\n /** Row offset in EMU (default 0) */\n readonly rowOffset?: number;\n /** Relationship ID for the image */\n readonly rId: string;\n}\n\nexport interface ChartAnchorOptions {\n /** 1-based column */\n readonly col: number;\n /** Column offset in EMU (default 0) */\n readonly colOffset?: number;\n /** 1-based row */\n readonly row: number;\n /** Row offset in EMU (default 0) */\n readonly rowOffset?: number;\n /** Relationship ID for the chart */\n readonly rId: string;\n}\n\nconst XDR_NS = \"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\";\nconst A_NS = \"http://schemas.openxmlformats.org/drawingml/2006/main\";\nconst R_NS = \"http://schemas.openxmlformats.org/officeDocument/2006/relationships\";\nconst C_URI = \"http://schemas.openxmlformats.org/drawingml/2006/chart\";\n\nexport class Drawing extends BaseXmlComponent {\n private readonly images: readonly ImageOptions[];\n private readonly charts: readonly ChartAnchorOptions[];\n\n public constructor(images: readonly ImageOptions[], charts: readonly ChartAnchorOptions[] = []) {\n super(\"wsDr\");\n this.images = images;\n this.charts = charts;\n }\n\n public override toXml(_context: Context): string {\n const p: string[] = [`<wsDr xmlns=\"${XDR_NS}\" xmlns:a=\"${A_NS}\" xmlns:r=\"${R_NS}\">`];\n let id = 1;\n for (const img of this.images) {\n p.push(\n `<twoCellAnchor editAs=\"oneCell\"><from><col>${img.col - 1}</col><colOff>${img.colOffset ?? 0}</colOff><row>${img.row - 1}</row><rowOff>${img.rowOffset ?? 0}</rowOff></from>`,\n `<to><col>${img.col}</col><colOff>0</colOff><row>${img.row}</row><rowOff>0</rowOff></to>`,\n `<pic><nvPicPr><cNvPr id=\"${id}\" name=\"Picture ${id}\"/><cNvPicPr preferRelativeResize=\"1\"/></nvPicPr>`,\n `<blipFill><a:blip r:embed=\"${img.rId}\"/><a:stretch><a:fillRect/></a:stretch></blipFill>`,\n `<spPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"400000\" cy=\"300000\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></spPr></pic>`,\n `<clientData/></twoCellAnchor>`,\n );\n id++;\n }\n for (const chart of this.charts) {\n p.push(\n `<twoCellAnchor editAs=\"oneCell\"><from><col>${chart.col - 1}</col><colOff>${chart.colOffset ?? 0}</colOff><row>${chart.row - 1}</row><rowOff>${chart.rowOffset ?? 0}</rowOff></from>`,\n `<to><col>${chart.col + 8}</col><colOff>0</colOff><row>${chart.row + 15}</row><rowOff>0</rowOff></to>`,\n `<graphicFrame><nvGraphicFramePr><cNvPr id=\"${id}\" name=\"Chart ${id}\"/><cNvGraphicFramePr><a:graphicFrameLocks noGrp=\"1\"/></cNvGraphicFramePr></nvGraphicFramePr>`,\n `<xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/></xfrm>`,\n `<a:graphic><a:graphicData uri=\"${C_URI}\"><c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" xmlns:r=\"${R_NS}\" r:id=\"${chart.rId}\"/></a:graphicData></a:graphic></graphicFrame>`,\n `<clientData/></twoCellAnchor>`,\n );\n id++;\n }\n p.push(\"</wsDr>\");\n return p.join(\"\");\n }\n}\n","/**\n * XLSX Compiler — compiles a File object into a Zippable structure.\n *\n * @module\n */\nimport { Formatter } from \"@export/formatter\";\nimport { Drawing, type ImageOptions, type ChartAnchorOptions } from \"@file/drawing/drawing\";\nimport type { File } from \"@file/file\";\nimport type { Context } from \"@file/xml-components\";\nimport {\n ChartSpace,\n Relationships,\n compileMapping,\n type XmlifyedFile,\n type Zippable,\n} from \"@office-open/core\";\n\nexport class Compiler {\n private readonly formatter = new Formatter();\n\n public compile(file: File, overrides: readonly XmlifyedFile[] = []): Zippable {\n const context: Context = { fileData: file, stack: [] };\n const f = this.formatter;\n\n const mapping: Record<string, { data: string; path: string }> = {};\n\n const fmt = (component: any) => f.formatToXml(component, context);\n\n // Core properties\n mapping[\"Properties\"] = {\n data: fmt(file.coreProperties),\n path: \"docProps/core.xml\",\n };\n\n // App properties\n mapping[\"AppProperties\"] = {\n data: fmt(file.appProperties),\n path: \"docProps/app.xml\",\n };\n\n // File-level relationships (_rels/.rels)\n mapping[\"FileRelationships\"] = {\n data: fmt(file.fileRelationships),\n path: \"_rels/.rels\",\n };\n\n // Workbook\n mapping[\"Workbook\"] = {\n data: fmt(file.workbookXml),\n path: \"xl/workbook.xml\",\n };\n\n // Workbook relationships\n mapping[\"WorkbookRelationships\"] = {\n data: fmt(file.workbookRelationships),\n path: \"xl/_rels/workbook.xml.rels\",\n };\n\n // Worksheets — formatted BEFORE SharedStrings so strings are registered\n const worksheets = file.worksheets;\n let globalMediaIdx = 0;\n let globalChartIdx = 0;\n\n for (let i = 0; i < worksheets.length; i++) {\n const ws = worksheets[i];\n const imgOpts = ws.imageOptions;\n const chartOpts = ws.charts;\n\n // Worksheet uses toXml() fast path (zero-allocation string concat)\n let sheetXml = fmt(ws);\n\n const hasMedia = imgOpts.length > 0 || chartOpts.length > 0;\n\n if (hasMedia) {\n const drawingImages: ImageOptions[] = [];\n const drawingCharts: ChartAnchorOptions[] = [];\n const drawingRels = new Relationships();\n let rid = 1;\n\n // Process images\n for (const img of imgOpts) {\n const mediaKey = `image_${globalMediaIdx}`;\n const ext = img.type === \"jpeg\" || img.type === \"jpg\" ? \"jpeg\" : \"png\";\n file.media.addImage(mediaKey, {\n fileName: `image${globalMediaIdx + 1}.${ext}`,\n type: ext,\n data: img.data,\n width: 0,\n height: 0,\n });\n\n drawingRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image\",\n `../media/image${globalMediaIdx + 1}.${ext}`,\n );\n\n drawingImages.push({\n col: img.col,\n row: img.row,\n rId: `rId${rid}`,\n });\n rid++;\n globalMediaIdx++;\n }\n\n // Process charts\n for (const chart of chartOpts) {\n const chartKey = `chart_${globalChartIdx}`;\n file.charts.addChart(chartKey, {\n key: chartKey,\n chartSpace: new ChartSpace(chart),\n });\n\n drawingRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart\",\n `../charts/chart${globalChartIdx + 1}.xml`,\n );\n\n drawingCharts.push({\n col: chart.col,\n row: chart.row,\n rId: `rId${rid}`,\n });\n rid++;\n globalChartIdx++;\n }\n\n // Generate drawing XML\n const drawing = new Drawing(drawingImages, drawingCharts);\n const drawingIdx = i + 1;\n mapping[`Drawing${i}`] = {\n data: fmt(drawing),\n path: `xl/drawings/drawing${drawingIdx}.xml`,\n };\n\n // Drawing relationships\n mapping[`DrawingRels${i}`] = {\n data: fmt(drawingRels),\n path: `xl/drawings/_rels/drawing${drawingIdx}.xml.rels`,\n };\n\n // Insert drawing reference before the closing </worksheet> tag.\n // Use slice instead of replace to avoid O(n) full-string scan.\n const closingTag = \"</worksheet>\";\n sheetXml =\n sheetXml.slice(0, -closingTag.length) + `<drawing r:id=\"rId${rid}\"/>` + closingTag;\n\n // Worksheet needs its own rels for drawing reference\n const wsRels = new Relationships();\n wsRels.addRelationship(\n rid,\n \"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing\",\n `../drawings/drawing${drawingIdx}.xml`,\n );\n mapping[`WorksheetRels${i}`] = {\n data: fmt(wsRels),\n path: `xl/worksheets/_rels/sheet${i + 1}.xml.rels`,\n };\n\n file.contentTypes.addDrawing(drawingIdx);\n }\n\n mapping[`Worksheet${i}`] = {\n data: sheetXml,\n path: `xl/worksheets/sheet${i + 1}.xml`,\n };\n }\n\n // Shared Strings — AFTER worksheets so all strings are collected\n const sharedStrings = file.sharedStrings;\n if (sharedStrings.count > 0) {\n mapping[\"SharedStrings\"] = {\n data: fmt(sharedStrings),\n path: \"xl/sharedStrings.xml\",\n };\n }\n\n // Styles\n mapping[\"Styles\"] = {\n data: fmt(file.styles),\n path: \"xl/styles.xml\",\n };\n\n // Theme\n mapping[\"Theme\"] = {\n data: fmt(file.theme),\n path: \"xl/theme/theme1.xml\",\n };\n\n // Charts — AFTER worksheets so charts are registered\n for (let i = 0; i < file.charts.array.length; i++) {\n const chartData = file.charts.array[i];\n mapping[`Chart${i}`] = {\n data: fmt(chartData.chartSpace),\n path: `xl/charts/chart${i + 1}.xml`,\n };\n file.contentTypes.addChart(i + 1);\n }\n\n // Register image content types\n const imageExts = new Set<string>();\n for (const img of file.media.array) {\n const ext = img.fileName.endsWith(\".png\") ? \"png\" : \"jpeg\";\n if (!imageExts.has(ext)) {\n imageExts.add(ext);\n file.contentTypes.addImageType(ext as \"png\" | \"jpeg\");\n }\n }\n\n // Content Types — must be last\n mapping[\"ContentTypes\"] = {\n data: fmt(file.contentTypes),\n path: \"[Content_Types].xml\",\n };\n\n // Convert mapping to Zippable\n const mediaFiles: Array<{ data: Uint8Array; path: string }> = [];\n for (const img of file.media.array) {\n mediaFiles.push({ data: img.data, path: `xl/media/${img.fileName}` });\n }\n\n return compileMapping(mapping, overrides, mediaFiles);\n }\n}\n","import type { File } from \"@file/file\";\n/**\n * Packer module — export API for XLSX files.\n *\n * @module\n */\nimport { createPacker, OoxmlMimeType } from \"@office-open/core\";\n\nimport { Compiler } from \"./next-compiler\";\n\nconst compiler = new Compiler();\n\nexport const Packer = createPacker<File>({\n compile: (file, overrides) => compiler.compile(file, overrides),\n mimeType: OoxmlMimeType.XLSX,\n});\n","/**\n * Convert a 1-based column number to Excel column letter(s).\n * 1 → \"A\", 26 → \"Z\", 27 → \"AA\", 28 → \"AB\"\n */\nexport function columnToLetter(col: number): string {\n let result = \"\";\n let n = col;\n while (n > 0) {\n const remainder = (n - 1) % 26;\n result = String.fromCharCode(65 + remainder) + result;\n n = Math.floor((n - 1) / 26);\n }\n return result;\n}\n\n/**\n * Convert Excel column letter(s) to a 1-based column number.\n * \"A\" → 1, \"Z\" → 26, \"AA\" → 27\n */\nexport function letterToColumn(s: string): number {\n let result = 0;\n for (let i = 0; i < s.length; i++) {\n result = result * 26 + (s.charCodeAt(i) - 64);\n }\n return result;\n}\n\n/**\n * Convert a JavaScript Date to an Excel serial number.\n * Excel epoch: January 1, 1900 = 1 (with the 1900 leap year bug).\n */\nexport function dateToSerialNumber(date: Date): number {\n // Excel treats 1900 as a leap year (bug inherited from Lotus 1-2-3).\n // The epoch is effectively December 30, 1899 = 0.\n const epoch = new Date(1899, 11, 30);\n const msPerDay = 86400000;\n const diff = date.getTime() - epoch.getTime();\n return diff / msPerDay;\n}\n","/**\n * XLSX parsing — parse .xlsx files into structured data.\n *\n * @module\n */\nimport { parseArchive, parseCorePropsElement } from \"@office-open/core\";\nimport type { ParsedArchive } from \"@office-open/core\";\nimport type { Element } from \"@office-open/xml\";\nimport { attr, attrNum, findChild, textOf } from \"@office-open/xml\";\nimport { toUint8Array } from \"undio\";\nimport type { DataType } from \"undio\";\n\nimport type { WorkbookOptions } from \"./file/file\";\nimport type {\n WorksheetOptions,\n RowOptions,\n CellOptions,\n ColumnOptions,\n MergeCellOptions,\n} from \"./file/worksheet\";\nimport { letterToColumn } from \"./util\";\n\nexport { parseArchive };\n\n// ── Low-level parse result ──\n\nexport interface XlsxPartRefs {\n worksheets: string[];\n charts: string[];\n media: string[];\n drawings: string[];\n}\n\nexport interface XlsxDocument {\n doc: ParsedArchive;\n /** xl/workbook.xml root element */\n workbook?: Element;\n /** Worksheet paths (xl/worksheets/sheet{n}.xml) */\n worksheets: string[];\n /** xl/styles.xml root element */\n styles?: Element;\n /** xl/sharedStrings.xml root element */\n sharedStrings?: Element;\n partRefs: XlsxPartRefs;\n /** docProps/core.xml path */\n coreProps?: string;\n /** docProps/app.xml path */\n appProps?: string;\n}\n\nfunction sortByNumber(paths: string[]): string[] {\n return paths.sort((a, b) => {\n const numA = parseInt(a.match(/(\\d+)/)?.[1] ?? \"0\", 10);\n const numB = parseInt(b.match(/(\\d+)/)?.[1] ?? \"0\", 10);\n return numA - numB;\n });\n}\n\n/**\n * Parse raw .xlsx data into a low-level XlsxDocument.\n */\nexport function parseXlsx(data: DataType): XlsxDocument {\n const uint8 = toUint8Array(data);\n const doc = parseArchive(uint8);\n\n const workbook = doc.get(\"xl/workbook.xml\");\n const styles = doc.get(\"xl/styles.xml\");\n const sharedStrings = doc.get(\"xl/sharedStrings.xml\");\n\n // Resolve worksheet paths from workbook rels\n const worksheets: string[] = [];\n const charts: string[] = [];\n const drawings: string[] = [];\n const media: string[] = [];\n\n const wbRels = doc.get(\"xl/_rels/workbook.xml.rels\");\n if (wbRels) {\n for (const child of wbRels.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (!target) continue;\n\n if (type.includes(\"/worksheet\")) {\n worksheets.push(target.startsWith(\"/\") ? target.slice(1) : `xl/${target}`);\n }\n }\n }\n sortByNumber(worksheets);\n\n // Scan for drawings, charts, media\n drawings.push(...doc.keys(\"xl/drawings/\").filter((k) => k.endsWith(\".xml\")));\n charts.push(...doc.keys(\"xl/charts/\").filter((k) => k.endsWith(\".xml\")));\n media.push(...doc.keys(\"xl/media/\"));\n sortByNumber(drawings);\n sortByNumber(charts);\n\n // Root rels → core/app props\n let coreProps: string | undefined;\n let appProps: string | undefined;\n const rootRels = doc.get(\"_rels/.rels\");\n if (rootRels) {\n for (const child of rootRels.elements ?? []) {\n if (child.name !== \"Relationship\") continue;\n const type = attr(child, \"Type\") ?? \"\";\n const target = attr(child, \"Target\") ?? \"\";\n if (type.includes(\"/core-properties\")) coreProps = target;\n else if (type.includes(\"/extended-properties\")) appProps = target;\n }\n }\n\n return {\n doc,\n workbook,\n worksheets,\n styles,\n sharedStrings,\n partRefs: { worksheets, charts, media, drawings },\n coreProps,\n appProps,\n };\n}\n\n// ── Shared strings helper ──\n\nfunction parseSharedStrings(el: Element | undefined): string[] {\n if (!el) return [];\n const strings: string[] = [];\n for (const si of el.elements ?? []) {\n if (si.name !== \"si\") continue;\n // Handle both <si><t>text</t></si> and <si><r><t>text</t></r>...</si>\n const t = findChild(si, \"t\");\n if (t) {\n strings.push(textOf(t) ?? \"\");\n } else {\n // Rich text: concatenate all <r><t> segments\n const parts: string[] = [];\n for (const r of si.elements ?? []) {\n if (r.name !== \"r\") continue;\n const rt = findChild(r, \"t\");\n if (rt) parts.push(textOf(rt) ?? \"\");\n }\n strings.push(parts.join(\"\"));\n }\n }\n return strings;\n}\n\n// ── Cell reference helpers ──\n\nfunction colFromRef(ref: string): number {\n const match = ref.match(/^([A-Z]+)/);\n return match ? letterToColumn(match[1]) : 1;\n}\n\nfunction rowFromRef(ref: string): number {\n const match = ref.match(/(\\d+)$/);\n return match ? parseInt(match[1], 10) : 1;\n}\n\n// ── Worksheet parsing ──\n\nfunction parseWorksheetElement(wsEl: Element, strings: string[]): WorksheetOptions {\n const opts: Record<string, unknown> = {};\n\n // Sheet name from the parent workbook's sheet element (not available here)\n // Caller should set it\n\n // Columns\n // Elements might be prefixed or unprefixed depending on how the XML parser handles default namespaces.\n const colsEl = findChild(wsEl, \"cols\") ?? findChildByLocalName(wsEl, \"cols\");\n if (colsEl) {\n const columns: ColumnOptions[] = [];\n for (const col of colsEl.elements ?? []) {\n if (localName(col) !== \"col\") continue;\n const min = attrNum(col, \"min\");\n const max = attrNum(col, \"max\");\n if (min === undefined || max === undefined) continue;\n const colOpts: Record<string, unknown> = { min, max };\n const width = attrNum(col, \"width\");\n if (width !== undefined) colOpts.width = width;\n if (attr(col, \"hidden\") === \"1\") colOpts.hidden = true;\n columns.push(colOpts as unknown as ColumnOptions);\n }\n if (columns.length > 0) opts.columns = columns;\n }\n\n // Freeze panes\n const sheetViews = findChildByLocalName(wsEl, \"sheetViews\");\n if (sheetViews) {\n const sheetView = findChildByLocalName(sheetViews, \"sheetView\");\n if (sheetView) {\n const pane = findChildByLocalName(sheetView, \"pane\");\n if (pane) {\n const state = attr(pane, \"state\");\n if (state === \"frozen\") {\n const freezePanes: Record<string, unknown> = {};\n const ySplit = attrNum(pane, \"ySplit\");\n const xSplit = attrNum(pane, \"xSplit\");\n if (ySplit && ySplit > 0) freezePanes.row = ySplit;\n if (xSplit && xSplit > 0) freezePanes.col = xSplit;\n if (Object.keys(freezePanes).length > 0) opts.freezePanes = freezePanes;\n }\n }\n }\n }\n\n // Sheet data (rows)\n const sheetData = findChildByLocalName(wsEl, \"sheetData\");\n const rows: RowOptions[] = [];\n if (sheetData) {\n for (const rowEl of sheetData.elements ?? []) {\n if (localName(rowEl) !== \"row\") continue;\n const rowNumber = attrNum(rowEl, \"r\");\n const rowOpts: Record<string, unknown> = {};\n if (rowNumber !== undefined) rowOpts.rowNumber = rowNumber;\n\n const ht = attrNum(rowEl, \"ht\");\n if (ht !== undefined) rowOpts.height = ht;\n if (attr(rowEl, \"hidden\") === \"1\") rowOpts.hidden = true;\n\n const cells: CellOptions[] = [];\n for (const cellEl of rowEl.elements ?? []) {\n if (localName(cellEl) !== \"c\") continue;\n const ref = attr(cellEl, \"r\");\n const type = attr(cellEl, \"t\");\n const cellOpts: Record<string, unknown> = {};\n if (ref) cellOpts.reference = ref;\n\n const styleIdx = attrNum(cellEl, \"s\");\n if (styleIdx !== undefined) cellOpts.styleIndex = styleIdx;\n\n // Cell value\n const vEl = findChildByLocalName(cellEl, \"v\");\n const isEl = findChildByLocalName(cellEl, \"is\");\n\n if (type === \"s\" && vEl) {\n // Shared string\n const idx = parseInt(textOf(vEl) ?? \"\", 10);\n cellOpts.value = strings[idx] ?? \"\";\n } else if (type === \"b\" && vEl) {\n cellOpts.value = textOf(vEl) === \"1\";\n } else if (type === \"inlineStr\" && isEl) {\n const t = findChildByLocalName(isEl, \"t\");\n cellOpts.value = textOf(t) ?? \"\";\n } else if (vEl) {\n const raw = textOf(vEl) ?? \"\";\n const num = Number(raw);\n cellOpts.value = isNaN(num) ? raw : num;\n }\n\n cells.push(cellOpts as CellOptions);\n }\n\n rowOpts.cells = cells;\n rows.push(rowOpts as RowOptions);\n }\n }\n opts.children = rows;\n\n // Merge cells\n const mergeCellsEl = findChildByLocalName(wsEl, \"mergeCells\");\n if (mergeCellsEl) {\n const mergeCells: MergeCellOptions[] = [];\n for (const mc of mergeCellsEl.elements ?? []) {\n if (localName(mc) !== \"mergeCell\") continue;\n const ref = attr(mc, \"ref\");\n if (!ref) continue;\n const parts = ref.split(\":\");\n if (parts.length === 2) {\n mergeCells.push({\n from: { row: rowFromRef(parts[0]), col: colFromRef(parts[0]) },\n to: { row: rowFromRef(parts[1]), col: colFromRef(parts[1]) },\n });\n }\n }\n if (mergeCells.length > 0) opts.mergeCells = mergeCells;\n }\n\n // Auto filter\n const autoFilterEl = findChildByLocalName(wsEl, \"autoFilter\");\n if (autoFilterEl) {\n const ref = attr(autoFilterEl, \"ref\");\n if (ref) opts.autoFilter = ref;\n }\n\n return opts as WorksheetOptions;\n}\n\n// ── Helpers ──\n\nfunction localName(el: Element): string {\n const name = el.name ?? \"\";\n const colonIdx = name.indexOf(\":\");\n return colonIdx >= 0 ? name.slice(colonIdx + 1) : name;\n}\n\nfunction findChildByLocalName(parent: Element, name: string): Element | undefined {\n return (parent.elements ?? []).find((el) => localName(el) === name);\n}\n\n/**\n * Parse a .xlsx file and convert it into WorkbookOptions.\n *\n * The returned options can be passed to `new Workbook(parsed)`.\n */\nexport function parseWorkbook(data: DataType): WorkbookOptions {\n const xlsx = parseXlsx(data);\n\n const opts: Record<string, unknown> = {};\n\n // Core properties\n if (xlsx.coreProps) {\n const corePropsEl = xlsx.doc.get(xlsx.coreProps);\n if (corePropsEl) {\n const cp = parseCorePropsElement(corePropsEl);\n if (cp.title) opts.title = cp.title;\n if (cp.subject) opts.subject = cp.subject;\n if (cp.creator) opts.creator = cp.creator;\n if (cp.keywords) opts.keywords = cp.keywords;\n if (cp.description) opts.description = cp.description;\n if (cp.lastModifiedBy) opts.lastModifiedBy = cp.lastModifiedBy;\n if (cp.revision) opts.revision = parseInt(cp.revision, 10);\n }\n }\n\n // Shared strings\n const strings = parseSharedStrings(xlsx.sharedStrings);\n\n // Sheet names from workbook\n const sheetNames: string[] = [];\n if (xlsx.workbook) {\n const sheetsEl = findChildByLocalName(xlsx.workbook, \"sheets\");\n if (sheetsEl) {\n for (const s of sheetsEl.elements ?? []) {\n if (localName(s) !== \"sheet\") continue;\n sheetNames.push(attr(s, \"name\") ?? \"\");\n }\n }\n }\n\n // Parse worksheets\n const worksheets: WorksheetOptions[] = [];\n for (let i = 0; i < xlsx.worksheets.length; i++) {\n const wsPath = xlsx.worksheets[i];\n const wsEl = xlsx.doc.get(wsPath);\n if (!wsEl) continue;\n\n const wsOpts = parseWorksheetElement(wsEl, strings) as Record<string, unknown>;\n if (sheetNames[i]) wsOpts.name = sheetNames[i];\n worksheets.push(wsOpts as WorksheetOptions);\n }\n\n opts.worksheets = worksheets;\n return opts as WorkbookOptions;\n}\n","/**\n * XLSX patching — replace placeholders in existing .xlsx files.\n *\n * Unlike DOCX/PPTX (paragraph-based), XLSX patching targets cell values:\n * - Replaces placeholders in the shared strings table (most common)\n * - Replaces placeholders in inline strings within worksheet cells\n *\n * @module\n */\nimport { OoxmlMimeType, unzipSync, zipAndConvert, strFromU8, toJson } from \"@office-open/core\";\nimport type { OutputByType, OutputType } from \"@office-open/core\";\nimport { js2xml } from \"@office-open/xml\";\nimport type { Element } from \"@office-open/xml\";\nimport { toUint8Array } from \"undio\";\n\n/** Reusable TextEncoder (stateless, safe to share). */\nconst encoder = new TextEncoder();\n\nexport type InputDataType = Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob;\n\nexport type PatchDocumentOutputType = OutputType;\n\nexport const PatchType = {\n CELL: \"cell\",\n} as const;\n\nexport interface CellPatch {\n /** Replacement value (string, number, boolean, or Date) */\n readonly value: string | number | boolean | Date;\n}\n\nexport type IPatch = CellPatch;\n\nexport interface PatchWorkbookOptions<T extends PatchDocumentOutputType = PatchDocumentOutputType> {\n readonly outputType: T;\n readonly data: InputDataType;\n readonly patches: Readonly<Record<string, IPatch>>;\n readonly placeholderDelimiters?: Readonly<{\n readonly start: string;\n readonly end: string;\n }>;\n}\n\n/**\n * Patch an existing .xlsx workbook by replacing placeholder text in cells.\n *\n * Placeholders are matched in shared strings and inline strings.\n * For string replacements, the shared string value is updated in-place.\n * For non-string replacements, the cell type and value are updated.\n */\nexport const patchWorkbook = async <T extends PatchDocumentOutputType = PatchDocumentOutputType>({\n outputType,\n data,\n patches,\n placeholderDelimiters = { start: \"{{\", end: \"}}\" } as const,\n}: PatchWorkbookOptions<T>): Promise<OutputByType[T]> => {\n const zipContent = unzipSync(toUint8Array(data));\n\n const xmlMap = new Map<string, Element>();\n const binaryMap = new Map<string, Uint8Array>();\n\n // Separate XML files from binary files\n for (const [key, value] of Object.entries(zipContent)) {\n if (key.endsWith(\".xml\") || key.endsWith(\".rels\")) {\n xmlMap.set(key, toJson(strFromU8(value)));\n } else {\n binaryMap.set(key, value);\n }\n }\n\n const { start, end } = placeholderDelimiters;\n\n // Build placeholder → patch map\n const patchMap = new Map<string, IPatch>();\n for (const [key, patch] of Object.entries(patches)) {\n patchMap.set(`${start}${key}${end}`, patch);\n }\n\n // 1. Patch shared strings\n const sst = xmlMap.get(\"xl/sharedStrings.xml\");\n if (sst) {\n patchSharedStrings(sst, patchMap);\n }\n\n // 2. Patch inline strings in worksheets\n const worksheetKeys = Object.keys(zipContent).filter(\n (k) => k.startsWith(\"xl/worksheets/sheet\") && k.endsWith(\".xml\"),\n );\n for (const wsKey of worksheetKeys) {\n const ws = xmlMap.get(wsKey);\n if (ws) patchWorksheetInlineStrings(ws, patchMap);\n }\n\n // Rebuild ZIP\n const files: Record<string, Uint8Array> = {};\n for (const [key, value] of xmlMap) {\n files[key] = encoder.encode(js2xml(value));\n }\n for (const [key, value] of binaryMap) {\n files[key] = value;\n }\n\n return await zipAndConvert(files, outputType, OoxmlMimeType.XLSX);\n};\n\nfunction patchSharedStrings(sst: Element, patchMap: Map<string, IPatch>): void {\n // toJson returns {elements: [{name: \"sst\", ...}]} — unwrap to actual root\n const root = sst.name ? sst : sst.elements?.[0];\n if (!root) return;\n\n for (const si of root.elements ?? []) {\n if (si.name !== \"si\") continue;\n\n // Simple: <si><t>text</t></si>\n const t = findLocalChild(si, \"t\");\n if (t) {\n patchTextElement(t, patchMap);\n } else {\n // Rich text: <si><r><t>text</t></r>...</si>\n for (const r of si.elements ?? []) {\n if (r.name !== \"r\") continue;\n const rt = findLocalChild(r, \"t\");\n if (rt) patchTextElement(rt, patchMap);\n }\n }\n }\n}\n\nfunction patchWorksheetInlineStrings(ws: Element, patchMap: Map<string, IPatch>): void {\n const root = ws.name ? ws : ws.elements?.[0];\n if (!root) return;\n\n const sheetData = findLocalChild(root, \"sheetData\");\n if (!sheetData) return;\n\n for (const row of sheetData.elements ?? []) {\n if (localName(row) !== \"row\") continue;\n for (const cell of row.elements ?? []) {\n if (localName(cell) !== \"c\") continue;\n\n // Check inline strings: <c t=\"inlineStr\"><is><t>text</t></is></c>\n const isEl = findLocalChild(cell, \"is\");\n if (isEl) {\n const t = findLocalChild(isEl, \"t\");\n if (t) patchTextElement(t, patchMap);\n }\n }\n }\n}\n\nfunction patchTextElement(tEl: Element, patchMap: Map<string, IPatch>): void {\n const text = tEl.elements?.[0]?.text;\n if (typeof text !== \"string\") return;\n\n for (const [placeholder, patch] of patchMap) {\n if (text.includes(placeholder)) {\n const newValue = String(patch.value);\n const replaced = text.replace(placeholder, newValue);\n if (tEl.elements) {\n tEl.elements[0] = { ...tEl.elements[0], text: replaced };\n }\n }\n }\n}\n\nfunction localName(el: Element): string {\n const name = el.name ?? \"\";\n const colonIdx = name.indexOf(\":\");\n return colonIdx >= 0 ? name.slice(colonIdx + 1) : name;\n}\n\nfunction findLocalChild(parent: Element, name: string): Element | undefined {\n return (parent.elements ?? []).find((el) => localName(el) === name);\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,YAAY;AAClB,MAAM,iBAAiB;AACvB,MAAM,cAAc;AACpB,MAAM,sBACJ;AACF,MAAM,aAAa;AACnB,MAAM,aAAa;AA+BnB,MAAM,aAAa;CApBjB;EACE,MAAM;EACN,aAAa;EACb,KAAK;CACP;CACA;EAAE,MAAM;EAAW,aAAa;EAAmB,KAAK;CAAM;CAC9D;EAAE,MAAM;EAAY,aAAa;EAAW,KAAK;CAAmB;CACpE;EACE,MAAM;EACN,aAAa;EACb,KAAK;CACP;CACA;EACE,MAAM;EACN,aAAa;EACb,KAAK;CACP;AAI8B,EAAE,KAAK,MACrC,EAAE,SAAS,YACP,yBAAyB,EAAE,YAAY,eAAe,EAAE,IAAI,OAC5D,0BAA0B,EAAE,YAAY,cAAc,EAAE,IAAI,IAClE,EAAE,KAAK,EAAE;AAET,IAAa,eAAb,cAAkC,iBAAiB;CACjD,iBAAkD,CAAC;CAEnD,cAAqB;EACnB,MAAM,OAAO;CACf;CAEA,aAAoB,OAAqB;EACvC,KAAK,eAAe,K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U,YAAY,CAAC,GAAG;EAC1C,IAAI,UAAU,GAAG,MAAM,OAAO;EAC9B,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,GAAG;GACrC,IAAI,UAAU,IAAI,MAAM,KAAK;GAG7B,MAAM,OAAO,eAAe,MAAM,IAAI;GACtC,IAAI,MAAM;IACR,MAAM,IAAI,eAAe,MAAM,GAAG;IAClC,IAAI,GAAG,iBAAiB,GAAG,QAAQ;GACrC;EACF;CACF;AACF;AAEA,SAAS,iBAAiB,KAAc,UAAqC;CAC3E,MAAM,OAAO,IAAI,WAAW,IAAI;CAChC,IAAI,OAAO,SAAS,UAAU;CAE9B,KAAK,MAAM,CAAC,aAAa,UAAU,UACjC,IAAI,KAAK,SAAS,WAAW,GAAG;EAC9B,MAAM,WAAW,OAAO,MAAM,KAAK;EACnC,MAAM,WAAW,KAAK,QAAQ,aAAa,QAAQ;EACnD,IAAI,IAAI,UACN,IAAI,SAAS,KAAK;GAAE,GAAG,IAAI,SAAS;GAAI,MAAM;EAAS;CAE3D;AAEJ;AAEA,SAAS,UAAU,IAAqB;CACtC,MAAM,OAAO,GAAG,QAAQ;CACxB,MAAM,WAAW,KAAK,QAAQ,GAAG;CACjC,OAAO,YAAY,IAAI,KAAK,MAAM,WAAW,CAAC,IAAI;AACpD;AAEA,SAAS,eAAe,QAAiB,MAAmC;CAC1E,QAAQ,OAAO,YAAY,CAAC,GAAG,MAAM,OAAO,UAAU,EAAE,MAAM,IAAI;AACpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/xlsx",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "Generate .xlsx files with JS/TS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"excel",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"undio": "0.2.0",
|
|
40
|
-
"@office-open/core": "0.6.
|
|
41
|
-
"@office-open/xml": "0.6.
|
|
40
|
+
"@office-open/core": "0.6.9",
|
|
41
|
+
"@office-open/xml": "0.6.9"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"dev": "basis build --stub",
|