From eaabf9099dc9784cdc90f2739c32d0440050365c Mon Sep 17 00:00:00 2001 From: mohammadrezaeicode <131792366+mohammadrezaeicode@users.noreply.github.com> Date: Thu, 30 Jan 2025 02:35:16 -0800 Subject: [PATCH 1/7] Create manually_test.yml --- .github/workflows/manually_test.yml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/manually_test.yml diff --git a/.github/workflows/manually_test.yml b/.github/workflows/manually_test.yml new file mode 100644 index 0000000..c18b903 --- /dev/null +++ b/.github/workflows/manually_test.yml @@ -0,0 +1,38 @@ +name: Manually Test +on: + workflow_dispatch: + inputs: + branch: + description: 'Test Branch' + required: true + default: 'main' + os: + description: 'Operating System' + required: true + default: 'ubuntu-latest' + options: + - 'windows-latest' + - 'ubuntu-latest' + node_version: + description: 'Node Environment' + required: true + default: '20.x' +jobs: + test: + name: Test + timeout-minutes: 30 + continue-on-error: true + runs-on: ${{ github.event.inputs.os }} + steps: + - name: Checkout to code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch }} + - name: install Node js Version 20 + uses: actions/setup-node@v4 + with: + node-version: ${{ github.event.inputs.node_version }} + - name: install dependency + run: npm install + - name: Run test + run: npm run test From be5212106ddcbd71ef633e45e44c6a5b716c8e45 Mon Sep 17 00:00:00 2001 From: "m.r" Date: Thu, 6 Feb 2025 08:09:14 -0800 Subject: [PATCH 2/7] feature: init V7.0.0 --- .github/workflows/manually_test.yml | 1 + README.md | 79 +- _test_/__mocks__/file-saver.ts | 3 + _test_/__mocks__/xs.ts | 14 + _test_/src/functions/excel-to-json.test.ts | 57 + .../functions/generate-csv-mocked-2.test.ts | 89 +- _test_/src/functions/replacer.test.ts | 137 + _test_/src/index.test.ts | 42 +- _test_/src/utils/call-api.ts | 15 + _test_/src/utils/drop-down-utils.test.ts | 24 + _test_/src/utils/multi-value.test.ts | 304 +- ...8izuR1A.cjs => FileSaver.min-3zGNM-lE.cjs} | 2 +- ...-Di4lMG3c.js => FileSaver.min-BEH1o5YI.js} | 62 +- ...-Cjv31LBO.js => FileSaver.min-DXmtgrTw.js} | 2 +- ...-xJafi45S.js => FileSaver.min-DbxQUYqv.js} | 2 +- dist/excel-table.amd.js | 2 +- dist/excel-table.cjs | 2 +- dist/excel-table.d.ts | 40 +- dist/excel-table.iife.js | 50 +- dist/excel-table.js | 21 +- dist/excel-table.system.js | 2 +- dist/excel-table.umd.cjs | 50 +- dist/index-BGhJlXYS.cjs | 44 - dist/index-BRPJRQwV.js | 44 + dist/index-Cav6spD2.js | 2479 ++++++++++++++++ dist/index-D4WU6E--.js | 2518 ----------------- dist/index-DnICe6T_.js | 44 + dist/index-Ol2dJD1V.js | 44 - dist/index-Sti7hi3g.js | 44 - dist/index-xyzS9dVO.cjs | 44 + ....min-yECc9DIt.js => jszip.min-49JP7itW.js} | 6 +- ....min-BoDw5mwd.js => jszip.min-CGrYsaMq.js} | 6 +- ....min-DoL7Cu0z.js => jszip.min-D-TEDr9v.js} | 1388 ++++----- ...in-D99Dj6Yd.cjs => jszip.min-jYEVHKmD.cjs} | 6 +- ...ils-BRep2QN2.js => read-utils-C7gudp0B.js} | 4 +- ...ils-C-k9a0yr.js => read-utils-C8-wmTaQ.js} | 2 +- dist/read-utils-cd06gBiy.js | 1 - ...s-D5nfIasC.cjs => read-utils-omGMVauH.cjs} | 2 +- dist/read-utils-u30qVyXC.js | 1 + package-lock.json | 716 +++-- package.json | 2 +- src/data-model/excel-table.ts | 41 +- src/functions/generate-excel.ts | 38 +- src/functions/replacer.ts | 94 + src/index.ts | 20 +- src/utils/drop-down-utils.ts | 24 + src/utils/multi-value.ts | 266 +- 47 files changed, 4648 insertions(+), 4230 deletions(-) create mode 100644 _test_/__mocks__/file-saver.ts create mode 100644 _test_/__mocks__/xs.ts create mode 100644 _test_/src/functions/replacer.test.ts create mode 100644 _test_/src/utils/drop-down-utils.test.ts rename dist/{FileSaver.min-D8izuR1A.cjs => FileSaver.min-3zGNM-lE.cjs} (79%) rename dist/{FileSaver.min-Di4lMG3c.js => FileSaver.min-BEH1o5YI.js} (61%) rename dist/{FileSaver.min-Cjv31LBO.js => FileSaver.min-DXmtgrTw.js} (81%) rename dist/{FileSaver.min-xJafi45S.js => FileSaver.min-DbxQUYqv.js} (52%) delete mode 100644 dist/index-BGhJlXYS.cjs create mode 100644 dist/index-BRPJRQwV.js create mode 100644 dist/index-Cav6spD2.js delete mode 100644 dist/index-D4WU6E--.js create mode 100644 dist/index-DnICe6T_.js delete mode 100644 dist/index-Ol2dJD1V.js delete mode 100644 dist/index-Sti7hi3g.js create mode 100644 dist/index-xyzS9dVO.cjs rename dist/{jszip.min-yECc9DIt.js => jszip.min-49JP7itW.js} (56%) rename dist/{jszip.min-BoDw5mwd.js => jszip.min-CGrYsaMq.js} (56%) rename dist/{jszip.min-DoL7Cu0z.js => jszip.min-D-TEDr9v.js} (68%) rename dist/{jszip.min-D99Dj6Yd.cjs => jszip.min-jYEVHKmD.cjs} (56%) rename dist/{read-utils-BRep2QN2.js => read-utils-C7gudp0B.js} (96%) rename dist/{read-utils-C-k9a0yr.js => read-utils-C8-wmTaQ.js} (94%) delete mode 100644 dist/read-utils-cd06gBiy.js rename dist/{read-utils-D5nfIasC.cjs => read-utils-omGMVauH.cjs} (94%) create mode 100644 dist/read-utils-u30qVyXC.js create mode 100644 src/functions/replacer.ts create mode 100644 src/utils/drop-down-utils.ts diff --git a/.github/workflows/manually_test.yml b/.github/workflows/manually_test.yml index c18b903..6c23654 100644 --- a/.github/workflows/manually_test.yml +++ b/.github/workflows/manually_test.yml @@ -8,6 +8,7 @@ on: default: 'main' os: description: 'Operating System' + type: choice required: true default: 'ubuntu-latest' options: diff --git a/README.md b/README.md index f8cb7fa..33c3e05 100644 --- a/README.md +++ b/README.md @@ -34,11 +34,15 @@ important functions of library that are defined with specific use cases as follo -- **`πŸ†• excelToNode`**: This function reads an uploaded Excel file and generates a representation of the tables from its sheets. It can either return the table directly or insert it into a specified container node provided as input. +- **` excelToNode`**: This function reads an uploaded Excel file and generates a representation of the tables from its sheets. It can either return the table directly or insert it into a specified container node provided as input. -- **`πŸ†• excelToJson`**: This function reads an Excel file and returns a JSON object that represents the data contained in the file. +- **` excelToJson`**: This function reads an Excel file and returns a JSON object that represents the data contained in the file. + + + +- **`replaceInExcel`**: This function is used to replace data based on a defined flag, such as {{FLAG}}, in Excel. The example has been moved to a separate repository for easier updates. You can find it in the ["**_`mr-excel-example-gallery`_**"](https://github.com/mohammadrezaeicode/mr-excel-example-gallery)([**_link_**](https://github.com/mohammadrezaeicode/mr-excel-example-gallery)) @@ -88,16 +92,20 @@ The example has been moved to a separate repository for easier updates. You can - [**`How to use extractExcelData`**](#extract-excel-data-usage) - [**`generateCSV && generateText`**](#generate-csv-txt) - [**`How to use generateCSV && generateText`**](#generate-csv-txt-usage) -- [**`πŸ†• excelToNode`**](#excel-to-node) - - [**`πŸ†• How to use excelToNode`**](#excel-to-node-usage) -- [**`πŸ†• excelToJson`**](#excel-to-json) - - [**`πŸ†• How to use excelToJson`**](#excel-to-json-usage) +- [**` excelToNode`**](#excel-to-node) + - [**` How to use excelToNode`**](#excel-to-node-usage) +- [**` excelToJson`**](#excel-to-json) + - [**` How to use excelToJson`**](#excel-to-json-usage) +- [**`πŸ†• replaceInExcel`**](#replace-in-excel) + - [**`πŸ†• How to use replaceInExcel`**](#replace-in-excel-usage) - [**`interface`**](#interface) - [**`Migrate Version`**](#migrate) + - [**`Migrating from 6 to 7`**](#migrating-6) - [**`Migrating from 5 to 6`**](#migrating-5) - [**`Migrating from 4 to 5`**](#migrating-4) - [**`Migrating from 3 to 4`**](#migrating-3) - [**`Migrating from 2 to 3`**](#migrating-2) +- [**`Release note`**](#release-note) @@ -659,9 +667,34 @@ ExcelTable.excelToNode(uri, queryForTable, containerElement, config) + + +### πŸ†• How to use replaceInExcel + +To use this function, you should provide {{FLAG}} in Excel. Change the relevant cells to represent the flag ({{name}}, e.g.) and pass them to the function. Additionally, you should supply the data that will replace the flag. Here’s an example for clarification: +[Excel that used for example](https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/replacer.xlsx?raw=true) + +
+ +Display Code + +```javascript +ExcelTable.excelToNode(Link, Replace Map,Replacer Map) +----- +ExcelTable.replaceInExcel("./replacer.xlsx", { + V: "test Data", + v1: "This is value one", + v2: "This is value two", +}); +``` + +
+ +![result imag](https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/img/replacer.png?raw=true) + -### πŸ†• How to use excelToJson +### How to use excelToJson
@@ -7156,6 +7189,24 @@ The primary interface of the library is located in the excel-table.d.ts file. [C In this section, we define the significant changes that require migration for the upcoming version. + + +## Migrating from 6 to 7 [⬆️](#table-of-contents) + +To successfully migrate from version 6 to version 7, you should update the following options: + +- change in the interface of `MultiStyleValue`: + +``` +export interface MapMultiStyleValue { + [key: string]: MultiStyleValue[]; +} +export interface MultiStyleValue { + value: string | number; + styleId?: string; +} +``` + ## Migrating from 5 to 6 [⬆️](#table-of-contents) @@ -7226,8 +7277,22 @@ To migrate from Version 2 to Version 3, you need to follow the steps below: - Change "backgroundColor" to "backgroundColor." - Replace "color" with "color." + + ## Release Notes [⬆️](#table-of-contents) +#### New Features + +- A drop-down option (multi-select option) provides the ability to create a cell that contains multiple selectable values.`sheet`->`[n]`->`dropDowns` +- The `replaceInExcel` functionality in Excel allows you to replace data in an existing file using flags provided within the spreadsheet. + +#### Bug Fixes + +- `generateExcel` supports empty objects and will generate an empty Excel file. + +> [!NOTE] +> The related interface has not changed, so the sheet needs to be provided in TypeScript. + ### Version 6.0.1 (2024-08-11) #### New Features diff --git a/_test_/__mocks__/file-saver.ts b/_test_/__mocks__/file-saver.ts new file mode 100644 index 0000000..f9c19c0 --- /dev/null +++ b/_test_/__mocks__/file-saver.ts @@ -0,0 +1,3 @@ +import { jest } from "@jest/globals"; + +export const saveAs = jest.fn(); diff --git a/_test_/__mocks__/xs.ts b/_test_/__mocks__/xs.ts new file mode 100644 index 0000000..4587a98 --- /dev/null +++ b/_test_/__mocks__/xs.ts @@ -0,0 +1,14 @@ +import { jest } from "@jest/globals"; + +const JSZip = jest.fn(); + +JSZip.mockImplementation(() => { + return { + loadAsync: jest.fn(), + generateAsync: jest.fn().mockResolvedValue({ + slice: jest.fn().mockReturnValue("mockedValue"), + }), // Mocking generateAsync to return a resolved promise + }; +}); + +export default JSZip; // Mocking the default export diff --git a/_test_/src/functions/excel-to-json.test.ts b/_test_/src/functions/excel-to-json.test.ts index 92f0d1b..1e9d507 100644 --- a/_test_/src/functions/excel-to-json.test.ts +++ b/_test_/src/functions/excel-to-json.test.ts @@ -12,6 +12,63 @@ const mockedExtractExcelData = >( extractExcelData ); describe("excel-to-node data tests", () => { + test("excelToJson 2", async () => { + jest.resetAllMocks(); + const map = new Map(); + map.set("sheet1", "Sheet1"); + map.set("sheet2", "Sheet2"); + mockedExtractExcelData.mockReturnValue( + Promise.resolve({ + data: { + sheet1: [ + ["test value for cell", "3"], + , + , + ["7", "6", "5", "4"], + , + , + [, , , , , "h"], + ], + Sheet2: [, , ["a"], , , [, , "e"]], + }, + sheetName: map.entries(), + sheetNameObject: { + sheet1: "nameSheet", + sheet2: "Sheet2", + }, + maxLengthOfColumn: { + sheet1: 5, + Sheet2: 2, + }, + } as ReadResult) + ); + let result = await excelToJson( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/y.xlsx?raw=true" + ).catch((e: string) => { + return e; + }); + expect(extractExcelData).toBeCalledTimes(1); + expect(result).toEqual({ + nameSheet: [ + {}, + { + "3": "6", + property3: "5", + property4: "4", + "test value for cell": "7", + }, + { + property6: "h", + }, + ], + Sheet2: [ + {}, + { + property3: "e", + }, + ], + }); + }, 150000); test("excelToJson", async () => { jest.resetAllMocks(); const map = new Map(); diff --git a/_test_/src/functions/generate-csv-mocked-2.test.ts b/_test_/src/functions/generate-csv-mocked-2.test.ts index c91e7fc..3bf6b2d 100644 --- a/_test_/src/functions/generate-csv-mocked-2.test.ts +++ b/_test_/src/functions/generate-csv-mocked-2.test.ts @@ -54,8 +54,95 @@ describe("generateCSV", () => { }, true ); - expect(mockGenerateAsync).toHaveBeenCalledTimes(1); + // expect(mockGenerateAsync).toHaveBeenCalledTimes(1); expect(saveAs).toHaveBeenCalledTimes(1); expect(result).toBe("done"); }); + test("should create a zip and save it 2", async () => { + let result = await generateCSV( + { + fileName:"test", + sheet: [ + { + data: [ + { a: 1, b: "b1" }, + { a: 2, b: "b2" }, + ], + headers: [ + { + label: "a", + text: "a", + }, + { + label: "b", + text: "b", + }, + ], + }, + ], + }, + true + ); + // expect(mockGenerateAsync).toHaveBeenCalledTimes(1); + expect(saveAs).toHaveBeenCalledTimes(1); + expect(result).toBe("done"); + }); + test("should create a blob and save it", async () => { + let result = await generateCSV( + { + sheet: [ + { + data: [ + { a: 1, b: "b1" }, + { a: 2, b: "b2" }, + ], + headers: [ + { + label: "a", + text: "a", + }, + { + label: "b", + text: "b", + }, + ], + }, + ], + }, + false + ); + // expect(mockGenerateAsync).toHaveBeenCalledTimes(1); + expect(saveAs).toHaveBeenCalledTimes(1); + expect(result).toBe(undefined); + }); + test("should create a blob and save it 2", async () => { + let result = await generateCSV( + { + fileName:"test", + sheet: [ + { + data: [ + { a: 1, b: "b1" }, + { a: 2, b: "b2" }, + ], + headers: [ + { + label: "a", + text: "a", + }, + { + label: "b", + text: "b", + }, + ], + }, + ], + }, + false, + true + ); + // expect(mockGenerateAsync).toHaveBeenCalledTimes(1); + expect(saveAs).toHaveBeenCalledTimes(1); + expect(result).toBe(undefined); + }); }); diff --git a/_test_/src/functions/replacer.test.ts b/_test_/src/functions/replacer.test.ts new file mode 100644 index 0000000..38a4f29 --- /dev/null +++ b/_test_/src/functions/replacer.test.ts @@ -0,0 +1,137 @@ +import { beforeEach, describe, expect, it, jest, test } from "@jest/globals"; +import { saveAs } from "file-saver"; +// import JSZip from "jszip"; +jest.mock("file-saver"); +import { myFunction, replaceInExcel } from "../../../src/functions/replacer"; +import { callApi, callApiReturnMockBlob, callApiReturnNull, mockBlob } from "../utils/call-api"; +import { readFileSync } from "fs"; +// This will use the mock we created + +describe("replaceInExcel tests", () => { + beforeEach(() => { + jest.clearAllMocks(); // Reset the mock status before each test + }); + test("should be function", () => { + expect(typeof replaceInExcel).toBe("function"); + }); + test("should be function xyz", async () => { + const val = (await replaceInExcel( + "", + { x: "2" }, + { + backend: false, + notSave: true, + data: (await callApi( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true" + )) as any, + } + )) as any; + + expect(typeof val).toBe("object"); + expect("size" in val).toBeTruthy(); + expect("type" in val).toBeTruthy(); + expect(val["type"]).toBe( + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + ); + expect(typeof val.arrayBuffer).toBe("function"); + + // expect(Array.isArray(abuffer)).toBeTruthy(); + // expect(JSZip.generateAsync).toHaveBeenCalledTimes(1); + // expect(val.length).toBeGreaterThan(1000); + }, 1000000); + test("should be function mock", async () => { + const val = await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: false, + fetch: callApi, + generateType: "array", + notSave: false, + } + ); + expect(typeof val).toBe("undefined"); + expect(saveAs).toHaveBeenCalledTimes(1); + // expect(val.length).toBeGreaterThan(1000); + }, 120000); + test("should be function", async () => { + const val = (await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: true, + fetch: callApi, + fileName: "test", + generateType: "array", + } + )) as number[]; + expect(Array.isArray(val)).toBe(true); + expect(val.length).toBeGreaterThan(1000); + }, 120000); + test("should be function", async () => { + const val = (await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: true, + fetch: callApi, + generateType: "array", + } + )) as number[]; + expect(Array.isArray(val)).toBe(true); + expect(val.length).toBeGreaterThan(1000); + }, 120000); + test("should be function 2", async () => { + const val = (await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: true, + // fetch: callApi, + generateType: "array", + } + )) as number[]; + expect(Array.isArray(val)).toBe(true); + expect(val.length).toBeGreaterThan(1000); + }, 120000); + test("should be function 3-2", async () => { + // jest.resetAllMocks() + await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: false, + fetch: callApi, + generateType: "array", + } + ).catch((e) => { + }); + }, 120000); + test("should be function 3", async () => { + await replaceInExcel( + "https://github.com/mohammadrezaeicode/mr-excel-page-repo/blob/main/public/x.xlsx?raw=true", + {}, + { + backend: true, + fetch: callApiReturnNull, + generateType: "array", + } + ).catch((e) => { + expect(e).toBe("response is null"); + }); + }, 120000); +}); +// myFile.test.ts +describe("Your test suite", () => { + beforeEach(() => { + jest.clearAllMocks(); // Reset the mock status before each test + }); + + it("should call saveAs with the correct arguments", async () => { + // Assuming the function you are testing looks something like this + + await myFunction(); + + expect(saveAs).toBeCalledTimes(1); + }); +}); diff --git a/_test_/src/index.test.ts b/_test_/src/index.test.ts index d37152b..6398761 100644 --- a/_test_/src/index.test.ts +++ b/_test_/src/index.test.ts @@ -12,21 +12,41 @@ import { generateText, sideBySideLineByLine, themeBaseGenerate, + excelToJson as exTJson, + replaceInExcel as rep, } from "../../src/index"; +import { + defaultConfig, + excelToNode as mainExcelToNode, +} from "../../src/functions/excel-to-node"; import { createExcelTableBaseOnDomElement } from "../../src/functions/create-excel-data"; import { generateExcel } from "../../src/functions/generate-excel"; import { themeGenerator } from "../../src/functions/theme"; import { sideBySide } from "../../src/functions/side-by-side"; import { generateCSV } from "../../src/functions/generate-csv"; +import { replaceInExcel } from "../../src/functions/replacer"; +import { excelToJson } from "../../src/functions/excel-to-json"; +import {extractExcelData as eE} from "../../src/utils/read-utils" +jest.mock("../../src/functions/excel-to-json"); +jest.mock("../../src/utils/read-utils"); jest.mock("../../src/functions/theme.ts"); jest.mock("../../src/functions/create-excel-data.ts"); jest.mock("../../src/functions/generate-excel.ts"); jest.mock("../../src/functions/side-by-side.ts"); jest.mock("../../src/functions/generate-csv.ts"); +jest.mock("../../src/functions/replacer.ts"); +jest.mock("../../src/functions/generate-csv.ts"); +jest.mock("../../src/functions/excel-to-node"); afterEach(() => { jest.resetAllMocks(); }); describe("index function tests", () => { + test("replaceInExcel data should be passed", async () => { + try { + await rep("", {}, {}); + } catch (error) {} + expect(replaceInExcel).toBeCalledTimes(1); + }); test("generate should be exist", () => { expect(typeof generate).toBe("function"); }); @@ -56,23 +76,39 @@ describe("index function tests", () => { test("excelToNode should be exist", () => { expect(typeof excelToNode).toBe("function"); }); + test("excelToNode should be exist", async () => { + try { + await excelToNode("", "", null); + } catch (error) {} + expect(mainExcelToNode).toBeCalledTimes(1); + }); test("themeGenerator should be called", () => { try { themeBaseGenerate({ sheet: [], }); - } catch (error) { - - } + } catch (error) {} expect(themeGenerator).toBeCalledTimes(1); expect(generateExcel).toBeCalledTimes(1); }); test("extractExcelData should be exist", () => { expect(typeof extractExcelData).toBe("function"); }); + test("extractExcelData should be called",async () => { + try { + await extractExcelData(""); + } catch (error) {} + expect(eE).toBeCalledTimes(1); + }); test("generateCSV should be exist", () => { expect(typeof gCSV).toBe("function"); }); + test("excelToJson most be called",async () => { + try { + await exTJson(""); + } catch (error) {} + expect(excelToJson).toHaveBeenCalledTimes(1); + }); test("generateCSV most be called", () => { try { gCSV({ diff --git a/_test_/src/utils/call-api.ts b/_test_/src/utils/call-api.ts index 62138e3..9fdef51 100644 --- a/_test_/src/utils/call-api.ts +++ b/_test_/src/utils/call-api.ts @@ -1,5 +1,7 @@ // import axios from "axios"; +import { jest } from "@jest/globals"; import fetch from "cross-fetch"; +import { blob } from "stream/consumers"; function str2ab(str: string) { var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char var bufView = new Uint16Array(buf); @@ -13,8 +15,21 @@ export async function callApi(url: string) { return res.arrayBuffer(); }); } +export async function callApiReturnNull(url: string) { + return new Promise((resolve) => { + resolve(null); + }); +} export async function callApi2(url: string) { return await fetch(url).then((res) => { return res.arrayBuffer(); }); } +export const mockBlob=jest.fn() +export async function callApiReturnMockBlob(url: string) { + return new Promise((resolve) => { + resolve({ + blob: mockBlob, + }); + }); +} diff --git a/_test_/src/utils/drop-down-utils.test.ts b/_test_/src/utils/drop-down-utils.test.ts new file mode 100644 index 0000000..4b3f2d0 --- /dev/null +++ b/_test_/src/utils/drop-down-utils.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, test, jest, it } from "@jest/globals"; +import {generateDropDown} from '../../../src/utils/drop-down-utils' +describe("getColRowBaseOnRefString data tests", () => { + test("generateDropDown should be function", () => { + expect(typeof generateDropDown).toBe("function"); + }); + test("generateDropDown -> not array/empty arry", () => { + expect(generateDropDown([])).toBe(""); + expect(generateDropDown(1 as any)).toBe(""); + expect(generateDropDown("" as any)).toBe(""); + }); + test("generateDropDown -> arry", () => { + expect( + generateDropDown([ + { + for: ["A1", "A2", "A4"], + option: ["ice", "test", "create"], + }, + ]) + ).toBe( + '"ice,test,create"' + ); + }); +}) \ No newline at end of file diff --git a/_test_/src/utils/multi-value.test.ts b/_test_/src/utils/multi-value.test.ts index 3293116..9d53103 100644 --- a/_test_/src/utils/multi-value.test.ts +++ b/_test_/src/utils/multi-value.test.ts @@ -1,277 +1,75 @@ import { describe, expect, test } from "@jest/globals"; -import { - exportedForTesting, - generateMultiStyleValue, -} from "../../../src/utils/multi-value"; +import { generateMultiStyleByArray } from "../../../src/utils/multi-value"; // not completed -describe("splitAndMatching function tests", () => { +describe("generateMultiStyleByArray function tests", () => { test("should be function", () => { - expect(typeof exportedForTesting.splitAndMatching).toBe("function"); + expect(typeof generateMultiStyleByArray).toBe("function"); }); - test("splitAndMatching 2", () => { + test("check one item", () => { expect( - exportedForTesting.splitAndMatching( - "t", - "", - "test", - false, - [], - [], - [], - false - ) - ).toEqual({ - matchValue: ["t"], - splitValue: ["", "est"], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "t", - }); - expect( - exportedForTesting.splitAndMatching( - "t", - "", - "test", - false, - [], - [], - [], - true - ) - ).toEqual({ - matchValue: ["t"], - splitValue: ["", "es",""], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "t", - }); - expect( - exportedForTesting.splitAndMatching( - "t", - "", - "test", - false, - [], - [], - [], - true, - true - ) - ).toEqual({ - matchValue: ["t"], - splitValue: ["", "est"], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "t", - }); - expect( - exportedForTesting.splitAndMatching( - "uniq", - "", - "test", - true, - ["uniq"], - [], - [], - true, - true - ) - ).toEqual({ - matchValue: ["uniq"], - splitValue: ["", ""], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "uniq", - }); - expect( - exportedForTesting.splitAndMatching( - "uniq", - "", - "test", - true, - ["uniq"], - [], - [], - false, - true - ) - ).toEqual({ - matchValue: ["uniq"], - splitValue: ["", ""], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "uniq", - }); - expect( - exportedForTesting.splitAndMatching( - "uniq", - "", - "test", - true, - ["uniq"], - [], - [], - false, - false - ) - ).toEqual({ - matchValue: ["uniq"], - splitValue: ["", ""], - splittedText: true, - styleMatchValue: [""], - text: "test", - v: "uniq", - }); - }); -}); -describe("splitBaseOnMatch function tests", () => { - test("should be function", () => { - expect(typeof exportedForTesting.splitBaseOnMatch).toBe("function"); - }); - test("should be function", () => { - expect(exportedForTesting.splitBaseOnMatch(["t", "st"], "test")).toEqual([ - "", - "e", - "", - ]); - }); -}); -describe("generateMultiStyleValue function tests", () => { - test("should be function", () => { - expect(typeof generateMultiStyleValue).toBe("function"); - }); - test("should be function", () => { - expect( - generateMultiStyleValue( - { - reg: [ - { - reg: /t/g, - styleId: "st", - }, - ], - }, - "test data", + generateMultiStyleByArray( + [ + { + styleId: "c2", + value: "text", + }, + ], { - st: "", + c2: "style2", + def:"defaultStyle" }, - "st", - false + "def" ) - ).toBe( - 'test data' - ); - expect( - generateMultiStyleValue( - { - reg: [ - { - reg: /t/g, - styleId: "st", - }, - ], - }, - "test data", - { - st: "", - }, - "st", - true - ) - ).toBe( - 'test data' - ); - expect( - generateMultiStyleValue( - { - reg: [ - { - reg: /t/g, - styleId: "st", - }, - { - reg: /t/g, - styleId: "st", - }, - ], - }, - "test data", - { - st: "", - }, - "st", - true - ) - ).toBe( - 'test data' - ); + ).toBe('style2text'); + }); + test("check one item,no style", () => { expect( - generateMultiStyleValue( - { - reg: [ - { - reg: /t/g, - styleId: "st", - }, - { - reg: /e/g, - styleId: "st", - }, - ], - }, - "test data", + generateMultiStyleByArray( + [ + { + value: "text", + }, + ], { - st: "", + c2: "style2", + def:"defaultStyle" }, - "st", - false + "def" ) - ).toBe( - 'test data' - ); + ).toBe('defaultStyletext'); + }); + test("check multi item", () => { expect( - generateMultiStyleValue( + generateMultiStyleByArray( + [ + { + value: "text", + }, + { + value: "xx", + styleId: "c2", + }, + ], { - reg: [ - { - reg: /t/g, - styleId: "st", - }, - { - reg: /e/g, - styleId: "sq", - }, - ], + c2: "style2", + def:"defaultStyle" }, - "test data", - { - st: "", - }, - "st", - false + "def" ) ).toBe( - 'test data' + 'defaultStyletextstyle2xx' ); + }); + test("check no item", () => { expect( - generateMultiStyleValue( - { - test: "test", - }, - "test data", + generateMultiStyleByArray( + [], { - st: "", + c2: "style2", + def:"defaultStyle" }, - "st", - false + "def" ) - ).toBe( - 'test data' - ); + ).toBe(''); }); }); diff --git a/dist/FileSaver.min-D8izuR1A.cjs b/dist/FileSaver.min-3zGNM-lE.cjs similarity index 79% rename from dist/FileSaver.min-D8izuR1A.cjs rename to dist/FileSaver.min-3zGNM-lE.cjs index 92f234e..6b2d3e0 100644 --- a/dist/FileSaver.min-D8izuR1A.cjs +++ b/dist/FileSaver.min-3zGNM-lE.cjs @@ -1 +1 @@ -"use strict";const u=require("./_commonjsHelpers-DKOUU3wS.cjs");function O(f,m){for(var l=0;lr[c]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}};(function(f,m){(function(l,r){r()})(u.commonjsGlobal,function(){function l(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){p(o.response,t,i)},o.onerror=function(){console.error("could not download file")},o.send()}function c(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof u.commonjsGlobal=="object"&&u.commonjsGlobal.global===u.commonjsGlobal?u.commonjsGlobal:void 0,y=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!y?function(e,t,i){var o=a.URL||a.webkitURL,n=document.createElement("a");t=t||e.name||"download",n.download=t,n.rel="noopener",typeof e=="string"?(n.href=e,n.origin===location.origin?s(n):c(n.href)?r(e,t,i):s(n,n.target="_blank")):(n.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(n.href)},4e4),setTimeout(function(){s(n)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,i),t);else if(c(e))r(e,t,i);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){s(o)})}}:function(e,t,i,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var n=e.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||n&&g||y)&&typeof FileReader<"u"){var v=new FileReader;v.onloadend=function(){var d=v.result;d=b?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=d:location=d,o=null},v.readAsDataURL(e)}else{var j=a.URL||a.webkitURL,w=j.createObjectURL(e);o?o.location=w:location.href=w,o=null,setTimeout(function(){j.revokeObjectURL(w)},4e4)}});a.saveAs=p.saveAs=p,f.exports=p})})(E);var h=E.exports;const S=u.getDefaultExportFromCjs(h),_=O({__proto__:null,default:S},[h]);exports.FileSaver_min=_; +"use strict";const u=require("./_commonjsHelpers-DKOUU3wS.cjs");function O(f,m){for(var l=0;lr[s]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var E={exports:{}};(function(f,m){(function(l,r){r()})(u.commonjsGlobal,function(){function l(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){p(o.response,t,i)},o.onerror=function(){console.error("could not download file")},o.send()}function s(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function c(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof u.commonjsGlobal=="object"&&u.commonjsGlobal.global===u.commonjsGlobal?u.commonjsGlobal:void 0,y=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!y?function(e,t,i){var o=a.URL||a.webkitURL,n=document.createElement("a");t=t||e.name||"download",n.download=t,n.rel="noopener",typeof e=="string"?(n.href=e,n.origin===location.origin?c(n):s(n.href)?r(e,t,i):c(n,n.target="_blank")):(n.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(n.href)},4e4),setTimeout(function(){c(n)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,i),t);else if(s(e))r(e,t,i);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){c(o)})}}:function(e,t,i,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var n=e.type==="application/octet-stream",g=/constructor/i.test(a.HTMLElement)||a.safari,b=/CriOS\/[\d]+/.test(navigator.userAgent);if((b||n&&g||y)&&typeof FileReader<"u"){var v=new FileReader;v.onloadend=function(){var d=v.result;d=b?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=d:location=d,o=null},v.readAsDataURL(e)}else{var j=a.URL||a.webkitURL,w=j.createObjectURL(e);o?o.location=w:location.href=w,o=null,setTimeout(function(){j.revokeObjectURL(w)},4e4)}});a.saveAs=p.saveAs=p,f.exports=p})})(E);var h=E.exports;const S=u.getDefaultExportFromCjs(h),_=O({__proto__:null,default:S},[h]);exports.FileSaver_min=_; diff --git a/dist/FileSaver.min-Di4lMG3c.js b/dist/FileSaver.min-BEH1o5YI.js similarity index 61% rename from dist/FileSaver.min-Di4lMG3c.js rename to dist/FileSaver.min-BEH1o5YI.js index 6d5cd1d..c2af72b 100644 --- a/dist/FileSaver.min-Di4lMG3c.js +++ b/dist/FileSaver.min-BEH1o5YI.js @@ -1,22 +1,22 @@ import { g as O, c as d } from "./_commonjsHelpers-DaMA6jEr.js"; -function A(u, v) { +function A(f, v) { for (var l = 0; l < v.length; l++) { const r = v[l]; if (typeof r != "string" && !Array.isArray(r)) { - for (const c in r) - if (c !== "default" && !(c in u)) { - const s = Object.getOwnPropertyDescriptor(r, c); - s && Object.defineProperty(u, c, s.get ? s : { + for (const s in r) + if (s !== "default" && !(s in f)) { + const c = Object.getOwnPropertyDescriptor(r, s); + c && Object.defineProperty(f, s, c.get ? c : { enumerable: !0, - get: () => r[c] + get: () => r[s] }); } } } - return Object.freeze(Object.defineProperty(u, Symbol.toStringTag, { value: "Module" })); + return Object.freeze(Object.defineProperty(f, Symbol.toStringTag, { value: "Module" })); } var E = { exports: {} }; -(function(u, v) { +(function(f, v) { (function(l, r) { r(); })(d, function() { @@ -24,14 +24,14 @@ var E = { exports: {} }; return typeof t > "u" ? t = { autoBom: !1 } : typeof t != "object" && (console.warn("Deprecated: Expected third argument to be a object"), t = { autoBom: !t }), t.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type) ? new Blob(["\uFEFF", e], { type: e.type }) : e; } function r(e, t, i) { - var o = new XMLHttpRequest(); - o.open("GET", e), o.responseType = "blob", o.onload = function() { - p(o.response, t, i); - }, o.onerror = function() { + var n = new XMLHttpRequest(); + n.open("GET", e), n.responseType = "blob", n.onload = function() { + p(n.response, t, i); + }, n.onerror = function() { console.error("could not download file"); - }, o.send(); + }, n.send(); } - function c(e) { + function s(e) { var t = new XMLHttpRequest(); t.open("HEAD", e, !1); try { @@ -40,7 +40,7 @@ var E = { exports: {} }; } return 200 <= t.status && 299 >= t.status; } - function s(e) { + function c(e) { try { e.dispatchEvent(new MouseEvent("click")); } catch { @@ -50,38 +50,38 @@ var E = { exports: {} }; } var a = typeof window == "object" && window.window === window ? window : typeof self == "object" && self.self === self ? self : typeof d == "object" && d.global === d ? d : void 0, y = a.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent), p = a.saveAs || (typeof window != "object" || window !== a ? function() { } : "download" in HTMLAnchorElement.prototype && !y ? function(e, t, i) { - var o = a.URL || a.webkitURL, n = document.createElement("a"); - t = t || e.name || "download", n.download = t, n.rel = "noopener", typeof e == "string" ? (n.href = e, n.origin === location.origin ? s(n) : c(n.href) ? r(e, t, i) : s(n, n.target = "_blank")) : (n.href = o.createObjectURL(e), setTimeout(function() { - o.revokeObjectURL(n.href); + var n = a.URL || a.webkitURL, o = document.createElement("a"); + t = t || e.name || "download", o.download = t, o.rel = "noopener", typeof e == "string" ? (o.href = e, o.origin === location.origin ? c(o) : s(o.href) ? r(e, t, i) : c(o, o.target = "_blank")) : (o.href = n.createObjectURL(e), setTimeout(function() { + n.revokeObjectURL(o.href); }, 4e4), setTimeout(function() { - s(n); + c(o); }, 0)); } : "msSaveOrOpenBlob" in navigator ? function(e, t, i) { if (t = t || e.name || "download", typeof e != "string") navigator.msSaveOrOpenBlob(l(e, i), t); - else if (c(e)) r(e, t, i); + else if (s(e)) r(e, t, i); else { - var o = document.createElement("a"); - o.href = e, o.target = "_blank", setTimeout(function() { - s(o); + var n = document.createElement("a"); + n.href = e, n.target = "_blank", setTimeout(function() { + c(n); }); } - } : function(e, t, i, o) { - if (o = o || open("", "_blank"), o && (o.document.title = o.document.body.innerText = "downloading..."), typeof e == "string") return r(e, t, i); - var n = e.type === "application/octet-stream", g = /constructor/i.test(a.HTMLElement) || a.safari, b = /CriOS\/[\d]+/.test(navigator.userAgent); - if ((b || n && g || y) && typeof FileReader < "u") { + } : function(e, t, i, n) { + if (n = n || open("", "_blank"), n && (n.document.title = n.document.body.innerText = "downloading..."), typeof e == "string") return r(e, t, i); + var o = e.type === "application/octet-stream", g = /constructor/i.test(a.HTMLElement) || a.safari, b = /CriOS\/[\d]+/.test(navigator.userAgent); + if ((b || o && g || y) && typeof FileReader < "u") { var m = new FileReader(); m.onloadend = function() { - var f = m.result; - f = b ? f : f.replace(/^data:[^;]*;/, "data:attachment/file;"), o ? o.location.href = f : location = f, o = null; + var u = m.result; + u = b ? u : u.replace(/^data:[^;]*;/, "data:attachment/file;"), n ? n.location.href = u : location = u, n = null; }, m.readAsDataURL(e); } else { var j = a.URL || a.webkitURL, w = j.createObjectURL(e); - o ? o.location = w : location.href = w, o = null, setTimeout(function() { + n ? n.location = w : location.href = w, n = null, setTimeout(function() { j.revokeObjectURL(w); }, 4e4); } }); - a.saveAs = p.saveAs = p, u.exports = p; + a.saveAs = p.saveAs = p, f.exports = p; }); })(E); var h = E.exports; diff --git a/dist/FileSaver.min-Cjv31LBO.js b/dist/FileSaver.min-DXmtgrTw.js similarity index 81% rename from dist/FileSaver.min-Cjv31LBO.js rename to dist/FileSaver.min-DXmtgrTw.js index 01455d3..4d2188b 100644 --- a/dist/FileSaver.min-Cjv31LBO.js +++ b/dist/FileSaver.min-DXmtgrTw.js @@ -1 +1 @@ -System.register("ExcelTable",["./_commonjsHelpers-DOjADtSw.js"],function(_,x){"use strict";var b,l;return{setters:[p=>{b=p.g,l=p.c}],execute:function(){function p(f,m){for(var u=0;ur[c]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var j={exports:{}};(function(f,m){(function(u,r){r()})(l,function(){function u(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){v(n.response,t,i)},n.onerror=function(){console.error("could not download file")},n.send()}function c(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof l=="object"&&l.global===l?l:void 0,g=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),v=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!g?function(e,t,i){var n=a.URL||a.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin===location.origin?s(o):c(o.href)?r(e,t,i):s(o,o.target="_blank")):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){s(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(u(e,i),t);else if(c(e))r(e,t,i);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){s(n)})}}:function(e,t,i,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var o=e.type==="application/octet-stream",O=/constructor/i.test(a.HTMLElement)||a.safari,h=/CriOS\/[\d]+/.test(navigator.userAgent);if((h||o&&O||g)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var d=w.result;d=h?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},w.readAsDataURL(e)}else{var S=a.URL||a.webkitURL,y=S.createObjectURL(e);n?n.location=y:location.href=y,n=null,setTimeout(function(){S.revokeObjectURL(y)},4e4)}});a.saveAs=v.saveAs=v,f.exports=v})})(j);var E=j.exports;_("F",p({__proto__:null,default:b(E)},[E]))}}}); +System.register("ExcelTable",["./_commonjsHelpers-DOjADtSw.js"],function(_,x){"use strict";var b,l;return{setters:[p=>{b=p.g,l=p.c}],execute:function(){function p(f,m){for(var u=0;ur[s]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var j={exports:{}};(function(f,m){(function(u,r){r()})(l,function(){function u(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){v(n.response,t,i)},n.onerror=function(){console.error("could not download file")},n.send()}function s(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function c(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof l=="object"&&l.global===l?l:void 0,g=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),v=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!g?function(e,t,i){var n=a.URL||a.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin===location.origin?c(o):s(o.href)?r(e,t,i):c(o,o.target="_blank")):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){c(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(u(e,i),t);else if(s(e))r(e,t,i);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){c(n)})}}:function(e,t,i,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var o=e.type==="application/octet-stream",O=/constructor/i.test(a.HTMLElement)||a.safari,h=/CriOS\/[\d]+/.test(navigator.userAgent);if((h||o&&O||g)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var d=w.result;d=h?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},w.readAsDataURL(e)}else{var S=a.URL||a.webkitURL,y=S.createObjectURL(e);n?n.location=y:location.href=y,n=null,setTimeout(function(){S.revokeObjectURL(y)},4e4)}});a.saveAs=v.saveAs=v,f.exports=v})})(j);var E=j.exports;_("F",p({__proto__:null,default:b(E)},[E]))}}}); diff --git a/dist/FileSaver.min-xJafi45S.js b/dist/FileSaver.min-DbxQUYqv.js similarity index 52% rename from dist/FileSaver.min-xJafi45S.js rename to dist/FileSaver.min-DbxQUYqv.js index 16c67ee..08998db 100644 --- a/dist/FileSaver.min-xJafi45S.js +++ b/dist/FileSaver.min-DbxQUYqv.js @@ -1 +1 @@ -define(["exports","./_commonjsHelpers-BXTBJ82R"],function(g,l){"use strict";function S(f,v){for(var u=0;ur[c]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var y={exports:{}};(function(f,v){(function(u,r){r()})(l.commonjsGlobal,function(){function u(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){p(n.response,t,i)},n.onerror=function(){console.error("could not download file")},n.send()}function c(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function s(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof l.commonjsGlobal=="object"&&l.commonjsGlobal.global===l.commonjsGlobal?l.commonjsGlobal:void 0,j=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!j?function(e,t,i){var n=a.URL||a.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin===location.origin?s(o):c(o.href)?r(e,t,i):s(o,o.target="_blank")):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){s(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(u(e,i),t);else if(c(e))r(e,t,i);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){s(n)})}}:function(e,t,i,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var o=e.type==="application/octet-stream",A=/constructor/i.test(a.HTMLElement)||a.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||o&&A||j)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var d=m.result;d=E?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},m.readAsDataURL(e)}else{var h=a.URL||a.webkitURL,w=h.createObjectURL(e);n?n.location=w:location.href=w,n=null,setTimeout(function(){h.revokeObjectURL(w)},4e4)}});a.saveAs=p.saveAs=p,f.exports=p})})(y);var b=y.exports;const O=S({__proto__:null,default:l.getDefaultExportFromCjs(b)},[b]);g.FileSaver_min=O}); +define(["exports","./_commonjsHelpers-BXTBJ82R"],function(g,l){"use strict";function S(f,v){for(var u=0;ua[s]})}}}return Object.freeze(Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}))}var y={exports:{}};(function(f,v){(function(u,a){a()})(l.commonjsGlobal,function(){function u(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function a(e,t,i){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){p(n.response,t,i)},n.onerror=function(){console.error("could not download file")},n.send()}function s(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function c(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var r=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof l.commonjsGlobal=="object"&&l.commonjsGlobal.global===l.commonjsGlobal?l.commonjsGlobal:void 0,j=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),p=r.saveAs||(typeof window!="object"||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!j?function(e,t,i){var n=r.URL||r.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin===location.origin?c(o):s(o.href)?a(e,t,i):c(o,o.target="_blank")):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){c(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(u(e,i),t);else if(s(e))a(e,t,i);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){c(n)})}}:function(e,t,i,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return a(e,t,i);var o=e.type==="application/octet-stream",A=/constructor/i.test(r.HTMLElement)||r.safari,E=/CriOS\/[\d]+/.test(navigator.userAgent);if((E||o&&A||j)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var d=m.result;d=E?d:d.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=d:location=d,n=null},m.readAsDataURL(e)}else{var h=r.URL||r.webkitURL,w=h.createObjectURL(e);n?n.location=w:location.href=w,n=null,setTimeout(function(){h.revokeObjectURL(w)},4e4)}});r.saveAs=p.saveAs=p,f.exports=p})})(y);var b=y.exports;const O=S({__proto__:null,default:l.getDefaultExportFromCjs(b)},[b]);g.FileSaver_min=O}); diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index f773dc3..4bd985b 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-Ol2dJD1V"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); +define(["exports","./index-BRPJRQwV"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index cf0c758..ae634ad 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BGhJlXYS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-xyzS9dVO.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index bec3099..189fc7a 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -145,6 +145,7 @@ declare namespace DataModel { Styles, Data, DataOptions, + DropDown, RowMap, ProtectionOption, ProtectionOptionKey, @@ -189,7 +190,9 @@ declare namespace DataModel { ExtractedData, ExtractResult, ReadResult, - Buffer_2 as Buffer + Buffer_2 as Buffer, + ReplacerOption, + ExcelToNodeConfig } } export { DataModel } @@ -204,6 +207,11 @@ declare interface DataOptions { comment?: MapComment; } +declare interface DropDown { + option: (string | number)[]; + for: string[]; +} + declare interface ExcelTable extends ExcelTableOption { sheet: Sheet[]; } @@ -227,7 +235,9 @@ declare interface ExcelTableOption { export declare function excelToJson(uri: string, fetchFunc?: Function, withHeader?: boolean, defaultPropertyPrefix?: string): Promise>; -export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: { +export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; + +declare interface ExcelToNodeConfig { fetchFunc?: Function; firstHeader?: boolean; returnTableNodes?: boolean; @@ -239,7 +249,7 @@ export declare function excelToNode(uri: string, queryForTable?: string | null, buttonContainerStyle?: object; buttonStyle?: object; activeButtonStyle?: object; -}): Promise; +} declare const exportedForTesting: { checkSheetValidWithOneRef: typeof checkSheetValidWithOneRef; @@ -287,7 +297,7 @@ declare interface Header { label: string; text: string; size?: number; - multiStyleValue?: MultiStyleValue; + multiStyleValue?: MultiStyleValue[]; comment?: Comment_2 | string; conditionalFormatting?: ConditionalFormattingOption; formula?: { @@ -340,7 +350,7 @@ declare interface MapComment { } declare interface MapMultiStyleValue { - [key: string]: MultiStyleValue; + [key: string]: MultiStyleValue[]; } declare interface MergeRowConditionMap { @@ -352,7 +362,7 @@ declare interface MergeRowConditionMap { declare type MergeRowDataConditionFunction = (data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean) => boolean; -declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue | null; +declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; declare interface MultiStyleRexValue { reg: RegExp | string; @@ -360,8 +370,8 @@ declare interface MultiStyleRexValue { } declare interface MultiStyleValue { - [key: string]: string | undefined | MultiStyleRexValue[]; - reg?: MultiStyleRexValue[]; + value: string | number; + styleId?: string; } declare interface NoArgFormulaSetting { @@ -403,6 +413,17 @@ declare interface ReadResult { maxLengthOfColumn: Record; } +export declare function replaceInExcel(url: string | null | undefined, replaceData: Record, option?: ReplacerOption): Promise; + +declare interface ReplacerOption { + fileName?: string; + backend?: boolean; + fetch?: Function; + data?: Blob | Buffer_2; + notSave?: boolean; + generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; +} + declare type RowHeightScaleFunction = (data: number, rowIndex: number, fromHeader: boolean) => number; declare interface RowMap { @@ -454,6 +475,7 @@ declare interface SheetOption { rtl?: boolean; pageBreak?: PageBreak; asTable?: AsTableOption; + dropDowns?: DropDown[]; } declare interface SideBySide { @@ -560,7 +582,7 @@ declare interface Title { height?: number; styleId?: string; text?: string; - multiStyleValue?: MultiStyleValue; + multiStyleValue?: MultiStyleValue[]; comment?: Comment_2 | string; } diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index a24a888..c27cd9f 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1,10 +1,10 @@ -var ExcelTable=function(Rt){"use strict";function ke(h,w){for(var s=0;s_[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function Se(h){return h.replace(/ /g,"")}function Ee(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),s=h.charAt(1),_=h.charAt(2);return w+w+s+s+_+_}else return h}function or(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Ee(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Te(h){const w=or(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function Ae(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Ee(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ce(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function jt(h){h=Se(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),s=w.reduce((_,c)=>_&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!s?null:(ce(w[0])+ce(w[1])+ce(w[2])).toUpperCase()}function Ut(h,w){if(typeof h>"u"||h===null)return null;if(!w){let s=Se(h);s.indexOf("var(")==0&&s.lastIndexOf(")")==s.length-1&&(s=s.substring(4,s.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(s))}if(h.indexOf("rgb")>=0){const s=jt(h);h=s||""}return h.replace(/^#/,"")}function ir(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((s,_)=>s+_.charAt(0)+_.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Oe(h,w){let s=Object.keys(h).filter(r=>!w.includes(r)),_=[];return s.reduce((r,l)=>(r.push({label:l,text:ir(l)}),r),_)}const fe={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ar=function(h,w={...fe}){let s;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let f=[];for(let a=0;a0){const b=Oe(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);f.push({headers:b,data:u})}}s={sheet:f}}else h.length>0?s={sheet:[{headers:Oe(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:s={sheet:[]};else s={sheet:[]};else s=h;let _=w&&w.headerBackgroundColor?w.headerBackgroundColor:fe.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:fe.rowBackgroundColor,r=w&&w.negativeColor?Ae(_):w&&w.headerColor?w.headerColor:Te(_),l=w&&w.negativeColor?Ae(c):w&&w.rowColor?w.rowColor:Te(c);typeof s.styles>"u"&&(s.styles={}),s.styles.themeStyleHeader={backgroundColor:_,color:r},s.styles.themeStyleBody={backgroundColor:c,color:l};const o=s.sheet.length;for(let f=0;f=1?(b["c"+g]=r,r="",l+="*",i--):w>=2&&s==g?(b["c"+g]=r,r="",l+="+"):l+="-":v>0&&(l+="-");f.push({...b,mergeString:l}),b={},l=""}return f}function lr(h,w,s,_,c){var b;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(b=document.querySelector(h))==null?void 0:b.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let l=[],o=[],f={header:{},rows:[]},a=40;if(r){let v=!1,i=0;r.forEach((g,e)=>{var m=[].slice.call(g.children);const p=window.getComputedStyle(g,null);let x=jt(p.backgroundColor);if(!v)i=m.length,v=!0,typeof _=="function"?a=_(Number(p.height.substring(0,p.height.length-2)),e,!0):a=Number(p.height.substring(0,p.height.length-2)),m.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=jt(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=jt(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=jt(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=jt(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let B=jt(E.backgroundColor);!B&&x&&(B=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...B?{backgroundColor:B}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};f.header[e+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");l.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;o.length>=e&&(S=o[e-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;m.forEach((B,U)=>{if("c"+(U+R)in S)for(let n=0;n<=i+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(B,null);if(B.getAttribute("colspan")||B.getAttribute("rowspan")){let n=sr(B.getAttribute("colspan")*1,B.getAttribute("rowspan")*1,U,i,S,B.textContent,I,S);o.length{o.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};f.header[e+"-"+U]=j,S["c"+U]=B.textContent}),typeof _=="function"?S.height=_(Number(p.height.substring(0,p.height.length-2)),e,!1):S.height=p.height.substring(0,p.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,o.length -`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,s,_,c,r,l){let o={};return` -`+s.reduce((f,a)=>(a=a.toLowerCase(),o[a]?f:a=="svg"?(o.png=!0,o.svg=!0,f+''):a=="jpeg"||a=="jpg"?(o.jpeg=!0,o.jpg=!0,f+''):(o.curr=!0,f+'')),"")+w.reduce((f,a)=>f+'',"")+h+(l.length>0?l.reduce((f,a)=>f+'',""):"")+''+(r?'':"")+''+_.reduce((f,a)=>f+'',"")+(c.length>0?c.reduce((f,a,u)=>f+'',""):"")+''}function hr(h,w){return` -Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function he(h,w,s,_){h=h.toUpperCase();let c="";if(w.formula){let a=w,u=a.formula.indexOf("=")==0?a.formula.substring(1):a.formula,b=h.indexOf(":")>0,v=a.referenceCells?a.referenceCells:h,i=b?h.substring(0,h.indexOf(":")):h,g=i.replace(/[0-9]/g,""),e=parseInt(h.substr(g.length)),m=a.returnType?a.returnType:a.isArray||b?' t="str"':"",p="styleId"in a&&_&&typeof a.styleId=="string"&&_[a.styleId]?' s="'+_[a.styleId].index+'"':"",x=a.isArray||b?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:e,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),l=parseInt(h.substr(r.length)),o=!1,f="";if(w.noArgType){const a=w;if(a.noArgType=="NOW"||a.noArgType=="TODAY"){const u="styleId"in a&&_&&typeof a.styleId=="string"&&_[a.styleId]?' s="'+_[a.styleId].index+'"':"";c='"+a.noArgType+"()"}else{let u="NOW()";const b="styleId"in a&&_&&typeof a.styleId=="string"&&_[a.styleId]?' s="'+_[a.styleId].index+'"':"";c='"+a.noArgType.substring(4)+"("+u+")"}f='',o=!0}else if(w.referenceCell){const a=w;let u="";typeof a.value<"u"&&(u=","+a.value);let b="";a.type=="COT"&&(b="_xlfn.");const v="styleId"in a&&_&&typeof a.styleId=="string"&&_[a.styleId]?' s="'+_[a.styleId].index+'"':"";c='"+b+a.type+"("+a.referenceCell.toUpperCase()+u+")",f='',o=!0}else{const a=w;c='"+a.type+"("+a.start.toUpperCase()+":"+a.end.toUpperCase()+")"}return{column:r,row:l,cell:c,needCalcChain:o,chainCell:f}}function de(h,w,s){let _=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(_=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let l=w[h.styleId];typeof l=="string"&&(s=l)}c="comment"in h&&typeof h.comment=="string"?Ie(h.comment):[""]}else c=h?Ie(h):[""];return _&&c.unshift(r+":"),{hasAuthor:_,author:r,commentStyle:s,commentStr:c}}function Ie(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ue(h,w,s,_){let c='',r="";return w.forEach((l,o)=>{let f="";if(l.length==0){r+=` -`;return}o>0&&(f=' xml:space="preserve"',r+=` -`),c+=""+s+""+r+l+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const dr='',Jt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function re(h,w){let s={result:[],str:w},_=h.reduce((c,r)=>{let l=c.str.indexOf(r);return c.result.push(c.str.substring(0,l)),c.str=c.str.substring(l+r.length),c},s);return _.result.push(_.str),_.result}function Fe(h,w,s,_,c,r,l,o,f){if(_){let a=[],u=[],b=[];const v=r.length;c.forEach((i,g)=>{let e;try{e=i.match(h)}catch(m){if(typeof h=="string")e=i.match("\\"+h);else throw m}if(e)if(o){let m;f?m=re(e,i):m=i.split(h),a.push(...m),u.push(...e),b.push(...e.reduce((p,x)=>[...p,w],[]))}else{let m;f?m=re(e,i):m=i.split(h).reduce((p,x,S)=>S>=2?(p[1]+=h+x,p):[...p,x],[]),a.push(...m),b.push(w),u.push(h.toString())}else a.push(i);v>g&&(u.push(r[g]),b.push(l[g]))}),c=a,r=u,l=b}else{let a;try{a=s.match(h)}catch(u){if(typeof h=="string")a=s.match("\\"+h);else throw u}a?o?(r.push(...a),l.push(...a.reduce((u,b)=>[...u,w],[])),f?c=re(a,s):c=s.split(h)):(r.push(h.toString()),l.push(w),f?c=re(a,s):c=s.split(h).reduce((u,b,v)=>v>=2?(u[1]+=h+b,u):[...u,b],[])):c.push(s),_=!0}return{v:h,text:s,splittedText:_,splitValue:c,matchValue:r,styleMatchValue:l}}function pe(h,w,s,_,c){if(typeof h=="object"){let r="",l=[],o=[],f=[],a=!1;if(Object.keys(h).forEach(i=>{const g=h[i];if(i!=="reg"){let e=Fe(i,typeof g=="string"?g:"",w,a,f,l,o,!1,c);a=e.splittedText,f=e.splitValue,l=e.matchValue,o=e.styleMatchValue}}),"reg"in h&&Array.isArray(h.reg)){const i=h.reg.length;for(let g=0;g0&&(r+=""+v+''+g+""),e.length>0&&(r+=""+(s[m]?s[m]:v)+''+e+"")}return f[b].length>0?r=""+r+""+v+""+Jt(f[b])+"":r=""+r+"",r}else return""+Jt(w)+""}const ze={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},Re=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Pe=(h,w,s=!1,_)=>{let c,r=!1;return typeof _=="function"?(c=_,r=!0):c=fetch,c(h).then(l=>r?l:s?l.arrayBuffer():l.blob()).then(l=>r||s?l:new File([l],w)).catch(l=>{throw l})};function Yt(h,w){h=h.toUpperCase();let s=h.replace(/[0-9]/g,"");if(s.length==0)throw"Invalid Column";let _=parseInt(h.substring(s.length));if(isNaN(_))throw"Invalid Row";_=Math.max(0,_-1);let c=w.indexOf(s);return c<0&&(w=ee(w,Math.pow(10,s.length+1),""),c=w.indexOf(s),c<0&&(c=0)),{col:c,row:_}}let ur={},me=new Proxy(ur,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,s,_){return h[w]=s,!0}});function De(h,w,s){me[h],me[h][w]=s}function Be(h,w,s){Object.keys(s).forEach(c=>{const r=s[c];typeof r=="object"?c!="data"&&c!="headers"&&Be(h,w.length>0?w+"."+c:c,r):De(h,w.length>0?w+"."+c:c,r)})}function pr(h,w){Be(h,"",w)}function mr(h,w){let s=w,_=me[h];return Object.keys(_).forEach(r=>{const l=r.split(".");let o=s,f=_[r];for(let a=0;a0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let s=ze;h.formatMap&&typeof h.formatMap=="object"&&(s={...s,...h.formatMap});const _=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...Re];h.numberOfColumn&&h.numberOfColumn>25&&(r=ee(r,h.numberOfColumn));const o=(await Promise.resolve().then(()=>be)).default;let f=new o;const a=h.sheet.length;let u=f.folder("xl"),b=null,v=null,i=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),e=dr,m=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,p={},x={};let S=g.reduce((t,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const Y=Ut(d.color,_);typeof Y=="string"&&Y.length>0&&(T+="&K"+Y.toUpperCase())}return p[C]=T,t}if(m&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=t.conditionalFormatting.count;let T=Ut(d.color,_),K=Ut(d.backgroundColor,_);return t.conditionalFormatting.value+=' ',t.conditionalFormatting.count++,t}const y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ut(d.backgroundColor,_);y.fillIndex=t.fill.count,t.fill.count++,t.fill.value=t.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ut(d.color,_);y.fontIndex=t.font.count,t.font.count++,t.font.value=t.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",t.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),y.borderIndex=t.border.count,t.border.count++,t.border.value+=""+P+""),d.format){const T=s[d.format];T&&(y.formatIndex=T.key,"value"in T&&(t.format.count++,t.format.value+=T.value))}return t.cell.value=t.cell.value+'0?' applyBorder="1" ':"")+(y.fillIndex>0?' applyFill="1" ':"")+(y.fontIndex>=0?' applyFont="1" ':"")+(y.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=t.cell.count,t.cell.count++,t},{conditionalFormatting:{count:m?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",cr(S,m));let I='',E="",R=0,B="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],et=1;const $={checkbox:` -`};let ft=1024;const Z={checkbox:`'+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,y,c,r,f){let i={};return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i.curr=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` +Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,y){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let y=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(y=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` +`;return}i>0&&(l=' xml:space="preserve"',r+=` +`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let y="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(h.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,y){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,y=pt[h];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const y=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,b=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,y),K=Ue(d.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` +`};let he=1024;const Z={checkbox:` @@ -22,26 +22,26 @@ var ExcelTable=function(Rt){"use strict";function ke(h,w){for(var s=0;sCenter - `},it={checkbox:``},oe={checkbox:` - `};let D=[],z="",nt=!1,Q=null;for(let t=0;t=0?C.shiftTop+1:1,T="",K="",J="",Y="",rt="",gt="",pt=!1,It="",Kt="",Bt="",$t="",yt=Object.assign([],C.merges),Ft=Object.assign({},C.formula),Zt=Object.assign([],C.conditionalFormatting),zt=!1,Pt=[],qt="",Vt=[],ae=[],Gt=[],Mt=[],Lt={},Qt="",te=!1,ve="";if(C.rtl&&(rt+=' rightToLeft="1" '),C.pageBreak){const ot=C.pageBreak;if(ot.row&&Array.isArray(ot.row)){gt="pageBreakPreview";const H=ot.row.length;ve+=''+ot.row.reduce((tt,q)=>tt+'',"")+""}if(ot.column&&Array.isArray(ot.column)){gt="pageBreakPreview";const H=ot.column.length;ve+=''+ot.column.reduce((tt,q)=>tt+'',"")+""}}let Ve="";if(C.pageOption){const ot=C.pageOption;if(ot.isPortrait&&(te=!0),ot.margin){const st=ot.margin;let lt={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(lt).forEach(G=>{typeof st[G]=="number"&&(lt[G]=st[G])}),Ve=''}let H="",tt="",q="",W="";if(["header","footer"].forEach(st=>{const lt=st.charAt(0).toUpperCase()+st.substring(1);if(ot[st]){const G=ot[st];typeof G=="object"&&Object.keys(G).forEach(at=>{H.indexOf(at)<0&&(H+=at);const Ot=G[at];let xt="";if(Object.keys(Ot).reduce((dt,ht)=>(ht=="l"?dt.splice(0,0,ht):ht=="c"?dt.splice(1,0,ht):ht=="r"&&dt.splice(2,0,ht),dt),[]).forEach(dt=>{const ht=Ot[dt];xt+="&"+dt.toUpperCase(),ht.styleId&&p[ht.styleId]&&(xt+=p[ht.styleId]),ht.text&&(xt+=ht.text)}),xt="<"+at+lt+">"+xt+"",at=="odd")tt+=xt;else if(at=="even")q+=xt;else if(at=="first")W+=xt;else throw"type error"})}}),Qt=tt+q+W,Qt.length>0){te=!0;const st=H.length==7||H.length==12?' differentOddEven="1"':"",lt=H.indexOf("first")>=0?' differentFirst="1"':"";Qt=""+Qt+""}}if(C.viewOption){let ot="";const H=C.viewOption;H.type&&(gt=H.type),H.hideRuler&&(rt+=' showRuler="0" '),H.hideGrid&&(rt+=' showGridLines="0" '),H.hideHeadlines&&(rt+=' showRowColHeaders="0" ');let tt=H.splitOption;if(typeof tt>"u"&&(te=!1,typeof H.frozenOption=="object")){const q=H.frozenOption;if(ot=' state="frozen" ',q.type=="R"||q.type=="ROW"){let W;typeof q.index=="object"?W=q.index.r:W=q.index,tt={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(q.type=="C"||q.type=="COLUMN"){let W;typeof q.index=="object"?W=q.index.c:W=q.index,W>r.length-1&&(r=ee(r,W)),tt={type:"V",startAt:{r:r[W]+1},split:W}}else if(q.type=="B"||q.type=="BOTH"){let W="",ct;typeof q.index=="number"?(ct=q.index,W=r[q.index]+(q.index+1)):(ct={y:q.index.r,x:q.index.c},W=r[q.index.c]+(q.index.r+1)),tt={startAt:{two:W},type:"B",split:ct}}}if(tt)if(tt.type=="H"||tt.type=="HORIZONTAL"){let q;tt.startAt&&(q=tt.startAt.b,tt.startAt.t&&(rt+=' topLeftCell="'+tt.startAt.t+'"')),q||(q="A1"),Y='"}else if(tt.type=="V"||tt.type=="VERTICAL"){let q;tt.startAt&&(q=tt.startAt.r,tt.startAt.l&&(rt+=' topLeftCell="'+tt.startAt.l+'"')),q||(q="A1"),Y='"}else{let q;tt.startAt&&(q=tt.startAt.two,tt.startAt.one&&(rt+=' topLeftCell="'+tt.startAt.one+'"')),q||(q="A1"),Y='"}}if(te&&(gt="pageLayout"),C.checkbox){pt=!0;const ot=$.checkbox;C.checkbox.forEach((H,tt)=>{let q=ot;if(H.link){let at=Yt(H.link,r);q=q.replace("**fmlaLink**",'fmlaLink="$'+r[at.col]+"$"+(at.row+1)+'"')}else q=q.replace("**fmlaLink**","");H.mixed?q=q.replace("**value**",'checked="Mixed"'):H.checked?q=q.replace("**value**",'checked="Checked"'):q=q.replace("**value**",""),H.threeD&&q.replace('noThreeD="1"',""),D.push(q),ft++;let W=t+""+ft++;const ct="_x0000_s"+W;Kt+=Z.checkbox.replace("***id***",ct).replace("***text***",H.text);let st=H.startStr,lt=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof st=="string"&&st.length>=2){let at=Yt(st,r);G.start={...at},G.end={col:at.col+1,row:at.row+1}}if(typeof lt=="string"&<.length>=2){let at=Yt(lt,r);at.row+=1,at.col+=1,G.end={...at}}$t+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",Bt+='',It+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let xe;if(C.backgroundImage){b==null&&(b=u==null?void 0:u.folder("media"));const ot=C.backgroundImage;xe=new Promise(async(H,tt)=>{let q=ot.lastIndexOf("."),W;q>0?(W=ot.substring(q+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const ct=et++,st="image"+ct+"."+W,lt=await Pe(ot,st,_,h.fetch);lt||tt("image not load"),M.push(W),H({name:st,type:W,image:lt,ref:ct})})}let we;if(C.images&&(b==null&&(b=u==null?void 0:u.folder("media")),we=Promise.all([...C.images.map(async(ot,H)=>{let tt=ot.url.lastIndexOf("."),q;tt>0?(q=ot.url.substring(tt+1).toLowerCase(),q.length>4&&(q.indexOf("gif")>=0?q="gif":q.indexOf("jpg")>=0?q="jpg":q.indexOf("jpeg")>=0?q="jpeg":q="png")):q="png",M.push(q);const W="image"+et+++"."+q;return{type:q,image:await Pe(ot.url,W,_,h.fetch),obj:ot,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ot=C.headers.length;let H="";if(C.title){const W=C.title,ct=W.comment,st=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,lt=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+lt>=0?W.shiftLeft+lt:lt,at=W.consommeRow?W.consommeRow-1:1,Ot=W.consommeCol?W.consommeCol:ot,xt=at==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",dt=W.styleId?W.styleId:"titleStyle",ht=r[G]+""+(P+st);if(yt.push(ht+":"+r[G+Ot-1]+(P+at+st)),typeof ct<"u"){zt=!0;const kt=de(ct,S.commentSyntax.value,e);let Nt=Pt.length;if(kt.hasAuthor&&typeof kt.author<"u"){let Ct=kt.author.toString();const Et=Pt.indexOf(Ct);Et<0?Pt.push(Ct):Nt=Et}Vt.push({row:P+st-1,col:G}),qt+=ue(ht,kt.commentStr,kt.commentStyle,Nt)}typeof W.text=="string"&&(d[P+st]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue?E+=pe(W.multiStyleValue,W.text,S.commentSyntax.value,dt,C.useSplitBaseOnMatch):E+=""+Jt(W.text)+""),P+=st+at+1}let tt=C.headerStyleKey?C.headerStyleKey:null,q=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(q=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),y.start=r[q]+""+P,y.end=r[q+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,ct)=>{if(O&&(N+=''),q&&(ct+=q),W.formula&&Gt.push(ct),W.conditionalFormatting&&Mt.push(ct),ae.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,ct,!0)===!0&&(Lt[r[ct]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(tt=C.styleCellCondition(W,W,P,ct,!0,g)||tt),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const st=r[ct]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,ct,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){zt=!0;const G=de(W.comment,S.commentSyntax.value,e);let at=Pt.length;if(G.hasAuthor&&typeof G.author<"u"){let Ot=G.author.toString();const xt=Pt.indexOf(Ot);xt<0?Pt.push(Ot):at=xt}Vt.push({row:P-1,col:ct}),qt+=ue(st,G.commentStr,G.commentStyle,at)}const lt=Ft&&Ft[st];if(lt){const G=he(st,lt,A,h.styles);G.needCalcChain&&(nt=!0,z+=G.chainCell),T+=G.cell,delete Ft[st]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,ct,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue?E+=pe(W.multiStyleValue,W.text,S.commentSyntax.value,tt||"",C.useSplitBaseOnMatch):E+=""+Jt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='ct+" "+st+'="'+C.headerRowOption[st]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",ct=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",st=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",lt=C.data.length;C.data.forEach((G,at)=>{if(G.mergeType)for(let ht=0;ht`};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ye="",Ve=[],at=[],Ge=[],Me=[],Le={},Je="",Qe=!1,vt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;vt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;vt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(Qe=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Oe=G[ae];let xe="";if(Object.keys(Oe).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Oe[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Je=ee+Y+W,Je.length>0){Qe=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Je=""+Je+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(Qe=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=et(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(Qe&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=qe(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=qe(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=qe(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let xt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;xt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,h.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let wt;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),wt=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,h.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Oe=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Oe-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=dt(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Ee=Pe.indexOf(ke);Ee<0?Pe.push(ke):Ne=Ee}Ve.push({row:P+se-1,col:G}),Ye+=ut(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(d[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+tt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Ge.push(fe),W.conditionalFormatting&&Me.push(fe),at.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=dt(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Oe=G.author.toString();const xe=Pe.indexOf(Oe);xe<0?Pe.push(Oe):ae=xe}Ve.push({row:P-1,col:fe}),Ye+=ut(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+tt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),y.borderIndex=t.border.count,t.border.count++,t.border.value+=""+P+""),d.format){const T=s[d.format];T&&(y.formatIndex=T.key,"value"in T&&(t.format.count++,t.format.value+=T.value))}return t.cell.value=t.cell.value+'0?' applyBorder="1" ':"")+(y.fillIndex>0?' applyFill="1" ':"")+(y.fontIndex>=0?' applyFont="1" ':"")+(y.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=t.cell.count,t.cell.count++,t},{conditionalFormatting:{count:m?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",cr(S,m));let I='',E="",R=0,B="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],et=1;const $={checkbox:` -`};let ft=1024;const Z={checkbox:`'+d.format.value+"":"")+''+d.font.value+''+d.fill.value+''+d.border.value+''+d.cell.value+' '+(w?''+d.conditionalFormatting.value+"":'')+""}function fr(d,w,o,y,c,r,f){let i={};return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i.curr=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+d+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(d,w){return` +Microsoft Excel0falseWorksheets`+d+' '+w+"falsefalsefalse16.0300"}function ht(d,w,o,y){d=d.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=d.indexOf(":")>0,v=s.referenceCells?s.referenceCells:d,a=_?d.substring(0,d.indexOf(":")):d,g=a.replace(/[0-9]/g,""),t=parseInt(d.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=d.replace(/[0-9]/g,""),f=parseInt(d.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function ut(d,w,o){let y=!1,c,r;if(typeof d=="object"){if("author"in d&&d.author&&(y=!0,r=d.author),"styleId"in d&&typeof d.styleId=="string"){let f=w[d.styleId];typeof f=="string"&&(o=f)}c="comment"in d&&typeof d.comment=="string"?It(d.comment):[""]}else c=d?It(d):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(d){var w=d.split(/\r?\n|\r|\n/g);return w}function mt(d,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` +`;return}i>0&&(l=' xml:space="preserve"',r+=` +`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const dr='',rt=function(d){return d.replace(/\&/g,"&").replace(/\/g,">")};function pt(d,w,o){let y="";return d.forEach(c=>{typeof c.value=="string"&&(c.value=rt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(d,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(d).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function Ye(d,w){d=d.toUpperCase();let o=d.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(d.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=tt(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let hr={},gt=new Proxy(hr,{get(d,w){return w in d?d[w]:(this.set(d,w,{},!0),{})},set(d,w,o,y){return d[w]=o,!0}});function Pt(d,w,o){gt[d],gt[d][w]=o}function Bt(d,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(d,w.length>0?w+"."+c:c,r):Pt(d,w.length>0?w+"."+c:c,r)})}function ur(d,w){Bt(d,"",w)}function mr(d,w){let o=w,y=gt[d];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function nt(d,w=""){if(typeof w=="string"&&w.length>0&&(d=mr(w,d)),typeof d.creator=="string"&&d.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof d.created=="string"&&new Date(d.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof d.modified=="string"&&new Date(d.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;d.formatMap&&typeof d.formatMap=="object"&&(o={...o,...d.formatMap});const y=d.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];d.numberOfColumn&&d.numberOfColumn>25&&(r=tt(r,d.numberOfColumn));const i=(await Promise.resolve().then(()=>at)).default;let l=new i;d.sheet||(d.sheet=[{headers:[],data:[]}]);const s=d.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;d.styles||(d.styles={}),d.addDefaultTitleStyle&&(d.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(d.styles),t=dr,b=d.activateConditionalFormatting?d.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const h=d.styles[C];if(h.type&&(h.type=="headerFooter"||h.type=="HF")){let T="",K="-",J="Regular";if(h.fontFamily&&(K=h.fontFamily),h.bold&&(J="Bold"),h.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),h.size&&(T+="&"+h.size),h.doubleUnderline?T+="&E":h.underline&&(T+="&U"),h.color){const q=Ue(h.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof h.type=="string"&&h.type&&(h.type=="conditionalFormatting"||h.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(h.color,y),K=Ue(h.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(h.backgroundColor){let T=Ue(h.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(h.color||h.fontFamily||h.size||h.bold||h.italic||h.underline||h.doubleUnderline){const T=Ue(h.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(h.bold?"":"")+(h.italic?"":"")+(h.underline||h.doubleUnderline?"":"")+(h.size?'':"")+(T?'':"")+(h.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(h.bold?"":"")+(h.italic?"":"")+(h.underline||h.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";h.alignment&&(h.alignment.rtl&&(h.alignment.readingOrder=2),delete h.alignment.rtl,h.alignment.ltr&&(h.alignment.readingOrder=1),delete h.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+h.alignment[K]+'" ',"")+" />");const N=h.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),h.format){const T=o[h.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,d.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` +`};let de=1024;const Z={checkbox:` @@ -22,26 +22,26 @@ Center - `},it={checkbox:``},oe={checkbox:` - `};let D=[],z="",nt=!1,Q=null;for(let t=0;t=0?C.shiftTop+1:1,T="",K="",J="",Y="",rt="",gt="",pt=!1,Ft="",Kt="",Bt="",$t="",yt=Object.assign([],C.merges),zt=Object.assign({},C.formula),Zt=Object.assign([],C.conditionalFormatting),Rt=!1,Pt=[],Vt="",Gt=[],se=[],Xt=[],Mt=[],Lt={},te="",ee=!1,xe="";if(C.rtl&&(rt+=' rightToLeft="1" '),C.pageBreak){const ot=C.pageBreak;if(ot.row&&Array.isArray(ot.row)){gt="pageBreakPreview";const H=ot.row.length;xe+=''+ot.row.reduce((tt,q)=>tt+'',"")+""}if(ot.column&&Array.isArray(ot.column)){gt="pageBreakPreview";const H=ot.column.length;xe+=''+ot.column.reduce((tt,q)=>tt+'',"")+""}}let Ve="";if(C.pageOption){const ot=C.pageOption;if(ot.isPortrait&&(ee=!0),ot.margin){const st=ot.margin;let lt={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(lt).forEach(G=>{typeof st[G]=="number"&&(lt[G]=st[G])}),Ve=''}let H="",tt="",q="",W="";if(["header","footer"].forEach(st=>{const lt=st.charAt(0).toUpperCase()+st.substring(1);if(ot[st]){const G=ot[st];typeof G=="object"&&Object.keys(G).forEach(at=>{H.indexOf(at)<0&&(H+=at);const It=G[at];let xt="";if(Object.keys(It).reduce((dt,ht)=>(ht=="l"?dt.splice(0,0,ht):ht=="c"?dt.splice(1,0,ht):ht=="r"&&dt.splice(2,0,ht),dt),[]).forEach(dt=>{const ht=It[dt];xt+="&"+dt.toUpperCase(),ht.styleId&&p[ht.styleId]&&(xt+=p[ht.styleId]),ht.text&&(xt+=ht.text)}),xt="<"+at+lt+">"+xt+"",at=="odd")tt+=xt;else if(at=="even")q+=xt;else if(at=="first")W+=xt;else throw"type error"})}}),te=tt+q+W,te.length>0){ee=!0;const st=H.length==7||H.length==12?' differentOddEven="1"':"",lt=H.indexOf("first")>=0?' differentFirst="1"':"";te=""+te+""}}if(C.viewOption){let ot="";const H=C.viewOption;H.type&&(gt=H.type),H.hideRuler&&(rt+=' showRuler="0" '),H.hideGrid&&(rt+=' showGridLines="0" '),H.hideHeadlines&&(rt+=' showRowColHeaders="0" ');let tt=H.splitOption;if(typeof tt>"u"&&(ee=!1,typeof H.frozenOption=="object")){const q=H.frozenOption;if(ot=' state="frozen" ',q.type=="R"||q.type=="ROW"){let W;typeof q.index=="object"?W=q.index.r:W=q.index,tt={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(q.type=="C"||q.type=="COLUMN"){let W;typeof q.index=="object"?W=q.index.c:W=q.index,W>r.length-1&&(r=re(r,W)),tt={type:"V",startAt:{r:r[W]+1},split:W}}else if(q.type=="B"||q.type=="BOTH"){let W="",ct;typeof q.index=="number"?(ct=q.index,W=r[q.index]+(q.index+1)):(ct={y:q.index.r,x:q.index.c},W=r[q.index.c]+(q.index.r+1)),tt={startAt:{two:W},type:"B",split:ct}}}if(tt)if(tt.type=="H"||tt.type=="HORIZONTAL"){let q;tt.startAt&&(q=tt.startAt.b,tt.startAt.t&&(rt+=' topLeftCell="'+tt.startAt.t+'"')),q||(q="A1"),Y='"}else if(tt.type=="V"||tt.type=="VERTICAL"){let q;tt.startAt&&(q=tt.startAt.r,tt.startAt.l&&(rt+=' topLeftCell="'+tt.startAt.l+'"')),q||(q="A1"),Y='"}else{let q;tt.startAt&&(q=tt.startAt.two,tt.startAt.one&&(rt+=' topLeftCell="'+tt.startAt.one+'"')),q||(q="A1"),Y='"}}if(ee&&(gt="pageLayout"),C.checkbox){pt=!0;const ot=$.checkbox;C.checkbox.forEach((H,tt)=>{let q=ot;if(H.link){let at=qt(H.link,r);q=q.replace("**fmlaLink**",'fmlaLink="$'+r[at.col]+"$"+(at.row+1)+'"')}else q=q.replace("**fmlaLink**","");H.mixed?q=q.replace("**value**",'checked="Mixed"'):H.checked?q=q.replace("**value**",'checked="Checked"'):q=q.replace("**value**",""),H.threeD&&q.replace('noThreeD="1"',""),D.push(q),ft++;let W=t+""+ft++;const ct="_x0000_s"+W;Kt+=Z.checkbox.replace("***id***",ct).replace("***text***",H.text);let st=H.startStr,lt=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof st=="string"&&st.length>=2){let at=qt(st,r);G.start={...at},G.end={col:at.col+1,row:at.row+1}}if(typeof lt=="string"&<.length>=2){let at=qt(lt,r);at.row+=1,at.col+=1,G.end={...at}}$t+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",Bt+='',Ft+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let we;if(C.backgroundImage){b==null&&(b=u==null?void 0:u.folder("media"));const ot=C.backgroundImage;we=new Promise(async(H,tt)=>{let q=ot.lastIndexOf("."),W;q>0?(W=ot.substring(q+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const ct=et++,st="image"+ct+"."+W,lt=await Pe(ot,st,_,h.fetch);lt||tt("image not load"),M.push(W),H({name:st,type:W,image:lt,ref:ct})})}let Ce;if(C.images&&(b==null&&(b=u==null?void 0:u.folder("media")),Ce=Promise.all([...C.images.map(async(ot,H)=>{let tt=ot.url.lastIndexOf("."),q;tt>0?(q=ot.url.substring(tt+1).toLowerCase(),q.length>4&&(q.indexOf("gif")>=0?q="gif":q.indexOf("jpg")>=0?q="jpg":q.indexOf("jpeg")>=0?q="jpeg":q="png")):q="png",M.push(q);const W="image"+et+++"."+q;return{type:q,image:await Pe(ot.url,W,_,h.fetch),obj:ot,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ot=C.headers.length;let H="";if(C.title){const W=C.title,ct=W.comment,st=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,lt=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+lt>=0?W.shiftLeft+lt:lt,at=W.consommeRow?W.consommeRow-1:1,It=W.consommeCol?W.consommeCol:ot,xt=at==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",dt=W.styleId?W.styleId:"titleStyle",ht=r[G]+""+(P+st);if(yt.push(ht+":"+r[G+It-1]+(P+at+st)),typeof ct<"u"){Rt=!0;const kt=ue(ct,S.commentSyntax.value,e);let Nt=Pt.length;if(kt.hasAuthor&&typeof kt.author<"u"){let Ct=kt.author.toString();const Tt=Pt.indexOf(Ct);Tt<0?Pt.push(Ct):Nt=Tt}Gt.push({row:P+st-1,col:G}),Vt+=pe(ht,kt.commentStr,kt.commentStyle,Nt)}typeof W.text=="string"&&(d[P+st]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue?E+=me(W.multiStyleValue,W.text,S.commentSyntax.value,dt,C.useSplitBaseOnMatch):E+=""+Qt(W.text)+""),P+=st+at+1}let tt=C.headerStyleKey?C.headerStyleKey:null,q=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(q=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),y.start=r[q]+""+P,y.end=r[q+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,ct)=>{if(O&&(N+=''),q&&(ct+=q),W.formula&&Xt.push(ct),W.conditionalFormatting&&Mt.push(ct),se.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,ct,!0)===!0&&(Lt[r[ct]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(tt=C.styleCellCondition(W,W,P,ct,!0,g)||tt),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const st=r[ct]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,ct,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Rt=!0;const G=ue(W.comment,S.commentSyntax.value,e);let at=Pt.length;if(G.hasAuthor&&typeof G.author<"u"){let It=G.author.toString();const xt=Pt.indexOf(It);xt<0?Pt.push(It):at=xt}Gt.push({row:P-1,col:ct}),Vt+=pe(st,G.commentStr,G.commentStyle,at)}const lt=zt&&zt[st];if(lt){const G=de(st,lt,A,h.styles);G.needCalcChain&&(nt=!0,z+=G.chainCell),T+=G.cell,delete zt[st]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,ct,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue?E+=me(W.multiStyleValue,W.text,S.commentSyntax.value,tt||"",C.useSplitBaseOnMatch):E+=""+Qt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='ct+" "+st+'="'+C.headerRowOption[st]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",ct=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",st=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",lt=C.data.length;C.data.forEach((G,at)=>{if(G.mergeType)for(let ht=0;ht`};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ve="",Ge=[],st=[],Xe=[],Me=[],Le={},Qe="",et=!1,xt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;xt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;xt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(et=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Ie=G[ae];let xe="";if(Object.keys(Ie).reduce((he,ce)=>(ce=="l"?he.splice(0,0,ce):ce=="c"?he.splice(1,0,ce):ce=="r"&&he.splice(2,0,ce),he),[]).forEach(he=>{const ce=Ie[he];xe+="&"+he.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Qe=ee+Y+W,Qe.length>0){et=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Qe=""+Qe+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(et=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=tt(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(et&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=Ye(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),de++;let W=e+""+de++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=Ye(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=Ye(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let wt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;wt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,d.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let Ct;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),Ct=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,d.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Ie=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",he=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Ie-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=ut(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Te=Pe.indexOf(ke);Te<0?Pe.push(ke):Ne=Te}Ge.push({row:P+se-1,col:G}),Ve+=mt(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(h[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,he):E+=""+rt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Xe.push(fe),W.conditionalFormatting&&Me.push(fe),st.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=ut(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Ie=G.author.toString();const xe=Pe.indexOf(Ie);xe<0?Pe.push(Ie):ae=xe}Ge.push({row:P-1,col:fe}),Ve+=mt(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,d.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+rt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";h[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const N=x.border;let O="";if(typeof N=="object"&&((N.left||N.full)&&(O+=''),(N.right||N.full)&&(O+=''),(N.top||N.full)&&(O+=''),(N.bottom||N.full)&&(O+=''),U.borderIndex=E.border.count,E.border.count++,E.border.value+=""+O+""),x.format){const w=l[x.format];w&&(U.formatIndex=w.key,"value"in w&&(E.format.count++,E.format.value+=w.value))}return E.cell.value=E.cell.value+'0?' applyBorder="1" ':"")+(U.fillIndex>0?' applyFill="1" ':"")+(U.fontIndex>=0?' applyFont="1" ':"")+(U.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[i].index=E.cell.count,E.cell.count++,E},{conditionalFormatting:{count:D?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});m==null||m.file("styles.xml",Jt(B,D));let oe='',j="",$=0,Z="",q="",H={};const k={};let K="",z=4,G=!1,Y=-1,Ce=[],J=1;const ye={checkbox:` -`};let ve=1024;const we={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Se={checkbox:` - - - - `};let ae=[],ie="",ge=!1,de=null;for(let E=0;E=0?i.shiftTop+1:1,w="",X="",ce="",Te="",Ee="",Ie="",We=!1,pt="",ht="",ut="",yt="",xe=Object.assign([],i.merges),ue=Object.assign({},i.formula),Ge=Object.assign([],i.conditionalFormatting),Pe=!1,pe=[],He="",Ne=[],gt=[],Xe=[],Ze=[],ke={},Re="",je=!1,Je="";if(i.rtl&&(Ee+=' rightToLeft="1" '),i.pageBreak){const S=i.pageBreak;if(S.row&&Array.isArray(S.row)){Ie="pageBreakPreview";const s=S.row.length;Je+=''+S.row.reduce((g,d)=>g+'',"")+""}if(S.column&&Array.isArray(S.column)){Ie="pageBreakPreview";const s=S.column.length;Je+=''+S.column.reduce((g,d)=>g+'',"")+""}}let xt="";if(i.pageOption){const S=i.pageOption;if(S.isPortrait&&(je=!0),S.margin){const _=S.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof _[h]=="number"&&(A[h]=_[h])}),xt=''}let s="",g="",d="",f="";if(["header","footer"].forEach(_=>{const A=_.charAt(0).toUpperCase()+_.substring(1);if(S[_]){const h=S[_];typeof h=="object"&&Object.keys(h).forEach(F=>{s.indexOf(F)<0&&(s+=F);const le=h[F];let W="";if(Object.keys(le).reduce((L,R)=>(R=="l"?L.splice(0,0,R):R=="c"?L.splice(1,0,R):R=="r"&&L.splice(2,0,R),L),[]).forEach(L=>{const R=le[L];W+="&"+L.toUpperCase(),R.styleId&&M[R.styleId]&&(W+=M[R.styleId]),R.text&&(W+=R.text)}),W="<"+F+A+">"+W+"",F=="odd")g+=W;else if(F=="even")d+=W;else if(F=="first")f+=W;else throw"type error"})}}),Re=g+d+f,Re.length>0){je=!0;const _=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";Re=""+Re+""}}if(i.viewOption){let S="";const s=i.viewOption;s.type&&(Ie=s.type),s.hideRuler&&(Ee+=' showRuler="0" '),s.hideGrid&&(Ee+=' showGridLines="0" '),s.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let g=s.splitOption;if(typeof g>"u"&&(je=!1,typeof s.frozenOption=="object")){const d=s.frozenOption;if(S=' state="frozen" ',d.type=="R"||d.type=="ROW"){let f;typeof d.index=="object"?f=d.index.r:f=d.index,g={startAt:{b:"A"+(f+1)},type:"H",split:f}}else if(d.type=="C"||d.type=="COLUMN"){let f;typeof d.index=="object"?f=d.index.c:f=d.index,f>n.length-1&&(n=Me(n,f)),g={type:"V",startAt:{r:n[f]+1},split:f}}else if(d.type=="B"||d.type=="BOTH"){let f="",I;typeof d.index=="number"?(I=d.index,f=n[d.index]+(d.index+1)):(I={y:d.index.r,x:d.index.c},f=n[d.index.c]+(d.index.r+1)),g={startAt:{two:f},type:"B",split:I}}}if(g)if(g.type=="H"||g.type=="HORIZONTAL"){let d;g.startAt&&(d=g.startAt.b,g.startAt.t&&(Ee+=' topLeftCell="'+g.startAt.t+'"')),d||(d="A1"),Te='"}else if(g.type=="V"||g.type=="VERTICAL"){let d;g.startAt&&(d=g.startAt.r,g.startAt.l&&(Ee+=' topLeftCell="'+g.startAt.l+'"')),d||(d="A1"),Te='"}else{let d;g.startAt&&(d=g.startAt.two,g.startAt.one&&(Ee+=' topLeftCell="'+g.startAt.one+'"')),d||(d="A1"),Te='"}}if(je&&(Ie="pageLayout"),i.checkbox){We=!0;const S=ye.checkbox;i.checkbox.forEach((s,g)=>{let d=S;if(s.link){let F=Ae(s.link,n);d=d.replace("**fmlaLink**",'fmlaLink="$'+n[F.col]+"$"+(F.row+1)+'"')}else d=d.replace("**fmlaLink**","");s.mixed?d=d.replace("**value**",'checked="Mixed"'):s.checked?d=d.replace("**value**",'checked="Checked"'):d=d.replace("**value**",""),s.threeD&&d.replace('noThreeD="1"',""),ae.push(d),ve++;let f=E+""+ve++;const I="_x0000_s"+f;ht+=we.checkbox.replace("***id***",I).replace("***text***",s.text);let _=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof _=="string"&&_.length>=2){let F=Ae(_,n);h.start={...F},h.end={col:F.col+1,row:F.row+1}}if(typeof A=="string"&&A.length>=2){let F=Ae(A,n);F.row+=1,F.col+=1,h.end={...F}}yt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ut+='',pt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let Qe;if(i.backgroundImage){b==null&&(b=m==null?void 0:m.folder("media"));const S=i.backgroundImage;Qe=new Promise(async(s,g)=>{let d=S.lastIndexOf("."),f;d>0?(f=S.substring(d+1).toLowerCase(),f.length>4&&(f.indexOf("gif")>=0?f="gif":f.indexOf("jpg")>=0?f="jpg":f.indexOf("jpeg")>=0?f="jpeg":f="png")):f="png";const I=J++,_="image"+I+"."+f,A=await Pt(S,_,o,e.fetch);A||g("image not load"),Ce.push(f),s({name:_,type:f,image:A,ref:I})})}let et;if(i.images&&(b==null&&(b=m==null?void 0:m.folder("media")),et=Promise.all([...i.images.map(async(S,s)=>{let g=S.url.lastIndexOf("."),d;g>0?(d=S.url.substring(g+1).toLowerCase(),d.length>4&&(d.indexOf("gif")>=0?d="gif":d.indexOf("jpg")>=0?d="jpg":d.indexOf("jpeg")>=0?d="jpeg":d="png")):d="png",Ce.push(d);const f="image"+J+++"."+d;return{type:d,image:await Pt(S.url,f,o,e.fetch),obj:S,i:s,name:f}})])),Array.isArray(i.headers)&&i.headers.length){const S=i.headers.length;let s="";if(i.title){const f=i.title,I=f.comment,_=f.shiftTop&&f.shiftTop>=0?f.shiftTop:0,A=i.shiftLeft&&i.shiftLeft>=0?i.shiftLeft:0,h=f.shiftLeft&&f.shiftLeft+A>=0?f.shiftLeft+A:A,F=f.consommeRow?f.consommeRow-1:1,le=f.consommeCol?f.consommeCol:S,W=F==0&&typeof f.height=="number"?' ht="'+f.height+'" customHeight="1" ':"",L=f.styleId?f.styleId:"titleStyle",R=n[h]+""+(O+_);if(xe.push(R+":"+n[h+le-1]+(O+F+_)),typeof I<"u"){Pe=!0;const ee=lt(I,B.commentSyntax.value,c);let fe=pe.length;if(ee.hasAuthor&&typeof ee.author<"u"){let Q=ee.author.toString();const re=pe.indexOf(Q);re<0?pe.push(Q):fe=re}Ne.push({row:O+_-1,col:h}),He+=at(R,ee.commentStr,ee.commentStyle,fe)}typeof f.text=="string"&&(x[O+_]={startTag:'',details:''+$+"",endTag:""},s+='',s+=''+$+"",s+="",$++,H[f.text]=f.text,f.multiStyleValue?j+=it(f.multiStyleValue,f.text,B.commentSyntax.value,L,i.useSplitBaseOnMatch):j+=""+Le(f.text)+""),O+=_+F+1}let g=i.headerStyleKey?i.headerStyleKey:null,d=0;if(typeof i.shiftLeft=="number"&&i.shiftLeft>=0&&(d=i.shiftLeft),se&&(N+='',de||(de=m==null?void 0:m.folder("tables"))),U.start=n[d]+""+O,U.end=n[d+i.headers.length-1]+""+(O+i.data.length),i.headers.forEach((f,I)=>{if(se&&(N+=''),d&&(I+=d),f.formula&&Xe.push(I),f.conditionalFormatting&&Ze.push(I),gt.push(f.label),i.mergeRowDataCondition&&typeof i.mergeRowDataCondition=="function"&&i.mergeRowDataCondition(f,null,I,!0)===!0&&(ke[n[I]]={inProgress:!0,start:O}),i.styleCellCondition&&typeof i.styleCellCondition=="function"&&(g=i.styleCellCondition(f,f,O,I,!0,v)||g),f.size&&f.size>0&&(X+=''),i.withoutHeader)return;const _=n[I]+""+O;if(typeof i.commentCondition=="function"){const h=i.commentCondition(f,null,f.label,O,I,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(f.comment=h)}if(f.comment){Pe=!0;const h=lt(f.comment,B.commentSyntax.value,c);let F=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const W=pe.indexOf(le);W<0?pe.push(le):F=W}Ne.push({row:O-1,col:I}),He+=at(_,h.commentStr,h.commentStyle,F)}const A=ue&&ue[_];if(A){const h=nt(_,A,C,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),w+=h.cell,delete ue[_]}else{if(w+=''+$+"",typeof i.multiStyleCondition=="function"){const h=i.multiStyleCondition(f,null,f.label,O,I,!0);h&&(f.multiStyleValue=h)}f.multiStyleValue?j+=it(f.multiStyleValue,f.text,B.commentSyntax.value,g||"",i.useSplitBaseOnMatch):j+=""+Le(f.text)+"",H[f.text]=f.text,$++}}),se&&(N+=""),i.withoutHeader)w+=s;else{const f='I+" "+_+'="'+i.headerRowOption[_]+'" '," "):"")+">";x[O]={startTag:f,endTag:"",details:w},w=s+f+w+"",O++}if(Array.isArray(i.data)){const f=i.mapSheetDataOption&&i.mapSheetDataOption.outlineLevel?i.mapSheetDataOption.outlineLevel:"outlineLevel",I=i.mapSheetDataOption&&i.mapSheetDataOption.hidden?i.mapSheetDataOption.hidden:"hidden",_=i.mapSheetDataOption&&i.mapSheetDataOption.height?i.mapSheetDataOption.height:"height",A=i.data.length;i.data.forEach((h,F)=>{if(h.mergeType)for(let R=0;R
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` +`};let Te=1024;const Ee={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},Oe={checkbox:` + + + + `};let ie=[],se="",be=!1,he=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",me="",Se="",ke="",je="",nt=!1,It="",Pt="",jt="",Rt="",Ce=Object.assign([],a.merges),ye=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,ue=[],Me="",Ye=[],Dt=[],at=[],it=[],Fe={},De="",Le=!1,st="";if(a.rtl&&(ke+=' rightToLeft="1" '),a.pageBreak){const E=a.pageBreak;if(E.row&&Array.isArray(E.row)){je="pageBreakPreview";const s=E.row.length;st+=''+E.row.reduce((y,p)=>y+'',"")+""}if(E.column&&Array.isArray(E.column)){je="pageBreakPreview";const s=E.column.length;st+=''+E.column.reduce((y,p)=>y+'',"")+""}}let Lt="";if(a.pageOption){const E=a.pageOption;if(E.isPortrait&&(Le=!0),E.margin){const F=E.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Lt=''}let s="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(E[F]){const h=E[F];typeof h=="object"&&Object.keys(h).forEach(O=>{s.indexOf(O)<0&&(s+=O);const le=h[O];let q="";if(Object.keys(le).reduce((D,I)=>(I=="l"?D.splice(0,0,I):I=="c"?D.splice(1,0,I):I=="r"&&D.splice(2,0,I),D),[]).forEach(D=>{const I=le[D];q+="&"+D.toUpperCase(),I.styleId&&z[I.styleId]&&(q+=z[I.styleId]),I.text&&(q+=I.text)}),q="<"+O+A+">"+q+"",O=="odd")y+=q;else if(O=="even")p+=q;else if(O=="first")c+=q;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let E="";const s=a.viewOption;s.type&&(je=s.type),s.hideRuler&&(ke+=' showRuler="0" '),s.hideGrid&&(ke+=' showGridLines="0" '),s.hideHeadlines&&(ke+=' showRowColHeaders="0" ');let y=s.splitOption;if(typeof y>"u"&&(Le=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(E=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(ke+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Se='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(ke+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Se='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(ke+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Se='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const E=xe.checkbox;a.checkbox.forEach((s,y)=>{let p=E;if(s.link){let O=Ae(s.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),Te++;let c=w+""+Te++;const _="_x0000_s"+c;Pt+=Ee.checkbox.replace("***id***",_).replace("***text***",s.text);let F=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof F=="string"&&F.length>=2){let O=Ae(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Ae(A,l);O.row+=1,O.col+=1,h.end={...O}}Rt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",jt+='',It+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const E=a.backgroundImage;ct=new Promise(async(s,y)=>{let p=E.lastIndexOf("."),c;p>0?(c=E.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await Ct(E,F,o,e.fetch);A||y("image not load"),we.push(c),s({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(E,s)=>{let y=E.url.lastIndexOf("."),p;y>0?(p=E.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",we.push(p);const c="image"+X+++"."+p;return{type:p,image:await Ct(E.url,c,o,e.fetch),obj:E,i:s,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const E=a.headers.length;let s="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:E,q=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",D=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(Ce.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let de=ue.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=ue.indexOf(ee);re<0?ue.push(ee):de=re}Ye.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,de)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},s+='',s+=''+B+"",s+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,D):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),ce&&(H+='',he||(he=f==null?void 0:f.folder("tables"))),V.start=l[p]+""+k,V.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(ce&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Dt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Fe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const q=ue.indexOf(le);q<0?ue.push(le):O=q}Ye.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ye&&ye[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(be=!0,se+=h.chainCell),C+=h.cell,delete ye[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),ce&&(H+=""),a.withoutHeader)C+=s;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=s+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
"); + const H = x.border; + let k = ""; + if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.top || H.full) && (k += ''), (H.bottom || H.full) && (k += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { + const C = r[x.format]; + C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); + } + return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; + }, + { + conditionalFormatting: { + count: G ? 1 : 0, + value: ' ' + }, + commentSyntax: { + value: {} + }, + format: { + count: 0, + value: "" + }, + border: { + count: 1, + value: "" + }, + fill: { + count: 2, + value: "" + }, + font: { + count: 2, + value: "" + }, + cell: { + count: 2, + value: "" + } + } + ); + f == null || f.file("styles.xml", Gt(N, G)); + let oe = '', P = "", B = 0, X = "", K = "", L = {}; + const E = {}; + let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; + const ye = { + checkbox: ` +` + }; + let ve = 1024; + const we = { + checkbox: ` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
` + }, Se = { + checkbox: ` + + + + ` + }; + let ae = [], ie = "", ge = !1, de = null; + for (let w = 0; w < s; w++) { + const a = e.sheet[w], b = w + 1; + let x = {}, Y = { + start: "", + end: "" + }; + const se = a.asTable; + let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( + [], + a.conditionalFormatting + ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; + if (a.rtl && (Ee += ' rightToLeft="1" '), a.pageBreak) { + const T = a.pageBreak; + if (T.row && Array.isArray(T.row)) { + _e = "pageBreakPreview"; + const i = T.row.length; + Ze += '' + T.row.reduce( + (y, p) => y + '', + "" + ) + ""; + } + if (T.column && Array.isArray(T.column)) { + _e = "pageBreakPreview"; + const i = T.column.length; + Ze += '' + T.column.reduce( + (y, p) => y + '', + "" + ) + ""; + } + } + let gt = ""; + if (a.pageOption) { + const T = a.pageOption; + if (T.isPortrait && (je = !0), T.margin) { + const F = T.margin; + let A = { + left: 0.7, + right: 0.7, + top: 0.75, + bottom: 0.75, + header: 0.3, + footer: 0.3 + }; + Object.keys(A).forEach((h) => { + typeof F[h] == "number" && (A[h] = F[h]); + }), gt = ''; + } + let i = "", y = "", p = "", c = ""; + if (["header", "footer"].forEach((F) => { + const A = F.charAt(0).toUpperCase() + F.substring(1); + if (T[F]) { + const h = T[F]; + typeof h == "object" && Object.keys(h).forEach((O) => { + i.indexOf(O) < 0 && (i += O); + const le = h[O]; + let V = ""; + if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { + const I = le[R]; + V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); + }), V = "<" + O + A + ">" + V + "", O == "odd") + y += V; + else if (O == "even") + p += V; + else if (O == "first") + c += V; + else + throw "type error"; + }); + } + }), Pe = y + p + c, Pe.length > 0) { + je = !0; + const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; + Pe = "" + Pe + ""; + } + } + if (a.viewOption) { + let T = ""; + const i = a.viewOption; + i.type && (_e = i.type), i.hideRuler && (Ee += ' showRuler="0" '), i.hideGrid && (Ee += ' showGridLines="0" '), i.hideHeadlines && (Ee += ' showRowColHeaders="0" '); + let y = i.splitOption; + if (typeof y > "u" && (je = !1, typeof i.frozenOption == "object")) { + const p = i.frozenOption; + if (T = ' state="frozen" ', p.type == "R" || p.type == "ROW") { + let c; + typeof p.index == "object" ? c = p.index.r : c = p.index, y = { + startAt: { + b: "A" + (c + 1) + }, + type: "H", + split: c + }; + } else if (p.type == "C" || p.type == "COLUMN") { + let c; + typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { + type: "V", + startAt: { + r: l[c] + 1 + }, + split: c + }; + } else if (p.type == "B" || p.type == "BOTH") { + let c = "", _; + typeof p.index == "number" ? (_ = p.index, c = l[p.index] + (p.index + 1)) : (_ = { + y: p.index.r, + x: p.index.c + }, c = l[p.index.c] + (p.index.r + 1)), y = { + startAt: { + two: c + }, + type: "B", + split: _ + }; + } + } + if (y) + if (y.type == "H" || y.type == "HORIZONTAL") { + let p; + y.startAt && (p = y.startAt.b, y.startAt.t && (Ee += ' topLeftCell="' + y.startAt.t + '"')), p || (p = "A1"), Te = '"; + } else if (y.type == "V" || y.type == "VERTICAL") { + let p; + y.startAt && (p = y.startAt.r, y.startAt.l && (Ee += ' topLeftCell="' + y.startAt.l + '"')), p || (p = "A1"), Te = '"; + } else { + let p; + y.startAt && (p = y.startAt.two, y.startAt.one && (Ee += ' topLeftCell="' + y.startAt.one + '"')), p || (p = "A1"), Te = '"; + } + } + if (je && (_e = "pageLayout"), a.checkbox) { + ze = !0; + const T = ye.checkbox; + a.checkbox.forEach((i, y) => { + let p = T; + if (i.link) { + let O = Re(i.link, l); + p = p.replace( + "**fmlaLink**", + 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' + ); + } else + p = p.replace("**fmlaLink**", ""); + i.mixed ? p = p.replace("**value**", 'checked="Mixed"') : i.checked ? p = p.replace("**value**", 'checked="Checked"') : p = p.replace("**value**", ""), i.threeD && p.replace('noThreeD="1"', ""), ae.push(p), ve++; + let c = w + "" + ve++; + const _ = "_x0000_s" + c; + pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); + let F = i.startStr, A = i.endStr, h = { + start: { + col: 0, + row: 0 + }, + end: { + col: 1, + row: 1 + } + }; + if (i.col && i.row && (h = { + start: { + col: i.col, + row: i.row - 1 + }, + end: { + col: i.col, + row: i.row + } + }), typeof F == "string" && F.length >= 2) { + let O = Re(F, l); + h.start = { + ...O + }, h.end = { + col: O.col + 1, + row: O.row + 1 + }; + } + if (typeof A == "string" && A.length >= 2) { + let O = Re(A, l); + O.row += 1, O.col += 1, h.end = { + ...O + }; + } + ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; + }); + } + let Xe; + if (a.backgroundImage) { + v == null && (v = f == null ? void 0 : f.folder("media")); + const T = a.backgroundImage; + Xe = new Promise(async (i, y) => { + let p = T.lastIndexOf("."), c; + p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; + const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); + A || y("image not load"), Ce.push(c), i({ + name: F, + type: c, + image: A, + ref: _ + }); + }); + } + let Je; + if (a.images && (v == null && (v = f == null ? void 0 : f.folder("media")), Je = Promise.all([ + ...a.images.map(async (T, i) => { + let y = T.url.lastIndexOf("."), p; + y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); + const c = "image" + J++ + "." + p; + return { + type: p, + image: await _t(T.url, c, o, e.fetch), + obj: T, + i, + name: c + }; + }) + ])), Array.isArray(a.headers) && a.headers.length) { + const T = a.headers.length; + let i = ""; + if (a.title) { + const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); + if (xe.push( + I + ":" + l[h + le - 1] + (k + O + F) + ), typeof _ < "u") { + Ie = !0; + const Q = rt( + _, + N.commentSyntax.value, + d + ); + let fe = pe.length; + if (Q.hasAuthor && typeof Q.author < "u") { + let ee = Q.author.toString(); + const re = pe.indexOf(ee); + re < 0 ? pe.push(ee) : fe = re; + } + He.push({ + row: k + F - 1, + col: h + }), Le += nt( + I, + Q.commentStr, + Q.commentStyle, + fe + ); + } + typeof c.text == "string" && (x[k + F] = { + startTag: '', + details: '' + B + "", + endTag: "" + }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + c.multiStyleValue, + N.commentSyntax.value, + R + ) : P += "" + $e(c.text) + ""), k += F + O + 1; + } + let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; + if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { + if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( + c, + null, + _, + !0 + ) === !0 && (ke[l[_]] = { + inProgress: !0, + start: k + }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( + c, + c, + k, + _, + !0, + S + ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) + return; + const F = l[_] + "" + k; + if (typeof a.commentCondition == "function") { + const h = a.commentCondition( + c, + null, + c.label, + k, + _, + !0 + ); + (typeof h == "string" || typeof h == "object" && h != null) && (c.comment = h); + } + if (c.comment) { + Ie = !0; + const h = rt( + c.comment, + N.commentSyntax.value, + d + ); + let O = pe.length; + if (h.hasAuthor && typeof h.author < "u") { + let le = h.author.toString(); + const V = pe.indexOf(le); + V < 0 ? pe.push(le) : O = V; + } + He.push({ + row: k - 1, + col: _ + }), Le += nt( + F, + h.commentStr, + h.commentStyle, + O + ); + } + const A = ue && ue[F]; + if (A) { + const h = ot( + F, + A, + b, + e.styles + ); + h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; + } else { + if (C += '' + B + "", typeof a.multiStyleCondition == "function") { + const h = a.multiStyleCondition( + c, + null, + c.label, + k, + _, + !0 + ); + h && (c.multiStyleValue = h); + } + c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + c.multiStyleValue, + N.commentSyntax.value, + y || "" + ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; + } + }), se && (H += ""), a.withoutHeader) + C += i; + else { + const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; + x[k] = { + startTag: c, + endTag: "", + details: C + }, C = i + c + C + "", k++; + } + if (Array.isArray(a.data)) { + const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; + a.data.forEach((h, O) => { + if (h.mergeType) + for (let I = 0; I < h.mergeType.length; I++) { + const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; + let re = ""; + Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); + } + const le = h.rowStyle, V = '", + details: R + }, k++, C += ""; + }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); + } + if (We.length > 0 && We.forEach((c) => { + const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; + ue[A + "" + k] = { + start: a.withoutHeader ? A + "1" : A + "2", + end: A + "" + (k - 1), + type: F.formula.type, + ...F.formula.styleId ? { styleId: F.formula.styleId } : {} + }; + }), Ge.length > 0 && Ge.forEach((c) => { + const _ = a.headers[c]; + _.conditionalFormatting && Ue.push({ + ..._.conditionalFormatting, + start: a.withoutHeader ? l[c] + "1" : l[c] + "2", + end: l[c] + "" + (k - 1) + }); + }), ue) { + const c = Object.keys(ue).sort( + (_, F) => _ > F ? 1 : -1 + ); + if (c.length) { + let _ = {}; + c.forEach((F) => { + const A = ot( + F, + ue[F], + b, + e.styles + ); + A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; + }), Object.keys(_).forEach((F) => { + const A = F, h = _[A]; + let O = x[A]; + if (O) { + const le = O.startTag + O.details + h + O.endTag; + let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); + C = C.replace(V, le); + } else + C += '' + h + "", x[A] = { + startTag: '', + endTag: "", + details: h + }; + }); + } + } + } + w > 0 && (oe += ''); + const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; + X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); + const bt = a.sortAndFilter ? 'filterMode="1"' : ""; + let Ct = -1; + Xe && await Xe.then((T) => { + let i = T; + Ct = i.ref, v == null || v.file(i.name, i.image); + }); + let Ne = !1, Qe = "", vt = ""; + Je && (Ne = !0, await Je.then((T) => { + let i = ""; + T.forEach((y, p) => { + const c = p + 1; + let _ = y.image; + const F = y.name; + let A = y.obj.from, h = y.obj.to, O = y.obj.margin; + y.type; + let le = y.obj.type, V = y.obj.extent; + typeof V > "u" && (V = { + cx: 2e5, + cy: 2e5 + }); + let R = { + start: { + col: 0, + row: 0, + mL: 0, + mT: 0 + }, + end: { + col: 1, + row: 1, + mR: 0, + mB: 0 + } + }; + if (typeof A == "string" && A.length >= 2) { + let I = Re(A, l); + R.start = { + ...I + }, R.end = { + col: I.col + 1, + row: I.row + 1 + }; + } + if (typeof h == "string" && h.length >= 2) { + let I = Re(h, l); + I.row += 1, I.col += 1, R.end = { + ...I + }; + } + R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; + }), vt = ` +` + i + ""; + })), xe = [...new Set(xe)]; + let wt = "", Ae = 1; + Ue.length > 0 && (wt = Ue.reduce((T, i) => { + if (i.type == "cells") + return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; + if (i.type == "top") + return T + '"; + if (i.type == "iconSet") { + let y = ""; + return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); + } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; + }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { + indexId: q + 1, + key: "sheet" + (w + 1), + sheetName: xt, + sheetDataTableColumns: H, + backgroundImageRef: Ct, + sheetDimensions: Y, + asTable: se || !1, + sheetDataString: C, + sheetDropDown: ro(a.dropDowns), + sheetBreakLine: Ze, + viewType: _e, + hasComment: Ie, + drawersContent: Qe, + cFDataString: wt, + sheetMargin: gt, + sheetHeaderFooter: Pe, + isPortrait: je, + drawersRels: vt, + hasImages: Ne, + hasCheckbox: ze, + formRel: ht, + checkboxDrawingContent: dt, + checkboxForm: ae, + checkboxSheetContent: ut, + checkboxShape: pt, + commentString: Le, + commentAuthor: pe, + shapeCommentRowCol: He, + splitOption: Te, + sheetViewProperties: Ee, + sheetSizeString: W.length > 0 ? "" + W + "" : "", + protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", + merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", + selectedView: !!a.selected, + sheetSortFilter: ce, + tabColor: a.tabColor ? '' : "' + }, q++; + } + ge && (q++, K += '', f == null || f.file( + "calcChain.xml", + ` +` + ie + "" + )); + let Mt = Object.keys(E), qe = m.folder("_rels"); + qe == null || qe.file( + ".rels", + ` + ` + ); + let Oe = m.folder("docProps"); + Oe == null || Oe.file( + "core.xml", + ` +` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" + ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( + "workbook.xml", + ` + ` + (U ? '' : "") + " " + X + " " + ), f == null || f.file( + "sharedStrings.xml", + ` + ' + P + "" + ); + let Ye = f == null ? void 0 : f.folder("_rels"); + Ye == null || Ye.file( + "workbook.xml.rels", + ` + ` + K + " " + ); + let Ve = f == null ? void 0 : f.folder("theme"); + Ve == null || Ve.file( + "theme1.xml", + ` +` + ); + let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; + if (Mt.forEach((w, a) => { + const b = E[w]; + let x = "", Y = { + form: !1, + drawing: !1, + vmlDrwing: !1, + comment: !1, + table: !1, + sheetDrawingsPushed: !1 + }; + const se = b.sheetDataTableColumns; + if (se.length > 0) { + mt.push("table" + (a + 1) + ".xml"); + const C = b.asTable, W = b.sheetDimensions; + de == null || de.file( + "table" + (a + 1) + ".xml", + ` +' + se + '
' + ), x += ''; + } + const H = "drawing" + (De.length + 1) + ".xml"; + if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( + H + ".rels", + b.drawersRels.toString() + ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( + H, + ` +` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" + )), b.hasComment) { + ft.push(a + 1); + let C = b.commentAuthor; + f == null || f.file( + "comments" + (a + 1) + ".xml", + ` +` + (Array.isArray(C) && C.length > 0 ? C.reduce( + (W, ce) => W + "" + ce + "", + "" + ) : "") + "" + b.commentString + "" + ), x += '' + (Y.vmlDrwing ? "" : ''); + } + if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( + "vmlDrawing" + (a + 1) + ".vml", + '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" + )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { + const C = Fe == null ? void 0 : Fe.folder("_rels"); + C == null || C.file( + "sheet" + (a + 1) + ".xml.rels", + ` + ` + x + "" + ); + } + let k = ""; + b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( + b.key + ".xml", + ` +` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" + ); + }), ae.length > 0) { + let w = f == null ? void 0 : f.folder("ctrlProps"); + ae.forEach((a, b) => { + w == null || w.file("ctrlProp" + (b + 1) + ".xml", a); + }); + } + if (m.file( + "[Content_Types].xml", + Zt( + oe, + ft, + [...new Set(Ce)], + De, + ae, + ge, + mt + ) + ), o) + return m.generateAsync({ + type: e.generateType ? e.generateType : "nodebuffer" + }).then((w) => w); + if (e.notSave) + return m.generateAsync({ type: "blob" }).then((w) => w.slice( + 0, + w.size, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + )); + m.generateAsync({ type: "blob" }).then(function(w) { + import("./FileSaver.min-BEH1o5YI.js").then((a) => a.F).then((a) => { + const { saveAs: b } = a; + b( + w, + (e.fileName ? e.fileName : "tableRecord") + ".xlsx" + ); + }); + }); +} +function no(e) { + const t = e.length; + let r = 0, o = {}, n = {}, l = {}; + for (let s = 0; s < t; s++) { + const f = e[s], v = f.length; + let D = {}; + for (let j = 0; j < v; j++) { + r++; + const S = f[j]; + let d; + S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { + headers: [], + data: [], + labelCounter: 0, + seenAt: s + }), d in n || (n[d] = { + index: s, + value: 0 + }), d in l || (o[d].labelCounter = 0, l[d] = !0); + let G = []; + const z = o[d].headers.length; + let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ + label: "c" + o[d].labelCounter, + text: N ? L.text : "" + }), Z["c" + o[d].labelCounter] = L.text, { + ...K, + [L.label]: "c" + o[d].labelCounter + }), {}); + if (o[d].headers.push(...G), S.spaceX) + for (let K = 0; K < S.spaceX; K++) + o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ + label: "c" + o[d].labelCounter, + text: "" + }); + n[d].index + 1 == s && (D[d] = n[d].value); + let P = D[d] || 0; + P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { + ...o[d].data[P], + ...Z + }, o[d].headerIndex = P, P++); + let B = Object.keys(oe), X = S.data.length >= o[d].data.length; + if (o[d].data = S.data.reduce((K, L, E) => { + let $ = {}; + return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { + let U = oe[q]; + $[U] = L[q] ? L[q] : ""; + }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; + }, o[d].data), X && S.spaceY) { + const K = o[d].headers.length; + for (let L = 0; L < S.spaceY; L++) { + let E = {}; + for (let $ = 0; $ < K; $++) { + const q = o[d].headers[$]; + E[q.label] = ""; + } + o[d].data.push(E); + } + } + n[d] = { + value: Math.max(o[d].data.length, n[d].value), + index: s + }; + } + l = {}; + } + let g = Object.keys(o), u = []; + return g.reduce( + (s, f) => { + let v = o[f]; + return s.sheet.push({ + ...v, + name: f + }), s; + }, + { sheet: u } + ); +} +function it(e) { + return /^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e); +} +function st(e) { + return /^[A-Z]+[1-9][1-9]*$/.test(e); +} +const lo = { + fontFamily: { + mode: "TYPE_CHECK", + type: "string" + }, + type: { + mode: "TYPE_CHECK", + type: "string" + }, + size: { + mode: "TYPE_CHECK", + type: "number" + }, + index: { + mode: "TYPE_CHECK", + type: "number" + }, + alignment: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + return t.rtl && t.ltr && o && console.warn("Alignment-rtl and ltr cannot be used together."), (t.readingOrder && t.ltr || t.readingOrder && t.rtl) && o && console.warn( + "Alignment-readingOrder cannot be used with rtl or ltr." + ), !0; + } + }, + border: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = ["full", "top", "left", "right", "bottom"], l = [ + "slantDashDot", + "dotted", + "thick", + "hair", + "dashDot", + "dashDotDot", + "dashed", + "thin", + "mediumDashDot", + "medium", + "double", + "mediumDashed" + ]; + return Object.keys(t).forEach((u) => { + const m = u; + if (n.indexOf(m) < 0) + throw 'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."'; + const s = t[m]; + if (!("color" in s)) + throw "border-The border must have a color."; + if (!("style" in s)) + throw "border-The border needs a style."; + if (typeof s.style == "string" && l.indexOf(s.style) < 0) + throw "border-An invalid style has been used."; + }), !0; + } + }, + format: { + mode: "TYPE_CHECK", + type: "string" + }, + bold: { + mode: "TYPE_CHECK", + type: "boolean" + }, + underline: { + mode: "TYPE_CHECK", + type: "boolean" + }, + italic: { + mode: "TYPE_CHECK", + type: "boolean" + }, + doubleUnderline: { + mode: "TYPE_CHECK", + type: "boolean" + }, + color: { + mode: "TYPE_CHECK", + type: "string" + }, + backgroundColor: { + mode: "TYPE_CHECK", + type: "string" + } +}, ao = { + notSave: { + mode: "TYPE_CHECK", + type: "boolean" + }, + creator: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + backend: { + mode: "TYPE_CHECK", + type: "boolean" + }, + activateConditionalFormatting: { + mode: "TYPE_CHECK", + type: "boolean" + }, + fileName: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + generateType: { + mode: "TYPE_CHECK", + type: "string", + isEnum: !0, + enum: ["nodebuffer", "array", "binarystring", "base64"] + }, + addDefaultTitleStyle: { + mode: "TYPE_CHECK", + type: "boolean" + }, + created: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + modified: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + numberOfColumn: { + mode: "TYPE_CHECK", + type: "number", + min: 26 + }, + createType: { + mode: "TYPE_CHECK", + type: "string" + }, + styles: { + mode: "TYPE_CHECK", + type: "object" + }, + sheet: { + mode: "TYPE_CHECK", + type: "object", + isArray: !0 + } +}, io = { + headers: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object" + }, + data: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object" + }, + withoutHeader: { + mode: "TYPE_CHECK", + type: "boolean" + }, + mapSheetDataOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = Object.keys(t), l = ["outlineLevel", "hidden", "height"]; + return n.forEach((g) => { + l.indexOf(g) < 0 && o && console.warn( + 'The Schema of mapSheetDataOption does not include the "' + g + '" property.' + ); + }), !0; + } + }, + backgroundImage: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + conditionalFormatting: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + return Array.isArray(t) && t.forEach((n) => { + if (n.type == "cells") { + const l = ["lt", "gt", "between", "ct", "eq"]; + if (!n.operator || !n.start || !n.end || typeof n.value > "u") + throw { + record: n, + error: "The object is not complete; you need to fill in the values for operator, start, end and value." + }; + if (l.indexOf(n.operator) < 0) + throw { record: n, error: "The operator is not valid." }; + } else if (n.type == "top") { + const l = ["belowAverage", "aboveAverage"]; + if (!n.start || !n.end || typeof n.value > "u") + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start, end and value." + }; + if (n.operator && l.indexOf(n.operator) < 0) + throw { record: n, error: "The operator is not valid." }; + } else if (n.type == "iconSet") { + if (!n.operator || !n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for operator, start and end" + }; + } else if (n.type == "colorScale") { + if (!n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start and end" + }; + } else if (n.type == "dataBar") { + if (!n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start and end" + }; + } else + throw 'Property "type" is not valid.'; + }), !0; + } + }, + multiStyleCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + useSplitBaseOnMatch: { + mode: "TYPE_CHECK", + type: "boolean" + }, + convertStringToNumber: { + mode: "TYPE_CHECK", + type: "boolean" + }, + images: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) { + const n = ["one", "two"]; + t.forEach((l) => { + if (typeof l.src != "string") + throw '"src" property is required.'; + if (typeof l.from != "string" || l.from.length == 0) + throw '"from" property is required.'; + if (l.to && !st(l.to)) + throw 'value of "to" is not valid.'; + if (l.from && !st(l.from)) + throw 'value of "from" is not valid.'; + if (n.indexOf(l.type) < 0) + throw 'Type of "type" is not valid in the "images" property.'; + if (l.type == "two" && !l.to) + throw '"to" property is empty. for "two" type "to" property is required.'; + }); + } + return !0; + } + }, + formula: { + mode: "TYPE_CHECK", + type: "object" + }, + pageOption: { + mode: "TYPE_CHECK", + type: "object" + }, + name: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + title: { + mode: "TYPE_CHECK", + type: "object" + }, + shiftTop: { + mode: "TYPE_CHECK", + type: "number", + min: 0 + }, + shiftLeft: { + mode: "TYPE_CHECK", + type: "number" + }, + selected: { + mode: "TYPE_CHECK", + type: "boolean" + }, + tabColor: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + merges: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) { + let n = []; + if (t.forEach((l) => { + it(l) || n.push( + "The " + l + ' reference is not valid in the "merges" property.' + ); + }), n.length > 0) + throw n; + } + return !0; + } + }, + headerStyleKey: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + mergeRowDataCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + styleCellCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + commentCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + sortAndFilter: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + if (typeof t == "object") { + const n = ["all", "ref"]; + if (!t.mode) + throw '"mode" is required in sortAndFilter'; + if (n.indexOf(t.mode) < 0) + throw '"mode" is not valid'; + if (t.mode == "ref") + if (t.ref) { + if (!it(t.ref)) + throw '"ref" is not valid'; + } else + throw '"ref" is must need be defined.'; + } + return !0; + } + }, + state: { + mode: "TYPE_CHECK", + type: "string", + isEnum: !0, + enum: ["hidden", "visible"] + }, + headerRowOption: { + mode: "TYPE_CHECK", + type: "object" + // Adjust according to the expected type for headerRowOption + }, + protectionOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = [ + "sheet", + "formatCells", + "formatColumns", + "formatRows", + "insertColumns", + "insertRows", + "insertHyperlinks", + "deleteColumns", + "deleteRows", + "sort", + "autoFilter", + "pivotTables" + ], l = ["0", "1", 0, 1]; + return Object.keys(t).forEach((u) => { + const m = t[u]; + if (n.indexOf(u) < 0) + throw '"' + u + '" is not valid.'; + if (l.indexOf(m) < 0) + throw 'value of "' + u + '" is not valid'; + }), !0; + } + }, + headerHeight: { + mode: "TYPE_CHECK", + type: "number", + min: 1 + }, + checkbox: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) + t.forEach((n) => { + if (!n.col || !n.row) + throw '"checkbox" is not complete'; + }); + else + throw 'Type of "checkbox" property is not valid'; + return !0; + } + }, + viewOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = ["pageLayout", "pageBreakPreview"]; + if (t.type && n.indexOf(t.type) < 0) + throw 'Type of "type" property is not valid'; + return !0; + } + }, + rtl: { + mode: "TYPE_CHECK", + type: "boolean" + }, + pageBreak: { + mode: "TYPE_CHECK", + type: "object", + isArray: !0 + }, + asTable: { + mode: "TYPE_CHECK", + type: "object" + } +}; +function Bt(e, t = !0, r = !0) { + Object.keys(e).forEach((n) => { + const l = e[n], g = Object.keys(l); + if (l.format && !Lt[l.format]) + throw 'The "' + l.format + '" format that has been used is not defined.'; + l.underline && l.doubleUnderline, g.forEach((u) => { + let m = l[u]; + const s = lo[u]; + if (Me(m, s, u, t, r)) + return !0; + }); + }); +} +function $t(e, t = !0, r = !0) { + Array.isArray(e) || (e = [e]), e.forEach((o) => { + Object.keys(o).forEach((l) => { + const g = o[l], u = io[l]; + Me(g, u, l, t, r); + }); + }); +} +function so(e, t = !0, r = !0) { + Object.keys(e).forEach((n) => { + let l = e[n]; + const g = ao[n]; + if (Me(l, g, n, t, r)) + if (n == "sheet") + if (Array.isArray(l)) + $t(l); + else + throw "Sheet must be Array."; + else n == "styles" && Bt(l); + }); +} +function Me(e, t, r, o, n) { + if (t) { + if (typeof e != t.type) { + if (t.type == "object" || t.type == "string" || o) + throw 'The Type of The "' + r + '" is not valid'; + n && console.warn("The property type must be " + t.type); + } + if (t.isEnum && t.enum.indexOf(e) < 0) + throw 'The value of "' + r + '" must be ' + JSON.stringify(t.enum); + if (t.min && e < t.min) + throw 'The value of "' + r + '" must be higher than ' + t.min; + if (t.notEmpty && (!e || e.length <= 0)) + throw 'The value of "' + r + '" must not be empty.'; + if (t.isArray && !Array.isArray(e)) + throw 'The value of "' + r + '" should be an array.'; + return typeof t.validateFunction == "function" && t.validateFunction(r, e, o, n), !0; + } else + return n && console.warn( + 'The Schema Object does not include the "' + r + '" property.' + ), !1; +} +const co = { + checkSheetValidWithOneRef: st, + checkSheetValidWithTwoRef: it, + generalValidationCheck: Me +}, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + exportedForTesting: co, + validateExcelTableObjectFunction: so, + validateSheetArrayFunction: $t, + validateStyleObjectFunction: Bt +}, Symbol.toStringTag, { value: "Module" })); +function It(e) { + if (typeof e > "u" || e == null) + return ""; + typeof e != "string" && (e = String(e)); + let t = e, r = !1; + return e.indexOf('"') >= 0 && (t = t.replace(/"/g, '""'), r = !0), e.indexOf(",") >= 0 && (r = !0), r && (t = '"' + t + '"'), t; +} +function fo(e) { + return e ? " " : ","; +} +function Pt(e, t) { + return e.substring(0, e.length - t) + ` +`; +} +async function Kt(e, t = !1, r = !1) { + const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; + let g = []; + if (e.sheet.forEach((m) => { + let s = "", f = ""; + const v = m.headers; + let D = [], j = v.length; + for (let S = 0; S < j; S++) { + const d = v[S]; + D.push(d.label), m.withoutHeader || (f += It(d.text) + o); + } + s += Pt(f, l), j = m.data.length; + for (let S = 0; S < j; S++) { + f = ""; + const d = m.data[S]; + D.forEach((G) => { + f += It(d[G]) + o; + }), s += Pt(f, l); + } + g.push(s); + }), e.backend) + return g; + const u = await import("./FileSaver.min-BEH1o5YI.js").then((m) => m.F).then((m) => m.saveAs); + if (t) { + const m = await import("./jszip.min-D-TEDr9v.js").then((v) => v.j).then((v) => v.default); + let s = new m(); + g.forEach((v, D) => { + s.file("sheet" + (D + 1) + n, v); + }); + const f = await s.generateAsync({ type: "blob" }).then(function(v) { + return v; + }); + return u( + f, + (e.fileName ? e.fileName : "tableRecord") + ".zip" + ), "done"; + } + g.forEach((m) => { + var s = new Blob([m], { + type: "text/" + (r ? "plain" : "csv") + ";charset=utf-8" + }); + u( + s, + (e.fileName ? e.fileName : "tableRecord") + n + ); + }); +} +const jt = { + firstHeader: !0, + returnTableNodes: !1, + emptyNodeDefaultString: " ", + removeContainerChildNode: !0, + containerNodeStyle: { + display: "flex", + flexDirection: "column" + }, + tableStyle: { + borderSpacing: "0", + border: "1px solid #EEEEEEF1" + }, + cellStyle: { + width: "68px", + height: "24px", + border: "1px solid #EEEEEEF1" + }, + buttonContainerStyle: { + display: "flex" + }, + buttonStyle: { + height: "40px", + width: "80px", + display: "flex", + justifyContent: "center", + alignItems: "center", + border: "0", + background: "transparent", + cursor: "pointer" + }, + activeButtonStyle: { + background: "#EEEDEB" + } +}; +async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { + display: "flex", + flexDirection: "column" +}, s = { + borderSpacing: "0", + border: "1px solid #EEEEEEF1" +}, f = { + width: "68px", + height: "24px", + border: "1px solid #EEEEEEF1" +}, v = { + display: "flex" +}, D = { + height: "40px", + width: "80px", + display: "flex", + justifyContent: "center", + alignItems: "center", + border: "0", + background: "transparent", + cursor: "pointer" +}, j = { + background: "#EEEDEB" +}) { + let S = await import("./read-utils-C7gudp0B.js").then( + async (E) => await E.extractExcelData(e, !1, o) + ), d = null; + if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) + throw "Container Node not found"; + const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); + let B = document.createElement("div"); + N.forEach((E) => { + B.style[E] = v[E]; + }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { + d.style[E] = m[E]; + }), d.appendChild(B)); + let X = [], K = !1, L = 0; + do { + L++; + const E = S.sheetName.next(); + if (!E.value) + break; + const $ = document.createElement("div"); + if ($.style.display = "none", !l) { + const J = document.createElement("button"); + oe.forEach((ye) => { + J.style[ye] = D[ye]; + }), J.addEventListener("click", (ye) => { + const ve = J.getAttribute("data-sheet"), we = d.querySelector( + 'div[data-sheet="' + ve + '"]' + ); + if (we) { + P.forEach((ie) => { + J.style[ie] = j[ie]; + }); + const Se = d.querySelector( + "[data-sheet-button-activate]" + ); + let ae = d.querySelector("[data-sheet-activate]"); + we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { + Se.style[ie] = D[ie]; + }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); + } else + console.error("Sheet content not found!! id is " + ve); + }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); + } + let q = n ? "th" : "td"; + const U = document.createElement("table"); + z.forEach((J) => { + U.style[J] = s[J]; + }); + const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; + if (Array.isArray(M)) { + const J = M.length; + for (let ye = 0; ye < J; ye++) { + const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); + for (let ae = 0; ae <= Ce; ae++) { + let ie = g; + if (Se) { + const de = ve[ae]; + typeof de == "string" && (ie = de); + } + const ge = document.createElement(q); + Z.forEach((de) => { + ge.style[de] = f[de]; + }), ge.innerText = ie, we.appendChild(ge); + } + U.appendChild(we), q = "td"; + } + } + l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; + } while (!K); + if (l) + return X; + { + const E = d.querySelector( + 'div[data-sheet="1"]' + ); + E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); + const $ = d.querySelector( + 'button[data-sheet="1"]' + ); + return $ && (P.forEach((q) => { + $.style[q] = j[q]; + }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; + } +} +async function uo(e, t, r = !0, o = "property") { + let n = await import("./read-utils-C7gudp0B.js").then( + async (u) => await u.extractExcelData(e, !1, t) + ), l = {}, g = []; + return Object.keys(n.sheetNameObject).forEach((u) => { + const m = n.sheetNameObject[u], s = n.data[m] || n.data[u], f = n.maxLengthOfColumn[m] || n.maxLengthOfColumn[u]; + for (let j = 0; j <= f; j++) + g[j] = o + (j + 1); + let v = r, D = []; + s.forEach((j) => { + let S = {}; + j.forEach((d, G) => { + typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); + }), v = !1, D.push(S); + }), l = Object.assign(l, { + [m]: D + }); + }), l; +} +const yo = Ht, go = to; +function xo(e, t, r = {}) { + const o = Wt( + e, + t, + r.keepStyle, + r.rowHeightScaleFunction, + r.colWidthScaleFunction + ); + return ct(o); +} +function bo(e) { + const t = no(e); + return ct(t); +} +function Co(e, t) { + return ct(zt(e, t)); +} +function vo(e, t = !1, r) { + return import("./read-utils-C7gudp0B.js").then( + (o) => o.extractExcelData(e, t, r) + ); +} +function wo(e, t = !1) { + return Kt(e, t, !1); +} +function To(e, t = !1) { + return Kt(e, t, !0); +} +function Eo(e, t, r, o = { ...jt }) { + return o = { + ...jt, + ...o + }, mo( + e, + t, + r, + o.fetchFunc, + o.firstHeader, + o.returnTableNodes, + o.emptyNodeDefaultString, + o.removeContainerChildNode, + o.containerNodeStyle, + o.tableStyle, + o.cellStyle, + o.buttonContainerStyle, + o.buttonStyle, + o.activeButtonStyle + ); +} +export { + yo as a, + go as b, + Qt as c, + xo as d, + vo as e, + wo as f, + Re as g, + To as h, + Eo as i, + ct as j, + uo as k, + po as r, + bo as s, + Co as t, + ho as v +}; diff --git a/dist/index-D4WU6E--.js b/dist/index-D4WU6E--.js deleted file mode 100644 index ec05f1a..0000000 --- a/dist/index-D4WU6E--.js +++ /dev/null @@ -1,2518 +0,0 @@ -function Lt(e) { - return e.replace(/ /g, ""); -} -function Ht(e) { - if (e = e.replace(/^#/, ""), e.length == 3) { - const t = e.charAt(0), l = e.charAt(1), o = e.charAt(2); - return t + t + l + l + o + o; - } else - return e; -} -function zt(e) { - /^#?([a-f\d]{3})$/i.test(e) && (e = Ht(e)); - var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); - return t ? [ - parseInt(t[1], 16), - parseInt(t[2], 16), - parseInt(t[3], 16) - ] : [0, 0, 0]; -} -function Ot(e) { - const t = zt(e); - return t == null ? void 0 : (0.299 * t[0] + 0.587 * t[1] + 0.114 * t[2]) / 255 > 0.5 ? "rgb(0,0,0)" : "rgb(255,255,255)"; -} -function Ft(e) { - /^#?([a-f\d]{3})$/i.test(e) && (e = Ht(e)); - var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); - return t ? "rgb(" + (255 - parseInt(t[1], 16)) + "," + (255 - parseInt(t[2], 16)) + "," + (255 - parseInt(t[3], 16)) + ")" : "rgb(0,0,0)"; -} -function tt(e) { - e = Number(e); - var t = e.toString(16); - return t.length == 1 ? "0" + t : t; -} -function me(e) { - e = Lt(e); - let t = e.indexOf("rgba") >= 0 ? e.substring(5, e.length - 1).split(",") : e.substring(4, e.length - 1).split(","), l = t.reduce((o, r) => o && !Number.isNaN(Number(r)), !0); - return t.length == 4 && t[3] == "0" || t.length != 3 && t.length != 4 || !l ? null : (tt(t[0]) + tt(t[1]) + tt(t[2])).toUpperCase(); -} -function he(e, t) { - if (typeof e > "u" || e === null) - return null; - if (!t) { - let l = Lt(e); - l.indexOf("var(") == 0 && l.lastIndexOf(")") == l.length - 1 && (l = l.substring(4, l.length - 1), e = getComputedStyle(document.documentElement).getPropertyValue( - l - )); - } - if (e.indexOf("rgb") >= 0) { - const l = me(e); - e = l || ""; - } - return e.replace(/^#/, ""); -} -function Ut(e) { - let t = ""; - return e.indexOf("_") > 0 ? e.replace(/[a-z]/g, "").length == e.length ? t = e.split(/_/).reduce((l, o) => l + o.charAt(0) + o.substring(1).toLowerCase() + " ", "").trim() : t = e.replace(/_/g, " ").trim() : (t = e.replace(/([A-Z])/g, " $1").trim(), t = t.charAt(0).toUpperCase() + t.substring(1).trim()), t; -} -function _t(e, t) { - let l = Object.keys(e).filter((n) => !t.includes(n)), o = []; - return l.reduce((n, u) => (n.push({ - label: u, - text: Ut(u) - }), n), o); -} -const ot = { - fileName: "MR-Excel", - headerBackgroundColor: "#393E46", - headerColor: "#EEEEEE", - negativeColor: !1, - rowBackgroundColor: "#EEEEEE", - rowColor: "#393E46", - filterKeys: [] -}, Wt = function(e, t = { - ...ot -}) { - let l; - if (typeof e == "object" && Array.isArray(e)) - if (e.length > 0) - if (Array.isArray(e[0])) { - let p = []; - for (let a = 0; a < e.length; a++) { - const m = e[a]; - if (m.length > 0) { - const b = _t( - m[0], - Array.isArray(t.filterKeys) ? t.filterKeys : [] - ); - p.push({ - headers: b, - data: m - }); - } - } - l = { - sheet: p - }; - } else - e.length > 0 ? l = { - sheet: [ - { - headers: _t( - e[0], - Array.isArray(t.filterKeys) ? t.filterKeys : [] - ), - data: e - } - ] - } : l = { - sheet: [] - }; - else - l = { - sheet: [] - }; - else - l = e; - let o = t && t.headerBackgroundColor ? t.headerBackgroundColor : ot.headerBackgroundColor, r = t && t.rowBackgroundColor ? t.rowBackgroundColor : ot.rowBackgroundColor, n = t && t.negativeColor ? Ft(o) : t && t.headerColor ? t.headerColor : Ot(o), u = t && t.negativeColor ? Ft(r) : t && t.rowColor ? t.rowColor : Ot(r); - typeof l.styles > "u" && (l.styles = {}), l.styles.themeStyleHeader = { - backgroundColor: o, - color: n - }, l.styles.themeStyleBody = { - backgroundColor: r, - color: u - }; - const y = l.sheet.length; - for (let p = 0; p < y; p++) - l.sheet[p].styleCellCondition = function(a, m, b, P, T, v) { - return T ? "themeStyleHeader" : "themeStyleBody"; - }; - return typeof (t == null ? void 0 : t.fileName) == "string" && (l.fileName = t.fileName), l; -}; -function Gt(e, t, l, o, r, n, u, y) { - let p = [], a = "both", m = []; - !t || t === 0 ? (t = 1, a = "col") : m.push(t - 1), !e || e === 0 ? (e = 0, a = "row") : m.push(e - 1); - let b = r || {}; - b.mergeType = y && y.mergeType ? [...y.mergeType, a] : [a], b.mergeValue = y && y.mergeValue ? [...y.mergeValue, m] : [m], b.mergeStart = y && y.mergeStart ? [...y.mergeStart, l] : [l]; - for (let P = 0; P < t; P++) { - let T = e; - for (let v = 0; v < o; v++) - l <= v ? T >= 1 ? (b["c" + v] = n, n = "", u += "*", T--) : t >= 2 && l == v ? (b["c" + v] = n, n = "", u += "+") : u += "-" : P > 0 && (u += "-"); - p.push({ - ...b, - mergeString: u - }), b = {}, u = ""; - } - return p; -} -function Xt(e, t, l, o, r) { - var b; - if (!e && !t) - throw "Error: One of the function inputs is required."; - let n; - e ? n = (b = document.querySelector(e)) == null ? void 0 : b.querySelectorAll("tr") : n = t == null ? void 0 : t.querySelectorAll("tr"); - let u = [], y = [], p = { - header: {}, - rows: [] - }, a = 40; - if (n) { - let P = !1, T = 0; - n.forEach((v, c) => { - var L = [].slice.call(v.children); - const M = window.getComputedStyle(v, null); - let V = me(M.backgroundColor); - if (!P) - T = L.length, P = !0, typeof o == "function" ? a = o( - Number(M.height.substring(0, M.height.length - 2)), - c, - !0 - ) : a = Number( - M.height.substring(0, M.height.length - 2) - ), L.forEach((B, oe) => { - let R = window.getComputedStyle(B, null), $ = null; - if (R.borderBottomWidth !== "0px") { - const G = me(R.borderBottomColor); - G && ($ || ($ = {}), $.bottom = { - style: "thin", - color: G - }); - } - if (R.borderTopWidth !== "0px") { - const G = me(R.borderTopColor); - G && ($ || ($ = {}), $.top = { - style: "thin", - color: G - }); - } - if (R.borderLeftWidth !== "0px") { - const G = me(R.borderLeftColor); - G && ($ || ($ = {}), $.left = { - style: "thin", - color: G - }); - } - if (R.borderRightWidth !== "0px") { - const G = me(R.borderRightColor); - G && ($ || ($ = {}), $.right = { - style: "thin", - color: G - }); - } - let Z = me(R.backgroundColor); - !Z && V && (Z = V); - const q = parseInt( - R.fontSize.substring(0, R.fontSize.indexOf("p")) - ); - let H = { - ...Z ? { backgroundColor: Z } : {}, - bold: parseInt(R.fontWeight) > 500, - ...isNaN(q) ? {} : { size: q }, - ...$ ? { border: $ } : {}, - alignment: { - ...typeof R.textAlign == "string" && R.textAlign.length > 0 ? { horizontal: R.textAlign } : {}, - vertical: "center", - ...R.direction == "rtl" ? { rtl: !0 } : { ltr: !0 } - } - }; - p.header[c + "-" + oe] = H; - let k; - typeof r == "function" ? k = r( - Number(R.width.substring(0, R.width.length - 2)), - oe - ) : k = Number(R.width.substring(0, R.width.length - 2)) * 0.15; - const K = B.getAttribute("colspan"), z = B.getAttribute("rowspan"); - u.push({ - label: "c" + oe, - ...K ? { colspan: K } : {}, - ...z ? { rowspan: z } : {}, - text: B.textContent, - ...isNaN(k) || k <= 0 ? {} : { size: k } - }); - }); - else { - let B = {}, oe = "", R = !1; - y.length >= c && (B = y[c - 1], oe = "mergeString" in B ? B.mergeString : "", R = !0); - let $ = 0; - L.forEach((Z, q) => { - if ("c" + (q + $) in B) - for (let Y = 0; Y <= T + 1 && "c" + (q + Y) in B; Y++) - $++; - q += $; - let H = window.getComputedStyle(Z, null); - if (Z.getAttribute("colspan") || Z.getAttribute("rowspan")) { - let Y = Gt( - Z.getAttribute("colspan") * 1, - Z.getAttribute("rowspan") * 1, - q, - T, - B, - Z.textContent, - oe, - B - ); - y.length < c ? y.push(...Y) : Y.forEach((Ce, J) => { - y.length < c + J ? y.push(...Y) : y[c + J] = { - ...y[c + J], - ...Ce - }; - }), B = Y[0], oe = Y[0].mergeString, R = !0; - } else - R || (oe += "-"); - let k = null; - if (H.borderBottomWidth !== "0px") { - const Y = me(H.borderBottomColor); - Y && (k || (k = {}), k.bottom = { - style: "thin", - color: Y - }); - } - if (H.borderTopWidth !== "0px") { - const Y = me(H.borderTopColor); - Y && (k || (k = {}), k.top = { - style: "thin", - color: Y - }); - } - if (H.borderLeftWidth !== "0px") { - const Y = me(H.borderLeftColor); - Y && (k || (k = {}), k.left = { - style: "thin", - color: Y - }); - } - if (H.borderRightWidth !== "0px") { - const Y = me(H.borderRightColor); - Y && (k || (k = {}), k.right = { - style: "thin", - color: Y - }); - } - let K = me(H.backgroundColor); - !K && V && (K = V); - const z = parseInt( - H.fontSize.substring(0, H.fontSize.indexOf("p")) - ); - let G = { - ...K ? { backgroundColor: K } : {}, - bold: parseInt(H.fontWeight) > 500, - ...isNaN(z) ? {} : { size: z }, - ...k ? { border: k } : {}, - alignment: { - ...typeof H.textAlign == "string" && H.textAlign.length > 0 ? { horizontal: H.textAlign } : {}, - vertical: "center", - ...H.direction == "rtl" ? { rtl: !0 } : { ltr: !0 } - } - }; - p.header[c + "-" + q] = G, B["c" + q] = Z.textContent; - }), typeof o == "function" ? B.height = o( - Number(M.height.substring(0, M.height.length - 2)), - c, - !1 - ) : B.height = M.height.substring(0, M.height.length - 2), typeof B.height == "string" && B.height.length == 0 && delete B.height, y.length < c ? y.push(B) : y[c - 1] = B; - } - }); - } else - throw "Error: DOM Element Not Found"; - return { - styles: p.header, - sheet: [ - { - ...a ? { headerHeight: a } : {}, - styleCellCondition: function(P, T, v, c, L, M) { - return l ? M.includes(v - 1 + "-" + c) ? v - 1 + "-" + c : "" : null; - }, - data: y, - headers: u - } - ] - }; -} -function Me(e, t, l = "", o = [], r = -1) { - const n = e.length; - for (let u = 0; u < n; u++) - o.push(l + e[u]); - return t < o.length ? o : Me( - e, - t, - o[r + 1], - o, - r + 1 - ); -} -function Zt(e, t) { - return ` -` + (e.format.count > 0 ? '' + e.format.value + "" : "") + '' + e.font.value + '' + e.fill.value + '' + e.border.value + '' + e.cell.value + ' ' + (t ? '' + e.conditionalFormatting.value + "" : '') + ""; -} -function Jt(e, t, l, o, r, n, u) { - let y = {}; - return ` -` + l.reduce((p, a) => (a = a.toLowerCase(), y[a] ? p : a == "svg" ? (y.png = !0, y.svg = !0, p + '') : a == "jpeg" || a == "jpg" ? (y.jpeg = !0, y.jpg = !0, p + '') : (y.curr = !0, p + '')), "") + t.reduce((p, a) => p + '', "") + e + (u.length > 0 ? u.reduce((p, a) => p + '', "") : "") + '' + (n ? '' : "") + '' + o.reduce((p, a) => p + '', "") + (r.length > 0 ? r.reduce((p, a, m) => p + '', "") : "") + ''; -} -function Qt(e, t) { - return ` -Microsoft Excel0falseWorksheets` + e + ' ' + t + "falsefalsefalse16.0300"; -} -function rt(e, t, l, o) { - e = e.toUpperCase(); - let r = ""; - if (t.formula) { - let a = t, m = a.formula.indexOf("=") == 0 ? a.formula.substring(1) : a.formula, b = e.indexOf(":") > 0, P = a.referenceCells ? a.referenceCells : e, T = b ? e.substring(0, e.indexOf(":")) : e, v = T.replace(/[0-9]/g, ""), c = parseInt(e.substr(v.length)), L = a.returnType ? a.returnType : a.isArray || b ? ' t="str"' : "", M = "styleId" in a && o && typeof a.styleId == "string" && o[a.styleId] ? ' s="' + o[a.styleId].index + '"' : "", V = a.isArray || b ? ' t="array" ref="' + P + '"' : ""; - return r = '" + m + "", { - column: v, - row: c, - needCalcChain: !1, - isCustom: !0, - cell: r - }; - } - let n = e.replace(/[0-9]/g, ""), u = parseInt(e.substr(n.length)), y = !1, p = ""; - if (t.noArgType) { - const a = t; - if (a.noArgType == "NOW" || a.noArgType == "TODAY") { - const m = "styleId" in a && o && typeof a.styleId == "string" && o[a.styleId] ? ' s="' + o[a.styleId].index + '"' : ""; - r = '" + a.noArgType + "()"; - } else { - let m = "NOW()"; - const b = "styleId" in a && o && typeof a.styleId == "string" && o[a.styleId] ? ' s="' + o[a.styleId].index + '"' : ""; - r = '" + a.noArgType.substring(4) + "(" + m + ")"; - } - p = '', y = !0; - } else if (t.referenceCell) { - const a = t; - let m = ""; - typeof a.value < "u" && (m = "," + a.value); - let b = ""; - a.type == "COT" && (b = "_xlfn."); - const P = "styleId" in a && o && typeof a.styleId == "string" && o[a.styleId] ? ' s="' + o[a.styleId].index + '"' : ""; - r = '" + b + a.type + "(" + a.referenceCell.toUpperCase() + m + ")", p = '', y = !0; - } else { - const a = t; - r = '" + a.type + "(" + a.start.toUpperCase() + ":" + a.end.toUpperCase() + ")"; - } - return { - column: n, - row: u, - cell: r, - needCalcChain: y, - chainCell: p - }; -} -function nt(e, t, l) { - let o = !1, r, n; - if (typeof e == "object") { - if ("author" in e && e.author && (o = !0, n = e.author), "styleId" in e && typeof e.styleId == "string") { - let u = t[e.styleId]; - typeof u == "string" && (l = u); - } - r = "comment" in e && typeof e.comment == "string" ? At(e.comment) : [""]; - } else - r = e ? At(e) : [""]; - return o && r.unshift(n + ":"), { - hasAuthor: o, - author: n, - commentStyle: l, - commentStr: r - }; -} -function At(e) { - var t = e.split(/\r?\n|\r|\n/g); - return t; -} -function lt(e, t, l, o) { - let r = '', n = ""; - return t.forEach((u, y) => { - let p = ""; - if (u.length == 0) { - n += ` -`; - return; - } - y > 0 && (p = ' xml:space="preserve"', n += ` -`), r += "" + l + "" + n + u + "", n = ""; - }), n.length > 0 && r.indexOf("") > 0 && (r = r.substring(0, r.length - 8) + n + ""), r += "", r; -} -const eo = '', De = function(e) { - return e.replace(/\&/g, "&").replace(/\/g, ">"); -}; -function Ke(e, t) { - let l = { - result: [], - str: t - }, o = e.reduce((r, n) => { - let u = r.str.indexOf(n); - return r.result.push(r.str.substring(0, u)), r.str = r.str.substring(u + n.length), r; - }, l); - return o.result.push(o.str), o.result; -} -function It(e, t, l, o, r, n, u, y, p) { - if (o) { - let a = [], m = [], b = []; - const P = n.length; - r.forEach((T, v) => { - let c; - try { - c = T.match(e); - } catch (L) { - if (typeof e == "string") - c = T.match("\\" + e); - else - throw L; - } - if (c) - if (y) { - let L; - p ? L = Ke(c, T) : L = T.split(e), a.push(...L), m.push(...c), b.push( - ...c.reduce((M, V) => [...M, t], []) - ); - } else { - let L; - p ? L = Ke(c, T) : L = T.split(e).reduce((M, V, B) => B >= 2 ? (M[1] += e + V, M) : [...M, V], []), a.push(...L), b.push(t), m.push(e.toString()); - } - else - a.push(T); - P > v && (m.push(n[v]), b.push(u[v])); - }), r = a, n = m, u = b; - } else { - let a; - try { - a = l.match(e); - } catch (m) { - if (typeof e == "string") - a = l.match("\\" + e); - else - throw m; - } - a ? y ? (n.push(...a), u.push( - ...a.reduce((m, b) => [...m, t], []) - ), p ? r = Ke(a, l) : r = l.split(e)) : (n.push(e.toString()), u.push(t), p ? r = Ke(a, l) : r = l.split(e).reduce((m, b, P) => P >= 2 ? (m[1] += e + b, m) : [...m, b], [])) : r.push(l), o = !0; - } - return { - v: e, - text: l, - splittedText: o, - splitValue: r, - matchValue: n, - styleMatchValue: u - }; -} -function at(e, t, l, o, r) { - if (typeof e == "object") { - let n = "", u = [], y = [], p = [], a = !1; - if (Object.keys(e).forEach((T) => { - const v = e[T]; - if (T !== "reg") { - let c = It( - T, - typeof v == "string" ? v : "", - t, - a, - p, - u, - y, - !1, - r - ); - a = c.splittedText, p = c.splitValue, u = c.matchValue, y = c.styleMatchValue; - } - }), "reg" in e && Array.isArray(e.reg)) { - const T = e.reg.length; - for (let v = 0; v < T; v++) { - const c = e.reg[v]; - if ("reg" in c && "styleId" in c) { - typeof c.reg == "string" && (c.reg = new RegExp(c.reg, "g")); - let L = It( - c.reg, - c.styleId, - t, - a, - p, - u, - y, - !0, - r - ); - a = L.splittedText, p = L.splitValue, u = L.matchValue, y = L.styleMatchValue; - } - } - } - const b = p.length - 1, P = o in l ? l[o] : ""; - for (let T = 0; T < b; T++) { - const v = p[T], c = u[T], L = y[T]; - v.length > 0 && (n += "" + P + '' + v + ""), c.length > 0 && (n += "" + (l[L] ? l[L] : P) + '' + c + ""); - } - return p[b].length > 0 ? n = "" + n + "" + P + "" + De(p[b]) + "" : n = "" + n + "", n; - } else - return "" + De(t) + ""; -} -const Nt = { - time: { - key: 165, - value: '' - }, - date: { - key: 187, - value: '' - }, - short_date: { - key: 14 - }, - fraction: { - key: 13 - }, - percentage: { - key: 9 - }, - float_1: { key: 180, value: '' }, - float_2: { key: 181, value: '' }, - float_3: { - key: 164, - value: '' - }, - float_4: { - key: 182, - value: '' - }, - dollar_rounded: { - key: 183, - value: '' - }, - dollar_2: { - key: 183, - value: '' - }, - num_sep: { - key: 184, - value: '' - }, - num_sep_1: { - key: 185, - value: '' - }, - num_sep_2: { - key: 186, - value: '' - }, - dollar: { - key: 163, - value: '' - }, - $: { - key: 163, - value: '' - }, - pound: { - key: 162, - value: '' - }, - "Β£": { - key: 162, - value: '' - }, - euro: { - key: 161, - value: '' - }, - "€": { - key: 161, - value: '' - }, - yen: { - key: 160, - value: '' - }, - "Β₯": { - key: 160, - value: '' - }, - CHF: { - key: 179, - value: '' - }, - ruble: { - key: 178, - value: '' - }, - "β‚½": { - key: 178, - value: '' - }, - "֏": { - key: 177, - value: '' - }, - manat: { - key: 176, - value: '' - }, - "β‚Ό": { - key: 176, - value: '' - }, - "β‚Ό1": { - key: 175, - value: '' - }, - "β‚½1": { - key: 174, - value: '' - }, - "β‚½2": { - key: 173, - value: '' - }, - "β‚½3": { - key: 172, - value: '' - }, - Ψ±ΩŠΨ§Ω„: { - key: 171, - value: '' - } -}, to = [ - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z" -], Pt = (e, t, l = !1, o) => { - let r, n = !1; - return typeof o == "function" ? (r = o, n = !0) : r = fetch, r(e).then((u) => n ? u : l ? u.arrayBuffer() : u.blob()).then((u) => n || l ? u : new File([u], t)).catch((u) => { - throw u; - }); -}; -function Re(e, t) { - e = e.toUpperCase(); - let l = e.replace(/[0-9]/g, ""); - if (l.length == 0) - throw "Invalid Column"; - let o = parseInt(e.substring(l.length)); - if (isNaN(o)) - throw "Invalid Row"; - o = Math.max(0, o - 1); - let r = t.indexOf(l); - return r < 0 && (t = Me(t, Math.pow(10, l.length + 1), ""), r = t.indexOf(l), r < 0 && (r = 0)), { - col: r, - row: o - }; -} -let oo = {}, it = new Proxy(oo, { - get(e, t) { - return t in e ? e[t] : (this.set(e, t, {}, !0), {}); - }, - set(e, t, l, o) { - return e[t] = l, !0; - } -}); -function Bt(e, t, l) { - it[e], it[e][t] = l; -} -function $t(e, t, l) { - Object.keys(l).forEach((r) => { - const n = l[r]; - typeof n == "object" ? r != "data" && r != "headers" && $t(e, t.length > 0 ? t + "." + r : r, n) : Bt(e, t.length > 0 ? t + "." + r : r, n); - }); -} -function ro(e, t) { - $t(e, "", t); -} -function no(e, t) { - let l = t, o = it[e]; - return Object.keys(o).forEach((n) => { - const u = n.split("."); - let y = l, p = o[n]; - for (let a = 0; a < u.length; a++) { - const m = u[a]; - y[m] ? y = y[m] : u.length - 1 == a ? y[m] = p : (y[m] = {}, y = y[m]); - } - }), l; -} -async function ft(e, t = "") { - if (typeof t == "string" && t.length > 0 && (e = no(t, e)), typeof e.creator == "string" && e.creator.trim().length <= 0) - throw 'length of "creator" most be bigger then 0'; - if (typeof e.created == "string" && new Date(e.created).toString() == "Invalid Date") - throw '"created" is not valid date'; - if (typeof e.modified == "string" && new Date(e.modified).toString() == "Invalid Date") - throw '"modified" is not valid date'; - let l = Nt; - e.formatMap && typeof e.formatMap == "object" && (l = { - ...l, - ...e.formatMap - }); - const o = e.backend, r = { - lt: "lessThan", - gt: "greaterThan", - between: "between", - ct: "containsText", - eq: "equal" - }; - let n = [...to]; - e.numberOfColumn && e.numberOfColumn > 25 && (n = Me(n, e.numberOfColumn)); - const y = (await import("./jszip.min-DoL7Cu0z.js").then((E) => E.j)).default; - let p = new y(); - const a = e.sheet.length; - let m = p.folder("xl"), b = null, P = null, T = null; - e.styles || (e.styles = {}), e.addDefaultTitleStyle && (e.styles.titleStyle = { - alignment: { - horizontal: "center", - vertical: "center" - } - }); - const v = Object.keys(e.styles), c = eo, L = e.activateConditionalFormatting ? e.activateConditionalFormatting : !1, M = {}, V = {}; - let B = v.reduce( - (E, i, C) => { - const x = e.styles[i]; - if (x.type && (x.type == "headerFooter" || x.type == "HF")) { - let w = "", X = "-", ce = "Regular"; - if (x.fontFamily && (X = x.fontFamily), x.bold && (ce = "Bold"), x.italic && (ce == "Regular" && (ce = ""), ce += "Italic"), (X != "-" || ce != "Regular") && (w = '&"' + X + "," + ce + '"'), x.size && (w += "&" + x.size), x.doubleUnderline ? w += "&E" : x.underline && (w += "&U"), x.color) { - const Te = he(x.color, o); - typeof Te == "string" && Te.length > 0 && (w += "&K" + Te.toUpperCase()); - } - return M[i] = w, E; - } - if (L && typeof x.type == "string" && x.type && (x.type == "conditionalFormatting" || x.type.toUpperCase() == "CF")) { - V[i] = E.conditionalFormatting.count; - let w = he(x.color, o), X = he(x.backgroundColor, o); - return E.conditionalFormatting.value += ' ', E.conditionalFormatting.count++, E; - } - const U = { - fillIndex: 0, - fontIndex: 0, - borderIndex: 0, - formatIndex: 0 - }; - if (x.backgroundColor) { - let w = he(x.backgroundColor, o); - U.fillIndex = E.fill.count, E.fill.count++, E.fill.value = E.fill.value + '' + (w ? '' : "") + ""; - } - if (x.color || x.fontFamily || x.size || x.bold || x.italic || x.underline || x.doubleUnderline) { - const w = he(x.color, o); - U.fontIndex = E.font.count, E.font.count++, E.font.value = E.font.value + "" + (x.bold ? "" : "") + (x.italic ? "" : "") + (x.underline || x.doubleUnderline ? "" : "") + (x.size ? '' : "") + (w ? '' : "") + (x.fontFamily ? '' : "") + "", E.commentSyntax.value[i] = "" + (x.bold ? "" : "") + (x.italic ? "" : "") + (x.underline || x.doubleUnderline ? "" : "") + '' + (w ? '' : "") + ''; - } - let se = "/>"; - x.alignment && (x.alignment.rtl && (x.alignment.readingOrder = 2), delete x.alignment.rtl, x.alignment.ltr && (x.alignment.readingOrder = 1), delete x.alignment.ltr, se = ' applyAlignment="1"> w + " " + X + '="' + x.alignment[X] + '" ', "") + " />
"); - const N = x.border; - let O = ""; - if (typeof N == "object" && ((N.left || N.full) && (O += ''), (N.right || N.full) && (O += ''), (N.top || N.full) && (O += ''), (N.bottom || N.full) && (O += ''), U.borderIndex = E.border.count, E.border.count++, E.border.value += "" + O + ""), x.format) { - const w = l[x.format]; - w && (U.formatIndex = w.key, "value" in w && (E.format.count++, E.format.value += w.value)); - } - return E.cell.value = E.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (U.fillIndex > 0 ? ' applyFill="1" ' : "") + (U.fontIndex >= 0 ? ' applyFont="1" ' : "") + (U.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[i].index = E.cell.count, E.cell.count++, E; - }, - { - conditionalFormatting: { - count: L ? 1 : 0, - value: ' ' - }, - commentSyntax: { - value: {} - }, - format: { - count: 0, - value: "" - }, - border: { - count: 1, - value: "" - }, - fill: { - count: 2, - value: "" - }, - font: { - count: 2, - value: "" - }, - cell: { - count: 2, - value: "" - } - } - ); - m == null || m.file("styles.xml", Zt(B, L)); - let oe = '', R = "", $ = 0, Z = "", q = "", H = {}; - const k = {}; - let K = "", z = 4, G = !1, Y = -1, Ce = [], J = 1; - const ye = { - checkbox: ` -` - }; - let ve = 1024; - const we = { - checkbox: ` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
` - }, Se = { - checkbox: ` - - - - ` - }; - let ae = [], ie = "", ge = !1, de = null; - for (let E = 0; E < a; E++) { - const i = e.sheet[E], C = E + 1; - let x = {}, U = { - start: "", - end: "" - }; - const se = i.asTable; - let N = "", O = i.shiftTop && i.shiftTop >= 0 ? i.shiftTop + 1 : 1, w = "", X = "", ce = "", Te = "", Ee = "", Ae = "", Ue = !1, pt = "", ht = "", ut = "", yt = "", xe = Object.assign([], i.merges), ue = Object.assign({}, i.formula), We = Object.assign( - [], - i.conditionalFormatting - ), Ie = !1, pe = [], He = "", Ne = [], gt = [], Ge = [], Xe = [], ke = {}, Pe = "", je = !1, Ze = ""; - if (i.rtl && (Ee += ' rightToLeft="1" '), i.pageBreak) { - const S = i.pageBreak; - if (S.row && Array.isArray(S.row)) { - Ae = "pageBreakPreview"; - const s = S.row.length; - Ze += '' + S.row.reduce( - (g, d) => g + '', - "" - ) + ""; - } - if (S.column && Array.isArray(S.column)) { - Ae = "pageBreakPreview"; - const s = S.column.length; - Ze += '' + S.column.reduce( - (g, d) => g + '', - "" - ) + ""; - } - } - let xt = ""; - if (i.pageOption) { - const S = i.pageOption; - if (S.isPortrait && (je = !0), S.margin) { - const _ = S.margin; - let A = { - left: 0.7, - right: 0.7, - top: 0.75, - bottom: 0.75, - header: 0.3, - footer: 0.3 - }; - Object.keys(A).forEach((h) => { - typeof _[h] == "number" && (A[h] = _[h]); - }), xt = ''; - } - let s = "", g = "", d = "", f = ""; - if (["header", "footer"].forEach((_) => { - const A = _.charAt(0).toUpperCase() + _.substring(1); - if (S[_]) { - const h = S[_]; - typeof h == "object" && Object.keys(h).forEach((F) => { - s.indexOf(F) < 0 && (s += F); - const le = h[F]; - let W = ""; - if (Object.keys(le).reduce((D, j) => (j == "l" ? D.splice(0, 0, j) : j == "c" ? D.splice(1, 0, j) : j == "r" && D.splice(2, 0, j), D), []).forEach((D) => { - const j = le[D]; - W += "&" + D.toUpperCase(), j.styleId && M[j.styleId] && (W += M[j.styleId]), j.text && (W += j.text); - }), W = "<" + F + A + ">" + W + "", F == "odd") - g += W; - else if (F == "even") - d += W; - else if (F == "first") - f += W; - else - throw "type error"; - }); - } - }), Pe = g + d + f, Pe.length > 0) { - je = !0; - const _ = s.length == 7 || s.length == 12 ? ' differentOddEven="1"' : "", A = s.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; - Pe = "" + Pe + ""; - } - } - if (i.viewOption) { - let S = ""; - const s = i.viewOption; - s.type && (Ae = s.type), s.hideRuler && (Ee += ' showRuler="0" '), s.hideGrid && (Ee += ' showGridLines="0" '), s.hideHeadlines && (Ee += ' showRowColHeaders="0" '); - let g = s.splitOption; - if (typeof g > "u" && (je = !1, typeof s.frozenOption == "object")) { - const d = s.frozenOption; - if (S = ' state="frozen" ', d.type == "R" || d.type == "ROW") { - let f; - typeof d.index == "object" ? f = d.index.r : f = d.index, g = { - startAt: { - b: "A" + (f + 1) - }, - type: "H", - split: f - }; - } else if (d.type == "C" || d.type == "COLUMN") { - let f; - typeof d.index == "object" ? f = d.index.c : f = d.index, f > n.length - 1 && (n = Me(n, f)), g = { - type: "V", - startAt: { - r: n[f] + 1 - }, - split: f - }; - } else if (d.type == "B" || d.type == "BOTH") { - let f = "", I; - typeof d.index == "number" ? (I = d.index, f = n[d.index] + (d.index + 1)) : (I = { - y: d.index.r, - x: d.index.c - }, f = n[d.index.c] + (d.index.r + 1)), g = { - startAt: { - two: f - }, - type: "B", - split: I - }; - } - } - if (g) - if (g.type == "H" || g.type == "HORIZONTAL") { - let d; - g.startAt && (d = g.startAt.b, g.startAt.t && (Ee += ' topLeftCell="' + g.startAt.t + '"')), d || (d = "A1"), Te = '"; - } else if (g.type == "V" || g.type == "VERTICAL") { - let d; - g.startAt && (d = g.startAt.r, g.startAt.l && (Ee += ' topLeftCell="' + g.startAt.l + '"')), d || (d = "A1"), Te = '"; - } else { - let d; - g.startAt && (d = g.startAt.two, g.startAt.one && (Ee += ' topLeftCell="' + g.startAt.one + '"')), d || (d = "A1"), Te = '"; - } - } - if (je && (Ae = "pageLayout"), i.checkbox) { - Ue = !0; - const S = ye.checkbox; - i.checkbox.forEach((s, g) => { - let d = S; - if (s.link) { - let F = Re(s.link, n); - d = d.replace( - "**fmlaLink**", - 'fmlaLink="$' + n[F.col] + "$" + (F.row + 1) + '"' - ); - } else - d = d.replace("**fmlaLink**", ""); - s.mixed ? d = d.replace("**value**", 'checked="Mixed"') : s.checked ? d = d.replace("**value**", 'checked="Checked"') : d = d.replace("**value**", ""), s.threeD && d.replace('noThreeD="1"', ""), ae.push(d), ve++; - let f = E + "" + ve++; - const I = "_x0000_s" + f; - ht += we.checkbox.replace("***id***", I).replace("***text***", s.text); - let _ = s.startStr, A = s.endStr, h = { - start: { - col: 0, - row: 0 - }, - end: { - col: 1, - row: 1 - } - }; - if (s.col && s.row && (h = { - start: { - col: s.col, - row: s.row - 1 - }, - end: { - col: s.col, - row: s.row - } - }), typeof _ == "string" && _.length >= 2) { - let F = Re(_, n); - h.start = { - ...F - }, h.end = { - col: F.col + 1, - row: F.row + 1 - }; - } - if (typeof A == "string" && A.length >= 2) { - let F = Re(A, n); - F.row += 1, F.col += 1, h.end = { - ...F - }; - } - yt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ut += '', pt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + s.text + ""; - }); - } - let Je; - if (i.backgroundImage) { - b == null && (b = m == null ? void 0 : m.folder("media")); - const S = i.backgroundImage; - Je = new Promise(async (s, g) => { - let d = S.lastIndexOf("."), f; - d > 0 ? (f = S.substring(d + 1).toLowerCase(), f.length > 4 && (f.indexOf("gif") >= 0 ? f = "gif" : f.indexOf("jpg") >= 0 ? f = "jpg" : f.indexOf("jpeg") >= 0 ? f = "jpeg" : f = "png")) : f = "png"; - const I = J++, _ = "image" + I + "." + f, A = await Pt(S, _, o, e.fetch); - A || g("image not load"), Ce.push(f), s({ - name: _, - type: f, - image: A, - ref: I - }); - }); - } - let Qe; - if (i.images && (b == null && (b = m == null ? void 0 : m.folder("media")), Qe = Promise.all([ - ...i.images.map(async (S, s) => { - let g = S.url.lastIndexOf("."), d; - g > 0 ? (d = S.url.substring(g + 1).toLowerCase(), d.length > 4 && (d.indexOf("gif") >= 0 ? d = "gif" : d.indexOf("jpg") >= 0 ? d = "jpg" : d.indexOf("jpeg") >= 0 ? d = "jpeg" : d = "png")) : d = "png", Ce.push(d); - const f = "image" + J++ + "." + d; - return { - type: d, - image: await Pt(S.url, f, o, e.fetch), - obj: S, - i: s, - name: f - }; - }) - ])), Array.isArray(i.headers) && i.headers.length) { - const S = i.headers.length; - let s = ""; - if (i.title) { - const f = i.title, I = f.comment, _ = f.shiftTop && f.shiftTop >= 0 ? f.shiftTop : 0, A = i.shiftLeft && i.shiftLeft >= 0 ? i.shiftLeft : 0, h = f.shiftLeft && f.shiftLeft + A >= 0 ? f.shiftLeft + A : A, F = f.consommeRow ? f.consommeRow - 1 : 1, le = f.consommeCol ? f.consommeCol : S, W = F == 0 && typeof f.height == "number" ? ' ht="' + f.height + '" customHeight="1" ' : "", D = f.styleId ? f.styleId : "titleStyle", j = n[h] + "" + (O + _); - if (xe.push( - j + ":" + n[h + le - 1] + (O + F + _) - ), typeof I < "u") { - Ie = !0; - const ee = nt( - I, - B.commentSyntax.value, - c - ); - let fe = pe.length; - if (ee.hasAuthor && typeof ee.author < "u") { - let Q = ee.author.toString(); - const re = pe.indexOf(Q); - re < 0 ? pe.push(Q) : fe = re; - } - Ne.push({ - row: O + _ - 1, - col: h - }), He += lt( - j, - ee.commentStr, - ee.commentStyle, - fe - ); - } - typeof f.text == "string" && (x[O + _] = { - startTag: '', - details: '' + $ + "", - endTag: "" - }, s += '', s += '' + $ + "", s += "", $++, H[f.text] = f.text, f.multiStyleValue ? R += at( - f.multiStyleValue, - f.text, - B.commentSyntax.value, - D, - i.useSplitBaseOnMatch - ) : R += "" + De(f.text) + ""), O += _ + F + 1; - } - let g = i.headerStyleKey ? i.headerStyleKey : null, d = 0; - if (typeof i.shiftLeft == "number" && i.shiftLeft >= 0 && (d = i.shiftLeft), se && (N += '', de || (de = m == null ? void 0 : m.folder("tables"))), U.start = n[d] + "" + O, U.end = n[d + i.headers.length - 1] + "" + (O + i.data.length), i.headers.forEach((f, I) => { - if (se && (N += ''), d && (I += d), f.formula && Ge.push(I), f.conditionalFormatting && Xe.push(I), gt.push(f.label), i.mergeRowDataCondition && typeof i.mergeRowDataCondition == "function" && i.mergeRowDataCondition( - f, - null, - I, - !0 - ) === !0 && (ke[n[I]] = { - inProgress: !0, - start: O - }), i.styleCellCondition && typeof i.styleCellCondition == "function" && (g = i.styleCellCondition( - f, - f, - O, - I, - !0, - v - ) || g), f.size && f.size > 0 && (X += ''), i.withoutHeader) - return; - const _ = n[I] + "" + O; - if (typeof i.commentCondition == "function") { - const h = i.commentCondition( - f, - null, - f.label, - O, - I, - !0 - ); - (typeof h == "string" || typeof h == "object" && h != null) && (f.comment = h); - } - if (f.comment) { - Ie = !0; - const h = nt( - f.comment, - B.commentSyntax.value, - c - ); - let F = pe.length; - if (h.hasAuthor && typeof h.author < "u") { - let le = h.author.toString(); - const W = pe.indexOf(le); - W < 0 ? pe.push(le) : F = W; - } - Ne.push({ - row: O - 1, - col: I - }), He += lt( - _, - h.commentStr, - h.commentStyle, - F - ); - } - const A = ue && ue[_]; - if (A) { - const h = rt( - _, - A, - C, - e.styles - ); - h.needCalcChain && (ge = !0, ie += h.chainCell), w += h.cell, delete ue[_]; - } else { - if (w += '' + $ + "", typeof i.multiStyleCondition == "function") { - const h = i.multiStyleCondition( - f, - null, - f.label, - O, - I, - !0 - ); - h && (f.multiStyleValue = h); - } - f.multiStyleValue ? R += at( - f.multiStyleValue, - f.text, - B.commentSyntax.value, - g || "", - i.useSplitBaseOnMatch - ) : R += "" + De(f.text) + "", H[f.text] = f.text, $++; - } - }), se && (N += ""), i.withoutHeader) - w += s; - else { - const f = ' I + " " + _ + '="' + i.headerRowOption[_] + '" ', " ") : "") + ">"; - x[O] = { - startTag: f, - endTag: "", - details: w - }, w = s + f + w + "", O++; - } - if (Array.isArray(i.data)) { - const f = i.mapSheetDataOption && i.mapSheetDataOption.outlineLevel ? i.mapSheetDataOption.outlineLevel : "outlineLevel", I = i.mapSheetDataOption && i.mapSheetDataOption.hidden ? i.mapSheetDataOption.hidden : "hidden", _ = i.mapSheetDataOption && i.mapSheetDataOption.height ? i.mapSheetDataOption.height : "height", A = i.data.length; - i.data.forEach((h, F) => { - if (h.mergeType) - for (let j = 0; j < h.mergeType.length; j++) { - const ee = h.mergeType[j], fe = h.mergeStart[j], Q = h.mergeValue[E]; - let re = ""; - ee == "both" ? re = n[fe] + "" + O + ":" + n[fe + Q[1]] + (O + Q[0]) : ee == "col" ? re = n[fe] + "" + O + ":" + n[fe + Q[0]] + O : re = n[fe] + "" + O + ":" + n[fe] + (O + Q[0]), xe.push(re); - } - const le = h.rowStyle, W = '", - details: D - }, O++, w += ""; - }), i.sortAndFilter && (i.sortAndFilter.mode == "all" ? ce += '' : typeof i.sortAndFilter.ref == "string" && i.sortAndFilter.ref.length > 0 && (ce += '')); - } - if (Ge.length > 0 && Ge.forEach((f) => { - const I = i.shiftLeft ? i.shiftLeft : 0, _ = i.headers[f - I], A = n[f]; - ue[A + "" + O] = { - start: i.withoutHeader ? A + "1" : A + "2", - end: A + "" + (O - 1), - type: _.formula.type, - ..._.formula.styleId ? { styleId: _.formula.styleId } : {} - }; - }), Xe.length > 0 && Xe.forEach((f) => { - const I = i.headers[f]; - I.conditionalFormatting && We.push({ - ...I.conditionalFormatting, - start: i.withoutHeader ? n[f] + "1" : n[f] + "2", - end: n[f] + "" + (O - 1) - }); - }), ue) { - const f = Object.keys(ue).sort( - (I, _) => I > _ ? 1 : -1 - ); - if (f.length) { - let I = {}; - f.forEach((_) => { - const A = rt( - _, - ue[_], - C, - e.styles - ); - A.needCalcChain && (ge = !0, ie += A.chainCell), I[A.row] ? I[A.row] += A.cell : I[A.row] = A.cell; - }), Object.keys(I).forEach((_) => { - const A = _, h = I[A]; - let F = x[A]; - if (F) { - const le = F.startTag + F.details + h + F.endTag; - let W = new RegExp(F.startTag + "[\\n\\s\\S]*?"); - w = w.replace(W, le); - } else - w += '' + h + "", x[A] = { - startTag: '', - endTag: "", - details: h - }; - }); - } - } - } - E > 0 && (oe += ''); - const bt = i.name ? i.name : "sheet" + (E + 1), Vt = i.state ? i.state : "visible"; - Z += '', q += '', K += "" + ("sheet" + (E + 1)) + "", i.selected && (G = !0, Y = E); - const Ct = i.sortAndFilter ? 'filterMode="1"' : ""; - let vt = -1; - Je && await Je.then((S) => { - let s = S; - vt = s.ref, b == null || b.file(s.name, s.image); - }); - let Be = !1, et = "", wt = ""; - Qe && (Be = !0, await Qe.then((S) => { - let s = ""; - S.forEach((g, d) => { - const f = d + 1; - let I = g.image; - const _ = g.name; - let A = g.obj.from, h = g.obj.to, F = g.obj.margin; - g.type; - let le = g.obj.type, W = g.obj.extent; - typeof W > "u" && (W = { - cx: 2e5, - cy: 2e5 - }); - let D = { - start: { - col: 0, - row: 0, - mL: 0, - mT: 0 - }, - end: { - col: 1, - row: 1, - mR: 0, - mB: 0 - } - }; - if (typeof A == "string" && A.length >= 2) { - let j = Re(A, n); - D.start = { - ...j - }, D.end = { - col: j.col + 1, - row: j.row + 1 - }; - } - if (typeof h == "string" && h.length >= 2) { - let j = Re(h, n); - j.row += 1, j.col += 1, D.end = { - ...j - }; - } - D.end.mR = 0, D.end.mB = 0, D.start.mL = 0, D.start.mT = 0, F && ((F.all || F.right) && (D.end.mR = F.all || F.right), (F.all || F.bottom) && (D.end.mB = F.all || F.bottom), (F.all || F.left) && (D.start.mL = F.all || F.left), (F.all || F.top) && (D.start.mT = F.all || F.top)), le == "one" ? et += "" + D.start.col + "" + D.start.mT + "" + D.start.row + "" + D.start.mL + '' : et += '' + D.start.col + "" + D.start.mT + "" + D.start.row + "" + D.start.mL + "" + D.end.col + "" + D.end.mB + "" + D.end.row + "" + D.end.mR + '', b == null || b.file(_, I), s += ''; - }), wt = ` -` + s + ""; - })), xe = [...new Set(xe)]; - let Tt = "", _e = 1; - We.length > 0 && (Tt = We.reduce((S, s) => { - if (s.type == "cells") - return s.operator == "ct" ? S + 'NOT(ISERROR(SEARCH("' + s.value + '",' + s.start + ")))" : typeof s.operator > "u" || typeof r[s.operator] > "u" ? S : S + '' + (Array.isArray(s.value) ? s.value.reduce((g, d) => g + "" + d.value + "", "") : "" + s.value + "") + ""; - if (s.type == "top") - return S + '"; - if (s.type == "iconSet") { - let g = ""; - return typeof s.operator > "u" ? S : (s.operator.indexOf("5") == 0 ? g = '' : s.operator.indexOf("4") == 0 ? g = '' : g = '', S + '' + g + ""); - } else return s.type == "colorScale" ? S + '' + (s.operator == "percentile" ? '' : "") + '' + (s.colors && Array.isArray(s.colors) ? s.colors.reduce((g, d) => g + '', "") : '') + "" : s.type == "dataBar" ? S + '' + (s.colors && Array.isArray(s.colors) ? s.colors.reduce((g, d) => g + '', "") : '') + "" : S; - }, "")), (Ue || Ie || Be) && P == null && (P = m == null ? void 0 : m.folder("drawings")), Be && T == null && (T = P == null ? void 0 : P.folder("_rels")), k["sheet" + (E + 1)] = { - indexId: z + 1, - key: "sheet" + (E + 1), - sheetName: bt, - sheetDataTableColumns: N, - backgroundImageRef: vt, - sheetDimensions: U, - asTable: se || !1, - sheetDataString: w, - sheetBreakLine: Ze, - viewType: Ae, - hasComment: Ie, - drawersContent: et, - cFDataString: Tt, - sheetMargin: xt, - sheetHeaderFooter: Pe, - isPortrait: je, - drawersRels: wt, - hasImages: Be, - hasCheckbox: Ue, - formRel: ut, - checkboxDrawingContent: pt, - checkboxForm: ae, - checkboxSheetContent: yt, - checkboxShape: ht, - commentString: He, - commentAuthor: pe, - shapeCommentRowCol: Ne, - splitOption: Te, - sheetViewProperties: Ee, - sheetSizeString: X.length > 0 ? "" + X + "" : "", - protectionOption: i.protectionOption ? Object.keys(i.protectionOption).reduce((S, s) => S + " " + s + '="' + i.protectionOption[s] + '" ', "" : "", - merges: xe.length > 0 ? xe.reduce((S, s) => S + ' ', '') + " " : "", - selectedView: !!i.selected, - sheetSortFilter: ce, - tabColor: i.tabColor ? '' : "' - }, z++; - } - ge && (z++, q += '', m == null || m.file( - "calcChain.xml", - ` -` + ie + "" - )); - let Yt = Object.keys(k), Ye = p.folder("_rels"); - Ye == null || Ye.file( - ".rels", - ` - ` - ); - let Oe = p.folder("docProps"); - Oe == null || Oe.file( - "core.xml", - ` -` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" - ), Oe == null || Oe.file("app.xml", Qt(a, K)), m == null || m.file( - "workbook.xml", - ` - ` + (G ? '' : "") + " " + Z + " " - ), m == null || m.file( - "sharedStrings.xml", - ` - ' + R + "" - ); - let Ve = m == null ? void 0 : m.folder("_rels"); - Ve == null || Ve.file( - "workbook.xml.rels", - ` - ` + q + " " - ); - let ze = m == null ? void 0 : m.folder("theme"); - ze == null || ze.file( - "theme1.xml", - ` -` - ); - let Fe = m == null ? void 0 : m.folder("worksheets"), mt = [], dt = [], Le = []; - if (Yt.forEach((E, i) => { - const C = k[E]; - let x = "", U = { - form: !1, - drawing: !1, - vmlDrwing: !1, - comment: !1, - table: !1, - sheetDrawingsPushed: !1 - }; - const se = C.sheetDataTableColumns; - if (se.length > 0) { - dt.push("table" + (i + 1) + ".xml"); - const w = C.asTable, X = C.sheetDimensions; - de == null || de.file( - "table" + (i + 1) + ".xml", - ` -' + se + '
' - ), x += ''; - } - const N = "drawing" + (Le.length + 1) + ".xml"; - if (C.hasImages && (Le.push(N), U.sheetDrawingsPushed = !0, T == null || T.file( - N + ".rels", - C.drawersRels.toString() - ), U.drawing = !0, x += ''), C.hasCheckbox && (U.sheetDrawingsPushed || Le.push(N), x += '' + (U.drawing ? "" : ''), U.drawing = !0, U.vmlDrwing = !0, x += C.formRel), (C.hasCheckbox || C.hasImages) && (P == null || P.file( - N, - ` -` + (C.hasImages ? C.drawersContent : "") + (C.hasCheckbox ? C.checkboxDrawingContent : "") + "" - )), C.hasComment) { - mt.push(i + 1); - let w = C.commentAuthor; - m == null || m.file( - "comments" + (i + 1) + ".xml", - ` -` + (Array.isArray(w) && w.length > 0 ? w.reduce( - (X, ce) => X + "" + ce + "", - "" - ) : "") + "" + C.commentString + "" - ), x += '' + (U.vmlDrwing ? "" : ''); - } - if ((C.hasComment || C.hasCheckbox) && (P == null || P.file( - "vmlDrawing" + (i + 1) + ".vml", - '' + (C.hasCheckbox ? Se.checkbox + C.checkboxShape : "") + (C.hasComment ? ' ' + C.shapeCommentRowCol.reduce((w, X) => w + `", "") : "") + "" - )), C.backgroundImageRef > 0 && (x += ''), C.hasImages || C.hasComment || C.hasCheckbox || se.length > 0 || C.backgroundImageRef > 0) { - const w = Fe == null ? void 0 : Fe.folder("_rels"); - w == null || w.file( - "sheet" + (i + 1) + ".xml.rels", - ` - ` + x + "" - ); - } - let O = ""; - C.selectedView || C.splitOption ? O = ' 0 ? ' view="' + C.viewType + '"' : "") + ' workbookViewId="0">' + C.splitOption + (C.selectedView ? '' : "") + "" : O = ' 0 ? ' view="' + C.viewType + '"' : "") + "/>", Fe == null || Fe.file( - C.key + ".xml", - ` -` + C.tabColor + O + '' + C.sheetSizeString + "" + C.sheetDataString + "" + C.protectionOption + C.sheetSortFilter + C.merges + C.cFDataString + (C.hasImages || C.hasCheckbox ? '' : "") + (C.hasComment || C.hasCheckbox ? '' : "") + (C.hasCheckbox ? '' + C.checkboxSheetContent + "" : "") + C.sheetMargin + (C.isPortrait || C.sheetBreakLine.length > 0 ? '' : "") + C.sheetBreakLine + C.sheetHeaderFooter + (C.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" - ); - }), ae.length > 0) { - let E = m == null ? void 0 : m.folder("ctrlProps"); - ae.forEach((i, C) => { - E == null || E.file("ctrlProp" + (C + 1) + ".xml", i); - }); - } - if (p.file( - "[Content_Types].xml", - Jt( - oe, - mt, - [...new Set(Ce)], - Le, - ae, - ge, - dt - ) - ), o) - return p.generateAsync({ - type: e.generateType ? e.generateType : "nodebuffer" - }).then((E) => E); - if (e.notSave) - return p.generateAsync({ type: "blob" }).then((E) => E.slice( - 0, - E.size, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - )); - p.generateAsync({ type: "blob" }).then(function(E) { - import("./FileSaver.min-Di4lMG3c.js").then((i) => i.F).then((i) => { - const { saveAs: C } = i; - C( - E, - (e.fileName ? e.fileName : "tableRecord") + ".xlsx" - ); - }); - }); -} -function lo(e) { - const t = e.length; - let l = 0, o = {}, r = {}, n = {}; - for (let a = 0; a < t; a++) { - const m = e[a], b = m.length; - let P = {}; - for (let T = 0; T < b; T++) { - l++; - const v = m[T]; - let c; - v.sheetName ? c = v.sheetName : c = "Sheet 1", c in o || (o[c] = { - headers: [], - data: [], - labelCounter: 0, - seenAt: a - }), c in r || (r[c] = { - index: a, - value: 0 - }), c in n || (o[c].labelCounter = 0, n[c] = !0); - let L = []; - const M = o[c].headers.length; - let V = {}, B = o[c].seenAt == a, oe = v.headers.reduce((q, H, k) => (o[c].labelCounter++, M < o[c].labelCounter && L.push({ - label: "c" + o[c].labelCounter, - text: B ? H.text : "" - }), V["c" + o[c].labelCounter] = H.text, { - ...q, - [H.label]: "c" + o[c].labelCounter - }), {}); - if (o[c].headers.push(...L), v.spaceX) - for (let q = 0; q < v.spaceX; q++) - o[c].labelCounter++, M <= o[c].labelCounter && o[c].headers.push({ - label: "c" + o[c].labelCounter, - text: "" - }); - r[c].index + 1 == a && (P[c] = r[c].value); - let R = P[c] || 0; - R > 0 && (!o[c].headerIndex || o[c].headerIndex && o[c].headerIndex != R ? o[c].data.push(V) : o[c].data[R] = { - ...o[c].data[R], - ...V - }, o[c].headerIndex = R, R++); - let $ = Object.keys(oe), Z = v.data.length >= o[c].data.length; - if (o[c].data = v.data.reduce((q, H, k) => { - let K = {}; - return q.length > k + R ? K = q[k + R] : q.push(K), $.forEach((z) => { - let G = oe[z]; - K[G] = H[z] ? H[z] : ""; - }), K.tableIndex = l, K.tableStringIndex = k + "," + T, q[k + R] = K, q; - }, o[c].data), Z && v.spaceY) { - const q = o[c].headers.length; - for (let H = 0; H < v.spaceY; H++) { - let k = {}; - for (let K = 0; K < q; K++) { - const z = o[c].headers[K]; - k[z.label] = ""; - } - o[c].data.push(k); - } - } - r[c] = { - value: Math.max(o[c].data.length, r[c].value), - index: a - }; - } - n = {}; - } - let u = Object.keys(o), y = []; - return u.reduce( - (a, m) => { - let b = o[m]; - return a.sheet.push({ - ...b, - name: m - }), a; - }, - { sheet: y } - ); -} -function st(e) { - return /^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e); -} -function ct(e) { - return /^[A-Z]+[1-9][1-9]*$/.test(e); -} -const ao = { - fontFamily: { - mode: "TYPE_CHECK", - type: "string" - }, - type: { - mode: "TYPE_CHECK", - type: "string" - }, - size: { - mode: "TYPE_CHECK", - type: "number" - }, - index: { - mode: "TYPE_CHECK", - type: "number" - }, - alignment: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - return t.rtl && t.ltr && o && console.warn("Alignment-rtl and ltr cannot be used together."), (t.readingOrder && t.ltr || t.readingOrder && t.rtl) && o && console.warn( - "Alignment-readingOrder cannot be used with rtl or ltr." - ), !0; - } - }, - border: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - const r = ["full", "top", "left", "right", "bottom"], n = [ - "slantDashDot", - "dotted", - "thick", - "hair", - "dashDot", - "dashDotDot", - "dashed", - "thin", - "mediumDashDot", - "medium", - "double", - "mediumDashed" - ]; - return Object.keys(t).forEach((y) => { - const p = y; - if (r.indexOf(p) < 0) - throw 'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."'; - const a = t[p]; - if (!("color" in a)) - throw "border-The border must have a color."; - if (!("style" in a)) - throw "border-The border needs a style."; - if (typeof a.style == "string" && n.indexOf(a.style) < 0) - throw "border-An invalid style has been used."; - }), !0; - } - }, - format: { - mode: "TYPE_CHECK", - type: "string" - }, - bold: { - mode: "TYPE_CHECK", - type: "boolean" - }, - underline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - italic: { - mode: "TYPE_CHECK", - type: "boolean" - }, - doubleUnderline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - color: { - mode: "TYPE_CHECK", - type: "string" - }, - backgroundColor: { - mode: "TYPE_CHECK", - type: "string" - } -}, io = { - notSave: { - mode: "TYPE_CHECK", - type: "boolean" - }, - creator: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - backend: { - mode: "TYPE_CHECK", - type: "boolean" - }, - activateConditionalFormatting: { - mode: "TYPE_CHECK", - type: "boolean" - }, - fileName: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - generateType: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["nodebuffer", "array", "binarystring", "base64"] - }, - addDefaultTitleStyle: { - mode: "TYPE_CHECK", - type: "boolean" - }, - created: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - modified: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - numberOfColumn: { - mode: "TYPE_CHECK", - type: "number", - min: 26 - }, - createType: { - mode: "TYPE_CHECK", - type: "string" - }, - styles: { - mode: "TYPE_CHECK", - type: "object" - }, - sheet: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - } -}, so = { - headers: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - data: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - withoutHeader: { - mode: "TYPE_CHECK", - type: "boolean" - }, - mapSheetDataOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - const r = Object.keys(t), n = ["outlineLevel", "hidden", "height"]; - return r.forEach((u) => { - n.indexOf(u) < 0 && o && console.warn( - 'The Schema of mapSheetDataOption does not include the "' + u + '" property.' - ); - }), !0; - } - }, - backgroundImage: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - conditionalFormatting: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, l, o) { - return Array.isArray(t) && t.forEach((r) => { - if (r.type == "cells") { - const n = ["lt", "gt", "between", "ct", "eq"]; - if (!r.operator || !r.start || !r.end || typeof r.value > "u") - throw { - record: r, - error: "The object is not complete; you need to fill in the values for operator, start, end and value." - }; - if (n.indexOf(r.operator) < 0) - throw { record: r, error: "The operator is not valid." }; - } else if (r.type == "top") { - const n = ["belowAverage", "aboveAverage"]; - if (!r.start || !r.end || typeof r.value > "u") - throw { - record: r, - error: "The object is not complete; you need to fill in the values for start, end and value." - }; - if (r.operator && n.indexOf(r.operator) < 0) - throw { record: r, error: "The operator is not valid." }; - } else if (r.type == "iconSet") { - if (!r.operator || !r.start || !r.end) - throw { - record: r, - error: "The object is not complete; you need to fill in the values for operator, start and end" - }; - } else if (r.type == "colorScale") { - if (!r.start || !r.end) - throw { - record: r, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else if (r.type == "dataBar") { - if (!r.start || !r.end) - throw { - record: r, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else - throw 'Property "type" is not valid.'; - }), !0; - } - }, - multiStyleCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - useSplitBaseOnMatch: { - mode: "TYPE_CHECK", - type: "boolean" - }, - convertStringToNumber: { - mode: "TYPE_CHECK", - type: "boolean" - }, - images: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, l, o) { - if (Array.isArray(t)) { - const r = ["one", "two"]; - t.forEach((n) => { - if (typeof n.src != "string") - throw '"src" property is required.'; - if (typeof n.from != "string" || n.from.length == 0) - throw '"from" property is required.'; - if (n.to && !ct(n.to)) - throw 'value of "to" is not valid.'; - if (n.from && !ct(n.from)) - throw 'value of "from" is not valid.'; - if (r.indexOf(n.type) < 0) - throw 'Type of "type" is not valid in the "images" property.'; - if (n.type == "two" && !n.to) - throw '"to" property is empty. for "two" type "to" property is required.'; - }); - } - return !0; - } - }, - formula: { - mode: "TYPE_CHECK", - type: "object" - }, - pageOption: { - mode: "TYPE_CHECK", - type: "object" - }, - name: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - title: { - mode: "TYPE_CHECK", - type: "object" - }, - shiftTop: { - mode: "TYPE_CHECK", - type: "number", - min: 0 - }, - shiftLeft: { - mode: "TYPE_CHECK", - type: "number" - }, - selected: { - mode: "TYPE_CHECK", - type: "boolean" - }, - tabColor: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - merges: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, l, o) { - if (Array.isArray(t)) { - let r = []; - if (t.forEach((n) => { - st(n) || r.push( - "The " + n + ' reference is not valid in the "merges" property.' - ); - }), r.length > 0) - throw r; - } - return !0; - } - }, - headerStyleKey: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - mergeRowDataCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - styleCellCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - commentCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - sortAndFilter: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - if (typeof t == "object") { - const r = ["all", "ref"]; - if (!t.mode) - throw '"mode" is required in sortAndFilter'; - if (r.indexOf(t.mode) < 0) - throw '"mode" is not valid'; - if (t.mode == "ref") - if (t.ref) { - if (!st(t.ref)) - throw '"ref" is not valid'; - } else - throw '"ref" is must need be defined.'; - } - return !0; - } - }, - state: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["hidden", "visible"] - }, - headerRowOption: { - mode: "TYPE_CHECK", - type: "object" - // Adjust according to the expected type for headerRowOption - }, - protectionOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - const r = [ - "sheet", - "formatCells", - "formatColumns", - "formatRows", - "insertColumns", - "insertRows", - "insertHyperlinks", - "deleteColumns", - "deleteRows", - "sort", - "autoFilter", - "pivotTables" - ], n = ["0", "1", 0, 1]; - return Object.keys(t).forEach((y) => { - const p = t[y]; - if (r.indexOf(y) < 0) - throw '"' + y + '" is not valid.'; - if (n.indexOf(p) < 0) - throw 'value of "' + y + '" is not valid'; - }), !0; - } - }, - headerHeight: { - mode: "TYPE_CHECK", - type: "number", - min: 1 - }, - checkbox: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, l, o) { - if (Array.isArray(t)) - t.forEach((r) => { - if (!r.col || !r.row) - throw '"checkbox" is not complete'; - }); - else - throw 'Type of "checkbox" property is not valid'; - return !0; - } - }, - viewOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, l, o) { - const r = ["pageLayout", "pageBreakPreview"]; - if (t.type && r.indexOf(t.type) < 0) - throw 'Type of "type" property is not valid'; - return !0; - } - }, - rtl: { - mode: "TYPE_CHECK", - type: "boolean" - }, - pageBreak: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - }, - asTable: { - mode: "TYPE_CHECK", - type: "object" - } -}; -function Kt(e, t = !0, l = !0) { - Object.keys(e).forEach((r) => { - const n = e[r], u = Object.keys(n); - if (n.format && !Nt[n.format]) - throw 'The "' + n.format + '" format that has been used is not defined.'; - n.underline && n.doubleUnderline, u.forEach((y) => { - let p = n[y]; - const a = ao[y]; - if (qe(p, a, y, t, l)) - return !0; - }); - }); -} -function Mt(e, t = !0, l = !0) { - Array.isArray(e) || (e = [e]), e.forEach((o) => { - Object.keys(o).forEach((n) => { - const u = o[n], y = so[n]; - qe(u, y, n, t, l); - }); - }); -} -function co(e, t = !0, l = !0) { - Object.keys(e).forEach((r) => { - let n = e[r]; - const u = io[r]; - if (qe(n, u, r, t, l)) - if (r == "sheet") - if (Array.isArray(n)) - Mt(n); - else - throw "Sheet must be Array."; - else r == "styles" && Kt(n); - }); -} -function qe(e, t, l, o, r) { - if (t) { - if (typeof e != t.type) { - if (t.type == "object" || t.type == "string" || o) - throw 'The Type of The "' + l + '" is not valid'; - r && console.warn("The property type must be " + t.type); - } - if (t.isEnum && t.enum.indexOf(e) < 0) - throw 'The value of "' + l + '" must be ' + JSON.stringify(t.enum); - if (t.min && e < t.min) - throw 'The value of "' + l + '" must be higher than ' + t.min; - if (t.notEmpty && (!e || e.length <= 0)) - throw 'The value of "' + l + '" must not be empty.'; - if (t.isArray && !Array.isArray(e)) - throw 'The value of "' + l + '" should be an array.'; - return typeof t.validateFunction == "function" && t.validateFunction(l, e, o, r), !0; - } else - return r && console.warn( - 'The Schema Object does not include the "' + l + '" property.' - ), !1; -} -const fo = { - checkSheetValidWithOneRef: ct, - checkSheetValidWithTwoRef: st, - generalValidationCheck: qe -}, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - exportedForTesting: fo, - validateExcelTableObjectFunction: co, - validateSheetArrayFunction: Mt, - validateStyleObjectFunction: Kt -}, Symbol.toStringTag, { value: "Module" })); -function jt(e) { - if (typeof e > "u" || e == null) - return ""; - typeof e != "string" && (e = String(e)); - let t = e, l = !1; - return e.indexOf('"') >= 0 && (t = t.replace(/"/g, '""'), l = !0), e.indexOf(",") >= 0 && (l = !0), l && (t = '"' + t + '"'), t; -} -function mo(e) { - return e ? " " : ","; -} -function Rt(e, t) { - return e.substring(0, e.length - t) + ` -`; -} -async function qt(e, t = !1, l = !1) { - const o = mo(l), r = l ? ".txt" : ".csv", n = o.length; - let u = []; - if (e.sheet.forEach((p) => { - let a = "", m = ""; - const b = p.headers; - let P = [], T = b.length; - for (let v = 0; v < T; v++) { - const c = b[v]; - P.push(c.label), p.withoutHeader || (m += jt(c.text) + o); - } - a += Rt(m, n), T = p.data.length; - for (let v = 0; v < T; v++) { - m = ""; - const c = p.data[v]; - P.forEach((L) => { - m += jt(c[L]) + o; - }), a += Rt(m, n); - } - u.push(a); - }), e.backend) - return u; - const y = await import("./FileSaver.min-Di4lMG3c.js").then((p) => p.F).then((p) => p.saveAs); - if (t) { - const p = await import("./jszip.min-DoL7Cu0z.js").then((b) => b.j).then((b) => b.default); - let a = new p(); - u.forEach((b, P) => { - a.file("sheet" + (P + 1) + r, b); - }); - const m = await a.generateAsync({ type: "blob" }).then(function(b) { - return b; - }); - return y( - m, - (e.fileName ? e.fileName : "tableRecord") + ".zip" - ), "done"; - } - u.forEach((p) => { - var a = new Blob([p], { - type: "text/" + (l ? "plain" : "csv") + ";charset=utf-8" - }); - y( - a, - (e.fileName ? e.fileName : "tableRecord") + r - ); - }); -} -const Dt = { - firstHeader: !0, - returnTableNodes: !1, - emptyNodeDefaultString: " ", - removeContainerChildNode: !0, - containerNodeStyle: { - display: "flex", - flexDirection: "column" - }, - tableStyle: { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" - }, - cellStyle: { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" - }, - buttonContainerStyle: { - display: "flex" - }, - buttonStyle: { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" - }, - activeButtonStyle: { - background: "#EEEDEB" - } -}; -async function po(e, t, l, o, r = !0, n = !1, u = " ", y = !0, p = { - display: "flex", - flexDirection: "column" -}, a = { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" -}, m = { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" -}, b = { - display: "flex" -}, P = { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" -}, T = { - background: "#EEEDEB" -}) { - let v = await import("./read-utils-BRep2QN2.js").then( - async (k) => await k.extractExcelData(e, !1, o) - ), c = null; - if (t ? c = document.querySelector(t) : l && (c = l), c == null && !n) - throw "Container Node not found"; - const L = Object.keys(p), M = Object.keys(a), V = Object.keys(m), B = Object.keys(b), oe = Object.keys(P), R = Object.keys(T); - let $ = document.createElement("div"); - B.forEach((k) => { - $.style[k] = b[k]; - }), n || (y && c != null && (c.innerText = ""), L.forEach((k) => { - c.style[k] = p[k]; - }), c.appendChild($)); - let Z = [], q = !1, H = 0; - do { - H++; - const k = v.sheetName.next(); - if (!k.value) - break; - const K = document.createElement("div"); - if (K.style.display = "none", !n) { - const J = document.createElement("button"); - oe.forEach((ye) => { - J.style[ye] = P[ye]; - }), J.addEventListener("click", (ye) => { - const ve = J.getAttribute("data-sheet"), we = c.querySelector( - 'div[data-sheet="' + ve + '"]' - ); - if (we) { - R.forEach((ie) => { - J.style[ie] = T[ie]; - }); - const Se = c.querySelector( - "[data-sheet-button-activate]" - ); - let ae = c.querySelector("[data-sheet-activate]"); - we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { - Se.style[ie] = P[ie]; - }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); - } else - console.error("Sheet content not found!! id is " + ve); - }), J.setAttribute("data-sheet", H + ""), K.setAttribute("data-sheet", H + ""), J.innerText = k.value[1] || k.value[0], $.appendChild(J), c.appendChild(K); - } - let z = r ? "th" : "td"; - const G = document.createElement("table"); - M.forEach((J) => { - G.style[J] = a[J]; - }); - const Y = v.data[k.value[0]] || v.data[k.value[1]], Ce = v.maxLengthOfColumn[k.value[0]] || v.maxLengthOfColumn[k.value[1]]; - if (Array.isArray(Y)) { - const J = Y.length; - for (let ye = 0; ye < J; ye++) { - const ve = Y[ye], we = document.createElement("tr"), Se = Array.isArray(ve); - for (let ae = 0; ae <= Ce; ae++) { - let ie = u; - if (Se) { - const de = ve[ae]; - typeof de == "string" && (ie = de); - } - const ge = document.createElement(z); - V.forEach((de) => { - ge.style[de] = m[de]; - }), ge.innerText = ie, we.appendChild(ge); - } - G.appendChild(we), z = "td"; - } - } - n ? Z.push(G) : (K.appendChild(G), c == null || c.appendChild(K)), q = k.done; - } while (!q); - if (n) - return Z; - { - const k = c.querySelector( - 'div[data-sheet="1"]' - ); - k && (k.style.display = "flex", k.setAttribute("data-sheet-activate", "1")); - const K = c.querySelector( - 'button[data-sheet="1"]' - ); - return K && (R.forEach((z) => { - K.style[z] = T[z]; - }), K.setAttribute("data-sheet-button-activate", "1")), "Done"; - } -} -async function uo(e, t, l = !0, o = "property") { - let r = await import("./read-utils-BRep2QN2.js").then( - async (y) => await y.extractExcelData(e, !1, t) - ), n = {}, u = []; - return Object.keys(r.sheetNameObject).forEach((y) => { - const p = r.sheetNameObject[y], a = r.data[p] || r.data[y], m = r.maxLengthOfColumn[p] || r.maxLengthOfColumn[y]; - for (let T = 0; T <= m; T++) - u[T] = o + (T + 1); - let b = l, P = []; - a.forEach((T) => { - let v = {}; - T.forEach((c, L) => { - typeof c == "string" && (b ? u[L] = c : v[u[L]] = c); - }), b = !1, P.push(v); - }), n = Object.assign(n, { - [p]: P - }); - }), n; -} -const yo = Bt, go = ro; -function xo(e, t, l = {}) { - const o = Xt( - e, - t, - l.keepStyle, - l.rowHeightScaleFunction, - l.colWidthScaleFunction - ); - return ft(o); -} -function bo(e) { - const t = lo(e); - return ft(t); -} -function Co(e, t) { - return ft(Wt(e, t)); -} -function vo(e, t = !1, l) { - return import("./read-utils-BRep2QN2.js").then( - (o) => o.extractExcelData(e, t, l) - ); -} -function wo(e, t = !1) { - return qt(e, t, !1); -} -function To(e, t = !1) { - return qt(e, t, !0); -} -function Eo(e, t, l, o = { ...Dt }) { - return o = { - ...Dt, - ...o - }, po( - e, - t, - l, - o.fetchFunc, - o.firstHeader, - o.returnTableNodes, - o.emptyNodeDefaultString, - o.removeContainerChildNode, - o.containerNodeStyle, - o.tableStyle, - o.cellStyle, - o.buttonContainerStyle, - o.buttonStyle, - o.activeButtonStyle - ); -} -export { - yo as a, - go as b, - to as c, - xo as d, - vo as e, - wo as f, - Re as g, - To as h, - Eo as i, - ft as j, - uo as k, - bo as s, - Co as t, - ho as v -}; diff --git a/dist/index-DnICe6T_.js b/dist/index-DnICe6T_.js new file mode 100644 index 0000000..36f7c0e --- /dev/null +++ b/dist/index-DnICe6T_.js @@ -0,0 +1,44 @@ +System.register("ExcelTable",[],function(Pe,ye){"use strict";return{execute:function(){Pe({d:ho,e:go,f:xo,g:Fe,h:bo,i:Co,j:Be,k:po,r:Ut,s:uo,t:yo});function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Yt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=Yt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function ce(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function de(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=ce(e);e=r||""}return e.replace(/^#/,"")}function Vt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:Vt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},zt=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mm.j)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await ye.import("./FileSaver.min-DXmtgrTw.js").then(f=>f.F)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Wt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Gt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=ce(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=ce(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=ce(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=ce(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=ce(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let X=ce(P.backgroundColor);!X&&Z&&(X=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...X?{backgroundColor:X}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),q=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...q?{rowspan:q}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((X,K)=>{if("c"+(K+B)in N)for(let M=0;M<=j+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(X,null);if(X.getAttribute("colspan")||X.getAttribute("rowspan")){let M=Wt(X.getAttribute("colspan")*1,X.getAttribute("rowspan")*1,K,j,N,X.textContent,oe,N);u.length{u.length500,...isNaN(q)?{}:{size:q},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=X.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length +`+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` +`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u.curr=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Jt(e,t){return` +Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` +`;return}u>0&&(m=' xml:space="preserve"',l+=` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=Qt,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",fe="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(W!="-"||fe!="Regular")&&(C='&"'+W+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=de(x.color,o),W=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` +`};let we=1024;const Te={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},ke={checkbox:` + + + + `};let ae=[],ie="",xe=!1,pe=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",fe="",Ee="",Se="",je="",nt=!1,_t="",It="",Pt="",jt="",be=Object.assign([],a.merges),ue=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,he=[],Me="",qe=[],Rt=[],at=[],it=[],Oe={},De="",Le=!1,st="";if(a.rtl&&(Se+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){je="pageBreakPreview";const i=T.row.length;st+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){je="pageBreakPreview";const i=T.column.length;st+=''+T.column.reduce((y,p)=>y+'',"")+""}}let Dt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Le=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Dt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(je=i.type),i.hideRuler&&(Se+=' showRuler="0" '),i.hideGrid&&(Se+=' showGridLines="0" '),i.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Le=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Se+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Ee='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Se+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Se+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Ee='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const T=ge.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=Fe(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),we++;let c=w+""+we++;const _="_x0000_s"+c;It+=Te.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=Fe(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Fe(A,l);O.row+=1,O.col+=1,h.end={...O}}jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Pt+='',_t+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;ct=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=J++,F="image"+_+"."+c,A=await bt(T,F,o,e.fetch);A||y("image not load"),ve.push(c),i({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const c="image"+J+++"."+p;return{type:p,image:await bt(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(be.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let me=he.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=he.indexOf(ee);re<0?he.push(ee):me=re}qe.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,me)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,R):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',pe||(pe=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Rt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Oe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=he.indexOf(le);V<0?he.push(le):O=V}qe.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(xe=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const N=x.border;let O="";if(typeof N=="object"&&((N.left||N.full)&&(O+=''),(N.right||N.full)&&(O+=''),(N.top||N.full)&&(O+=''),(N.bottom||N.full)&&(O+=''),U.borderIndex=E.border.count,E.border.count++,E.border.value+=""+O+""),x.format){const w=l[x.format];w&&(U.formatIndex=w.key,"value"in w&&(E.format.count++,E.format.value+=w.value))}return E.cell.value=E.cell.value+'0?' applyBorder="1" ':"")+(U.fillIndex>0?' applyFill="1" ':"")+(U.fontIndex>=0?' applyFont="1" ':"")+(U.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[i].index=E.cell.count,E.cell.count++,E},{conditionalFormatting:{count:D?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});m==null||m.file("styles.xml",Jt(B,D));let oe='',R="",$=0,Z="",Y="",H={};const S={};let K="",V=4,G=!1,q=-1,ve=[],J=1;const ge={checkbox:` -`};let we=1024;const Te={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Oe={checkbox:` - - - - `};let ie=[],se="",xe=!1,he=null;for(let E=0;E=0?i.shiftTop+1:1,w="",X="",me="",Ee="",Se="",Re="",lt=!1,jt="",Rt="",Lt="",Dt="",be=Object.assign([],i.merges),ye=Object.assign({},i.formula),at=Object.assign([],i.conditionalFormatting),Le=!1,ue=[],Ye="",qe=[],Ht=[],it=[],st=[],Fe={},De="",He=!1,ct="";if(i.rtl&&(Se+=' rightToLeft="1" '),i.pageBreak){const k=i.pageBreak;if(k.row&&Array.isArray(k.row)){Re="pageBreakPreview";const s=k.row.length;ct+=''+k.row.reduce((g,p)=>g+'',"")+""}if(k.column&&Array.isArray(k.column)){Re="pageBreakPreview";const s=k.column.length;ct+=''+k.column.reduce((g,p)=>g+'',"")+""}}let Nt="";if(i.pageOption){const k=i.pageOption;if(k.isPortrait&&(He=!0),k.margin){const _=k.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof _[h]=="number"&&(A[h]=_[h])}),Nt=''}let s="",g="",p="",f="";if(["header","footer"].forEach(_=>{const A=_.charAt(0).toUpperCase()+_.substring(1);if(k[_]){const h=k[_];typeof h=="object"&&Object.keys(h).forEach(F=>{s.indexOf(F)<0&&(s+=F);const le=h[F];let W="";if(Object.keys(le).reduce((L,j)=>(j=="l"?L.splice(0,0,j):j=="c"?L.splice(1,0,j):j=="r"&&L.splice(2,0,j),L),[]).forEach(L=>{const j=le[L];W+="&"+L.toUpperCase(),j.styleId&&M[j.styleId]&&(W+=M[j.styleId]),j.text&&(W+=j.text)}),W="<"+F+A+">"+W+"",F=="odd")g+=W;else if(F=="even")p+=W;else if(F=="first")f+=W;else throw"type error"})}}),De=g+p+f,De.length>0){He=!0;const _=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(i.viewOption){let k="";const s=i.viewOption;s.type&&(Re=s.type),s.hideRuler&&(Se+=' showRuler="0" '),s.hideGrid&&(Se+=' showGridLines="0" '),s.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let g=s.splitOption;if(typeof g>"u"&&(He=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(k=' state="frozen" ',p.type=="R"||p.type=="ROW"){let f;typeof p.index=="object"?f=p.index.r:f=p.index,g={startAt:{b:"A"+(f+1)},type:"H",split:f}}else if(p.type=="C"||p.type=="COLUMN"){let f;typeof p.index=="object"?f=p.index.c:f=p.index,f>n.length-1&&(n=Ne(n,f)),g={type:"V",startAt:{r:n[f]+1},split:f}}else if(p.type=="B"||p.type=="BOTH"){let f="",P;typeof p.index=="number"?(P=p.index,f=n[p.index]+(p.index+1)):(P={y:p.index.r,x:p.index.c},f=n[p.index.c]+(p.index.r+1)),g={startAt:{two:f},type:"B",split:P}}}if(g)if(g.type=="H"||g.type=="HORIZONTAL"){let p;g.startAt&&(p=g.startAt.b,g.startAt.t&&(Se+=' topLeftCell="'+g.startAt.t+'"')),p||(p="A1"),Ee='"}else if(g.type=="V"||g.type=="VERTICAL"){let p;g.startAt&&(p=g.startAt.r,g.startAt.l&&(Se+=' topLeftCell="'+g.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;g.startAt&&(p=g.startAt.two,g.startAt.one&&(Se+=' topLeftCell="'+g.startAt.one+'"')),p||(p="A1"),Ee='"}}if(He&&(Re="pageLayout"),i.checkbox){lt=!0;const k=ge.checkbox;i.checkbox.forEach((s,g)=>{let p=k;if(s.link){let F=_e(s.link,n);p=p.replace("**fmlaLink**",'fmlaLink="$'+n[F.col]+"$"+(F.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),we++;let f=E+""+we++;const P="_x0000_s"+f;Rt+=Te.checkbox.replace("***id***",P).replace("***text***",s.text);let _=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof _=="string"&&_.length>=2){let F=_e(_,n);h.start={...F},h.end={col:F.col+1,row:F.row+1}}if(typeof A=="string"&&A.length>=2){let F=_e(A,n);F.row+=1,F.col+=1,h.end={...F}}Dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Lt+='',jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ft;if(i.backgroundImage){b==null&&(b=m==null?void 0:m.folder("media"));const k=i.backgroundImage;ft=new Promise(async(s,g)=>{let p=k.lastIndexOf("."),f;p>0?(f=k.substring(p+1).toLowerCase(),f.length>4&&(f.indexOf("gif")>=0?f="gif":f.indexOf("jpg")>=0?f="jpg":f.indexOf("jpeg")>=0?f="jpeg":f="png")):f="png";const P=J++,_="image"+P+"."+f,A=await wt(k,_,o,e.fetch);A||g("image not load"),ve.push(f),s({name:_,type:f,image:A,ref:P})})}let mt;if(i.images&&(b==null&&(b=m==null?void 0:m.folder("media")),mt=Promise.all([...i.images.map(async(k,s)=>{let g=k.url.lastIndexOf("."),p;g>0?(p=k.url.substring(g+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const f="image"+J+++"."+p;return{type:p,image:await wt(k.url,f,o,e.fetch),obj:k,i:s,name:f}})])),Array.isArray(i.headers)&&i.headers.length){const k=i.headers.length;let s="";if(i.title){const f=i.title,P=f.comment,_=f.shiftTop&&f.shiftTop>=0?f.shiftTop:0,A=i.shiftLeft&&i.shiftLeft>=0?i.shiftLeft:0,h=f.shiftLeft&&f.shiftLeft+A>=0?f.shiftLeft+A:A,F=f.consommeRow?f.consommeRow-1:1,le=f.consommeCol?f.consommeCol:k,W=F==0&&typeof f.height=="number"?' ht="'+f.height+'" customHeight="1" ':"",L=f.styleId?f.styleId:"titleStyle",j=n[h]+""+(O+_);if(be.push(j+":"+n[h+le-1]+(O+F+_)),typeof P<"u"){Le=!0;const ee=Xe(P,B.commentSyntax.value,c);let de=ue.length;if(ee.hasAuthor&&typeof ee.author<"u"){let Q=ee.author.toString();const re=ue.indexOf(Q);re<0?ue.push(Q):de=re}qe.push({row:O+_-1,col:h}),Ye+=Ze(j,ee.commentStr,ee.commentStyle,de)}typeof f.text=="string"&&(x[O+_]={startTag:'',details:''+$+"",endTag:""},s+='',s+=''+$+"",s+="",$++,H[f.text]=f.text,f.multiStyleValue?R+=Je(f.multiStyleValue,f.text,B.commentSyntax.value,L,i.useSplitBaseOnMatch):R+=""+je(f.text)+""),O+=_+F+1}let g=i.headerStyleKey?i.headerStyleKey:null,p=0;if(typeof i.shiftLeft=="number"&&i.shiftLeft>=0&&(p=i.shiftLeft),ce&&(N+='',he||(he=m==null?void 0:m.folder("tables"))),U.start=n[p]+""+O,U.end=n[p+i.headers.length-1]+""+(O+i.data.length),i.headers.forEach((f,P)=>{if(ce&&(N+=''),p&&(P+=p),f.formula&&it.push(P),f.conditionalFormatting&&st.push(P),Ht.push(f.label),i.mergeRowDataCondition&&typeof i.mergeRowDataCondition=="function"&&i.mergeRowDataCondition(f,null,P,!0)===!0&&(Fe[n[P]]={inProgress:!0,start:O}),i.styleCellCondition&&typeof i.styleCellCondition=="function"&&(g=i.styleCellCondition(f,f,O,P,!0,v)||g),f.size&&f.size>0&&(X+=''),i.withoutHeader)return;const _=n[P]+""+O;if(typeof i.commentCondition=="function"){const h=i.commentCondition(f,null,f.label,O,P,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(f.comment=h)}if(f.comment){Le=!0;const h=Xe(f.comment,B.commentSyntax.value,c);let F=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const W=ue.indexOf(le);W<0?ue.push(le):F=W}qe.push({row:O-1,col:P}),Ye+=Ze(_,h.commentStr,h.commentStyle,F)}const A=ye&&ye[_];if(A){const h=Ge(_,A,C,e.styles);h.needCalcChain&&(xe=!0,se+=h.chainCell),w+=h.cell,delete ye[_]}else{if(w+=''+$+"",typeof i.multiStyleCondition=="function"){const h=i.multiStyleCondition(f,null,f.label,O,P,!0);h&&(f.multiStyleValue=h)}f.multiStyleValue?R+=Je(f.multiStyleValue,f.text,B.commentSyntax.value,g||"",i.useSplitBaseOnMatch):R+=""+je(f.text)+"",H[f.text]=f.text,$++}}),ce&&(N+=""),i.withoutHeader)w+=s;else{const f='P+" "+_+'="'+i.headerRowOption[_]+'" '," "):"")+">";x[O]={startTag:f,endTag:"",details:w},w=s+f+w+"",O++}if(Array.isArray(i.data)){const f=i.mapSheetDataOption&&i.mapSheetDataOption.outlineLevel?i.mapSheetDataOption.outlineLevel:"outlineLevel",P=i.mapSheetDataOption&&i.mapSheetDataOption.hidden?i.mapSheetDataOption.hidden:"hidden",_=i.mapSheetDataOption&&i.mapSheetDataOption.height?i.mapSheetDataOption.height:"height",A=i.data.length;i.data.forEach((h,F)=>{if(h.mergeType)for(let j=0;j
");const N=x.border;let O="";if(typeof N=="object"&&((N.left||N.full)&&(O+=''),(N.right||N.full)&&(O+=''),(N.top||N.full)&&(O+=''),(N.bottom||N.full)&&(O+=''),U.borderIndex=E.border.count,E.border.count++,E.border.value+=""+O+""),x.format){const w=l[x.format];w&&(U.formatIndex=w.key,"value"in w&&(E.format.count++,E.format.value+=w.value))}return E.cell.value=E.cell.value+'0?' applyBorder="1" ':"")+(U.fillIndex>0?' applyFill="1" ':"")+(U.fontIndex>=0?' applyFont="1" ':"")+(U.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[i].index=E.cell.count,E.cell.count++,E},{conditionalFormatting:{count:L?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});m==null||m.file("styles.xml",Zt(B,L));let oe='',R="",$=0,Z="",q="",H={};const k={};let K="",V=4,G=!1,Y=-1,Ce=[],J=1;const ye={checkbox:` -`};let ve=1024;const we={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},ke={checkbox:` - - - - `};let ae=[],ie="",ge=!1,pe=null;for(let E=0;E=0?i.shiftTop+1:1,w="",X="",fe="",Te="",Ee="",Re="",lt=!1,Pt="",jt="",Rt="",Dt="",xe=Object.assign([],i.merges),ue=Object.assign({},i.formula),at=Object.assign([],i.conditionalFormatting),De=!1,he=[],qe="",Ye=[],Lt=[],it=[],st=[],Oe={},Le="",He=!1,ct="";if(i.rtl&&(Ee+=' rightToLeft="1" '),i.pageBreak){const S=i.pageBreak;if(S.row&&Array.isArray(S.row)){Re="pageBreakPreview";const s=S.row.length;ct+=''+S.row.reduce((g,d)=>g+'',"")+""}if(S.column&&Array.isArray(S.column)){Re="pageBreakPreview";const s=S.column.length;ct+=''+S.column.reduce((g,d)=>g+'',"")+""}}let Ht="";if(i.pageOption){const S=i.pageOption;if(S.isPortrait&&(He=!0),S.margin){const _=S.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof _[h]=="number"&&(A[h]=_[h])}),Ht=''}let s="",g="",d="",f="";if(["header","footer"].forEach(_=>{const A=_.charAt(0).toUpperCase()+_.substring(1);if(S[_]){const h=S[_];typeof h=="object"&&Object.keys(h).forEach(F=>{s.indexOf(F)<0&&(s+=F);const le=h[F];let W="";if(Object.keys(le).reduce((D,j)=>(j=="l"?D.splice(0,0,j):j=="c"?D.splice(1,0,j):j=="r"&&D.splice(2,0,j),D),[]).forEach(D=>{const j=le[D];W+="&"+D.toUpperCase(),j.styleId&&M[j.styleId]&&(W+=M[j.styleId]),j.text&&(W+=j.text)}),W="<"+F+A+">"+W+"",F=="odd")g+=W;else if(F=="even")d+=W;else if(F=="first")f+=W;else throw"type error"})}}),Le=g+d+f,Le.length>0){He=!0;const _=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";Le=""+Le+""}}if(i.viewOption){let S="";const s=i.viewOption;s.type&&(Re=s.type),s.hideRuler&&(Ee+=' showRuler="0" '),s.hideGrid&&(Ee+=' showGridLines="0" '),s.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let g=s.splitOption;if(typeof g>"u"&&(He=!1,typeof s.frozenOption=="object")){const d=s.frozenOption;if(S=' state="frozen" ',d.type=="R"||d.type=="ROW"){let f;typeof d.index=="object"?f=d.index.r:f=d.index,g={startAt:{b:"A"+(f+1)},type:"H",split:f}}else if(d.type=="C"||d.type=="COLUMN"){let f;typeof d.index=="object"?f=d.index.c:f=d.index,f>n.length-1&&(n=Ne(n,f)),g={type:"V",startAt:{r:n[f]+1},split:f}}else if(d.type=="B"||d.type=="BOTH"){let f="",I;typeof d.index=="number"?(I=d.index,f=n[d.index]+(d.index+1)):(I={y:d.index.r,x:d.index.c},f=n[d.index.c]+(d.index.r+1)),g={startAt:{two:f},type:"B",split:I}}}if(g)if(g.type=="H"||g.type=="HORIZONTAL"){let d;g.startAt&&(d=g.startAt.b,g.startAt.t&&(Ee+=' topLeftCell="'+g.startAt.t+'"')),d||(d="A1"),Te='"}else if(g.type=="V"||g.type=="VERTICAL"){let d;g.startAt&&(d=g.startAt.r,g.startAt.l&&(Ee+=' topLeftCell="'+g.startAt.l+'"')),d||(d="A1"),Te='"}else{let d;g.startAt&&(d=g.startAt.two,g.startAt.one&&(Ee+=' topLeftCell="'+g.startAt.one+'"')),d||(d="A1"),Te='"}}if(He&&(Re="pageLayout"),i.checkbox){lt=!0;const S=ye.checkbox;i.checkbox.forEach((s,g)=>{let d=S;if(s.link){let F=Fe(s.link,n);d=d.replace("**fmlaLink**",'fmlaLink="$'+n[F.col]+"$"+(F.row+1)+'"')}else d=d.replace("**fmlaLink**","");s.mixed?d=d.replace("**value**",'checked="Mixed"'):s.checked?d=d.replace("**value**",'checked="Checked"'):d=d.replace("**value**",""),s.threeD&&d.replace('noThreeD="1"',""),ae.push(d),ve++;let f=E+""+ve++;const I="_x0000_s"+f;jt+=we.checkbox.replace("***id***",I).replace("***text***",s.text);let _=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof _=="string"&&_.length>=2){let F=Fe(_,n);h.start={...F},h.end={col:F.col+1,row:F.row+1}}if(typeof A=="string"&&A.length>=2){let F=Fe(A,n);F.row+=1,F.col+=1,h.end={...F}}Dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Rt+='',Pt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ft;if(i.backgroundImage){b==null&&(b=m==null?void 0:m.folder("media"));const S=i.backgroundImage;ft=new Promise(async(s,g)=>{let d=S.lastIndexOf("."),f;d>0?(f=S.substring(d+1).toLowerCase(),f.length>4&&(f.indexOf("gif")>=0?f="gif":f.indexOf("jpg")>=0?f="jpg":f.indexOf("jpeg")>=0?f="jpeg":f="png")):f="png";const I=J++,_="image"+I+"."+f,A=await vt(S,_,o,e.fetch);A||g("image not load"),Ce.push(f),s({name:_,type:f,image:A,ref:I})})}let mt;if(i.images&&(b==null&&(b=m==null?void 0:m.folder("media")),mt=Promise.all([...i.images.map(async(S,s)=>{let g=S.url.lastIndexOf("."),d;g>0?(d=S.url.substring(g+1).toLowerCase(),d.length>4&&(d.indexOf("gif")>=0?d="gif":d.indexOf("jpg")>=0?d="jpg":d.indexOf("jpeg")>=0?d="jpeg":d="png")):d="png",Ce.push(d);const f="image"+J+++"."+d;return{type:d,image:await vt(S.url,f,o,e.fetch),obj:S,i:s,name:f}})])),Array.isArray(i.headers)&&i.headers.length){const S=i.headers.length;let s="";if(i.title){const f=i.title,I=f.comment,_=f.shiftTop&&f.shiftTop>=0?f.shiftTop:0,A=i.shiftLeft&&i.shiftLeft>=0?i.shiftLeft:0,h=f.shiftLeft&&f.shiftLeft+A>=0?f.shiftLeft+A:A,F=f.consommeRow?f.consommeRow-1:1,le=f.consommeCol?f.consommeCol:S,W=F==0&&typeof f.height=="number"?' ht="'+f.height+'" customHeight="1" ':"",D=f.styleId?f.styleId:"titleStyle",j=n[h]+""+(O+_);if(xe.push(j+":"+n[h+le-1]+(O+F+_)),typeof I<"u"){De=!0;const ee=Xe(I,B.commentSyntax.value,c);let me=he.length;if(ee.hasAuthor&&typeof ee.author<"u"){let Q=ee.author.toString();const re=he.indexOf(Q);re<0?he.push(Q):me=re}Ye.push({row:O+_-1,col:h}),qe+=Ze(j,ee.commentStr,ee.commentStyle,me)}typeof f.text=="string"&&(x[O+_]={startTag:'',details:''+$+"",endTag:""},s+='',s+=''+$+"",s+="",$++,H[f.text]=f.text,f.multiStyleValue?R+=Je(f.multiStyleValue,f.text,B.commentSyntax.value,D,i.useSplitBaseOnMatch):R+=""+je(f.text)+""),O+=_+F+1}let g=i.headerStyleKey?i.headerStyleKey:null,d=0;if(typeof i.shiftLeft=="number"&&i.shiftLeft>=0&&(d=i.shiftLeft),se&&(N+='',pe||(pe=m==null?void 0:m.folder("tables"))),U.start=n[d]+""+O,U.end=n[d+i.headers.length-1]+""+(O+i.data.length),i.headers.forEach((f,I)=>{if(se&&(N+=''),d&&(I+=d),f.formula&&it.push(I),f.conditionalFormatting&&st.push(I),Lt.push(f.label),i.mergeRowDataCondition&&typeof i.mergeRowDataCondition=="function"&&i.mergeRowDataCondition(f,null,I,!0)===!0&&(Oe[n[I]]={inProgress:!0,start:O}),i.styleCellCondition&&typeof i.styleCellCondition=="function"&&(g=i.styleCellCondition(f,f,O,I,!0,v)||g),f.size&&f.size>0&&(X+=''),i.withoutHeader)return;const _=n[I]+""+O;if(typeof i.commentCondition=="function"){const h=i.commentCondition(f,null,f.label,O,I,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(f.comment=h)}if(f.comment){De=!0;const h=Xe(f.comment,B.commentSyntax.value,c);let F=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const W=he.indexOf(le);W<0?he.push(le):F=W}Ye.push({row:O-1,col:I}),qe+=Ze(_,h.commentStr,h.commentStyle,F)}const A=ue&&ue[_];if(A){const h=Ge(_,A,C,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),w+=h.cell,delete ue[_]}else{if(w+=''+$+"",typeof i.multiStyleCondition=="function"){const h=i.multiStyleCondition(f,null,f.label,O,I,!0);h&&(f.multiStyleValue=h)}f.multiStyleValue?R+=Je(f.multiStyleValue,f.text,B.commentSyntax.value,g||"",i.useSplitBaseOnMatch):R+=""+je(f.text)+"",H[f.text]=f.text,$++}}),se&&(N+=""),i.withoutHeader)w+=s;else{const f='I+" "+_+'="'+i.headerRowOption[_]+'" '," "):"")+">";x[O]={startTag:f,endTag:"",details:w},w=s+f+w+"",O++}if(Array.isArray(i.data)){const f=i.mapSheetDataOption&&i.mapSheetDataOption.outlineLevel?i.mapSheetDataOption.outlineLevel:"outlineLevel",I=i.mapSheetDataOption&&i.mapSheetDataOption.hidden?i.mapSheetDataOption.hidden:"hidden",_=i.mapSheetDataOption&&i.mapSheetDataOption.height?i.mapSheetDataOption.height:"height",A=i.data.length;i.data.forEach((h,F)=>{if(h.mergeType)for(let j=0;j
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` +`};let ve=1024;const we={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},Se={checkbox:` + + + + `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
-[More Example](example/CDN/themeBaseGenerate) +[More Example](https://github.com/mohammadrezaeicode/mr-excel-example-gallery/blob/main/CDN/themeBaseGenerate) @@ -498,9 +506,9 @@ ExcelTable.convertTableToExcel("#table", null, {
-result of Example in https://github.com/mohammadrezaeicode/mr-excel-repo/blob/main/example/conv1.html +result of Example in https://github.com/mohammadrezaeicode/mr-excel-example-gallery/blob/main/conv1.html -![ex](./example/ex13.PNG) +![ex](https://github.com/mohammadrezaeicode/mr-excel-example-gallery/blob/main/ex13.PNG)
@@ -853,7 +861,7 @@ ExcelTable.sideBySideLineByLine(sideData); -[More Example](example/CDN/sideBySideLineByLine) +[More Example](https://github.com/mohammadrezaeicode/mr-excel-example-gallery/tree/main/CDN/sideBySideLineByLine) @@ -1018,7 +1026,7 @@ ExcelTable.generateExcel(data); -[More Example](example/CDN/generateExcel) +[More Example](https://github.com/mohammadrezaeicode/mr-excel-example-gallery/blob/main/CDN/generateExcel) @@ -7281,6 +7289,8 @@ To migrate from Version 2 to Version 3, you need to follow the steps below: ## Release Notes [⬆️](#table-of-contents) +### Version 7.0.0 (2025-02-16) + #### New Features - A drop-down option (multi-select option) provides the ability to create a cell that contains multiple selectable values.`sheet`->`[n]`->`dropDowns` @@ -7293,6 +7303,10 @@ To migrate from Version 2 to Version 3, you need to follow the steps below: > [!NOTE] > The related interface has not changed, so the sheet needs to be provided in TypeScript. +#### Improvements + +- Begin adding JSDoc comments to the main functions and interfaces. + ### Version 6.0.1 (2024-08-11) #### New Features diff --git a/change-log b/change-log index 645cfbf..434d0f7 100644 --- a/change-log +++ b/change-log @@ -1,18 +1,19 @@ -## Version 6.0.1 (2024-08-11) +## Version 7.0.0 (2025-02-16) ### New Features -- Introduced formatMap to support new data formats. -- Added the excelToJson and excelToNode functions. +- A drop-down option (multi-select option) provides the ability to create a cell that contains multiple selectable values.`sheet`->`[n]`->`dropDowns` +- The `replaceInExcel` functionality in Excel allows you to replace data in an existing file using flags provided within the spreadsheet. + +### Bug Fixes + +- `generateExcel` supports empty objects and will generate an empty Excel file. + +> [!NOTE] +> The related interface has not changed, so the sheet needs to be provided in TypeScript. ### Improvements -- Increased code coverage to 90%. -- Enhanced capability to use image, checkbox, and comment together. -- Incorporated GitHub Community Standards for better collaboration. -- more +- Begin adding JSDoc comments to the main functions and interfaces. -### Bug Fixes -- Resolved issues related to backgroundImage. -- Resolved an issue related to the incorrect package release in version 6.0.0. diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index 4bd985b..7620f9f 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-BRPJRQwV"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); +define(["exports","./index-BYjrfbvd"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index ae634ad..7b54219 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-xyzS9dVO.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CzrjgJVS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index 189fc7a..10a8c76 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -1,13 +1,32 @@ export declare const addGlobalOptionFromExcelTable: typeof addGlobalOptionFromExcelTable_2; +/** + * Adds global options from an Excel table. + * @param {string} key - The key for the global option. + * @param {ExcelTable} data - The Excel table data. + */ declare function addGlobalOptionFromExcelTable_2(key: string, data: ExcelTable): void; export declare const addGlobalOptions: typeof addGlobalOptions_2; +/** + * Adds global options to the proxy. + * @param {string} key - The key for the global option. + * @param {string} path - The path for the global option. + * @param {any} data - The data for the global option. + */ declare function addGlobalOptions_2(key: string, path: string, data: any): void; +/** + * Horizontal alignment options. + * @typedef {"center" | "left" | "right"} AlignmentHorizontal + */ declare type AlignmentHorizontal = "center" | "left" | "right"; +/** + * Options for configuring alignment. + * @interface + */ declare interface AlignmentOption { horizontal?: AlignmentHorizontal; vertical?: AlignmentVertical; @@ -20,21 +39,47 @@ declare interface AlignmentOption { ltr?: boolean; } +/** + * Keys for alignment options. + * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey + */ declare type AlignmentOptionKey = "horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"; +/** + * Vertical alignment options. + * @typedef {"center" | "top" | "bottom"} AlignmentVertical + */ declare type AlignmentVertical = "center" | "top" | "bottom"; +/** + * Options for displaying the sheet as a table. + * @interface + */ declare interface AsTableOption { + /** The type of table style. */ type?: "Light" | "Medium" | "Dark"; + /** The style number of the table. */ styleNumber?: number; + /** Indicates if the first column should be styled. */ firstColumn?: boolean; + /** Indicates if the last column should be styled. */ lastColumn?: boolean; + /** Indicates if row stripes should be applied. */ rowStripes?: boolean; + /** Indicates if column stripes should be applied. */ columnStripes?: boolean; } +/** + * Directions for border options. + * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection + */ declare type BorderDirection = "full" | "top" | "left" | "right" | "bottom"; +/** + * Options for configuring borders. + * @interface + */ declare type BorderOption = { [key in BorderDirection]?: { color: string; @@ -42,6 +87,11 @@ declare type BorderOption = { }; }; +/** + * Represents a buffer. + * @class + * @extends {Uint8Array} + */ declare class Buffer_2 extends Uint8Array { constructor(str: string, encoding?: string); constructor(size: number); @@ -59,6 +109,10 @@ declare class Buffer_2 extends Uint8Array { byteOffset: number; } +/** + * Represents a checkbox in the sheet. + * @interface + */ declare interface Checkbox { col: number; row: number; @@ -77,42 +131,102 @@ declare function checkSheetValidWithTwoRef(ref: string): boolean; declare type ColWidthScaleFunction = (data: number, colIndex: number) => number; +/** + * Represents a comment in the sheet. + * @interface + */ declare interface Comment_2 { comment?: string; styleId?: string; author?: string; } +/** + * Function type for comment condition. + * @callback CommentConditionFunction@callback CommentConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {Comment | string | false | undefined | null} The comment or null. + */ declare type CommentConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => Comment_2 | string | false | undefined | null; +/** + * Represents conditional formatting in the sheet. + * @interface + * @extends {ConditionalFormattingOption} + */ declare interface ConditionalFormatting extends ConditionalFormattingOption { + /** The start cell for the conditional formatting. */ start: string; + /** The end cell for the conditional formatting. */ end: string; } +/** + * Operations for conditional formatting cells. + * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation + */ declare type ConditionalFormattingCellsOperation = "lt" | "gt" | "between" | "eq" | "ct"; +/** + * Operations for conditional formatting icon sets. + * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation + */ declare type ConditionalFormattingIconSetOperation = "3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"; +/** + * Options for conditional formatting. + * @interface + */ declare interface ConditionalFormattingOption { + /** The type of conditional formatting. */ type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top"; + /** The operator for the conditional formatting. */ operator?: string | ConditionalFormattingCellsOperation | ConditionalFormattingIconSetOperation | ConditionalFormattingTopOperation; + /** The value for the conditional formatting. */ value?: number | string; + /** The priority of the conditional formatting. */ priority?: number; + /** The colors for the conditional formatting. */ colors?: string[]; + /** Indicates if the conditional formatting is for the bottom values. */ bottom?: boolean; + /** The style ID for the conditional formatting. */ styleId?: string; + /** The percentage for the conditional formatting. */ percent?: number; } +/** + * Operations for conditional formatting top values. + * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation + */ declare type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage"; +/** + * Converts an HTML table to an Excel file. + * @param {string} [queryForTable] - The query selector for the table. + * @param {HTMLTableElement} [table] - The HTML table element. + * @param {Object} [config] - The configuration options. + * @param {boolean} [config.keepStyle] - Whether to keep the style. + * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. + * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. + * @returns {Promise} The generated Excel table. + */ export declare function convertTableToExcel(queryForTable?: string, table?: HTMLTableElement, config?: { keepStyle?: boolean; rowHeightScaleFunction?: RowHeightScaleFunction; colWidthScaleFunction?: ColWidthScaleFunction; }): Promise; +/** + * Represents a custom formula setting. + * @interface + */ declare interface CustomFormulaSetting { isArray?: boolean; referenceCells?: string; @@ -121,6 +235,11 @@ declare interface CustomFormulaSetting { styleId?: string; } +/** + * Represents data in the sheet. + * @interface + * @extends {DataOptions} + */ declare interface Data extends DataOptions { [key: string]: string | number | any | undefined; } @@ -140,6 +259,7 @@ declare namespace DataModel { HeaderFooterTypes, PageOption, Header, + HeaderOption, StyleType, StyleBody, Styles, @@ -197,8 +317,14 @@ declare namespace DataModel { } export { DataModel } +/** + * Options for configuring data in the sheet. + * @interface + */ declare interface DataOptions { - [key: string]: "0" | "1" | number | string | undefined | MapComment | MapMultiStyleValue; + [key: string]: "0" | "1" | number | string | undefined | MapComment + /** Array of multi-style values for the data. */ + | MapMultiStyleValue; outlineLevel?: number; hidden?: "0" | "1" | number; rowStyle?: string; @@ -207,36 +333,78 @@ declare interface DataOptions { comment?: MapComment; } +/** + * Represents a dropdown in the sheet. + * @interface + */ declare interface DropDown { + /** Array of options for the dropdown. */ option: (string | number)[]; + /** Array of columns the dropdown applies to. */ for: string[]; } +/** + * Represents an Excel table with options and sheets. + * @interface + * @extends {ExcelTableOption} + */ declare interface ExcelTable extends ExcelTableOption { + /** Array of sheets in the Excel table. */ sheet: Sheet[]; } +/** + * Options for configuring an Excel table. + * @interface + */ declare interface ExcelTableOption { + /** Indicates if the Excel should not be saved. */ notSave?: boolean; + /** The creator of the Excel. */ creator?: string; + /** Indicates if the backend is used. */ backend?: boolean; + /** Activates conditional formatting. */ activateConditionalFormatting?: boolean; + /** Function to fetch data. */ fetch?: Function; + /** The file name of the Excel. */ fileName?: string; + /** The type of generated file. */ generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; + /** Adds default title style. */ addDefaultTitleStyle?: boolean; + /** The creation date of the Excel. */ created?: string; + /** The modification date of the Excel. */ modified?: string; + /** The number of columns in the Excel. */ numberOfColumn?: number; + /** The type of creation. */ createType?: string; + /** Styles applied to the Excel. */ styles?: Styles; + /** Format map for the Excel. */ formatMap?: FormatMap; } export declare function excelToJson(uri: string, fetchFunc?: Function, withHeader?: boolean, defaultPropertyPrefix?: string): Promise>; +/** + * Converts an Excel file to a Node. + * @param {string} uri - The URI of the Excel file. + * @param {string | null} [queryForTable] - The query selector for the table. + * @param {HTMLDivElement | null} [containerElement] - The container element. + * @param {ExcelToNodeConfig} [config={}] - The configuration options. + * @returns {Promise} The result of the conversion. + */ export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; +/** + * Represents configuration options for Excel to Node. + * @interface + */ declare interface ExcelToNodeConfig { fetchFunc?: Function; firstHeader?: boolean; @@ -257,14 +425,33 @@ declare const exportedForTesting: { generalValidationCheck: typeof generalValidationCheck; }; +/** + * Represents extracted data. + * @typedef {(string | null | undefined)[][]} ExtractedData + */ declare type ExtractedData = (string | null | undefined)[][]; +/** + * Extracts data from an Excel file. + * @param {string} uri - The URI of the Excel file. + * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. + * @param {Function} [fetchFunc] - The function to fetch data. + * @returns {Promise} The extracted data. + */ export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; +/** + * Represents the result of data extraction. + * @interface + */ declare interface ExtractResult { [sheetName: string]: ExtractedData; } +/** + * Represents a format map. + * @interface + */ declare interface FormatMap { [format: string]: { key: number; @@ -272,10 +459,18 @@ declare interface FormatMap { }; } +/** + * Represents a formula in the sheet. + * @interface + */ declare interface Formula { [insertCell: string]: FormulaSetting | SingleRefFormulaSetting | NoArgFormulaSetting | CustomFormulaSetting; } +/** + * Represents a formula setting. + * @interface + */ declare interface FormulaSetting { type: FormulaType; start: string; @@ -283,50 +478,109 @@ declare interface FormulaSetting { styleId?: string; } +/** + * Types of formulas. + * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType + */ declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; declare function generalValidationCheck(value: never, validateProperty: ValidationObject, property: string, strict: boolean, warn: boolean): boolean; +/** + * Generates a CSV file from an Excel table. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. + * @returns {Promise} The generated CSV file. + */ export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): Promise; export declare function generateExcel(data: ExcelTable, styleKey?: string): Promise; +/** + * Generates a text file from an Excel table. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. + * @returns {Promise} The generated text file. + */ export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; -declare interface Header { +/** + * Represents a header in the sheet. + * @interface + * @extends {HeaderOption} + */ +declare interface Header extends HeaderOption { + /** The label of the header. */ label: string; + /** The text of the header. */ text: string; - size?: number; - multiStyleValue?: MultiStyleValue[]; - comment?: Comment_2 | string; - conditionalFormatting?: ConditionalFormattingOption; - formula?: { - type: FormulaType; - styleId?: string; - }; } +/** + * Location map for header and footer options.l:Left, c:Center, r:Right + * @interface + */ declare interface HeaderFooterLocationMap { l?: HeaderFooterOption; c?: HeaderFooterOption; r?: HeaderFooterOption; } +/** + * Options for header and footer. + * @interface + */ declare interface HeaderFooterOption { + /** The text of the header or footer. */ text?: string; + /** The style ID of the header or footer. */ styleId?: string; } +/** + * Types of header and footer in page(odd page, even page,first page). + * @interface + */ declare interface HeaderFooterTypes { odd?: HeaderFooterLocationMap; even?: HeaderFooterLocationMap; first?: HeaderFooterLocationMap; } +/** + * Options for configuring a header. + * @interface + */ +declare interface HeaderOption { + /** The size(width) of the header. */ + size?: number; + /** Array of multi-style values for the header. */ + multiStyleValue?: MultiStyleValue[]; + /** Comment for the header. */ + comment?: Comment_2 | string; + /** Conditional formatting options for the header. */ + conditionalFormatting?: ConditionalFormattingOption; + /** Formula applied to the column. */ + formula?: { + /** The type of the formula. */ + type: FormulaType; + /** The style ID of the formula. */ + styleId?: string; + }; +} + +/** + * Options for the header row. + * @interface + */ declare interface HeaderRowOption { outlineLevel: "string"; } +/** + * Represents an image in the sheet. + * @interface + */ declare interface ImageTypes { url: string; from: string; @@ -345,14 +599,26 @@ declare interface ImageTypes { }; } +/** + * Represents a map of comments. + * @interface + */ declare interface MapComment { [key: string]: Comment_2 | string; } +/** + * Represents a map of multi-style values. + * @interface + */ declare interface MapMultiStyleValue { [key: string]: MultiStyleValue[]; } +/** + * Represents a map of merge row conditions. + * @interface + */ declare interface MergeRowConditionMap { [columnKey: string]: { inProgress: boolean; @@ -360,33 +626,80 @@ declare interface MergeRowConditionMap { }; } +/** + * Function type for merge row data condition. + * @callback MergeRowDataConditionFunction@callback MergeRowDataConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {string | null} key - The key. + * @param {number} index - The index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {boolean} The result of the condition. + */ declare type MergeRowDataConditionFunction = (data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean) => boolean; +/** + * Function type for multi-style condition. + * @callback MultiStyleConditionFunction@callback MultiStyleConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {MultiStyleValue[] | null} The multi-style values or null. + */ declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; +/** + * Represents a multi-style regex value. + * @interface + */ declare interface MultiStyleRexValue { reg: RegExp | string; styleId: string; } +/** + * Represents a multi-style value. + * @interface + */ declare interface MultiStyleValue { value: string | number; styleId?: string; } +/** + * Represents a no-argument formula setting. + * @interface + */ declare interface NoArgFormulaSetting { noArgType: NoArgFormulaType; styleId?: string; } +/** + * Types of no-argument formulas. + * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType + */ declare type NoArgFormulaType = "NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"; +/** + * Options for page breaks in the sheet. + * @interface + */ declare interface PageBreak { + /** Array of row indices where page breaks should occur. */ row?: number[]; + /** Array of column indices where page breaks should occur. */ column?: number[]; } +/** + * Options for configuring the page. + * @interface + */ declare interface PageOption { + /** Margin settings for the page. */ margin?: { left?: number; right?: number; @@ -395,17 +708,44 @@ declare interface PageOption { header?: number; footer?: number; }; + /** Header settings for the page. */ header?: HeaderFooterTypes; + /** Footer settings for the page. */ footer?: HeaderFooterTypes; + /** Indicates if the page is in portrait orientation. */ isPortrait: boolean; } +/** + * Represents protection options for the sheet. + * @typedef {Object} ProtectionOption@typedef {Object} ProtectionOption + * @property {"0" | "1" | 0 | 1} sheet - Protect the sheet. + * @property {"0" | "1" | 0 | 1} formatCells - Allow formatting cells. + * @property {"0" | "1" | 0 | 1} formatColumns - Allow formatting columns. + * @property {"0" | "1" | 0 | 1} formatRows - Allow formatting rows. + * @property {"0" | "1" | 0 | 1} insertColumns - Allow inserting columns. + * @property {"0" | "1" | 0 | 1} insertRows - Allow inserting rows. + * @property {"0" | "1" | 0 | 1} insertHyperlinks - Allow inserting hyperlinks. + * @property {"0" | "1" | 0 | 1} deleteColumns - Allow deleting columns. + * @property {"0" | "1" | 0 | 1} deleteRows - Allow deleting rows. + * @property {"0" | "1" | 0 | 1} sort - Allow sorting. + * @property {"0" | "1" | 0 | 1} autoFilter - Allow using auto filter. + * @property {"0" | "1" | 0 | 1} pivotTables - Allow using pivot tables. + */ declare type ProtectionOption = { [key in ProtectionOptionKey]: "0" | "1" | 0 | 1; }; +/** + * Keys for protection options. + * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey + */ declare type ProtectionOptionKey = "sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"; +/** + * Represents the result of reading data. + * @interface + */ declare interface ReadResult { data: ExtractResult; sheetNameObject: Record; @@ -415,6 +755,10 @@ declare interface ReadResult { export declare function replaceInExcel(url: string | null | undefined, replaceData: Record, option?: ReplacerOption): Promise; +/** + * Represents options for the replacer. + * @interface + */ declare interface ReplacerOption { fileName?: string; backend?: boolean; @@ -426,6 +770,10 @@ declare interface ReplacerOption { declare type RowHeightScaleFunction = (data: number, rowIndex: number, fromHeader: boolean) => number; +/** + * Represents a map of rows in the sheet. + * @interface + */ declare interface RowMap { [rowNumber: number]: { startTag: string; @@ -434,50 +782,100 @@ declare interface RowMap { }; } +/** + * Represents a sheet in the Excel. + * @interface + * @extends {SheetOption} + */ declare interface Sheet extends SheetOption { + /** Array of headers in the sheet. */ headers: Header[]; + /** Array of data in the sheet. */ data: Data[]; } +/** + * Options for configuring a sheet. + * @interface + */ declare interface SheetOption { + /** Indicates if the sheet should be without a header. */ withoutHeader?: boolean; + /** Options for configure property name that maybe provide for apply outlineLevel, hidden, height option of row*/ mapSheetDataOption?: { + /** Outline level of the sheet data. */ outlineLevel?: string; + /** Indicates if the sheet data is hidden. */ hidden?: string; + /** Height of the sheet data. */ height?: string; }; + /** Background image of the sheet. */ backgroundImage?: string; + /** Array of conditional formatting rules. */ conditionalFormatting?: ConditionalFormatting[]; + /** Function for multi-style condition. */ multiStyleCondition?: MultiStyleConditionFunction; + /** Indicates if the sheet should use split based on match. */ useSplitBaseOnMatch?: boolean; + /** Indicates if strings should be converted to numbers Automatically. */ convertStringToNumber?: boolean; + /** Array of images in the sheet. */ images?: ImageTypes[]; + /** Formula applied to the sheet. */ formula?: Formula; + /** Page options for the sheet. */ pageOption?: PageOption; + /** Name of the sheet. */ name?: string; + /** Title of the sheet. */ title?: Title; + /** Shift sheet from top. */ shiftTop?: number; + /** Shift sheet from Left. */ shiftLeft?: number; + /** Indicates if the sheet is selected. */ selected?: boolean; + /** Tab color of the sheet. */ tabColor?: string; + /** Array of merge ranges in the sheet. */ merges?: string[]; + /** Key for the header style. */ headerStyleKey?: string; + /** Function for merge row data base on condition. */ mergeRowDataCondition?: MergeRowDataConditionFunction; + /** Function for style cell base on condition. */ styleCellCondition?: StyleCellConditionFunction; + /** Function for comment base on condition. */ commentCondition?: CommentConditionFunction; + /** Sort and filter options for the sheet. */ sortAndFilter?: SortAndFilter; + /** State of the sheet (hidden or visible). */ state?: "hidden" | "visible"; + /** Options for the header row. */ headerRowOption?: object; + /** Protection options for the sheet. */ protectionOption?: ProtectionOption; + /** Height of the header. */ headerHeight?: number; + /** Array of checkboxes in the sheet. */ checkbox?: Checkbox[]; + /** View options for the sheet. */ viewOption?: ViewOption; + /** Indicates if the sheet is right-to-left. */ rtl?: boolean; + /** Page break options for the sheet. */ pageBreak?: PageBreak; + /** Options for displaying the sheet as a table. */ asTable?: AsTableOption; + /** Array of dropdowns in the sheet. */ dropDowns?: DropDown[]; } +/** + * Represents side-by-side data in the sheet. + * @interface + */ declare interface SideBySide { sheetName?: string; spaceX?: number; @@ -490,8 +888,17 @@ declare interface SideBySide { headerIndex?: number; } +/** + * Generates an Excel file with side-by-side data. + * @param {SideBySide[][]} data - The side-by-side data. + * @returns {Promise} The generated Excel table. + */ export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; +/** + * Represents a single-reference formula setting. + * @interface + */ declare interface SingleRefFormulaSetting { type: SingleRefFormulaType; referenceCell: string; @@ -499,31 +906,71 @@ declare interface SingleRefFormulaSetting { styleId?: string; } +/** + * Types of single-reference formulas. + * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType + */ declare type SingleRefFormulaType = "LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"; +/** + * Represents sort and filter options. + * @interface + */ declare interface SortAndFilter { mode: "all" | "ref"; ref?: string; } +/** + * Represents the body of a style. + * @interface + */ declare interface StyleBody { + /** The font family of the text. */ fontFamily?: string; + /** The type of the style.(if not define used for cells, for other type should be define) */ type?: StyleType; + /** The size of the font. */ size?: number; + /** The index of the style(!!it's will override by process,Don't set value for it). */ index?: number; + /** The alignment options of the text. */ alignment?: AlignmentOption; + /** The border options. */ border?: BorderOption; + /** The format of the text. */ format?: string; + /** Indicates if the style is bold. */ bold?: boolean; + /** Indicates if the style is underlined. */ underline?: boolean; + /** Indicates if the style is italic. */ italic?: boolean; + /** Indicates if the style has double underline. */ doubleUnderline?: boolean; + /** The color of the style. */ color?: string; + /** The background color of the style. */ backgroundColor?: string; } +/** + * Function type for style cell condition. + * @callback StyleCellConditionFunction@callback StyleCellConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {Header | Data} object - The data object. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @param {string[]} styleKeys - The style keys. + * @returns {string | null} The style key or null. + */ declare type StyleCellConditionFunction = (data: Header | string | number | undefined, object: Header | Data, rowIndex: number, colIndex: number, fromHeader: boolean, styleKeys: string[]) => string | null; +/** + * Represents a style mapper. + * @interface + */ declare interface StyleMapper { conditionalFormatting: { count: number; @@ -556,14 +1003,32 @@ declare interface StyleMapper { }; } +/** + * Represents a collection of styles. + * @interface + */ declare interface Styles { [key: string]: StyleBody; } +/** + * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). + * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType + */ declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; +/** + * Generates an Excel file with a theme. + * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. + * @param {ThemeOption} [option] - The theme options. + * @returns {Promise} The generated Excel table. + */ export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; +/** + * Represents theme options. + * @interface + */ declare interface ThemeOption { negativeColor?: boolean; headerColor?: string; @@ -574,6 +1039,10 @@ declare interface ThemeOption { filterKeys?: string[]; } +/** + * Represents the title of the sheet. + * @interface + */ declare interface Title { shiftTop?: number; shiftLeft?: number; @@ -615,21 +1084,36 @@ declare namespace Validator { } export { Validator } +/** + * Options for configuring the view of the sheet. + * @interface + */ declare interface ViewOption { + /** The type of view. */ type?: "pageLayout" | "pageBreakPreview"; + /** Indicates if the grid should be hidden. */ hideGrid?: boolean; + /** Indicates if the headlines should be hidden. */ hideHeadlines?: boolean; + /** Indicates if the ruler should be hidden. */ hideRuler?: boolean; + /** Options for freezing rows or columns. */ frozenOption?: { + /** The type of freezing. */ type: "ROW" | "COLUMN" | "BOTH" | "R" | "C" | "B"; + /** The index/position at which to freeze. */ index: number | { r: number; c: number; }; }; + /** Options for splitting the view. */ splitOption?: { + /** The type of split. */ type: "VERTICAL" | "HORIZONTAL" | "BOTH" | "V" | "H" | "B"; + /** The start position of the split. */ startAt?: ViewStart; + /** The position of the split. */ split: number | { x: number; y: number; @@ -637,6 +1121,10 @@ declare interface ViewOption { }; } +/** + * Options for the start of the view. + * @interface + */ declare interface ViewStart { t?: string; b?: string; diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index c27cd9f..b550970 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1,6 +1,6 @@ var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;oy[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),y=h.charAt(2);return w+w+o+o+y+y}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((y,c)=>y&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,y)=>o+y.charAt(0)+y.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),y=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),y)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let y=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(y):w&&w.headerColor?w.headerColor:Tt(y),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:y,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),y[_]=a})}return l});if(Object.keys(y).forEach(l=>{i.file(l,y[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,y,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,y,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var b=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=b.length,v=!0,typeof y=="function"?s=y(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),b.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;b.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof y=="function"?S.height=y(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length `+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,y,c,r,f){let i={};return` -`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i.curr=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,y){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let y=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(y=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` `;return}i>0&&(l=' xml:space="preserve"',r+=` `),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let y="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(h.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,y){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,y=pt[h];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const y=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,b=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,y),K=Ue(d.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` diff --git a/dist/excel-table.js b/dist/excel-table.js index 5ad5e54..f1c36c0 100644 --- a/dist/excel-table.js +++ b/dist/excel-table.js @@ -1,4 +1,4 @@ -import { v as s, b as l, a as t, d as o, k as r, i as n, e as c, f as x, j as d, h as i, r as T, s as b, t as E } from "./index-Cav6spD2.js"; +import { v as s, b as l, a as t, d as o, k as r, i as n, e as c, f as x, j as d, h as i, r as T, s as b, t as E } from "./index-DMAk0ysA.js"; export { s as Validator, l as addGlobalOptionFromExcelTable, diff --git a/dist/excel-table.system.js b/dist/excel-table.system.js index be844a2..e94415c 100644 --- a/dist/excel-table.system.js +++ b/dist/excel-table.system.js @@ -1 +1 @@ -System.register("ExcelTable",["./index-DnICe6T_.js"],function(t,a){"use strict";return{setters:[e=>{t({Validator:e.v,addGlobalOptionFromExcelTable:e.b,addGlobalOptions:e.a,convertTableToExcel:e.d,excelToJson:e.k,excelToNode:e.i,extractExcelData:e.e,generateCSV:e.f,generateExcel:e.j,generateText:e.h,replaceInExcel:e.r,sideBySideLineByLine:e.s,themeBaseGenerate:e.t})}],execute:function(){}}}); +System.register("ExcelTable",["./index-BPuSW_h3.js"],function(t,a){"use strict";return{setters:[e=>{t({Validator:e.v,addGlobalOptionFromExcelTable:e.b,addGlobalOptions:e.a,convertTableToExcel:e.d,excelToJson:e.k,excelToNode:e.i,extractExcelData:e.e,generateCSV:e.f,generateExcel:e.j,generateText:e.h,replaceInExcel:e.r,sideBySideLineByLine:e.s,themeBaseGenerate:e.t})}],execute:function(){}}}); diff --git a/dist/excel-table.umd.cjs b/dist/excel-table.umd.cjs index c49ba3c..ba8d0bf 100644 --- a/dist/excel-table.umd.cjs +++ b/dist/excel-table.umd.cjs @@ -1,6 +1,6 @@ (function(Ee,qe){typeof exports=="object"&&typeof module<"u"?qe(exports):typeof define=="function"&&define.amd?define(["exports"],qe):(Ee=typeof globalThis<"u"?globalThis:Ee||self,qe(Ee.ExcelTable={}))})(this,function(Ee){"use strict";function qe(d,w){for(var o=0;oy[c]})}}}return Object.freeze(Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}))}function St(d){return d.replace(/ /g,"")}function Et(d){if(d=d.replace(/^#/,""),d.length==3){const w=d.charAt(0),o=d.charAt(1),y=d.charAt(2);return w+w+o+o+y+y}else return d}function rr(d){/^#?([a-f\d]{3})$/i.test(d)&&(d=Et(d));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(d);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(d){const w=rr(d);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(d){/^#?([a-f\d]{3})$/i.test(d)&&(d=Et(d));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(d);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ct(d){d=Number(d);var w=d.toString(16);return w.length==1?"0"+w:w}function je(d){d=St(d);let w=d.indexOf("rgba")>=0?d.substring(5,d.length-1).split(","):d.substring(4,d.length-1).split(","),o=w.reduce((y,c)=>y&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ct(w[0])+ct(w[1])+ct(w[2])).toUpperCase()}function Ue(d,w){if(typeof d>"u"||d===null)return null;if(!w){let o=St(d);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),d=getComputedStyle(document.documentElement).getPropertyValue(o))}if(d.indexOf("rgb")>=0){const o=je(d);d=o||""}return d.replace(/^#/,"")}function nr(d){let w="";return d.indexOf("_")>0?d.replace(/[a-z]/g,"").length==d.length?w=d.split(/_/).reduce((o,y)=>o+y.charAt(0)+y.substring(1).toLowerCase()+" ","").trim():w=d.replace(/_/g," ").trim():(w=d.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(d,w){let o=Object.keys(d).filter(r=>!w.includes(r)),y=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),y)}const dt={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(d,w={...dt}){let o;if(typeof d=="object"&&Array.isArray(d))if(d.length>0)if(Array.isArray(d[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else d.length>0?o={sheet:[{headers:Ot(d[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:d}]}:o={sheet:[]};else o={sheet:[]};else o=d;let y=w&&w.headerBackgroundColor?w.headerBackgroundColor:dt.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:dt.rowBackgroundColor,r=w&&w.negativeColor?At(y):w&&w.headerColor?w.headerColor:Tt(y),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:y,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lat)).default;let f;if(typeof d=="string"&&d.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(d).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),y[_]=a})}return l});if(Object.keys(y).forEach(l=>{i.file(l,y[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>_t)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(d,w,o,y,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!d||d===0?(d=0,s="row"):u.push(d-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(d,w,o,y,c){var _;if(!d&&!w)throw"Error: One of the function inputs is required.";let r;d?r=(_=document.querySelector(d))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var b=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=b.length,v=!0,typeof y=="function"?s=y(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),b.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;b.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof y=="function"?S.height=y(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length `+(d.format.count>0?''+d.format.value+"":"")+''+d.font.value+''+d.fill.value+''+d.border.value+''+d.cell.value+' '+(w?''+d.conditionalFormatting.value+"":'')+""}function fr(d,w,o,y,c,r,f){let i={};return` -`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i.curr=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+d+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(d,w){return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+d+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(d,w){return` Microsoft Excel0falseWorksheets`+d+' '+w+"falsefalsefalse16.0300"}function ht(d,w,o,y){d=d.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=d.indexOf(":")>0,v=s.referenceCells?s.referenceCells:d,a=_?d.substring(0,d.indexOf(":")):d,g=a.replace(/[0-9]/g,""),t=parseInt(d.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=d.replace(/[0-9]/g,""),f=parseInt(d.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function ut(d,w,o){let y=!1,c,r;if(typeof d=="object"){if("author"in d&&d.author&&(y=!0,r=d.author),"styleId"in d&&typeof d.styleId=="string"){let f=w[d.styleId];typeof f=="string"&&(o=f)}c="comment"in d&&typeof d.comment=="string"?It(d.comment):[""]}else c=d?It(d):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(d){var w=d.split(/\r?\n|\r|\n/g);return w}function mt(d,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` `;return}i>0&&(l=' xml:space="preserve"',r+=` `),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const dr='',rt=function(d){return d.replace(/\&/g,"&").replace(/\/g,">")};function pt(d,w,o){let y="";return d.forEach(c=>{typeof c.value=="string"&&(c.value=rt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(d,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(d).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function Ye(d,w){d=d.toUpperCase();let o=d.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(d.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=tt(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let hr={},gt=new Proxy(hr,{get(d,w){return w in d?d[w]:(this.set(d,w,{},!0),{})},set(d,w,o,y){return d[w]=o,!0}});function Pt(d,w,o){gt[d],gt[d][w]=o}function Bt(d,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(d,w.length>0?w+"."+c:c,r):Pt(d,w.length>0?w+"."+c:c,r)})}function ur(d,w){Bt(d,"",w)}function mr(d,w){let o=w,y=gt[d];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function nt(d,w=""){if(typeof w=="string"&&w.length>0&&(d=mr(w,d)),typeof d.creator=="string"&&d.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof d.created=="string"&&new Date(d.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof d.modified=="string"&&new Date(d.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;d.formatMap&&typeof d.formatMap=="object"&&(o={...o,...d.formatMap});const y=d.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];d.numberOfColumn&&d.numberOfColumn>25&&(r=tt(r,d.numberOfColumn));const i=(await Promise.resolve().then(()=>at)).default;let l=new i;d.sheet||(d.sheet=[{headers:[],data:[]}]);const s=d.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;d.styles||(d.styles={}),d.addDefaultTitleStyle&&(d.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(d.styles),t=dr,b=d.activateConditionalFormatting?d.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const h=d.styles[C];if(h.type&&(h.type=="headerFooter"||h.type=="HF")){let T="",K="-",J="Regular";if(h.fontFamily&&(K=h.fontFamily),h.bold&&(J="Bold"),h.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),h.size&&(T+="&"+h.size),h.doubleUnderline?T+="&E":h.underline&&(T+="&U"),h.color){const q=Ue(h.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof h.type=="string"&&h.type&&(h.type=="conditionalFormatting"||h.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(h.color,y),K=Ue(h.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(h.backgroundColor){let T=Ue(h.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(h.color||h.fontFamily||h.size||h.bold||h.italic||h.underline||h.doubleUnderline){const T=Ue(h.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(h.bold?"":"")+(h.italic?"":"")+(h.underline||h.doubleUnderline?"":"")+(h.size?'':"")+(T?'':"")+(h.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(h.bold?"":"")+(h.italic?"":"")+(h.underline||h.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";h.alignment&&(h.alignment.rtl&&(h.alignment.readingOrder=2),delete h.alignment.rtl,h.alignment.ltr&&(h.alignment.readingOrder=1),delete h.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+h.alignment[K]+'" ',"")+" />");const N=h.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),h.format){const T=o[h.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,d.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` diff --git a/dist/index-DnICe6T_.js b/dist/index-BPuSW_h3.js similarity index 98% rename from dist/index-DnICe6T_.js rename to dist/index-BPuSW_h3.js index 36f7c0e..cca826e 100644 --- a/dist/index-DnICe6T_.js +++ b/dist/index-BPuSW_h3.js @@ -1,6 +1,6 @@ System.register("ExcelTable",[],function(Pe,ye){"use strict";return{execute:function(){Pe({d:ho,e:go,f:xo,g:Fe,h:bo,i:Co,j:Be,k:po,r:Ut,s:uo,t:yo});function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Yt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=Yt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function ce(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function de(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=ce(e);e=r||""}return e.replace(/^#/,"")}function Vt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:Vt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},zt=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mm.j)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await ye.import("./FileSaver.min-DXmtgrTw.js").then(f=>f.F)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Wt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Gt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=ce(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=ce(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=ce(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=ce(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=ce(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let X=ce(P.backgroundColor);!X&&Z&&(X=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...X?{backgroundColor:X}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),q=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...q?{rowspan:q}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((X,K)=>{if("c"+(K+B)in N)for(let M=0;M<=j+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(X,null);if(X.getAttribute("colspan")||X.getAttribute("rowspan")){let M=Wt(X.getAttribute("colspan")*1,X.getAttribute("rowspan")*1,K,j,N,X.textContent,oe,N);u.length{u.length500,...isNaN(q)?{}:{size:q},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=X.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length `+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u.curr=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Jt(e,t){return` +`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[s]=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Jt(e,t){return` Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` `;return}u>0&&(m=' xml:space="preserve"',l+=` `),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=Qt,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",fe="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(W!="-"||fe!="Regular")&&(C='&"'+W+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=de(x.color,o),W=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` @@ -41,4 +41,4 @@ System.register("ExcelTable",[],function(Pe,ye){"use strict";return{execute:func `+(Array.isArray(C)&&C.length>0?C.reduce((W,fe)=>W+""+fe+"",""):"")+""+b.commentString+""),x+=''+(Y.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(D==null||D.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?ke.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,W)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||se.length>0||b.backgroundImageRef>0){const C=_e==null?void 0:_e.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let k="";b.selectedView||b.splitOption?k='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":k='0?' view="'+b.viewType+'"':"")+"/>",_e==null||_e.file(b.key+".xml",` `+b.tabColor+k+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(se.length>0?' ':"")+"")}),ae.length>0){let w=f==null?void 0:f.folder("ctrlProps");ae.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,Ft,[...new Set(ve)],Ke,ae,xe,At)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){ye.import("./FileSaver.min-DXmtgrTw.js").then(a=>a.F).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let s=0;s(o[d].labelCounter++,z0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(Z):o[d].data[P]={...o[d].data[P],...Z},o[d].headerIndex=P,P++);let B=Object.keys(oe),X=S.data.length>=o[d].data.length;if(o[d].data=S.data.reduce((K,L,E)=>{let $={};return K.length>E+P?$=K[E+P]:K.push($),B.forEach(q=>{let U=oe[q];$[U]=L[q]?L[q]:""}),$.tableIndex=r,$.tableStringIndex=E+","+j,K[E+P]=$,K},o[d].data),X&&S.spaceY){const K=o[d].headers.length;for(let L=0;L{let v=o[f];return s.sheet.push({...v,name:f}),s},{sheet:u})}function Qe(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function et(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const s=t[m];if(!("color"in s))throw"border-The border must have a color.";if(!("style"in s))throw"border-The border needs a style.";if(typeof s.style=="string"&&l.indexOf(s.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!et(l.to))throw'value of "to" is not valid.';if(l.from&&!et(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{Qe(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!Qe(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function wt(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!xt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const s=ao[u];if($e(m,s,u,t,r))return!0})})}function Tt(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];$e(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if($e(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))Tt(l);else throw"Sheet must be Array.";else n=="styles"&&wt(l)})}function $e(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function fo(e){return e?" ":","}function St(e,t){return e.substring(0,e.length-t)+` -`}async function kt(e,t=!1,r=!1){const o=fo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let S=0;S{f+=Et(d[G])+o}),s+=St(f,l)}g.push(s)}),e.backend)return g;const u=await ye.import("./FileSaver.min-DXmtgrTw.js").then(m=>m.F).then(m=>m.saveAs);if(t){const m=await ye.import("./jszip.min-49JP7itW.js").then(v=>v.j).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const Ot={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function mo(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let S=await ye.import("./read-utils-C8-wmTaQ.js").then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(s),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let X=[],K=!1,L=0;do{L++;const E=S.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const J=document.createElement("button");oe.forEach(ge=>{J.style[ge]=D[ge]}),J.addEventListener("click",ge=>{const we=J.getAttribute("data-sheet"),Te=d.querySelector('div[data-sheet="'+we+'"]');if(Te){P.forEach(ie=>{J.style[ie]=j[ie]});const ke=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");Te.setAttribute("data-sheet-activate","1"),Te.style.display="flex",J.setAttribute("data-sheet-button-activate","1"),ke&&(oe.forEach(ie=>{ke.style[ie]=D[ie]}),ke.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+we)}),J.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),J.innerText=E.value[1]||E.value[0],B.appendChild(J),d.appendChild($)}let q=n?"th":"td";const U=document.createElement("table");z.forEach(J=>{U.style[J]=s[J]});const M=S.data[E.value[0]]||S.data[E.value[1]],ve=S.maxLengthOfColumn[E.value[0]]||S.maxLengthOfColumn[E.value[1]];if(Array.isArray(M)){const J=M.length;for(let ge=0;ge{xe.style[pe]=f[pe]}),xe.innerText=ie,Te.appendChild(xe)}U.appendChild(Te),q="td"}}l?X.push(U):($.appendChild(U),d==null||d.appendChild($)),K=E.done}while(!K);if(l)return X;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(q=>{$.style[q]=j[q]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function po(e,t,r=!0,o="property"){let n=await ye.import("./read-utils-C8-wmTaQ.js").then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let S={};j.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,D.push(S)}),l=Object.assign(l,{[m]:D})}),l}const So=Pe("a",Ct),ko=Pe("b",oo);function ho(e,t,r={}){const o=Gt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function uo(e){const t=lo(e);return Be(t)}function yo(e,t){return Be(zt(e,t))}function go(e,t=!1,r){return ye.import("./read-utils-C8-wmTaQ.js").then(o=>o.extractExcelData(e,t,r))}function xo(e,t=!1){return kt(e,t,!1)}function bo(e,t=!1){return kt(e,t,!0)}function Co(e,t,r,o={...Ot}){return o={...Ot,...o},mo(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}}}}); +`}async function kt(e,t=!1,r=!1){const o=fo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let S=0;S{f+=Et(d[G])+o}),s+=St(f,l)}g.push(s)}),e.backend)return g;const u=await ye.import("./FileSaver.min-DXmtgrTw.js").then(m=>m.F).then(m=>m.saveAs);if(t){const m=await ye.import("./jszip.min-49JP7itW.js").then(v=>v.j).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const Ot={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function mo(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let S=await ye.import("./read-utils-CwMyWpVb.js").then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(s),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let X=[],K=!1,L=0;do{L++;const E=S.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const J=document.createElement("button");oe.forEach(ge=>{J.style[ge]=D[ge]}),J.addEventListener("click",ge=>{const we=J.getAttribute("data-sheet"),Te=d.querySelector('div[data-sheet="'+we+'"]');if(Te){P.forEach(ie=>{J.style[ie]=j[ie]});const ke=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");Te.setAttribute("data-sheet-activate","1"),Te.style.display="flex",J.setAttribute("data-sheet-button-activate","1"),ke&&(oe.forEach(ie=>{ke.style[ie]=D[ie]}),ke.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+we)}),J.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),J.innerText=E.value[1]||E.value[0],B.appendChild(J),d.appendChild($)}let q=n?"th":"td";const U=document.createElement("table");z.forEach(J=>{U.style[J]=s[J]});const M=S.data[E.value[0]]||S.data[E.value[1]],ve=S.maxLengthOfColumn[E.value[0]]||S.maxLengthOfColumn[E.value[1]];if(Array.isArray(M)){const J=M.length;for(let ge=0;ge{xe.style[pe]=f[pe]}),xe.innerText=ie,Te.appendChild(xe)}U.appendChild(Te),q="td"}}l?X.push(U):($.appendChild(U),d==null||d.appendChild($)),K=E.done}while(!K);if(l)return X;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(q=>{$.style[q]=j[q]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function po(e,t,r=!0,o="property"){let n=await ye.import("./read-utils-CwMyWpVb.js").then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let S={};j.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,D.push(S)}),l=Object.assign(l,{[m]:D})}),l}const So=Pe("a",Ct),ko=Pe("b",oo);function ho(e,t,r={}){const o=Gt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function uo(e){const t=lo(e);return Be(t)}function yo(e,t){return Be(zt(e,t))}function go(e,t=!1,r){return ye.import("./read-utils-CwMyWpVb.js").then(o=>o.extractExcelData(e,t,r))}function xo(e,t=!1){return kt(e,t,!1)}function bo(e,t=!1){return kt(e,t,!0)}function Co(e,t,r,o={...Ot}){return o={...Ot,...o},mo(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}}}}); diff --git a/dist/index-BRPJRQwV.js b/dist/index-BYjrfbvd.js similarity index 98% rename from dist/index-BRPJRQwV.js rename to dist/index-BYjrfbvd.js index 8c3ecfe..0d288d4 100644 --- a/dist/index-BRPJRQwV.js +++ b/dist/index-BYjrfbvd.js @@ -1,6 +1,6 @@ define(["require","exports"],function(ge,ae){"use strict";function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function qt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=qt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function fe(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function pe(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=fe(e);e=r||""}return e.replace(/^#/,"")}function zt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:zt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Ut=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let i=0;i0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mge(["./jszip.min-CGrYsaMq"],m,i)).then(m=>m.jszip_min)).default;let g;if(typeof e=="string"&&e.length){let m,i=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,i=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return i?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let i=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let R=j;Object.keys(t).forEach(S=>{var d;R=R.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=R})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await new Promise((f,v)=>ge(["./FileSaver.min-DbxQUYqv"],f,v)).then(f=>f.FileSaver_min)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Gt(e,t,r,o,n,l,g,u){let m=[],i="both",f=[];!t||t===0?(t=1,i="col"):f.push(t-1),!e||e===0?(e=0,i="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,i]:[i],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let j=0;j=1?(v["c"+S]=l,l="",g+="*",R--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":j>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Zt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},i=40;if(l){let j=!1,R=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=fe(z.backgroundColor);if(!j)R=G.length,j=!0,typeof o=="function"?i=o(Number(z.height.substring(0,z.height.length-2)),d,!0):i=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=fe(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=fe(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=fe(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=fe(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let J=fe(P.backgroundColor);!J&&Z&&(J=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...J?{backgroundColor:J}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let T;typeof n=="function"?T=n(Number(P.width.substring(0,P.width.length-2)),oe):T=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),Y=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...Y?{rowspan:Y}:{},text:N.textContent,...isNaN(T)||T<=0?{}:{size:T}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((J,K)=>{if("c"+(K+B)in N)for(let M=0;M<=R+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(J,null);if(J.getAttribute("colspan")||J.getAttribute("rowspan")){let M=Gt(J.getAttribute("colspan")*1,J.getAttribute("rowspan")*1,K,R,N,J.textContent,oe,N);u.length{u.length500,...isNaN(Y)?{}:{size:Y},...T?{border:T}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=J.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length `+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,i)=>(i=i.toLowerCase(),u[i]?m:i=="svg"?(u.png=!0,u.svg=!0,m+''):i=="jpeg"||i=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u.curr=!0,m+'')),"")+t.reduce((m,i)=>m+'',"")+e+(g.length>0?g.reduce((m,i)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,i)=>m+'',"")+(n.length>0?n.reduce((m,i,f)=>m+'',""):"")+''}function Qt(e,t){return` +`+r.reduce((m,i)=>(i=i.toLowerCase(),u[i]?m:i=="svg"?(u.png=!0,u.svg=!0,m+''):i=="jpeg"||i=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[i]=!0,m+'')),"")+t.reduce((m,i)=>m+'',"")+e+(g.length>0?g.reduce((m,i)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,i)=>m+'',"")+(n.length>0?n.reduce((m,i,f)=>m+'',""):"")+''}function Qt(e,t){return` Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let i=t,f=i.formula.indexOf("=")==0?i.formula.substring(1):i.formula,v=e.indexOf(":")>0,j=i.referenceCells?i.referenceCells:e,R=v?e.substring(0,e.indexOf(":")):e,S=R.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=i.returnType?i.returnType:i.isArray||v?' t="str"':"",z="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"",Z=i.isArray||v?' t="array" ref="'+j+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const i=t;if(i.noArgType=="NOW"||i.noArgType=="TODAY"){const f="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType+"()"}else{let f="NOW()";const v="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const i=t;let f="";typeof i.value<"u"&&(f=","+i.value);let v="";i.type=="COT"&&(v="_xlfn.");const j="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+v+i.type+"("+i.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const i=t;n='"+i.type+"("+i.start.toUpperCase()+":"+i.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` `;return}u>0&&(m=' xml:space="preserve"',l+=` `),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Je(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ct=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Ae(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Xe=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function vt(e,t,r){Xe[e],Xe[e][t]=r}function wt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&wt(e,t.length>0?t+"."+n:n,l):vt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){wt(e,"",t)}function ro(e,t){let r=t,o=Xe[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let i=0;iu+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...bt];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await new Promise((w,a)=>ge(["./jszip.min-CGrYsaMq"],w,a)).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const i=e.sheet.length;let f=m.folder("xl"),v=null,j=null,R=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=eo,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",me="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(W!="-"||me!="Regular")&&(C='&"'+W+","+me+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Se=pe(x.color,o);typeof Se=="string"&&Se.length>0&&(C+="&K"+Se.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=pe(x.color,o),W=pe(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=pe(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=pe(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let ce="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,ce=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` @@ -41,4 +41,4 @@ define(["require","exports"],function(ge,ae){"use strict";function dt(e){return `+(Array.isArray(C)&&C.length>0?C.reduce((W,me)=>W+""+me+"",""):"")+""+b.commentString+""),x+=''+(V.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(j==null||j.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?Oe.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,W)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||ce.length>0||b.backgroundImageRef>0){const C=Ie==null?void 0:Ie.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let k="";b.selectedView||b.splitOption?k='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":k='0?' view="'+b.viewType+'"':"")+"/>",Ie==null||Ie.file(b.key+".xml",` `+b.tabColor+k+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(ce.length>0?' ':"")+"")}),ie.length>0){let w=f==null?void 0:f.folder("ctrlProps");ie.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,At,[...new Set(we)],Ke,ie,be,_t)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){new Promise((a,b)=>ge(["./FileSaver.min-DbxQUYqv"],a,b)).then(a=>a.FileSaver_min).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let i=0;i(o[d].labelCounter++,z0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(Z):o[d].data[P]={...o[d].data[P],...Z},o[d].headerIndex=P,P++);let B=Object.keys(oe),J=S.data.length>=o[d].data.length;if(o[d].data=S.data.reduce((K,L,T)=>{let $={};return K.length>T+P?$=K[T+P]:K.push($),B.forEach(Y=>{let U=oe[Y];$[U]=L[Y]?L[Y]:""}),$.tableIndex=r,$.tableStringIndex=T+","+R,K[T+P]=$,K},o[d].data),J&&S.spaceY){const K=o[d].headers.length;for(let L=0;L{let v=o[f];return i.sheet.push({...v,name:f}),i},{sheet:u})}function Qe(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function et(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const i=t[m];if(!("color"in i))throw"border-The border must have a color.";if(!("style"in i))throw"border-The border needs a style.";if(typeof i.style=="string"&&l.indexOf(i.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!et(l.to))throw'value of "to" is not valid.';if(l.from&&!et(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{Qe(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!Qe(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function Tt(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!xt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const i=ao[u];if($e(m,i,u,t,r))return!0})})}function Et(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];$e(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if($e(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))Et(l);else throw"Sheet must be Array.";else n=="styles"&&Tt(l)})}function $e(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function mo(e){return e?" ":","}function kt(e,t){return e.substring(0,e.length-t)+` -`}async function Ot(e,t=!1,r=!1){const o=mo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let i="",f="";const v=m.headers;let j=[],R=v.length;for(let S=0;S{f+=St(d[G])+o}),i+=kt(f,l)}g.push(i)}),e.backend)return g;const u=await new Promise((m,i)=>ge(["./FileSaver.min-DbxQUYqv"],m,i)).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await new Promise((v,j)=>ge(["./jszip.min-CGrYsaMq"],v,j)).then(v=>v.jszip_min).then(v=>v.default);let i=new m;g.forEach((v,j)=>{i.file("sheet"+(j+1)+n,v)});const f=await i.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var i=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(i,(e.fileName?e.fileName:"tableRecord")+n)})}const Ft={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function po(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},i={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},j={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},R={background:"#EEEDEB"}){let S=await new Promise((T,$)=>ge(["./read-utils-u30qVyXC"],T,$)).then(async T=>await T.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(i),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(j),P=Object.keys(R);let B=document.createElement("div");N.forEach(T=>{B.style[T]=v[T]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(T=>{d.style[T]=m[T]}),d.appendChild(B));let J=[],K=!1,L=0;do{L++;const T=S.sheetName.next();if(!T.value)break;const $=document.createElement("div");if($.style.display="none",!l){const X=document.createElement("button");oe.forEach(xe=>{X.style[xe]=j[xe]}),X.addEventListener("click",xe=>{const Te=X.getAttribute("data-sheet"),Ee=d.querySelector('div[data-sheet="'+Te+'"]');if(Ee){P.forEach(se=>{X.style[se]=R[se]});const Oe=d.querySelector("[data-sheet-button-activate]");let ie=d.querySelector("[data-sheet-activate]");Ee.setAttribute("data-sheet-activate","1"),Ee.style.display="flex",X.setAttribute("data-sheet-button-activate","1"),Oe&&(oe.forEach(se=>{Oe.style[se]=j[se]}),Oe.removeAttribute("data-sheet-button-activate")),ie&&(ie.style.display="none",ie.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+Te)}),X.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),X.innerText=T.value[1]||T.value[0],B.appendChild(X),d.appendChild($)}let Y=n?"th":"td";const U=document.createElement("table");z.forEach(X=>{U.style[X]=i[X]});const M=S.data[T.value[0]]||S.data[T.value[1]],we=S.maxLengthOfColumn[T.value[0]]||S.maxLengthOfColumn[T.value[1]];if(Array.isArray(M)){const X=M.length;for(let xe=0;xe{be.style[he]=f[he]}),be.innerText=se,Ee.appendChild(be)}U.appendChild(Ee),Y="td"}}l?J.push(U):($.appendChild(U),d==null||d.appendChild($)),K=T.done}while(!K);if(l)return J;{const T=d.querySelector('div[data-sheet="1"]');T&&(T.style.display="flex",T.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(Y=>{$.style[Y]=R[Y]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function ho(e,t,r=!0,o="property"){let n=await new Promise((u,m)=>ge(["./read-utils-u30qVyXC"],u,m)).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],i=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let R=0;R<=f;R++)g[R]=o+(R+1);let v=r,j=[];i.forEach(R=>{let S={};R.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,j.push(S)}),l=Object.assign(l,{[m]:j})}),l}const uo=vt,yo=oo;function go(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function xo(e){const t=lo(e);return Be(t)}function bo(e,t){return Be(Ut(e,t))}function Co(e,t=!1,r){return new Promise((o,n)=>ge(["./read-utils-u30qVyXC"],o,n)).then(o=>o.extractExcelData(e,t,r))}function vo(e,t=!1){return Ot(e,t,!1)}function wo(e,t=!1){return Ot(e,t,!0)}function To(e,t,r,o={...Ft}){return o={...Ft,...o},po(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}ae.addGlobalOptionFromExcelTable=yo,ae.addGlobalOptions=uo,ae.cols=bt,ae.convertTableToExcel=go,ae.excelToJson=ho,ae.excelToNode=To,ae.extractExcelData=Co,ae.generateCSV=vo,ae.generateExcel=Be,ae.generateText=wo,ae.getColRowBaseOnRefString=Ae,ae.replaceInExcel=Wt,ae.sideBySideLineByLine=xo,ae.themeBaseGenerate=bo,ae.validateExcelTable=fo}); +`}async function Ot(e,t=!1,r=!1){const o=mo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let i="",f="";const v=m.headers;let j=[],R=v.length;for(let S=0;S{f+=St(d[G])+o}),i+=kt(f,l)}g.push(i)}),e.backend)return g;const u=await new Promise((m,i)=>ge(["./FileSaver.min-DbxQUYqv"],m,i)).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await new Promise((v,j)=>ge(["./jszip.min-CGrYsaMq"],v,j)).then(v=>v.jszip_min).then(v=>v.default);let i=new m;g.forEach((v,j)=>{i.file("sheet"+(j+1)+n,v)});const f=await i.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var i=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(i,(e.fileName?e.fileName:"tableRecord")+n)})}const Ft={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function po(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},i={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},j={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},R={background:"#EEEDEB"}){let S=await new Promise((T,$)=>ge(["./read-utils-DODcKE84"],T,$)).then(async T=>await T.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(i),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(j),P=Object.keys(R);let B=document.createElement("div");N.forEach(T=>{B.style[T]=v[T]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(T=>{d.style[T]=m[T]}),d.appendChild(B));let J=[],K=!1,L=0;do{L++;const T=S.sheetName.next();if(!T.value)break;const $=document.createElement("div");if($.style.display="none",!l){const X=document.createElement("button");oe.forEach(xe=>{X.style[xe]=j[xe]}),X.addEventListener("click",xe=>{const Te=X.getAttribute("data-sheet"),Ee=d.querySelector('div[data-sheet="'+Te+'"]');if(Ee){P.forEach(se=>{X.style[se]=R[se]});const Oe=d.querySelector("[data-sheet-button-activate]");let ie=d.querySelector("[data-sheet-activate]");Ee.setAttribute("data-sheet-activate","1"),Ee.style.display="flex",X.setAttribute("data-sheet-button-activate","1"),Oe&&(oe.forEach(se=>{Oe.style[se]=j[se]}),Oe.removeAttribute("data-sheet-button-activate")),ie&&(ie.style.display="none",ie.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+Te)}),X.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),X.innerText=T.value[1]||T.value[0],B.appendChild(X),d.appendChild($)}let Y=n?"th":"td";const U=document.createElement("table");z.forEach(X=>{U.style[X]=i[X]});const M=S.data[T.value[0]]||S.data[T.value[1]],we=S.maxLengthOfColumn[T.value[0]]||S.maxLengthOfColumn[T.value[1]];if(Array.isArray(M)){const X=M.length;for(let xe=0;xe{be.style[he]=f[he]}),be.innerText=se,Ee.appendChild(be)}U.appendChild(Ee),Y="td"}}l?J.push(U):($.appendChild(U),d==null||d.appendChild($)),K=T.done}while(!K);if(l)return J;{const T=d.querySelector('div[data-sheet="1"]');T&&(T.style.display="flex",T.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(Y=>{$.style[Y]=R[Y]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function ho(e,t,r=!0,o="property"){let n=await new Promise((u,m)=>ge(["./read-utils-DODcKE84"],u,m)).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],i=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let R=0;R<=f;R++)g[R]=o+(R+1);let v=r,j=[];i.forEach(R=>{let S={};R.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,j.push(S)}),l=Object.assign(l,{[m]:j})}),l}const uo=vt,yo=oo;function go(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function xo(e){const t=lo(e);return Be(t)}function bo(e,t){return Be(Ut(e,t))}function Co(e,t=!1,r){return new Promise((o,n)=>ge(["./read-utils-DODcKE84"],o,n)).then(o=>o.extractExcelData(e,t,r))}function vo(e,t=!1){return Ot(e,t,!1)}function wo(e,t=!1){return Ot(e,t,!0)}function To(e,t,r,o={...Ft}){return o={...Ft,...o},po(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}ae.addGlobalOptionFromExcelTable=yo,ae.addGlobalOptions=uo,ae.cols=bt,ae.convertTableToExcel=go,ae.excelToJson=ho,ae.excelToNode=To,ae.extractExcelData=Co,ae.generateCSV=vo,ae.generateExcel=Be,ae.generateText=wo,ae.getColRowBaseOnRefString=Ae,ae.replaceInExcel=Wt,ae.sideBySideLineByLine=xo,ae.themeBaseGenerate=bo,ae.validateExcelTable=fo}); diff --git a/dist/index-xyzS9dVO.cjs b/dist/index-CzrjgJVS.cjs similarity index 98% rename from dist/index-xyzS9dVO.cjs rename to dist/index-CzrjgJVS.cjs index d57a0e8..e0d0f1e 100644 --- a/dist/index-xyzS9dVO.cjs +++ b/dist/index-CzrjgJVS.cjs @@ -1,6 +1,6 @@ "use strict";function Rt(e){return e.replace(/ /g,"")}function Dt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Vt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=Dt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function kt(e){const t=Vt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function Ot(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=Dt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function tt(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function me(e){e=Rt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(tt(t[0])+tt(t[1])+tt(t[2])).toUpperCase()}function he(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=Rt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=me(e);e=r||""}return e.replace(/^#/,"")}function zt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function Ft(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:zt(g)}),l),o)}const ot={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Ut=function(e,t={...ot}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=Ft(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:Ft(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:ot.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:ot.rowBackgroundColor,l=t&&t.negativeColor?Ot(o):t&&t.headerColor?t.headerColor:kt(o),g=t&&t.negativeColor?Ot(n):t&&t.rowColor?t.rowColor:kt(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mrequire("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(f=>f.FileSaver_min)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Gt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Zt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=me(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=me(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=me(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=me(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=me(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let J=me(P.backgroundColor);!J&&Z&&(J=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...J?{backgroundColor:J}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),M=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...M?{rowspan:M}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((J,K)=>{if("c"+(K+B)in N)for(let q=0;q<=j+1&&"c"+(K+q)in N;q++)B++;K+=B;let L=window.getComputedStyle(J,null);if(J.getAttribute("colspan")||J.getAttribute("rowspan")){let q=Gt(J.getAttribute("colspan")*1,J.getAttribute("rowspan")*1,K,j,N,J.textContent,oe,N);u.length{u.length500,...isNaN(M)?{}:{size:M},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=J.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length `+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u.curr=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Qt(e,t){return` +`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[s]=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Qt(e,t){return` Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function rt(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function nt(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?At(e.comment):[""]}else n=e?At(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function At(e){var t=e.split(/\r?\n|\r|\n/g);return t}function lt(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` `;return}u>0&&(m=' xml:space="preserve"',l+=` `),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',$e=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function at(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=$e(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const Lt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_t=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function _e(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=Ke(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},it=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Nt(e,t,r){it[e],it[e][t]=r}function Bt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&Bt(e,t.length>0?t+"."+n:n,l):Nt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){Bt(e,"",t)}function ro(e,t){let r=t,o=it[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function qe(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=Lt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...Ht];e.numberOfColumn&&e.numberOfColumn>25&&(l=Ke(l,e.numberOfColumn));const u=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=eo,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",ce="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(ce="Bold"),x.italic&&(ce=="Regular"&&(ce=""),ce+="Italic"),(W!="-"||ce!="Regular")&&(C='&"'+W+","+ce+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Te=he(x.color,o);typeof Te=="string"&&Te.length>0&&(C+="&K"+Te.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=he(x.color,o),W=he(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=he(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=he(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` @@ -41,4 +41,4 @@ `+(Array.isArray(C)&&C.length>0?C.reduce((W,ce)=>W+""+ce+"",""):"")+""+b.commentString+""),x+=''+(Y.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(D==null||D.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?Se.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,W)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||se.length>0||b.backgroundImageRef>0){const C=Fe==null?void 0:Fe.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let k="";b.selectedView||b.splitOption?k='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":k='0?' view="'+b.viewType+'"':"")+"/>",Fe==null||Fe.file(b.key+".xml",` `+b.tabColor+k+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(se.length>0?' ':"")+"")}),ae.length>0){let w=f==null?void 0:f.folder("ctrlProps");ae.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,ft,[...new Set(Ce)],De,ae,ge,mt)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(a=>a.FileSaver_min).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let s=0;s(o[d].labelCounter++,z0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(Z):o[d].data[P]={...o[d].data[P],...Z},o[d].headerIndex=P,P++);let B=Object.keys(oe),J=S.data.length>=o[d].data.length;if(o[d].data=S.data.reduce((K,L,E)=>{let $={};return K.length>E+P?$=K[E+P]:K.push($),B.forEach(M=>{let U=oe[M];$[U]=L[M]?L[M]:""}),$.tableIndex=r,$.tableStringIndex=E+","+j,K[E+P]=$,K},o[d].data),J&&S.spaceY){const K=o[d].headers.length;for(let L=0;L{let v=o[f];return s.sheet.push({...v,name:f}),s},{sheet:u})}function st(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function ct(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const s=t[m];if(!("color"in s))throw"border-The border must have a color.";if(!("style"in s))throw"border-The border needs a style.";if(typeof s.style=="string"&&l.indexOf(s.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!ct(l.to))throw'value of "to" is not valid.';if(l.from&&!ct(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{st(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!st(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function $t(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!Lt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const s=ao[u];if(Me(m,s,u,t,r))return!0})})}function Kt(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];Me(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if(Me(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))Kt(l);else throw"Sheet must be Array.";else n=="styles"&&$t(l)})}function Me(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function po(e){return e?" ":","}function Pt(e,t){return e.substring(0,e.length-t)+` -`}async function qt(e,t=!1,r=!1){const o=po(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let S=0;S{f+=It(d[G])+o}),s+=Pt(f,l)}g.push(s)}),e.backend)return g;const u=await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(v=>v.jszip_min).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const jt={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function ho(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let S=await Promise.resolve().then(()=>require("./read-utils-omGMVauH.cjs")).then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(s),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let J=[],K=!1,L=0;do{L++;const E=S.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const X=document.createElement("button");oe.forEach(ye=>{X.style[ye]=D[ye]}),X.addEventListener("click",ye=>{const ve=X.getAttribute("data-sheet"),we=d.querySelector('div[data-sheet="'+ve+'"]');if(we){P.forEach(ie=>{X.style[ie]=j[ie]});const Se=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");we.setAttribute("data-sheet-activate","1"),we.style.display="flex",X.setAttribute("data-sheet-button-activate","1"),Se&&(oe.forEach(ie=>{Se.style[ie]=D[ie]}),Se.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+ve)}),X.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),X.innerText=E.value[1]||E.value[0],B.appendChild(X),d.appendChild($)}let M=n?"th":"td";const U=document.createElement("table");z.forEach(X=>{U.style[X]=s[X]});const q=S.data[E.value[0]]||S.data[E.value[1]],Ce=S.maxLengthOfColumn[E.value[0]]||S.maxLengthOfColumn[E.value[1]];if(Array.isArray(q)){const X=q.length;for(let ye=0;ye{ge.style[de]=f[de]}),ge.innerText=ie,we.appendChild(ge)}U.appendChild(we),M="td"}}l?J.push(U):($.appendChild(U),d==null||d.appendChild($)),K=E.done}while(!K);if(l)return J;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(M=>{$.style[M]=j[M]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function uo(e,t,r=!0,o="property"){let n=await Promise.resolve().then(()=>require("./read-utils-omGMVauH.cjs")).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let S={};j.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,D.push(S)}),l=Object.assign(l,{[m]:D})}),l}const yo=Nt,go=oo;function xo(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return qe(o)}function bo(e){const t=lo(e);return qe(t)}function Co(e,t){return qe(Ut(e,t))}function vo(e,t=!1,r){return Promise.resolve().then(()=>require("./read-utils-omGMVauH.cjs")).then(o=>o.extractExcelData(e,t,r))}function wo(e,t=!1){return qt(e,t,!1)}function To(e,t=!1){return qt(e,t,!0)}function Eo(e,t,r,o={...jt}){return o={...jt,...o},ho(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}exports.addGlobalOptionFromExcelTable=go;exports.addGlobalOptions=yo;exports.cols=Ht;exports.convertTableToExcel=xo;exports.excelToJson=uo;exports.excelToNode=Eo;exports.extractExcelData=vo;exports.generateCSV=wo;exports.generateExcel=qe;exports.generateText=To;exports.getColRowBaseOnRefString=_e;exports.replaceInExcel=Wt;exports.sideBySideLineByLine=bo;exports.themeBaseGenerate=Co;exports.validateExcelTable=mo; +`}async function qt(e,t=!1,r=!1){const o=po(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let S=0;S{f+=It(d[G])+o}),s+=Pt(f,l)}g.push(s)}),e.backend)return g;const u=await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(v=>v.jszip_min).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const jt={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function ho(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let S=await Promise.resolve().then(()=>require("./read-utils-D8LB9Gmq.cjs")).then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const G=Object.keys(m),z=Object.keys(s),Z=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),G.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let J=[],K=!1,L=0;do{L++;const E=S.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const X=document.createElement("button");oe.forEach(ye=>{X.style[ye]=D[ye]}),X.addEventListener("click",ye=>{const ve=X.getAttribute("data-sheet"),we=d.querySelector('div[data-sheet="'+ve+'"]');if(we){P.forEach(ie=>{X.style[ie]=j[ie]});const Se=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");we.setAttribute("data-sheet-activate","1"),we.style.display="flex",X.setAttribute("data-sheet-button-activate","1"),Se&&(oe.forEach(ie=>{Se.style[ie]=D[ie]}),Se.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+ve)}),X.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),X.innerText=E.value[1]||E.value[0],B.appendChild(X),d.appendChild($)}let M=n?"th":"td";const U=document.createElement("table");z.forEach(X=>{U.style[X]=s[X]});const q=S.data[E.value[0]]||S.data[E.value[1]],Ce=S.maxLengthOfColumn[E.value[0]]||S.maxLengthOfColumn[E.value[1]];if(Array.isArray(q)){const X=q.length;for(let ye=0;ye{ge.style[de]=f[de]}),ge.innerText=ie,we.appendChild(ge)}U.appendChild(we),M="td"}}l?J.push(U):($.appendChild(U),d==null||d.appendChild($)),K=E.done}while(!K);if(l)return J;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(M=>{$.style[M]=j[M]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function uo(e,t,r=!0,o="property"){let n=await Promise.resolve().then(()=>require("./read-utils-D8LB9Gmq.cjs")).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let S={};j.forEach((d,G)=>{typeof d=="string"&&(v?g[G]=d:S[g[G]]=d)}),v=!1,D.push(S)}),l=Object.assign(l,{[m]:D})}),l}const yo=Nt,go=oo;function xo(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return qe(o)}function bo(e){const t=lo(e);return qe(t)}function Co(e,t){return qe(Ut(e,t))}function vo(e,t=!1,r){return Promise.resolve().then(()=>require("./read-utils-D8LB9Gmq.cjs")).then(o=>o.extractExcelData(e,t,r))}function wo(e,t=!1){return qt(e,t,!1)}function To(e,t=!1){return qt(e,t,!0)}function Eo(e,t,r,o={...jt}){return o={...jt,...o},ho(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}exports.addGlobalOptionFromExcelTable=go;exports.addGlobalOptions=yo;exports.cols=Ht;exports.convertTableToExcel=xo;exports.excelToJson=uo;exports.excelToNode=Eo;exports.extractExcelData=vo;exports.generateCSV=wo;exports.generateExcel=qe;exports.generateText=To;exports.getColRowBaseOnRefString=_e;exports.replaceInExcel=Wt;exports.sideBySideLineByLine=bo;exports.themeBaseGenerate=Co;exports.validateExcelTable=mo; diff --git a/dist/index-Cav6spD2.js b/dist/index-DMAk0ysA.js similarity index 98% rename from dist/index-Cav6spD2.js rename to dist/index-DMAk0ysA.js index 277112e..d527ce9 100644 --- a/dist/index-Cav6spD2.js +++ b/dist/index-DMAk0ysA.js @@ -398,7 +398,7 @@ function Gt(e, t) { function Zt(e, t, r, o, n, l, g) { let u = {}; return ` -` + r.reduce((m, s) => (s = s.toLowerCase(), u[s] ? m : s == "svg" ? (u.png = !0, u.svg = !0, m + '') : s == "jpeg" || s == "jpg" ? (u.jpeg = !0, u.jpg = !0, m + '') : (u.curr = !0, m + '')), "") + t.reduce((m, s) => m + '', "") + e + (g.length > 0 ? g.reduce((m, s) => m + '', "") : "") + '' + (l ? '' : "") + '' + o.reduce((m, s) => m + '', "") + (n.length > 0 ? n.reduce((m, s, f) => m + '', "") : "") + ''; +` + r.reduce((m, s) => (s = s.toLowerCase(), u[s] ? m : s == "svg" ? (u.png = !0, u.svg = !0, m + '') : s == "jpeg" || s == "jpg" ? (u.jpeg = !0, u.jpg = !0, m + '') : (u[s] = !0, m + '')), "") + t.reduce((m, s) => m + '', "") + e + (g.length > 0 ? g.reduce((m, s) => m + '', "") : "") + '' + (l ? '' : "") + '' + o.reduce((m, s) => m + '', "") + (n.length > 0 ? n.reduce((m, s, f) => m + '', "") : "") + ''; } function Xt(e, t) { return ` @@ -2308,7 +2308,7 @@ async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { }, j = { background: "#EEEDEB" }) { - let S = await import("./read-utils-C7gudp0B.js").then( + let S = await import("./read-utils-YAGe6NNW.js").then( async (E) => await E.extractExcelData(e, !1, o) ), d = null; if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) @@ -2392,7 +2392,7 @@ async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { } } async function uo(e, t, r = !0, o = "property") { - let n = await import("./read-utils-C7gudp0B.js").then( + let n = await import("./read-utils-YAGe6NNW.js").then( async (u) => await u.extractExcelData(e, !1, t) ), l = {}, g = []; return Object.keys(n.sheetNameObject).forEach((u) => { @@ -2429,7 +2429,7 @@ function Co(e, t) { return ct(zt(e, t)); } function vo(e, t = !1, r) { - return import("./read-utils-C7gudp0B.js").then( + return import("./read-utils-YAGe6NNW.js").then( (o) => o.extractExcelData(e, t, r) ); } diff --git a/dist/read-utils-C8-wmTaQ.js b/dist/read-utils-CwMyWpVb.js similarity index 97% rename from dist/read-utils-C8-wmTaQ.js rename to dist/read-utils-CwMyWpVb.js index b7c2746..c47491c 100644 --- a/dist/read-utils-C8-wmTaQ.js +++ b/dist/read-utils-CwMyWpVb.js @@ -1 +1 @@ -System.register("ExcelTable",["./index-DnICe6T_.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); +System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); diff --git a/dist/read-utils-omGMVauH.cjs b/dist/read-utils-D8LB9Gmq.cjs similarity index 97% rename from dist/read-utils-omGMVauH.cjs rename to dist/read-utils-D8LB9Gmq.cjs index ad92e58..c55b446 100644 --- a/dist/read-utils-omGMVauH.cjs +++ b/dist/read-utils-D8LB9Gmq.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-xyzS9dVO.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; diff --git a/dist/read-utils-u30qVyXC.js b/dist/read-utils-DODcKE84.js similarity index 97% rename from dist/read-utils-u30qVyXC.js rename to dist/read-utils-DODcKE84.js index a316b34..26ca0f0 100644 --- a/dist/read-utils-u30qVyXC.js +++ b/dist/read-utils-DODcKE84.js @@ -1 +1 @@ -define(["require","exports","./index-BRPJRQwV"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); +define(["require","exports","./index-BYjrfbvd"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/read-utils-C7gudp0B.js b/dist/read-utils-YAGe6NNW.js similarity index 98% rename from dist/read-utils-C7gudp0B.js rename to dist/read-utils-YAGe6NNW.js index 1dba4e0..d715a4b 100644 --- a/dist/read-utils-C7gudp0B.js +++ b/dist/read-utils-YAGe6NNW.js @@ -1,4 +1,4 @@ -import { g as R, c as T } from "./index-Cav6spD2.js"; +import { g as R, c as T } from "./index-DMAk0ysA.js"; function B(s) { return /t="s".*? in data : {"header label":"value","XYZ":12} + */ mapSheetDataOption?: { + /** Outline level of the sheet data. */ outlineLevel?: string; + /** Indicates if the sheet data is hidden. */ hidden?: string; + /** Height of the sheet data. */ height?: string; }; + /** Background image of the sheet. */ backgroundImage?: string; + /** Array of conditional formatting rules. */ conditionalFormatting?: ConditionalFormatting[]; + /** Function for multi-style condition. */ multiStyleCondition?: MultiStyleConditionFunction; + /** Indicates if the sheet should use split based on match. */ useSplitBaseOnMatch?: boolean; + /** Indicates if strings should be converted to numbers Automatically. */ convertStringToNumber?: boolean; + /** Array of images in the sheet. */ images?: ImageTypes[]; + /** Formula applied to the sheet. */ formula?: Formula; + /** Page options for the sheet. */ pageOption?: PageOption; + /** Name of the sheet. */ name?: string; + /** Title of the sheet. */ title?: Title; + /** Shift sheet from top. */ shiftTop?: number; + /** Shift sheet from Left. */ shiftLeft?: number; + /** Indicates if the sheet is selected. */ selected?: boolean; + /** Tab color of the sheet. */ tabColor?: string; + /** Array of merge ranges in the sheet. */ merges?: string[]; + /** Key for the header style. */ headerStyleKey?: string; + /** Function for merge row data base on condition. */ mergeRowDataCondition?: MergeRowDataConditionFunction; + /** Function for style cell base on condition. */ styleCellCondition?: StyleCellConditionFunction; + /** Function for comment base on condition. */ commentCondition?: CommentConditionFunction; + /** Sort and filter options for the sheet. */ sortAndFilter?: SortAndFilter; + /** State of the sheet (hidden or visible). */ state?: "hidden" | "visible"; + /** Options for the header row. */ headerRowOption?: object; + /** Protection options for the sheet. */ protectionOption?: ProtectionOption; + /** Height of the header. */ headerHeight?: number; + /** Array of checkboxes in the sheet. */ checkbox?: Checkbox[]; + /** View options for the sheet. */ viewOption?: ViewOption; + /** Indicates if the sheet is right-to-left. */ rtl?: boolean; + /** Page break options for the sheet. */ pageBreak?: PageBreak; + /** Options for displaying the sheet as a table. */ asTable?: AsTableOption; + /** Array of dropdowns in the sheet. */ dropDowns?: DropDown[]; } +/** + * Options for displaying the sheet as a table. + * @interface + */ export interface AsTableOption { + /** The type of table style. */ type?: "Light" | "Medium" | "Dark"; + /** The style number of the table. */ styleNumber?: number; + /** Indicates if the first column should be styled. */ firstColumn?: boolean; + /** Indicates if the last column should be styled. */ lastColumn?: boolean; + /** Indicates if row stripes should be applied. */ rowStripes?: boolean; + /** Indicates if column stripes should be applied. */ columnStripes?: boolean; } + +/** + * Options for page breaks in the sheet. + * @interface + */ export interface PageBreak { + /** Array of row indices where page breaks should occur. */ row?: number[]; + /** Array of column indices where page breaks should occur. */ column?: number[]; } + +/** + * Options for the start of the view. + * @interface + */ export interface ViewStart { t?: string; b?: string; @@ -80,13 +176,25 @@ export interface ViewStart { one?: string; two?: string; } + +/** + * Options for configuring the view of the sheet. + * @interface + */ export interface ViewOption { + /** The type of view. */ type?: "pageLayout" | "pageBreakPreview"; + /** Indicates if the grid should be hidden. */ hideGrid?: boolean; + /** Indicates if the headlines should be hidden. */ hideHeadlines?: boolean; + /** Indicates if the ruler should be hidden. */ hideRuler?: boolean; + /** Options for freezing rows or columns. */ frozenOption?: { + /** The type of freezing. */ type: "ROW" | "COLUMN" | "BOTH" | "R" | "C" | "B"; + /** The index/position at which to freeze. */ index: | number | { @@ -94,9 +202,13 @@ export interface ViewOption { c: number; }; }; + /** Options for splitting the view. */ splitOption?: { + /** The type of split. */ type: "VERTICAL" | "HORIZONTAL" | "BOTH" | "V" | "H" | "B"; + /** The start position of the split. */ startAt?: ViewStart; + /** The position of the split. */ split: | number | { @@ -105,21 +217,44 @@ export interface ViewOption { }; }; } + +/** + * Options for header and footer. + * @interface + */ export interface HeaderFooterOption { + /** The text of the header or footer. */ text?: string; + /** The style ID of the header or footer. */ styleId?: string; } + +/** + * Location map for header and footer options.l:Left, c:Center, r:Right + * @interface + */ export interface HeaderFooterLocationMap { l?: HeaderFooterOption; c?: HeaderFooterOption; r?: HeaderFooterOption; } + +/** + * Types of header and footer in page(odd page, even page,first page). + * @interface + */ export interface HeaderFooterTypes { odd?: HeaderFooterLocationMap; even?: HeaderFooterLocationMap; first?: HeaderFooterLocationMap; } + +/** + * Options for configuring the page. + * @interface + */ export interface PageOption { + /** Margin settings for the page. */ margin?: { left?: number; right?: number; @@ -128,44 +263,106 @@ export interface PageOption { header?: number; footer?: number; }; + /** Header settings for the page. */ header?: HeaderFooterTypes; + /** Footer settings for the page. */ footer?: HeaderFooterTypes; + /** Indicates if the page is in portrait orientation. */ isPortrait: boolean; } -export interface Header { +/** + * Represents a header in the sheet. + * @interface + * @extends {HeaderOption} + */ +export interface Header extends HeaderOption { + /** The label of the header. */ label: string; + /** The text of the header. */ text: string; +} + +/** + * Options for configuring a header. + * @interface + */ +export interface HeaderOption { + /** The size(width) of the header. */ size?: number; + /** Array of multi-style values for the header. */ multiStyleValue?: MultiStyleValue[]; + /** Comment for the header. */ comment?: Comment | string; + /** Conditional formatting options for the header. */ conditionalFormatting?: ConditionalFormattingOption; + /** Formula applied to the column. */ formula?: { + /** The type of the formula. */ type: FormulaType; + /** The style ID of the formula. */ styleId?: string; }; } +/** + * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). + * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType + */ + export type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; + +/** + * Represents the body of a style. + * @interface + */ export interface StyleBody { + /** The font family of the text. */ fontFamily?: string; + /** The type of the style.(if not define used for cells, for other type should be define) */ type?: StyleType; + /** The size of the font. */ size?: number; + /** The index of the style(!!it's will override by process,Don't set value for it). */ index?: number; + /** The alignment options of the text. */ alignment?: AlignmentOption; + /** The border options. */ border?: BorderOption; + /** The format of the text. */ format?: string; + /** Indicates if the style is bold. */ bold?: boolean; + /** Indicates if the style is underlined. */ underline?: boolean; + /** Indicates if the style is italic. */ italic?: boolean; + /** Indicates if the style has double underline. */ doubleUnderline?: boolean; + /** The color of the style. */ color?: string; + /** The background color of the style. */ backgroundColor?: string; } + +/** + * Represents a collection of styles. + * @interface + */ export interface Styles { [key: string]: StyleBody; } +/** + * Represents data in the sheet. + * @interface + * @extends {DataOptions} + */ export interface Data extends DataOptions { [key: string]: string | number | any | undefined; } + +/** + * Options for configuring data in the sheet. + * @interface + */ export interface DataOptions { [key: string]: | "0" @@ -174,6 +371,7 @@ export interface DataOptions { | string | undefined | MapComment + /** Array of multi-style values for the data. */ | MapMultiStyleValue; outlineLevel?: number; hidden?: "0" | "1" | number; @@ -183,10 +381,21 @@ export interface DataOptions { comment?: MapComment; } +/** + * Represents a dropdown in the sheet. + * @interface + */ export interface DropDown { + /** Array of options for the dropdown. */ option: (string | number)[]; + /** Array of columns the dropdown applies to. */ for: string[]; } + +/** + * Represents a map of rows in the sheet. + * @interface + */ export interface RowMap { [rowNumber: number]: { startTag: string; @@ -194,9 +403,31 @@ export interface RowMap { details: string; }; } + +/** + * Represents protection options for the sheet. + * @typedef {Object} ProtectionOption + * @property {"0" | "1" | 0 | 1} sheet - Protect the sheet. + * @property {"0" | "1" | 0 | 1} formatCells - Allow formatting cells. + * @property {"0" | "1" | 0 | 1} formatColumns - Allow formatting columns. + * @property {"0" | "1" | 0 | 1} formatRows - Allow formatting rows. + * @property {"0" | "1" | 0 | 1} insertColumns - Allow inserting columns. + * @property {"0" | "1" | 0 | 1} insertRows - Allow inserting rows. + * @property {"0" | "1" | 0 | 1} insertHyperlinks - Allow inserting hyperlinks. + * @property {"0" | "1" | 0 | 1} deleteColumns - Allow deleting columns. + * @property {"0" | "1" | 0 | 1} deleteRows - Allow deleting rows. + * @property {"0" | "1" | 0 | 1} sort - Allow sorting. + * @property {"0" | "1" | 0 | 1} autoFilter - Allow using auto filter. + * @property {"0" | "1" | 0 | 1} pivotTables - Allow using pivot tables. + */ export type ProtectionOption = { [key in ProtectionOptionKey]: "0" | "1" | 0 | 1; }; + +/** + * Keys for protection options. + * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey + */ export type ProtectionOptionKey = | "sheet" | "formatCells" @@ -210,12 +441,22 @@ export type ProtectionOptionKey = | "sort" | "autoFilter" | "pivotTables"; + +/** + * Operations for conditional formatting cells. + * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation + */ export type ConditionalFormattingCellsOperation = | "lt" | "gt" | "between" | "eq" | "ct"; + +/** + * Operations for conditional formatting icon sets. + * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation + */ export type ConditionalFormattingIconSetOperation = | "3Arrows" | "4Arrows" @@ -223,26 +464,56 @@ export type ConditionalFormattingIconSetOperation = | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"; + +/** + * Operations for conditional formatting top values. + * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation + */ export type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage"; + +/** + * Options for conditional formatting. + * @interface + */ export interface ConditionalFormattingOption { + /** The type of conditional formatting. */ type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top"; + /** The operator for the conditional formatting. */ operator?: | string | ConditionalFormattingCellsOperation | ConditionalFormattingIconSetOperation | ConditionalFormattingTopOperation; - + /** The value for the conditional formatting. */ value?: number | string; + /** The priority of the conditional formatting. */ priority?: number; + /** The colors for the conditional formatting. */ colors?: string[]; + /** Indicates if the conditional formatting is for the bottom values. */ bottom?: boolean; + /** The style ID for the conditional formatting. */ styleId?: string; + /** The percentage for the conditional formatting. */ percent?: number; } + +/** + * Represents conditional formatting in the sheet. + * @interface + * @extends {ConditionalFormattingOption} + */ export interface ConditionalFormatting extends ConditionalFormattingOption { + /** The start cell for the conditional formatting. */ start: string; + /** The end cell for the conditional formatting. */ end: string; } + +/** + * Represents an image in the sheet. + * @interface + */ export interface ImageTypes { url: string; from: string; @@ -260,6 +531,11 @@ export interface ImageTypes { top?: number; }; } + +/** + * Represents side-by-side data in the sheet. + * @interface + */ export interface SideBySide { sheetName?: string; spaceX?: number; @@ -268,6 +544,11 @@ export interface SideBySide { data: Data[]; headerIndex?: number; } + +/** + * Keys for alignment options. + * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey + */ export type AlignmentOptionKey = | "horizontal" | "vertical" @@ -276,8 +557,23 @@ export type AlignmentOptionKey = | "readingOrder" | "textRotation" | "indent"; + +/** + * Horizontal alignment options. + * @typedef {"center" | "left" | "right"} AlignmentHorizontal + */ export type AlignmentHorizontal = "center" | "left" | "right"; + +/** + * Vertical alignment options. + * @typedef {"center" | "top" | "bottom"} AlignmentVertical + */ export type AlignmentVertical = "center" | "top" | "bottom"; + +/** + * Options for configuring alignment. + * @interface + */ export interface AlignmentOption { horizontal?: AlignmentHorizontal; vertical?: AlignmentVertical; @@ -289,7 +585,17 @@ export interface AlignmentOption { rtl?: boolean; ltr?: boolean; } + +/** + * Directions for border options. + * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection + */ export type BorderDirection = "full" | "top" | "left" | "right" | "bottom"; + +/** + * Options for configuring borders. + * @interface + */ export type BorderOption = { [key in BorderDirection]?: { color: string; @@ -309,29 +615,64 @@ export type BorderOption = { }; }; +/** + * Represents a map of multi-style values. + * @interface + */ export interface MapMultiStyleValue { [key: string]: MultiStyleValue[]; } + +/** + * Represents a multi-style value. + * @interface + */ export interface MultiStyleValue { value: string | number; styleId?: string; } + +/** + * Represents a multi-style regex value. + * @interface + */ export interface MultiStyleRexValue { reg: RegExp | string; styleId: string; } + +/** + * Represents a comment in the sheet. + * @interface + */ export interface Comment { comment?: string; styleId?: string; author?: string; } +/** + * Represents a map of merge row conditions. + * @interface + */ export interface MergeRowConditionMap { [columnKey: string]: { inProgress: boolean; start: number; }; } + +/** + * Function type for multi-style condition. + * @callback MultiStyleConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {MultiStyleValue[] | null} The multi-style values or null. + */ export type MultiStyleConditionFunction = ( data: Header | string | number | undefined, object: null | Data, @@ -341,6 +682,17 @@ export type MultiStyleConditionFunction = ( fromHeader: boolean ) => MultiStyleValue[] | null; +/** + * Function type for comment condition. + * @callback CommentConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {Comment | string | false | undefined | null} The comment or null. + */ export type CommentConditionFunction = ( data: Header | string | number | undefined, object: null | Data, @@ -349,6 +701,18 @@ export type CommentConditionFunction = ( colIndex: number, fromHeader: boolean ) => Comment | string | false | undefined | null; + +/** + * Function type for style cell condition. + * @callback StyleCellConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {Header | Data} object - The data object. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @param {string[]} styleKeys - The style keys. + * @returns {string | null} The style key or null. + */ export type StyleCellConditionFunction = ( data: Header | string | number | undefined, object: Header | Data, @@ -357,16 +721,36 @@ export type StyleCellConditionFunction = ( fromHeader: boolean, styleKeys: string[] ) => string | null; + +/** + * Function type for merge row data condition. + * @callback MergeRowDataConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {string | null} key - The key. + * @param {number} index - The index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {boolean} The result of the condition. + */ export type MergeRowDataConditionFunction = ( data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean ) => boolean; + +/** + * Represents sort and filter options. + * @interface + */ export interface SortAndFilter { mode: "all" | "ref"; ref?: string; } + +/** + * Represents the title of the sheet. + * @interface + */ export interface Title { shiftTop?: number; shiftLeft?: number; @@ -378,9 +762,19 @@ export interface Title { multiStyleValue?: MultiStyleValue[]; comment?: Comment | string; } + +/** + * Options for the header row. + * @interface + */ export interface HeaderRowOption { outlineLevel: "string"; } + +/** + * Represents a checkbox in the sheet. + * @interface + */ export interface Checkbox { col: number; row: number; @@ -392,6 +786,11 @@ export interface Checkbox { startStr?: string; endStr?: string; } + +/** + * Types of no-argument formulas. + * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType + */ export type NoArgFormulaType = | "NOW" | "TODAY" @@ -404,7 +803,17 @@ export type NoArgFormulaType = | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"; + +/** + * Types of formulas. + * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType + */ export type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; + +/** + * Types of single-reference formulas. + * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType + */ export type SingleRefFormulaType = | "LEN" | "MODE" @@ -427,12 +836,22 @@ export type SingleRefFormulaType = | "COUNTIF" | "SUMIF" | "TRIM"; + +/** + * Represents a format map. + * @interface + */ export interface FormatMap { [format: string]: { key: number; value?: string; }; } + +/** + * Represents a formula in the sheet. + * @interface + */ export interface Formula { [insertCell: string]: | FormulaSetting @@ -440,12 +859,22 @@ export interface Formula { | NoArgFormulaSetting | CustomFormulaSetting; } + +/** + * Represents a formula setting. + * @interface + */ export interface FormulaSetting { type: FormulaType; start: string; end: string; styleId?: string; } + +/** + * Represents a custom formula setting. + * @interface + */ export interface CustomFormulaSetting { isArray?: boolean; referenceCells?: string; @@ -453,16 +882,31 @@ export interface CustomFormulaSetting { returnType?: string; styleId?: string; } + +/** + * Represents a single-reference formula setting. + * @interface + */ export interface SingleRefFormulaSetting { type: SingleRefFormulaType; referenceCell: string; value?: number | string; styleId?: string; } + +/** + * Represents a no-argument formula setting. + * @interface + */ export interface NoArgFormulaSetting { noArgType: NoArgFormulaType; styleId?: string; } + +/** + * Represents a style mapper. + * @interface + */ export interface StyleMapper { conditionalFormatting: { count: number; @@ -494,9 +938,19 @@ export interface StyleMapper { value: string; }; } + +/** + * Represents a map of comments. + * @interface + */ export interface MapComment { [key: string]: Comment | string; } + +/** + * Represents theme options. + * @interface + */ export interface ThemeOption { negativeColor?: boolean; headerColor?: string; @@ -506,16 +960,37 @@ export interface ThemeOption { fileName?: string; filterKeys?: string[]; } + +/** + * Represents extracted data. + * @typedef {(string | null | undefined)[][]} ExtractedData + */ export type ExtractedData = (string | null | undefined)[][]; + +/** + * Represents the result of data extraction. + * @interface + */ export interface ExtractResult { [sheetName: string]: ExtractedData; } + +/** + * Represents the result of reading data. + * @interface + */ export interface ReadResult { data: ExtractResult; sheetNameObject: Record; sheetName: IterableIterator<[string, string]>; maxLengthOfColumn: Record; } + +/** + * Represents a buffer. + * @class + * @extends {Uint8Array} + */ export declare class Buffer extends Uint8Array { constructor(str: string, encoding?: string); constructor(size: number); @@ -548,6 +1023,11 @@ export declare class Buffer extends Uint8Array { length: number; byteOffset: number; } + +/** + * Represents options for the replacer. + * @interface + */ export interface ReplacerOption { fileName?: string; backend?: boolean; @@ -556,6 +1036,11 @@ export interface ReplacerOption { notSave?: boolean; generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; } + +/** + * Represents configuration options for Excel to Node. + * @interface + */ export interface ExcelToNodeConfig { fetchFunc?: Function; firstHeader?: boolean; @@ -568,4 +1053,4 @@ export interface ExcelToNodeConfig { buttonContainerStyle?: object; buttonStyle?: object; activeButtonStyle?: object; -} +} \ No newline at end of file diff --git a/src/functions/generate-excel.ts b/src/functions/generate-excel.ts index 260e752..bbb09c1 100644 --- a/src/functions/generate-excel.ts +++ b/src/functions/generate-excel.ts @@ -2300,7 +2300,6 @@ export async function generateExcel( " " + " " + workbookString + - "" + " " + " " + " " + @@ -2316,7 +2315,6 @@ export async function generateExcel( '">' + " " + sharedString + - "" + "" ); @@ -2338,9 +2336,7 @@ export async function generateExcel( ' Target="sharedStrings.xml" />' + " " + workbookRelString + - "" + " " + - "" + "" ); diff --git a/src/index.ts b/src/index.ts index 50b6e36..b63460a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,8 +26,20 @@ import { excelToNode as mainExcelToNode, } from "./functions/excel-to-node"; import { excelToJson } from "./functions/excel-to-json"; + export const addGlobalOptions = addGlobalOptionsFunc; export const addGlobalOptionFromExcelTable = addGlobalOptionFromExcelTableFunc; + +/** + * Converts an HTML table to an Excel file. + * @param {string} [queryForTable] - The query selector for the table. + * @param {HTMLTableElement} [table] - The HTML table element. + * @param {Object} [config] - The configuration options. + * @param {boolean} [config.keepStyle] - Whether to keep the style. + * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. + * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. + * @returns {Promise} The generated Excel table. + */ export function convertTableToExcel( queryForTable?: string, table?: HTMLTableElement, @@ -47,11 +59,22 @@ export function convertTableToExcel( return generateExcel(data); } +/** + * Generates an Excel file with side-by-side data. + * @param {SideBySide[][]} data - The side-by-side data. + * @returns {Promise} The generated Excel table. + */ export function sideBySideLineByLine(data: SideBySide[][]) { const exData: ExcelTable = sideBySide(data); return generateExcel(exData); } +/** + * Generates an Excel file with a theme. + * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. + * @param {ThemeOption} [option] - The theme options. + * @returns {Promise} The generated Excel table. + */ export function themeBaseGenerate( data: ExcelTable | Data[] | Data[][], option?: ThemeOption @@ -59,6 +82,13 @@ export function themeBaseGenerate( return generateExcel(themeGenerator(data, option)); } +/** + * Extracts data from an Excel file. + * @param {string} uri - The URI of the Excel file. + * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. + * @param {Function} [fetchFunc] - The function to fetch data. + * @returns {Promise} The extracted data. + */ export function extractExcelData( uri: string, isBackend: boolean = false, @@ -68,12 +98,35 @@ export function extractExcelData( m.extractExcelData(uri, isBackend, fetchFunc) ); } + +/** + * Generates a CSV file from an Excel table Object. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. + * @returns {Promise} The generated CSV file. + */ export function generateCSV(excelTable: ExcelTable, asZip: boolean = false) { return gCSV(excelTable, asZip, false); } + +/** + * Generates a text file from an Excel table Object. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. + * @returns {Promise} The generated text file. + */ export function generateText(excelTable: ExcelTable, asZip: boolean = false) { return gCSV(excelTable, asZip, true); } + +/** + * Converts an Excel file to a Node. + * @param {string} uri - The URI of the Excel file. + * @param {string | null} [queryForTable] - The query selector for the table. + * @param {HTMLDivElement | null} [containerElement] - The container element. + * @param {ExcelToNodeConfig} [config=defaultConfig] - The configuration options. + * @returns {Promise} The result of the conversion. + */ export function excelToNode( uri: string, queryForTable?: string | null, @@ -100,6 +153,7 @@ export function excelToNode( config.buttonStyle, config.activeButtonStyle ); -} +} + export type { DataModel }; -export { Validator, generateExcel, excelToJson, replaceInExcel }; +export { Validator, generateExcel, excelToJson, replaceInExcel }; \ No newline at end of file diff --git a/src/utils/content-generator/content-types.ts b/src/utils/content-generator/content-types.ts index 47b3fb6..ac0128f 100644 --- a/src/utils/content-generator/content-types.ts +++ b/src/utils/content-generator/content-types.ts @@ -43,7 +43,7 @@ export function contentTypeGenerator( res + '' ); } else { - typeCheck["curr"] = true; + typeCheck[curr] = true; return ( res + ' { @@ -31,9 +51,22 @@ function generatePathRecursive(key: string, path: string, data: object) { } }); } + +/** + * Adds global options from an Excel table. + * @param {string} key - The key for the global option. + * @param {ExcelTable} data - The Excel table data. + */ export function addGlobalOptionFromExcelTable(key: string, data: ExcelTable) { generatePathRecursive(key, "", data); } + +/** + * Applies configuration to an Excel table. + * @param {string} key - The key for the global option. + * @param {ExcelTable} data - The Excel table data. + * @returns {ExcelTable} The updated Excel table. + */ export function applyConfig(key: string, data: ExcelTable): ExcelTable { let data2 = data as any; let proxy2 = proxy[key]; @@ -59,6 +92,11 @@ export function applyConfig(key: string, data: ExcelTable): ExcelTable { return data2; } +/** + * Exported for testing purposes. + * @type {Object} + * @property {Function} generatePathRecursive - The generatePathRecursive function. + */ export const exportedForTesting = { generatePathRecursive, -}; +}; \ No newline at end of file From 1f96fa22e7c9f00c278be05b2043315ddedbbec7 Mon Sep 17 00:00:00 2001 From: "m.r" Date: Thu, 13 Mar 2025 01:23:45 -0800 Subject: [PATCH 4/7] fix: check range of record --- .../workflows/manually-release-publish.yml | 54 +- .npmrc | 4 +- README.md | 2 +- dist/excel-table.amd.js | 2 +- dist/excel-table.cjs | 2 +- dist/excel-table.d.ts | 20 +- dist/excel-table.iife.js | 22 +- dist/excel-table.js | 2 +- dist/excel-table.system.js | 2 +- dist/excel-table.umd.cjs | 34 +- dist/{index-BPuSW_h3.js => index-B8PpTQiZ.js} | 26 +- dist/{index-BYjrfbvd.js => index-DfuHK51s.js} | 28 +- ...{index-CzrjgJVS.cjs => index-DkpykvyS.cjs} | 30 +- dist/{index-DMAk0ysA.js => index-p1xk7Sgq.js} | 724 +++++++++--------- ...s-D8LB9Gmq.cjs => read-utils-BEg2qKSg.cjs} | 2 +- ...ils-CwMyWpVb.js => read-utils-Byj29Erp.js} | 2 +- ...ils-DODcKE84.js => read-utils-DXQsy33k.js} | 2 +- ...ils-YAGe6NNW.js => read-utils-DnAqiCj7.js} | 2 +- package.json | 5 +- src/functions/generate-excel.ts | 101 +-- 20 files changed, 555 insertions(+), 511 deletions(-) rename dist/{index-BPuSW_h3.js => index-B8PpTQiZ.js} (69%) rename dist/{index-BYjrfbvd.js => index-DfuHK51s.js} (69%) rename dist/{index-CzrjgJVS.cjs => index-DkpykvyS.cjs} (67%) rename dist/{index-DMAk0ysA.js => index-p1xk7Sgq.js} (82%) rename dist/{read-utils-D8LB9Gmq.cjs => read-utils-BEg2qKSg.cjs} (97%) rename dist/{read-utils-CwMyWpVb.js => read-utils-Byj29Erp.js} (97%) rename dist/{read-utils-DODcKE84.js => read-utils-DXQsy33k.js} (97%) rename dist/{read-utils-YAGe6NNW.js => read-utils-DnAqiCj7.js} (98%) diff --git a/.github/workflows/manually-release-publish.yml b/.github/workflows/manually-release-publish.yml index a83da78..2fbf8eb 100644 --- a/.github/workflows/manually-release-publish.yml +++ b/.github/workflows/manually-release-publish.yml @@ -1,6 +1,23 @@ name: Manually Release & Publish Package on: - workflow_dispatch + workflow_dispatch: + inputs: + skip-release: + description: 'Skip Release Job' + required: true + default: 'false' + type: choice + options: + - 'false' + - 'true' + skip-publish-gpr: + description: 'Skip publish Github Job' + required: true + default: 'false' + type: choice + options: + - 'false' + - 'true' # push: # branches: # - main @@ -13,6 +30,7 @@ on: # - CHANGELOG.md jobs: release: + if: ${{ github.event.inputs.skip-release == 'false' }} name: Create release package runs-on: ubuntu-latest steps: @@ -41,25 +59,33 @@ jobs: tag_name: ${{env.PV}} release_name: Release v${{env.PV}} body: ${{env.PB}} - publish-gpr: - needs: build + publish-gpr: + needs: release + if: ${{always() && (needs.release.result == 'success' || needs.release.result == 'skipped') && github.event.inputs.skip-publish-gpr == 'false'}} runs-on: ubuntu-latest permissions: contents: read packages: write steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://npm.pkg.github.com/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - publish: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to GitHub Packages + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://npm.pkg.github.com' + # Defaults to the user or organization that owns the workflow file + scope: '@mohammadrezaeicode' + - run: npm set @mohammadrezaeicode:registry=https://npm.pkg.github.com/ + - run: npm login --scope=@mohammadrezaeicode --registry=https://npm.pkg.github.com + - run: npm adduser + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + publish: name: Publish to NPM - needs: release + needs: publish-gpr + if: ${{always() && (needs.publish-gpr.result == 'success' || needs.publish-gpr.result == 'skipped') }} runs-on: ubuntu-latest steps: - name: Checkout to code diff --git a/.npmrc b/.npmrc index 68d2967..93326fc 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ -@mohammadrezaeicode:registry=https://npm.pkg.github.com +//@npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN} +mohammadrezaeicode:registry=https://npm.pkg.github.com +always-auth=true \ No newline at end of file diff --git a/README.md b/README.md index 135913d..87942c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MR Excel -![Test](https://github.com/mohammadrezaeicode/github-action/actions/workflows/test.yml/badge.svg) [![Release & Publish](https://github.com/mohammadrezaeicode/mr-excel-repo/actions/workflows/release.yml/badge.svg)](https://github.com/mohammadrezaeicode/mr-excel-repo/actions/workflows/release.yml) +![Test](https://github.com/mohammadrezaeicode/github-action/actions/workflows/test.yml/badge.svg) [![Release & Publish](https://github.com/mohammadrezaeicode/mr-excel-repo/actions/workflows/release.yml/badge.svg)](https://github.com/mohammadrezaeicode/mr-excel-repo/actions/workflows/manually-release-publish.yml) `MR-Excel` is a powerful JavaScript library designed for reading and writing Excel files. It enables users to extract data seamlessly from Excel documents while providing an array of advanced writing features. These include commenting, styling, applying formulas, merging cells, inserting images into cells, adding background images, grouping rows, and implementing conditional formatting. Additionally, the library supports multi-style values and offers functions for cell merging and styling, as well as commenting features. diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index 7620f9f..1de5e2c 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-BYjrfbvd"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); +define(["exports","./index-DfuHK51s"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index 7b54219..0c60a4f 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CzrjgJVS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DkpykvyS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index 10a8c76..d2ad689 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -215,7 +215,7 @@ declare type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage" * @param {boolean} [config.keepStyle] - Whether to keep the style. * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function convertTableToExcel(queryForTable?: string, table?: HTMLTableElement, config?: { keepStyle?: boolean; @@ -396,8 +396,8 @@ export declare function excelToJson(uri: string, fetchFunc?: Function, withHeade * @param {string} uri - The URI of the Excel file. * @param {string | null} [queryForTable] - The query selector for the table. * @param {HTMLDivElement | null} [containerElement] - The container element. - * @param {ExcelToNodeConfig} [config={}] - The configuration options. - * @returns {Promise} The result of the conversion. + * @param {ExcelToNodeConfig} [config=defaultConfig] - The configuration options. + * @returns {Promise} The result of the conversion. */ export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; @@ -436,7 +436,7 @@ declare type ExtractedData = (string | null | undefined)[][]; * @param {string} uri - The URI of the Excel file. * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. * @param {Function} [fetchFunc] - The function to fetch data. - * @returns {Promise} The extracted data. + * @returns {Promise} The extracted data. */ export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; @@ -487,20 +487,20 @@ declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; declare function generalValidationCheck(value: never, validateProperty: ValidationObject, property: string, strict: boolean, warn: boolean): boolean; /** - * Generates a CSV file from an Excel table. + * Generates a CSV file from an Excel table Object. * @param {ExcelTable} excelTable - The Excel table. * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. - * @returns {Promise} The generated CSV file. + * @returns {Promise} The generated CSV file. */ export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): Promise; export declare function generateExcel(data: ExcelTable, styleKey?: string): Promise; /** - * Generates a text file from an Excel table. + * Generates a text file from an Excel table Object. * @param {ExcelTable} excelTable - The Excel table. * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. - * @returns {Promise} The generated text file. + * @returns {Promise} The generated text file. */ export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; @@ -891,7 +891,7 @@ declare interface SideBySide { /** * Generates an Excel file with side-by-side data. * @param {SideBySide[][]} data - The side-by-side data. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; @@ -1021,7 +1021,7 @@ declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; * Generates an Excel file with a theme. * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. * @param {ThemeOption} [option] - The theme options. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index b550970..706dcd2 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1,9 +1,9 @@ -var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;oy[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),y=h.charAt(2);return w+w+o+o+y+y}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((y,c)=>y&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,y)=>o+y.charAt(0)+y.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),y=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),y)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let y=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(y):w&&w.headerColor?w.headerColor:Tt(y),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:y,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),y[_]=a})}return l});if(Object.keys(y).forEach(l=>{i.file(l,y[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,y,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,y,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var b=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=b.length,v=!0,typeof y=="function"?s=y(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),b.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;b.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof y=="function"?S.height=y(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length -`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,y,c,r,f){let i={};return` -`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` -Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,y){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let y=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(y=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` +var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;ob[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),b=h.charAt(2);return w+w+o+o+b+b}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((b,c)=>b&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,b)=>o+b.charAt(0)+b.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),b=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),b)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let b=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(b):w&&w.headerColor?w.headerColor:Tt(b),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:b,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),b[_]=a})}return l});if(Object.keys(b).forEach(l=>{i.file(l,b[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,b,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,b,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var y=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=y.length,v=!0,typeof b=="function"?s=b(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),y.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;y.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof b=="function"?S.height=b(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length +`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,b,c,r,f){let i={};return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+b.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` +Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,b){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),y=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let b=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(b=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return b&&c.unshift(r+":"),{hasAuthor:b,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,b){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` `;return}i>0&&(l=' xml:space="preserve"',r+=` -`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let y="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(h.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,y){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,y=pt[h];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const y=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,b=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,y),K=Ue(d.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` +`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=pt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` `};let he=1024;const Z={checkbox:` - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ye="",Ve=[],at=[],Ge=[],Me=[],Le={},Je="",Qe=!1,vt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;vt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;vt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(Qe=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Oe=G[ae];let xe="";if(Object.keys(Oe).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Oe[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Je=ee+Y+W,Je.length>0){Qe=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Je=""+Je+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(Qe=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=et(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(Qe&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=qe(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=qe(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=qe(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let xt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;xt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,h.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let wt;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),wt=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,h.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Oe=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Oe-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=dt(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Ee=Pe.indexOf(ke);Ee<0?Pe.push(ke):Ne=Ee}Ve.push({row:P+se-1,col:G}),Ye+=ut(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(d[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+tt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Ge.push(fe),W.conditionalFormatting&&Me.push(fe),at.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=dt(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Oe=G.author.toString();const xe=Pe.indexOf(Oe);xe<0?Pe.push(Oe):ae=xe}Ve.push({row:P-1,col:fe}),Ye+=ut(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+tt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const N=h.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),h.format){const T=o[h.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,d.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` -`};let de=1024;const Z={checkbox:`',rt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function pt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=rt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function Ye(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=tt(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},gt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){gt[h],gt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=gt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function nt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=tt(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>at)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` +`};let he=1024;const Z={checkbox:` @@ -27,21 +27,21 @@ - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ve="",Ge=[],st=[],Xe=[],Me=[],Le={},Qe="",et=!1,xt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;xt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;xt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(et=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Ie=G[ae];let xe="";if(Object.keys(Ie).reduce((he,ce)=>(ce=="l"?he.splice(0,0,ce):ce=="c"?he.splice(1,0,ce):ce=="r"&&he.splice(2,0,ce),he),[]).forEach(he=>{const ce=Ie[he];xe+="&"+he.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Qe=ee+Y+W,Qe.length>0){et=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Qe=""+Qe+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(et=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=tt(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(et&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=Ye(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),de++;let W=e+""+de++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=Ye(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=Ye(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let wt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;wt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,d.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let Ct;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),Ct=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,d.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Ie=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",he=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Ie-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=ut(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Te=Pe.indexOf(ke);Te<0?Pe.push(ke):Ne=Te}Ge.push({row:P+se-1,col:G}),Ve+=mt(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(h[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,he):E+=""+rt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Xe.push(fe),W.conditionalFormatting&&Me.push(fe),st.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=ut(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Ie=G.author.toString();const xe=Pe.indexOf(Ie);xe<0?Pe.push(Ie):ae=xe}Ge.push({row:P-1,col:fe}),Ve+=mt(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,d.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+rt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";h[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=Qt,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},X={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",fe="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(G!="-"||fe!="Regular")&&(C='&"'+G+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){X[a]=w.conditionalFormatting.count;let C=de(x.color,o),G=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,q));let oe='',P="",B=0,J="",M="",L={};const E={};let $="",Y=4,W=!1,K=-1,ve=[],Q=1;const ge={checkbox:` `};let we=1024;const Te={checkbox:` - `};let ae=[],ie="",xe=!1,pe=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",fe="",Ee="",Se="",je="",nt=!1,_t="",It="",Pt="",jt="",be=Object.assign([],a.merges),ue=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,he=[],Me="",qe=[],Rt=[],at=[],it=[],Oe={},De="",Le=!1,st="";if(a.rtl&&(Se+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){je="pageBreakPreview";const i=T.row.length;st+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){je="pageBreakPreview";const i=T.column.length;st+=''+T.column.reduce((y,p)=>y+'',"")+""}}let Dt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Le=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Dt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(je=i.type),i.hideRuler&&(Se+=' showRuler="0" '),i.hideGrid&&(Se+=' showGridLines="0" '),i.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Le=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Se+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Ee='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Se+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Se+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Ee='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const T=ge.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=Fe(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),we++;let c=w+""+we++;const _="_x0000_s"+c;It+=Te.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=Fe(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Fe(A,l);O.row+=1,O.col+=1,h.end={...O}}jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Pt+='',_t+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;ct=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=J++,F="image"+_+"."+c,A=await bt(T,F,o,e.fetch);A||y("image not load"),ve.push(c),i({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const c="image"+J+++"."+p;return{type:p,image:await bt(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(be.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let me=he.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=he.indexOf(ee);re<0?he.push(ee):me=re}qe.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,me)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,R):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',pe||(pe=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Rt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Oe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=he.indexOf(le);V<0?he.push(le):O=V}qe.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(xe=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Je(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ct=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Ae(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Xe=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function vt(e,t,r){Xe[e],Xe[e][t]=r}function wt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&wt(e,t.length>0?t+"."+n:n,l):vt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){wt(e,"",t)}function ro(e,t){let r=t,o=Xe[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let i=0;iu+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...bt];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await new Promise((w,a)=>ge(["./jszip.min-CGrYsaMq"],w,a)).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const i=e.sheet.length;let f=m.folder("xl"),v=null,j=null,R=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,Y=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",me="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(G!="-"||me!="Regular")&&(C='&"'+G+","+me+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Se=pe(x.color,o);typeof Se=="string"&&Se.length>0&&(C+="&K"+Se.toUpperCase())}return U[a]=C,w}if(Y&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=pe(x.color,o),G=pe(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const q={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=pe(x.backgroundColor,o);q.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=pe(x.color,o);q.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let ce="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,ce=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),q.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(q.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(q.fillIndex>0?' applyFill="1" ':"")+(q.fontIndex>=0?' applyFont="1" ':"")+(q.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:Y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,Y));let oe='',P="",B=0,X="",$="",L={};const T={};let M="",V=4,W=!1,K=-1,we=[],Q=1;const xe={checkbox:` `};let Te=1024;const Ee={checkbox:` - `};let ie=[],se="",be=!1,he=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",me="",Se="",ke="",je="",nt=!1,It="",Pt="",jt="",Rt="",Ce=Object.assign([],a.merges),ye=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,ue=[],Me="",Ye=[],Dt=[],at=[],it=[],Fe={},De="",Le=!1,st="";if(a.rtl&&(ke+=' rightToLeft="1" '),a.pageBreak){const E=a.pageBreak;if(E.row&&Array.isArray(E.row)){je="pageBreakPreview";const s=E.row.length;st+=''+E.row.reduce((y,p)=>y+'',"")+""}if(E.column&&Array.isArray(E.column)){je="pageBreakPreview";const s=E.column.length;st+=''+E.column.reduce((y,p)=>y+'',"")+""}}let Lt="";if(a.pageOption){const E=a.pageOption;if(E.isPortrait&&(Le=!0),E.margin){const F=E.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Lt=''}let s="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(E[F]){const h=E[F];typeof h=="object"&&Object.keys(h).forEach(O=>{s.indexOf(O)<0&&(s+=O);const le=h[O];let q="";if(Object.keys(le).reduce((D,I)=>(I=="l"?D.splice(0,0,I):I=="c"?D.splice(1,0,I):I=="r"&&D.splice(2,0,I),D),[]).forEach(D=>{const I=le[D];q+="&"+D.toUpperCase(),I.styleId&&z[I.styleId]&&(q+=z[I.styleId]),I.text&&(q+=I.text)}),q="<"+O+A+">"+q+"",O=="odd")y+=q;else if(O=="even")p+=q;else if(O=="first")c+=q;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let E="";const s=a.viewOption;s.type&&(je=s.type),s.hideRuler&&(ke+=' showRuler="0" '),s.hideGrid&&(ke+=' showGridLines="0" '),s.hideHeadlines&&(ke+=' showRowColHeaders="0" ');let y=s.splitOption;if(typeof y>"u"&&(Le=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(E=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(ke+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Se='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(ke+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Se='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(ke+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Se='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const E=xe.checkbox;a.checkbox.forEach((s,y)=>{let p=E;if(s.link){let O=Ae(s.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),Te++;let c=w+""+Te++;const _="_x0000_s"+c;Pt+=Ee.checkbox.replace("***id***",_).replace("***text***",s.text);let F=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof F=="string"&&F.length>=2){let O=Ae(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Ae(A,l);O.row+=1,O.col+=1,h.end={...O}}Rt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",jt+='',It+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const E=a.backgroundImage;ct=new Promise(async(s,y)=>{let p=E.lastIndexOf("."),c;p>0?(c=E.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await Ct(E,F,o,e.fetch);A||y("image not load"),we.push(c),s({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(E,s)=>{let y=E.url.lastIndexOf("."),p;y>0?(p=E.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",we.push(p);const c="image"+X+++"."+p;return{type:p,image:await Ct(E.url,c,o,e.fetch),obj:E,i:s,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const E=a.headers.length;let s="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:E,q=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",D=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(Ce.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let de=ue.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=ue.indexOf(ee);re<0?ue.push(ee):de=re}Ye.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,de)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},s+='',s+=''+B+"",s+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,D):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),ce&&(H+='',he||(he=f==null?void 0:f.folder("tables"))),V.start=l[p]+""+k,V.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(ce&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Dt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Fe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const q=ue.indexOf(le);q<0?ue.push(le):O=q}Ye.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ye&&ye[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(be=!0,se+=h.chainCell),C+=h.cell,delete ye[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),ce&&(H+=""),a.withoutHeader)C+=s;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=s+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Me=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function at(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Me(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const Lt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_t=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function _e(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=$e(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},it=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Nt(e,t,r){it[e],it[e][t]=r}function Bt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&Bt(e,t.length>0?t+"."+n:n,l):Nt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){Bt(e,"",t)}function ro(e,t){let r=t,o=it[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Ke(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=Lt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...Ht];e.numberOfColumn&&e.numberOfColumn>25&&(l=$e(l,e.numberOfColumn));const u=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",ce="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(ce="Bold"),x.italic&&(ce=="Regular"&&(ce=""),ce+="Italic"),(G!="-"||ce!="Regular")&&(C='&"'+G+","+ce+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Te=he(x.color,o);typeof Te=="string"&&Te.length>0&&(C+="&K"+Te.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=he(x.color,o),G=he(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=he(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=he(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,q));let oe='',P="",B=0,X="",$="",L={};const E={};let M="",Y=4,W=!1,K=-1,Ce=[],Q=1;const ye={checkbox:` `};let ve=1024;const we={checkbox:` - `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I"); + x.alignment && (x.alignment.rtl && (x.alignment.readingOrder = 2), delete x.alignment.rtl, x.alignment.ltr && (x.alignment.readingOrder = 1), delete x.alignment.ltr, se = ' applyAlignment="1"> C + " " + G + '="' + x.alignment[G] + '" ', "") + " />"); const H = x.border; - let k = ""; - if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.right || H.full) && (O += ''), (H.top || H.full) && (k += ''), (H.top || H.full) && (O += ''), (H.bottom || H.full) && (k += ''), (H.bottom || H.full) && (O += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { + ).replace("#", "") + '" />'), V.borderIndex = w.border.count, w.border.count++, w.border.value += "" + O + ""), x.format) { const C = r[x.format]; - C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); + C && (V.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); } - return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; + return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (V.fillIndex > 0 ? ' applyFill="1" ' : "") + (V.fontIndex >= 0 ? ' applyFont="1" ' : "") + (V.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; }, { conditionalFormatting: { - count: G ? 1 : 0, + count: q ? 1 : 0, value: ' ' }, commentSyntax: { @@ -826,10 +826,10 @@ async function ct(e, t = "") { } } ); - f == null || f.file("styles.xml", Gt(N, G)); - let oe = '', P = "", B = 0, X = "", K = "", L = {}; + f == null || f.file("styles.xml", Gt(N, q)); + let oe = '', P = "", B = 0, J = "", $ = "", L = {}; const E = {}; - let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; + let M = "", Y = 4, W = !1, K = -1, Ce = [], Q = 1; const ye = { checkbox: ` ` @@ -866,12 +866,12 @@ async function ct(e, t = "") { let ae = [], ie = "", ge = !1, de = null; for (let w = 0; w < s; w++) { const a = e.sheet[w], b = w + 1; - let x = {}, Y = { + let x = {}, V = { start: "", end: "" }; const se = a.asTable; - let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( + let H = "", O = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", G = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( [], a.conditionalFormatting ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; @@ -898,8 +898,8 @@ async function ct(e, t = "") { if (a.pageOption) { const T = a.pageOption; if (T.isPortrait && (je = !0), T.margin) { - const F = T.margin; - let A = { + const S = T.margin; + let F = { left: 0.7, right: 0.7, top: 0.75, @@ -907,36 +907,36 @@ async function ct(e, t = "") { header: 0.3, footer: 0.3 }; - Object.keys(A).forEach((h) => { - typeof F[h] == "number" && (A[h] = F[h]); - }), gt = ''; + Object.keys(F).forEach((h) => { + typeof S[h] == "number" && (F[h] = S[h]); + }), gt = ''; } let i = "", y = "", p = "", c = ""; - if (["header", "footer"].forEach((F) => { - const A = F.charAt(0).toUpperCase() + F.substring(1); - if (T[F]) { - const h = T[F]; - typeof h == "object" && Object.keys(h).forEach((O) => { - i.indexOf(O) < 0 && (i += O); - const le = h[O]; - let V = ""; + if (["header", "footer"].forEach((S) => { + const F = S.charAt(0).toUpperCase() + S.substring(1); + if (T[S]) { + const h = T[S]; + typeof h == "object" && Object.keys(h).forEach((A) => { + i.indexOf(A) < 0 && (i += A); + const le = h[A]; + let z = ""; if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { const I = le[R]; - V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); - }), V = "<" + O + A + ">" + V + "", O == "odd") - y += V; - else if (O == "even") - p += V; - else if (O == "first") - c += V; + z += "&" + R.toUpperCase(), I.styleId && U[I.styleId] && (z += U[I.styleId]), I.text && (z += I.text); + }), z = "<" + A + F + ">" + z + "", A == "odd") + y += z; + else if (A == "even") + p += z; + else if (A == "first") + c += z; else throw "type error"; }); } }), Pe = y + p + c, Pe.length > 0) { je = !0; - const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; - Pe = "" + Pe + ""; + const S = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", F = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; + Pe = "" + Pe + ""; } } if (a.viewOption) { @@ -957,7 +957,7 @@ async function ct(e, t = "") { }; } else if (p.type == "C" || p.type == "COLUMN") { let c; - typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { + typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = $e(l, c)), y = { type: "V", startAt: { r: l[c] + 1 @@ -996,10 +996,10 @@ async function ct(e, t = "") { a.checkbox.forEach((i, y) => { let p = T; if (i.link) { - let O = Re(i.link, l); + let A = Re(i.link, l); p = p.replace( "**fmlaLink**", - 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' + 'fmlaLink="$' + l[A.col] + "$" + (A.row + 1) + '"' ); } else p = p.replace("**fmlaLink**", ""); @@ -1007,7 +1007,7 @@ async function ct(e, t = "") { let c = w + "" + ve++; const _ = "_x0000_s" + c; pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); - let F = i.startStr, A = i.endStr, h = { + let S = i.startStr, F = i.endStr, h = { start: { col: 0, row: 0 @@ -1026,19 +1026,19 @@ async function ct(e, t = "") { col: i.col, row: i.row } - }), typeof F == "string" && F.length >= 2) { - let O = Re(F, l); + }), typeof S == "string" && S.length >= 2) { + let A = Re(S, l); h.start = { - ...O + ...A }, h.end = { - col: O.col + 1, - row: O.row + 1 + col: A.col + 1, + row: A.row + 1 }; } - if (typeof A == "string" && A.length >= 2) { - let O = Re(A, l); - O.row += 1, O.col += 1, h.end = { - ...O + if (typeof F == "string" && F.length >= 2) { + let A = Re(F, l); + A.row += 1, A.col += 1, h.end = { + ...A }; } ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; @@ -1051,11 +1051,11 @@ async function ct(e, t = "") { Xe = new Promise(async (i, y) => { let p = T.lastIndexOf("."), c; p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; - const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); - A || y("image not load"), Ce.push(c), i({ - name: F, + const _ = Q++, S = "image" + _ + "." + c, F = await _t(T, S, o, e.fetch); + F || y("image not load"), Ce.push(c), i({ + name: S, type: c, - image: A, + image: F, ref: _ }); }); @@ -1065,7 +1065,7 @@ async function ct(e, t = "") { ...a.images.map(async (T, i) => { let y = T.url.lastIndexOf("."), p; y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); - const c = "image" + J++ + "." + p; + const c = "image" + Q++ + "." + p; return { type: p, image: await _t(T.url, c, o, e.fetch), @@ -1078,68 +1078,68 @@ async function ct(e, t = "") { const T = a.headers.length; let i = ""; if (a.title) { - const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); + const c = a.title, _ = c.comment, S = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, F = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + F >= 0 ? c.shiftLeft + F : F, A = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, z = A == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (O + S); if (xe.push( - I + ":" + l[h + le - 1] + (k + O + F) + I + ":" + l[h + le - 1] + (O + A + S) ), typeof _ < "u") { Ie = !0; - const Q = rt( + const ee = rt( _, N.commentSyntax.value, d ); let fe = pe.length; - if (Q.hasAuthor && typeof Q.author < "u") { - let ee = Q.author.toString(); - const re = pe.indexOf(ee); - re < 0 ? pe.push(ee) : fe = re; + if (ee.hasAuthor && typeof ee.author < "u") { + let Z = ee.author.toString(); + const re = pe.indexOf(Z); + re < 0 ? pe.push(Z) : fe = re; } He.push({ - row: k + F - 1, + row: O + S - 1, col: h }), Le += nt( I, - Q.commentStr, - Q.commentStyle, + ee.commentStr, + ee.commentStyle, fe ); } - typeof c.text == "string" && (x[k + F] = { - startTag: '', + typeof c.text == "string" && (x[O + S] = { + startTag: '', details: '' + B + "", endTag: "" - }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( c.multiStyleValue, N.commentSyntax.value, R - ) : P += "" + $e(c.text) + ""), k += F + O + 1; + ) : P += "" + Me(c.text) + ""), O += S + A + 1; } let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; - if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { - if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( + if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), V.start = l[p] + "" + O, V.end = l[p + a.headers.length - 1] + "" + (O + a.data.length), a.headers.forEach((c, _) => { + if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && q && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( c, null, _, !0 ) === !0 && (ke[l[_]] = { inProgress: !0, - start: k + start: O }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( c, c, - k, + O, _, !0, - S - ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) + k + ) || y), c.size && c.size > 0 && (G += ''), a.withoutHeader) return; - const F = l[_] + "" + k; + const S = l[_] + "" + O; if (typeof a.commentCondition == "function") { const h = a.commentCondition( c, null, c.label, - k, + O, _, !0 ); @@ -1152,38 +1152,38 @@ async function ct(e, t = "") { N.commentSyntax.value, d ); - let O = pe.length; + let A = pe.length; if (h.hasAuthor && typeof h.author < "u") { let le = h.author.toString(); - const V = pe.indexOf(le); - V < 0 ? pe.push(le) : O = V; + const z = pe.indexOf(le); + z < 0 ? pe.push(le) : A = z; } He.push({ - row: k - 1, + row: O - 1, col: _ }), Le += nt( - F, + S, h.commentStr, h.commentStyle, - O + A ); } - const A = ue && ue[F]; - if (A) { + const F = ue && ue[S]; + if (F) { const h = ot( + S, F, - A, b, e.styles ); - h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; + h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[S]; } else { - if (C += '' + B + "", typeof a.multiStyleCondition == "function") { + if (C += '' + B + "", typeof a.multiStyleCondition == "function") { const h = a.multiStyleCondition( c, null, c.label, - k, + O, _, !0 ); @@ -1193,69 +1193,71 @@ async function ct(e, t = "") { c.multiStyleValue, N.commentSyntax.value, y || "" - ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; + ) : P += "" + Me(c.text) + "", L[c.text] = c.text, B++; } }), se && (H += ""), a.withoutHeader) C += i; else { - const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; - x[k] = { + const c = ' _ + " " + S + '="' + a.headerRowOption[S] + '" ', " ") : "") + ">"; + x[O] = { startTag: c, endTag: "", details: C - }, C = i + c + C + "", k++; + }, C = i + c + C + "", O++; } if (Array.isArray(a.data)) { - const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; - a.data.forEach((h, O) => { + const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", S = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", F = a.data.length; + a.data.forEach((h, A) => { if (h.mergeType) for (let I = 0; I < h.mergeType.length; I++) { - const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; + const ee = h.mergeType[I], fe = h.mergeStart[I], Z = h.mergeValue[w]; let re = ""; - Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); + ee == "both" ? re = l[fe] + "" + O + ":" + l[fe + Z[1]] + (O + Z[0]) : ee == "col" ? re = l[fe] + "" + O + ":" + l[fe + Z[0]] + O : re = l[fe] + "" + O + ":" + l[fe] + (O + Z[0]), xe.push(re); } - const le = h.rowStyle, V = '"; - }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); + }, O++, C += ""; + }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); } if (We.length > 0 && We.forEach((c) => { - const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; - ue[A + "" + k] = { - start: a.withoutHeader ? A + "1" : A + "2", - end: A + "" + (k - 1), - type: F.formula.type, - ...F.formula.styleId ? { styleId: F.formula.styleId } : {} + const _ = a.shiftLeft ? a.shiftLeft : 0, S = a.headers[c - _], F = l[c]; + ue[F + "" + O] = { + start: a.withoutHeader ? F + "1" : F + "2", + end: F + "" + (O - 1), + type: S.formula.type, + ...S.formula.styleId ? { styleId: S.formula.styleId } : {} }; - }), Ge.length > 0 && Ge.forEach((c) => { + }), Ge.length > 0 && q && Ge.forEach((c) => { const _ = a.headers[c]; _.conditionalFormatting && Ue.push({ ..._.conditionalFormatting, start: a.withoutHeader ? l[c] + "1" : l[c] + "2", - end: l[c] + "" + (k - 1) + end: l[c] + "" + (O - 1) }); }), ue) { const c = Object.keys(ue).sort( - (_, F) => _ > F ? 1 : -1 + (_, S) => _ > S ? 1 : -1 ); if (c.length) { let _ = {}; - c.forEach((F) => { - const A = ot( - F, - ue[F], + c.forEach((S) => { + const F = ot( + S, + ue[S], b, e.styles ); - A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; - }), Object.keys(_).forEach((F) => { - const A = F, h = _[A]; - let O = x[A]; - if (O) { - const le = O.startTag + O.details + h + O.endTag; - let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); - C = C.replace(V, le); + F.needCalcChain && (ge = !0, ie += F.chainCell), _[F.row] ? _[F.row] += F.cell : _[F.row] = F.cell; + }), Object.keys(_).sort((S, F) => +S > +F ? 1 : -1).forEach((S) => { + const F = S, h = _[F]; + let A = x[F]; + if (A) { + const le = A.startTag + A.details + h + A.endTag; + let z = new RegExp( + A.startTag + "[\\n\\s\\S]*?" + ); + C = C.replace(z, le); } else - C += '' + h + "", x[A] = { - startTag: '', + C += '' + h + "", x[F] = { + startTag: '', endTag: "", details: h }; @@ -1370,7 +1374,7 @@ async function ct(e, t = "") { } w > 0 && (oe += ''); const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; - X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); + J += '', $ += '', M += "" + ("sheet" + (w + 1)) + "", a.selected && (W = !0, K = w); const bt = a.sortAndFilter ? 'filterMode="1"' : ""; let Ct = -1; Xe && await Xe.then((T) => { @@ -1383,11 +1387,9 @@ async function ct(e, t = "") { T.forEach((y, p) => { const c = p + 1; let _ = y.image; - const F = y.name; - let A = y.obj.from, h = y.obj.to, O = y.obj.margin; - y.type; - let le = y.obj.type, V = y.obj.extent; - typeof V > "u" && (V = { + const S = y.name; + let F = y.obj.from, h = y.obj.to, A = y.obj.margin, le = y.obj.type, z = y.obj.extent; + typeof z > "u" && (z = { cx: 2e5, cy: 2e5 }); @@ -1405,8 +1407,8 @@ async function ct(e, t = "") { mB: 0 } }; - if (typeof A == "string" && A.length >= 2) { - let I = Re(A, l); + if (typeof F == "string" && F.length >= 2) { + let I = Re(F, l); R.start = { ...I }, R.end = { @@ -1420,27 +1422,27 @@ async function ct(e, t = "") { ...I }; } - R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; + R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, A && ((A.right || A.all) && (R.end.mR = A.right || A.all), (A.bottom || A.all) && (R.end.mB = A.bottom || A.all), (A.left || A.all) && (R.start.mL = A.left || A.all), (A.top || A.all) && (R.start.mT = A.top || A.all)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(S, _), i += ''; }), vt = ` ` + i + ""; })), xe = [...new Set(xe)]; let wt = "", Ae = 1; - Ue.length > 0 && (wt = Ue.reduce((T, i) => { + Ue.length > 0 && q && (wt = Ue.reduce((T, i) => { if (i.type == "cells") - return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; + return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; if (i.type == "top") - return T + '"; + return T + '"; if (i.type == "iconSet") { let y = ""; return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { - indexId: q + 1, + indexId: Y + 1, key: "sheet" + (w + 1), sheetName: xt, sheetDataTableColumns: H, backgroundImageRef: Ct, - sheetDimensions: Y, + sheetDimensions: V, asTable: se || !1, sheetDataString: C, sheetDropDown: ro(a.dropDowns), @@ -1465,20 +1467,20 @@ async function ct(e, t = "") { shapeCommentRowCol: He, splitOption: Te, sheetViewProperties: Ee, - sheetSizeString: W.length > 0 ? "" + W + "" : "", + sheetSizeString: G.length > 0 ? "" + G + "" : "", protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", selectedView: !!a.selected, sheetSortFilter: ce, tabColor: a.tabColor ? '' : "' - }, q++; + }, Y++; } - ge && (q++, K += '', f == null || f.file( + ge && (Y++, $ += '', f == null || f.file( "calcChain.xml", ` ` + ie + "" )); - let Mt = Object.keys(E), qe = m.folder("_rels"); + let Kt = Object.keys(E), qe = m.folder("_rels"); qe == null || qe.file( ".rels", ` @@ -1489,10 +1491,10 @@ async function ct(e, t = "") { "core.xml", ` ` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" - ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( + ), Oe == null || Oe.file("app.xml", Xt(s, M)), f == null || f.file( "workbook.xml", ` - ` + (U ? '' : "") + " " + X + " " + ` + (W ? '' : "") + " " + J + " " ), f == null || f.file( "sharedStrings.xml", ` @@ -1502,7 +1504,7 @@ async function ct(e, t = "") { Ye == null || Ye.file( "workbook.xml.rels", ` - ` + K + " " + ` + $ + " " ); let Ve = f == null ? void 0 : f.folder("theme"); Ve == null || Ve.file( @@ -1511,9 +1513,9 @@ async function ct(e, t = "") { ` ); let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; - if (Mt.forEach((w, a) => { + if (Kt.forEach((w, a) => { const b = E[w]; - let x = "", Y = { + let x = "", V = { form: !1, drawing: !1, vmlDrwing: !1, @@ -1524,18 +1526,18 @@ async function ct(e, t = "") { const se = b.sheetDataTableColumns; if (se.length > 0) { mt.push("table" + (a + 1) + ".xml"); - const C = b.asTable, W = b.sheetDimensions; + const C = b.asTable, G = b.sheetDimensions; de == null || de.file( "table" + (a + 1) + ".xml", ` -' + se + '
' +' + se + '
' ), x += ''; } const H = "drawing" + (De.length + 1) + ".xml"; - if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( + if (b.hasImages && (De.push(H), V.sheetDrawingsPushed = !0, j == null || j.file( H + ".rels", b.drawersRels.toString() - ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( + ), V.drawing = !0, x += ''), b.hasCheckbox && (V.sheetDrawingsPushed || De.push(H), x += '' + (V.drawing ? "" : ''), V.drawing = !0, V.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( H, ` ` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" @@ -1546,14 +1548,14 @@ async function ct(e, t = "") { "comments" + (a + 1) + ".xml", ` ` + (Array.isArray(C) && C.length > 0 ? C.reduce( - (W, ce) => W + "" + ce + "", + (G, ce) => G + "" + ce + "", "" ) : "") + "" + b.commentString + "" - ), x += '' + (Y.vmlDrwing ? "" : ''); + ), x += '' + (V.vmlDrwing ? "" : ''); } if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( "vmlDrawing" + (a + 1) + ".vml", - '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" + '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, G) => C + `", "") : "") + "" )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { const C = Fe == null ? void 0 : Fe.folder("_rels"); C == null || C.file( @@ -1562,11 +1564,11 @@ async function ct(e, t = "") { ` + x + "" ); } - let k = ""; - b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( + let O = ""; + b.selectedView || b.splitOption ? O = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : O = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( b.key + ".xml", ` -` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" +` + b.tabColor + O + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" ); }), ae.length > 0) { let w = f == null ? void 0 : f.folder("ctrlProps"); @@ -1613,9 +1615,9 @@ function no(e) { let D = {}; for (let j = 0; j < v; j++) { r++; - const S = f[j]; + const k = f[j]; let d; - S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { + k.sheetName ? d = k.sheetName : d = "Sheet 1", d in o || (o[d] = { headers: [], data: [], labelCounter: 0, @@ -1624,41 +1626,41 @@ function no(e) { index: s, value: 0 }), d in l || (o[d].labelCounter = 0, l[d] = !0); - let G = []; - const z = o[d].headers.length; - let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ + let q = []; + const U = o[d].headers.length; + let X = {}, N = o[d].seenAt == s, oe = k.headers.reduce(($, L, E) => (o[d].labelCounter++, U < o[d].labelCounter && q.push({ label: "c" + o[d].labelCounter, text: N ? L.text : "" - }), Z["c" + o[d].labelCounter] = L.text, { - ...K, + }), X["c" + o[d].labelCounter] = L.text, { + ...$, [L.label]: "c" + o[d].labelCounter }), {}); - if (o[d].headers.push(...G), S.spaceX) - for (let K = 0; K < S.spaceX; K++) - o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ + if (o[d].headers.push(...q), k.spaceX) + for (let $ = 0; $ < k.spaceX; $++) + o[d].labelCounter++, U <= o[d].labelCounter && o[d].headers.push({ label: "c" + o[d].labelCounter, text: "" }); n[d].index + 1 == s && (D[d] = n[d].value); let P = D[d] || 0; - P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { + P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(X) : o[d].data[P] = { ...o[d].data[P], - ...Z + ...X }, o[d].headerIndex = P, P++); - let B = Object.keys(oe), X = S.data.length >= o[d].data.length; - if (o[d].data = S.data.reduce((K, L, E) => { - let $ = {}; - return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { - let U = oe[q]; - $[U] = L[q] ? L[q] : ""; - }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; - }, o[d].data), X && S.spaceY) { - const K = o[d].headers.length; - for (let L = 0; L < S.spaceY; L++) { + let B = Object.keys(oe), J = k.data.length >= o[d].data.length; + if (o[d].data = k.data.reduce(($, L, E) => { + let M = {}; + return $.length > E + P ? M = $[E + P] : $.push(M), B.forEach((Y) => { + let W = oe[Y]; + M[W] = L[Y] ? L[Y] : ""; + }), M.tableIndex = r, M.tableStringIndex = E + "," + j, $[E + P] = M, $; + }, o[d].data), J && k.spaceY) { + const $ = o[d].headers.length; + for (let L = 0; L < k.spaceY; L++) { let E = {}; - for (let $ = 0; $ < K; $++) { - const q = o[d].headers[$]; - E[q.label] = ""; + for (let M = 0; M < $; M++) { + const Y = o[d].headers[M]; + E[Y.label] = ""; } o[d].data.push(E); } @@ -2130,16 +2132,16 @@ function Bt(e, t = !0, r = !0) { l.underline && l.doubleUnderline, g.forEach((u) => { let m = l[u]; const s = lo[u]; - if (Me(m, s, u, t, r)) + if (Ke(m, s, u, t, r)) return !0; }); }); } -function $t(e, t = !0, r = !0) { +function Mt(e, t = !0, r = !0) { Array.isArray(e) || (e = [e]), e.forEach((o) => { Object.keys(o).forEach((l) => { const g = o[l], u = io[l]; - Me(g, u, l, t, r); + Ke(g, u, l, t, r); }); }); } @@ -2147,16 +2149,16 @@ function so(e, t = !0, r = !0) { Object.keys(e).forEach((n) => { let l = e[n]; const g = ao[n]; - if (Me(l, g, n, t, r)) + if (Ke(l, g, n, t, r)) if (n == "sheet") if (Array.isArray(l)) - $t(l); + Mt(l); else throw "Sheet must be Array."; else n == "styles" && Bt(l); }); } -function Me(e, t, r, o, n) { +function Ke(e, t, r, o, n) { if (t) { if (typeof e != t.type) { if (t.type == "object" || t.type == "string" || o) @@ -2180,12 +2182,12 @@ function Me(e, t, r, o, n) { const co = { checkSheetValidWithOneRef: st, checkSheetValidWithTwoRef: it, - generalValidationCheck: Me + generalValidationCheck: Ke }, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, exportedForTesting: co, validateExcelTableObjectFunction: so, - validateSheetArrayFunction: $t, + validateSheetArrayFunction: Mt, validateStyleObjectFunction: Bt }, Symbol.toStringTag, { value: "Module" })); function It(e) { @@ -2202,23 +2204,23 @@ function Pt(e, t) { return e.substring(0, e.length - t) + ` `; } -async function Kt(e, t = !1, r = !1) { +async function $t(e, t = !1, r = !1) { const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; let g = []; if (e.sheet.forEach((m) => { let s = "", f = ""; const v = m.headers; let D = [], j = v.length; - for (let S = 0; S < j; S++) { - const d = v[S]; + for (let k = 0; k < j; k++) { + const d = v[k]; D.push(d.label), m.withoutHeader || (f += It(d.text) + o); } s += Pt(f, l), j = m.data.length; - for (let S = 0; S < j; S++) { + for (let k = 0; k < j; k++) { f = ""; - const d = m.data[S]; - D.forEach((G) => { - f += It(d[G]) + o; + const d = m.data[k]; + D.forEach((q) => { + f += It(d[q]) + o; }), s += Pt(f, l); } g.push(s); @@ -2308,91 +2310,91 @@ async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { }, j = { background: "#EEEDEB" }) { - let S = await import("./read-utils-YAGe6NNW.js").then( + let k = await import("./read-utils-DnAqiCj7.js").then( async (E) => await E.extractExcelData(e, !1, o) ), d = null; if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) throw "Container Node not found"; - const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); + const q = Object.keys(m), U = Object.keys(s), X = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); let B = document.createElement("div"); N.forEach((E) => { B.style[E] = v[E]; - }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { + }), l || (u && d != null && (d.innerText = ""), q.forEach((E) => { d.style[E] = m[E]; }), d.appendChild(B)); - let X = [], K = !1, L = 0; + let J = [], $ = !1, L = 0; do { L++; - const E = S.sheetName.next(); + const E = k.sheetName.next(); if (!E.value) break; - const $ = document.createElement("div"); - if ($.style.display = "none", !l) { - const J = document.createElement("button"); + const M = document.createElement("div"); + if (M.style.display = "none", !l) { + const Q = document.createElement("button"); oe.forEach((ye) => { - J.style[ye] = D[ye]; - }), J.addEventListener("click", (ye) => { - const ve = J.getAttribute("data-sheet"), we = d.querySelector( + Q.style[ye] = D[ye]; + }), Q.addEventListener("click", (ye) => { + const ve = Q.getAttribute("data-sheet"), we = d.querySelector( 'div[data-sheet="' + ve + '"]' ); if (we) { P.forEach((ie) => { - J.style[ie] = j[ie]; + Q.style[ie] = j[ie]; }); const Se = d.querySelector( "[data-sheet-button-activate]" ); let ae = d.querySelector("[data-sheet-activate]"); - we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { + we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", Q.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { Se.style[ie] = D[ie]; }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); } else console.error("Sheet content not found!! id is " + ve); - }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); + }), Q.setAttribute("data-sheet", L + ""), M.setAttribute("data-sheet", L + ""), Q.innerText = E.value[1] || E.value[0], B.appendChild(Q), d.appendChild(M); } - let q = n ? "th" : "td"; - const U = document.createElement("table"); - z.forEach((J) => { - U.style[J] = s[J]; + let Y = n ? "th" : "td"; + const W = document.createElement("table"); + U.forEach((Q) => { + W.style[Q] = s[Q]; }); - const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; - if (Array.isArray(M)) { - const J = M.length; - for (let ye = 0; ye < J; ye++) { - const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); + const K = k.data[E.value[0]] || k.data[E.value[1]], Ce = k.maxLengthOfColumn[E.value[0]] || k.maxLengthOfColumn[E.value[1]]; + if (Array.isArray(K)) { + const Q = K.length; + for (let ye = 0; ye < Q; ye++) { + const ve = K[ye], we = document.createElement("tr"), Se = Array.isArray(ve); for (let ae = 0; ae <= Ce; ae++) { let ie = g; if (Se) { const de = ve[ae]; typeof de == "string" && (ie = de); } - const ge = document.createElement(q); - Z.forEach((de) => { + const ge = document.createElement(Y); + X.forEach((de) => { ge.style[de] = f[de]; }), ge.innerText = ie, we.appendChild(ge); } - U.appendChild(we), q = "td"; + W.appendChild(we), Y = "td"; } } - l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; - } while (!K); + l ? J.push(W) : (M.appendChild(W), d == null || d.appendChild(M)), $ = E.done; + } while (!$); if (l) - return X; + return J; { const E = d.querySelector( 'div[data-sheet="1"]' ); E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); - const $ = d.querySelector( + const M = d.querySelector( 'button[data-sheet="1"]' ); - return $ && (P.forEach((q) => { - $.style[q] = j[q]; - }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; + return M && (P.forEach((Y) => { + M.style[Y] = j[Y]; + }), M.setAttribute("data-sheet-button-activate", "1")), "Done"; } } async function uo(e, t, r = !0, o = "property") { - let n = await import("./read-utils-YAGe6NNW.js").then( + let n = await import("./read-utils-DnAqiCj7.js").then( async (u) => await u.extractExcelData(e, !1, t) ), l = {}, g = []; return Object.keys(n.sheetNameObject).forEach((u) => { @@ -2401,10 +2403,10 @@ async function uo(e, t, r = !0, o = "property") { g[j] = o + (j + 1); let v = r, D = []; s.forEach((j) => { - let S = {}; - j.forEach((d, G) => { - typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); - }), v = !1, D.push(S); + let k = {}; + j.forEach((d, q) => { + typeof d == "string" && (v ? g[q] = d : k[g[q]] = d); + }), v = !1, D.push(k); }), l = Object.assign(l, { [m]: D }); @@ -2429,15 +2431,15 @@ function Co(e, t) { return ct(zt(e, t)); } function vo(e, t = !1, r) { - return import("./read-utils-YAGe6NNW.js").then( + return import("./read-utils-DnAqiCj7.js").then( (o) => o.extractExcelData(e, t, r) ); } function wo(e, t = !1) { - return Kt(e, t, !1); + return $t(e, t, !1); } function To(e, t = !1) { - return Kt(e, t, !0); + return $t(e, t, !0); } function Eo(e, t, r, o = { ...jt }) { return o = { diff --git a/dist/read-utils-D8LB9Gmq.cjs b/dist/read-utils-BEg2qKSg.cjs similarity index 97% rename from dist/read-utils-D8LB9Gmq.cjs rename to dist/read-utils-BEg2qKSg.cjs index c55b446..3e0dfaa 100644 --- a/dist/read-utils-D8LB9Gmq.cjs +++ b/dist/read-utils-BEg2qKSg.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-DkpykvyS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; diff --git a/dist/read-utils-CwMyWpVb.js b/dist/read-utils-Byj29Erp.js similarity index 97% rename from dist/read-utils-CwMyWpVb.js rename to dist/read-utils-Byj29Erp.js index c47491c..3c194ca 100644 --- a/dist/read-utils-CwMyWpVb.js +++ b/dist/read-utils-Byj29Erp.js @@ -1 +1 @@ -System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); +System.register("ExcelTable",["./index-B8PpTQiZ.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); diff --git a/dist/read-utils-DODcKE84.js b/dist/read-utils-DXQsy33k.js similarity index 97% rename from dist/read-utils-DODcKE84.js rename to dist/read-utils-DXQsy33k.js index 26ca0f0..be5248a 100644 --- a/dist/read-utils-DODcKE84.js +++ b/dist/read-utils-DXQsy33k.js @@ -1 +1 @@ -define(["require","exports","./index-BYjrfbvd"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); +define(["require","exports","./index-DfuHK51s"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/read-utils-YAGe6NNW.js b/dist/read-utils-DnAqiCj7.js similarity index 98% rename from dist/read-utils-YAGe6NNW.js rename to dist/read-utils-DnAqiCj7.js index d715a4b..b7fff06 100644 --- a/dist/read-utils-YAGe6NNW.js +++ b/dist/read-utils-DnAqiCj7.js @@ -1,4 +1,4 @@ -import { g as R, c as T } from "./index-DMAk0ysA.js"; +import { g as R, c as T } from "./index-p1xk7Sgq.js"; function B(s) { return /t="s".*?', details: ''; titleRow += ' 0) { + if (headerConditionalFormatting.length > 0 && addCF) { headerConditionalFormatting.forEach((v) => { const header = sheetData.headers[v]; if (!header.conditionalFormatting) { @@ -1691,34 +1693,43 @@ export async function generateExcel( rF[f.row] += f.cell; } }); - Object.keys(rF).forEach((v) => { - const val = v as keyof object; - const l = rF[val]; - let rowDataMap = rowMap[val]; - if (rowDataMap) { - const body = - rowDataMap.startTag + - rowDataMap.details + - l + - rowDataMap.endTag; - let reg = new RegExp(rowDataMap.startTag + "[\\n\\s\\S]*?
"); - sheetDataString = sheetDataString.replace(reg, body); - } else { - sheetDataString += - '' + - l + - ""; - rowMap[val] = { - startTag: '', - endTag: "", - details: l, - }; - } - }); + Object.keys(rF) + .sort((a, b) => (+a > +b ? 1 : -1)) + .forEach((v) => { + const val = v as keyof object; + const l = rF[val]; + let rowDataMap = rowMap[val]; + if (rowDataMap) { + const body = + rowDataMap.startTag + + rowDataMap.details + + l + + rowDataMap.endTag; + let reg = new RegExp( + rowDataMap.startTag + "[\\n\\s\\S]*?" + ); + sheetDataString = sheetDataString.replace(reg, body); + } else { + sheetDataString += + '' + + l + + ""; + rowMap[val] = { + startTag: + '', + endTag: "", + details: l, + }; + } + }); } } } @@ -1779,7 +1790,6 @@ export async function generateExcel( let from = val.obj.from; let to = val.obj.to; let margin = val.obj.margin; - let imageType = val.type; let type = val.obj.type; let extent = val.obj.extent; if (typeof extent == "undefined") { @@ -1838,19 +1848,20 @@ export async function generateExcel( result.start.mL = 0; result.start.mT = 0; if (margin) { - if (margin.all || margin.right) { - result.end.mR = margin.all || margin.right; + if (margin.right || margin.all) { + result.end.mR = margin.right || margin.all; } - if (margin.all || margin.bottom) { - result.end.mB = margin.all || margin.bottom; + if (margin.bottom || margin.all) { + result.end.mB = margin.bottom || margin.all; } - if (margin.all || margin.left) { - result.start.mL = margin.all || margin.left; + if (margin.left || margin.all) { + result.start.mL = margin.left || margin.all; } - if (margin.all || margin.top) { - result.start.mT = margin.all || margin.top; + if (margin.top || margin.all) { + result.start.mT = margin.top || margin.all; } } + if (type == "one") { drawersContent += "" + @@ -1981,7 +1992,7 @@ export async function generateExcel( mergesCellArray = [...new Set(mergesCellArray)]; let cFDataString: string = ""; let priorityCounter = 1; - if (conditionalFormatting.length > 0) { + if (conditionalFormatting.length > 0 && addCF) { cFDataString = conditionalFormatting.reduce((cf, cu) => { if (cu.type == "cells") { if (cu.operator == "ct") { From ac9d7f58e680f42654012740c888d9731c5a2383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Fern=C3=A1ndez?= Date: Wed, 12 Mar 2025 19:03:58 -0300 Subject: [PATCH 5/7] fix: changed custom dollar_rounded format key and numFmtId to 188 (#5) * V7.0.0 (#4) * Create manually_test.yml * feature: init V7.0.0 * add comment to interface and main func & update readme --------- Co-authored-by: m.r * fix: changed custom dollar_rounded format key and numFmtId to 188 ## Description `dollar_2` and `dollar_rounded` defined 2 different `formatCode`, although they have the same `key` and `numFmtId` set to 183. This cause an issue when using both formats in a sheet, where only 1 is applied because the `183` id is used for reference in the spreadsheet context. The fix is to set `dollar_rounded` id to something else: 188 (last used key value was 187). Also, ordered the object by key value for better readability. --------- Co-authored-by: mohammadrezaeicode <131792366+mohammadrezaeicode@users.noreply.github.com> Co-authored-by: m.r --- dist/excel-table.amd.js | 2 +- dist/excel-table.cjs | 2 +- dist/excel-table.d.ts | 1137 ---------------- dist/excel-table.iife.js | 54 - dist/excel-table.js | 16 - dist/excel-table.system.js | 1 - dist/excel-table.umd.cjs | 55 - dist/index-BPuSW_h3.js | 44 + dist/index-BYjrfbvd.js | 44 + dist/index-CzrjgJVS.cjs | 44 + dist/index-DMAk0ysA.js | 2479 ++++++++++++++++++++++++++++++++++ dist/read-utils-CwMyWpVb.js | 1 + dist/read-utils-D8LB9Gmq.cjs | 1 + dist/read-utils-DODcKE84.js | 1 + dist/read-utils-YAGe6NNW.js | 110 ++ src/data-model/const-data.ts | 174 +-- 16 files changed, 2813 insertions(+), 1352 deletions(-) create mode 100644 dist/index-BPuSW_h3.js create mode 100644 dist/index-BYjrfbvd.js create mode 100644 dist/index-CzrjgJVS.cjs create mode 100644 dist/index-DMAk0ysA.js create mode 100644 dist/read-utils-CwMyWpVb.js create mode 100644 dist/read-utils-D8LB9Gmq.cjs create mode 100644 dist/read-utils-DODcKE84.js create mode 100644 dist/read-utils-YAGe6NNW.js diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index 1de5e2c..2fe50bc 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-DfuHK51s"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); +define(["exports","./index-DfuHK51s"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); \ No newline at end of file diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index 0c60a4f..05053db 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DkpykvyS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DkpykvyS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; \ No newline at end of file diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index d2ad689..e69de29 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -1,1137 +0,0 @@ -export declare const addGlobalOptionFromExcelTable: typeof addGlobalOptionFromExcelTable_2; - -/** - * Adds global options from an Excel table. - * @param {string} key - The key for the global option. - * @param {ExcelTable} data - The Excel table data. - */ -declare function addGlobalOptionFromExcelTable_2(key: string, data: ExcelTable): void; - -export declare const addGlobalOptions: typeof addGlobalOptions_2; - -/** - * Adds global options to the proxy. - * @param {string} key - The key for the global option. - * @param {string} path - The path for the global option. - * @param {any} data - The data for the global option. - */ -declare function addGlobalOptions_2(key: string, path: string, data: any): void; - -/** - * Horizontal alignment options. - * @typedef {"center" | "left" | "right"} AlignmentHorizontal - */ -declare type AlignmentHorizontal = "center" | "left" | "right"; - -/** - * Options for configuring alignment. - * @interface - */ -declare interface AlignmentOption { - horizontal?: AlignmentHorizontal; - vertical?: AlignmentVertical; - wrapText?: "0" | "1" | 0 | 1; - shrinkToFit?: "0" | "1" | 0 | 1; - readingOrder?: "1" | "2" | 2 | 1; - textRotation?: number; - indent?: number; - rtl?: boolean; - ltr?: boolean; -} - -/** - * Keys for alignment options. - * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey - */ -declare type AlignmentOptionKey = "horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"; - -/** - * Vertical alignment options. - * @typedef {"center" | "top" | "bottom"} AlignmentVertical - */ -declare type AlignmentVertical = "center" | "top" | "bottom"; - -/** - * Options for displaying the sheet as a table. - * @interface - */ -declare interface AsTableOption { - /** The type of table style. */ - type?: "Light" | "Medium" | "Dark"; - /** The style number of the table. */ - styleNumber?: number; - /** Indicates if the first column should be styled. */ - firstColumn?: boolean; - /** Indicates if the last column should be styled. */ - lastColumn?: boolean; - /** Indicates if row stripes should be applied. */ - rowStripes?: boolean; - /** Indicates if column stripes should be applied. */ - columnStripes?: boolean; -} - -/** - * Directions for border options. - * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection - */ -declare type BorderDirection = "full" | "top" | "left" | "right" | "bottom"; - -/** - * Options for configuring borders. - * @interface - */ -declare type BorderOption = { - [key in BorderDirection]?: { - color: string; - style: "slantDashDot" | "dotted" | "thick" | "hair" | "dashDot" | "dashDotDot" | "dashed" | "thin" | "mediumDashDot" | "medium" | "double" | "mediumDashed"; - }; -}; - -/** - * Represents a buffer. - * @class - * @extends {Uint8Array} - */ -declare class Buffer_2 extends Uint8Array { - constructor(str: string, encoding?: string); - constructor(size: number); - constructor(array: Uint8Array); - constructor(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number); - static alloc(size: number, fill?: string | Buffer_2 | number, encoding?: string): Buffer_2; - static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer_2; - static from(data: number[]): Buffer_2; - static from(str: string, encoding?: string): Buffer_2; - write(string: string, offset?: number, length?: number, encoding?: string): number; - toString(encoding?: string, start?: number, end?: number): string; - slice(start?: number, end?: number): Buffer_2; - static concat(list: Buffer_2[], totalLength?: number): Buffer_2; - length: number; - byteOffset: number; -} - -/** - * Represents a checkbox in the sheet. - * @interface - */ -declare interface Checkbox { - col: number; - row: number; - text: string; - link?: string; - checked?: boolean; - mixed?: boolean; - threeD?: boolean; - startStr?: string; - endStr?: string; -} - -declare function checkSheetValidWithOneRef(ref: string): boolean; - -declare function checkSheetValidWithTwoRef(ref: string): boolean; - -declare type ColWidthScaleFunction = (data: number, colIndex: number) => number; - -/** - * Represents a comment in the sheet. - * @interface - */ -declare interface Comment_2 { - comment?: string; - styleId?: string; - author?: string; -} - -/** - * Function type for comment condition. - * @callback CommentConditionFunction@callback CommentConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {null | Data} object - The data object. - * @param {string} headerKey - The header key. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {Comment | string | false | undefined | null} The comment or null. - */ -declare type CommentConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => Comment_2 | string | false | undefined | null; - -/** - * Represents conditional formatting in the sheet. - * @interface - * @extends {ConditionalFormattingOption} - */ -declare interface ConditionalFormatting extends ConditionalFormattingOption { - /** The start cell for the conditional formatting. */ - start: string; - /** The end cell for the conditional formatting. */ - end: string; -} - -/** - * Operations for conditional formatting cells. - * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation - */ -declare type ConditionalFormattingCellsOperation = "lt" | "gt" | "between" | "eq" | "ct"; - -/** - * Operations for conditional formatting icon sets. - * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation - */ -declare type ConditionalFormattingIconSetOperation = "3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"; - -/** - * Options for conditional formatting. - * @interface - */ -declare interface ConditionalFormattingOption { - /** The type of conditional formatting. */ - type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top"; - /** The operator for the conditional formatting. */ - operator?: string | ConditionalFormattingCellsOperation | ConditionalFormattingIconSetOperation | ConditionalFormattingTopOperation; - /** The value for the conditional formatting. */ - value?: number | string; - /** The priority of the conditional formatting. */ - priority?: number; - /** The colors for the conditional formatting. */ - colors?: string[]; - /** Indicates if the conditional formatting is for the bottom values. */ - bottom?: boolean; - /** The style ID for the conditional formatting. */ - styleId?: string; - /** The percentage for the conditional formatting. */ - percent?: number; -} - -/** - * Operations for conditional formatting top values. - * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation - */ -declare type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage"; - -/** - * Converts an HTML table to an Excel file. - * @param {string} [queryForTable] - The query selector for the table. - * @param {HTMLTableElement} [table] - The HTML table element. - * @param {Object} [config] - The configuration options. - * @param {boolean} [config.keepStyle] - Whether to keep the style. - * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. - * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. - * @returns {Promise} The generated Excel table. - */ -export declare function convertTableToExcel(queryForTable?: string, table?: HTMLTableElement, config?: { - keepStyle?: boolean; - rowHeightScaleFunction?: RowHeightScaleFunction; - colWidthScaleFunction?: ColWidthScaleFunction; -}): Promise; - -/** - * Represents a custom formula setting. - * @interface - */ -declare interface CustomFormulaSetting { - isArray?: boolean; - referenceCells?: string; - formula: string; - returnType?: string; - styleId?: string; -} - -/** - * Represents data in the sheet. - * @interface - * @extends {DataOptions} - */ -declare interface Data extends DataOptions { - [key: string]: string | number | any | undefined; -} - -declare namespace DataModel { - export { - ExcelTable, - ExcelTableOption, - Sheet, - SheetOption, - AsTableOption, - PageBreak, - ViewStart, - ViewOption, - HeaderFooterOption, - HeaderFooterLocationMap, - HeaderFooterTypes, - PageOption, - Header, - HeaderOption, - StyleType, - StyleBody, - Styles, - Data, - DataOptions, - DropDown, - RowMap, - ProtectionOption, - ProtectionOptionKey, - ConditionalFormattingCellsOperation, - ConditionalFormattingIconSetOperation, - ConditionalFormattingTopOperation, - ConditionalFormattingOption, - ConditionalFormatting, - ImageTypes, - SideBySide, - AlignmentOptionKey, - AlignmentHorizontal, - AlignmentVertical, - AlignmentOption, - BorderDirection, - BorderOption, - MapMultiStyleValue, - MultiStyleValue, - MultiStyleRexValue, - Comment_2 as Comment, - MergeRowConditionMap, - MultiStyleConditionFunction, - CommentConditionFunction, - StyleCellConditionFunction, - MergeRowDataConditionFunction, - SortAndFilter, - Title, - HeaderRowOption, - Checkbox, - NoArgFormulaType, - FormulaType, - SingleRefFormulaType, - FormatMap, - Formula, - FormulaSetting, - CustomFormulaSetting, - SingleRefFormulaSetting, - NoArgFormulaSetting, - StyleMapper, - MapComment, - ThemeOption, - ExtractedData, - ExtractResult, - ReadResult, - Buffer_2 as Buffer, - ReplacerOption, - ExcelToNodeConfig - } -} -export { DataModel } - -/** - * Options for configuring data in the sheet. - * @interface - */ -declare interface DataOptions { - [key: string]: "0" | "1" | number | string | undefined | MapComment - /** Array of multi-style values for the data. */ - | MapMultiStyleValue; - outlineLevel?: number; - hidden?: "0" | "1" | number; - rowStyle?: string; - height?: number; - multiStyleValue?: MapMultiStyleValue; - comment?: MapComment; -} - -/** - * Represents a dropdown in the sheet. - * @interface - */ -declare interface DropDown { - /** Array of options for the dropdown. */ - option: (string | number)[]; - /** Array of columns the dropdown applies to. */ - for: string[]; -} - -/** - * Represents an Excel table with options and sheets. - * @interface - * @extends {ExcelTableOption} - */ -declare interface ExcelTable extends ExcelTableOption { - /** Array of sheets in the Excel table. */ - sheet: Sheet[]; -} - -/** - * Options for configuring an Excel table. - * @interface - */ -declare interface ExcelTableOption { - /** Indicates if the Excel should not be saved. */ - notSave?: boolean; - /** The creator of the Excel. */ - creator?: string; - /** Indicates if the backend is used. */ - backend?: boolean; - /** Activates conditional formatting. */ - activateConditionalFormatting?: boolean; - /** Function to fetch data. */ - fetch?: Function; - /** The file name of the Excel. */ - fileName?: string; - /** The type of generated file. */ - generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; - /** Adds default title style. */ - addDefaultTitleStyle?: boolean; - /** The creation date of the Excel. */ - created?: string; - /** The modification date of the Excel. */ - modified?: string; - /** The number of columns in the Excel. */ - numberOfColumn?: number; - /** The type of creation. */ - createType?: string; - /** Styles applied to the Excel. */ - styles?: Styles; - /** Format map for the Excel. */ - formatMap?: FormatMap; -} - -export declare function excelToJson(uri: string, fetchFunc?: Function, withHeader?: boolean, defaultPropertyPrefix?: string): Promise>; - -/** - * Converts an Excel file to a Node. - * @param {string} uri - The URI of the Excel file. - * @param {string | null} [queryForTable] - The query selector for the table. - * @param {HTMLDivElement | null} [containerElement] - The container element. - * @param {ExcelToNodeConfig} [config=defaultConfig] - The configuration options. - * @returns {Promise} The result of the conversion. - */ -export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; - -/** - * Represents configuration options for Excel to Node. - * @interface - */ -declare interface ExcelToNodeConfig { - fetchFunc?: Function; - firstHeader?: boolean; - returnTableNodes?: boolean; - emptyNodeDefaultString?: string; - removeContainerChildNode?: boolean; - containerNodeStyle?: object; - tableStyle?: object; - cellStyle?: object; - buttonContainerStyle?: object; - buttonStyle?: object; - activeButtonStyle?: object; -} - -declare const exportedForTesting: { - checkSheetValidWithOneRef: typeof checkSheetValidWithOneRef; - checkSheetValidWithTwoRef: typeof checkSheetValidWithTwoRef; - generalValidationCheck: typeof generalValidationCheck; -}; - -/** - * Represents extracted data. - * @typedef {(string | null | undefined)[][]} ExtractedData - */ -declare type ExtractedData = (string | null | undefined)[][]; - -/** - * Extracts data from an Excel file. - * @param {string} uri - The URI of the Excel file. - * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. - * @param {Function} [fetchFunc] - The function to fetch data. - * @returns {Promise} The extracted data. - */ -export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; - -/** - * Represents the result of data extraction. - * @interface - */ -declare interface ExtractResult { - [sheetName: string]: ExtractedData; -} - -/** - * Represents a format map. - * @interface - */ -declare interface FormatMap { - [format: string]: { - key: number; - value?: string; - }; -} - -/** - * Represents a formula in the sheet. - * @interface - */ -declare interface Formula { - [insertCell: string]: FormulaSetting | SingleRefFormulaSetting | NoArgFormulaSetting | CustomFormulaSetting; -} - -/** - * Represents a formula setting. - * @interface - */ -declare interface FormulaSetting { - type: FormulaType; - start: string; - end: string; - styleId?: string; -} - -/** - * Types of formulas. - * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType - */ -declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; - -declare function generalValidationCheck(value: never, validateProperty: ValidationObject, property: string, strict: boolean, warn: boolean): boolean; - -/** - * Generates a CSV file from an Excel table Object. - * @param {ExcelTable} excelTable - The Excel table. - * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. - * @returns {Promise} The generated CSV file. - */ -export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): Promise; - -export declare function generateExcel(data: ExcelTable, styleKey?: string): Promise; - -/** - * Generates a text file from an Excel table Object. - * @param {ExcelTable} excelTable - The Excel table. - * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. - * @returns {Promise} The generated text file. - */ -export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; - -/** - * Represents a header in the sheet. - * @interface - * @extends {HeaderOption} - */ -declare interface Header extends HeaderOption { - /** The label of the header. */ - label: string; - /** The text of the header. */ - text: string; -} - -/** - * Location map for header and footer options.l:Left, c:Center, r:Right - * @interface - */ -declare interface HeaderFooterLocationMap { - l?: HeaderFooterOption; - c?: HeaderFooterOption; - r?: HeaderFooterOption; -} - -/** - * Options for header and footer. - * @interface - */ -declare interface HeaderFooterOption { - /** The text of the header or footer. */ - text?: string; - /** The style ID of the header or footer. */ - styleId?: string; -} - -/** - * Types of header and footer in page(odd page, even page,first page). - * @interface - */ -declare interface HeaderFooterTypes { - odd?: HeaderFooterLocationMap; - even?: HeaderFooterLocationMap; - first?: HeaderFooterLocationMap; -} - -/** - * Options for configuring a header. - * @interface - */ -declare interface HeaderOption { - /** The size(width) of the header. */ - size?: number; - /** Array of multi-style values for the header. */ - multiStyleValue?: MultiStyleValue[]; - /** Comment for the header. */ - comment?: Comment_2 | string; - /** Conditional formatting options for the header. */ - conditionalFormatting?: ConditionalFormattingOption; - /** Formula applied to the column. */ - formula?: { - /** The type of the formula. */ - type: FormulaType; - /** The style ID of the formula. */ - styleId?: string; - }; -} - -/** - * Options for the header row. - * @interface - */ -declare interface HeaderRowOption { - outlineLevel: "string"; -} - -/** - * Represents an image in the sheet. - * @interface - */ -declare interface ImageTypes { - url: string; - from: string; - to?: string; - type?: "one" | "two"; - extent?: { - cx: number; - cy: number; - }; - margin?: { - all?: number; - right?: number; - left?: number; - bottom?: number; - top?: number; - }; -} - -/** - * Represents a map of comments. - * @interface - */ -declare interface MapComment { - [key: string]: Comment_2 | string; -} - -/** - * Represents a map of multi-style values. - * @interface - */ -declare interface MapMultiStyleValue { - [key: string]: MultiStyleValue[]; -} - -/** - * Represents a map of merge row conditions. - * @interface - */ -declare interface MergeRowConditionMap { - [columnKey: string]: { - inProgress: boolean; - start: number; - }; -} - -/** - * Function type for merge row data condition. - * @callback MergeRowDataConditionFunction@callback MergeRowDataConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {string | null} key - The key. - * @param {number} index - The index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {boolean} The result of the condition. - */ -declare type MergeRowDataConditionFunction = (data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean) => boolean; - -/** - * Function type for multi-style condition. - * @callback MultiStyleConditionFunction@callback MultiStyleConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {null | Data} object - The data object. - * @param {string} headerKey - The header key. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {MultiStyleValue[] | null} The multi-style values or null. - */ -declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; - -/** - * Represents a multi-style regex value. - * @interface - */ -declare interface MultiStyleRexValue { - reg: RegExp | string; - styleId: string; -} - -/** - * Represents a multi-style value. - * @interface - */ -declare interface MultiStyleValue { - value: string | number; - styleId?: string; -} - -/** - * Represents a no-argument formula setting. - * @interface - */ -declare interface NoArgFormulaSetting { - noArgType: NoArgFormulaType; - styleId?: string; -} - -/** - * Types of no-argument formulas. - * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType - */ -declare type NoArgFormulaType = "NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"; - -/** - * Options for page breaks in the sheet. - * @interface - */ -declare interface PageBreak { - /** Array of row indices where page breaks should occur. */ - row?: number[]; - /** Array of column indices where page breaks should occur. */ - column?: number[]; -} - -/** - * Options for configuring the page. - * @interface - */ -declare interface PageOption { - /** Margin settings for the page. */ - margin?: { - left?: number; - right?: number; - top?: number; - bottom?: number; - header?: number; - footer?: number; - }; - /** Header settings for the page. */ - header?: HeaderFooterTypes; - /** Footer settings for the page. */ - footer?: HeaderFooterTypes; - /** Indicates if the page is in portrait orientation. */ - isPortrait: boolean; -} - -/** - * Represents protection options for the sheet. - * @typedef {Object} ProtectionOption@typedef {Object} ProtectionOption - * @property {"0" | "1" | 0 | 1} sheet - Protect the sheet. - * @property {"0" | "1" | 0 | 1} formatCells - Allow formatting cells. - * @property {"0" | "1" | 0 | 1} formatColumns - Allow formatting columns. - * @property {"0" | "1" | 0 | 1} formatRows - Allow formatting rows. - * @property {"0" | "1" | 0 | 1} insertColumns - Allow inserting columns. - * @property {"0" | "1" | 0 | 1} insertRows - Allow inserting rows. - * @property {"0" | "1" | 0 | 1} insertHyperlinks - Allow inserting hyperlinks. - * @property {"0" | "1" | 0 | 1} deleteColumns - Allow deleting columns. - * @property {"0" | "1" | 0 | 1} deleteRows - Allow deleting rows. - * @property {"0" | "1" | 0 | 1} sort - Allow sorting. - * @property {"0" | "1" | 0 | 1} autoFilter - Allow using auto filter. - * @property {"0" | "1" | 0 | 1} pivotTables - Allow using pivot tables. - */ -declare type ProtectionOption = { - [key in ProtectionOptionKey]: "0" | "1" | 0 | 1; -}; - -/** - * Keys for protection options. - * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey - */ -declare type ProtectionOptionKey = "sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"; - -/** - * Represents the result of reading data. - * @interface - */ -declare interface ReadResult { - data: ExtractResult; - sheetNameObject: Record; - sheetName: IterableIterator<[string, string]>; - maxLengthOfColumn: Record; -} - -export declare function replaceInExcel(url: string | null | undefined, replaceData: Record, option?: ReplacerOption): Promise; - -/** - * Represents options for the replacer. - * @interface - */ -declare interface ReplacerOption { - fileName?: string; - backend?: boolean; - fetch?: Function; - data?: Blob | Buffer_2; - notSave?: boolean; - generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; -} - -declare type RowHeightScaleFunction = (data: number, rowIndex: number, fromHeader: boolean) => number; - -/** - * Represents a map of rows in the sheet. - * @interface - */ -declare interface RowMap { - [rowNumber: number]: { - startTag: string; - endTag: string; - details: string; - }; -} - -/** - * Represents a sheet in the Excel. - * @interface - * @extends {SheetOption} - */ -declare interface Sheet extends SheetOption { - /** Array of headers in the sheet. */ - headers: Header[]; - /** Array of data in the sheet. */ - data: Data[]; -} - -/** - * Options for configuring a sheet. - * @interface - */ -declare interface SheetOption { - /** Indicates if the sheet should be without a header. */ - withoutHeader?: boolean; - /** Options for configure property name that maybe provide for apply outlineLevel, hidden, height option of row*/ - mapSheetDataOption?: { - /** Outline level of the sheet data. */ - outlineLevel?: string; - /** Indicates if the sheet data is hidden. */ - hidden?: string; - /** Height of the sheet data. */ - height?: string; - }; - /** Background image of the sheet. */ - backgroundImage?: string; - /** Array of conditional formatting rules. */ - conditionalFormatting?: ConditionalFormatting[]; - /** Function for multi-style condition. */ - multiStyleCondition?: MultiStyleConditionFunction; - /** Indicates if the sheet should use split based on match. */ - useSplitBaseOnMatch?: boolean; - /** Indicates if strings should be converted to numbers Automatically. */ - convertStringToNumber?: boolean; - /** Array of images in the sheet. */ - images?: ImageTypes[]; - /** Formula applied to the sheet. */ - formula?: Formula; - /** Page options for the sheet. */ - pageOption?: PageOption; - /** Name of the sheet. */ - name?: string; - /** Title of the sheet. */ - title?: Title; - /** Shift sheet from top. */ - shiftTop?: number; - /** Shift sheet from Left. */ - shiftLeft?: number; - /** Indicates if the sheet is selected. */ - selected?: boolean; - /** Tab color of the sheet. */ - tabColor?: string; - /** Array of merge ranges in the sheet. */ - merges?: string[]; - /** Key for the header style. */ - headerStyleKey?: string; - /** Function for merge row data base on condition. */ - mergeRowDataCondition?: MergeRowDataConditionFunction; - /** Function for style cell base on condition. */ - styleCellCondition?: StyleCellConditionFunction; - /** Function for comment base on condition. */ - commentCondition?: CommentConditionFunction; - /** Sort and filter options for the sheet. */ - sortAndFilter?: SortAndFilter; - /** State of the sheet (hidden or visible). */ - state?: "hidden" | "visible"; - /** Options for the header row. */ - headerRowOption?: object; - /** Protection options for the sheet. */ - protectionOption?: ProtectionOption; - /** Height of the header. */ - headerHeight?: number; - /** Array of checkboxes in the sheet. */ - checkbox?: Checkbox[]; - /** View options for the sheet. */ - viewOption?: ViewOption; - /** Indicates if the sheet is right-to-left. */ - rtl?: boolean; - /** Page break options for the sheet. */ - pageBreak?: PageBreak; - /** Options for displaying the sheet as a table. */ - asTable?: AsTableOption; - /** Array of dropdowns in the sheet. */ - dropDowns?: DropDown[]; -} - -/** - * Represents side-by-side data in the sheet. - * @interface - */ -declare interface SideBySide { - sheetName?: string; - spaceX?: number; - spaceY?: number; - headers: { - label: string; - text: string; - }[]; - data: Data[]; - headerIndex?: number; -} - -/** - * Generates an Excel file with side-by-side data. - * @param {SideBySide[][]} data - The side-by-side data. - * @returns {Promise} The generated Excel table. - */ -export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; - -/** - * Represents a single-reference formula setting. - * @interface - */ -declare interface SingleRefFormulaSetting { - type: SingleRefFormulaType; - referenceCell: string; - value?: number | string; - styleId?: string; -} - -/** - * Types of single-reference formulas. - * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType - */ -declare type SingleRefFormulaType = "LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"; - -/** - * Represents sort and filter options. - * @interface - */ -declare interface SortAndFilter { - mode: "all" | "ref"; - ref?: string; -} - -/** - * Represents the body of a style. - * @interface - */ -declare interface StyleBody { - /** The font family of the text. */ - fontFamily?: string; - /** The type of the style.(if not define used for cells, for other type should be define) */ - type?: StyleType; - /** The size of the font. */ - size?: number; - /** The index of the style(!!it's will override by process,Don't set value for it). */ - index?: number; - /** The alignment options of the text. */ - alignment?: AlignmentOption; - /** The border options. */ - border?: BorderOption; - /** The format of the text. */ - format?: string; - /** Indicates if the style is bold. */ - bold?: boolean; - /** Indicates if the style is underlined. */ - underline?: boolean; - /** Indicates if the style is italic. */ - italic?: boolean; - /** Indicates if the style has double underline. */ - doubleUnderline?: boolean; - /** The color of the style. */ - color?: string; - /** The background color of the style. */ - backgroundColor?: string; -} - -/** - * Function type for style cell condition. - * @callback StyleCellConditionFunction@callback StyleCellConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {Header | Data} object - The data object. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @param {string[]} styleKeys - The style keys. - * @returns {string | null} The style key or null. - */ -declare type StyleCellConditionFunction = (data: Header | string | number | undefined, object: Header | Data, rowIndex: number, colIndex: number, fromHeader: boolean, styleKeys: string[]) => string | null; - -/** - * Represents a style mapper. - * @interface - */ -declare interface StyleMapper { - conditionalFormatting: { - count: number; - value: string; - }; - commentSyntax: { - value: { - [key: string]: string; - }; - }; - format: { - count: number; - value: string; - }; - border: { - count: number; - value: string; - }; - fill: { - count: number; - value: string; - }; - font: { - count: number; - value: string; - }; - cell: { - count: number; - value: string; - }; -} - -/** - * Represents a collection of styles. - * @interface - */ -declare interface Styles { - [key: string]: StyleBody; -} - -/** - * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). - * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType - */ -declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; - -/** - * Generates an Excel file with a theme. - * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. - * @param {ThemeOption} [option] - The theme options. - * @returns {Promise} The generated Excel table. - */ -export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; - -/** - * Represents theme options. - * @interface - */ -declare interface ThemeOption { - negativeColor?: boolean; - headerColor?: string; - rowColor?: string; - headerBackgroundColor?: string; - rowBackgroundColor?: string; - fileName?: string; - filterKeys?: string[]; -} - -/** - * Represents the title of the sheet. - * @interface - */ -declare interface Title { - shiftTop?: number; - shiftLeft?: number; - consommeRow?: number; - consommeCol?: number; - height?: number; - styleId?: string; - text?: string; - multiStyleValue?: MultiStyleValue[]; - comment?: Comment_2 | string; -} - -declare function validateExcelTableObjectFunction(data: ExcelTable, strict?: boolean, warn?: boolean): void; - -declare function validateSheetArrayFunction(sheets: Sheet[] | Sheet, strict?: boolean, warn?: boolean): void; - -declare function validateStyleObjectFunction(styles: Styles, strict?: boolean, warn?: boolean): void; - -declare interface ValidationObject { - mode: ValidationType; - type: string; - isEnum?: boolean; - enum?: string[]; - isArray?: boolean; - notEmpty?: boolean; - min?: number; - validateFunction?: (key: string, value: any, strict: boolean, warn: boolean) => boolean; -} - -declare type ValidationType = "TYPE_CHECK"; - -declare namespace Validator { - export { - validateStyleObjectFunction, - validateSheetArrayFunction, - validateExcelTableObjectFunction, - exportedForTesting - } -} -export { Validator } - -/** - * Options for configuring the view of the sheet. - * @interface - */ -declare interface ViewOption { - /** The type of view. */ - type?: "pageLayout" | "pageBreakPreview"; - /** Indicates if the grid should be hidden. */ - hideGrid?: boolean; - /** Indicates if the headlines should be hidden. */ - hideHeadlines?: boolean; - /** Indicates if the ruler should be hidden. */ - hideRuler?: boolean; - /** Options for freezing rows or columns. */ - frozenOption?: { - /** The type of freezing. */ - type: "ROW" | "COLUMN" | "BOTH" | "R" | "C" | "B"; - /** The index/position at which to freeze. */ - index: number | { - r: number; - c: number; - }; - }; - /** Options for splitting the view. */ - splitOption?: { - /** The type of split. */ - type: "VERTICAL" | "HORIZONTAL" | "BOTH" | "V" | "H" | "B"; - /** The start position of the split. */ - startAt?: ViewStart; - /** The position of the split. */ - split: number | { - x: number; - y: number; - }; - }; -} - -/** - * Options for the start of the view. - * @interface - */ -declare interface ViewStart { - t?: string; - b?: string; - r?: string; - l?: string; - one?: string; - two?: string; -} - -export { } diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index 706dcd2..8b13789 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1,55 +1 @@ -var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;ob[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),b=h.charAt(2);return w+w+o+o+b+b}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((b,c)=>b&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,b)=>o+b.charAt(0)+b.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),b=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),b)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let b=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(b):w&&w.headerColor?w.headerColor:Tt(b),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:b,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),b[_]=a})}return l});if(Object.keys(b).forEach(l=>{i.file(l,b[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,b,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,b,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var y=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=y.length,v=!0,typeof b=="function"?s=b(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),y.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;y.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof b=="function"?S.height=b(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length -`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,b,c,r,f){let i={};return` -`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+b.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` -Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,b){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),y=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let b=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(b=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return b&&c.unshift(r+":"),{hasAuthor:b,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,b){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` -`;return}i>0&&(l=' xml:space="preserve"',r+=` -`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=pt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />
");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` -`};let he=1024;const Z={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},oe={checkbox:` - - - - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ye="",Ve=[],at=[],Ge=[],He=[],Le={},Je="",Qe=!1,vt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const M=ie.row.length;vt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const M=ie.column.length;vt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(Qe=!0),ie.margin){const ae=ie.margin;let se={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(se).forEach(G=>{typeof ae[G]=="number"&&(se[G]=ae[G])}),qt=''}let M="",ee="",Y="",W="";if(["header","footer"].forEach(ae=>{const se=ae.charAt(0).toUpperCase()+ae.substring(1);if(ie[ae]){const G=ie[ae];typeof G=="object"&&Object.keys(G).forEach(le=>{M.indexOf(le)<0&&(M+=le);const Oe=G[le];let xe="";if(Object.keys(Oe).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Oe[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+le+se+">"+xe+"",le=="odd")ee+=xe;else if(le=="even")Y+=xe;else if(le=="first")W+=xe;else throw"type error"})}}),Je=ee+Y+W,Je.length>0){Qe=!0;const ae=M.length==7||M.length==12?' differentOddEven="1"':"",se=M.indexOf("first")>=0?' differentFirst="1"':"";Je=""+Je+""}}if(C.viewOption){let ie="";const M=C.viewOption;M.type&&(ge=M.type),M.hideRuler&&(re+=' showRuler="0" '),M.hideGrid&&(re+=' showGridLines="0" '),M.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=M.splitOption;if(typeof ee>"u"&&(Qe=!1,typeof M.frozenOption=="object")){const Y=M.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=et(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(Qe&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((M,ee)=>{let Y=ie;if(M.link){let le=qe(M.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[le.col]+"$"+(le.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");M.mixed?Y=Y.replace("**value**",'checked="Mixed"'):M.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),M.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",M.text);let ae=M.startStr,se=M.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(M.col&&M.row&&(G={start:{col:M.col,row:M.row-1},end:{col:M.col,row:M.row}}),typeof ae=="string"&&ae.length>=2){let le=qe(ae,r);G.start={...le},G.end={col:le.col+1,row:le.row+1}}if(typeof se=="string"&&se.length>=2){let le=qe(se,r);le.row+=1,le.col+=1,G.end={...le}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+M.text+""})}let xt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;xt=new Promise(async(M,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,ae="image"+fe+"."+W,se=await Rt(ie,ae,b,h.fetch);se||ee("image not load"),H.push(W),M({name:ae,type:W,image:se,ref:fe})})}let wt;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),wt=Promise.all([...C.images.map(async(ie,M)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",H.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,b,h.fetch),obj:ie,i:M,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let M="";if(C.title){const W=C.title,fe=W.comment,ae=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,se=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+se>=0?W.shiftLeft+se:se,le=W.consommeRow?W.consommeRow-1:1,Oe=W.consommeCol?W.consommeCol:ie,xe=le==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+ae);if(ye.push(ce+":"+r[G+Oe-1]+(P+le+ae)),typeof fe<"u"){Re=!0;const ke=dt(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(ke.hasAuthor&&typeof ke.author<"u"){let Ce=ke.author.toString();const Ee=Pe.indexOf(Ce);Ee<0?Pe.push(Ce):Ne=Ee}Ve.push({row:P+ae-1,col:G}),Ye+=ut(ce,ke.commentStr,ke.commentStyle,Ne)}typeof W.text=="string"&&(d[P+ae]={startTag:'',details:''+R+"",endTag:""},M+='',M+=''+R+"",M+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+tt(W.text)+""),P+=ae+le+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Ge.push(fe),W.conditionalFormatting&&y&&He.push(fe),at.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const ae=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=dt(W.comment,S.commentSyntax.value,t);let le=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Oe=G.author.toString();const xe=Pe.indexOf(Oe);xe<0?Pe.push(Oe):le=xe}Ve.push({row:P-1,col:fe}),Ye+=ut(ae,G.commentStr,G.commentStyle,le)}const se=ze&&ze[ae];if(se){const G=ht(ae,se,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[ae]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+tt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=M;else{const W='fe+" "+ae+'="'+C.headerRowOption[ae]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=M+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",ae=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",se=C.data.length;C.data.forEach((G,le)=>{if(G.mergeType)for(let ce=0;ce
");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` -`};let he=1024;const Z={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},oe={checkbox:` - - - - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ve="",Ge=[],st=[],Xe=[],He=[],Le={},Qe="",et=!1,xt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const M=ie.row.length;xt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const M=ie.column.length;xt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(et=!0),ie.margin){const ae=ie.margin;let se={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(se).forEach(G=>{typeof ae[G]=="number"&&(se[G]=ae[G])}),qt=''}let M="",ee="",Y="",W="";if(["header","footer"].forEach(ae=>{const se=ae.charAt(0).toUpperCase()+ae.substring(1);if(ie[ae]){const G=ie[ae];typeof G=="object"&&Object.keys(G).forEach(le=>{M.indexOf(le)<0&&(M+=le);const Ie=G[le];let xe="";if(Object.keys(Ie).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Ie[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+le+se+">"+xe+"",le=="odd")ee+=xe;else if(le=="even")Y+=xe;else if(le=="first")W+=xe;else throw"type error"})}}),Qe=ee+Y+W,Qe.length>0){et=!0;const ae=M.length==7||M.length==12?' differentOddEven="1"':"",se=M.indexOf("first")>=0?' differentFirst="1"':"";Qe=""+Qe+""}}if(C.viewOption){let ie="";const M=C.viewOption;M.type&&(ge=M.type),M.hideRuler&&(re+=' showRuler="0" '),M.hideGrid&&(re+=' showGridLines="0" '),M.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=M.splitOption;if(typeof ee>"u"&&(et=!1,typeof M.frozenOption=="object")){const Y=M.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=tt(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(et&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((M,ee)=>{let Y=ie;if(M.link){let le=Ye(M.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[le.col]+"$"+(le.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");M.mixed?Y=Y.replace("**value**",'checked="Mixed"'):M.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),M.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",M.text);let ae=M.startStr,se=M.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(M.col&&M.row&&(G={start:{col:M.col,row:M.row-1},end:{col:M.col,row:M.row}}),typeof ae=="string"&&ae.length>=2){let le=Ye(ae,r);G.start={...le},G.end={col:le.col+1,row:le.row+1}}if(typeof se=="string"&&se.length>=2){let le=Ye(se,r);le.row+=1,le.col+=1,G.end={...le}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+M.text+""})}let wt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;wt=new Promise(async(M,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,ae="image"+fe+"."+W,se=await Rt(ie,ae,b,h.fetch);se||ee("image not load"),H.push(W),M({name:ae,type:W,image:se,ref:fe})})}let Ct;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),Ct=Promise.all([...C.images.map(async(ie,M)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",H.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,b,h.fetch),obj:ie,i:M,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let M="";if(C.title){const W=C.title,fe=W.comment,ae=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,se=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+se>=0?W.shiftLeft+se:se,le=W.consommeRow?W.consommeRow-1:1,Ie=W.consommeCol?W.consommeCol:ie,xe=le==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+ae);if(ye.push(ce+":"+r[G+Ie-1]+(P+le+ae)),typeof fe<"u"){Re=!0;const ke=ut(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(ke.hasAuthor&&typeof ke.author<"u"){let Ce=ke.author.toString();const Te=Pe.indexOf(Ce);Te<0?Pe.push(Ce):Ne=Te}Ge.push({row:P+ae-1,col:G}),Ve+=mt(ce,ke.commentStr,ke.commentStyle,Ne)}typeof W.text=="string"&&(d[P+ae]={startTag:'',details:''+R+"",endTag:""},M+='',M+=''+R+"",M+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+rt(W.text)+""),P+=ae+le+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Xe.push(fe),W.conditionalFormatting&&y&&He.push(fe),st.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const ae=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=ut(W.comment,S.commentSyntax.value,t);let le=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Ie=G.author.toString();const xe=Pe.indexOf(Ie);xe<0?Pe.push(Ie):le=xe}Ge.push({row:P-1,col:fe}),Ve+=mt(ae,G.commentStr,G.commentStyle,le)}const se=ze&&ze[ae];if(se){const G=dt(ae,se,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[ae]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+rt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=M;else{const W='fe+" "+ae+'="'+C.headerRowOption[ae]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=M+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",ae=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",se=C.data.length;C.data.forEach((G,le)=>{if(G.mergeType)for(let ce=0;ce
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` +`};let we=1024;const Te={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},ke={checkbox:` + + + + `};let ae=[],ie="",xe=!1,pe=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",fe="",Ee="",Se="",je="",nt=!1,_t="",It="",Pt="",jt="",be=Object.assign([],a.merges),ue=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,he=[],Me="",qe=[],Rt=[],at=[],it=[],Oe={},De="",Le=!1,st="";if(a.rtl&&(Se+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){je="pageBreakPreview";const i=T.row.length;st+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){je="pageBreakPreview";const i=T.column.length;st+=''+T.column.reduce((y,p)=>y+'',"")+""}}let Dt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Le=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Dt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(je=i.type),i.hideRuler&&(Se+=' showRuler="0" '),i.hideGrid&&(Se+=' showGridLines="0" '),i.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Le=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Se+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Ee='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Se+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Se+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Ee='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const T=ge.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=Fe(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),we++;let c=w+""+we++;const _="_x0000_s"+c;It+=Te.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=Fe(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Fe(A,l);O.row+=1,O.col+=1,h.end={...O}}jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Pt+='',_t+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;ct=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=J++,F="image"+_+"."+c,A=await bt(T,F,o,e.fetch);A||y("image not load"),ve.push(c),i({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const c="image"+J+++"."+p;return{type:p,image:await bt(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(be.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let me=he.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=he.indexOf(ee);re<0?he.push(ee):me=re}qe.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,me)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,R):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',pe||(pe=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Rt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Oe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=he.indexOf(le);V<0?he.push(le):O=V}qe.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(xe=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` +`};let Te=1024;const Ee={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},Oe={checkbox:` + + + + `};let ie=[],se="",be=!1,he=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",me="",Se="",ke="",je="",nt=!1,It="",Pt="",jt="",Rt="",Ce=Object.assign([],a.merges),ye=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,ue=[],Me="",Ye=[],Dt=[],at=[],it=[],Fe={},De="",Le=!1,st="";if(a.rtl&&(ke+=' rightToLeft="1" '),a.pageBreak){const E=a.pageBreak;if(E.row&&Array.isArray(E.row)){je="pageBreakPreview";const s=E.row.length;st+=''+E.row.reduce((y,p)=>y+'',"")+""}if(E.column&&Array.isArray(E.column)){je="pageBreakPreview";const s=E.column.length;st+=''+E.column.reduce((y,p)=>y+'',"")+""}}let Lt="";if(a.pageOption){const E=a.pageOption;if(E.isPortrait&&(Le=!0),E.margin){const F=E.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Lt=''}let s="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(E[F]){const h=E[F];typeof h=="object"&&Object.keys(h).forEach(O=>{s.indexOf(O)<0&&(s+=O);const le=h[O];let q="";if(Object.keys(le).reduce((D,I)=>(I=="l"?D.splice(0,0,I):I=="c"?D.splice(1,0,I):I=="r"&&D.splice(2,0,I),D),[]).forEach(D=>{const I=le[D];q+="&"+D.toUpperCase(),I.styleId&&z[I.styleId]&&(q+=z[I.styleId]),I.text&&(q+=I.text)}),q="<"+O+A+">"+q+"",O=="odd")y+=q;else if(O=="even")p+=q;else if(O=="first")c+=q;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let E="";const s=a.viewOption;s.type&&(je=s.type),s.hideRuler&&(ke+=' showRuler="0" '),s.hideGrid&&(ke+=' showGridLines="0" '),s.hideHeadlines&&(ke+=' showRowColHeaders="0" ');let y=s.splitOption;if(typeof y>"u"&&(Le=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(E=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(ke+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Se='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(ke+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Se='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(ke+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Se='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const E=xe.checkbox;a.checkbox.forEach((s,y)=>{let p=E;if(s.link){let O=Ae(s.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),Te++;let c=w+""+Te++;const _="_x0000_s"+c;Pt+=Ee.checkbox.replace("***id***",_).replace("***text***",s.text);let F=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof F=="string"&&F.length>=2){let O=Ae(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Ae(A,l);O.row+=1,O.col+=1,h.end={...O}}Rt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",jt+='',It+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const E=a.backgroundImage;ct=new Promise(async(s,y)=>{let p=E.lastIndexOf("."),c;p>0?(c=E.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await Ct(E,F,o,e.fetch);A||y("image not load"),we.push(c),s({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(E,s)=>{let y=E.url.lastIndexOf("."),p;y>0?(p=E.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",we.push(p);const c="image"+X+++"."+p;return{type:p,image:await Ct(E.url,c,o,e.fetch),obj:E,i:s,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const E=a.headers.length;let s="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:E,q=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",D=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(Ce.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let de=ue.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=ue.indexOf(ee);re<0?ue.push(ee):de=re}Ye.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,de)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},s+='',s+=''+B+"",s+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,D):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),ce&&(H+='',he||(he=f==null?void 0:f.folder("tables"))),V.start=l[p]+""+k,V.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(ce&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Dt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Fe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const q=ue.indexOf(le);q<0?ue.push(le):O=q}Ye.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ye&&ye[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(be=!0,se+=h.chainCell),C+=h.cell,delete ye[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),ce&&(H+=""),a.withoutHeader)C+=s;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=s+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` +`};let ve=1024;const we={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},Se={checkbox:` + + + + `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
"); + const H = x.border; + let k = ""; + if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.top || H.full) && (k += ''), (H.bottom || H.full) && (k += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { + const C = r[x.format]; + C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); + } + return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; + }, + { + conditionalFormatting: { + count: G ? 1 : 0, + value: ' ' + }, + commentSyntax: { + value: {} + }, + format: { + count: 0, + value: "" + }, + border: { + count: 1, + value: "" + }, + fill: { + count: 2, + value: "" + }, + font: { + count: 2, + value: "" + }, + cell: { + count: 2, + value: "" + } + } + ); + f == null || f.file("styles.xml", Gt(N, G)); + let oe = '', P = "", B = 0, X = "", K = "", L = {}; + const E = {}; + let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; + const ye = { + checkbox: ` +` + }; + let ve = 1024; + const we = { + checkbox: ` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
` + }, Se = { + checkbox: ` + + + + ` + }; + let ae = [], ie = "", ge = !1, de = null; + for (let w = 0; w < s; w++) { + const a = e.sheet[w], b = w + 1; + let x = {}, Y = { + start: "", + end: "" + }; + const se = a.asTable; + let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( + [], + a.conditionalFormatting + ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; + if (a.rtl && (Ee += ' rightToLeft="1" '), a.pageBreak) { + const T = a.pageBreak; + if (T.row && Array.isArray(T.row)) { + _e = "pageBreakPreview"; + const i = T.row.length; + Ze += '' + T.row.reduce( + (y, p) => y + '', + "" + ) + ""; + } + if (T.column && Array.isArray(T.column)) { + _e = "pageBreakPreview"; + const i = T.column.length; + Ze += '' + T.column.reduce( + (y, p) => y + '', + "" + ) + ""; + } + } + let gt = ""; + if (a.pageOption) { + const T = a.pageOption; + if (T.isPortrait && (je = !0), T.margin) { + const F = T.margin; + let A = { + left: 0.7, + right: 0.7, + top: 0.75, + bottom: 0.75, + header: 0.3, + footer: 0.3 + }; + Object.keys(A).forEach((h) => { + typeof F[h] == "number" && (A[h] = F[h]); + }), gt = ''; + } + let i = "", y = "", p = "", c = ""; + if (["header", "footer"].forEach((F) => { + const A = F.charAt(0).toUpperCase() + F.substring(1); + if (T[F]) { + const h = T[F]; + typeof h == "object" && Object.keys(h).forEach((O) => { + i.indexOf(O) < 0 && (i += O); + const le = h[O]; + let V = ""; + if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { + const I = le[R]; + V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); + }), V = "<" + O + A + ">" + V + "", O == "odd") + y += V; + else if (O == "even") + p += V; + else if (O == "first") + c += V; + else + throw "type error"; + }); + } + }), Pe = y + p + c, Pe.length > 0) { + je = !0; + const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; + Pe = "" + Pe + ""; + } + } + if (a.viewOption) { + let T = ""; + const i = a.viewOption; + i.type && (_e = i.type), i.hideRuler && (Ee += ' showRuler="0" '), i.hideGrid && (Ee += ' showGridLines="0" '), i.hideHeadlines && (Ee += ' showRowColHeaders="0" '); + let y = i.splitOption; + if (typeof y > "u" && (je = !1, typeof i.frozenOption == "object")) { + const p = i.frozenOption; + if (T = ' state="frozen" ', p.type == "R" || p.type == "ROW") { + let c; + typeof p.index == "object" ? c = p.index.r : c = p.index, y = { + startAt: { + b: "A" + (c + 1) + }, + type: "H", + split: c + }; + } else if (p.type == "C" || p.type == "COLUMN") { + let c; + typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { + type: "V", + startAt: { + r: l[c] + 1 + }, + split: c + }; + } else if (p.type == "B" || p.type == "BOTH") { + let c = "", _; + typeof p.index == "number" ? (_ = p.index, c = l[p.index] + (p.index + 1)) : (_ = { + y: p.index.r, + x: p.index.c + }, c = l[p.index.c] + (p.index.r + 1)), y = { + startAt: { + two: c + }, + type: "B", + split: _ + }; + } + } + if (y) + if (y.type == "H" || y.type == "HORIZONTAL") { + let p; + y.startAt && (p = y.startAt.b, y.startAt.t && (Ee += ' topLeftCell="' + y.startAt.t + '"')), p || (p = "A1"), Te = '"; + } else if (y.type == "V" || y.type == "VERTICAL") { + let p; + y.startAt && (p = y.startAt.r, y.startAt.l && (Ee += ' topLeftCell="' + y.startAt.l + '"')), p || (p = "A1"), Te = '"; + } else { + let p; + y.startAt && (p = y.startAt.two, y.startAt.one && (Ee += ' topLeftCell="' + y.startAt.one + '"')), p || (p = "A1"), Te = '"; + } + } + if (je && (_e = "pageLayout"), a.checkbox) { + ze = !0; + const T = ye.checkbox; + a.checkbox.forEach((i, y) => { + let p = T; + if (i.link) { + let O = Re(i.link, l); + p = p.replace( + "**fmlaLink**", + 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' + ); + } else + p = p.replace("**fmlaLink**", ""); + i.mixed ? p = p.replace("**value**", 'checked="Mixed"') : i.checked ? p = p.replace("**value**", 'checked="Checked"') : p = p.replace("**value**", ""), i.threeD && p.replace('noThreeD="1"', ""), ae.push(p), ve++; + let c = w + "" + ve++; + const _ = "_x0000_s" + c; + pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); + let F = i.startStr, A = i.endStr, h = { + start: { + col: 0, + row: 0 + }, + end: { + col: 1, + row: 1 + } + }; + if (i.col && i.row && (h = { + start: { + col: i.col, + row: i.row - 1 + }, + end: { + col: i.col, + row: i.row + } + }), typeof F == "string" && F.length >= 2) { + let O = Re(F, l); + h.start = { + ...O + }, h.end = { + col: O.col + 1, + row: O.row + 1 + }; + } + if (typeof A == "string" && A.length >= 2) { + let O = Re(A, l); + O.row += 1, O.col += 1, h.end = { + ...O + }; + } + ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; + }); + } + let Xe; + if (a.backgroundImage) { + v == null && (v = f == null ? void 0 : f.folder("media")); + const T = a.backgroundImage; + Xe = new Promise(async (i, y) => { + let p = T.lastIndexOf("."), c; + p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; + const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); + A || y("image not load"), Ce.push(c), i({ + name: F, + type: c, + image: A, + ref: _ + }); + }); + } + let Je; + if (a.images && (v == null && (v = f == null ? void 0 : f.folder("media")), Je = Promise.all([ + ...a.images.map(async (T, i) => { + let y = T.url.lastIndexOf("."), p; + y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); + const c = "image" + J++ + "." + p; + return { + type: p, + image: await _t(T.url, c, o, e.fetch), + obj: T, + i, + name: c + }; + }) + ])), Array.isArray(a.headers) && a.headers.length) { + const T = a.headers.length; + let i = ""; + if (a.title) { + const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); + if (xe.push( + I + ":" + l[h + le - 1] + (k + O + F) + ), typeof _ < "u") { + Ie = !0; + const Q = rt( + _, + N.commentSyntax.value, + d + ); + let fe = pe.length; + if (Q.hasAuthor && typeof Q.author < "u") { + let ee = Q.author.toString(); + const re = pe.indexOf(ee); + re < 0 ? pe.push(ee) : fe = re; + } + He.push({ + row: k + F - 1, + col: h + }), Le += nt( + I, + Q.commentStr, + Q.commentStyle, + fe + ); + } + typeof c.text == "string" && (x[k + F] = { + startTag: '', + details: '' + B + "", + endTag: "" + }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + c.multiStyleValue, + N.commentSyntax.value, + R + ) : P += "" + $e(c.text) + ""), k += F + O + 1; + } + let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; + if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { + if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( + c, + null, + _, + !0 + ) === !0 && (ke[l[_]] = { + inProgress: !0, + start: k + }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( + c, + c, + k, + _, + !0, + S + ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) + return; + const F = l[_] + "" + k; + if (typeof a.commentCondition == "function") { + const h = a.commentCondition( + c, + null, + c.label, + k, + _, + !0 + ); + (typeof h == "string" || typeof h == "object" && h != null) && (c.comment = h); + } + if (c.comment) { + Ie = !0; + const h = rt( + c.comment, + N.commentSyntax.value, + d + ); + let O = pe.length; + if (h.hasAuthor && typeof h.author < "u") { + let le = h.author.toString(); + const V = pe.indexOf(le); + V < 0 ? pe.push(le) : O = V; + } + He.push({ + row: k - 1, + col: _ + }), Le += nt( + F, + h.commentStr, + h.commentStyle, + O + ); + } + const A = ue && ue[F]; + if (A) { + const h = ot( + F, + A, + b, + e.styles + ); + h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; + } else { + if (C += '' + B + "", typeof a.multiStyleCondition == "function") { + const h = a.multiStyleCondition( + c, + null, + c.label, + k, + _, + !0 + ); + h && (c.multiStyleValue = h); + } + c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + c.multiStyleValue, + N.commentSyntax.value, + y || "" + ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; + } + }), se && (H += ""), a.withoutHeader) + C += i; + else { + const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; + x[k] = { + startTag: c, + endTag: "", + details: C + }, C = i + c + C + "", k++; + } + if (Array.isArray(a.data)) { + const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; + a.data.forEach((h, O) => { + if (h.mergeType) + for (let I = 0; I < h.mergeType.length; I++) { + const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; + let re = ""; + Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); + } + const le = h.rowStyle, V = '", + details: R + }, k++, C += ""; + }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); + } + if (We.length > 0 && We.forEach((c) => { + const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; + ue[A + "" + k] = { + start: a.withoutHeader ? A + "1" : A + "2", + end: A + "" + (k - 1), + type: F.formula.type, + ...F.formula.styleId ? { styleId: F.formula.styleId } : {} + }; + }), Ge.length > 0 && Ge.forEach((c) => { + const _ = a.headers[c]; + _.conditionalFormatting && Ue.push({ + ..._.conditionalFormatting, + start: a.withoutHeader ? l[c] + "1" : l[c] + "2", + end: l[c] + "" + (k - 1) + }); + }), ue) { + const c = Object.keys(ue).sort( + (_, F) => _ > F ? 1 : -1 + ); + if (c.length) { + let _ = {}; + c.forEach((F) => { + const A = ot( + F, + ue[F], + b, + e.styles + ); + A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; + }), Object.keys(_).forEach((F) => { + const A = F, h = _[A]; + let O = x[A]; + if (O) { + const le = O.startTag + O.details + h + O.endTag; + let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); + C = C.replace(V, le); + } else + C += '' + h + "", x[A] = { + startTag: '', + endTag: "", + details: h + }; + }); + } + } + } + w > 0 && (oe += ''); + const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; + X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); + const bt = a.sortAndFilter ? 'filterMode="1"' : ""; + let Ct = -1; + Xe && await Xe.then((T) => { + let i = T; + Ct = i.ref, v == null || v.file(i.name, i.image); + }); + let Ne = !1, Qe = "", vt = ""; + Je && (Ne = !0, await Je.then((T) => { + let i = ""; + T.forEach((y, p) => { + const c = p + 1; + let _ = y.image; + const F = y.name; + let A = y.obj.from, h = y.obj.to, O = y.obj.margin; + y.type; + let le = y.obj.type, V = y.obj.extent; + typeof V > "u" && (V = { + cx: 2e5, + cy: 2e5 + }); + let R = { + start: { + col: 0, + row: 0, + mL: 0, + mT: 0 + }, + end: { + col: 1, + row: 1, + mR: 0, + mB: 0 + } + }; + if (typeof A == "string" && A.length >= 2) { + let I = Re(A, l); + R.start = { + ...I + }, R.end = { + col: I.col + 1, + row: I.row + 1 + }; + } + if (typeof h == "string" && h.length >= 2) { + let I = Re(h, l); + I.row += 1, I.col += 1, R.end = { + ...I + }; + } + R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; + }), vt = ` +` + i + ""; + })), xe = [...new Set(xe)]; + let wt = "", Ae = 1; + Ue.length > 0 && (wt = Ue.reduce((T, i) => { + if (i.type == "cells") + return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; + if (i.type == "top") + return T + '"; + if (i.type == "iconSet") { + let y = ""; + return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); + } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; + }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { + indexId: q + 1, + key: "sheet" + (w + 1), + sheetName: xt, + sheetDataTableColumns: H, + backgroundImageRef: Ct, + sheetDimensions: Y, + asTable: se || !1, + sheetDataString: C, + sheetDropDown: ro(a.dropDowns), + sheetBreakLine: Ze, + viewType: _e, + hasComment: Ie, + drawersContent: Qe, + cFDataString: wt, + sheetMargin: gt, + sheetHeaderFooter: Pe, + isPortrait: je, + drawersRels: vt, + hasImages: Ne, + hasCheckbox: ze, + formRel: ht, + checkboxDrawingContent: dt, + checkboxForm: ae, + checkboxSheetContent: ut, + checkboxShape: pt, + commentString: Le, + commentAuthor: pe, + shapeCommentRowCol: He, + splitOption: Te, + sheetViewProperties: Ee, + sheetSizeString: W.length > 0 ? "" + W + "" : "", + protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", + merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", + selectedView: !!a.selected, + sheetSortFilter: ce, + tabColor: a.tabColor ? '' : "' + }, q++; + } + ge && (q++, K += '', f == null || f.file( + "calcChain.xml", + ` +` + ie + "" + )); + let Mt = Object.keys(E), qe = m.folder("_rels"); + qe == null || qe.file( + ".rels", + ` + ` + ); + let Oe = m.folder("docProps"); + Oe == null || Oe.file( + "core.xml", + ` +` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" + ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( + "workbook.xml", + ` + ` + (U ? '' : "") + " " + X + " " + ), f == null || f.file( + "sharedStrings.xml", + ` + ' + P + "" + ); + let Ye = f == null ? void 0 : f.folder("_rels"); + Ye == null || Ye.file( + "workbook.xml.rels", + ` + ` + K + " " + ); + let Ve = f == null ? void 0 : f.folder("theme"); + Ve == null || Ve.file( + "theme1.xml", + ` +` + ); + let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; + if (Mt.forEach((w, a) => { + const b = E[w]; + let x = "", Y = { + form: !1, + drawing: !1, + vmlDrwing: !1, + comment: !1, + table: !1, + sheetDrawingsPushed: !1 + }; + const se = b.sheetDataTableColumns; + if (se.length > 0) { + mt.push("table" + (a + 1) + ".xml"); + const C = b.asTable, W = b.sheetDimensions; + de == null || de.file( + "table" + (a + 1) + ".xml", + ` +' + se + '
' + ), x += ''; + } + const H = "drawing" + (De.length + 1) + ".xml"; + if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( + H + ".rels", + b.drawersRels.toString() + ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( + H, + ` +` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" + )), b.hasComment) { + ft.push(a + 1); + let C = b.commentAuthor; + f == null || f.file( + "comments" + (a + 1) + ".xml", + ` +` + (Array.isArray(C) && C.length > 0 ? C.reduce( + (W, ce) => W + "" + ce + "", + "" + ) : "") + "" + b.commentString + "" + ), x += '' + (Y.vmlDrwing ? "" : ''); + } + if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( + "vmlDrawing" + (a + 1) + ".vml", + '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" + )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { + const C = Fe == null ? void 0 : Fe.folder("_rels"); + C == null || C.file( + "sheet" + (a + 1) + ".xml.rels", + ` + ` + x + "" + ); + } + let k = ""; + b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( + b.key + ".xml", + ` +` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" + ); + }), ae.length > 0) { + let w = f == null ? void 0 : f.folder("ctrlProps"); + ae.forEach((a, b) => { + w == null || w.file("ctrlProp" + (b + 1) + ".xml", a); + }); + } + if (m.file( + "[Content_Types].xml", + Zt( + oe, + ft, + [...new Set(Ce)], + De, + ae, + ge, + mt + ) + ), o) + return m.generateAsync({ + type: e.generateType ? e.generateType : "nodebuffer" + }).then((w) => w); + if (e.notSave) + return m.generateAsync({ type: "blob" }).then((w) => w.slice( + 0, + w.size, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + )); + m.generateAsync({ type: "blob" }).then(function(w) { + import("./FileSaver.min-BEH1o5YI.js").then((a) => a.F).then((a) => { + const { saveAs: b } = a; + b( + w, + (e.fileName ? e.fileName : "tableRecord") + ".xlsx" + ); + }); + }); +} +function no(e) { + const t = e.length; + let r = 0, o = {}, n = {}, l = {}; + for (let s = 0; s < t; s++) { + const f = e[s], v = f.length; + let D = {}; + for (let j = 0; j < v; j++) { + r++; + const S = f[j]; + let d; + S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { + headers: [], + data: [], + labelCounter: 0, + seenAt: s + }), d in n || (n[d] = { + index: s, + value: 0 + }), d in l || (o[d].labelCounter = 0, l[d] = !0); + let G = []; + const z = o[d].headers.length; + let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ + label: "c" + o[d].labelCounter, + text: N ? L.text : "" + }), Z["c" + o[d].labelCounter] = L.text, { + ...K, + [L.label]: "c" + o[d].labelCounter + }), {}); + if (o[d].headers.push(...G), S.spaceX) + for (let K = 0; K < S.spaceX; K++) + o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ + label: "c" + o[d].labelCounter, + text: "" + }); + n[d].index + 1 == s && (D[d] = n[d].value); + let P = D[d] || 0; + P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { + ...o[d].data[P], + ...Z + }, o[d].headerIndex = P, P++); + let B = Object.keys(oe), X = S.data.length >= o[d].data.length; + if (o[d].data = S.data.reduce((K, L, E) => { + let $ = {}; + return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { + let U = oe[q]; + $[U] = L[q] ? L[q] : ""; + }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; + }, o[d].data), X && S.spaceY) { + const K = o[d].headers.length; + for (let L = 0; L < S.spaceY; L++) { + let E = {}; + for (let $ = 0; $ < K; $++) { + const q = o[d].headers[$]; + E[q.label] = ""; + } + o[d].data.push(E); + } + } + n[d] = { + value: Math.max(o[d].data.length, n[d].value), + index: s + }; + } + l = {}; + } + let g = Object.keys(o), u = []; + return g.reduce( + (s, f) => { + let v = o[f]; + return s.sheet.push({ + ...v, + name: f + }), s; + }, + { sheet: u } + ); +} +function it(e) { + return /^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e); +} +function st(e) { + return /^[A-Z]+[1-9][1-9]*$/.test(e); +} +const lo = { + fontFamily: { + mode: "TYPE_CHECK", + type: "string" + }, + type: { + mode: "TYPE_CHECK", + type: "string" + }, + size: { + mode: "TYPE_CHECK", + type: "number" + }, + index: { + mode: "TYPE_CHECK", + type: "number" + }, + alignment: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + return t.rtl && t.ltr && o && console.warn("Alignment-rtl and ltr cannot be used together."), (t.readingOrder && t.ltr || t.readingOrder && t.rtl) && o && console.warn( + "Alignment-readingOrder cannot be used with rtl or ltr." + ), !0; + } + }, + border: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = ["full", "top", "left", "right", "bottom"], l = [ + "slantDashDot", + "dotted", + "thick", + "hair", + "dashDot", + "dashDotDot", + "dashed", + "thin", + "mediumDashDot", + "medium", + "double", + "mediumDashed" + ]; + return Object.keys(t).forEach((u) => { + const m = u; + if (n.indexOf(m) < 0) + throw 'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."'; + const s = t[m]; + if (!("color" in s)) + throw "border-The border must have a color."; + if (!("style" in s)) + throw "border-The border needs a style."; + if (typeof s.style == "string" && l.indexOf(s.style) < 0) + throw "border-An invalid style has been used."; + }), !0; + } + }, + format: { + mode: "TYPE_CHECK", + type: "string" + }, + bold: { + mode: "TYPE_CHECK", + type: "boolean" + }, + underline: { + mode: "TYPE_CHECK", + type: "boolean" + }, + italic: { + mode: "TYPE_CHECK", + type: "boolean" + }, + doubleUnderline: { + mode: "TYPE_CHECK", + type: "boolean" + }, + color: { + mode: "TYPE_CHECK", + type: "string" + }, + backgroundColor: { + mode: "TYPE_CHECK", + type: "string" + } +}, ao = { + notSave: { + mode: "TYPE_CHECK", + type: "boolean" + }, + creator: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + backend: { + mode: "TYPE_CHECK", + type: "boolean" + }, + activateConditionalFormatting: { + mode: "TYPE_CHECK", + type: "boolean" + }, + fileName: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + generateType: { + mode: "TYPE_CHECK", + type: "string", + isEnum: !0, + enum: ["nodebuffer", "array", "binarystring", "base64"] + }, + addDefaultTitleStyle: { + mode: "TYPE_CHECK", + type: "boolean" + }, + created: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + modified: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + numberOfColumn: { + mode: "TYPE_CHECK", + type: "number", + min: 26 + }, + createType: { + mode: "TYPE_CHECK", + type: "string" + }, + styles: { + mode: "TYPE_CHECK", + type: "object" + }, + sheet: { + mode: "TYPE_CHECK", + type: "object", + isArray: !0 + } +}, io = { + headers: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object" + }, + data: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object" + }, + withoutHeader: { + mode: "TYPE_CHECK", + type: "boolean" + }, + mapSheetDataOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = Object.keys(t), l = ["outlineLevel", "hidden", "height"]; + return n.forEach((g) => { + l.indexOf(g) < 0 && o && console.warn( + 'The Schema of mapSheetDataOption does not include the "' + g + '" property.' + ); + }), !0; + } + }, + backgroundImage: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + conditionalFormatting: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + return Array.isArray(t) && t.forEach((n) => { + if (n.type == "cells") { + const l = ["lt", "gt", "between", "ct", "eq"]; + if (!n.operator || !n.start || !n.end || typeof n.value > "u") + throw { + record: n, + error: "The object is not complete; you need to fill in the values for operator, start, end and value." + }; + if (l.indexOf(n.operator) < 0) + throw { record: n, error: "The operator is not valid." }; + } else if (n.type == "top") { + const l = ["belowAverage", "aboveAverage"]; + if (!n.start || !n.end || typeof n.value > "u") + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start, end and value." + }; + if (n.operator && l.indexOf(n.operator) < 0) + throw { record: n, error: "The operator is not valid." }; + } else if (n.type == "iconSet") { + if (!n.operator || !n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for operator, start and end" + }; + } else if (n.type == "colorScale") { + if (!n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start and end" + }; + } else if (n.type == "dataBar") { + if (!n.start || !n.end) + throw { + record: n, + error: "The object is not complete; you need to fill in the values for start and end" + }; + } else + throw 'Property "type" is not valid.'; + }), !0; + } + }, + multiStyleCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + useSplitBaseOnMatch: { + mode: "TYPE_CHECK", + type: "boolean" + }, + convertStringToNumber: { + mode: "TYPE_CHECK", + type: "boolean" + }, + images: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) { + const n = ["one", "two"]; + t.forEach((l) => { + if (typeof l.src != "string") + throw '"src" property is required.'; + if (typeof l.from != "string" || l.from.length == 0) + throw '"from" property is required.'; + if (l.to && !st(l.to)) + throw 'value of "to" is not valid.'; + if (l.from && !st(l.from)) + throw 'value of "from" is not valid.'; + if (n.indexOf(l.type) < 0) + throw 'Type of "type" is not valid in the "images" property.'; + if (l.type == "two" && !l.to) + throw '"to" property is empty. for "two" type "to" property is required.'; + }); + } + return !0; + } + }, + formula: { + mode: "TYPE_CHECK", + type: "object" + }, + pageOption: { + mode: "TYPE_CHECK", + type: "object" + }, + name: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + title: { + mode: "TYPE_CHECK", + type: "object" + }, + shiftTop: { + mode: "TYPE_CHECK", + type: "number", + min: 0 + }, + shiftLeft: { + mode: "TYPE_CHECK", + type: "number" + }, + selected: { + mode: "TYPE_CHECK", + type: "boolean" + }, + tabColor: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + merges: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) { + let n = []; + if (t.forEach((l) => { + it(l) || n.push( + "The " + l + ' reference is not valid in the "merges" property.' + ); + }), n.length > 0) + throw n; + } + return !0; + } + }, + headerStyleKey: { + mode: "TYPE_CHECK", + type: "string", + notEmpty: !0 + }, + mergeRowDataCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + styleCellCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + commentCondition: { + mode: "TYPE_CHECK", + type: "function" + }, + sortAndFilter: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + if (typeof t == "object") { + const n = ["all", "ref"]; + if (!t.mode) + throw '"mode" is required in sortAndFilter'; + if (n.indexOf(t.mode) < 0) + throw '"mode" is not valid'; + if (t.mode == "ref") + if (t.ref) { + if (!it(t.ref)) + throw '"ref" is not valid'; + } else + throw '"ref" is must need be defined.'; + } + return !0; + } + }, + state: { + mode: "TYPE_CHECK", + type: "string", + isEnum: !0, + enum: ["hidden", "visible"] + }, + headerRowOption: { + mode: "TYPE_CHECK", + type: "object" + // Adjust according to the expected type for headerRowOption + }, + protectionOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = [ + "sheet", + "formatCells", + "formatColumns", + "formatRows", + "insertColumns", + "insertRows", + "insertHyperlinks", + "deleteColumns", + "deleteRows", + "sort", + "autoFilter", + "pivotTables" + ], l = ["0", "1", 0, 1]; + return Object.keys(t).forEach((u) => { + const m = t[u]; + if (n.indexOf(u) < 0) + throw '"' + u + '" is not valid.'; + if (l.indexOf(m) < 0) + throw 'value of "' + u + '" is not valid'; + }), !0; + } + }, + headerHeight: { + mode: "TYPE_CHECK", + type: "number", + min: 1 + }, + checkbox: { + mode: "TYPE_CHECK", + isArray: !0, + type: "object", + validateFunction(e, t, r, o) { + if (Array.isArray(t)) + t.forEach((n) => { + if (!n.col || !n.row) + throw '"checkbox" is not complete'; + }); + else + throw 'Type of "checkbox" property is not valid'; + return !0; + } + }, + viewOption: { + mode: "TYPE_CHECK", + type: "object", + validateFunction(e, t, r, o) { + const n = ["pageLayout", "pageBreakPreview"]; + if (t.type && n.indexOf(t.type) < 0) + throw 'Type of "type" property is not valid'; + return !0; + } + }, + rtl: { + mode: "TYPE_CHECK", + type: "boolean" + }, + pageBreak: { + mode: "TYPE_CHECK", + type: "object", + isArray: !0 + }, + asTable: { + mode: "TYPE_CHECK", + type: "object" + } +}; +function Bt(e, t = !0, r = !0) { + Object.keys(e).forEach((n) => { + const l = e[n], g = Object.keys(l); + if (l.format && !Lt[l.format]) + throw 'The "' + l.format + '" format that has been used is not defined.'; + l.underline && l.doubleUnderline, g.forEach((u) => { + let m = l[u]; + const s = lo[u]; + if (Me(m, s, u, t, r)) + return !0; + }); + }); +} +function $t(e, t = !0, r = !0) { + Array.isArray(e) || (e = [e]), e.forEach((o) => { + Object.keys(o).forEach((l) => { + const g = o[l], u = io[l]; + Me(g, u, l, t, r); + }); + }); +} +function so(e, t = !0, r = !0) { + Object.keys(e).forEach((n) => { + let l = e[n]; + const g = ao[n]; + if (Me(l, g, n, t, r)) + if (n == "sheet") + if (Array.isArray(l)) + $t(l); + else + throw "Sheet must be Array."; + else n == "styles" && Bt(l); + }); +} +function Me(e, t, r, o, n) { + if (t) { + if (typeof e != t.type) { + if (t.type == "object" || t.type == "string" || o) + throw 'The Type of The "' + r + '" is not valid'; + n && console.warn("The property type must be " + t.type); + } + if (t.isEnum && t.enum.indexOf(e) < 0) + throw 'The value of "' + r + '" must be ' + JSON.stringify(t.enum); + if (t.min && e < t.min) + throw 'The value of "' + r + '" must be higher than ' + t.min; + if (t.notEmpty && (!e || e.length <= 0)) + throw 'The value of "' + r + '" must not be empty.'; + if (t.isArray && !Array.isArray(e)) + throw 'The value of "' + r + '" should be an array.'; + return typeof t.validateFunction == "function" && t.validateFunction(r, e, o, n), !0; + } else + return n && console.warn( + 'The Schema Object does not include the "' + r + '" property.' + ), !1; +} +const co = { + checkSheetValidWithOneRef: st, + checkSheetValidWithTwoRef: it, + generalValidationCheck: Me +}, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + exportedForTesting: co, + validateExcelTableObjectFunction: so, + validateSheetArrayFunction: $t, + validateStyleObjectFunction: Bt +}, Symbol.toStringTag, { value: "Module" })); +function It(e) { + if (typeof e > "u" || e == null) + return ""; + typeof e != "string" && (e = String(e)); + let t = e, r = !1; + return e.indexOf('"') >= 0 && (t = t.replace(/"/g, '""'), r = !0), e.indexOf(",") >= 0 && (r = !0), r && (t = '"' + t + '"'), t; +} +function fo(e) { + return e ? " " : ","; +} +function Pt(e, t) { + return e.substring(0, e.length - t) + ` +`; +} +async function Kt(e, t = !1, r = !1) { + const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; + let g = []; + if (e.sheet.forEach((m) => { + let s = "", f = ""; + const v = m.headers; + let D = [], j = v.length; + for (let S = 0; S < j; S++) { + const d = v[S]; + D.push(d.label), m.withoutHeader || (f += It(d.text) + o); + } + s += Pt(f, l), j = m.data.length; + for (let S = 0; S < j; S++) { + f = ""; + const d = m.data[S]; + D.forEach((G) => { + f += It(d[G]) + o; + }), s += Pt(f, l); + } + g.push(s); + }), e.backend) + return g; + const u = await import("./FileSaver.min-BEH1o5YI.js").then((m) => m.F).then((m) => m.saveAs); + if (t) { + const m = await import("./jszip.min-D-TEDr9v.js").then((v) => v.j).then((v) => v.default); + let s = new m(); + g.forEach((v, D) => { + s.file("sheet" + (D + 1) + n, v); + }); + const f = await s.generateAsync({ type: "blob" }).then(function(v) { + return v; + }); + return u( + f, + (e.fileName ? e.fileName : "tableRecord") + ".zip" + ), "done"; + } + g.forEach((m) => { + var s = new Blob([m], { + type: "text/" + (r ? "plain" : "csv") + ";charset=utf-8" + }); + u( + s, + (e.fileName ? e.fileName : "tableRecord") + n + ); + }); +} +const jt = { + firstHeader: !0, + returnTableNodes: !1, + emptyNodeDefaultString: " ", + removeContainerChildNode: !0, + containerNodeStyle: { + display: "flex", + flexDirection: "column" + }, + tableStyle: { + borderSpacing: "0", + border: "1px solid #EEEEEEF1" + }, + cellStyle: { + width: "68px", + height: "24px", + border: "1px solid #EEEEEEF1" + }, + buttonContainerStyle: { + display: "flex" + }, + buttonStyle: { + height: "40px", + width: "80px", + display: "flex", + justifyContent: "center", + alignItems: "center", + border: "0", + background: "transparent", + cursor: "pointer" + }, + activeButtonStyle: { + background: "#EEEDEB" + } +}; +async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { + display: "flex", + flexDirection: "column" +}, s = { + borderSpacing: "0", + border: "1px solid #EEEEEEF1" +}, f = { + width: "68px", + height: "24px", + border: "1px solid #EEEEEEF1" +}, v = { + display: "flex" +}, D = { + height: "40px", + width: "80px", + display: "flex", + justifyContent: "center", + alignItems: "center", + border: "0", + background: "transparent", + cursor: "pointer" +}, j = { + background: "#EEEDEB" +}) { + let S = await import("./read-utils-YAGe6NNW.js").then( + async (E) => await E.extractExcelData(e, !1, o) + ), d = null; + if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) + throw "Container Node not found"; + const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); + let B = document.createElement("div"); + N.forEach((E) => { + B.style[E] = v[E]; + }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { + d.style[E] = m[E]; + }), d.appendChild(B)); + let X = [], K = !1, L = 0; + do { + L++; + const E = S.sheetName.next(); + if (!E.value) + break; + const $ = document.createElement("div"); + if ($.style.display = "none", !l) { + const J = document.createElement("button"); + oe.forEach((ye) => { + J.style[ye] = D[ye]; + }), J.addEventListener("click", (ye) => { + const ve = J.getAttribute("data-sheet"), we = d.querySelector( + 'div[data-sheet="' + ve + '"]' + ); + if (we) { + P.forEach((ie) => { + J.style[ie] = j[ie]; + }); + const Se = d.querySelector( + "[data-sheet-button-activate]" + ); + let ae = d.querySelector("[data-sheet-activate]"); + we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { + Se.style[ie] = D[ie]; + }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); + } else + console.error("Sheet content not found!! id is " + ve); + }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); + } + let q = n ? "th" : "td"; + const U = document.createElement("table"); + z.forEach((J) => { + U.style[J] = s[J]; + }); + const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; + if (Array.isArray(M)) { + const J = M.length; + for (let ye = 0; ye < J; ye++) { + const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); + for (let ae = 0; ae <= Ce; ae++) { + let ie = g; + if (Se) { + const de = ve[ae]; + typeof de == "string" && (ie = de); + } + const ge = document.createElement(q); + Z.forEach((de) => { + ge.style[de] = f[de]; + }), ge.innerText = ie, we.appendChild(ge); + } + U.appendChild(we), q = "td"; + } + } + l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; + } while (!K); + if (l) + return X; + { + const E = d.querySelector( + 'div[data-sheet="1"]' + ); + E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); + const $ = d.querySelector( + 'button[data-sheet="1"]' + ); + return $ && (P.forEach((q) => { + $.style[q] = j[q]; + }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; + } +} +async function uo(e, t, r = !0, o = "property") { + let n = await import("./read-utils-YAGe6NNW.js").then( + async (u) => await u.extractExcelData(e, !1, t) + ), l = {}, g = []; + return Object.keys(n.sheetNameObject).forEach((u) => { + const m = n.sheetNameObject[u], s = n.data[m] || n.data[u], f = n.maxLengthOfColumn[m] || n.maxLengthOfColumn[u]; + for (let j = 0; j <= f; j++) + g[j] = o + (j + 1); + let v = r, D = []; + s.forEach((j) => { + let S = {}; + j.forEach((d, G) => { + typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); + }), v = !1, D.push(S); + }), l = Object.assign(l, { + [m]: D + }); + }), l; +} +const yo = Ht, go = to; +function xo(e, t, r = {}) { + const o = Wt( + e, + t, + r.keepStyle, + r.rowHeightScaleFunction, + r.colWidthScaleFunction + ); + return ct(o); +} +function bo(e) { + const t = no(e); + return ct(t); +} +function Co(e, t) { + return ct(zt(e, t)); +} +function vo(e, t = !1, r) { + return import("./read-utils-YAGe6NNW.js").then( + (o) => o.extractExcelData(e, t, r) + ); +} +function wo(e, t = !1) { + return Kt(e, t, !1); +} +function To(e, t = !1) { + return Kt(e, t, !0); +} +function Eo(e, t, r, o = { ...jt }) { + return o = { + ...jt, + ...o + }, mo( + e, + t, + r, + o.fetchFunc, + o.firstHeader, + o.returnTableNodes, + o.emptyNodeDefaultString, + o.removeContainerChildNode, + o.containerNodeStyle, + o.tableStyle, + o.cellStyle, + o.buttonContainerStyle, + o.buttonStyle, + o.activeButtonStyle + ); +} +export { + yo as a, + go as b, + Qt as c, + xo as d, + vo as e, + wo as f, + Re as g, + To as h, + Eo as i, + ct as j, + uo as k, + po as r, + bo as s, + Co as t, + ho as v +}; diff --git a/dist/read-utils-CwMyWpVb.js b/dist/read-utils-CwMyWpVb.js new file mode 100644 index 0000000..c47491c --- /dev/null +++ b/dist/read-utils-CwMyWpVb.js @@ -0,0 +1 @@ +System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); diff --git a/dist/read-utils-D8LB9Gmq.cjs b/dist/read-utils-D8LB9Gmq.cjs new file mode 100644 index 0000000..c55b446 --- /dev/null +++ b/dist/read-utils-D8LB9Gmq.cjs @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; diff --git a/dist/read-utils-DODcKE84.js b/dist/read-utils-DODcKE84.js new file mode 100644 index 0000000..26ca0f0 --- /dev/null +++ b/dist/read-utils-DODcKE84.js @@ -0,0 +1 @@ +define(["require","exports","./index-BYjrfbvd"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/read-utils-YAGe6NNW.js b/dist/read-utils-YAGe6NNW.js new file mode 100644 index 0000000..d715a4b --- /dev/null +++ b/dist/read-utils-YAGe6NNW.js @@ -0,0 +1,110 @@ +import { g as R, c as T } from "./index-DMAk0ysA.js"; +function B(s) { + return /t="s".*?(.*?)<\/t>/, r = s.match(a); + return r ? r[1] : null; +} +function $(s) { + const a = /(.*?)<\/v>/, r = s.match(a); + return r ? r[1] : null; +} +function j(s) { + const a = /r="(.*?)"/, r = s.match(a); + return r ? r[1] : null; +} +async function P(s, a = !1, r) { + let N, O = !1; + typeof r == "function" ? (N = r, O = !0) : N = fetch; + let x = [], y = /* @__PURE__ */ new Map(), b = {}, A = [], C = {}, k = {}, E = !1; + function V(t, I) { + let g = 0, u = [], m = I.match(//g); + if (Array.isArray(m) && m.forEach((n) => { + let f = $(n); + B(n) && f && (f = A[parseInt(f)]); + const p = j(n); + let i = R(p, T); + typeof u[i.row] > "u" && (u[i.row] = []), u[i.row][i.col] = f, g = Math.max(i.col, g); + }), t.indexOf("xl/worksheets/sheet") == 0) { + let n = t.substring(14, t.lastIndexOf(".")); + y.has(n) && (n = y.get(n)), C[n] = u, k[n] = g; + } + } + return await N(s).then((t) => { + if (t == null || t == null) + throw "response is null"; + return O ? t : a ? t.arrayBuffer() : t.blob(); + }).then(async (t) => { + const g = (await import("./jszip.min-D-TEDr9v.js").then((m) => m.j)).default; + let u = 0; + return await new Promise((m, n) => { + g.loadAsync(t).then(function(f) { + const p = Object.keys(f.files); + u = p.length; + let i = new Proxy( + { + counter: 0, + isNameSet: !1 + }, + { + set(e, o, c) { + if (o === "isNameSet") + return e.isNameSet = c, !0; + if (typeof c != "number") + throw "value most be number"; + return e.counter = c, e.isNameSet && e.counter === u && m({ + data: C, + sheetNameObject: b, + sheetName: y.entries(), + maxLengthOfColumn: k + }), !0; + }, + get(e, o, c) { + return o === "isNameSet" ? e.isNameSet : e.counter; + } + } + ); + p.forEach(function(e) { + f.files[e].async("string").then(function(o) { + if (e.indexOf("sharedStrings") >= 0) { + let c = o.match(//g); + Array.isArray(c) && c.forEach((S) => { + let h = S.match(//g); + if (Array.isArray(h)) { + let w = h.reduce((l, d) => l + M(d), ""); + A.push(w); + } + }), E = !0, x.length > 0 && (x.forEach((S) => { + V(S.filename, S.fileData); + }), x = []); + } + e.indexOf("sheet") >= 0 && (E ? V(e, o) : x.push({ + filename: e, + fileData: o + })), e.indexOf("workbook") >= 0 && (o.replace( + /(.*[\n\s\S]*)()(.*[\n\s\S]*)/, + "$2" + ).split(" { + let l = w + 1, d = "Sheet " + l; + h.indexOf("name=") >= 0 && (d = h.replace( + /(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/, + "$2" + )), h.indexOf("sheetId=") > 0 && (l = Number( + h.replace( + /(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/, + "$2" + ) + ), isNaN(l) && (l = w + 1)), y.set("sheet" + l, d), b["sheet" + l] = d; + }), i.isNameSet = !0), i.counter++; + }); + }); + }); + }); + }).catch((t) => { + throw t; + }); +} +export { + P as extractExcelData +}; diff --git a/src/data-model/const-data.ts b/src/data-model/const-data.ts index 7638260..ac2e540 100644 --- a/src/data-model/const-data.ts +++ b/src/data-model/const-data.ts @@ -1,63 +1,34 @@ import { type FormatMap } from "./excel-table"; export const formatMap: FormatMap = { - time: { - key: 165, - value: '', - }, - date: { - key: 187, - value: - '', - }, - short_date: { - key: 14, - }, - fraction: { - key: 13, - }, percentage: { key: 9, }, - float_1: { key: 180, value: '' }, - float_2: { key: 181, value: '' }, - float_3: { - key: 164, - value: '', - }, - float_4: { - key: 182, - value: '', - }, - dollar_rounded: { - key: 183, - value: '', - }, - dollar_2: { - key: 183, - value: '', + fraction: { + key: 13, }, - num_sep: { - key: 184, - value: '', + short_date: { + key: 14, }, - num_sep_1: { - key: 185, - value: '', + yen: { + key: 160, + value: + '', }, - num_sep_2: { - key: 186, - value: '', + "Β₯": { + key: 160, + value: + '', }, - dollar: { - key: 163, + euro: { + key: 161, value: - '', + '', }, - $: { - key: 163, + "€": { + key: 161, value: - '', + '', }, pound: { key: 162, @@ -69,45 +40,48 @@ export const formatMap: FormatMap = { value: '', }, - euro: { - key: 161, + dollar: { + key: 163, value: - '', + '', }, - "€": { - key: 161, + "$": { + key: 163, value: - '', + '', }, - yen: { - key: 160, - value: - '', + float_3: { + key: 164, + value: '', }, - "Β₯": { - key: 160, + time: { + key: 165, + value: '', + }, + "Ψ±ΩŠΨ§Ω„": { + key: 171, value: - '', + '', }, - CHF: { - key: 179, + "β‚½3": { + key: 172, value: - '', + '', }, - ruble: { - key: 178, + "β‚½2": { + key: 173, value: - '', + '', }, - "β‚½": { - key: 178, + "β‚½1": { + key: 174, value: - '', + '', }, - "֏": { - key: 177, + "β‚Ό1": { + key: 175, value: - '', + '', }, manat: { key: 176, @@ -119,30 +93,56 @@ export const formatMap: FormatMap = { value: '', }, - "β‚Ό1": { - key: 175, + "֏": { + key: 177, value: - '', + '', }, - "β‚½1": { - key: 174, + ruble: { + key: 178, value: - '', + '', }, - "β‚½2": { - key: 173, + "β‚½": { + key: 178, value: - '', + '', }, - "β‚½3": { - key: 172, + CHF: { + key: 179, value: - '', + '', }, - "Ψ±ΩŠΨ§Ω„": { - key: 171, + float_1: { key: 180, value: '' }, + float_2: { key: 181, value: '' }, + float_4: { + key: 182, + value: '', + }, + dollar_2: { + key: 183, + value: '', + }, + num_sep: { + key: 184, + value: '', + }, + num_sep_1: { + key: 185, + value: '', + }, + num_sep_2: { + key: 186, + value: '', + }, + date: { + key: 187, value: - '', + '', + }, + dollar_rounded: { + key: 188, + value: '', }, }; From 44a6146d944cbee40ebf61986f875e7cf91df026 Mon Sep 17 00:00:00 2001 From: "m.r" Date: Thu, 13 Mar 2025 01:44:05 -0800 Subject: [PATCH 6/7] V7.0.1 --- CHANGELOG.md | 7 + README.md | 7 + change-log | 19 +- dist/excel-table.amd.js | 2 +- dist/excel-table.cjs | 2 +- dist/excel-table.d.ts | 1137 ++++++++ dist/excel-table.iife.js | 54 + dist/excel-table.js | 16 + dist/excel-table.system.js | 1 + dist/excel-table.umd.cjs | 55 + dist/{index-B8PpTQiZ.js => index-BBP-cHpJ.js} | 4 +- dist/index-BPuSW_h3.js | 44 - dist/index-BYjrfbvd.js | 44 - ...{index-DkpykvyS.cjs => index-CNq3yjRY.cjs} | 4 +- dist/index-CzrjgJVS.cjs | 44 - dist/{index-p1xk7Sgq.js => index-D07Il0Qz.js} | 168 +- dist/{index-DfuHK51s.js => index-D3jbCDy2.js} | 4 +- dist/index-DMAk0ysA.js | 2479 ----------------- ...ils-Byj29Erp.js => read-utils-CMxu90Z7.js} | 2 +- ...ils-DnAqiCj7.js => read-utils-CU7cU67B.js} | 2 +- ...s-BEg2qKSg.cjs => read-utils-CWXTa8vm.cjs} | 2 +- dist/read-utils-CwMyWpVb.js | 1 - dist/read-utils-D8LB9Gmq.cjs | 1 - dist/read-utils-DXQsy33k.js | 1 - dist/read-utils-YAGe6NNW.js | 110 - ...ils-DODcKE84.js => read-utils-pmXAaVV2.js} | 2 +- package-lock.json | 240 +- package.json | 2 +- 28 files changed, 1418 insertions(+), 3036 deletions(-) rename dist/{index-B8PpTQiZ.js => index-BBP-cHpJ.js} (95%) delete mode 100644 dist/index-BPuSW_h3.js delete mode 100644 dist/index-BYjrfbvd.js rename dist/{index-DkpykvyS.cjs => index-CNq3yjRY.cjs} (95%) delete mode 100644 dist/index-CzrjgJVS.cjs rename dist/{index-p1xk7Sgq.js => index-D07Il0Qz.js} (99%) rename dist/{index-DfuHK51s.js => index-D3jbCDy2.js} (95%) delete mode 100644 dist/index-DMAk0ysA.js rename dist/{read-utils-Byj29Erp.js => read-utils-CMxu90Z7.js} (97%) rename dist/{read-utils-DnAqiCj7.js => read-utils-CU7cU67B.js} (98%) rename dist/{read-utils-BEg2qKSg.cjs => read-utils-CWXTa8vm.cjs} (97%) delete mode 100644 dist/read-utils-CwMyWpVb.js delete mode 100644 dist/read-utils-D8LB9Gmq.cjs delete mode 100644 dist/read-utils-DXQsy33k.js delete mode 100644 dist/read-utils-YAGe6NNW.js rename dist/{read-utils-DODcKE84.js => read-utils-pmXAaVV2.js} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c45dee..5e2f3ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Version 7.0.1 (2025-03-13) + +### Bug Fixes + +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio FernΓ‘ndez](https://github.com/xergiodf)) +- Data range error. + ## Version 7.0.0 (2025-02-16) ### New Features diff --git a/README.md b/README.md index 87942c0..5ac54d7 100644 --- a/README.md +++ b/README.md @@ -7289,6 +7289,13 @@ To migrate from Version 2 to Version 3, you need to follow the steps below: ## Release Notes [⬆️](#table-of-contents) +### Version 7.0.1 (2025-03-13) + +#### Bug Fixes + +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio FernΓ‘ndez](https://github.com/xergiodf)) +- Data range error. + ### Version 7.0.0 (2025-02-16) #### New Features diff --git a/change-log b/change-log index 434d0f7..fd40355 100644 --- a/change-log +++ b/change-log @@ -1,19 +1,6 @@ -## Version 7.0.0 (2025-02-16) - -### New Features - -- A drop-down option (multi-select option) provides the ability to create a cell that contains multiple selectable values.`sheet`->`[n]`->`dropDowns` -- The `replaceInExcel` functionality in Excel allows you to replace data in an existing file using flags provided within the spreadsheet. +## Version 7.0.1 (2025-03-13) ### Bug Fixes -- `generateExcel` supports empty objects and will generate an empty Excel file. - -> [!NOTE] -> The related interface has not changed, so the sheet needs to be provided in TypeScript. - -### Improvements - -- Begin adding JSDoc comments to the main functions and interfaces. - - +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio FernΓ‘ndez](https://github.com/xergiodf)) +- Data range error. diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index 2fe50bc..7b26b50 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-DfuHK51s"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); \ No newline at end of file +define(["exports","./index-D3jbCDy2"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index 05053db..9474d68 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DkpykvyS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; \ No newline at end of file +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CNq3yjRY.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index e69de29..d2ad689 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -0,0 +1,1137 @@ +export declare const addGlobalOptionFromExcelTable: typeof addGlobalOptionFromExcelTable_2; + +/** + * Adds global options from an Excel table. + * @param {string} key - The key for the global option. + * @param {ExcelTable} data - The Excel table data. + */ +declare function addGlobalOptionFromExcelTable_2(key: string, data: ExcelTable): void; + +export declare const addGlobalOptions: typeof addGlobalOptions_2; + +/** + * Adds global options to the proxy. + * @param {string} key - The key for the global option. + * @param {string} path - The path for the global option. + * @param {any} data - The data for the global option. + */ +declare function addGlobalOptions_2(key: string, path: string, data: any): void; + +/** + * Horizontal alignment options. + * @typedef {"center" | "left" | "right"} AlignmentHorizontal + */ +declare type AlignmentHorizontal = "center" | "left" | "right"; + +/** + * Options for configuring alignment. + * @interface + */ +declare interface AlignmentOption { + horizontal?: AlignmentHorizontal; + vertical?: AlignmentVertical; + wrapText?: "0" | "1" | 0 | 1; + shrinkToFit?: "0" | "1" | 0 | 1; + readingOrder?: "1" | "2" | 2 | 1; + textRotation?: number; + indent?: number; + rtl?: boolean; + ltr?: boolean; +} + +/** + * Keys for alignment options. + * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey + */ +declare type AlignmentOptionKey = "horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"; + +/** + * Vertical alignment options. + * @typedef {"center" | "top" | "bottom"} AlignmentVertical + */ +declare type AlignmentVertical = "center" | "top" | "bottom"; + +/** + * Options for displaying the sheet as a table. + * @interface + */ +declare interface AsTableOption { + /** The type of table style. */ + type?: "Light" | "Medium" | "Dark"; + /** The style number of the table. */ + styleNumber?: number; + /** Indicates if the first column should be styled. */ + firstColumn?: boolean; + /** Indicates if the last column should be styled. */ + lastColumn?: boolean; + /** Indicates if row stripes should be applied. */ + rowStripes?: boolean; + /** Indicates if column stripes should be applied. */ + columnStripes?: boolean; +} + +/** + * Directions for border options. + * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection + */ +declare type BorderDirection = "full" | "top" | "left" | "right" | "bottom"; + +/** + * Options for configuring borders. + * @interface + */ +declare type BorderOption = { + [key in BorderDirection]?: { + color: string; + style: "slantDashDot" | "dotted" | "thick" | "hair" | "dashDot" | "dashDotDot" | "dashed" | "thin" | "mediumDashDot" | "medium" | "double" | "mediumDashed"; + }; +}; + +/** + * Represents a buffer. + * @class + * @extends {Uint8Array} + */ +declare class Buffer_2 extends Uint8Array { + constructor(str: string, encoding?: string); + constructor(size: number); + constructor(array: Uint8Array); + constructor(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number); + static alloc(size: number, fill?: string | Buffer_2 | number, encoding?: string): Buffer_2; + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer_2; + static from(data: number[]): Buffer_2; + static from(str: string, encoding?: string): Buffer_2; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + slice(start?: number, end?: number): Buffer_2; + static concat(list: Buffer_2[], totalLength?: number): Buffer_2; + length: number; + byteOffset: number; +} + +/** + * Represents a checkbox in the sheet. + * @interface + */ +declare interface Checkbox { + col: number; + row: number; + text: string; + link?: string; + checked?: boolean; + mixed?: boolean; + threeD?: boolean; + startStr?: string; + endStr?: string; +} + +declare function checkSheetValidWithOneRef(ref: string): boolean; + +declare function checkSheetValidWithTwoRef(ref: string): boolean; + +declare type ColWidthScaleFunction = (data: number, colIndex: number) => number; + +/** + * Represents a comment in the sheet. + * @interface + */ +declare interface Comment_2 { + comment?: string; + styleId?: string; + author?: string; +} + +/** + * Function type for comment condition. + * @callback CommentConditionFunction@callback CommentConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {Comment | string | false | undefined | null} The comment or null. + */ +declare type CommentConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => Comment_2 | string | false | undefined | null; + +/** + * Represents conditional formatting in the sheet. + * @interface + * @extends {ConditionalFormattingOption} + */ +declare interface ConditionalFormatting extends ConditionalFormattingOption { + /** The start cell for the conditional formatting. */ + start: string; + /** The end cell for the conditional formatting. */ + end: string; +} + +/** + * Operations for conditional formatting cells. + * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation + */ +declare type ConditionalFormattingCellsOperation = "lt" | "gt" | "between" | "eq" | "ct"; + +/** + * Operations for conditional formatting icon sets. + * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation + */ +declare type ConditionalFormattingIconSetOperation = "3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"; + +/** + * Options for conditional formatting. + * @interface + */ +declare interface ConditionalFormattingOption { + /** The type of conditional formatting. */ + type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top"; + /** The operator for the conditional formatting. */ + operator?: string | ConditionalFormattingCellsOperation | ConditionalFormattingIconSetOperation | ConditionalFormattingTopOperation; + /** The value for the conditional formatting. */ + value?: number | string; + /** The priority of the conditional formatting. */ + priority?: number; + /** The colors for the conditional formatting. */ + colors?: string[]; + /** Indicates if the conditional formatting is for the bottom values. */ + bottom?: boolean; + /** The style ID for the conditional formatting. */ + styleId?: string; + /** The percentage for the conditional formatting. */ + percent?: number; +} + +/** + * Operations for conditional formatting top values. + * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation + */ +declare type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage"; + +/** + * Converts an HTML table to an Excel file. + * @param {string} [queryForTable] - The query selector for the table. + * @param {HTMLTableElement} [table] - The HTML table element. + * @param {Object} [config] - The configuration options. + * @param {boolean} [config.keepStyle] - Whether to keep the style. + * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. + * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. + * @returns {Promise} The generated Excel table. + */ +export declare function convertTableToExcel(queryForTable?: string, table?: HTMLTableElement, config?: { + keepStyle?: boolean; + rowHeightScaleFunction?: RowHeightScaleFunction; + colWidthScaleFunction?: ColWidthScaleFunction; +}): Promise; + +/** + * Represents a custom formula setting. + * @interface + */ +declare interface CustomFormulaSetting { + isArray?: boolean; + referenceCells?: string; + formula: string; + returnType?: string; + styleId?: string; +} + +/** + * Represents data in the sheet. + * @interface + * @extends {DataOptions} + */ +declare interface Data extends DataOptions { + [key: string]: string | number | any | undefined; +} + +declare namespace DataModel { + export { + ExcelTable, + ExcelTableOption, + Sheet, + SheetOption, + AsTableOption, + PageBreak, + ViewStart, + ViewOption, + HeaderFooterOption, + HeaderFooterLocationMap, + HeaderFooterTypes, + PageOption, + Header, + HeaderOption, + StyleType, + StyleBody, + Styles, + Data, + DataOptions, + DropDown, + RowMap, + ProtectionOption, + ProtectionOptionKey, + ConditionalFormattingCellsOperation, + ConditionalFormattingIconSetOperation, + ConditionalFormattingTopOperation, + ConditionalFormattingOption, + ConditionalFormatting, + ImageTypes, + SideBySide, + AlignmentOptionKey, + AlignmentHorizontal, + AlignmentVertical, + AlignmentOption, + BorderDirection, + BorderOption, + MapMultiStyleValue, + MultiStyleValue, + MultiStyleRexValue, + Comment_2 as Comment, + MergeRowConditionMap, + MultiStyleConditionFunction, + CommentConditionFunction, + StyleCellConditionFunction, + MergeRowDataConditionFunction, + SortAndFilter, + Title, + HeaderRowOption, + Checkbox, + NoArgFormulaType, + FormulaType, + SingleRefFormulaType, + FormatMap, + Formula, + FormulaSetting, + CustomFormulaSetting, + SingleRefFormulaSetting, + NoArgFormulaSetting, + StyleMapper, + MapComment, + ThemeOption, + ExtractedData, + ExtractResult, + ReadResult, + Buffer_2 as Buffer, + ReplacerOption, + ExcelToNodeConfig + } +} +export { DataModel } + +/** + * Options for configuring data in the sheet. + * @interface + */ +declare interface DataOptions { + [key: string]: "0" | "1" | number | string | undefined | MapComment + /** Array of multi-style values for the data. */ + | MapMultiStyleValue; + outlineLevel?: number; + hidden?: "0" | "1" | number; + rowStyle?: string; + height?: number; + multiStyleValue?: MapMultiStyleValue; + comment?: MapComment; +} + +/** + * Represents a dropdown in the sheet. + * @interface + */ +declare interface DropDown { + /** Array of options for the dropdown. */ + option: (string | number)[]; + /** Array of columns the dropdown applies to. */ + for: string[]; +} + +/** + * Represents an Excel table with options and sheets. + * @interface + * @extends {ExcelTableOption} + */ +declare interface ExcelTable extends ExcelTableOption { + /** Array of sheets in the Excel table. */ + sheet: Sheet[]; +} + +/** + * Options for configuring an Excel table. + * @interface + */ +declare interface ExcelTableOption { + /** Indicates if the Excel should not be saved. */ + notSave?: boolean; + /** The creator of the Excel. */ + creator?: string; + /** Indicates if the backend is used. */ + backend?: boolean; + /** Activates conditional formatting. */ + activateConditionalFormatting?: boolean; + /** Function to fetch data. */ + fetch?: Function; + /** The file name of the Excel. */ + fileName?: string; + /** The type of generated file. */ + generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; + /** Adds default title style. */ + addDefaultTitleStyle?: boolean; + /** The creation date of the Excel. */ + created?: string; + /** The modification date of the Excel. */ + modified?: string; + /** The number of columns in the Excel. */ + numberOfColumn?: number; + /** The type of creation. */ + createType?: string; + /** Styles applied to the Excel. */ + styles?: Styles; + /** Format map for the Excel. */ + formatMap?: FormatMap; +} + +export declare function excelToJson(uri: string, fetchFunc?: Function, withHeader?: boolean, defaultPropertyPrefix?: string): Promise>; + +/** + * Converts an Excel file to a Node. + * @param {string} uri - The URI of the Excel file. + * @param {string | null} [queryForTable] - The query selector for the table. + * @param {HTMLDivElement | null} [containerElement] - The container element. + * @param {ExcelToNodeConfig} [config=defaultConfig] - The configuration options. + * @returns {Promise} The result of the conversion. + */ +export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; + +/** + * Represents configuration options for Excel to Node. + * @interface + */ +declare interface ExcelToNodeConfig { + fetchFunc?: Function; + firstHeader?: boolean; + returnTableNodes?: boolean; + emptyNodeDefaultString?: string; + removeContainerChildNode?: boolean; + containerNodeStyle?: object; + tableStyle?: object; + cellStyle?: object; + buttonContainerStyle?: object; + buttonStyle?: object; + activeButtonStyle?: object; +} + +declare const exportedForTesting: { + checkSheetValidWithOneRef: typeof checkSheetValidWithOneRef; + checkSheetValidWithTwoRef: typeof checkSheetValidWithTwoRef; + generalValidationCheck: typeof generalValidationCheck; +}; + +/** + * Represents extracted data. + * @typedef {(string | null | undefined)[][]} ExtractedData + */ +declare type ExtractedData = (string | null | undefined)[][]; + +/** + * Extracts data from an Excel file. + * @param {string} uri - The URI of the Excel file. + * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. + * @param {Function} [fetchFunc] - The function to fetch data. + * @returns {Promise} The extracted data. + */ +export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; + +/** + * Represents the result of data extraction. + * @interface + */ +declare interface ExtractResult { + [sheetName: string]: ExtractedData; +} + +/** + * Represents a format map. + * @interface + */ +declare interface FormatMap { + [format: string]: { + key: number; + value?: string; + }; +} + +/** + * Represents a formula in the sheet. + * @interface + */ +declare interface Formula { + [insertCell: string]: FormulaSetting | SingleRefFormulaSetting | NoArgFormulaSetting | CustomFormulaSetting; +} + +/** + * Represents a formula setting. + * @interface + */ +declare interface FormulaSetting { + type: FormulaType; + start: string; + end: string; + styleId?: string; +} + +/** + * Types of formulas. + * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType + */ +declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; + +declare function generalValidationCheck(value: never, validateProperty: ValidationObject, property: string, strict: boolean, warn: boolean): boolean; + +/** + * Generates a CSV file from an Excel table Object. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. + * @returns {Promise} The generated CSV file. + */ +export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): Promise; + +export declare function generateExcel(data: ExcelTable, styleKey?: string): Promise; + +/** + * Generates a text file from an Excel table Object. + * @param {ExcelTable} excelTable - The Excel table. + * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. + * @returns {Promise} The generated text file. + */ +export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; + +/** + * Represents a header in the sheet. + * @interface + * @extends {HeaderOption} + */ +declare interface Header extends HeaderOption { + /** The label of the header. */ + label: string; + /** The text of the header. */ + text: string; +} + +/** + * Location map for header and footer options.l:Left, c:Center, r:Right + * @interface + */ +declare interface HeaderFooterLocationMap { + l?: HeaderFooterOption; + c?: HeaderFooterOption; + r?: HeaderFooterOption; +} + +/** + * Options for header and footer. + * @interface + */ +declare interface HeaderFooterOption { + /** The text of the header or footer. */ + text?: string; + /** The style ID of the header or footer. */ + styleId?: string; +} + +/** + * Types of header and footer in page(odd page, even page,first page). + * @interface + */ +declare interface HeaderFooterTypes { + odd?: HeaderFooterLocationMap; + even?: HeaderFooterLocationMap; + first?: HeaderFooterLocationMap; +} + +/** + * Options for configuring a header. + * @interface + */ +declare interface HeaderOption { + /** The size(width) of the header. */ + size?: number; + /** Array of multi-style values for the header. */ + multiStyleValue?: MultiStyleValue[]; + /** Comment for the header. */ + comment?: Comment_2 | string; + /** Conditional formatting options for the header. */ + conditionalFormatting?: ConditionalFormattingOption; + /** Formula applied to the column. */ + formula?: { + /** The type of the formula. */ + type: FormulaType; + /** The style ID of the formula. */ + styleId?: string; + }; +} + +/** + * Options for the header row. + * @interface + */ +declare interface HeaderRowOption { + outlineLevel: "string"; +} + +/** + * Represents an image in the sheet. + * @interface + */ +declare interface ImageTypes { + url: string; + from: string; + to?: string; + type?: "one" | "two"; + extent?: { + cx: number; + cy: number; + }; + margin?: { + all?: number; + right?: number; + left?: number; + bottom?: number; + top?: number; + }; +} + +/** + * Represents a map of comments. + * @interface + */ +declare interface MapComment { + [key: string]: Comment_2 | string; +} + +/** + * Represents a map of multi-style values. + * @interface + */ +declare interface MapMultiStyleValue { + [key: string]: MultiStyleValue[]; +} + +/** + * Represents a map of merge row conditions. + * @interface + */ +declare interface MergeRowConditionMap { + [columnKey: string]: { + inProgress: boolean; + start: number; + }; +} + +/** + * Function type for merge row data condition. + * @callback MergeRowDataConditionFunction@callback MergeRowDataConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {string | null} key - The key. + * @param {number} index - The index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {boolean} The result of the condition. + */ +declare type MergeRowDataConditionFunction = (data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean) => boolean; + +/** + * Function type for multi-style condition. + * @callback MultiStyleConditionFunction@callback MultiStyleConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {null | Data} object - The data object. + * @param {string} headerKey - The header key. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @returns {MultiStyleValue[] | null} The multi-style values or null. + */ +declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; + +/** + * Represents a multi-style regex value. + * @interface + */ +declare interface MultiStyleRexValue { + reg: RegExp | string; + styleId: string; +} + +/** + * Represents a multi-style value. + * @interface + */ +declare interface MultiStyleValue { + value: string | number; + styleId?: string; +} + +/** + * Represents a no-argument formula setting. + * @interface + */ +declare interface NoArgFormulaSetting { + noArgType: NoArgFormulaType; + styleId?: string; +} + +/** + * Types of no-argument formulas. + * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType + */ +declare type NoArgFormulaType = "NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"; + +/** + * Options for page breaks in the sheet. + * @interface + */ +declare interface PageBreak { + /** Array of row indices where page breaks should occur. */ + row?: number[]; + /** Array of column indices where page breaks should occur. */ + column?: number[]; +} + +/** + * Options for configuring the page. + * @interface + */ +declare interface PageOption { + /** Margin settings for the page. */ + margin?: { + left?: number; + right?: number; + top?: number; + bottom?: number; + header?: number; + footer?: number; + }; + /** Header settings for the page. */ + header?: HeaderFooterTypes; + /** Footer settings for the page. */ + footer?: HeaderFooterTypes; + /** Indicates if the page is in portrait orientation. */ + isPortrait: boolean; +} + +/** + * Represents protection options for the sheet. + * @typedef {Object} ProtectionOption@typedef {Object} ProtectionOption + * @property {"0" | "1" | 0 | 1} sheet - Protect the sheet. + * @property {"0" | "1" | 0 | 1} formatCells - Allow formatting cells. + * @property {"0" | "1" | 0 | 1} formatColumns - Allow formatting columns. + * @property {"0" | "1" | 0 | 1} formatRows - Allow formatting rows. + * @property {"0" | "1" | 0 | 1} insertColumns - Allow inserting columns. + * @property {"0" | "1" | 0 | 1} insertRows - Allow inserting rows. + * @property {"0" | "1" | 0 | 1} insertHyperlinks - Allow inserting hyperlinks. + * @property {"0" | "1" | 0 | 1} deleteColumns - Allow deleting columns. + * @property {"0" | "1" | 0 | 1} deleteRows - Allow deleting rows. + * @property {"0" | "1" | 0 | 1} sort - Allow sorting. + * @property {"0" | "1" | 0 | 1} autoFilter - Allow using auto filter. + * @property {"0" | "1" | 0 | 1} pivotTables - Allow using pivot tables. + */ +declare type ProtectionOption = { + [key in ProtectionOptionKey]: "0" | "1" | 0 | 1; +}; + +/** + * Keys for protection options. + * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey + */ +declare type ProtectionOptionKey = "sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"; + +/** + * Represents the result of reading data. + * @interface + */ +declare interface ReadResult { + data: ExtractResult; + sheetNameObject: Record; + sheetName: IterableIterator<[string, string]>; + maxLengthOfColumn: Record; +} + +export declare function replaceInExcel(url: string | null | undefined, replaceData: Record, option?: ReplacerOption): Promise; + +/** + * Represents options for the replacer. + * @interface + */ +declare interface ReplacerOption { + fileName?: string; + backend?: boolean; + fetch?: Function; + data?: Blob | Buffer_2; + notSave?: boolean; + generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; +} + +declare type RowHeightScaleFunction = (data: number, rowIndex: number, fromHeader: boolean) => number; + +/** + * Represents a map of rows in the sheet. + * @interface + */ +declare interface RowMap { + [rowNumber: number]: { + startTag: string; + endTag: string; + details: string; + }; +} + +/** + * Represents a sheet in the Excel. + * @interface + * @extends {SheetOption} + */ +declare interface Sheet extends SheetOption { + /** Array of headers in the sheet. */ + headers: Header[]; + /** Array of data in the sheet. */ + data: Data[]; +} + +/** + * Options for configuring a sheet. + * @interface + */ +declare interface SheetOption { + /** Indicates if the sheet should be without a header. */ + withoutHeader?: boolean; + /** Options for configure property name that maybe provide for apply outlineLevel, hidden, height option of row*/ + mapSheetDataOption?: { + /** Outline level of the sheet data. */ + outlineLevel?: string; + /** Indicates if the sheet data is hidden. */ + hidden?: string; + /** Height of the sheet data. */ + height?: string; + }; + /** Background image of the sheet. */ + backgroundImage?: string; + /** Array of conditional formatting rules. */ + conditionalFormatting?: ConditionalFormatting[]; + /** Function for multi-style condition. */ + multiStyleCondition?: MultiStyleConditionFunction; + /** Indicates if the sheet should use split based on match. */ + useSplitBaseOnMatch?: boolean; + /** Indicates if strings should be converted to numbers Automatically. */ + convertStringToNumber?: boolean; + /** Array of images in the sheet. */ + images?: ImageTypes[]; + /** Formula applied to the sheet. */ + formula?: Formula; + /** Page options for the sheet. */ + pageOption?: PageOption; + /** Name of the sheet. */ + name?: string; + /** Title of the sheet. */ + title?: Title; + /** Shift sheet from top. */ + shiftTop?: number; + /** Shift sheet from Left. */ + shiftLeft?: number; + /** Indicates if the sheet is selected. */ + selected?: boolean; + /** Tab color of the sheet. */ + tabColor?: string; + /** Array of merge ranges in the sheet. */ + merges?: string[]; + /** Key for the header style. */ + headerStyleKey?: string; + /** Function for merge row data base on condition. */ + mergeRowDataCondition?: MergeRowDataConditionFunction; + /** Function for style cell base on condition. */ + styleCellCondition?: StyleCellConditionFunction; + /** Function for comment base on condition. */ + commentCondition?: CommentConditionFunction; + /** Sort and filter options for the sheet. */ + sortAndFilter?: SortAndFilter; + /** State of the sheet (hidden or visible). */ + state?: "hidden" | "visible"; + /** Options for the header row. */ + headerRowOption?: object; + /** Protection options for the sheet. */ + protectionOption?: ProtectionOption; + /** Height of the header. */ + headerHeight?: number; + /** Array of checkboxes in the sheet. */ + checkbox?: Checkbox[]; + /** View options for the sheet. */ + viewOption?: ViewOption; + /** Indicates if the sheet is right-to-left. */ + rtl?: boolean; + /** Page break options for the sheet. */ + pageBreak?: PageBreak; + /** Options for displaying the sheet as a table. */ + asTable?: AsTableOption; + /** Array of dropdowns in the sheet. */ + dropDowns?: DropDown[]; +} + +/** + * Represents side-by-side data in the sheet. + * @interface + */ +declare interface SideBySide { + sheetName?: string; + spaceX?: number; + spaceY?: number; + headers: { + label: string; + text: string; + }[]; + data: Data[]; + headerIndex?: number; +} + +/** + * Generates an Excel file with side-by-side data. + * @param {SideBySide[][]} data - The side-by-side data. + * @returns {Promise} The generated Excel table. + */ +export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; + +/** + * Represents a single-reference formula setting. + * @interface + */ +declare interface SingleRefFormulaSetting { + type: SingleRefFormulaType; + referenceCell: string; + value?: number | string; + styleId?: string; +} + +/** + * Types of single-reference formulas. + * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType + */ +declare type SingleRefFormulaType = "LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"; + +/** + * Represents sort and filter options. + * @interface + */ +declare interface SortAndFilter { + mode: "all" | "ref"; + ref?: string; +} + +/** + * Represents the body of a style. + * @interface + */ +declare interface StyleBody { + /** The font family of the text. */ + fontFamily?: string; + /** The type of the style.(if not define used for cells, for other type should be define) */ + type?: StyleType; + /** The size of the font. */ + size?: number; + /** The index of the style(!!it's will override by process,Don't set value for it). */ + index?: number; + /** The alignment options of the text. */ + alignment?: AlignmentOption; + /** The border options. */ + border?: BorderOption; + /** The format of the text. */ + format?: string; + /** Indicates if the style is bold. */ + bold?: boolean; + /** Indicates if the style is underlined. */ + underline?: boolean; + /** Indicates if the style is italic. */ + italic?: boolean; + /** Indicates if the style has double underline. */ + doubleUnderline?: boolean; + /** The color of the style. */ + color?: string; + /** The background color of the style. */ + backgroundColor?: string; +} + +/** + * Function type for style cell condition. + * @callback StyleCellConditionFunction@callback StyleCellConditionFunction + * @param {Header | string | number | undefined} data - The data to apply the condition to. + * @param {Header | Data} object - The data object. + * @param {number} rowIndex - The row index. + * @param {number} colIndex - The column index. + * @param {boolean} fromHeader - Indicates if the condition is from the header. + * @param {string[]} styleKeys - The style keys. + * @returns {string | null} The style key or null. + */ +declare type StyleCellConditionFunction = (data: Header | string | number | undefined, object: Header | Data, rowIndex: number, colIndex: number, fromHeader: boolean, styleKeys: string[]) => string | null; + +/** + * Represents a style mapper. + * @interface + */ +declare interface StyleMapper { + conditionalFormatting: { + count: number; + value: string; + }; + commentSyntax: { + value: { + [key: string]: string; + }; + }; + format: { + count: number; + value: string; + }; + border: { + count: number; + value: string; + }; + fill: { + count: number; + value: string; + }; + font: { + count: number; + value: string; + }; + cell: { + count: number; + value: string; + }; +} + +/** + * Represents a collection of styles. + * @interface + */ +declare interface Styles { + [key: string]: StyleBody; +} + +/** + * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). + * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType + */ +declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; + +/** + * Generates an Excel file with a theme. + * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. + * @param {ThemeOption} [option] - The theme options. + * @returns {Promise} The generated Excel table. + */ +export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; + +/** + * Represents theme options. + * @interface + */ +declare interface ThemeOption { + negativeColor?: boolean; + headerColor?: string; + rowColor?: string; + headerBackgroundColor?: string; + rowBackgroundColor?: string; + fileName?: string; + filterKeys?: string[]; +} + +/** + * Represents the title of the sheet. + * @interface + */ +declare interface Title { + shiftTop?: number; + shiftLeft?: number; + consommeRow?: number; + consommeCol?: number; + height?: number; + styleId?: string; + text?: string; + multiStyleValue?: MultiStyleValue[]; + comment?: Comment_2 | string; +} + +declare function validateExcelTableObjectFunction(data: ExcelTable, strict?: boolean, warn?: boolean): void; + +declare function validateSheetArrayFunction(sheets: Sheet[] | Sheet, strict?: boolean, warn?: boolean): void; + +declare function validateStyleObjectFunction(styles: Styles, strict?: boolean, warn?: boolean): void; + +declare interface ValidationObject { + mode: ValidationType; + type: string; + isEnum?: boolean; + enum?: string[]; + isArray?: boolean; + notEmpty?: boolean; + min?: number; + validateFunction?: (key: string, value: any, strict: boolean, warn: boolean) => boolean; +} + +declare type ValidationType = "TYPE_CHECK"; + +declare namespace Validator { + export { + validateStyleObjectFunction, + validateSheetArrayFunction, + validateExcelTableObjectFunction, + exportedForTesting + } +} +export { Validator } + +/** + * Options for configuring the view of the sheet. + * @interface + */ +declare interface ViewOption { + /** The type of view. */ + type?: "pageLayout" | "pageBreakPreview"; + /** Indicates if the grid should be hidden. */ + hideGrid?: boolean; + /** Indicates if the headlines should be hidden. */ + hideHeadlines?: boolean; + /** Indicates if the ruler should be hidden. */ + hideRuler?: boolean; + /** Options for freezing rows or columns. */ + frozenOption?: { + /** The type of freezing. */ + type: "ROW" | "COLUMN" | "BOTH" | "R" | "C" | "B"; + /** The index/position at which to freeze. */ + index: number | { + r: number; + c: number; + }; + }; + /** Options for splitting the view. */ + splitOption?: { + /** The type of split. */ + type: "VERTICAL" | "HORIZONTAL" | "BOTH" | "V" | "H" | "B"; + /** The start position of the split. */ + startAt?: ViewStart; + /** The position of the split. */ + split: number | { + x: number; + y: number; + }; + }; +} + +/** + * Options for the start of the view. + * @interface + */ +declare interface ViewStart { + t?: string; + b?: string; + r?: string; + l?: string; + one?: string; + two?: string; +} + +export { } diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index 8b13789..868600f 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1 +1,55 @@ +var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;ob[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),b=h.charAt(2);return w+w+o+o+b+b}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((b,c)=>b&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,b)=>o+b.charAt(0)+b.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),b=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),b)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let b=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(b):w&&w.headerColor?w.headerColor:Tt(b),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:b,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),b[_]=a})}return l});if(Object.keys(b).forEach(l=>{i.file(l,b[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,b,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,b,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var y=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=y.length,v=!0,typeof b=="function"?s=b(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),y.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;y.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof b=="function"?S.height=b(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length +`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,b,c,r,f){let i={};return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+b.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` +Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,b){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),y=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let b=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(b=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return b&&c.unshift(r+":"),{hasAuthor:b,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,b){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` +`;return}i>0&&(l=' xml:space="preserve"',r+=` +`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"Β₯":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''},"β‚½3":{key:172,value:''},"β‚½2":{key:173,value:''},"β‚½1":{key:174,value:''},"β‚Ό1":{key:175,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=pt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />
");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` +`};let he=1024;const Z={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},oe={checkbox:` + + + + `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ye="",Ve=[],at=[],Ge=[],He=[],Le={},Je="",Qe=!1,vt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const M=ie.row.length;vt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const M=ie.column.length;vt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(Qe=!0),ie.margin){const ae=ie.margin;let se={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(se).forEach(G=>{typeof ae[G]=="number"&&(se[G]=ae[G])}),qt=''}let M="",ee="",Y="",W="";if(["header","footer"].forEach(ae=>{const se=ae.charAt(0).toUpperCase()+ae.substring(1);if(ie[ae]){const G=ie[ae];typeof G=="object"&&Object.keys(G).forEach(le=>{M.indexOf(le)<0&&(M+=le);const Oe=G[le];let xe="";if(Object.keys(Oe).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Oe[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+le+se+">"+xe+"",le=="odd")ee+=xe;else if(le=="even")Y+=xe;else if(le=="first")W+=xe;else throw"type error"})}}),Je=ee+Y+W,Je.length>0){Qe=!0;const ae=M.length==7||M.length==12?' differentOddEven="1"':"",se=M.indexOf("first")>=0?' differentFirst="1"':"";Je=""+Je+""}}if(C.viewOption){let ie="";const M=C.viewOption;M.type&&(ge=M.type),M.hideRuler&&(re+=' showRuler="0" '),M.hideGrid&&(re+=' showGridLines="0" '),M.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=M.splitOption;if(typeof ee>"u"&&(Qe=!1,typeof M.frozenOption=="object")){const Y=M.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=et(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(Qe&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((M,ee)=>{let Y=ie;if(M.link){let le=qe(M.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[le.col]+"$"+(le.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");M.mixed?Y=Y.replace("**value**",'checked="Mixed"'):M.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),M.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",M.text);let ae=M.startStr,se=M.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(M.col&&M.row&&(G={start:{col:M.col,row:M.row-1},end:{col:M.col,row:M.row}}),typeof ae=="string"&&ae.length>=2){let le=qe(ae,r);G.start={...le},G.end={col:le.col+1,row:le.row+1}}if(typeof se=="string"&&se.length>=2){let le=qe(se,r);le.row+=1,le.col+=1,G.end={...le}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+M.text+""})}let xt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;xt=new Promise(async(M,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,ae="image"+fe+"."+W,se=await Rt(ie,ae,b,h.fetch);se||ee("image not load"),H.push(W),M({name:ae,type:W,image:se,ref:fe})})}let wt;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),wt=Promise.all([...C.images.map(async(ie,M)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",H.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,b,h.fetch),obj:ie,i:M,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let M="";if(C.title){const W=C.title,fe=W.comment,ae=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,se=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+se>=0?W.shiftLeft+se:se,le=W.consommeRow?W.consommeRow-1:1,Oe=W.consommeCol?W.consommeCol:ie,xe=le==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+ae);if(ye.push(ce+":"+r[G+Oe-1]+(P+le+ae)),typeof fe<"u"){Re=!0;const ke=dt(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(ke.hasAuthor&&typeof ke.author<"u"){let Ce=ke.author.toString();const Ee=Pe.indexOf(Ce);Ee<0?Pe.push(Ce):Ne=Ee}Ve.push({row:P+ae-1,col:G}),Ye+=ut(ce,ke.commentStr,ke.commentStyle,Ne)}typeof W.text=="string"&&(d[P+ae]={startTag:'',details:''+R+"",endTag:""},M+='',M+=''+R+"",M+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+tt(W.text)+""),P+=ae+le+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Ge.push(fe),W.conditionalFormatting&&y&&He.push(fe),at.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const ae=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=dt(W.comment,S.commentSyntax.value,t);let le=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Oe=G.author.toString();const xe=Pe.indexOf(Oe);xe<0?Pe.push(Oe):le=xe}Ve.push({row:P-1,col:fe}),Ye+=ut(ae,G.commentStr,G.commentStyle,le)}const se=ze&&ze[ae];if(se){const G=ht(ae,se,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[ae]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+tt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=M;else{const W='fe+" "+ae+'="'+C.headerRowOption[ae]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=M+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",ae=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",se=C.data.length;C.data.forEach((G,le)=>{if(G.mergeType)for(let ce=0;ce
");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` +`};let he=1024;const Z={checkbox:` + + + +
***text***
+
+ + + + 0, 2, 0, 2, 0, 86, 1, 0 + False + False + Center + + +
`},oe={checkbox:` + + + + `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ve="",Ge=[],st=[],Xe=[],He=[],Le={},Qe="",et=!1,xt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const M=ie.row.length;xt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const M=ie.column.length;xt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(et=!0),ie.margin){const ae=ie.margin;let se={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(se).forEach(G=>{typeof ae[G]=="number"&&(se[G]=ae[G])}),qt=''}let M="",ee="",Y="",W="";if(["header","footer"].forEach(ae=>{const se=ae.charAt(0).toUpperCase()+ae.substring(1);if(ie[ae]){const G=ie[ae];typeof G=="object"&&Object.keys(G).forEach(le=>{M.indexOf(le)<0&&(M+=le);const Ie=G[le];let xe="";if(Object.keys(Ie).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Ie[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+le+se+">"+xe+"",le=="odd")ee+=xe;else if(le=="even")Y+=xe;else if(le=="first")W+=xe;else throw"type error"})}}),Qe=ee+Y+W,Qe.length>0){et=!0;const ae=M.length==7||M.length==12?' differentOddEven="1"':"",se=M.indexOf("first")>=0?' differentFirst="1"':"";Qe=""+Qe+""}}if(C.viewOption){let ie="";const M=C.viewOption;M.type&&(ge=M.type),M.hideRuler&&(re+=' showRuler="0" '),M.hideGrid&&(re+=' showGridLines="0" '),M.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=M.splitOption;if(typeof ee>"u"&&(et=!1,typeof M.frozenOption=="object")){const Y=M.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=tt(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(et&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((M,ee)=>{let Y=ie;if(M.link){let le=Ye(M.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[le.col]+"$"+(le.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");M.mixed?Y=Y.replace("**value**",'checked="Mixed"'):M.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),M.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",M.text);let ae=M.startStr,se=M.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(M.col&&M.row&&(G={start:{col:M.col,row:M.row-1},end:{col:M.col,row:M.row}}),typeof ae=="string"&&ae.length>=2){let le=Ye(ae,r);G.start={...le},G.end={col:le.col+1,row:le.row+1}}if(typeof se=="string"&&se.length>=2){let le=Ye(se,r);le.row+=1,le.col+=1,G.end={...le}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+M.text+""})}let wt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;wt=new Promise(async(M,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,ae="image"+fe+"."+W,se=await Rt(ie,ae,b,h.fetch);se||ee("image not load"),H.push(W),M({name:ae,type:W,image:se,ref:fe})})}let Ct;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),Ct=Promise.all([...C.images.map(async(ie,M)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",H.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,b,h.fetch),obj:ie,i:M,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let M="";if(C.title){const W=C.title,fe=W.comment,ae=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,se=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+se>=0?W.shiftLeft+se:se,le=W.consommeRow?W.consommeRow-1:1,Ie=W.consommeCol?W.consommeCol:ie,xe=le==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+ae);if(ye.push(ce+":"+r[G+Ie-1]+(P+le+ae)),typeof fe<"u"){Re=!0;const ke=ut(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(ke.hasAuthor&&typeof ke.author<"u"){let Ce=ke.author.toString();const Te=Pe.indexOf(Ce);Te<0?Pe.push(Ce):Ne=Te}Ge.push({row:P+ae-1,col:G}),Ve+=mt(ce,ke.commentStr,ke.commentStyle,Ne)}typeof W.text=="string"&&(d[P+ae]={startTag:'',details:''+R+"",endTag:""},M+='',M+=''+R+"",M+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+rt(W.text)+""),P+=ae+le+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Xe.push(fe),W.conditionalFormatting&&y&&He.push(fe),st.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const ae=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=ut(W.comment,S.commentSyntax.value,t);let le=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Ie=G.author.toString();const xe=Pe.indexOf(Ie);xe<0?Pe.push(Ie):le=xe}Ge.push({row:P-1,col:fe}),Ve+=mt(ae,G.commentStr,G.commentStyle,le)}const se=ze&&ze[ae];if(se){const G=dt(ae,se,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[ae]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+rt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=M;else{const W='fe+" "+ae+'="'+C.headerRowOption[ae]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=M+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",ae=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",se=C.data.length;C.data.forEach((G,le)=>{if(G.mergeType)for(let ce=0;ce
");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,q));let oe='',P="",B=0,J="",M="",L={};const E={};let $="",Y=4,W=!1,K=-1,ve=[],Q=1;const ge={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"Β₯":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''},"β‚½3":{key:172,value:''},"β‚½2":{key:173,value:''},"β‚½1":{key:174,value:''},"β‚Ό1":{key:175,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=Qt,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},X={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",fe="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(G!="-"||fe!="Regular")&&(C='&"'+G+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){X[a]=w.conditionalFormatting.count;let C=de(x.color,o),G=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,q));let oe='',P="",B=0,J="",M="",L={};const E={};let $="",Y=4,W=!1,K=-1,ve=[],Q=1;const ge={checkbox:` `};let we=1024;const Te={checkbox:``+(Array.isArray(C)&&C.length>0?C.reduce((G,fe)=>G+""+fe+"",""):"")+""+b.commentString+""),x+=''+(V.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(D==null||D.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?ke.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,G)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||se.length>0||b.backgroundImageRef>0){const C=_e==null?void 0:_e.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let O="";b.selectedView||b.splitOption?O='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":O='0?' view="'+b.viewType+'"':"")+"/>",_e==null||_e.file(b.key+".xml",` `+b.tabColor+O+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(se.length>0?' ':"")+"")}),ae.length>0){let w=f==null?void 0:f.folder("ctrlProps");ae.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,Ft,[...new Set(ve)],Me,ae,xe,At)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){ye.import("./FileSaver.min-DXmtgrTw.js").then(a=>a.F).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let s=0;s(o[d].labelCounter++,U0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(X):o[d].data[P]={...o[d].data[P],...X},o[d].headerIndex=P,P++);let B=Object.keys(oe),J=k.data.length>=o[d].data.length;if(o[d].data=k.data.reduce((M,L,E)=>{let $={};return M.length>E+P?$=M[E+P]:M.push($),B.forEach(Y=>{let W=oe[Y];$[W]=L[Y]?L[Y]:""}),$.tableIndex=r,$.tableStringIndex=E+","+j,M[E+P]=$,M},o[d].data),J&&k.spaceY){const M=o[d].headers.length;for(let L=0;L{let v=o[f];return s.sheet.push({...v,name:f}),s},{sheet:u})}function Qe(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function et(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const s=t[m];if(!("color"in s))throw"border-The border must have a color.";if(!("style"in s))throw"border-The border needs a style.";if(typeof s.style=="string"&&l.indexOf(s.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!et(l.to))throw'value of "to" is not valid.';if(l.from&&!et(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{Qe(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!Qe(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function wt(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!xt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const s=ao[u];if($e(m,s,u,t,r))return!0})})}function Tt(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];$e(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if($e(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))Tt(l);else throw"Sheet must be Array.";else n=="styles"&&wt(l)})}function $e(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function fo(e){return e?" ":","}function St(e,t){return e.substring(0,e.length-t)+` -`}async function kt(e,t=!1,r=!1){const o=fo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let k=0;k{f+=Et(d[q])+o}),s+=St(f,l)}g.push(s)}),e.backend)return g;const u=await ye.import("./FileSaver.min-DXmtgrTw.js").then(m=>m.F).then(m=>m.saveAs);if(t){const m=await ye.import("./jszip.min-49JP7itW.js").then(v=>v.j).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const Ot={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function mo(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let k=await ye.import("./read-utils-Byj29Erp.js").then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const q=Object.keys(m),U=Object.keys(s),X=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),q.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let J=[],M=!1,L=0;do{L++;const E=k.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const Q=document.createElement("button");oe.forEach(ge=>{Q.style[ge]=D[ge]}),Q.addEventListener("click",ge=>{const we=Q.getAttribute("data-sheet"),Te=d.querySelector('div[data-sheet="'+we+'"]');if(Te){P.forEach(ie=>{Q.style[ie]=j[ie]});const ke=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");Te.setAttribute("data-sheet-activate","1"),Te.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),ke&&(oe.forEach(ie=>{ke.style[ie]=D[ie]}),ke.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+we)}),Q.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),Q.innerText=E.value[1]||E.value[0],B.appendChild(Q),d.appendChild($)}let Y=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=s[Q]});const K=k.data[E.value[0]]||k.data[E.value[1]],ve=k.maxLengthOfColumn[E.value[0]]||k.maxLengthOfColumn[E.value[1]];if(Array.isArray(K)){const Q=K.length;for(let ge=0;ge{xe.style[pe]=f[pe]}),xe.innerText=ie,Te.appendChild(xe)}W.appendChild(Te),Y="td"}}l?J.push(W):($.appendChild(W),d==null||d.appendChild($)),M=E.done}while(!M);if(l)return J;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(Y=>{$.style[Y]=j[Y]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function po(e,t,r=!0,o="property"){let n=await ye.import("./read-utils-Byj29Erp.js").then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let k={};j.forEach((d,q)=>{typeof d=="string"&&(v?g[q]=d:k[g[q]]=d)}),v=!1,D.push(k)}),l=Object.assign(l,{[m]:D})}),l}const So=Pe("a",Ct),ko=Pe("b",oo);function ho(e,t,r={}){const o=Gt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function uo(e){const t=lo(e);return Be(t)}function yo(e,t){return Be(zt(e,t))}function go(e,t=!1,r){return ye.import("./read-utils-Byj29Erp.js").then(o=>o.extractExcelData(e,t,r))}function xo(e,t=!1){return kt(e,t,!1)}function bo(e,t=!1){return kt(e,t,!0)}function Co(e,t,r,o={...Ot}){return o={...Ot,...o},mo(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}}}}); +`}async function kt(e,t=!1,r=!1){const o=fo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let k=0;k{f+=Et(d[q])+o}),s+=St(f,l)}g.push(s)}),e.backend)return g;const u=await ye.import("./FileSaver.min-DXmtgrTw.js").then(m=>m.F).then(m=>m.saveAs);if(t){const m=await ye.import("./jszip.min-49JP7itW.js").then(v=>v.j).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const Ot={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function mo(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let k=await ye.import("./read-utils-CMxu90Z7.js").then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const q=Object.keys(m),U=Object.keys(s),X=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),q.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let J=[],M=!1,L=0;do{L++;const E=k.sheetName.next();if(!E.value)break;const $=document.createElement("div");if($.style.display="none",!l){const Q=document.createElement("button");oe.forEach(ge=>{Q.style[ge]=D[ge]}),Q.addEventListener("click",ge=>{const we=Q.getAttribute("data-sheet"),Te=d.querySelector('div[data-sheet="'+we+'"]');if(Te){P.forEach(ie=>{Q.style[ie]=j[ie]});const ke=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");Te.setAttribute("data-sheet-activate","1"),Te.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),ke&&(oe.forEach(ie=>{ke.style[ie]=D[ie]}),ke.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+we)}),Q.setAttribute("data-sheet",L+""),$.setAttribute("data-sheet",L+""),Q.innerText=E.value[1]||E.value[0],B.appendChild(Q),d.appendChild($)}let Y=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=s[Q]});const K=k.data[E.value[0]]||k.data[E.value[1]],ve=k.maxLengthOfColumn[E.value[0]]||k.maxLengthOfColumn[E.value[1]];if(Array.isArray(K)){const Q=K.length;for(let ge=0;ge{xe.style[pe]=f[pe]}),xe.innerText=ie,Te.appendChild(xe)}W.appendChild(Te),Y="td"}}l?J.push(W):($.appendChild(W),d==null||d.appendChild($)),M=E.done}while(!M);if(l)return J;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const $=d.querySelector('button[data-sheet="1"]');return $&&(P.forEach(Y=>{$.style[Y]=j[Y]}),$.setAttribute("data-sheet-button-activate","1")),"Done"}}async function po(e,t,r=!0,o="property"){let n=await ye.import("./read-utils-CMxu90Z7.js").then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let k={};j.forEach((d,q)=>{typeof d=="string"&&(v?g[q]=d:k[g[q]]=d)}),v=!1,D.push(k)}),l=Object.assign(l,{[m]:D})}),l}const So=Pe("a",Ct),ko=Pe("b",oo);function ho(e,t,r={}){const o=Gt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function uo(e){const t=lo(e);return Be(t)}function yo(e,t){return Be(zt(e,t))}function go(e,t=!1,r){return ye.import("./read-utils-CMxu90Z7.js").then(o=>o.extractExcelData(e,t,r))}function xo(e,t=!1){return kt(e,t,!1)}function bo(e,t=!1){return kt(e,t,!0)}function Co(e,t,r,o={...Ot}){return o={...Ot,...o},mo(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}}}}); diff --git a/dist/index-BPuSW_h3.js b/dist/index-BPuSW_h3.js deleted file mode 100644 index cca826e..0000000 --- a/dist/index-BPuSW_h3.js +++ /dev/null @@ -1,44 +0,0 @@ -System.register("ExcelTable",[],function(Pe,ye){"use strict";return{execute:function(){Pe({d:ho,e:go,f:xo,g:Fe,h:bo,i:Co,j:Be,k:po,r:Ut,s:uo,t:yo});function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Yt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=Yt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function ce(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function de(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=ce(e);e=r||""}return e.replace(/^#/,"")}function Vt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:Vt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},zt=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mm.j)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await ye.import("./FileSaver.min-DXmtgrTw.js").then(f=>f.F)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Wt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Gt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=ce(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=ce(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=ce(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=ce(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=ce(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let X=ce(P.backgroundColor);!X&&Z&&(X=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...X?{backgroundColor:X}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),q=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...q?{rowspan:q}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((X,K)=>{if("c"+(K+B)in N)for(let M=0;M<=j+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(X,null);if(X.getAttribute("colspan")||X.getAttribute("rowspan")){let M=Wt(X.getAttribute("colspan")*1,X.getAttribute("rowspan")*1,K,j,N,X.textContent,oe,N);u.length{u.length500,...isNaN(q)?{}:{size:q},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=X.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length -`+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[s]=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Jt(e,t){return` -Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` -`;return}u>0&&(m=' xml:space="preserve"',l+=` -`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=Qt,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",fe="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(W!="-"||fe!="Regular")&&(C='&"'+W+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=de(x.color,o),W=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` -`};let we=1024;const Te={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},ke={checkbox:` - - - - `};let ae=[],ie="",xe=!1,pe=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",fe="",Ee="",Se="",je="",nt=!1,_t="",It="",Pt="",jt="",be=Object.assign([],a.merges),ue=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,he=[],Me="",qe=[],Rt=[],at=[],it=[],Oe={},De="",Le=!1,st="";if(a.rtl&&(Se+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){je="pageBreakPreview";const i=T.row.length;st+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){je="pageBreakPreview";const i=T.column.length;st+=''+T.column.reduce((y,p)=>y+'',"")+""}}let Dt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Le=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Dt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(je=i.type),i.hideRuler&&(Se+=' showRuler="0" '),i.hideGrid&&(Se+=' showGridLines="0" '),i.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Le=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Se+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Ee='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Se+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Se+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Ee='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const T=ge.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=Fe(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),we++;let c=w+""+we++;const _="_x0000_s"+c;It+=Te.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=Fe(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Fe(A,l);O.row+=1,O.col+=1,h.end={...O}}jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Pt+='',_t+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;ct=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=J++,F="image"+_+"."+c,A=await bt(T,F,o,e.fetch);A||y("image not load"),ve.push(c),i({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const c="image"+J+++"."+p;return{type:p,image:await bt(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(be.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let me=he.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=he.indexOf(ee);re<0?he.push(ee):me=re}qe.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,me)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,R):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',pe||(pe=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Rt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Oe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=he.indexOf(le);V<0?he.push(le):O=V}qe.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(xe=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` -`};let Te=1024;const Ee={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Oe={checkbox:` - - - - `};let ie=[],se="",be=!1,he=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",me="",Se="",ke="",je="",nt=!1,It="",Pt="",jt="",Rt="",Ce=Object.assign([],a.merges),ye=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,ue=[],Me="",Ye=[],Dt=[],at=[],it=[],Fe={},De="",Le=!1,st="";if(a.rtl&&(ke+=' rightToLeft="1" '),a.pageBreak){const E=a.pageBreak;if(E.row&&Array.isArray(E.row)){je="pageBreakPreview";const s=E.row.length;st+=''+E.row.reduce((y,p)=>y+'',"")+""}if(E.column&&Array.isArray(E.column)){je="pageBreakPreview";const s=E.column.length;st+=''+E.column.reduce((y,p)=>y+'',"")+""}}let Lt="";if(a.pageOption){const E=a.pageOption;if(E.isPortrait&&(Le=!0),E.margin){const F=E.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Lt=''}let s="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(E[F]){const h=E[F];typeof h=="object"&&Object.keys(h).forEach(O=>{s.indexOf(O)<0&&(s+=O);const le=h[O];let q="";if(Object.keys(le).reduce((D,I)=>(I=="l"?D.splice(0,0,I):I=="c"?D.splice(1,0,I):I=="r"&&D.splice(2,0,I),D),[]).forEach(D=>{const I=le[D];q+="&"+D.toUpperCase(),I.styleId&&z[I.styleId]&&(q+=z[I.styleId]),I.text&&(q+=I.text)}),q="<"+O+A+">"+q+"",O=="odd")y+=q;else if(O=="even")p+=q;else if(O=="first")c+=q;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let E="";const s=a.viewOption;s.type&&(je=s.type),s.hideRuler&&(ke+=' showRuler="0" '),s.hideGrid&&(ke+=' showGridLines="0" '),s.hideHeadlines&&(ke+=' showRowColHeaders="0" ');let y=s.splitOption;if(typeof y>"u"&&(Le=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(E=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(ke+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Se='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(ke+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Se='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(ke+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Se='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const E=xe.checkbox;a.checkbox.forEach((s,y)=>{let p=E;if(s.link){let O=Ae(s.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),Te++;let c=w+""+Te++;const _="_x0000_s"+c;Pt+=Ee.checkbox.replace("***id***",_).replace("***text***",s.text);let F=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof F=="string"&&F.length>=2){let O=Ae(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Ae(A,l);O.row+=1,O.col+=1,h.end={...O}}Rt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",jt+='',It+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const E=a.backgroundImage;ct=new Promise(async(s,y)=>{let p=E.lastIndexOf("."),c;p>0?(c=E.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await Ct(E,F,o,e.fetch);A||y("image not load"),we.push(c),s({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(E,s)=>{let y=E.url.lastIndexOf("."),p;y>0?(p=E.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",we.push(p);const c="image"+X+++"."+p;return{type:p,image:await Ct(E.url,c,o,e.fetch),obj:E,i:s,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const E=a.headers.length;let s="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:E,q=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",D=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(Ce.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let de=ue.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=ue.indexOf(ee);re<0?ue.push(ee):de=re}Ye.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,de)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},s+='',s+=''+B+"",s+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,D):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),ce&&(H+='',he||(he=f==null?void 0:f.folder("tables"))),V.start=l[p]+""+k,V.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(ce&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Dt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Fe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const q=ue.indexOf(le);q<0?ue.push(le):O=q}Ye.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ye&&ye[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(be=!0,se+=h.chainCell),C+=h.cell,delete ye[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),ce&&(H+=""),a.withoutHeader)C+=s;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=s+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,q));let oe='',P="",B=0,X="",$="",L={};const E={};let M="",Y=4,W=!1,K=-1,Ce=[],Q=1;const ye={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Me=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function at(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Me(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const Lt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"Β₯":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''},"β‚½3":{key:172,value:''},"β‚½2":{key:173,value:''},"β‚½1":{key:174,value:''},"β‚Ό1":{key:175,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_t=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function _e(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=$e(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},it=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Nt(e,t,r){it[e],it[e][t]=r}function Bt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&Bt(e,t.length>0?t+"."+n:n,l):Nt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){Bt(e,"",t)}function ro(e,t){let r=t,o=it[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Ke(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=Lt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...Ht];e.numberOfColumn&&e.numberOfColumn>25&&(l=$e(l,e.numberOfColumn));const u=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",ce="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(ce="Bold"),x.italic&&(ce=="Regular"&&(ce=""),ce+="Italic"),(G!="-"||ce!="Regular")&&(C='&"'+G+","+ce+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Te=he(x.color,o);typeof Te=="string"&&Te.length>0&&(C+="&K"+Te.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=he(x.color,o),G=he(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=he(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=he(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,q));let oe='',P="",B=0,X="",$="",L={};const E={};let M="",Y=4,W=!1,K=-1,Ce=[],Q=1;const ye={checkbox:` `};let ve=1024;const we={checkbox:``+(Array.isArray(C)&&C.length>0?C.reduce((G,ce)=>G+""+ce+"",""):"")+""+b.commentString+""),x+=''+(V.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(D==null||D.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?Se.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,G)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||se.length>0||b.backgroundImageRef>0){const C=Fe==null?void 0:Fe.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let O="";b.selectedView||b.splitOption?O='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":O='0?' view="'+b.viewType+'"':"")+"/>",Fe==null||Fe.file(b.key+".xml",` `+b.tabColor+O+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(se.length>0?' ':"")+"")}),ae.length>0){let w=f==null?void 0:f.folder("ctrlProps");ae.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,ft,[...new Set(Ce)],De,ae,ge,mt)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(a=>a.FileSaver_min).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let s=0;s(o[d].labelCounter++,U0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(J):o[d].data[P]={...o[d].data[P],...J},o[d].headerIndex=P,P++);let B=Object.keys(oe),X=k.data.length>=o[d].data.length;if(o[d].data=k.data.reduce(($,L,E)=>{let M={};return $.length>E+P?M=$[E+P]:$.push(M),B.forEach(Y=>{let W=oe[Y];M[W]=L[Y]?L[Y]:""}),M.tableIndex=r,M.tableStringIndex=E+","+j,$[E+P]=M,$},o[d].data),X&&k.spaceY){const $=o[d].headers.length;for(let L=0;L{let v=o[f];return s.sheet.push({...v,name:f}),s},{sheet:u})}function st(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function ct(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const s=t[m];if(!("color"in s))throw"border-The border must have a color.";if(!("style"in s))throw"border-The border needs a style.";if(typeof s.style=="string"&&l.indexOf(s.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!ct(l.to))throw'value of "to" is not valid.';if(l.from&&!ct(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{st(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!st(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function Mt(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!Lt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const s=ao[u];if(qe(m,s,u,t,r))return!0})})}function $t(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];qe(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if(qe(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))$t(l);else throw"Sheet must be Array.";else n=="styles"&&Mt(l)})}function qe(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function po(e){return e?" ":","}function Pt(e,t){return e.substring(0,e.length-t)+` -`}async function Kt(e,t=!1,r=!1){const o=po(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let k=0;k{f+=It(d[q])+o}),s+=Pt(f,l)}g.push(s)}),e.backend)return g;const u=await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(v=>v.jszip_min).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const jt={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function ho(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let k=await Promise.resolve().then(()=>require("./read-utils-BEg2qKSg.cjs")).then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const q=Object.keys(m),U=Object.keys(s),J=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),q.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let X=[],$=!1,L=0;do{L++;const E=k.sheetName.next();if(!E.value)break;const M=document.createElement("div");if(M.style.display="none",!l){const Q=document.createElement("button");oe.forEach(ye=>{Q.style[ye]=D[ye]}),Q.addEventListener("click",ye=>{const ve=Q.getAttribute("data-sheet"),we=d.querySelector('div[data-sheet="'+ve+'"]');if(we){P.forEach(ie=>{Q.style[ie]=j[ie]});const Se=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");we.setAttribute("data-sheet-activate","1"),we.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),Se&&(oe.forEach(ie=>{Se.style[ie]=D[ie]}),Se.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+ve)}),Q.setAttribute("data-sheet",L+""),M.setAttribute("data-sheet",L+""),Q.innerText=E.value[1]||E.value[0],B.appendChild(Q),d.appendChild(M)}let Y=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=s[Q]});const K=k.data[E.value[0]]||k.data[E.value[1]],Ce=k.maxLengthOfColumn[E.value[0]]||k.maxLengthOfColumn[E.value[1]];if(Array.isArray(K)){const Q=K.length;for(let ye=0;ye{ge.style[de]=f[de]}),ge.innerText=ie,we.appendChild(ge)}W.appendChild(we),Y="td"}}l?X.push(W):(M.appendChild(W),d==null||d.appendChild(M)),$=E.done}while(!$);if(l)return X;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const M=d.querySelector('button[data-sheet="1"]');return M&&(P.forEach(Y=>{M.style[Y]=j[Y]}),M.setAttribute("data-sheet-button-activate","1")),"Done"}}async function uo(e,t,r=!0,o="property"){let n=await Promise.resolve().then(()=>require("./read-utils-BEg2qKSg.cjs")).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let k={};j.forEach((d,q)=>{typeof d=="string"&&(v?g[q]=d:k[g[q]]=d)}),v=!1,D.push(k)}),l=Object.assign(l,{[m]:D})}),l}const yo=Nt,go=oo;function xo(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Ke(o)}function bo(e){const t=lo(e);return Ke(t)}function Co(e,t){return Ke(Ut(e,t))}function vo(e,t=!1,r){return Promise.resolve().then(()=>require("./read-utils-BEg2qKSg.cjs")).then(o=>o.extractExcelData(e,t,r))}function wo(e,t=!1){return Kt(e,t,!1)}function To(e,t=!1){return Kt(e,t,!0)}function Eo(e,t,r,o={...jt}){return o={...jt,...o},ho(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}exports.addGlobalOptionFromExcelTable=go;exports.addGlobalOptions=yo;exports.cols=Ht;exports.convertTableToExcel=xo;exports.excelToJson=uo;exports.excelToNode=Eo;exports.extractExcelData=vo;exports.generateCSV=wo;exports.generateExcel=Ke;exports.generateText=To;exports.getColRowBaseOnRefString=_e;exports.replaceInExcel=Wt;exports.sideBySideLineByLine=bo;exports.themeBaseGenerate=Co;exports.validateExcelTable=mo; +`}async function Kt(e,t=!1,r=!1){const o=po(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let s="",f="";const v=m.headers;let D=[],j=v.length;for(let k=0;k{f+=It(d[q])+o}),s+=Pt(f,l)}g.push(s)}),e.backend)return g;const u=await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(v=>v.jszip_min).then(v=>v.default);let s=new m;g.forEach((v,D)=>{s.file("sheet"+(D+1)+n,v)});const f=await s.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var s=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(s,(e.fileName?e.fileName:"tableRecord")+n)})}const jt={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function ho(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},s={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},D={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},j={background:"#EEEDEB"}){let k=await Promise.resolve().then(()=>require("./read-utils-CWXTa8vm.cjs")).then(async E=>await E.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const q=Object.keys(m),U=Object.keys(s),J=Object.keys(f),N=Object.keys(v),oe=Object.keys(D),P=Object.keys(j);let B=document.createElement("div");N.forEach(E=>{B.style[E]=v[E]}),l||(u&&d!=null&&(d.innerText=""),q.forEach(E=>{d.style[E]=m[E]}),d.appendChild(B));let X=[],$=!1,L=0;do{L++;const E=k.sheetName.next();if(!E.value)break;const M=document.createElement("div");if(M.style.display="none",!l){const Q=document.createElement("button");oe.forEach(ye=>{Q.style[ye]=D[ye]}),Q.addEventListener("click",ye=>{const ve=Q.getAttribute("data-sheet"),we=d.querySelector('div[data-sheet="'+ve+'"]');if(we){P.forEach(ie=>{Q.style[ie]=j[ie]});const Se=d.querySelector("[data-sheet-button-activate]");let ae=d.querySelector("[data-sheet-activate]");we.setAttribute("data-sheet-activate","1"),we.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),Se&&(oe.forEach(ie=>{Se.style[ie]=D[ie]}),Se.removeAttribute("data-sheet-button-activate")),ae&&(ae.style.display="none",ae.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+ve)}),Q.setAttribute("data-sheet",L+""),M.setAttribute("data-sheet",L+""),Q.innerText=E.value[1]||E.value[0],B.appendChild(Q),d.appendChild(M)}let Y=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=s[Q]});const K=k.data[E.value[0]]||k.data[E.value[1]],Ce=k.maxLengthOfColumn[E.value[0]]||k.maxLengthOfColumn[E.value[1]];if(Array.isArray(K)){const Q=K.length;for(let ye=0;ye{ge.style[de]=f[de]}),ge.innerText=ie,we.appendChild(ge)}W.appendChild(we),Y="td"}}l?X.push(W):(M.appendChild(W),d==null||d.appendChild(M)),$=E.done}while(!$);if(l)return X;{const E=d.querySelector('div[data-sheet="1"]');E&&(E.style.display="flex",E.setAttribute("data-sheet-activate","1"));const M=d.querySelector('button[data-sheet="1"]');return M&&(P.forEach(Y=>{M.style[Y]=j[Y]}),M.setAttribute("data-sheet-button-activate","1")),"Done"}}async function uo(e,t,r=!0,o="property"){let n=await Promise.resolve().then(()=>require("./read-utils-CWXTa8vm.cjs")).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],s=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let j=0;j<=f;j++)g[j]=o+(j+1);let v=r,D=[];s.forEach(j=>{let k={};j.forEach((d,q)=>{typeof d=="string"&&(v?g[q]=d:k[g[q]]=d)}),v=!1,D.push(k)}),l=Object.assign(l,{[m]:D})}),l}const yo=Nt,go=oo;function xo(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Ke(o)}function bo(e){const t=lo(e);return Ke(t)}function Co(e,t){return Ke(Ut(e,t))}function vo(e,t=!1,r){return Promise.resolve().then(()=>require("./read-utils-CWXTa8vm.cjs")).then(o=>o.extractExcelData(e,t,r))}function wo(e,t=!1){return Kt(e,t,!1)}function To(e,t=!1){return Kt(e,t,!0)}function Eo(e,t,r,o={...jt}){return o={...jt,...o},ho(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}exports.addGlobalOptionFromExcelTable=go;exports.addGlobalOptions=yo;exports.cols=Ht;exports.convertTableToExcel=xo;exports.excelToJson=uo;exports.excelToNode=Eo;exports.extractExcelData=vo;exports.generateCSV=wo;exports.generateExcel=Ke;exports.generateText=To;exports.getColRowBaseOnRefString=_e;exports.replaceInExcel=Wt;exports.sideBySideLineByLine=bo;exports.themeBaseGenerate=Co;exports.validateExcelTable=mo; diff --git a/dist/index-CzrjgJVS.cjs b/dist/index-CzrjgJVS.cjs deleted file mode 100644 index e0d0f1e..0000000 --- a/dist/index-CzrjgJVS.cjs +++ /dev/null @@ -1,44 +0,0 @@ -"use strict";function Rt(e){return e.replace(/ /g,"")}function Dt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Vt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=Dt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function kt(e){const t=Vt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function Ot(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=Dt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function tt(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function me(e){e=Rt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(tt(t[0])+tt(t[1])+tt(t[2])).toUpperCase()}function he(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=Rt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=me(e);e=r||""}return e.replace(/^#/,"")}function zt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function Ft(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:zt(g)}),l),o)}const ot={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Ut=function(e,t={...ot}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=Ft(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:Ft(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:ot.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:ot.rowBackgroundColor,l=t&&t.negativeColor?Ot(o):t&&t.headerColor?t.headerColor:kt(o),g=t&&t.negativeColor?Ot(n):t&&t.rowColor?t.rowColor:kt(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mrequire("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await Promise.resolve().then(()=>require("./FileSaver.min-3zGNM-lE.cjs")).then(f=>f.FileSaver_min)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Gt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Zt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=me(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=me(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=me(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=me(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=me(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let J=me(P.backgroundColor);!J&&Z&&(J=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...J?{backgroundColor:J}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),M=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...M?{rowspan:M}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((J,K)=>{if("c"+(K+B)in N)for(let q=0;q<=j+1&&"c"+(K+q)in N;q++)B++;K+=B;let L=window.getComputedStyle(J,null);if(J.getAttribute("colspan")||J.getAttribute("rowspan")){let q=Gt(J.getAttribute("colspan")*1,J.getAttribute("rowspan")*1,K,j,N,J.textContent,oe,N);u.length{u.length500,...isNaN(M)?{}:{size:M},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=J.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length -`+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[s]=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Qt(e,t){return` -Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function rt(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function nt(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?At(e.comment):[""]}else n=e?At(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function At(e){var t=e.split(/\r?\n|\r|\n/g);return t}function lt(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` -`;return}u>0&&(m=' xml:space="preserve"',l+=` -`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',$e=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function at(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=$e(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const Lt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_t=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function _e(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=Ke(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},it=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Nt(e,t,r){it[e],it[e][t]=r}function Bt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&Bt(e,t.length>0?t+"."+n:n,l):Nt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){Bt(e,"",t)}function ro(e,t){let r=t,o=it[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function qe(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=Lt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...Ht];e.numberOfColumn&&e.numberOfColumn>25&&(l=Ke(l,e.numberOfColumn));const u=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=eo,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",ce="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(ce="Bold"),x.italic&&(ce=="Regular"&&(ce=""),ce+="Italic"),(W!="-"||ce!="Regular")&&(C='&"'+W+","+ce+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Te=he(x.color,o);typeof Te=="string"&&Te.length>0&&(C+="&K"+Te.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=he(x.color,o),W=he(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=he(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=he(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` -`};let ve=1024;const we={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Se={checkbox:` - - - - `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),q.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(q.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(q.fillIndex>0?' applyFill="1" ':"")+(q.fontIndex>=0?' applyFont="1" ':"")+(q.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:Y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,Y));let oe='',P="",B=0,X="",$="",L={};const T={};let M="",V=4,W=!1,K=-1,we=[],Q=1;const xe={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Je(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"Β₯":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''},"β‚½3":{key:172,value:''},"β‚½2":{key:173,value:''},"β‚½1":{key:174,value:''},"β‚Ό1":{key:175,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ct=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Ae(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Xe=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function vt(e,t,r){Xe[e],Xe[e][t]=r}function wt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&wt(e,t.length>0?t+"."+n:n,l):vt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){wt(e,"",t)}function ro(e,t){let r=t,o=Xe[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let i=0;iu+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...bt];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await new Promise((w,a)=>ge(["./jszip.min-CGrYsaMq"],w,a)).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const i=e.sheet.length;let f=m.folder("xl"),v=null,j=null,R=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,Y=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",me="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(G!="-"||me!="Regular")&&(C='&"'+G+","+me+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Se=pe(x.color,o);typeof Se=="string"&&Se.length>0&&(C+="&K"+Se.toUpperCase())}return U[a]=C,w}if(Y&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=pe(x.color,o),G=pe(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const q={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=pe(x.backgroundColor,o);q.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=pe(x.color,o);q.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let ce="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,ce=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),q.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(q.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(q.fillIndex>0?' applyFill="1" ':"")+(q.fontIndex>=0?' applyFont="1" ':"")+(q.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:Y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,Y));let oe='',P="",B=0,X="",$="",L={};const T={};let M="",V=4,W=!1,K=-1,we=[],Q=1;const xe={checkbox:` `};let Te=1024;const Ee={checkbox:``+(Array.isArray(C)&&C.length>0?C.reduce((G,me)=>G+""+me+"",""):"")+""+b.commentString+""),x+=''+(q.vmlDrwing?"":'')}if((b.hasComment||b.hasCheckbox)&&(j==null||j.file("vmlDrawing"+(a+1)+".vml",''+(b.hasCheckbox?Oe.checkbox+b.checkboxShape:"")+(b.hasComment?' '+b.shapeCommentRowCol.reduce((C,G)=>C+`",""):"")+"")),b.backgroundImageRef>0&&(x+=''),b.hasImages||b.hasComment||b.hasCheckbox||ce.length>0||b.backgroundImageRef>0){const C=Ie==null?void 0:Ie.folder("_rels");C==null||C.file("sheet"+(a+1)+".xml.rels",` `+x+"")}let O="";b.selectedView||b.splitOption?O='0?' view="'+b.viewType+'"':"")+' workbookViewId="0">'+b.splitOption+(b.selectedView?'':"")+"":O='0?' view="'+b.viewType+'"':"")+"/>",Ie==null||Ie.file(b.key+".xml",` `+b.tabColor+O+''+b.sheetSizeString+""+b.sheetDataString+""+b.sheetDropDown+b.protectionOption+b.sheetSortFilter+b.merges+b.cFDataString+(b.hasImages||b.hasCheckbox?'':"")+(b.hasComment||b.hasCheckbox?'':"")+(b.hasCheckbox?''+b.checkboxSheetContent+"":"")+b.sheetMargin+(b.isPortrait||b.sheetBreakLine.length>0?'':"")+b.sheetBreakLine+b.sheetHeaderFooter+(b.backgroundImageRef>0?'':"")+(ce.length>0?' ':"")+"")}),ie.length>0){let w=f==null?void 0:f.folder("ctrlProps");ie.forEach((a,b)=>{w==null||w.file("ctrlProp"+(b+1)+".xml",a)})}if(m.file("[Content_Types].xml",Xt(oe,At,[...new Set(we)],$e,ie,be,_t)),o)return m.generateAsync({type:e.generateType?e.generateType:"nodebuffer"}).then(w=>w);if(e.notSave)return m.generateAsync({type:"blob"}).then(w=>w.slice(0,w.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));m.generateAsync({type:"blob"}).then(function(w){new Promise((a,b)=>ge(["./FileSaver.min-DbxQUYqv"],a,b)).then(a=>a.FileSaver_min).then(a=>{const{saveAs:b}=a;b(w,(e.fileName?e.fileName:"tableRecord")+".xlsx")})})}function lo(e){const t=e.length;let r=0,o={},n={},l={};for(let i=0;i(o[d].labelCounter++,U0&&(!o[d].headerIndex||o[d].headerIndex&&o[d].headerIndex!=P?o[d].data.push(J):o[d].data[P]={...o[d].data[P],...J},o[d].headerIndex=P,P++);let B=Object.keys(oe),X=k.data.length>=o[d].data.length;if(o[d].data=k.data.reduce(($,L,T)=>{let M={};return $.length>T+P?M=$[T+P]:$.push(M),B.forEach(V=>{let W=oe[V];M[W]=L[V]?L[V]:""}),M.tableIndex=r,M.tableStringIndex=T+","+R,$[T+P]=M,$},o[d].data),X&&k.spaceY){const $=o[d].headers.length;for(let L=0;L{let v=o[f];return i.sheet.push({...v,name:f}),i},{sheet:u})}function Qe(e){return/^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e)}function et(e){return/^[A-Z]+[1-9][1-9]*$/.test(e)}const ao={fontFamily:{mode:"TYPE_CHECK",type:"string"},type:{mode:"TYPE_CHECK",type:"string"},size:{mode:"TYPE_CHECK",type:"number"},index:{mode:"TYPE_CHECK",type:"number"},alignment:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){return t.rtl&&t.ltr&&o&&console.warn("Alignment-rtl and ltr cannot be used together."),(t.readingOrder&&t.ltr||t.readingOrder&&t.rtl)&&o&&console.warn("Alignment-readingOrder cannot be used with rtl or ltr."),!0}},border:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["full","top","left","right","bottom"],l=["slantDashDot","dotted","thick","hair","dashDot","dashDotDot","dashed","thin","mediumDashDot","medium","double","mediumDashed"];return Object.keys(t).forEach(u=>{const m=u;if(n.indexOf(m)<0)throw'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."';const i=t[m];if(!("color"in i))throw"border-The border must have a color.";if(!("style"in i))throw"border-The border needs a style.";if(typeof i.style=="string"&&l.indexOf(i.style)<0)throw"border-An invalid style has been used."}),!0}},format:{mode:"TYPE_CHECK",type:"string"},bold:{mode:"TYPE_CHECK",type:"boolean"},underline:{mode:"TYPE_CHECK",type:"boolean"},italic:{mode:"TYPE_CHECK",type:"boolean"},doubleUnderline:{mode:"TYPE_CHECK",type:"boolean"},color:{mode:"TYPE_CHECK",type:"string"},backgroundColor:{mode:"TYPE_CHECK",type:"string"}},io={notSave:{mode:"TYPE_CHECK",type:"boolean"},creator:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},backend:{mode:"TYPE_CHECK",type:"boolean"},activateConditionalFormatting:{mode:"TYPE_CHECK",type:"boolean"},fileName:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},generateType:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["nodebuffer","array","binarystring","base64"]},addDefaultTitleStyle:{mode:"TYPE_CHECK",type:"boolean"},created:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},modified:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},numberOfColumn:{mode:"TYPE_CHECK",type:"number",min:26},createType:{mode:"TYPE_CHECK",type:"string"},styles:{mode:"TYPE_CHECK",type:"object"},sheet:{mode:"TYPE_CHECK",type:"object",isArray:!0}},so={headers:{mode:"TYPE_CHECK",isArray:!0,type:"object"},data:{mode:"TYPE_CHECK",isArray:!0,type:"object"},withoutHeader:{mode:"TYPE_CHECK",type:"boolean"},mapSheetDataOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=Object.keys(t),l=["outlineLevel","hidden","height"];return n.forEach(g=>{l.indexOf(g)<0&&o&&console.warn('The Schema of mapSheetDataOption does not include the "'+g+'" property.')}),!0}},backgroundImage:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},conditionalFormatting:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){return Array.isArray(t)&&t.forEach(n=>{if(n.type=="cells"){const l=["lt","gt","between","ct","eq"];if(!n.operator||!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start, end and value."};if(l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="top"){const l=["belowAverage","aboveAverage"];if(!n.start||!n.end||typeof n.value>"u")throw{record:n,error:"The object is not complete; you need to fill in the values for start, end and value."};if(n.operator&&l.indexOf(n.operator)<0)throw{record:n,error:"The operator is not valid."}}else if(n.type=="iconSet"){if(!n.operator||!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for operator, start and end"}}else if(n.type=="colorScale"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else if(n.type=="dataBar"){if(!n.start||!n.end)throw{record:n,error:"The object is not complete; you need to fill in the values for start and end"}}else throw'Property "type" is not valid.'}),!0}},multiStyleCondition:{mode:"TYPE_CHECK",type:"function"},useSplitBaseOnMatch:{mode:"TYPE_CHECK",type:"boolean"},convertStringToNumber:{mode:"TYPE_CHECK",type:"boolean"},images:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){const n=["one","two"];t.forEach(l=>{if(typeof l.src!="string")throw'"src" property is required.';if(typeof l.from!="string"||l.from.length==0)throw'"from" property is required.';if(l.to&&!et(l.to))throw'value of "to" is not valid.';if(l.from&&!et(l.from))throw'value of "from" is not valid.';if(n.indexOf(l.type)<0)throw'Type of "type" is not valid in the "images" property.';if(l.type=="two"&&!l.to)throw'"to" property is empty. for "two" type "to" property is required.'})}return!0}},formula:{mode:"TYPE_CHECK",type:"object"},pageOption:{mode:"TYPE_CHECK",type:"object"},name:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},title:{mode:"TYPE_CHECK",type:"object"},shiftTop:{mode:"TYPE_CHECK",type:"number",min:0},shiftLeft:{mode:"TYPE_CHECK",type:"number"},selected:{mode:"TYPE_CHECK",type:"boolean"},tabColor:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},merges:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t)){let n=[];if(t.forEach(l=>{Qe(l)||n.push("The "+l+' reference is not valid in the "merges" property.')}),n.length>0)throw n}return!0}},headerStyleKey:{mode:"TYPE_CHECK",type:"string",notEmpty:!0},mergeRowDataCondition:{mode:"TYPE_CHECK",type:"function"},styleCellCondition:{mode:"TYPE_CHECK",type:"function"},commentCondition:{mode:"TYPE_CHECK",type:"function"},sortAndFilter:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){if(typeof t=="object"){const n=["all","ref"];if(!t.mode)throw'"mode" is required in sortAndFilter';if(n.indexOf(t.mode)<0)throw'"mode" is not valid';if(t.mode=="ref")if(t.ref){if(!Qe(t.ref))throw'"ref" is not valid'}else throw'"ref" is must need be defined.'}return!0}},state:{mode:"TYPE_CHECK",type:"string",isEnum:!0,enum:["hidden","visible"]},headerRowOption:{mode:"TYPE_CHECK",type:"object"},protectionOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["sheet","formatCells","formatColumns","formatRows","insertColumns","insertRows","insertHyperlinks","deleteColumns","deleteRows","sort","autoFilter","pivotTables"],l=["0","1",0,1];return Object.keys(t).forEach(u=>{const m=t[u];if(n.indexOf(u)<0)throw'"'+u+'" is not valid.';if(l.indexOf(m)<0)throw'value of "'+u+'" is not valid'}),!0}},headerHeight:{mode:"TYPE_CHECK",type:"number",min:1},checkbox:{mode:"TYPE_CHECK",isArray:!0,type:"object",validateFunction(e,t,r,o){if(Array.isArray(t))t.forEach(n=>{if(!n.col||!n.row)throw'"checkbox" is not complete'});else throw'Type of "checkbox" property is not valid';return!0}},viewOption:{mode:"TYPE_CHECK",type:"object",validateFunction(e,t,r,o){const n=["pageLayout","pageBreakPreview"];if(t.type&&n.indexOf(t.type)<0)throw'Type of "type" property is not valid';return!0}},rtl:{mode:"TYPE_CHECK",type:"boolean"},pageBreak:{mode:"TYPE_CHECK",type:"object",isArray:!0},asTable:{mode:"TYPE_CHECK",type:"object"}};function Tt(e,t=!0,r=!0){Object.keys(e).forEach(n=>{const l=e[n],g=Object.keys(l);if(l.format&&!xt[l.format])throw'The "'+l.format+'" format that has been used is not defined.';l.underline&&l.doubleUnderline,g.forEach(u=>{let m=l[u];const i=ao[u];if(Me(m,i,u,t,r))return!0})})}function Et(e,t=!0,r=!0){Array.isArray(e)||(e=[e]),e.forEach(o=>{Object.keys(o).forEach(l=>{const g=o[l],u=so[l];Me(g,u,l,t,r)})})}function co(e,t=!0,r=!0){Object.keys(e).forEach(n=>{let l=e[n];const g=io[n];if(Me(l,g,n,t,r))if(n=="sheet")if(Array.isArray(l))Et(l);else throw"Sheet must be Array.";else n=="styles"&&Tt(l)})}function Me(e,t,r,o,n){if(t){if(typeof e!=t.type){if(t.type=="object"||t.type=="string"||o)throw'The Type of The "'+r+'" is not valid';n&&console.warn("The property type must be "+t.type)}if(t.isEnum&&t.enum.indexOf(e)<0)throw'The value of "'+r+'" must be '+JSON.stringify(t.enum);if(t.min&&e"u"||e==null)return"";typeof e!="string"&&(e=String(e));let t=e,r=!1;return e.indexOf('"')>=0&&(t=t.replace(/"/g,'""'),r=!0),e.indexOf(",")>=0&&(r=!0),r&&(t='"'+t+'"'),t}function mo(e){return e?" ":","}function kt(e,t){return e.substring(0,e.length-t)+` -`}async function Ot(e,t=!1,r=!1){const o=mo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let i="",f="";const v=m.headers;let j=[],R=v.length;for(let k=0;k{f+=St(d[Y])+o}),i+=kt(f,l)}g.push(i)}),e.backend)return g;const u=await new Promise((m,i)=>ge(["./FileSaver.min-DbxQUYqv"],m,i)).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await new Promise((v,j)=>ge(["./jszip.min-CGrYsaMq"],v,j)).then(v=>v.jszip_min).then(v=>v.default);let i=new m;g.forEach((v,j)=>{i.file("sheet"+(j+1)+n,v)});const f=await i.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var i=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(i,(e.fileName?e.fileName:"tableRecord")+n)})}const Ft={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function po(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},i={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},j={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},R={background:"#EEEDEB"}){let k=await new Promise((T,M)=>ge(["./read-utils-DXQsy33k"],T,M)).then(async T=>await T.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const Y=Object.keys(m),U=Object.keys(i),J=Object.keys(f),N=Object.keys(v),oe=Object.keys(j),P=Object.keys(R);let B=document.createElement("div");N.forEach(T=>{B.style[T]=v[T]}),l||(u&&d!=null&&(d.innerText=""),Y.forEach(T=>{d.style[T]=m[T]}),d.appendChild(B));let X=[],$=!1,L=0;do{L++;const T=k.sheetName.next();if(!T.value)break;const M=document.createElement("div");if(M.style.display="none",!l){const Q=document.createElement("button");oe.forEach(xe=>{Q.style[xe]=j[xe]}),Q.addEventListener("click",xe=>{const Te=Q.getAttribute("data-sheet"),Ee=d.querySelector('div[data-sheet="'+Te+'"]');if(Ee){P.forEach(se=>{Q.style[se]=R[se]});const Oe=d.querySelector("[data-sheet-button-activate]");let ie=d.querySelector("[data-sheet-activate]");Ee.setAttribute("data-sheet-activate","1"),Ee.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),Oe&&(oe.forEach(se=>{Oe.style[se]=j[se]}),Oe.removeAttribute("data-sheet-button-activate")),ie&&(ie.style.display="none",ie.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+Te)}),Q.setAttribute("data-sheet",L+""),M.setAttribute("data-sheet",L+""),Q.innerText=T.value[1]||T.value[0],B.appendChild(Q),d.appendChild(M)}let V=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=i[Q]});const K=k.data[T.value[0]]||k.data[T.value[1]],we=k.maxLengthOfColumn[T.value[0]]||k.maxLengthOfColumn[T.value[1]];if(Array.isArray(K)){const Q=K.length;for(let xe=0;xe{be.style[he]=f[he]}),be.innerText=se,Ee.appendChild(be)}W.appendChild(Ee),V="td"}}l?X.push(W):(M.appendChild(W),d==null||d.appendChild(M)),$=T.done}while(!$);if(l)return X;{const T=d.querySelector('div[data-sheet="1"]');T&&(T.style.display="flex",T.setAttribute("data-sheet-activate","1"));const M=d.querySelector('button[data-sheet="1"]');return M&&(P.forEach(V=>{M.style[V]=R[V]}),M.setAttribute("data-sheet-button-activate","1")),"Done"}}async function ho(e,t,r=!0,o="property"){let n=await new Promise((u,m)=>ge(["./read-utils-DXQsy33k"],u,m)).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],i=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let R=0;R<=f;R++)g[R]=o+(R+1);let v=r,j=[];i.forEach(R=>{let k={};R.forEach((d,Y)=>{typeof d=="string"&&(v?g[Y]=d:k[g[Y]]=d)}),v=!1,j.push(k)}),l=Object.assign(l,{[m]:j})}),l}const uo=vt,yo=oo;function go(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function xo(e){const t=lo(e);return Be(t)}function bo(e,t){return Be(Ut(e,t))}function Co(e,t=!1,r){return new Promise((o,n)=>ge(["./read-utils-DXQsy33k"],o,n)).then(o=>o.extractExcelData(e,t,r))}function vo(e,t=!1){return Ot(e,t,!1)}function wo(e,t=!1){return Ot(e,t,!0)}function To(e,t,r,o={...Ft}){return o={...Ft,...o},po(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}ae.addGlobalOptionFromExcelTable=yo,ae.addGlobalOptions=uo,ae.cols=bt,ae.convertTableToExcel=go,ae.excelToJson=ho,ae.excelToNode=To,ae.extractExcelData=Co,ae.generateCSV=vo,ae.generateExcel=Be,ae.generateText=wo,ae.getColRowBaseOnRefString=Ae,ae.replaceInExcel=Wt,ae.sideBySideLineByLine=xo,ae.themeBaseGenerate=bo,ae.validateExcelTable=fo}); +`}async function Ot(e,t=!1,r=!1){const o=mo(r),n=r?".txt":".csv",l=o.length;let g=[];if(e.sheet.forEach(m=>{let i="",f="";const v=m.headers;let j=[],R=v.length;for(let k=0;k{f+=St(d[Y])+o}),i+=kt(f,l)}g.push(i)}),e.backend)return g;const u=await new Promise((m,i)=>ge(["./FileSaver.min-DbxQUYqv"],m,i)).then(m=>m.FileSaver_min).then(m=>m.saveAs);if(t){const m=await new Promise((v,j)=>ge(["./jszip.min-CGrYsaMq"],v,j)).then(v=>v.jszip_min).then(v=>v.default);let i=new m;g.forEach((v,j)=>{i.file("sheet"+(j+1)+n,v)});const f=await i.generateAsync({type:"blob"}).then(function(v){return v});return u(f,(e.fileName?e.fileName:"tableRecord")+".zip"),"done"}g.forEach(m=>{var i=new Blob([m],{type:"text/"+(r?"plain":"csv")+";charset=utf-8"});u(i,(e.fileName?e.fileName:"tableRecord")+n)})}const Ft={firstHeader:!0,returnTableNodes:!1,emptyNodeDefaultString:" ",removeContainerChildNode:!0,containerNodeStyle:{display:"flex",flexDirection:"column"},tableStyle:{borderSpacing:"0",border:"1px solid #EEEEEEF1"},cellStyle:{width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},buttonContainerStyle:{display:"flex"},buttonStyle:{height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},activeButtonStyle:{background:"#EEEDEB"}};async function po(e,t,r,o,n=!0,l=!1,g=" ",u=!0,m={display:"flex",flexDirection:"column"},i={borderSpacing:"0",border:"1px solid #EEEEEEF1"},f={width:"68px",height:"24px",border:"1px solid #EEEEEEF1"},v={display:"flex"},j={height:"40px",width:"80px",display:"flex",justifyContent:"center",alignItems:"center",border:"0",background:"transparent",cursor:"pointer"},R={background:"#EEEDEB"}){let k=await new Promise((T,M)=>ge(["./read-utils-pmXAaVV2"],T,M)).then(async T=>await T.extractExcelData(e,!1,o)),d=null;if(t?d=document.querySelector(t):r&&(d=r),d==null&&!l)throw"Container Node not found";const Y=Object.keys(m),U=Object.keys(i),J=Object.keys(f),N=Object.keys(v),oe=Object.keys(j),P=Object.keys(R);let B=document.createElement("div");N.forEach(T=>{B.style[T]=v[T]}),l||(u&&d!=null&&(d.innerText=""),Y.forEach(T=>{d.style[T]=m[T]}),d.appendChild(B));let X=[],$=!1,L=0;do{L++;const T=k.sheetName.next();if(!T.value)break;const M=document.createElement("div");if(M.style.display="none",!l){const Q=document.createElement("button");oe.forEach(xe=>{Q.style[xe]=j[xe]}),Q.addEventListener("click",xe=>{const Te=Q.getAttribute("data-sheet"),Ee=d.querySelector('div[data-sheet="'+Te+'"]');if(Ee){P.forEach(se=>{Q.style[se]=R[se]});const Oe=d.querySelector("[data-sheet-button-activate]");let ie=d.querySelector("[data-sheet-activate]");Ee.setAttribute("data-sheet-activate","1"),Ee.style.display="flex",Q.setAttribute("data-sheet-button-activate","1"),Oe&&(oe.forEach(se=>{Oe.style[se]=j[se]}),Oe.removeAttribute("data-sheet-button-activate")),ie&&(ie.style.display="none",ie.removeAttribute("data-sheet-activate"))}else console.error("Sheet content not found!! id is "+Te)}),Q.setAttribute("data-sheet",L+""),M.setAttribute("data-sheet",L+""),Q.innerText=T.value[1]||T.value[0],B.appendChild(Q),d.appendChild(M)}let V=n?"th":"td";const W=document.createElement("table");U.forEach(Q=>{W.style[Q]=i[Q]});const K=k.data[T.value[0]]||k.data[T.value[1]],we=k.maxLengthOfColumn[T.value[0]]||k.maxLengthOfColumn[T.value[1]];if(Array.isArray(K)){const Q=K.length;for(let xe=0;xe{be.style[he]=f[he]}),be.innerText=se,Ee.appendChild(be)}W.appendChild(Ee),V="td"}}l?X.push(W):(M.appendChild(W),d==null||d.appendChild(M)),$=T.done}while(!$);if(l)return X;{const T=d.querySelector('div[data-sheet="1"]');T&&(T.style.display="flex",T.setAttribute("data-sheet-activate","1"));const M=d.querySelector('button[data-sheet="1"]');return M&&(P.forEach(V=>{M.style[V]=R[V]}),M.setAttribute("data-sheet-button-activate","1")),"Done"}}async function ho(e,t,r=!0,o="property"){let n=await new Promise((u,m)=>ge(["./read-utils-pmXAaVV2"],u,m)).then(async u=>await u.extractExcelData(e,!1,t)),l={},g=[];return Object.keys(n.sheetNameObject).forEach(u=>{const m=n.sheetNameObject[u],i=n.data[m]||n.data[u],f=n.maxLengthOfColumn[m]||n.maxLengthOfColumn[u];for(let R=0;R<=f;R++)g[R]=o+(R+1);let v=r,j=[];i.forEach(R=>{let k={};R.forEach((d,Y)=>{typeof d=="string"&&(v?g[Y]=d:k[g[Y]]=d)}),v=!1,j.push(k)}),l=Object.assign(l,{[m]:j})}),l}const uo=vt,yo=oo;function go(e,t,r={}){const o=Zt(e,t,r.keepStyle,r.rowHeightScaleFunction,r.colWidthScaleFunction);return Be(o)}function xo(e){const t=lo(e);return Be(t)}function bo(e,t){return Be(Ut(e,t))}function Co(e,t=!1,r){return new Promise((o,n)=>ge(["./read-utils-pmXAaVV2"],o,n)).then(o=>o.extractExcelData(e,t,r))}function vo(e,t=!1){return Ot(e,t,!1)}function wo(e,t=!1){return Ot(e,t,!0)}function To(e,t,r,o={...Ft}){return o={...Ft,...o},po(e,t,r,o.fetchFunc,o.firstHeader,o.returnTableNodes,o.emptyNodeDefaultString,o.removeContainerChildNode,o.containerNodeStyle,o.tableStyle,o.cellStyle,o.buttonContainerStyle,o.buttonStyle,o.activeButtonStyle)}ae.addGlobalOptionFromExcelTable=yo,ae.addGlobalOptions=uo,ae.cols=bt,ae.convertTableToExcel=go,ae.excelToJson=ho,ae.excelToNode=To,ae.extractExcelData=Co,ae.generateCSV=vo,ae.generateExcel=Be,ae.generateText=wo,ae.getColRowBaseOnRefString=Ae,ae.replaceInExcel=Wt,ae.sideBySideLineByLine=xo,ae.themeBaseGenerate=bo,ae.validateExcelTable=fo}); diff --git a/dist/index-DMAk0ysA.js b/dist/index-DMAk0ysA.js deleted file mode 100644 index d527ce9..0000000 --- a/dist/index-DMAk0ysA.js +++ /dev/null @@ -1,2479 +0,0 @@ -function Rt(e) { - return e.replace(/ /g, ""); -} -function Dt(e) { - if (e = e.replace(/^#/, ""), e.length == 3) { - const t = e.charAt(0), r = e.charAt(1), o = e.charAt(2); - return t + t + r + r + o + o; - } else - return e; -} -function Yt(e) { - /^#?([a-f\d]{3})$/i.test(e) && (e = Dt(e)); - var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); - return t ? [ - parseInt(t[1], 16), - parseInt(t[2], 16), - parseInt(t[3], 16) - ] : [0, 0, 0]; -} -function kt(e) { - const t = Yt(e); - return t == null ? void 0 : (0.299 * t[0] + 0.587 * t[1] + 0.114 * t[2]) / 255 > 0.5 ? "rgb(0,0,0)" : "rgb(255,255,255)"; -} -function Ot(e) { - /^#?([a-f\d]{3})$/i.test(e) && (e = Dt(e)); - var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); - return t ? "rgb(" + (255 - parseInt(t[1], 16)) + "," + (255 - parseInt(t[2], 16)) + "," + (255 - parseInt(t[3], 16)) + ")" : "rgb(0,0,0)"; -} -function et(e) { - e = Number(e); - var t = e.toString(16); - return t.length == 1 ? "0" + t : t; -} -function me(e) { - e = Rt(e); - let t = e.indexOf("rgba") >= 0 ? e.substring(5, e.length - 1).split(",") : e.substring(4, e.length - 1).split(","), r = t.reduce((o, n) => o && !Number.isNaN(Number(n)), !0); - return t.length == 4 && t[3] == "0" || t.length != 3 && t.length != 4 || !r ? null : (et(t[0]) + et(t[1]) + et(t[2])).toUpperCase(); -} -function he(e, t) { - if (typeof e > "u" || e === null) - return null; - if (!t) { - let r = Rt(e); - r.indexOf("var(") == 0 && r.lastIndexOf(")") == r.length - 1 && (r = r.substring(4, r.length - 1), e = getComputedStyle(document.documentElement).getPropertyValue( - r - )); - } - if (e.indexOf("rgb") >= 0) { - const r = me(e); - e = r || ""; - } - return e.replace(/^#/, ""); -} -function Vt(e) { - let t = ""; - return e.indexOf("_") > 0 ? e.replace(/[a-z]/g, "").length == e.length ? t = e.split(/_/).reduce((r, o) => r + o.charAt(0) + o.substring(1).toLowerCase() + " ", "").trim() : t = e.replace(/_/g, " ").trim() : (t = e.replace(/([A-Z])/g, " $1").trim(), t = t.charAt(0).toUpperCase() + t.substring(1).trim()), t; -} -function Ft(e, t) { - let r = Object.keys(e).filter((l) => !t.includes(l)), o = []; - return r.reduce((l, g) => (l.push({ - label: g, - text: Vt(g) - }), l), o); -} -const tt = { - fileName: "MR-Excel", - headerBackgroundColor: "#393E46", - headerColor: "#EEEEEE", - negativeColor: !1, - rowBackgroundColor: "#EEEEEE", - rowColor: "#393E46", - filterKeys: [] -}, zt = function(e, t = { - ...tt -}) { - let r; - if (typeof e == "object" && Array.isArray(e)) - if (e.length > 0) - if (Array.isArray(e[0])) { - let m = []; - for (let s = 0; s < e.length; s++) { - const f = e[s]; - if (f.length > 0) { - const v = Ft( - f[0], - Array.isArray(t.filterKeys) ? t.filterKeys : [] - ); - m.push({ - headers: v, - data: f - }); - } - } - r = { - sheet: m - }; - } else - e.length > 0 ? r = { - sheet: [ - { - headers: Ft( - e[0], - Array.isArray(t.filterKeys) ? t.filterKeys : [] - ), - data: e - } - ] - } : r = { - sheet: [] - }; - else - r = { - sheet: [] - }; - else - r = e; - let o = t && t.headerBackgroundColor ? t.headerBackgroundColor : tt.headerBackgroundColor, n = t && t.rowBackgroundColor ? t.rowBackgroundColor : tt.rowBackgroundColor, l = t && t.negativeColor ? Ot(o) : t && t.headerColor ? t.headerColor : kt(o), g = t && t.negativeColor ? Ot(n) : t && t.rowColor ? t.rowColor : kt(n); - typeof r.styles > "u" && (r.styles = {}), r.styles.themeStyleHeader = { - backgroundColor: o, - color: l - }, r.styles.themeStyleBody = { - backgroundColor: n, - color: g - }; - const u = r.sheet.length; - for (let m = 0; m < u; m++) - r.sheet[m].styleCellCondition = function(s, f, v, D, j, S) { - return j ? "themeStyleHeader" : "themeStyleBody"; - }; - return typeof (t == null ? void 0 : t.fileName) == "string" && (r.fileName = t.fileName), r; -}; -async function po(e, t, r) { - let o = {}; - const l = (await import("./jszip.min-D-TEDr9v.js").then((m) => m.j)).default; - let g; - if (typeof e == "string" && e.length) { - let m, s = !1; - typeof (r == null ? void 0 : r.fetch) == "function" ? (m = r == null ? void 0 : r.fetch, s = !0) : m = fetch, g = await m(e).then((f) => { - if (f == null || f == null) - throw "response is null"; - return s ? f : r != null && r.backend ? f.arrayBuffer() : f.blob(); - }); - } else - g = r == null ? void 0 : r.data; - let u = await l.loadAsync(g).then(async function(m) { - let s = Object.keys(m.files).filter( - (f) => f.indexOf("xl/worksheets/") == 0 && f.length - 4 == f.lastIndexOf(".xml") || f == "xl/sharedStrings.xml" - ); - for (let f = 0; f < s.length; f++) { - const v = s[f]; - await m.files[v].async("string").then((D) => { - let j = D; - Object.keys(t).forEach((S) => { - var d; - j = j.replace( - new RegExp("{{" + S + "}}", "g"), - (d = t[S]) == null ? void 0 : d.toString() - ); - }), o[v] = j; - }); - } - return m; - }); - if (Object.keys(o).forEach((m) => { - u.file(m, o[m]); - }), r != null && r.backend) - return u.generateAsync({ - type: r.generateType ? r.generateType : "nodebuffer" - }).then((m) => m); - if (r != null && r.notSave) - return u.generateAsync({ type: "blob" }).then((m) => m.slice( - 0, - m.size, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - )); - { - let m = await u.generateAsync({ type: "blob" }); - (await import("./FileSaver.min-BEH1o5YI.js").then((f) => f.F)).saveAs( - m, - (r != null && r.fileName ? r == null ? void 0 : r.fileName : "tableRecord") + ".xlsx" - ); - } -} -function Ut(e, t, r, o, n, l, g, u) { - let m = [], s = "both", f = []; - !t || t === 0 ? (t = 1, s = "col") : f.push(t - 1), !e || e === 0 ? (e = 0, s = "row") : f.push(e - 1); - let v = n || {}; - v.mergeType = u && u.mergeType ? [...u.mergeType, s] : [s], v.mergeValue = u && u.mergeValue ? [...u.mergeValue, f] : [f], v.mergeStart = u && u.mergeStart ? [...u.mergeStart, r] : [r]; - for (let D = 0; D < t; D++) { - let j = e; - for (let S = 0; S < o; S++) - r <= S ? j >= 1 ? (v["c" + S] = l, l = "", g += "*", j--) : t >= 2 && r == S ? (v["c" + S] = l, l = "", g += "+") : g += "-" : D > 0 && (g += "-"); - m.push({ - ...v, - mergeString: g - }), v = {}, g = ""; - } - return m; -} -function Wt(e, t, r, o, n) { - var v; - if (!e && !t) - throw "Error: One of the function inputs is required."; - let l; - e ? l = (v = document.querySelector(e)) == null ? void 0 : v.querySelectorAll("tr") : l = t == null ? void 0 : t.querySelectorAll("tr"); - let g = [], u = [], m = { - header: {}, - rows: [] - }, s = 40; - if (l) { - let D = !1, j = 0; - l.forEach((S, d) => { - var G = [].slice.call(S.children); - const z = window.getComputedStyle(S, null); - let Z = me(z.backgroundColor); - if (!D) - j = G.length, D = !0, typeof o == "function" ? s = o( - Number(z.height.substring(0, z.height.length - 2)), - d, - !0 - ) : s = Number( - z.height.substring(0, z.height.length - 2) - ), G.forEach((N, oe) => { - let P = window.getComputedStyle(N, null), B = null; - if (P.borderBottomWidth !== "0px") { - const U = me(P.borderBottomColor); - U && (B || (B = {}), B.bottom = { - style: "thin", - color: U - }); - } - if (P.borderTopWidth !== "0px") { - const U = me(P.borderTopColor); - U && (B || (B = {}), B.top = { - style: "thin", - color: U - }); - } - if (P.borderLeftWidth !== "0px") { - const U = me(P.borderLeftColor); - U && (B || (B = {}), B.left = { - style: "thin", - color: U - }); - } - if (P.borderRightWidth !== "0px") { - const U = me(P.borderRightColor); - U && (B || (B = {}), B.right = { - style: "thin", - color: U - }); - } - let X = me(P.backgroundColor); - !X && Z && (X = Z); - const K = parseInt( - P.fontSize.substring(0, P.fontSize.indexOf("p")) - ); - let L = { - ...X ? { backgroundColor: X } : {}, - bold: parseInt(P.fontWeight) > 500, - ...isNaN(K) ? {} : { size: K }, - ...B ? { border: B } : {}, - alignment: { - ...typeof P.textAlign == "string" && P.textAlign.length > 0 ? { horizontal: P.textAlign } : {}, - vertical: "center", - ...P.direction == "rtl" ? { rtl: !0 } : { ltr: !0 } - } - }; - m.header[d + "-" + oe] = L; - let E; - typeof n == "function" ? E = n( - Number(P.width.substring(0, P.width.length - 2)), - oe - ) : E = Number(P.width.substring(0, P.width.length - 2)) * 0.15; - const $ = N.getAttribute("colspan"), q = N.getAttribute("rowspan"); - g.push({ - label: "c" + oe, - ...$ ? { colspan: $ } : {}, - ...q ? { rowspan: q } : {}, - text: N.textContent, - ...isNaN(E) || E <= 0 ? {} : { size: E } - }); - }); - else { - let N = {}, oe = "", P = !1; - u.length >= d && (N = u[d - 1], oe = "mergeString" in N ? N.mergeString : "", P = !0); - let B = 0; - G.forEach((X, K) => { - if ("c" + (K + B) in N) - for (let M = 0; M <= j + 1 && "c" + (K + M) in N; M++) - B++; - K += B; - let L = window.getComputedStyle(X, null); - if (X.getAttribute("colspan") || X.getAttribute("rowspan")) { - let M = Ut( - X.getAttribute("colspan") * 1, - X.getAttribute("rowspan") * 1, - K, - j, - N, - X.textContent, - oe, - N - ); - u.length < d ? u.push(...M) : M.forEach((Ce, J) => { - u.length < d + J ? u.push(...M) : u[d + J] = { - ...u[d + J], - ...Ce - }; - }), N = M[0], oe = M[0].mergeString, P = !0; - } else - P || (oe += "-"); - let E = null; - if (L.borderBottomWidth !== "0px") { - const M = me(L.borderBottomColor); - M && (E || (E = {}), E.bottom = { - style: "thin", - color: M - }); - } - if (L.borderTopWidth !== "0px") { - const M = me(L.borderTopColor); - M && (E || (E = {}), E.top = { - style: "thin", - color: M - }); - } - if (L.borderLeftWidth !== "0px") { - const M = me(L.borderLeftColor); - M && (E || (E = {}), E.left = { - style: "thin", - color: M - }); - } - if (L.borderRightWidth !== "0px") { - const M = me(L.borderRightColor); - M && (E || (E = {}), E.right = { - style: "thin", - color: M - }); - } - let $ = me(L.backgroundColor); - !$ && Z && ($ = Z); - const q = parseInt( - L.fontSize.substring(0, L.fontSize.indexOf("p")) - ); - let U = { - ...$ ? { backgroundColor: $ } : {}, - bold: parseInt(L.fontWeight) > 500, - ...isNaN(q) ? {} : { size: q }, - ...E ? { border: E } : {}, - alignment: { - ...typeof L.textAlign == "string" && L.textAlign.length > 0 ? { horizontal: L.textAlign } : {}, - vertical: "center", - ...L.direction == "rtl" ? { rtl: !0 } : { ltr: !0 } - } - }; - m.header[d + "-" + K] = U, N["c" + K] = X.textContent; - }), typeof o == "function" ? N.height = o( - Number(z.height.substring(0, z.height.length - 2)), - d, - !1 - ) : N.height = z.height.substring(0, z.height.length - 2), typeof N.height == "string" && N.height.length == 0 && delete N.height, u.length < d ? u.push(N) : u[d - 1] = N; - } - }); - } else - throw "Error: DOM Element Not Found"; - return { - styles: m.header, - sheet: [ - { - ...s ? { headerHeight: s } : {}, - styleCellCondition: function(D, j, S, d, G, z) { - return r ? z.includes(S - 1 + "-" + d) ? S - 1 + "-" + d : "" : null; - }, - data: u, - headers: g - } - ] - }; -} -function Ke(e, t, r = "", o = [], n = -1) { - const l = e.length; - for (let g = 0; g < l; g++) - o.push(r + e[g]); - return t < o.length ? o : Ke( - e, - t, - o[n + 1], - o, - n + 1 - ); -} -function Gt(e, t) { - return ` -` + (e.format.count > 0 ? '' + e.format.value + "" : "") + '' + e.font.value + '' + e.fill.value + '' + e.border.value + '' + e.cell.value + ' ' + (t ? '' + e.conditionalFormatting.value + "" : '') + ""; -} -function Zt(e, t, r, o, n, l, g) { - let u = {}; - return ` -` + r.reduce((m, s) => (s = s.toLowerCase(), u[s] ? m : s == "svg" ? (u.png = !0, u.svg = !0, m + '') : s == "jpeg" || s == "jpg" ? (u.jpeg = !0, u.jpg = !0, m + '') : (u[s] = !0, m + '')), "") + t.reduce((m, s) => m + '', "") + e + (g.length > 0 ? g.reduce((m, s) => m + '', "") : "") + '' + (l ? '' : "") + '' + o.reduce((m, s) => m + '', "") + (n.length > 0 ? n.reduce((m, s, f) => m + '', "") : "") + ''; -} -function Xt(e, t) { - return ` -Microsoft Excel0falseWorksheets` + e + ' ' + t + "falsefalsefalse16.0300"; -} -function ot(e, t, r, o) { - e = e.toUpperCase(); - let n = ""; - if (t.formula) { - let s = t, f = s.formula.indexOf("=") == 0 ? s.formula.substring(1) : s.formula, v = e.indexOf(":") > 0, D = s.referenceCells ? s.referenceCells : e, j = v ? e.substring(0, e.indexOf(":")) : e, S = j.replace(/[0-9]/g, ""), d = parseInt(e.substr(S.length)), G = s.returnType ? s.returnType : s.isArray || v ? ' t="str"' : "", z = "styleId" in s && o && typeof s.styleId == "string" && o[s.styleId] ? ' s="' + o[s.styleId].index + '"' : "", Z = s.isArray || v ? ' t="array" ref="' + D + '"' : ""; - return n = '" + f + "", { - column: S, - row: d, - needCalcChain: !1, - isCustom: !0, - cell: n - }; - } - let l = e.replace(/[0-9]/g, ""), g = parseInt(e.substr(l.length)), u = !1, m = ""; - if (t.noArgType) { - const s = t; - if (s.noArgType == "NOW" || s.noArgType == "TODAY") { - const f = "styleId" in s && o && typeof s.styleId == "string" && o[s.styleId] ? ' s="' + o[s.styleId].index + '"' : ""; - n = '" + s.noArgType + "()"; - } else { - let f = "NOW()"; - const v = "styleId" in s && o && typeof s.styleId == "string" && o[s.styleId] ? ' s="' + o[s.styleId].index + '"' : ""; - n = '" + s.noArgType.substring(4) + "(" + f + ")"; - } - m = '', u = !0; - } else if (t.referenceCell) { - const s = t; - let f = ""; - typeof s.value < "u" && (f = "," + s.value); - let v = ""; - s.type == "COT" && (v = "_xlfn."); - const D = "styleId" in s && o && typeof s.styleId == "string" && o[s.styleId] ? ' s="' + o[s.styleId].index + '"' : ""; - n = '" + v + s.type + "(" + s.referenceCell.toUpperCase() + f + ")", m = '', u = !0; - } else { - const s = t; - n = '" + s.type + "(" + s.start.toUpperCase() + ":" + s.end.toUpperCase() + ")"; - } - return { - column: l, - row: g, - cell: n, - needCalcChain: u, - chainCell: m - }; -} -function rt(e, t, r) { - let o = !1, n, l; - if (typeof e == "object") { - if ("author" in e && e.author && (o = !0, l = e.author), "styleId" in e && typeof e.styleId == "string") { - let g = t[e.styleId]; - typeof g == "string" && (r = g); - } - n = "comment" in e && typeof e.comment == "string" ? At(e.comment) : [""]; - } else - n = e ? At(e) : [""]; - return o && n.unshift(l + ":"), { - hasAuthor: o, - author: l, - commentStyle: r, - commentStr: n - }; -} -function At(e) { - var t = e.split(/\r?\n|\r|\n/g); - return t; -} -function nt(e, t, r, o) { - let n = '', l = ""; - return t.forEach((g, u) => { - let m = ""; - if (g.length == 0) { - l += ` -`; - return; - } - u > 0 && (m = ' xml:space="preserve"', l += ` -`), n += "" + r + "" + l + g + "", l = ""; - }), l.length > 0 && n.indexOf("") > 0 && (n = n.substring(0, n.length - 8) + l + ""), n += "", n; -} -const Jt = '', $e = function(e) { - return e.replace(/\&/g, "&").replace(/\/g, ">"); -}; -function lt(e, t, r) { - let o = ""; - return e.forEach((n) => { - typeof n.value == "string" && (n.value = $e(n.value)), o += "" + (n.styleId && t[n.styleId] ? t[n.styleId] : t[r]) + '' + n.value + ""; - }), "" + o + ""; -} -const Lt = { - time: { - key: 165, - value: '' - }, - date: { - key: 187, - value: '' - }, - short_date: { - key: 14 - }, - fraction: { - key: 13 - }, - percentage: { - key: 9 - }, - float_1: { key: 180, value: '' }, - float_2: { key: 181, value: '' }, - float_3: { - key: 164, - value: '' - }, - float_4: { - key: 182, - value: '' - }, - dollar_rounded: { - key: 183, - value: '' - }, - dollar_2: { - key: 183, - value: '' - }, - num_sep: { - key: 184, - value: '' - }, - num_sep_1: { - key: 185, - value: '' - }, - num_sep_2: { - key: 186, - value: '' - }, - dollar: { - key: 163, - value: '' - }, - $: { - key: 163, - value: '' - }, - pound: { - key: 162, - value: '' - }, - "Β£": { - key: 162, - value: '' - }, - euro: { - key: 161, - value: '' - }, - "€": { - key: 161, - value: '' - }, - yen: { - key: 160, - value: '' - }, - "Β₯": { - key: 160, - value: '' - }, - CHF: { - key: 179, - value: '' - }, - ruble: { - key: 178, - value: '' - }, - "β‚½": { - key: 178, - value: '' - }, - "֏": { - key: 177, - value: '' - }, - manat: { - key: 176, - value: '' - }, - "β‚Ό": { - key: 176, - value: '' - }, - "β‚Ό1": { - key: 175, - value: '' - }, - "β‚½1": { - key: 174, - value: '' - }, - "β‚½2": { - key: 173, - value: '' - }, - "β‚½3": { - key: 172, - value: '' - }, - Ψ±ΩŠΨ§Ω„: { - key: 171, - value: '' - } -}, Qt = [ - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z" -], _t = (e, t, r = !1, o) => { - let n, l = !1; - return typeof o == "function" ? (n = o, l = !0) : n = fetch, n(e).then((g) => l ? g : r ? g.arrayBuffer() : g.blob()).then((g) => l || r ? g : new File([g], t)).catch((g) => { - throw g; - }); -}; -function Re(e, t) { - e = e.toUpperCase(); - let r = e.replace(/[0-9]/g, ""); - if (r.length == 0) - throw "Invalid Column"; - let o = parseInt(e.substring(r.length)); - if (isNaN(o)) - throw "Invalid Row"; - o = Math.max(0, o - 1); - let n = t.indexOf(r); - return n < 0 && (t = Ke(t, Math.pow(10, r.length + 1), ""), n = t.indexOf(r), n < 0 && (n = 0)), { - col: n, - row: o - }; -} -let eo = {}, at = new Proxy(eo, { - get(e, t) { - return t in e ? e[t] : (this.set(e, t, {}, !0), {}); - }, - set(e, t, r, o) { - return e[t] = r, !0; - } -}); -function Ht(e, t, r) { - at[e], at[e][t] = r; -} -function Nt(e, t, r) { - Object.keys(r).forEach((n) => { - const l = r[n]; - typeof l == "object" ? n != "data" && n != "headers" && Nt(e, t.length > 0 ? t + "." + n : n, l) : Ht(e, t.length > 0 ? t + "." + n : n, l); - }); -} -function to(e, t) { - Nt(e, "", t); -} -function oo(e, t) { - let r = t, o = at[e]; - return Object.keys(o).forEach((l) => { - const g = l.split("."); - let u = r, m = o[l]; - for (let s = 0; s < g.length; s++) { - const f = g[s]; - u[f] ? u = u[f] : g.length - 1 == s ? u[f] = m : (u[f] = {}, u = u[f]); - } - }), r; -} -function ro(e) { - if (!Array.isArray(e) || !e.length) - return ""; - const t = e.length; - let r = ""; - for (let o = 0; o < t; o++) { - const n = e[o], l = n.for.reduce((u, m) => u + " " + m, ""), g = n.option.join(","); - r += '"' + g + """; - } - return r += "", r; -} -async function ct(e, t = "") { - if (typeof t == "string" && t.length > 0 && (e = oo(t, e)), typeof e.creator == "string" && e.creator.trim().length <= 0) - throw 'length of "creator" most be bigger then 0'; - if (typeof e.created == "string" && new Date(e.created).toString() == "Invalid Date") - throw '"created" is not valid date'; - if (typeof e.modified == "string" && new Date(e.modified).toString() == "Invalid Date") - throw '"modified" is not valid date'; - let r = Lt; - e.formatMap && typeof e.formatMap == "object" && (r = { - ...r, - ...e.formatMap - }); - const o = e.backend, n = { - lt: "lessThan", - gt: "greaterThan", - between: "between", - ct: "containsText", - eq: "equal" - }; - let l = [...Qt]; - e.numberOfColumn && e.numberOfColumn > 25 && (l = Ke(l, e.numberOfColumn)); - const u = (await import("./jszip.min-D-TEDr9v.js").then((w) => w.j)).default; - let m = new u(); - e.sheet || (e.sheet = [ - { - headers: [], - data: [] - } - ]); - const s = e.sheet.length; - let f = m.folder("xl"), v = null, D = null, j = null; - e.styles || (e.styles = {}), e.addDefaultTitleStyle && (e.styles.titleStyle = { - alignment: { - horizontal: "center", - vertical: "center" - } - }); - const S = Object.keys(e.styles), d = Jt, G = e.activateConditionalFormatting ? e.activateConditionalFormatting : !1, z = {}, Z = {}; - let N = S.reduce( - (w, a, b) => { - const x = e.styles[a]; - if (x.type && (x.type == "headerFooter" || x.type == "HF")) { - let C = "", W = "-", ce = "Regular"; - if (x.fontFamily && (W = x.fontFamily), x.bold && (ce = "Bold"), x.italic && (ce == "Regular" && (ce = ""), ce += "Italic"), (W != "-" || ce != "Regular") && (C = '&"' + W + "," + ce + '"'), x.size && (C += "&" + x.size), x.doubleUnderline ? C += "&E" : x.underline && (C += "&U"), x.color) { - const Te = he(x.color, o); - typeof Te == "string" && Te.length > 0 && (C += "&K" + Te.toUpperCase()); - } - return z[a] = C, w; - } - if (G && typeof x.type == "string" && x.type && (x.type == "conditionalFormatting" || x.type.toUpperCase() == "CF")) { - Z[a] = w.conditionalFormatting.count; - let C = he(x.color, o), W = he(x.backgroundColor, o); - return w.conditionalFormatting.value += ' ', w.conditionalFormatting.count++, w; - } - const Y = { - fillIndex: 0, - fontIndex: 0, - borderIndex: 0, - formatIndex: 0 - }; - if (x.backgroundColor) { - let C = he(x.backgroundColor, o); - Y.fillIndex = w.fill.count, w.fill.count++, w.fill.value = w.fill.value + '' + (C ? '' : "") + ""; - } - if (x.color || x.fontFamily || x.size || x.bold || x.italic || x.underline || x.doubleUnderline) { - const C = he(x.color, o); - Y.fontIndex = w.font.count, w.font.count++, w.font.value = w.font.value + "" + (x.bold ? "" : "") + (x.italic ? "" : "") + (x.underline || x.doubleUnderline ? "" : "") + (x.size ? '' : "") + (C ? '' : "") + (x.fontFamily ? '' : "") + "", w.commentSyntax.value[a] = "" + (x.bold ? "" : "") + (x.italic ? "" : "") + (x.underline || x.doubleUnderline ? "" : "") + '' + (C ? '' : "") + ''; - } - let se = "/>"; - x.alignment && (x.alignment.rtl && (x.alignment.readingOrder = 2), delete x.alignment.rtl, x.alignment.ltr && (x.alignment.readingOrder = 1), delete x.alignment.ltr, se = ' applyAlignment="1"> C + " " + W + '="' + x.alignment[W] + '" ', "") + " />"); - const H = x.border; - let k = ""; - if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.top || H.full) && (k += ''), (H.bottom || H.full) && (k += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { - const C = r[x.format]; - C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); - } - return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; - }, - { - conditionalFormatting: { - count: G ? 1 : 0, - value: ' ' - }, - commentSyntax: { - value: {} - }, - format: { - count: 0, - value: "" - }, - border: { - count: 1, - value: "" - }, - fill: { - count: 2, - value: "" - }, - font: { - count: 2, - value: "" - }, - cell: { - count: 2, - value: "" - } - } - ); - f == null || f.file("styles.xml", Gt(N, G)); - let oe = '', P = "", B = 0, X = "", K = "", L = {}; - const E = {}; - let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; - const ye = { - checkbox: ` -` - }; - let ve = 1024; - const we = { - checkbox: ` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
` - }, Se = { - checkbox: ` - - - - ` - }; - let ae = [], ie = "", ge = !1, de = null; - for (let w = 0; w < s; w++) { - const a = e.sheet[w], b = w + 1; - let x = {}, Y = { - start: "", - end: "" - }; - const se = a.asTable; - let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( - [], - a.conditionalFormatting - ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; - if (a.rtl && (Ee += ' rightToLeft="1" '), a.pageBreak) { - const T = a.pageBreak; - if (T.row && Array.isArray(T.row)) { - _e = "pageBreakPreview"; - const i = T.row.length; - Ze += '' + T.row.reduce( - (y, p) => y + '', - "" - ) + ""; - } - if (T.column && Array.isArray(T.column)) { - _e = "pageBreakPreview"; - const i = T.column.length; - Ze += '' + T.column.reduce( - (y, p) => y + '', - "" - ) + ""; - } - } - let gt = ""; - if (a.pageOption) { - const T = a.pageOption; - if (T.isPortrait && (je = !0), T.margin) { - const F = T.margin; - let A = { - left: 0.7, - right: 0.7, - top: 0.75, - bottom: 0.75, - header: 0.3, - footer: 0.3 - }; - Object.keys(A).forEach((h) => { - typeof F[h] == "number" && (A[h] = F[h]); - }), gt = ''; - } - let i = "", y = "", p = "", c = ""; - if (["header", "footer"].forEach((F) => { - const A = F.charAt(0).toUpperCase() + F.substring(1); - if (T[F]) { - const h = T[F]; - typeof h == "object" && Object.keys(h).forEach((O) => { - i.indexOf(O) < 0 && (i += O); - const le = h[O]; - let V = ""; - if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { - const I = le[R]; - V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); - }), V = "<" + O + A + ">" + V + "", O == "odd") - y += V; - else if (O == "even") - p += V; - else if (O == "first") - c += V; - else - throw "type error"; - }); - } - }), Pe = y + p + c, Pe.length > 0) { - je = !0; - const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; - Pe = "" + Pe + ""; - } - } - if (a.viewOption) { - let T = ""; - const i = a.viewOption; - i.type && (_e = i.type), i.hideRuler && (Ee += ' showRuler="0" '), i.hideGrid && (Ee += ' showGridLines="0" '), i.hideHeadlines && (Ee += ' showRowColHeaders="0" '); - let y = i.splitOption; - if (typeof y > "u" && (je = !1, typeof i.frozenOption == "object")) { - const p = i.frozenOption; - if (T = ' state="frozen" ', p.type == "R" || p.type == "ROW") { - let c; - typeof p.index == "object" ? c = p.index.r : c = p.index, y = { - startAt: { - b: "A" + (c + 1) - }, - type: "H", - split: c - }; - } else if (p.type == "C" || p.type == "COLUMN") { - let c; - typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { - type: "V", - startAt: { - r: l[c] + 1 - }, - split: c - }; - } else if (p.type == "B" || p.type == "BOTH") { - let c = "", _; - typeof p.index == "number" ? (_ = p.index, c = l[p.index] + (p.index + 1)) : (_ = { - y: p.index.r, - x: p.index.c - }, c = l[p.index.c] + (p.index.r + 1)), y = { - startAt: { - two: c - }, - type: "B", - split: _ - }; - } - } - if (y) - if (y.type == "H" || y.type == "HORIZONTAL") { - let p; - y.startAt && (p = y.startAt.b, y.startAt.t && (Ee += ' topLeftCell="' + y.startAt.t + '"')), p || (p = "A1"), Te = '"; - } else if (y.type == "V" || y.type == "VERTICAL") { - let p; - y.startAt && (p = y.startAt.r, y.startAt.l && (Ee += ' topLeftCell="' + y.startAt.l + '"')), p || (p = "A1"), Te = '"; - } else { - let p; - y.startAt && (p = y.startAt.two, y.startAt.one && (Ee += ' topLeftCell="' + y.startAt.one + '"')), p || (p = "A1"), Te = '"; - } - } - if (je && (_e = "pageLayout"), a.checkbox) { - ze = !0; - const T = ye.checkbox; - a.checkbox.forEach((i, y) => { - let p = T; - if (i.link) { - let O = Re(i.link, l); - p = p.replace( - "**fmlaLink**", - 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' - ); - } else - p = p.replace("**fmlaLink**", ""); - i.mixed ? p = p.replace("**value**", 'checked="Mixed"') : i.checked ? p = p.replace("**value**", 'checked="Checked"') : p = p.replace("**value**", ""), i.threeD && p.replace('noThreeD="1"', ""), ae.push(p), ve++; - let c = w + "" + ve++; - const _ = "_x0000_s" + c; - pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); - let F = i.startStr, A = i.endStr, h = { - start: { - col: 0, - row: 0 - }, - end: { - col: 1, - row: 1 - } - }; - if (i.col && i.row && (h = { - start: { - col: i.col, - row: i.row - 1 - }, - end: { - col: i.col, - row: i.row - } - }), typeof F == "string" && F.length >= 2) { - let O = Re(F, l); - h.start = { - ...O - }, h.end = { - col: O.col + 1, - row: O.row + 1 - }; - } - if (typeof A == "string" && A.length >= 2) { - let O = Re(A, l); - O.row += 1, O.col += 1, h.end = { - ...O - }; - } - ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; - }); - } - let Xe; - if (a.backgroundImage) { - v == null && (v = f == null ? void 0 : f.folder("media")); - const T = a.backgroundImage; - Xe = new Promise(async (i, y) => { - let p = T.lastIndexOf("."), c; - p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; - const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); - A || y("image not load"), Ce.push(c), i({ - name: F, - type: c, - image: A, - ref: _ - }); - }); - } - let Je; - if (a.images && (v == null && (v = f == null ? void 0 : f.folder("media")), Je = Promise.all([ - ...a.images.map(async (T, i) => { - let y = T.url.lastIndexOf("."), p; - y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); - const c = "image" + J++ + "." + p; - return { - type: p, - image: await _t(T.url, c, o, e.fetch), - obj: T, - i, - name: c - }; - }) - ])), Array.isArray(a.headers) && a.headers.length) { - const T = a.headers.length; - let i = ""; - if (a.title) { - const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); - if (xe.push( - I + ":" + l[h + le - 1] + (k + O + F) - ), typeof _ < "u") { - Ie = !0; - const Q = rt( - _, - N.commentSyntax.value, - d - ); - let fe = pe.length; - if (Q.hasAuthor && typeof Q.author < "u") { - let ee = Q.author.toString(); - const re = pe.indexOf(ee); - re < 0 ? pe.push(ee) : fe = re; - } - He.push({ - row: k + F - 1, - col: h - }), Le += nt( - I, - Q.commentStr, - Q.commentStyle, - fe - ); - } - typeof c.text == "string" && (x[k + F] = { - startTag: '', - details: '' + B + "", - endTag: "" - }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( - c.multiStyleValue, - N.commentSyntax.value, - R - ) : P += "" + $e(c.text) + ""), k += F + O + 1; - } - let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; - if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { - if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( - c, - null, - _, - !0 - ) === !0 && (ke[l[_]] = { - inProgress: !0, - start: k - }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( - c, - c, - k, - _, - !0, - S - ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) - return; - const F = l[_] + "" + k; - if (typeof a.commentCondition == "function") { - const h = a.commentCondition( - c, - null, - c.label, - k, - _, - !0 - ); - (typeof h == "string" || typeof h == "object" && h != null) && (c.comment = h); - } - if (c.comment) { - Ie = !0; - const h = rt( - c.comment, - N.commentSyntax.value, - d - ); - let O = pe.length; - if (h.hasAuthor && typeof h.author < "u") { - let le = h.author.toString(); - const V = pe.indexOf(le); - V < 0 ? pe.push(le) : O = V; - } - He.push({ - row: k - 1, - col: _ - }), Le += nt( - F, - h.commentStr, - h.commentStyle, - O - ); - } - const A = ue && ue[F]; - if (A) { - const h = ot( - F, - A, - b, - e.styles - ); - h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; - } else { - if (C += '' + B + "", typeof a.multiStyleCondition == "function") { - const h = a.multiStyleCondition( - c, - null, - c.label, - k, - _, - !0 - ); - h && (c.multiStyleValue = h); - } - c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( - c.multiStyleValue, - N.commentSyntax.value, - y || "" - ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; - } - }), se && (H += ""), a.withoutHeader) - C += i; - else { - const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; - x[k] = { - startTag: c, - endTag: "", - details: C - }, C = i + c + C + "", k++; - } - if (Array.isArray(a.data)) { - const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; - a.data.forEach((h, O) => { - if (h.mergeType) - for (let I = 0; I < h.mergeType.length; I++) { - const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; - let re = ""; - Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); - } - const le = h.rowStyle, V = '", - details: R - }, k++, C += ""; - }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); - } - if (We.length > 0 && We.forEach((c) => { - const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; - ue[A + "" + k] = { - start: a.withoutHeader ? A + "1" : A + "2", - end: A + "" + (k - 1), - type: F.formula.type, - ...F.formula.styleId ? { styleId: F.formula.styleId } : {} - }; - }), Ge.length > 0 && Ge.forEach((c) => { - const _ = a.headers[c]; - _.conditionalFormatting && Ue.push({ - ..._.conditionalFormatting, - start: a.withoutHeader ? l[c] + "1" : l[c] + "2", - end: l[c] + "" + (k - 1) - }); - }), ue) { - const c = Object.keys(ue).sort( - (_, F) => _ > F ? 1 : -1 - ); - if (c.length) { - let _ = {}; - c.forEach((F) => { - const A = ot( - F, - ue[F], - b, - e.styles - ); - A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; - }), Object.keys(_).forEach((F) => { - const A = F, h = _[A]; - let O = x[A]; - if (O) { - const le = O.startTag + O.details + h + O.endTag; - let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); - C = C.replace(V, le); - } else - C += '' + h + "", x[A] = { - startTag: '', - endTag: "", - details: h - }; - }); - } - } - } - w > 0 && (oe += ''); - const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; - X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); - const bt = a.sortAndFilter ? 'filterMode="1"' : ""; - let Ct = -1; - Xe && await Xe.then((T) => { - let i = T; - Ct = i.ref, v == null || v.file(i.name, i.image); - }); - let Ne = !1, Qe = "", vt = ""; - Je && (Ne = !0, await Je.then((T) => { - let i = ""; - T.forEach((y, p) => { - const c = p + 1; - let _ = y.image; - const F = y.name; - let A = y.obj.from, h = y.obj.to, O = y.obj.margin; - y.type; - let le = y.obj.type, V = y.obj.extent; - typeof V > "u" && (V = { - cx: 2e5, - cy: 2e5 - }); - let R = { - start: { - col: 0, - row: 0, - mL: 0, - mT: 0 - }, - end: { - col: 1, - row: 1, - mR: 0, - mB: 0 - } - }; - if (typeof A == "string" && A.length >= 2) { - let I = Re(A, l); - R.start = { - ...I - }, R.end = { - col: I.col + 1, - row: I.row + 1 - }; - } - if (typeof h == "string" && h.length >= 2) { - let I = Re(h, l); - I.row += 1, I.col += 1, R.end = { - ...I - }; - } - R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; - }), vt = ` -` + i + ""; - })), xe = [...new Set(xe)]; - let wt = "", Ae = 1; - Ue.length > 0 && (wt = Ue.reduce((T, i) => { - if (i.type == "cells") - return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; - if (i.type == "top") - return T + '"; - if (i.type == "iconSet") { - let y = ""; - return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); - } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; - }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { - indexId: q + 1, - key: "sheet" + (w + 1), - sheetName: xt, - sheetDataTableColumns: H, - backgroundImageRef: Ct, - sheetDimensions: Y, - asTable: se || !1, - sheetDataString: C, - sheetDropDown: ro(a.dropDowns), - sheetBreakLine: Ze, - viewType: _e, - hasComment: Ie, - drawersContent: Qe, - cFDataString: wt, - sheetMargin: gt, - sheetHeaderFooter: Pe, - isPortrait: je, - drawersRels: vt, - hasImages: Ne, - hasCheckbox: ze, - formRel: ht, - checkboxDrawingContent: dt, - checkboxForm: ae, - checkboxSheetContent: ut, - checkboxShape: pt, - commentString: Le, - commentAuthor: pe, - shapeCommentRowCol: He, - splitOption: Te, - sheetViewProperties: Ee, - sheetSizeString: W.length > 0 ? "" + W + "" : "", - protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", - merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", - selectedView: !!a.selected, - sheetSortFilter: ce, - tabColor: a.tabColor ? '' : "' - }, q++; - } - ge && (q++, K += '', f == null || f.file( - "calcChain.xml", - ` -` + ie + "" - )); - let Mt = Object.keys(E), qe = m.folder("_rels"); - qe == null || qe.file( - ".rels", - ` - ` - ); - let Oe = m.folder("docProps"); - Oe == null || Oe.file( - "core.xml", - ` -` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" - ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( - "workbook.xml", - ` - ` + (U ? '' : "") + " " + X + " " - ), f == null || f.file( - "sharedStrings.xml", - ` - ' + P + "" - ); - let Ye = f == null ? void 0 : f.folder("_rels"); - Ye == null || Ye.file( - "workbook.xml.rels", - ` - ` + K + " " - ); - let Ve = f == null ? void 0 : f.folder("theme"); - Ve == null || Ve.file( - "theme1.xml", - ` -` - ); - let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; - if (Mt.forEach((w, a) => { - const b = E[w]; - let x = "", Y = { - form: !1, - drawing: !1, - vmlDrwing: !1, - comment: !1, - table: !1, - sheetDrawingsPushed: !1 - }; - const se = b.sheetDataTableColumns; - if (se.length > 0) { - mt.push("table" + (a + 1) + ".xml"); - const C = b.asTable, W = b.sheetDimensions; - de == null || de.file( - "table" + (a + 1) + ".xml", - ` -' + se + '
' - ), x += ''; - } - const H = "drawing" + (De.length + 1) + ".xml"; - if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( - H + ".rels", - b.drawersRels.toString() - ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( - H, - ` -` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" - )), b.hasComment) { - ft.push(a + 1); - let C = b.commentAuthor; - f == null || f.file( - "comments" + (a + 1) + ".xml", - ` -` + (Array.isArray(C) && C.length > 0 ? C.reduce( - (W, ce) => W + "" + ce + "", - "" - ) : "") + "" + b.commentString + "" - ), x += '' + (Y.vmlDrwing ? "" : ''); - } - if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( - "vmlDrawing" + (a + 1) + ".vml", - '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" - )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { - const C = Fe == null ? void 0 : Fe.folder("_rels"); - C == null || C.file( - "sheet" + (a + 1) + ".xml.rels", - ` - ` + x + "" - ); - } - let k = ""; - b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( - b.key + ".xml", - ` -` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" - ); - }), ae.length > 0) { - let w = f == null ? void 0 : f.folder("ctrlProps"); - ae.forEach((a, b) => { - w == null || w.file("ctrlProp" + (b + 1) + ".xml", a); - }); - } - if (m.file( - "[Content_Types].xml", - Zt( - oe, - ft, - [...new Set(Ce)], - De, - ae, - ge, - mt - ) - ), o) - return m.generateAsync({ - type: e.generateType ? e.generateType : "nodebuffer" - }).then((w) => w); - if (e.notSave) - return m.generateAsync({ type: "blob" }).then((w) => w.slice( - 0, - w.size, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - )); - m.generateAsync({ type: "blob" }).then(function(w) { - import("./FileSaver.min-BEH1o5YI.js").then((a) => a.F).then((a) => { - const { saveAs: b } = a; - b( - w, - (e.fileName ? e.fileName : "tableRecord") + ".xlsx" - ); - }); - }); -} -function no(e) { - const t = e.length; - let r = 0, o = {}, n = {}, l = {}; - for (let s = 0; s < t; s++) { - const f = e[s], v = f.length; - let D = {}; - for (let j = 0; j < v; j++) { - r++; - const S = f[j]; - let d; - S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { - headers: [], - data: [], - labelCounter: 0, - seenAt: s - }), d in n || (n[d] = { - index: s, - value: 0 - }), d in l || (o[d].labelCounter = 0, l[d] = !0); - let G = []; - const z = o[d].headers.length; - let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ - label: "c" + o[d].labelCounter, - text: N ? L.text : "" - }), Z["c" + o[d].labelCounter] = L.text, { - ...K, - [L.label]: "c" + o[d].labelCounter - }), {}); - if (o[d].headers.push(...G), S.spaceX) - for (let K = 0; K < S.spaceX; K++) - o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ - label: "c" + o[d].labelCounter, - text: "" - }); - n[d].index + 1 == s && (D[d] = n[d].value); - let P = D[d] || 0; - P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { - ...o[d].data[P], - ...Z - }, o[d].headerIndex = P, P++); - let B = Object.keys(oe), X = S.data.length >= o[d].data.length; - if (o[d].data = S.data.reduce((K, L, E) => { - let $ = {}; - return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { - let U = oe[q]; - $[U] = L[q] ? L[q] : ""; - }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; - }, o[d].data), X && S.spaceY) { - const K = o[d].headers.length; - for (let L = 0; L < S.spaceY; L++) { - let E = {}; - for (let $ = 0; $ < K; $++) { - const q = o[d].headers[$]; - E[q.label] = ""; - } - o[d].data.push(E); - } - } - n[d] = { - value: Math.max(o[d].data.length, n[d].value), - index: s - }; - } - l = {}; - } - let g = Object.keys(o), u = []; - return g.reduce( - (s, f) => { - let v = o[f]; - return s.sheet.push({ - ...v, - name: f - }), s; - }, - { sheet: u } - ); -} -function it(e) { - return /^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e); -} -function st(e) { - return /^[A-Z]+[1-9][1-9]*$/.test(e); -} -const lo = { - fontFamily: { - mode: "TYPE_CHECK", - type: "string" - }, - type: { - mode: "TYPE_CHECK", - type: "string" - }, - size: { - mode: "TYPE_CHECK", - type: "number" - }, - index: { - mode: "TYPE_CHECK", - type: "number" - }, - alignment: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - return t.rtl && t.ltr && o && console.warn("Alignment-rtl and ltr cannot be used together."), (t.readingOrder && t.ltr || t.readingOrder && t.rtl) && o && console.warn( - "Alignment-readingOrder cannot be used with rtl or ltr." - ), !0; - } - }, - border: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = ["full", "top", "left", "right", "bottom"], l = [ - "slantDashDot", - "dotted", - "thick", - "hair", - "dashDot", - "dashDotDot", - "dashed", - "thin", - "mediumDashDot", - "medium", - "double", - "mediumDashed" - ]; - return Object.keys(t).forEach((u) => { - const m = u; - if (n.indexOf(m) < 0) - throw 'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."'; - const s = t[m]; - if (!("color" in s)) - throw "border-The border must have a color."; - if (!("style" in s)) - throw "border-The border needs a style."; - if (typeof s.style == "string" && l.indexOf(s.style) < 0) - throw "border-An invalid style has been used."; - }), !0; - } - }, - format: { - mode: "TYPE_CHECK", - type: "string" - }, - bold: { - mode: "TYPE_CHECK", - type: "boolean" - }, - underline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - italic: { - mode: "TYPE_CHECK", - type: "boolean" - }, - doubleUnderline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - color: { - mode: "TYPE_CHECK", - type: "string" - }, - backgroundColor: { - mode: "TYPE_CHECK", - type: "string" - } -}, ao = { - notSave: { - mode: "TYPE_CHECK", - type: "boolean" - }, - creator: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - backend: { - mode: "TYPE_CHECK", - type: "boolean" - }, - activateConditionalFormatting: { - mode: "TYPE_CHECK", - type: "boolean" - }, - fileName: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - generateType: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["nodebuffer", "array", "binarystring", "base64"] - }, - addDefaultTitleStyle: { - mode: "TYPE_CHECK", - type: "boolean" - }, - created: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - modified: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - numberOfColumn: { - mode: "TYPE_CHECK", - type: "number", - min: 26 - }, - createType: { - mode: "TYPE_CHECK", - type: "string" - }, - styles: { - mode: "TYPE_CHECK", - type: "object" - }, - sheet: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - } -}, io = { - headers: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - data: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - withoutHeader: { - mode: "TYPE_CHECK", - type: "boolean" - }, - mapSheetDataOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = Object.keys(t), l = ["outlineLevel", "hidden", "height"]; - return n.forEach((g) => { - l.indexOf(g) < 0 && o && console.warn( - 'The Schema of mapSheetDataOption does not include the "' + g + '" property.' - ); - }), !0; - } - }, - backgroundImage: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - conditionalFormatting: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - return Array.isArray(t) && t.forEach((n) => { - if (n.type == "cells") { - const l = ["lt", "gt", "between", "ct", "eq"]; - if (!n.operator || !n.start || !n.end || typeof n.value > "u") - throw { - record: n, - error: "The object is not complete; you need to fill in the values for operator, start, end and value." - }; - if (l.indexOf(n.operator) < 0) - throw { record: n, error: "The operator is not valid." }; - } else if (n.type == "top") { - const l = ["belowAverage", "aboveAverage"]; - if (!n.start || !n.end || typeof n.value > "u") - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start, end and value." - }; - if (n.operator && l.indexOf(n.operator) < 0) - throw { record: n, error: "The operator is not valid." }; - } else if (n.type == "iconSet") { - if (!n.operator || !n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for operator, start and end" - }; - } else if (n.type == "colorScale") { - if (!n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else if (n.type == "dataBar") { - if (!n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else - throw 'Property "type" is not valid.'; - }), !0; - } - }, - multiStyleCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - useSplitBaseOnMatch: { - mode: "TYPE_CHECK", - type: "boolean" - }, - convertStringToNumber: { - mode: "TYPE_CHECK", - type: "boolean" - }, - images: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) { - const n = ["one", "two"]; - t.forEach((l) => { - if (typeof l.src != "string") - throw '"src" property is required.'; - if (typeof l.from != "string" || l.from.length == 0) - throw '"from" property is required.'; - if (l.to && !st(l.to)) - throw 'value of "to" is not valid.'; - if (l.from && !st(l.from)) - throw 'value of "from" is not valid.'; - if (n.indexOf(l.type) < 0) - throw 'Type of "type" is not valid in the "images" property.'; - if (l.type == "two" && !l.to) - throw '"to" property is empty. for "two" type "to" property is required.'; - }); - } - return !0; - } - }, - formula: { - mode: "TYPE_CHECK", - type: "object" - }, - pageOption: { - mode: "TYPE_CHECK", - type: "object" - }, - name: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - title: { - mode: "TYPE_CHECK", - type: "object" - }, - shiftTop: { - mode: "TYPE_CHECK", - type: "number", - min: 0 - }, - shiftLeft: { - mode: "TYPE_CHECK", - type: "number" - }, - selected: { - mode: "TYPE_CHECK", - type: "boolean" - }, - tabColor: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - merges: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) { - let n = []; - if (t.forEach((l) => { - it(l) || n.push( - "The " + l + ' reference is not valid in the "merges" property.' - ); - }), n.length > 0) - throw n; - } - return !0; - } - }, - headerStyleKey: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - mergeRowDataCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - styleCellCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - commentCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - sortAndFilter: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - if (typeof t == "object") { - const n = ["all", "ref"]; - if (!t.mode) - throw '"mode" is required in sortAndFilter'; - if (n.indexOf(t.mode) < 0) - throw '"mode" is not valid'; - if (t.mode == "ref") - if (t.ref) { - if (!it(t.ref)) - throw '"ref" is not valid'; - } else - throw '"ref" is must need be defined.'; - } - return !0; - } - }, - state: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["hidden", "visible"] - }, - headerRowOption: { - mode: "TYPE_CHECK", - type: "object" - // Adjust according to the expected type for headerRowOption - }, - protectionOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = [ - "sheet", - "formatCells", - "formatColumns", - "formatRows", - "insertColumns", - "insertRows", - "insertHyperlinks", - "deleteColumns", - "deleteRows", - "sort", - "autoFilter", - "pivotTables" - ], l = ["0", "1", 0, 1]; - return Object.keys(t).forEach((u) => { - const m = t[u]; - if (n.indexOf(u) < 0) - throw '"' + u + '" is not valid.'; - if (l.indexOf(m) < 0) - throw 'value of "' + u + '" is not valid'; - }), !0; - } - }, - headerHeight: { - mode: "TYPE_CHECK", - type: "number", - min: 1 - }, - checkbox: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) - t.forEach((n) => { - if (!n.col || !n.row) - throw '"checkbox" is not complete'; - }); - else - throw 'Type of "checkbox" property is not valid'; - return !0; - } - }, - viewOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = ["pageLayout", "pageBreakPreview"]; - if (t.type && n.indexOf(t.type) < 0) - throw 'Type of "type" property is not valid'; - return !0; - } - }, - rtl: { - mode: "TYPE_CHECK", - type: "boolean" - }, - pageBreak: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - }, - asTable: { - mode: "TYPE_CHECK", - type: "object" - } -}; -function Bt(e, t = !0, r = !0) { - Object.keys(e).forEach((n) => { - const l = e[n], g = Object.keys(l); - if (l.format && !Lt[l.format]) - throw 'The "' + l.format + '" format that has been used is not defined.'; - l.underline && l.doubleUnderline, g.forEach((u) => { - let m = l[u]; - const s = lo[u]; - if (Me(m, s, u, t, r)) - return !0; - }); - }); -} -function $t(e, t = !0, r = !0) { - Array.isArray(e) || (e = [e]), e.forEach((o) => { - Object.keys(o).forEach((l) => { - const g = o[l], u = io[l]; - Me(g, u, l, t, r); - }); - }); -} -function so(e, t = !0, r = !0) { - Object.keys(e).forEach((n) => { - let l = e[n]; - const g = ao[n]; - if (Me(l, g, n, t, r)) - if (n == "sheet") - if (Array.isArray(l)) - $t(l); - else - throw "Sheet must be Array."; - else n == "styles" && Bt(l); - }); -} -function Me(e, t, r, o, n) { - if (t) { - if (typeof e != t.type) { - if (t.type == "object" || t.type == "string" || o) - throw 'The Type of The "' + r + '" is not valid'; - n && console.warn("The property type must be " + t.type); - } - if (t.isEnum && t.enum.indexOf(e) < 0) - throw 'The value of "' + r + '" must be ' + JSON.stringify(t.enum); - if (t.min && e < t.min) - throw 'The value of "' + r + '" must be higher than ' + t.min; - if (t.notEmpty && (!e || e.length <= 0)) - throw 'The value of "' + r + '" must not be empty.'; - if (t.isArray && !Array.isArray(e)) - throw 'The value of "' + r + '" should be an array.'; - return typeof t.validateFunction == "function" && t.validateFunction(r, e, o, n), !0; - } else - return n && console.warn( - 'The Schema Object does not include the "' + r + '" property.' - ), !1; -} -const co = { - checkSheetValidWithOneRef: st, - checkSheetValidWithTwoRef: it, - generalValidationCheck: Me -}, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - exportedForTesting: co, - validateExcelTableObjectFunction: so, - validateSheetArrayFunction: $t, - validateStyleObjectFunction: Bt -}, Symbol.toStringTag, { value: "Module" })); -function It(e) { - if (typeof e > "u" || e == null) - return ""; - typeof e != "string" && (e = String(e)); - let t = e, r = !1; - return e.indexOf('"') >= 0 && (t = t.replace(/"/g, '""'), r = !0), e.indexOf(",") >= 0 && (r = !0), r && (t = '"' + t + '"'), t; -} -function fo(e) { - return e ? " " : ","; -} -function Pt(e, t) { - return e.substring(0, e.length - t) + ` -`; -} -async function Kt(e, t = !1, r = !1) { - const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; - let g = []; - if (e.sheet.forEach((m) => { - let s = "", f = ""; - const v = m.headers; - let D = [], j = v.length; - for (let S = 0; S < j; S++) { - const d = v[S]; - D.push(d.label), m.withoutHeader || (f += It(d.text) + o); - } - s += Pt(f, l), j = m.data.length; - for (let S = 0; S < j; S++) { - f = ""; - const d = m.data[S]; - D.forEach((G) => { - f += It(d[G]) + o; - }), s += Pt(f, l); - } - g.push(s); - }), e.backend) - return g; - const u = await import("./FileSaver.min-BEH1o5YI.js").then((m) => m.F).then((m) => m.saveAs); - if (t) { - const m = await import("./jszip.min-D-TEDr9v.js").then((v) => v.j).then((v) => v.default); - let s = new m(); - g.forEach((v, D) => { - s.file("sheet" + (D + 1) + n, v); - }); - const f = await s.generateAsync({ type: "blob" }).then(function(v) { - return v; - }); - return u( - f, - (e.fileName ? e.fileName : "tableRecord") + ".zip" - ), "done"; - } - g.forEach((m) => { - var s = new Blob([m], { - type: "text/" + (r ? "plain" : "csv") + ";charset=utf-8" - }); - u( - s, - (e.fileName ? e.fileName : "tableRecord") + n - ); - }); -} -const jt = { - firstHeader: !0, - returnTableNodes: !1, - emptyNodeDefaultString: " ", - removeContainerChildNode: !0, - containerNodeStyle: { - display: "flex", - flexDirection: "column" - }, - tableStyle: { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" - }, - cellStyle: { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" - }, - buttonContainerStyle: { - display: "flex" - }, - buttonStyle: { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" - }, - activeButtonStyle: { - background: "#EEEDEB" - } -}; -async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { - display: "flex", - flexDirection: "column" -}, s = { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" -}, f = { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" -}, v = { - display: "flex" -}, D = { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" -}, j = { - background: "#EEEDEB" -}) { - let S = await import("./read-utils-YAGe6NNW.js").then( - async (E) => await E.extractExcelData(e, !1, o) - ), d = null; - if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) - throw "Container Node not found"; - const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); - let B = document.createElement("div"); - N.forEach((E) => { - B.style[E] = v[E]; - }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { - d.style[E] = m[E]; - }), d.appendChild(B)); - let X = [], K = !1, L = 0; - do { - L++; - const E = S.sheetName.next(); - if (!E.value) - break; - const $ = document.createElement("div"); - if ($.style.display = "none", !l) { - const J = document.createElement("button"); - oe.forEach((ye) => { - J.style[ye] = D[ye]; - }), J.addEventListener("click", (ye) => { - const ve = J.getAttribute("data-sheet"), we = d.querySelector( - 'div[data-sheet="' + ve + '"]' - ); - if (we) { - P.forEach((ie) => { - J.style[ie] = j[ie]; - }); - const Se = d.querySelector( - "[data-sheet-button-activate]" - ); - let ae = d.querySelector("[data-sheet-activate]"); - we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { - Se.style[ie] = D[ie]; - }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); - } else - console.error("Sheet content not found!! id is " + ve); - }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); - } - let q = n ? "th" : "td"; - const U = document.createElement("table"); - z.forEach((J) => { - U.style[J] = s[J]; - }); - const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; - if (Array.isArray(M)) { - const J = M.length; - for (let ye = 0; ye < J; ye++) { - const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); - for (let ae = 0; ae <= Ce; ae++) { - let ie = g; - if (Se) { - const de = ve[ae]; - typeof de == "string" && (ie = de); - } - const ge = document.createElement(q); - Z.forEach((de) => { - ge.style[de] = f[de]; - }), ge.innerText = ie, we.appendChild(ge); - } - U.appendChild(we), q = "td"; - } - } - l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; - } while (!K); - if (l) - return X; - { - const E = d.querySelector( - 'div[data-sheet="1"]' - ); - E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); - const $ = d.querySelector( - 'button[data-sheet="1"]' - ); - return $ && (P.forEach((q) => { - $.style[q] = j[q]; - }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; - } -} -async function uo(e, t, r = !0, o = "property") { - let n = await import("./read-utils-YAGe6NNW.js").then( - async (u) => await u.extractExcelData(e, !1, t) - ), l = {}, g = []; - return Object.keys(n.sheetNameObject).forEach((u) => { - const m = n.sheetNameObject[u], s = n.data[m] || n.data[u], f = n.maxLengthOfColumn[m] || n.maxLengthOfColumn[u]; - for (let j = 0; j <= f; j++) - g[j] = o + (j + 1); - let v = r, D = []; - s.forEach((j) => { - let S = {}; - j.forEach((d, G) => { - typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); - }), v = !1, D.push(S); - }), l = Object.assign(l, { - [m]: D - }); - }), l; -} -const yo = Ht, go = to; -function xo(e, t, r = {}) { - const o = Wt( - e, - t, - r.keepStyle, - r.rowHeightScaleFunction, - r.colWidthScaleFunction - ); - return ct(o); -} -function bo(e) { - const t = no(e); - return ct(t); -} -function Co(e, t) { - return ct(zt(e, t)); -} -function vo(e, t = !1, r) { - return import("./read-utils-YAGe6NNW.js").then( - (o) => o.extractExcelData(e, t, r) - ); -} -function wo(e, t = !1) { - return Kt(e, t, !1); -} -function To(e, t = !1) { - return Kt(e, t, !0); -} -function Eo(e, t, r, o = { ...jt }) { - return o = { - ...jt, - ...o - }, mo( - e, - t, - r, - o.fetchFunc, - o.firstHeader, - o.returnTableNodes, - o.emptyNodeDefaultString, - o.removeContainerChildNode, - o.containerNodeStyle, - o.tableStyle, - o.cellStyle, - o.buttonContainerStyle, - o.buttonStyle, - o.activeButtonStyle - ); -} -export { - yo as a, - go as b, - Qt as c, - xo as d, - vo as e, - wo as f, - Re as g, - To as h, - Eo as i, - ct as j, - uo as k, - po as r, - bo as s, - Co as t, - ho as v -}; diff --git a/dist/read-utils-Byj29Erp.js b/dist/read-utils-CMxu90Z7.js similarity index 97% rename from dist/read-utils-Byj29Erp.js rename to dist/read-utils-CMxu90Z7.js index 3c194ca..41df78e 100644 --- a/dist/read-utils-Byj29Erp.js +++ b/dist/read-utils-CMxu90Z7.js @@ -1 +1 @@ -System.register("ExcelTable",["./index-B8PpTQiZ.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); +System.register("ExcelTable",["./index-BBP-cHpJ.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); diff --git a/dist/read-utils-DnAqiCj7.js b/dist/read-utils-CU7cU67B.js similarity index 98% rename from dist/read-utils-DnAqiCj7.js rename to dist/read-utils-CU7cU67B.js index b7fff06..fd7a95e 100644 --- a/dist/read-utils-DnAqiCj7.js +++ b/dist/read-utils-CU7cU67B.js @@ -1,4 +1,4 @@ -import { g as R, c as T } from "./index-p1xk7Sgq.js"; +import { g as R, c as T } from "./index-D07Il0Qz.js"; function B(s) { return /t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CNq3yjRY.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; diff --git a/dist/read-utils-CwMyWpVb.js b/dist/read-utils-CwMyWpVb.js deleted file mode 100644 index c47491c..0000000 --- a/dist/read-utils-CwMyWpVb.js +++ /dev/null @@ -1 +0,0 @@ -System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); diff --git a/dist/read-utils-D8LB9Gmq.cjs b/dist/read-utils-D8LB9Gmq.cjs deleted file mode 100644 index c55b446..0000000 --- a/dist/read-utils-D8LB9Gmq.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; diff --git a/dist/read-utils-DXQsy33k.js b/dist/read-utils-DXQsy33k.js deleted file mode 100644 index be5248a..0000000 --- a/dist/read-utils-DXQsy33k.js +++ /dev/null @@ -1 +0,0 @@ -define(["require","exports","./index-DfuHK51s"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/read-utils-YAGe6NNW.js b/dist/read-utils-YAGe6NNW.js deleted file mode 100644 index d715a4b..0000000 --- a/dist/read-utils-YAGe6NNW.js +++ /dev/null @@ -1,110 +0,0 @@ -import { g as R, c as T } from "./index-DMAk0ysA.js"; -function B(s) { - return /t="s".*?(.*?)<\/t>/, r = s.match(a); - return r ? r[1] : null; -} -function $(s) { - const a = /(.*?)<\/v>/, r = s.match(a); - return r ? r[1] : null; -} -function j(s) { - const a = /r="(.*?)"/, r = s.match(a); - return r ? r[1] : null; -} -async function P(s, a = !1, r) { - let N, O = !1; - typeof r == "function" ? (N = r, O = !0) : N = fetch; - let x = [], y = /* @__PURE__ */ new Map(), b = {}, A = [], C = {}, k = {}, E = !1; - function V(t, I) { - let g = 0, u = [], m = I.match(//g); - if (Array.isArray(m) && m.forEach((n) => { - let f = $(n); - B(n) && f && (f = A[parseInt(f)]); - const p = j(n); - let i = R(p, T); - typeof u[i.row] > "u" && (u[i.row] = []), u[i.row][i.col] = f, g = Math.max(i.col, g); - }), t.indexOf("xl/worksheets/sheet") == 0) { - let n = t.substring(14, t.lastIndexOf(".")); - y.has(n) && (n = y.get(n)), C[n] = u, k[n] = g; - } - } - return await N(s).then((t) => { - if (t == null || t == null) - throw "response is null"; - return O ? t : a ? t.arrayBuffer() : t.blob(); - }).then(async (t) => { - const g = (await import("./jszip.min-D-TEDr9v.js").then((m) => m.j)).default; - let u = 0; - return await new Promise((m, n) => { - g.loadAsync(t).then(function(f) { - const p = Object.keys(f.files); - u = p.length; - let i = new Proxy( - { - counter: 0, - isNameSet: !1 - }, - { - set(e, o, c) { - if (o === "isNameSet") - return e.isNameSet = c, !0; - if (typeof c != "number") - throw "value most be number"; - return e.counter = c, e.isNameSet && e.counter === u && m({ - data: C, - sheetNameObject: b, - sheetName: y.entries(), - maxLengthOfColumn: k - }), !0; - }, - get(e, o, c) { - return o === "isNameSet" ? e.isNameSet : e.counter; - } - } - ); - p.forEach(function(e) { - f.files[e].async("string").then(function(o) { - if (e.indexOf("sharedStrings") >= 0) { - let c = o.match(//g); - Array.isArray(c) && c.forEach((S) => { - let h = S.match(//g); - if (Array.isArray(h)) { - let w = h.reduce((l, d) => l + M(d), ""); - A.push(w); - } - }), E = !0, x.length > 0 && (x.forEach((S) => { - V(S.filename, S.fileData); - }), x = []); - } - e.indexOf("sheet") >= 0 && (E ? V(e, o) : x.push({ - filename: e, - fileData: o - })), e.indexOf("workbook") >= 0 && (o.replace( - /(.*[\n\s\S]*)()(.*[\n\s\S]*)/, - "$2" - ).split(" { - let l = w + 1, d = "Sheet " + l; - h.indexOf("name=") >= 0 && (d = h.replace( - /(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/, - "$2" - )), h.indexOf("sheetId=") > 0 && (l = Number( - h.replace( - /(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/, - "$2" - ) - ), isNaN(l) && (l = w + 1)), y.set("sheet" + l, d), b["sheet" + l] = d; - }), i.isNameSet = !0), i.counter++; - }); - }); - }); - }); - }).catch((t) => { - throw t; - }); -} -export { - P as extractExcelData -}; diff --git a/dist/read-utils-DODcKE84.js b/dist/read-utils-pmXAaVV2.js similarity index 97% rename from dist/read-utils-DODcKE84.js rename to dist/read-utils-pmXAaVV2.js index 26ca0f0..6e4efdc 100644 --- a/dist/read-utils-DODcKE84.js +++ b/dist/read-utils-pmXAaVV2.js @@ -1 +1 @@ -define(["require","exports","./index-BYjrfbvd"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); +define(["require","exports","./index-D3jbCDy2"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/package-lock.json b/package-lock.json index 3dffef1..beb7820 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,89 +39,20 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/code-frame/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/code-frame/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/code-frame/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/compat-data": { "version": "7.23.5", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", @@ -291,19 +222,21 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", - "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -318,111 +251,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.8", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz", - "integrity": "sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ==", - "dev": true, - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.7", - "@babel/types": "^7.23.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/parser": { - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", - "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.25.2" + "@babel/types": "^7.26.10" }, "bin": { "parser": "bin/babel-parser.js" @@ -609,14 +458,15 @@ } }, "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" @@ -644,14 +494,14 @@ } }, "node_modules/@babel/types": { - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz", - "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -4222,7 +4072,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "3.14.1", @@ -5485,15 +5336,6 @@ "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index 780050b..fc54c45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mr-excel", - "version": "7.0.0", + "version": "7.0.1", "type": "module", "main": "dist/excel-table.cjs", "module": "dist/excel-table.js", From 5016678cea821e91ed0d9a59ded76ee65587a744 Mon Sep 17 00:00:00 2001 From: "m.r" Date: Thu, 13 Mar 2025 04:35:01 -0800 Subject: [PATCH 7/7] V7.0.1 --- dist/excel-table.d.ts | 475 ------- dist/index-BPuSW_h3.js | 44 - dist/index-BYjrfbvd.js | 44 - dist/index-CzrjgJVS.cjs | 44 - dist/index-DMAk0ysA.js | 2479 ---------------------------------- dist/read-utils-CMxu90Z7.js | 4 - dist/read-utils-CU7cU67B.js | 4 - dist/read-utils-CWXTa8vm.cjs | 4 - dist/read-utils-CwMyWpVb.js | 5 - dist/read-utils-D8LB9Gmq.cjs | 5 - dist/read-utils-DODcKE84.js | 1 - dist/read-utils-YAGe6NNW.js | 114 -- 12 files changed, 3223 deletions(-) delete mode 100644 dist/index-BPuSW_h3.js delete mode 100644 dist/index-BYjrfbvd.js delete mode 100644 dist/index-CzrjgJVS.cjs delete mode 100644 dist/index-DMAk0ysA.js delete mode 100644 dist/read-utils-CwMyWpVb.js delete mode 100644 dist/read-utils-D8LB9Gmq.cjs delete mode 100644 dist/read-utils-DODcKE84.js delete mode 100644 dist/read-utils-YAGe6NNW.js diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index 73f46f3..d2ad689 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -1,10 +1,5 @@ export declare const addGlobalOptionFromExcelTable: typeof addGlobalOptionFromExcelTable_2; -/** - * Adds global options from an Excel table. - * @param {string} key - The key for the global option. - * @param {ExcelTable} data - The Excel table data. - */ /** * Adds global options from an Excel table. * @param {string} key - The key for the global option. @@ -14,12 +9,6 @@ declare function addGlobalOptionFromExcelTable_2(key: string, data: ExcelTable): export declare const addGlobalOptions: typeof addGlobalOptions_2; -/** - * Adds global options to the proxy. - * @param {string} key - The key for the global option. - * @param {string} path - The path for the global option. - * @param {any} data - The data for the global option. - */ /** * Adds global options to the proxy. * @param {string} key - The key for the global option. @@ -28,20 +17,12 @@ export declare const addGlobalOptions: typeof addGlobalOptions_2; */ declare function addGlobalOptions_2(key: string, path: string, data: any): void; -/** - * Horizontal alignment options. - * @typedef {"center" | "left" | "right"} AlignmentHorizontal - */ /** * Horizontal alignment options. * @typedef {"center" | "left" | "right"} AlignmentHorizontal */ declare type AlignmentHorizontal = "center" | "left" | "right"; -/** - * Options for configuring alignment. - * @interface - */ /** * Options for configuring alignment. * @interface @@ -58,69 +39,43 @@ declare interface AlignmentOption { ltr?: boolean; } -/** - * Keys for alignment options. - * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey - */ /** * Keys for alignment options. * @typedef {"horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"} AlignmentOptionKey */ declare type AlignmentOptionKey = "horizontal" | "vertical" | "wrapText" | "shrinkToFit" | "readingOrder" | "textRotation" | "indent"; -/** - * Vertical alignment options. - * @typedef {"center" | "top" | "bottom"} AlignmentVertical - */ /** * Vertical alignment options. * @typedef {"center" | "top" | "bottom"} AlignmentVertical */ declare type AlignmentVertical = "center" | "top" | "bottom"; -/** - * Options for displaying the sheet as a table. - * @interface - */ /** * Options for displaying the sheet as a table. * @interface */ declare interface AsTableOption { - /** The type of table style. */ /** The type of table style. */ type?: "Light" | "Medium" | "Dark"; /** The style number of the table. */ - /** The style number of the table. */ styleNumber?: number; /** Indicates if the first column should be styled. */ - /** Indicates if the first column should be styled. */ firstColumn?: boolean; /** Indicates if the last column should be styled. */ - /** Indicates if the last column should be styled. */ lastColumn?: boolean; /** Indicates if row stripes should be applied. */ - /** Indicates if row stripes should be applied. */ rowStripes?: boolean; /** Indicates if column stripes should be applied. */ - /** Indicates if column stripes should be applied. */ columnStripes?: boolean; } -/** - * Directions for border options. - * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection - */ /** * Directions for border options. * @typedef {"full" | "top" | "left" | "right" | "bottom"} BorderDirection */ declare type BorderDirection = "full" | "top" | "left" | "right" | "bottom"; -/** - * Options for configuring borders. - * @interface - */ /** * Options for configuring borders. * @interface @@ -132,11 +87,6 @@ declare type BorderOption = { }; }; -/** - * Represents a buffer. - * @class - * @extends {Uint8Array} - */ /** * Represents a buffer. * @class @@ -159,10 +109,6 @@ declare class Buffer_2 extends Uint8Array { byteOffset: number; } -/** - * Represents a checkbox in the sheet. - * @interface - */ /** * Represents a checkbox in the sheet. * @interface @@ -185,10 +131,6 @@ declare function checkSheetValidWithTwoRef(ref: string): boolean; declare type ColWidthScaleFunction = (data: number, colIndex: number) => number; -/** - * Represents a comment in the sheet. - * @interface - */ /** * Represents a comment in the sheet. * @interface @@ -199,17 +141,6 @@ declare interface Comment_2 { author?: string; } -/** - * Function type for comment condition. - * @callback CommentConditionFunction@callback CommentConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {null | Data} object - The data object. - * @param {string} headerKey - The header key. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {Comment | string | false | undefined | null} The comment or null. - */ /** * Function type for comment condition. * @callback CommentConditionFunction@callback CommentConditionFunction @@ -223,84 +154,53 @@ declare interface Comment_2 { */ declare type CommentConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => Comment_2 | string | false | undefined | null; -/** - * Represents conditional formatting in the sheet. - * @interface - * @extends {ConditionalFormattingOption} - */ /** * Represents conditional formatting in the sheet. * @interface * @extends {ConditionalFormattingOption} */ declare interface ConditionalFormatting extends ConditionalFormattingOption { - /** The start cell for the conditional formatting. */ /** The start cell for the conditional formatting. */ start: string; /** The end cell for the conditional formatting. */ - /** The end cell for the conditional formatting. */ end: string; } -/** - * Operations for conditional formatting cells. - * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation - */ /** * Operations for conditional formatting cells. * @typedef {"lt" | "gt" | "between" | "eq" | "ct"} ConditionalFormattingCellsOperation */ declare type ConditionalFormattingCellsOperation = "lt" | "gt" | "between" | "eq" | "ct"; -/** - * Operations for conditional formatting icon sets. - * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation - */ /** * Operations for conditional formatting icon sets. * @typedef {"3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"} ConditionalFormattingIconSetOperation */ declare type ConditionalFormattingIconSetOperation = "3Arrows" | "4Arrows" | "5Arrows" | "5ArrowsGray" | "4ArrowsGray" | "3ArrowsGray"; -/** - * Options for conditional formatting. - * @interface - */ /** * Options for conditional formatting. * @interface */ declare interface ConditionalFormattingOption { - /** The type of conditional formatting. */ /** The type of conditional formatting. */ type: "cells" | "dataBar" | "iconSet" | "colorScale" | "top"; /** The operator for the conditional formatting. */ - /** The operator for the conditional formatting. */ operator?: string | ConditionalFormattingCellsOperation | ConditionalFormattingIconSetOperation | ConditionalFormattingTopOperation; /** The value for the conditional formatting. */ - /** The value for the conditional formatting. */ value?: number | string; /** The priority of the conditional formatting. */ - /** The priority of the conditional formatting. */ priority?: number; /** The colors for the conditional formatting. */ - /** The colors for the conditional formatting. */ colors?: string[]; /** Indicates if the conditional formatting is for the bottom values. */ - /** Indicates if the conditional formatting is for the bottom values. */ bottom?: boolean; /** The style ID for the conditional formatting. */ - /** The style ID for the conditional formatting. */ styleId?: string; /** The percentage for the conditional formatting. */ - /** The percentage for the conditional formatting. */ percent?: number; } -/** - * Operations for conditional formatting top values. - * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation - */ /** * Operations for conditional formatting top values. * @typedef {"belowAverage" | "aboveAverage"} ConditionalFormattingTopOperation @@ -323,10 +223,6 @@ export declare function convertTableToExcel(queryForTable?: string, table?: HTML colWidthScaleFunction?: ColWidthScaleFunction; }): Promise; -/** - * Represents a custom formula setting. - * @interface - */ /** * Represents a custom formula setting. * @interface @@ -339,11 +235,6 @@ declare interface CustomFormulaSetting { styleId?: string; } -/** - * Represents data in the sheet. - * @interface - * @extends {DataOptions} - */ /** * Represents data in the sheet. * @interface @@ -369,14 +260,12 @@ declare namespace DataModel { PageOption, Header, HeaderOption, - HeaderOption, StyleType, StyleBody, Styles, Data, DataOptions, DropDown, - DropDown, RowMap, ProtectionOption, ProtectionOptionKey, @@ -424,25 +313,15 @@ declare namespace DataModel { Buffer_2 as Buffer, ReplacerOption, ExcelToNodeConfig - Buffer_2 as Buffer, - ReplacerOption, - ExcelToNodeConfig } } export { DataModel } -/** - * Options for configuring data in the sheet. - * @interface - */ /** * Options for configuring data in the sheet. * @interface */ declare interface DataOptions { - [key: string]: "0" | "1" | number | string | undefined | MapComment - /** Array of multi-style values for the data. */ - | MapMultiStyleValue; [key: string]: "0" | "1" | number | string | undefined | MapComment /** Array of multi-style values for the data. */ | MapMultiStyleValue; @@ -465,83 +344,48 @@ declare interface DropDown { for: string[]; } -/** - * Represents an Excel table with options and sheets. - * @interface - * @extends {ExcelTableOption} - */ -/** - * Represents a dropdown in the sheet. - * @interface - */ -declare interface DropDown { - /** Array of options for the dropdown. */ - option: (string | number)[]; - /** Array of columns the dropdown applies to. */ - for: string[]; -} - /** * Represents an Excel table with options and sheets. * @interface * @extends {ExcelTableOption} */ declare interface ExcelTable extends ExcelTableOption { - /** Array of sheets in the Excel table. */ /** Array of sheets in the Excel table. */ sheet: Sheet[]; } -/** - * Options for configuring an Excel table. - * @interface - */ /** * Options for configuring an Excel table. * @interface */ declare interface ExcelTableOption { - /** Indicates if the Excel should not be saved. */ /** Indicates if the Excel should not be saved. */ notSave?: boolean; /** The creator of the Excel. */ - /** The creator of the Excel. */ creator?: string; /** Indicates if the backend is used. */ - /** Indicates if the backend is used. */ backend?: boolean; /** Activates conditional formatting. */ - /** Activates conditional formatting. */ activateConditionalFormatting?: boolean; /** Function to fetch data. */ - /** Function to fetch data. */ fetch?: Function; /** The file name of the Excel. */ - /** The file name of the Excel. */ fileName?: string; /** The type of generated file. */ - /** The type of generated file. */ generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; /** Adds default title style. */ - /** Adds default title style. */ addDefaultTitleStyle?: boolean; /** The creation date of the Excel. */ - /** The creation date of the Excel. */ created?: string; /** The modification date of the Excel. */ - /** The modification date of the Excel. */ modified?: string; /** The number of columns in the Excel. */ - /** The number of columns in the Excel. */ numberOfColumn?: number; /** The type of creation. */ - /** The type of creation. */ createType?: string; /** Styles applied to the Excel. */ - /** Styles applied to the Excel. */ styles?: Styles; /** Format map for the Excel. */ - /** Format map for the Excel. */ formatMap?: FormatMap; } @@ -574,7 +418,6 @@ declare interface ExcelToNodeConfig { buttonStyle?: object; activeButtonStyle?: object; } -} declare const exportedForTesting: { checkSheetValidWithOneRef: typeof checkSheetValidWithOneRef; @@ -582,10 +425,6 @@ declare const exportedForTesting: { generalValidationCheck: typeof generalValidationCheck; }; -/** - * Represents extracted data. - * @typedef {(string | null | undefined)[][]} ExtractedData - */ /** * Represents extracted data. * @typedef {(string | null | undefined)[][]} ExtractedData @@ -601,10 +440,6 @@ declare type ExtractedData = (string | null | undefined)[][]; */ export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; -/** - * Represents the result of data extraction. - * @interface - */ /** * Represents the result of data extraction. * @interface @@ -613,10 +448,6 @@ declare interface ExtractResult { [sheetName: string]: ExtractedData; } -/** - * Represents a format map. - * @interface - */ /** * Represents a format map. * @interface @@ -628,10 +459,6 @@ declare interface FormatMap { }; } -/** - * Represents a formula in the sheet. - * @interface - */ /** * Represents a formula in the sheet. * @interface @@ -640,10 +467,6 @@ declare interface Formula { [insertCell: string]: FormulaSetting | SingleRefFormulaSetting | NoArgFormulaSetting | CustomFormulaSetting; } -/** - * Represents a formula setting. - * @interface - */ /** * Represents a formula setting. * @interface @@ -655,10 +478,6 @@ declare interface FormulaSetting { styleId?: string; } -/** - * Types of formulas. - * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType - */ /** * Types of formulas. * @typedef {"AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"} FormulaType @@ -685,13 +504,6 @@ export declare function generateExcel(data: ExcelTable, styleKey?: string): Prom */ export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; -/** - * Represents a header in the sheet. - * @interface - * @extends {HeaderOption} - */ -declare interface Header extends HeaderOption { - /** The label of the header. */ /** * Represents a header in the sheet. * @interface @@ -701,16 +513,9 @@ declare interface Header extends HeaderOption { /** The label of the header. */ label: string; /** The text of the header. */ - /** The text of the header. */ text: string; } -/** - * Location map for header and footer options.l:Left, c:Center, r:Right - * @interface - */ -} - /** * Location map for header and footer options.l:Left, c:Center, r:Right * @interface @@ -721,27 +526,17 @@ declare interface HeaderFooterLocationMap { r?: HeaderFooterOption; } -/** - * Options for header and footer. - * @interface - */ /** * Options for header and footer. * @interface */ declare interface HeaderFooterOption { - /** The text of the header or footer. */ /** The text of the header or footer. */ text?: string; /** The style ID of the header or footer. */ - /** The style ID of the header or footer. */ styleId?: string; } -/** - * Types of header and footer in page(odd page, even page,first page). - * @interface - */ /** * Types of header and footer in page(odd page, even page,first page). * @interface @@ -774,32 +569,6 @@ declare interface HeaderOption { }; } -/** - * Options for the header row. - * @interface - */ -/** - * Options for configuring a header. - * @interface - */ -declare interface HeaderOption { - /** The size(width) of the header. */ - size?: number; - /** Array of multi-style values for the header. */ - multiStyleValue?: MultiStyleValue[]; - /** Comment for the header. */ - comment?: Comment_2 | string; - /** Conditional formatting options for the header. */ - conditionalFormatting?: ConditionalFormattingOption; - /** Formula applied to the column. */ - formula?: { - /** The type of the formula. */ - type: FormulaType; - /** The style ID of the formula. */ - styleId?: string; - }; -} - /** * Options for the header row. * @interface @@ -808,10 +577,6 @@ declare interface HeaderRowOption { outlineLevel: "string"; } -/** - * Represents an image in the sheet. - * @interface - */ /** * Represents an image in the sheet. * @interface @@ -834,10 +599,6 @@ declare interface ImageTypes { }; } -/** - * Represents a map of comments. - * @interface - */ /** * Represents a map of comments. * @interface @@ -846,23 +607,14 @@ declare interface MapComment { [key: string]: Comment_2 | string; } -/** - * Represents a map of multi-style values. - * @interface - */ /** * Represents a map of multi-style values. * @interface */ declare interface MapMultiStyleValue { [key: string]: MultiStyleValue[]; - [key: string]: MultiStyleValue[]; } -/** - * Represents a map of merge row conditions. - * @interface - */ /** * Represents a map of merge row conditions. * @interface @@ -874,15 +626,6 @@ declare interface MergeRowConditionMap { }; } -/** - * Function type for merge row data condition. - * @callback MergeRowDataConditionFunction@callback MergeRowDataConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {string | null} key - The key. - * @param {number} index - The index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {boolean} The result of the condition. - */ /** * Function type for merge row data condition. * @callback MergeRowDataConditionFunction@callback MergeRowDataConditionFunction @@ -894,18 +637,6 @@ declare interface MergeRowConditionMap { */ declare type MergeRowDataConditionFunction = (data: Header | string | number | undefined, key: string | null, index: number, fromHeader: boolean) => boolean; -/** - * Function type for multi-style condition. - * @callback MultiStyleConditionFunction@callback MultiStyleConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {null | Data} object - The data object. - * @param {string} headerKey - The header key. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @returns {MultiStyleValue[] | null} The multi-style values or null. - */ -declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; /** * Function type for multi-style condition. * @callback MultiStyleConditionFunction@callback MultiStyleConditionFunction @@ -919,10 +650,6 @@ declare type MultiStyleConditionFunction = (data: Header | string | number | und */ declare type MultiStyleConditionFunction = (data: Header | string | number | undefined, object: null | Data, headerKey: string, rowIndex: number, colIndex: number, fromHeader: boolean) => MultiStyleValue[] | null; -/** - * Represents a multi-style regex value. - * @interface - */ /** * Represents a multi-style regex value. * @interface @@ -932,10 +659,6 @@ declare interface MultiStyleRexValue { styleId: string; } -/** - * Represents a multi-style value. - * @interface - */ /** * Represents a multi-style value. * @interface @@ -943,14 +666,8 @@ declare interface MultiStyleRexValue { declare interface MultiStyleValue { value: string | number; styleId?: string; - value: string | number; - styleId?: string; } -/** - * Represents a no-argument formula setting. - * @interface - */ /** * Represents a no-argument formula setting. * @interface @@ -960,43 +677,28 @@ declare interface NoArgFormulaSetting { styleId?: string; } -/** - * Types of no-argument formulas. - * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType - */ /** * Types of no-argument formulas. * @typedef {"NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"} NoArgFormulaType */ declare type NoArgFormulaType = "NOW" | "TODAY" | "HOUR" | "NOW_YEAR" | "NOW_HOUR" | "NOW_SECOND" | "NOW_MIN" | "NOW_MONTH" | "NOW_DAY" | "NOW_WEEKDAY" | "NOW_MINUTE"; -/** - * Options for page breaks in the sheet. - * @interface - */ /** * Options for page breaks in the sheet. * @interface */ declare interface PageBreak { - /** Array of row indices where page breaks should occur. */ /** Array of row indices where page breaks should occur. */ row?: number[]; /** Array of column indices where page breaks should occur. */ - /** Array of column indices where page breaks should occur. */ column?: number[]; } -/** - * Options for configuring the page. - * @interface - */ /** * Options for configuring the page. * @interface */ declare interface PageOption { - /** Margin settings for the page. */ /** Margin settings for the page. */ margin?: { left?: number; @@ -1007,32 +709,13 @@ declare interface PageOption { footer?: number; }; /** Header settings for the page. */ - /** Header settings for the page. */ header?: HeaderFooterTypes; /** Footer settings for the page. */ - /** Footer settings for the page. */ footer?: HeaderFooterTypes; /** Indicates if the page is in portrait orientation. */ - /** Indicates if the page is in portrait orientation. */ isPortrait: boolean; } -/** - * Represents protection options for the sheet. - * @typedef {Object} ProtectionOption@typedef {Object} ProtectionOption - * @property {"0" | "1" | 0 | 1} sheet - Protect the sheet. - * @property {"0" | "1" | 0 | 1} formatCells - Allow formatting cells. - * @property {"0" | "1" | 0 | 1} formatColumns - Allow formatting columns. - * @property {"0" | "1" | 0 | 1} formatRows - Allow formatting rows. - * @property {"0" | "1" | 0 | 1} insertColumns - Allow inserting columns. - * @property {"0" | "1" | 0 | 1} insertRows - Allow inserting rows. - * @property {"0" | "1" | 0 | 1} insertHyperlinks - Allow inserting hyperlinks. - * @property {"0" | "1" | 0 | 1} deleteColumns - Allow deleting columns. - * @property {"0" | "1" | 0 | 1} deleteRows - Allow deleting rows. - * @property {"0" | "1" | 0 | 1} sort - Allow sorting. - * @property {"0" | "1" | 0 | 1} autoFilter - Allow using auto filter. - * @property {"0" | "1" | 0 | 1} pivotTables - Allow using pivot tables. - */ /** * Represents protection options for the sheet. * @typedef {Object} ProtectionOption@typedef {Object} ProtectionOption @@ -1053,20 +736,12 @@ declare type ProtectionOption = { [key in ProtectionOptionKey]: "0" | "1" | 0 | 1; }; -/** - * Keys for protection options. - * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey - */ /** * Keys for protection options. * @typedef {"sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"} ProtectionOptionKey */ declare type ProtectionOptionKey = "sheet" | "formatCells" | "formatColumns" | "formatRows" | "insertColumns" | "insertRows" | "insertHyperlinks" | "deleteColumns" | "deleteRows" | "sort" | "autoFilter" | "pivotTables"; -/** - * Represents the result of reading data. - * @interface - */ /** * Represents the result of reading data. * @interface @@ -1093,27 +768,8 @@ declare interface ReplacerOption { generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; } -export declare function replaceInExcel(url: string | null | undefined, replaceData: Record, option?: ReplacerOption): Promise; - -/** - * Represents options for the replacer. - * @interface - */ -declare interface ReplacerOption { - fileName?: string; - backend?: boolean; - fetch?: Function; - data?: Blob | Buffer_2; - notSave?: boolean; - generateType?: "nodebuffer" | "array" | "binarystring" | "base64"; -} - declare type RowHeightScaleFunction = (data: number, rowIndex: number, fromHeader: boolean) => number; -/** - * Represents a map of rows in the sheet. - * @interface - */ /** * Represents a map of rows in the sheet. * @interface @@ -1126,147 +782,96 @@ declare interface RowMap { }; } -/** - * Represents a sheet in the Excel. - * @interface - * @extends {SheetOption} - */ /** * Represents a sheet in the Excel. * @interface * @extends {SheetOption} */ declare interface Sheet extends SheetOption { - /** Array of headers in the sheet. */ /** Array of headers in the sheet. */ headers: Header[]; /** Array of data in the sheet. */ - /** Array of data in the sheet. */ data: Data[]; } -/** - * Options for configuring a sheet. - * @interface - */ /** * Options for configuring a sheet. * @interface */ declare interface SheetOption { - /** Indicates if the sheet should be without a header. */ /** Indicates if the sheet should be without a header. */ withoutHeader?: boolean; /** Options for configure property name that maybe provide for apply outlineLevel, hidden, height option of row*/ - /** Options for configure property name that maybe provide for apply outlineLevel, hidden, height option of row*/ mapSheetDataOption?: { - /** Outline level of the sheet data. */ /** Outline level of the sheet data. */ outlineLevel?: string; /** Indicates if the sheet data is hidden. */ - /** Indicates if the sheet data is hidden. */ hidden?: string; /** Height of the sheet data. */ - /** Height of the sheet data. */ height?: string; }; /** Background image of the sheet. */ - /** Background image of the sheet. */ backgroundImage?: string; /** Array of conditional formatting rules. */ - /** Array of conditional formatting rules. */ conditionalFormatting?: ConditionalFormatting[]; /** Function for multi-style condition. */ - /** Function for multi-style condition. */ multiStyleCondition?: MultiStyleConditionFunction; /** Indicates if the sheet should use split based on match. */ - /** Indicates if the sheet should use split based on match. */ useSplitBaseOnMatch?: boolean; /** Indicates if strings should be converted to numbers Automatically. */ - /** Indicates if strings should be converted to numbers Automatically. */ convertStringToNumber?: boolean; /** Array of images in the sheet. */ - /** Array of images in the sheet. */ images?: ImageTypes[]; /** Formula applied to the sheet. */ - /** Formula applied to the sheet. */ formula?: Formula; /** Page options for the sheet. */ - /** Page options for the sheet. */ pageOption?: PageOption; /** Name of the sheet. */ - /** Name of the sheet. */ name?: string; /** Title of the sheet. */ - /** Title of the sheet. */ title?: Title; /** Shift sheet from top. */ - /** Shift sheet from top. */ shiftTop?: number; /** Shift sheet from Left. */ - /** Shift sheet from Left. */ shiftLeft?: number; /** Indicates if the sheet is selected. */ - /** Indicates if the sheet is selected. */ selected?: boolean; /** Tab color of the sheet. */ - /** Tab color of the sheet. */ tabColor?: string; /** Array of merge ranges in the sheet. */ - /** Array of merge ranges in the sheet. */ merges?: string[]; /** Key for the header style. */ - /** Key for the header style. */ headerStyleKey?: string; /** Function for merge row data base on condition. */ - /** Function for merge row data base on condition. */ mergeRowDataCondition?: MergeRowDataConditionFunction; /** Function for style cell base on condition. */ - /** Function for style cell base on condition. */ styleCellCondition?: StyleCellConditionFunction; /** Function for comment base on condition. */ - /** Function for comment base on condition. */ commentCondition?: CommentConditionFunction; /** Sort and filter options for the sheet. */ - /** Sort and filter options for the sheet. */ sortAndFilter?: SortAndFilter; /** State of the sheet (hidden or visible). */ - /** State of the sheet (hidden or visible). */ state?: "hidden" | "visible"; /** Options for the header row. */ - /** Options for the header row. */ headerRowOption?: object; /** Protection options for the sheet. */ - /** Protection options for the sheet. */ protectionOption?: ProtectionOption; /** Height of the header. */ - /** Height of the header. */ headerHeight?: number; /** Array of checkboxes in the sheet. */ - /** Array of checkboxes in the sheet. */ checkbox?: Checkbox[]; /** View options for the sheet. */ - /** View options for the sheet. */ viewOption?: ViewOption; /** Indicates if the sheet is right-to-left. */ - /** Indicates if the sheet is right-to-left. */ rtl?: boolean; /** Page break options for the sheet. */ - /** Page break options for the sheet. */ pageBreak?: PageBreak; /** Options for displaying the sheet as a table. */ - /** Options for displaying the sheet as a table. */ asTable?: AsTableOption; /** Array of dropdowns in the sheet. */ dropDowns?: DropDown[]; - /** Array of dropdowns in the sheet. */ - dropDowns?: DropDown[]; } -/** - * Represents side-by-side data in the sheet. - * @interface - */ /** * Represents side-by-side data in the sheet. * @interface @@ -1290,10 +895,6 @@ declare interface SideBySide { */ export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; -/** - * Represents a single-reference formula setting. - * @interface - */ /** * Represents a single-reference formula setting. * @interface @@ -1305,20 +906,12 @@ declare interface SingleRefFormulaSetting { styleId?: string; } -/** - * Types of single-reference formulas. - * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType - */ /** * Types of single-reference formulas. * @typedef {"LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"} SingleRefFormulaType */ declare type SingleRefFormulaType = "LEN" | "MODE" | "UPPER" | "LOWER" | "PROPER" | "RIGHT" | "LEFT" | "ABS" | "POWER" | "MOD" | "FLOOR" | "CEILING" | "ROUND" | "SQRT" | "COS" | "SIN" | "TAN" | "COT" | "COUNTIF" | "SUMIF" | "TRIM"; -/** - * Represents sort and filter options. - * @interface - */ /** * Represents sort and filter options. * @interface @@ -1328,67 +921,39 @@ declare interface SortAndFilter { ref?: string; } -/** - * Represents the body of a style. - * @interface - */ /** * Represents the body of a style. * @interface */ declare interface StyleBody { - /** The font family of the text. */ /** The font family of the text. */ fontFamily?: string; /** The type of the style.(if not define used for cells, for other type should be define) */ - /** The type of the style.(if not define used for cells, for other type should be define) */ type?: StyleType; /** The size of the font. */ - /** The size of the font. */ size?: number; /** The index of the style(!!it's will override by process,Don't set value for it). */ - /** The index of the style(!!it's will override by process,Don't set value for it). */ index?: number; /** The alignment options of the text. */ - /** The alignment options of the text. */ alignment?: AlignmentOption; /** The border options. */ - /** The border options. */ border?: BorderOption; /** The format of the text. */ - /** The format of the text. */ format?: string; /** Indicates if the style is bold. */ - /** Indicates if the style is bold. */ bold?: boolean; /** Indicates if the style is underlined. */ - /** Indicates if the style is underlined. */ underline?: boolean; /** Indicates if the style is italic. */ - /** Indicates if the style is italic. */ italic?: boolean; /** Indicates if the style has double underline. */ - /** Indicates if the style has double underline. */ doubleUnderline?: boolean; /** The color of the style. */ - /** The color of the style. */ color?: string; /** The background color of the style. */ - /** The background color of the style. */ backgroundColor?: string; } -/** - * Function type for style cell condition. - * @callback StyleCellConditionFunction@callback StyleCellConditionFunction - * @param {Header | string | number | undefined} data - The data to apply the condition to. - * @param {Header | Data} object - The data object. - * @param {number} rowIndex - The row index. - * @param {number} colIndex - The column index. - * @param {boolean} fromHeader - Indicates if the condition is from the header. - * @param {string[]} styleKeys - The style keys. - * @returns {string | null} The style key or null. - */ /** * Function type for style cell condition. * @callback StyleCellConditionFunction@callback StyleCellConditionFunction @@ -1402,10 +967,6 @@ declare interface StyleBody { */ declare type StyleCellConditionFunction = (data: Header | string | number | undefined, object: Header | Data, rowIndex: number, colIndex: number, fromHeader: boolean, styleKeys: string[]) => string | null; -/** - * Represents a style mapper. - * @interface - */ /** * Represents a style mapper. * @interface @@ -1442,10 +1003,6 @@ declare interface StyleMapper { }; } -/** - * Represents a collection of styles. - * @interface - */ /** * Represents a collection of styles. * @interface @@ -1454,10 +1011,6 @@ declare interface Styles { [key: string]: StyleBody; } -/** - * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). - * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType - */ /** * Types of styles that can be applied(not value for cell, CF/conditionalFormatting for conditionalFormatting option and HF/headerFooter for headerFooter option). * @typedef {"conditionalFormatting" | "CF" | "headerFooter" | "HF"} StyleType @@ -1472,10 +1025,6 @@ declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; */ export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; -/** - * Represents theme options. - * @interface - */ /** * Represents theme options. * @interface @@ -1490,10 +1039,6 @@ declare interface ThemeOption { filterKeys?: string[]; } -/** - * Represents the title of the sheet. - * @interface - */ /** * Represents the title of the sheet. * @interface @@ -1507,7 +1052,6 @@ declare interface Title { styleId?: string; text?: string; multiStyleValue?: MultiStyleValue[]; - multiStyleValue?: MultiStyleValue[]; comment?: Comment_2 | string; } @@ -1540,51 +1084,36 @@ declare namespace Validator { } export { Validator } -/** - * Options for configuring the view of the sheet. - * @interface - */ /** * Options for configuring the view of the sheet. * @interface */ declare interface ViewOption { - /** The type of view. */ /** The type of view. */ type?: "pageLayout" | "pageBreakPreview"; /** Indicates if the grid should be hidden. */ - /** Indicates if the grid should be hidden. */ hideGrid?: boolean; /** Indicates if the headlines should be hidden. */ - /** Indicates if the headlines should be hidden. */ hideHeadlines?: boolean; /** Indicates if the ruler should be hidden. */ - /** Indicates if the ruler should be hidden. */ hideRuler?: boolean; /** Options for freezing rows or columns. */ - /** Options for freezing rows or columns. */ frozenOption?: { - /** The type of freezing. */ /** The type of freezing. */ type: "ROW" | "COLUMN" | "BOTH" | "R" | "C" | "B"; /** The index/position at which to freeze. */ - /** The index/position at which to freeze. */ index: number | { r: number; c: number; }; }; /** Options for splitting the view. */ - /** Options for splitting the view. */ splitOption?: { - /** The type of split. */ /** The type of split. */ type: "VERTICAL" | "HORIZONTAL" | "BOTH" | "V" | "H" | "B"; /** The start position of the split. */ - /** The start position of the split. */ startAt?: ViewStart; /** The position of the split. */ - /** The position of the split. */ split: number | { x: number; y: number; @@ -1592,10 +1121,6 @@ declare interface ViewOption { }; } -/** - * Options for the start of the view. - * @interface - */ /** * Options for the start of the view. * @interface diff --git a/dist/index-BPuSW_h3.js b/dist/index-BPuSW_h3.js deleted file mode 100644 index cca826e..0000000 --- a/dist/index-BPuSW_h3.js +++ /dev/null @@ -1,44 +0,0 @@ -System.register("ExcelTable",[],function(Pe,ye){"use strict";return{execute:function(){Pe({d:ho,e:go,f:xo,g:Fe,h:bo,i:Co,j:Be,k:po,r:Ut,s:uo,t:yo});function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function Yt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=Yt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function ce(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function de(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=ce(e);e=r||""}return e.replace(/^#/,"")}function Vt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:Vt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},zt=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let s=0;s0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mm.j)).default;let g;if(typeof e=="string"&&e.length){let m,s=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,s=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return s?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let s=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let j=D;Object.keys(t).forEach(S=>{var d;j=j.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=j})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await ye.import("./FileSaver.min-DXmtgrTw.js").then(f=>f.F)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Wt(e,t,r,o,n,l,g,u){let m=[],s="both",f=[];!t||t===0?(t=1,s="col"):f.push(t-1),!e||e===0?(e=0,s="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,s]:[s],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let D=0;D=1?(v["c"+S]=l,l="",g+="*",j--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":D>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Gt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},s=40;if(l){let D=!1,j=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=ce(z.backgroundColor);if(!D)j=G.length,D=!0,typeof o=="function"?s=o(Number(z.height.substring(0,z.height.length-2)),d,!0):s=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=ce(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=ce(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=ce(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=ce(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let X=ce(P.backgroundColor);!X&&Z&&(X=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...X?{backgroundColor:X}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let E;typeof n=="function"?E=n(Number(P.width.substring(0,P.width.length-2)),oe):E=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),q=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...q?{rowspan:q}:{},text:N.textContent,...isNaN(E)||E<=0?{}:{size:E}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((X,K)=>{if("c"+(K+B)in N)for(let M=0;M<=j+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(X,null);if(X.getAttribute("colspan")||X.getAttribute("rowspan")){let M=Wt(X.getAttribute("colspan")*1,X.getAttribute("rowspan")*1,K,j,N,X.textContent,oe,N);u.length{u.length500,...isNaN(q)?{}:{size:q},...E?{border:E}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=X.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length -`+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` -`+r.reduce((m,s)=>(s=s.toLowerCase(),u[s]?m:s=="svg"?(u.png=!0,u.svg=!0,m+''):s=="jpeg"||s=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[s]=!0,m+'')),"")+t.reduce((m,s)=>m+'',"")+e+(g.length>0?g.reduce((m,s)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,s)=>m+'',"")+(n.length>0?n.reduce((m,s,f)=>m+'',""):"")+''}function Jt(e,t){return` -Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let s=t,f=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,v=e.indexOf(":")>0,D=s.referenceCells?s.referenceCells:e,j=v?e.substring(0,e.indexOf(":")):e,S=j.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=s.returnType?s.returnType:s.isArray||v?' t="str"':"",z="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"",Z=s.isArray||v?' t="array" ref="'+D+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const s=t;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const f="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType+"()"}else{let f="NOW()";const v="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+s.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const s=t;let f="";typeof s.value<"u"&&(f=","+s.value);let v="";s.type=="COT"&&(v="_xlfn.");const D="styleId"in s&&o&&typeof s.styleId=="string"&&o[s.styleId]?' s="'+o[s.styleId].index+'"':"";n='"+v+s.type+"("+s.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const s=t;n='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` -`;return}u>0&&(m=' xml:space="preserve"',l+=` -`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"Β£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"Β₯":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"β‚½":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"β‚Ό":{key:176,value:''},"β‚Ό1":{key:175,value:''},"β‚½1":{key:174,value:''},"β‚½2":{key:173,value:''},"β‚½3":{key:172,value:''},Ψ±ΩŠΨ§Ω„:{key:171,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=Qt,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",fe="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(W!="-"||fe!="Regular")&&(C='&"'+W+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=de(x.color,o),W=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const Y={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);Y.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);Y.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` -`};let we=1024;const Te={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},ke={checkbox:` - - - - `};let ae=[],ie="",xe=!1,pe=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",fe="",Ee="",Se="",je="",nt=!1,_t="",It="",Pt="",jt="",be=Object.assign([],a.merges),ue=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,he=[],Me="",qe=[],Rt=[],at=[],it=[],Oe={},De="",Le=!1,st="";if(a.rtl&&(Se+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){je="pageBreakPreview";const i=T.row.length;st+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){je="pageBreakPreview";const i=T.column.length;st+=''+T.column.reduce((y,p)=>y+'',"")+""}}let Dt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Le=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Dt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(je=i.type),i.hideRuler&&(Se+=' showRuler="0" '),i.hideGrid&&(Se+=' showGridLines="0" '),i.hideHeadlines&&(Se+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Le=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Se+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Ee='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Se+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Ee='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Se+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Ee='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const T=ge.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=Fe(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),we++;let c=w+""+we++;const _="_x0000_s"+c;It+=Te.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=Fe(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Fe(A,l);O.row+=1,O.col+=1,h.end={...O}}jt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",Pt+='',_t+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;ct=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=J++,F="image"+_+"."+c,A=await bt(T,F,o,e.fetch);A||y("image not load"),ve.push(c),i({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",ve.push(p);const c="image"+J+++"."+p;return{type:p,image:await bt(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(be.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let me=he.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=he.indexOf(ee);re<0?he.push(ee):me=re}qe.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,me)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,R):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',pe||(pe=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Rt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Oe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=he.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=he.indexOf(le);V<0?he.push(le):O=V}qe.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(xe=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Xe(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` -`};let Te=1024;const Ee={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Oe={checkbox:` - - - - `};let ie=[],se="",be=!1,he=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",me="",Se="",ke="",je="",nt=!1,It="",Pt="",jt="",Rt="",Ce=Object.assign([],a.merges),ye=Object.assign({},a.formula),lt=Object.assign([],a.conditionalFormatting),Re=!1,ue=[],Me="",Ye=[],Dt=[],at=[],it=[],Fe={},De="",Le=!1,st="";if(a.rtl&&(ke+=' rightToLeft="1" '),a.pageBreak){const E=a.pageBreak;if(E.row&&Array.isArray(E.row)){je="pageBreakPreview";const s=E.row.length;st+=''+E.row.reduce((y,p)=>y+'',"")+""}if(E.column&&Array.isArray(E.column)){je="pageBreakPreview";const s=E.column.length;st+=''+E.column.reduce((y,p)=>y+'',"")+""}}let Lt="";if(a.pageOption){const E=a.pageOption;if(E.isPortrait&&(Le=!0),E.margin){const F=E.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),Lt=''}let s="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(E[F]){const h=E[F];typeof h=="object"&&Object.keys(h).forEach(O=>{s.indexOf(O)<0&&(s+=O);const le=h[O];let q="";if(Object.keys(le).reduce((D,I)=>(I=="l"?D.splice(0,0,I):I=="c"?D.splice(1,0,I):I=="r"&&D.splice(2,0,I),D),[]).forEach(D=>{const I=le[D];q+="&"+D.toUpperCase(),I.styleId&&z[I.styleId]&&(q+=z[I.styleId]),I.text&&(q+=I.text)}),q="<"+O+A+">"+q+"",O=="odd")y+=q;else if(O=="even")p+=q;else if(O=="first")c+=q;else throw"type error"})}}),De=y+p+c,De.length>0){Le=!0;const F=s.length==7||s.length==12?' differentOddEven="1"':"",A=s.indexOf("first")>=0?' differentFirst="1"':"";De=""+De+""}}if(a.viewOption){let E="";const s=a.viewOption;s.type&&(je=s.type),s.hideRuler&&(ke+=' showRuler="0" '),s.hideGrid&&(ke+=' showGridLines="0" '),s.hideHeadlines&&(ke+=' showRowColHeaders="0" ');let y=s.splitOption;if(typeof y>"u"&&(Le=!1,typeof s.frozenOption=="object")){const p=s.frozenOption;if(E=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=He(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(ke+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Se='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(ke+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Se='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(ke+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Se='"}}if(Le&&(je="pageLayout"),a.checkbox){nt=!0;const E=xe.checkbox;a.checkbox.forEach((s,y)=>{let p=E;if(s.link){let O=Ae(s.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");s.mixed?p=p.replace("**value**",'checked="Mixed"'):s.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),s.threeD&&p.replace('noThreeD="1"',""),ie.push(p),Te++;let c=w+""+Te++;const _="_x0000_s"+c;Pt+=Ee.checkbox.replace("***id***",_).replace("***text***",s.text);let F=s.startStr,A=s.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(s.col&&s.row&&(h={start:{col:s.col,row:s.row-1},end:{col:s.col,row:s.row}}),typeof F=="string"&&F.length>=2){let O=Ae(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=Ae(A,l);O.row+=1,O.col+=1,h.end={...O}}Rt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",jt+='',It+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+s.text+""})}let ct;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const E=a.backgroundImage;ct=new Promise(async(s,y)=>{let p=E.lastIndexOf("."),c;p>0?(c=E.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await Ct(E,F,o,e.fetch);A||y("image not load"),we.push(c),s({name:F,type:c,image:A,ref:_})})}let ft;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),ft=Promise.all([...a.images.map(async(E,s)=>{let y=E.url.lastIndexOf("."),p;y>0?(p=E.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",we.push(p);const c="image"+X+++"."+p;return{type:p,image:await Ct(E.url,c,o,e.fetch),obj:E,i:s,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const E=a.headers.length;let s="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:E,q=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",D=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(Ce.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Re=!0;const Q=Ge(_,N.commentSyntax.value,d);let de=ue.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=ue.indexOf(ee);re<0?ue.push(ee):de=re}Ye.push({row:k+F-1,col:h}),Me+=Ze(I,Q.commentStr,Q.commentStyle,de)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},s+='',s+=''+B+"",s+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,D):P+=""+Ne(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),ce&&(H+='',he||(he=f==null?void 0:f.folder("tables"))),V.start=l[p]+""+k,V.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(ce&&(H+=''),p&&(_+=p),c.formula&&at.push(_),c.conditionalFormatting&&it.push(_),Dt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(Fe[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Re=!0;const h=Ge(c.comment,N.commentSyntax.value,d);let O=ue.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const q=ue.indexOf(le);q<0?ue.push(le):O=q}Ye.push({row:k-1,col:_}),Me+=Ze(F,h.commentStr,h.commentStyle,O)}const A=ye&&ye[F];if(A){const h=We(F,A,b,e.styles);h.needCalcChain&&(be=!0,se+=h.chainCell),C+=h.cell,delete ye[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=Je(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+Ne(c.text)+"",L[c.text]=c.text,B++}}),ce&&(H+=""),a.withoutHeader)C+=s;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=s+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` -`};let ve=1024;const we={checkbox:` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
`},Se={checkbox:` - - - - `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I
"); - const H = x.border; - let k = ""; - if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.top || H.full) && (k += ''), (H.bottom || H.full) && (k += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { - const C = r[x.format]; - C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); - } - return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; - }, - { - conditionalFormatting: { - count: G ? 1 : 0, - value: ' ' - }, - commentSyntax: { - value: {} - }, - format: { - count: 0, - value: "" - }, - border: { - count: 1, - value: "" - }, - fill: { - count: 2, - value: "" - }, - font: { - count: 2, - value: "" - }, - cell: { - count: 2, - value: "" - } - } - ); - f == null || f.file("styles.xml", Gt(N, G)); - let oe = '', P = "", B = 0, X = "", K = "", L = {}; - const E = {}; - let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; - const ye = { - checkbox: ` -` - }; - let ve = 1024; - const we = { - checkbox: ` - - - -
***text***
-
- - - - 0, 2, 0, 2, 0, 86, 1, 0 - False - False - Center - - -
` - }, Se = { - checkbox: ` - - - - ` - }; - let ae = [], ie = "", ge = !1, de = null; - for (let w = 0; w < s; w++) { - const a = e.sheet[w], b = w + 1; - let x = {}, Y = { - start: "", - end: "" - }; - const se = a.asTable; - let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( - [], - a.conditionalFormatting - ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; - if (a.rtl && (Ee += ' rightToLeft="1" '), a.pageBreak) { - const T = a.pageBreak; - if (T.row && Array.isArray(T.row)) { - _e = "pageBreakPreview"; - const i = T.row.length; - Ze += '' + T.row.reduce( - (y, p) => y + '', - "" - ) + ""; - } - if (T.column && Array.isArray(T.column)) { - _e = "pageBreakPreview"; - const i = T.column.length; - Ze += '' + T.column.reduce( - (y, p) => y + '', - "" - ) + ""; - } - } - let gt = ""; - if (a.pageOption) { - const T = a.pageOption; - if (T.isPortrait && (je = !0), T.margin) { - const F = T.margin; - let A = { - left: 0.7, - right: 0.7, - top: 0.75, - bottom: 0.75, - header: 0.3, - footer: 0.3 - }; - Object.keys(A).forEach((h) => { - typeof F[h] == "number" && (A[h] = F[h]); - }), gt = ''; - } - let i = "", y = "", p = "", c = ""; - if (["header", "footer"].forEach((F) => { - const A = F.charAt(0).toUpperCase() + F.substring(1); - if (T[F]) { - const h = T[F]; - typeof h == "object" && Object.keys(h).forEach((O) => { - i.indexOf(O) < 0 && (i += O); - const le = h[O]; - let V = ""; - if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { - const I = le[R]; - V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); - }), V = "<" + O + A + ">" + V + "", O == "odd") - y += V; - else if (O == "even") - p += V; - else if (O == "first") - c += V; - else - throw "type error"; - }); - } - }), Pe = y + p + c, Pe.length > 0) { - je = !0; - const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; - Pe = "" + Pe + ""; - } - } - if (a.viewOption) { - let T = ""; - const i = a.viewOption; - i.type && (_e = i.type), i.hideRuler && (Ee += ' showRuler="0" '), i.hideGrid && (Ee += ' showGridLines="0" '), i.hideHeadlines && (Ee += ' showRowColHeaders="0" '); - let y = i.splitOption; - if (typeof y > "u" && (je = !1, typeof i.frozenOption == "object")) { - const p = i.frozenOption; - if (T = ' state="frozen" ', p.type == "R" || p.type == "ROW") { - let c; - typeof p.index == "object" ? c = p.index.r : c = p.index, y = { - startAt: { - b: "A" + (c + 1) - }, - type: "H", - split: c - }; - } else if (p.type == "C" || p.type == "COLUMN") { - let c; - typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { - type: "V", - startAt: { - r: l[c] + 1 - }, - split: c - }; - } else if (p.type == "B" || p.type == "BOTH") { - let c = "", _; - typeof p.index == "number" ? (_ = p.index, c = l[p.index] + (p.index + 1)) : (_ = { - y: p.index.r, - x: p.index.c - }, c = l[p.index.c] + (p.index.r + 1)), y = { - startAt: { - two: c - }, - type: "B", - split: _ - }; - } - } - if (y) - if (y.type == "H" || y.type == "HORIZONTAL") { - let p; - y.startAt && (p = y.startAt.b, y.startAt.t && (Ee += ' topLeftCell="' + y.startAt.t + '"')), p || (p = "A1"), Te = '"; - } else if (y.type == "V" || y.type == "VERTICAL") { - let p; - y.startAt && (p = y.startAt.r, y.startAt.l && (Ee += ' topLeftCell="' + y.startAt.l + '"')), p || (p = "A1"), Te = '"; - } else { - let p; - y.startAt && (p = y.startAt.two, y.startAt.one && (Ee += ' topLeftCell="' + y.startAt.one + '"')), p || (p = "A1"), Te = '"; - } - } - if (je && (_e = "pageLayout"), a.checkbox) { - ze = !0; - const T = ye.checkbox; - a.checkbox.forEach((i, y) => { - let p = T; - if (i.link) { - let O = Re(i.link, l); - p = p.replace( - "**fmlaLink**", - 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' - ); - } else - p = p.replace("**fmlaLink**", ""); - i.mixed ? p = p.replace("**value**", 'checked="Mixed"') : i.checked ? p = p.replace("**value**", 'checked="Checked"') : p = p.replace("**value**", ""), i.threeD && p.replace('noThreeD="1"', ""), ae.push(p), ve++; - let c = w + "" + ve++; - const _ = "_x0000_s" + c; - pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); - let F = i.startStr, A = i.endStr, h = { - start: { - col: 0, - row: 0 - }, - end: { - col: 1, - row: 1 - } - }; - if (i.col && i.row && (h = { - start: { - col: i.col, - row: i.row - 1 - }, - end: { - col: i.col, - row: i.row - } - }), typeof F == "string" && F.length >= 2) { - let O = Re(F, l); - h.start = { - ...O - }, h.end = { - col: O.col + 1, - row: O.row + 1 - }; - } - if (typeof A == "string" && A.length >= 2) { - let O = Re(A, l); - O.row += 1, O.col += 1, h.end = { - ...O - }; - } - ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; - }); - } - let Xe; - if (a.backgroundImage) { - v == null && (v = f == null ? void 0 : f.folder("media")); - const T = a.backgroundImage; - Xe = new Promise(async (i, y) => { - let p = T.lastIndexOf("."), c; - p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; - const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); - A || y("image not load"), Ce.push(c), i({ - name: F, - type: c, - image: A, - ref: _ - }); - }); - } - let Je; - if (a.images && (v == null && (v = f == null ? void 0 : f.folder("media")), Je = Promise.all([ - ...a.images.map(async (T, i) => { - let y = T.url.lastIndexOf("."), p; - y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); - const c = "image" + J++ + "." + p; - return { - type: p, - image: await _t(T.url, c, o, e.fetch), - obj: T, - i, - name: c - }; - }) - ])), Array.isArray(a.headers) && a.headers.length) { - const T = a.headers.length; - let i = ""; - if (a.title) { - const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); - if (xe.push( - I + ":" + l[h + le - 1] + (k + O + F) - ), typeof _ < "u") { - Ie = !0; - const Q = rt( - _, - N.commentSyntax.value, - d - ); - let fe = pe.length; - if (Q.hasAuthor && typeof Q.author < "u") { - let ee = Q.author.toString(); - const re = pe.indexOf(ee); - re < 0 ? pe.push(ee) : fe = re; - } - He.push({ - row: k + F - 1, - col: h - }), Le += nt( - I, - Q.commentStr, - Q.commentStyle, - fe - ); - } - typeof c.text == "string" && (x[k + F] = { - startTag: '', - details: '' + B + "", - endTag: "" - }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( - c.multiStyleValue, - N.commentSyntax.value, - R - ) : P += "" + $e(c.text) + ""), k += F + O + 1; - } - let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; - if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { - if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( - c, - null, - _, - !0 - ) === !0 && (ke[l[_]] = { - inProgress: !0, - start: k - }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( - c, - c, - k, - _, - !0, - S - ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) - return; - const F = l[_] + "" + k; - if (typeof a.commentCondition == "function") { - const h = a.commentCondition( - c, - null, - c.label, - k, - _, - !0 - ); - (typeof h == "string" || typeof h == "object" && h != null) && (c.comment = h); - } - if (c.comment) { - Ie = !0; - const h = rt( - c.comment, - N.commentSyntax.value, - d - ); - let O = pe.length; - if (h.hasAuthor && typeof h.author < "u") { - let le = h.author.toString(); - const V = pe.indexOf(le); - V < 0 ? pe.push(le) : O = V; - } - He.push({ - row: k - 1, - col: _ - }), Le += nt( - F, - h.commentStr, - h.commentStyle, - O - ); - } - const A = ue && ue[F]; - if (A) { - const h = ot( - F, - A, - b, - e.styles - ); - h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; - } else { - if (C += '' + B + "", typeof a.multiStyleCondition == "function") { - const h = a.multiStyleCondition( - c, - null, - c.label, - k, - _, - !0 - ); - h && (c.multiStyleValue = h); - } - c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( - c.multiStyleValue, - N.commentSyntax.value, - y || "" - ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; - } - }), se && (H += ""), a.withoutHeader) - C += i; - else { - const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; - x[k] = { - startTag: c, - endTag: "", - details: C - }, C = i + c + C + "", k++; - } - if (Array.isArray(a.data)) { - const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; - a.data.forEach((h, O) => { - if (h.mergeType) - for (let I = 0; I < h.mergeType.length; I++) { - const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; - let re = ""; - Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); - } - const le = h.rowStyle, V = '", - details: R - }, k++, C += ""; - }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); - } - if (We.length > 0 && We.forEach((c) => { - const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; - ue[A + "" + k] = { - start: a.withoutHeader ? A + "1" : A + "2", - end: A + "" + (k - 1), - type: F.formula.type, - ...F.formula.styleId ? { styleId: F.formula.styleId } : {} - }; - }), Ge.length > 0 && Ge.forEach((c) => { - const _ = a.headers[c]; - _.conditionalFormatting && Ue.push({ - ..._.conditionalFormatting, - start: a.withoutHeader ? l[c] + "1" : l[c] + "2", - end: l[c] + "" + (k - 1) - }); - }), ue) { - const c = Object.keys(ue).sort( - (_, F) => _ > F ? 1 : -1 - ); - if (c.length) { - let _ = {}; - c.forEach((F) => { - const A = ot( - F, - ue[F], - b, - e.styles - ); - A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; - }), Object.keys(_).forEach((F) => { - const A = F, h = _[A]; - let O = x[A]; - if (O) { - const le = O.startTag + O.details + h + O.endTag; - let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); - C = C.replace(V, le); - } else - C += '' + h + "", x[A] = { - startTag: '', - endTag: "", - details: h - }; - }); - } - } - } - w > 0 && (oe += ''); - const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; - X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); - const bt = a.sortAndFilter ? 'filterMode="1"' : ""; - let Ct = -1; - Xe && await Xe.then((T) => { - let i = T; - Ct = i.ref, v == null || v.file(i.name, i.image); - }); - let Ne = !1, Qe = "", vt = ""; - Je && (Ne = !0, await Je.then((T) => { - let i = ""; - T.forEach((y, p) => { - const c = p + 1; - let _ = y.image; - const F = y.name; - let A = y.obj.from, h = y.obj.to, O = y.obj.margin; - y.type; - let le = y.obj.type, V = y.obj.extent; - typeof V > "u" && (V = { - cx: 2e5, - cy: 2e5 - }); - let R = { - start: { - col: 0, - row: 0, - mL: 0, - mT: 0 - }, - end: { - col: 1, - row: 1, - mR: 0, - mB: 0 - } - }; - if (typeof A == "string" && A.length >= 2) { - let I = Re(A, l); - R.start = { - ...I - }, R.end = { - col: I.col + 1, - row: I.row + 1 - }; - } - if (typeof h == "string" && h.length >= 2) { - let I = Re(h, l); - I.row += 1, I.col += 1, R.end = { - ...I - }; - } - R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; - }), vt = ` -` + i + ""; - })), xe = [...new Set(xe)]; - let wt = "", Ae = 1; - Ue.length > 0 && (wt = Ue.reduce((T, i) => { - if (i.type == "cells") - return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; - if (i.type == "top") - return T + '"; - if (i.type == "iconSet") { - let y = ""; - return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); - } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; - }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { - indexId: q + 1, - key: "sheet" + (w + 1), - sheetName: xt, - sheetDataTableColumns: H, - backgroundImageRef: Ct, - sheetDimensions: Y, - asTable: se || !1, - sheetDataString: C, - sheetDropDown: ro(a.dropDowns), - sheetBreakLine: Ze, - viewType: _e, - hasComment: Ie, - drawersContent: Qe, - cFDataString: wt, - sheetMargin: gt, - sheetHeaderFooter: Pe, - isPortrait: je, - drawersRels: vt, - hasImages: Ne, - hasCheckbox: ze, - formRel: ht, - checkboxDrawingContent: dt, - checkboxForm: ae, - checkboxSheetContent: ut, - checkboxShape: pt, - commentString: Le, - commentAuthor: pe, - shapeCommentRowCol: He, - splitOption: Te, - sheetViewProperties: Ee, - sheetSizeString: W.length > 0 ? "" + W + "" : "", - protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", - merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", - selectedView: !!a.selected, - sheetSortFilter: ce, - tabColor: a.tabColor ? '' : "' - }, q++; - } - ge && (q++, K += '', f == null || f.file( - "calcChain.xml", - ` -` + ie + "" - )); - let Mt = Object.keys(E), qe = m.folder("_rels"); - qe == null || qe.file( - ".rels", - ` - ` - ); - let Oe = m.folder("docProps"); - Oe == null || Oe.file( - "core.xml", - ` -` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" - ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( - "workbook.xml", - ` - ` + (U ? '' : "") + " " + X + " " - ), f == null || f.file( - "sharedStrings.xml", - ` - ' + P + "" - ); - let Ye = f == null ? void 0 : f.folder("_rels"); - Ye == null || Ye.file( - "workbook.xml.rels", - ` - ` + K + " " - ); - let Ve = f == null ? void 0 : f.folder("theme"); - Ve == null || Ve.file( - "theme1.xml", - ` -` - ); - let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; - if (Mt.forEach((w, a) => { - const b = E[w]; - let x = "", Y = { - form: !1, - drawing: !1, - vmlDrwing: !1, - comment: !1, - table: !1, - sheetDrawingsPushed: !1 - }; - const se = b.sheetDataTableColumns; - if (se.length > 0) { - mt.push("table" + (a + 1) + ".xml"); - const C = b.asTable, W = b.sheetDimensions; - de == null || de.file( - "table" + (a + 1) + ".xml", - ` -' + se + '
' - ), x += ''; - } - const H = "drawing" + (De.length + 1) + ".xml"; - if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( - H + ".rels", - b.drawersRels.toString() - ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( - H, - ` -` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" - )), b.hasComment) { - ft.push(a + 1); - let C = b.commentAuthor; - f == null || f.file( - "comments" + (a + 1) + ".xml", - ` -` + (Array.isArray(C) && C.length > 0 ? C.reduce( - (W, ce) => W + "" + ce + "", - "" - ) : "") + "" + b.commentString + "" - ), x += '' + (Y.vmlDrwing ? "" : ''); - } - if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( - "vmlDrawing" + (a + 1) + ".vml", - '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" - )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { - const C = Fe == null ? void 0 : Fe.folder("_rels"); - C == null || C.file( - "sheet" + (a + 1) + ".xml.rels", - ` - ` + x + "" - ); - } - let k = ""; - b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( - b.key + ".xml", - ` -` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" - ); - }), ae.length > 0) { - let w = f == null ? void 0 : f.folder("ctrlProps"); - ae.forEach((a, b) => { - w == null || w.file("ctrlProp" + (b + 1) + ".xml", a); - }); - } - if (m.file( - "[Content_Types].xml", - Zt( - oe, - ft, - [...new Set(Ce)], - De, - ae, - ge, - mt - ) - ), o) - return m.generateAsync({ - type: e.generateType ? e.generateType : "nodebuffer" - }).then((w) => w); - if (e.notSave) - return m.generateAsync({ type: "blob" }).then((w) => w.slice( - 0, - w.size, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - )); - m.generateAsync({ type: "blob" }).then(function(w) { - import("./FileSaver.min-BEH1o5YI.js").then((a) => a.F).then((a) => { - const { saveAs: b } = a; - b( - w, - (e.fileName ? e.fileName : "tableRecord") + ".xlsx" - ); - }); - }); -} -function no(e) { - const t = e.length; - let r = 0, o = {}, n = {}, l = {}; - for (let s = 0; s < t; s++) { - const f = e[s], v = f.length; - let D = {}; - for (let j = 0; j < v; j++) { - r++; - const S = f[j]; - let d; - S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { - headers: [], - data: [], - labelCounter: 0, - seenAt: s - }), d in n || (n[d] = { - index: s, - value: 0 - }), d in l || (o[d].labelCounter = 0, l[d] = !0); - let G = []; - const z = o[d].headers.length; - let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ - label: "c" + o[d].labelCounter, - text: N ? L.text : "" - }), Z["c" + o[d].labelCounter] = L.text, { - ...K, - [L.label]: "c" + o[d].labelCounter - }), {}); - if (o[d].headers.push(...G), S.spaceX) - for (let K = 0; K < S.spaceX; K++) - o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ - label: "c" + o[d].labelCounter, - text: "" - }); - n[d].index + 1 == s && (D[d] = n[d].value); - let P = D[d] || 0; - P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { - ...o[d].data[P], - ...Z - }, o[d].headerIndex = P, P++); - let B = Object.keys(oe), X = S.data.length >= o[d].data.length; - if (o[d].data = S.data.reduce((K, L, E) => { - let $ = {}; - return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { - let U = oe[q]; - $[U] = L[q] ? L[q] : ""; - }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; - }, o[d].data), X && S.spaceY) { - const K = o[d].headers.length; - for (let L = 0; L < S.spaceY; L++) { - let E = {}; - for (let $ = 0; $ < K; $++) { - const q = o[d].headers[$]; - E[q.label] = ""; - } - o[d].data.push(E); - } - } - n[d] = { - value: Math.max(o[d].data.length, n[d].value), - index: s - }; - } - l = {}; - } - let g = Object.keys(o), u = []; - return g.reduce( - (s, f) => { - let v = o[f]; - return s.sheet.push({ - ...v, - name: f - }), s; - }, - { sheet: u } - ); -} -function it(e) { - return /^[A-Z]+[1-9][1-9]*:[A-Z]+[1-9][1-9]*$/.test(e); -} -function st(e) { - return /^[A-Z]+[1-9][1-9]*$/.test(e); -} -const lo = { - fontFamily: { - mode: "TYPE_CHECK", - type: "string" - }, - type: { - mode: "TYPE_CHECK", - type: "string" - }, - size: { - mode: "TYPE_CHECK", - type: "number" - }, - index: { - mode: "TYPE_CHECK", - type: "number" - }, - alignment: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - return t.rtl && t.ltr && o && console.warn("Alignment-rtl and ltr cannot be used together."), (t.readingOrder && t.ltr || t.readingOrder && t.rtl) && o && console.warn( - "Alignment-readingOrder cannot be used with rtl or ltr." - ), !0; - } - }, - border: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = ["full", "top", "left", "right", "bottom"], l = [ - "slantDashDot", - "dotted", - "thick", - "hair", - "dashDot", - "dashDotDot", - "dashed", - "thin", - "mediumDashDot", - "medium", - "double", - "mediumDashed" - ]; - return Object.keys(t).forEach((u) => { - const m = u; - if (n.indexOf(m) < 0) - throw 'border-The type of border is not valid. Valid options include "full," "top," "left," "right," and "bottom."'; - const s = t[m]; - if (!("color" in s)) - throw "border-The border must have a color."; - if (!("style" in s)) - throw "border-The border needs a style."; - if (typeof s.style == "string" && l.indexOf(s.style) < 0) - throw "border-An invalid style has been used."; - }), !0; - } - }, - format: { - mode: "TYPE_CHECK", - type: "string" - }, - bold: { - mode: "TYPE_CHECK", - type: "boolean" - }, - underline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - italic: { - mode: "TYPE_CHECK", - type: "boolean" - }, - doubleUnderline: { - mode: "TYPE_CHECK", - type: "boolean" - }, - color: { - mode: "TYPE_CHECK", - type: "string" - }, - backgroundColor: { - mode: "TYPE_CHECK", - type: "string" - } -}, ao = { - notSave: { - mode: "TYPE_CHECK", - type: "boolean" - }, - creator: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - backend: { - mode: "TYPE_CHECK", - type: "boolean" - }, - activateConditionalFormatting: { - mode: "TYPE_CHECK", - type: "boolean" - }, - fileName: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - generateType: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["nodebuffer", "array", "binarystring", "base64"] - }, - addDefaultTitleStyle: { - mode: "TYPE_CHECK", - type: "boolean" - }, - created: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - modified: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - numberOfColumn: { - mode: "TYPE_CHECK", - type: "number", - min: 26 - }, - createType: { - mode: "TYPE_CHECK", - type: "string" - }, - styles: { - mode: "TYPE_CHECK", - type: "object" - }, - sheet: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - } -}, io = { - headers: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - data: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object" - }, - withoutHeader: { - mode: "TYPE_CHECK", - type: "boolean" - }, - mapSheetDataOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = Object.keys(t), l = ["outlineLevel", "hidden", "height"]; - return n.forEach((g) => { - l.indexOf(g) < 0 && o && console.warn( - 'The Schema of mapSheetDataOption does not include the "' + g + '" property.' - ); - }), !0; - } - }, - backgroundImage: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - conditionalFormatting: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - return Array.isArray(t) && t.forEach((n) => { - if (n.type == "cells") { - const l = ["lt", "gt", "between", "ct", "eq"]; - if (!n.operator || !n.start || !n.end || typeof n.value > "u") - throw { - record: n, - error: "The object is not complete; you need to fill in the values for operator, start, end and value." - }; - if (l.indexOf(n.operator) < 0) - throw { record: n, error: "The operator is not valid." }; - } else if (n.type == "top") { - const l = ["belowAverage", "aboveAverage"]; - if (!n.start || !n.end || typeof n.value > "u") - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start, end and value." - }; - if (n.operator && l.indexOf(n.operator) < 0) - throw { record: n, error: "The operator is not valid." }; - } else if (n.type == "iconSet") { - if (!n.operator || !n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for operator, start and end" - }; - } else if (n.type == "colorScale") { - if (!n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else if (n.type == "dataBar") { - if (!n.start || !n.end) - throw { - record: n, - error: "The object is not complete; you need to fill in the values for start and end" - }; - } else - throw 'Property "type" is not valid.'; - }), !0; - } - }, - multiStyleCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - useSplitBaseOnMatch: { - mode: "TYPE_CHECK", - type: "boolean" - }, - convertStringToNumber: { - mode: "TYPE_CHECK", - type: "boolean" - }, - images: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) { - const n = ["one", "two"]; - t.forEach((l) => { - if (typeof l.src != "string") - throw '"src" property is required.'; - if (typeof l.from != "string" || l.from.length == 0) - throw '"from" property is required.'; - if (l.to && !st(l.to)) - throw 'value of "to" is not valid.'; - if (l.from && !st(l.from)) - throw 'value of "from" is not valid.'; - if (n.indexOf(l.type) < 0) - throw 'Type of "type" is not valid in the "images" property.'; - if (l.type == "two" && !l.to) - throw '"to" property is empty. for "two" type "to" property is required.'; - }); - } - return !0; - } - }, - formula: { - mode: "TYPE_CHECK", - type: "object" - }, - pageOption: { - mode: "TYPE_CHECK", - type: "object" - }, - name: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - title: { - mode: "TYPE_CHECK", - type: "object" - }, - shiftTop: { - mode: "TYPE_CHECK", - type: "number", - min: 0 - }, - shiftLeft: { - mode: "TYPE_CHECK", - type: "number" - }, - selected: { - mode: "TYPE_CHECK", - type: "boolean" - }, - tabColor: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - merges: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) { - let n = []; - if (t.forEach((l) => { - it(l) || n.push( - "The " + l + ' reference is not valid in the "merges" property.' - ); - }), n.length > 0) - throw n; - } - return !0; - } - }, - headerStyleKey: { - mode: "TYPE_CHECK", - type: "string", - notEmpty: !0 - }, - mergeRowDataCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - styleCellCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - commentCondition: { - mode: "TYPE_CHECK", - type: "function" - }, - sortAndFilter: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - if (typeof t == "object") { - const n = ["all", "ref"]; - if (!t.mode) - throw '"mode" is required in sortAndFilter'; - if (n.indexOf(t.mode) < 0) - throw '"mode" is not valid'; - if (t.mode == "ref") - if (t.ref) { - if (!it(t.ref)) - throw '"ref" is not valid'; - } else - throw '"ref" is must need be defined.'; - } - return !0; - } - }, - state: { - mode: "TYPE_CHECK", - type: "string", - isEnum: !0, - enum: ["hidden", "visible"] - }, - headerRowOption: { - mode: "TYPE_CHECK", - type: "object" - // Adjust according to the expected type for headerRowOption - }, - protectionOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = [ - "sheet", - "formatCells", - "formatColumns", - "formatRows", - "insertColumns", - "insertRows", - "insertHyperlinks", - "deleteColumns", - "deleteRows", - "sort", - "autoFilter", - "pivotTables" - ], l = ["0", "1", 0, 1]; - return Object.keys(t).forEach((u) => { - const m = t[u]; - if (n.indexOf(u) < 0) - throw '"' + u + '" is not valid.'; - if (l.indexOf(m) < 0) - throw 'value of "' + u + '" is not valid'; - }), !0; - } - }, - headerHeight: { - mode: "TYPE_CHECK", - type: "number", - min: 1 - }, - checkbox: { - mode: "TYPE_CHECK", - isArray: !0, - type: "object", - validateFunction(e, t, r, o) { - if (Array.isArray(t)) - t.forEach((n) => { - if (!n.col || !n.row) - throw '"checkbox" is not complete'; - }); - else - throw 'Type of "checkbox" property is not valid'; - return !0; - } - }, - viewOption: { - mode: "TYPE_CHECK", - type: "object", - validateFunction(e, t, r, o) { - const n = ["pageLayout", "pageBreakPreview"]; - if (t.type && n.indexOf(t.type) < 0) - throw 'Type of "type" property is not valid'; - return !0; - } - }, - rtl: { - mode: "TYPE_CHECK", - type: "boolean" - }, - pageBreak: { - mode: "TYPE_CHECK", - type: "object", - isArray: !0 - }, - asTable: { - mode: "TYPE_CHECK", - type: "object" - } -}; -function Bt(e, t = !0, r = !0) { - Object.keys(e).forEach((n) => { - const l = e[n], g = Object.keys(l); - if (l.format && !Lt[l.format]) - throw 'The "' + l.format + '" format that has been used is not defined.'; - l.underline && l.doubleUnderline, g.forEach((u) => { - let m = l[u]; - const s = lo[u]; - if (Me(m, s, u, t, r)) - return !0; - }); - }); -} -function $t(e, t = !0, r = !0) { - Array.isArray(e) || (e = [e]), e.forEach((o) => { - Object.keys(o).forEach((l) => { - const g = o[l], u = io[l]; - Me(g, u, l, t, r); - }); - }); -} -function so(e, t = !0, r = !0) { - Object.keys(e).forEach((n) => { - let l = e[n]; - const g = ao[n]; - if (Me(l, g, n, t, r)) - if (n == "sheet") - if (Array.isArray(l)) - $t(l); - else - throw "Sheet must be Array."; - else n == "styles" && Bt(l); - }); -} -function Me(e, t, r, o, n) { - if (t) { - if (typeof e != t.type) { - if (t.type == "object" || t.type == "string" || o) - throw 'The Type of The "' + r + '" is not valid'; - n && console.warn("The property type must be " + t.type); - } - if (t.isEnum && t.enum.indexOf(e) < 0) - throw 'The value of "' + r + '" must be ' + JSON.stringify(t.enum); - if (t.min && e < t.min) - throw 'The value of "' + r + '" must be higher than ' + t.min; - if (t.notEmpty && (!e || e.length <= 0)) - throw 'The value of "' + r + '" must not be empty.'; - if (t.isArray && !Array.isArray(e)) - throw 'The value of "' + r + '" should be an array.'; - return typeof t.validateFunction == "function" && t.validateFunction(r, e, o, n), !0; - } else - return n && console.warn( - 'The Schema Object does not include the "' + r + '" property.' - ), !1; -} -const co = { - checkSheetValidWithOneRef: st, - checkSheetValidWithTwoRef: it, - generalValidationCheck: Me -}, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ - __proto__: null, - exportedForTesting: co, - validateExcelTableObjectFunction: so, - validateSheetArrayFunction: $t, - validateStyleObjectFunction: Bt -}, Symbol.toStringTag, { value: "Module" })); -function It(e) { - if (typeof e > "u" || e == null) - return ""; - typeof e != "string" && (e = String(e)); - let t = e, r = !1; - return e.indexOf('"') >= 0 && (t = t.replace(/"/g, '""'), r = !0), e.indexOf(",") >= 0 && (r = !0), r && (t = '"' + t + '"'), t; -} -function fo(e) { - return e ? " " : ","; -} -function Pt(e, t) { - return e.substring(0, e.length - t) + ` -`; -} -async function Kt(e, t = !1, r = !1) { - const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; - let g = []; - if (e.sheet.forEach((m) => { - let s = "", f = ""; - const v = m.headers; - let D = [], j = v.length; - for (let S = 0; S < j; S++) { - const d = v[S]; - D.push(d.label), m.withoutHeader || (f += It(d.text) + o); - } - s += Pt(f, l), j = m.data.length; - for (let S = 0; S < j; S++) { - f = ""; - const d = m.data[S]; - D.forEach((G) => { - f += It(d[G]) + o; - }), s += Pt(f, l); - } - g.push(s); - }), e.backend) - return g; - const u = await import("./FileSaver.min-BEH1o5YI.js").then((m) => m.F).then((m) => m.saveAs); - if (t) { - const m = await import("./jszip.min-D-TEDr9v.js").then((v) => v.j).then((v) => v.default); - let s = new m(); - g.forEach((v, D) => { - s.file("sheet" + (D + 1) + n, v); - }); - const f = await s.generateAsync({ type: "blob" }).then(function(v) { - return v; - }); - return u( - f, - (e.fileName ? e.fileName : "tableRecord") + ".zip" - ), "done"; - } - g.forEach((m) => { - var s = new Blob([m], { - type: "text/" + (r ? "plain" : "csv") + ";charset=utf-8" - }); - u( - s, - (e.fileName ? e.fileName : "tableRecord") + n - ); - }); -} -const jt = { - firstHeader: !0, - returnTableNodes: !1, - emptyNodeDefaultString: " ", - removeContainerChildNode: !0, - containerNodeStyle: { - display: "flex", - flexDirection: "column" - }, - tableStyle: { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" - }, - cellStyle: { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" - }, - buttonContainerStyle: { - display: "flex" - }, - buttonStyle: { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" - }, - activeButtonStyle: { - background: "#EEEDEB" - } -}; -async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { - display: "flex", - flexDirection: "column" -}, s = { - borderSpacing: "0", - border: "1px solid #EEEEEEF1" -}, f = { - width: "68px", - height: "24px", - border: "1px solid #EEEEEEF1" -}, v = { - display: "flex" -}, D = { - height: "40px", - width: "80px", - display: "flex", - justifyContent: "center", - alignItems: "center", - border: "0", - background: "transparent", - cursor: "pointer" -}, j = { - background: "#EEEDEB" -}) { - let S = await import("./read-utils-YAGe6NNW.js").then( - async (E) => await E.extractExcelData(e, !1, o) - ), d = null; - if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) - throw "Container Node not found"; - const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); - let B = document.createElement("div"); - N.forEach((E) => { - B.style[E] = v[E]; - }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { - d.style[E] = m[E]; - }), d.appendChild(B)); - let X = [], K = !1, L = 0; - do { - L++; - const E = S.sheetName.next(); - if (!E.value) - break; - const $ = document.createElement("div"); - if ($.style.display = "none", !l) { - const J = document.createElement("button"); - oe.forEach((ye) => { - J.style[ye] = D[ye]; - }), J.addEventListener("click", (ye) => { - const ve = J.getAttribute("data-sheet"), we = d.querySelector( - 'div[data-sheet="' + ve + '"]' - ); - if (we) { - P.forEach((ie) => { - J.style[ie] = j[ie]; - }); - const Se = d.querySelector( - "[data-sheet-button-activate]" - ); - let ae = d.querySelector("[data-sheet-activate]"); - we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { - Se.style[ie] = D[ie]; - }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); - } else - console.error("Sheet content not found!! id is " + ve); - }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); - } - let q = n ? "th" : "td"; - const U = document.createElement("table"); - z.forEach((J) => { - U.style[J] = s[J]; - }); - const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; - if (Array.isArray(M)) { - const J = M.length; - for (let ye = 0; ye < J; ye++) { - const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); - for (let ae = 0; ae <= Ce; ae++) { - let ie = g; - if (Se) { - const de = ve[ae]; - typeof de == "string" && (ie = de); - } - const ge = document.createElement(q); - Z.forEach((de) => { - ge.style[de] = f[de]; - }), ge.innerText = ie, we.appendChild(ge); - } - U.appendChild(we), q = "td"; - } - } - l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; - } while (!K); - if (l) - return X; - { - const E = d.querySelector( - 'div[data-sheet="1"]' - ); - E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); - const $ = d.querySelector( - 'button[data-sheet="1"]' - ); - return $ && (P.forEach((q) => { - $.style[q] = j[q]; - }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; - } -} -async function uo(e, t, r = !0, o = "property") { - let n = await import("./read-utils-YAGe6NNW.js").then( - async (u) => await u.extractExcelData(e, !1, t) - ), l = {}, g = []; - return Object.keys(n.sheetNameObject).forEach((u) => { - const m = n.sheetNameObject[u], s = n.data[m] || n.data[u], f = n.maxLengthOfColumn[m] || n.maxLengthOfColumn[u]; - for (let j = 0; j <= f; j++) - g[j] = o + (j + 1); - let v = r, D = []; - s.forEach((j) => { - let S = {}; - j.forEach((d, G) => { - typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); - }), v = !1, D.push(S); - }), l = Object.assign(l, { - [m]: D - }); - }), l; -} -const yo = Ht, go = to; -function xo(e, t, r = {}) { - const o = Wt( - e, - t, - r.keepStyle, - r.rowHeightScaleFunction, - r.colWidthScaleFunction - ); - return ct(o); -} -function bo(e) { - const t = no(e); - return ct(t); -} -function Co(e, t) { - return ct(zt(e, t)); -} -function vo(e, t = !1, r) { - return import("./read-utils-YAGe6NNW.js").then( - (o) => o.extractExcelData(e, t, r) - ); -} -function wo(e, t = !1) { - return Kt(e, t, !1); -} -function To(e, t = !1) { - return Kt(e, t, !0); -} -function Eo(e, t, r, o = { ...jt }) { - return o = { - ...jt, - ...o - }, mo( - e, - t, - r, - o.fetchFunc, - o.firstHeader, - o.returnTableNodes, - o.emptyNodeDefaultString, - o.removeContainerChildNode, - o.containerNodeStyle, - o.tableStyle, - o.cellStyle, - o.buttonContainerStyle, - o.buttonStyle, - o.activeButtonStyle - ); -} -export { - yo as a, - go as b, - Qt as c, - xo as d, - vo as e, - wo as f, - Re as g, - To as h, - Eo as i, - ct as j, - uo as k, - po as r, - bo as s, - Co as t, - ho as v -}; diff --git a/dist/read-utils-CMxu90Z7.js b/dist/read-utils-CMxu90Z7.js index 2221b8b..41df78e 100644 --- a/dist/read-utils-CMxu90Z7.js +++ b/dist/read-utils-CMxu90Z7.js @@ -1,5 +1 @@ -<<<<<<<< HEAD:dist/read-utils-CMxu90Z7.js System.register("ExcelTable",["./index-BBP-cHpJ.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); -======== -System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); ->>>>>>>> origin/main:dist/read-utils-CwMyWpVb.js diff --git a/dist/read-utils-CU7cU67B.js b/dist/read-utils-CU7cU67B.js index 69ef23c..fd7a95e 100644 --- a/dist/read-utils-CU7cU67B.js +++ b/dist/read-utils-CU7cU67B.js @@ -1,8 +1,4 @@ -<<<<<<<< HEAD:dist/read-utils-CU7cU67B.js import { g as R, c as T } from "./index-D07Il0Qz.js"; -======== -import { g as R, c as T } from "./index-DMAk0ysA.js"; ->>>>>>>> origin/main:dist/read-utils-YAGe6NNW.js function B(s) { return /t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; -======== -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; ->>>>>>>> origin/main:dist/read-utils-D8LB9Gmq.cjs diff --git a/dist/read-utils-CwMyWpVb.js b/dist/read-utils-CwMyWpVb.js deleted file mode 100644 index 2221b8b..0000000 --- a/dist/read-utils-CwMyWpVb.js +++ /dev/null @@ -1,5 +0,0 @@ -<<<<<<<< HEAD:dist/read-utils-CMxu90Z7.js -System.register("ExcelTable",["./index-BBP-cHpJ.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); -======== -System.register("ExcelTable",["./index-BPuSW_h3.js"],function(R,B){"use strict";var b,A;return{setters:[d=>{b=d.g,A=d.c}],execute:function(){R("extractExcelData",W);function d(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function M(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function P(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function W(s,a=!1,r){let O,E=!1;typeof r=="function"?(O=r,E=!0):O=fetch;let y=[],p=new Map,C={},k=[],V={},j={},T=!1;function $(t,I){let g=0,o=[],m=I.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=M(n);d(n)&&f&&(f=k[parseInt(f)]);const w=P(n);let i=b(w,A);typeof o[i.row]>"u"&&(o[i.row]=[]),o[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));p.has(n)&&(n=p.get(n)),V[n]=o,j[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return E?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await B.import("./jszip.min-49JP7itW.js").then(m=>m.j)).default;let o=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const w=Object.keys(f.files);o=w.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,c,u){if(c==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===o&&m({data:V,sheetNameObject:C,sheetName:p.entries(),maxLengthOfColumn:j}),!0},get(e,c,u){return c==="isNameSet"?e.isNameSet:e.counter}});w.forEach(function(e){f.files[e].async("string").then(function(c){if(e.indexOf("sharedStrings")>=0){let u=c.match(//g);Array.isArray(u)&&u.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let N=h.reduce((l,x)=>l+D(x),"");k.push(N)}}),T=!0,y.length>0&&(y.forEach(S=>{$(S.filename,S.fileData)}),y=[])}e.indexOf("sheet")>=0&&(T?$(e,c):y.push({filename:e,fileData:c})),e.indexOf("workbook")>=0&&(c.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=N+1,x="Sheet "+l;h.indexOf("name=")>=0&&(x=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=N+1)),p.set("sheet"+l,x),C["sheet"+l]=x}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}}}}); ->>>>>>>> origin/main:dist/read-utils-CwMyWpVb.js diff --git a/dist/read-utils-D8LB9Gmq.cjs b/dist/read-utils-D8LB9Gmq.cjs deleted file mode 100644 index 80c0461..0000000 --- a/dist/read-utils-D8LB9Gmq.cjs +++ /dev/null @@ -1,5 +0,0 @@ -<<<<<<<< HEAD:dist/read-utils-CWXTa8vm.cjs -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CNq3yjRY.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; -======== -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("./index-CzrjgJVS.cjs");function M(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function R(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function j(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function q(s,a=!1,r){let O,N=!1;typeof r=="function"?(O=r,N=!0):O=fetch;let x=[],y=new Map,b={},A=[],C={},E={},k=!1;function V(t,T){let g=0,u=[],m=T.match(//g);if(Array.isArray(m)&&m.forEach(n=>{let f=R(n);M(n)&&f&&(f=A[parseInt(f)]);const p=j(n);let i=I.getColRowBaseOnRefString(p,I.cols);typeof u[i.row]>"u"&&(u[i.row]=[]),u[i.row][i.col]=f,g=Math.max(i.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),C[n]=u,E[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return N?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(m=>m.jszip_min)).default;let u=0;return await new Promise((m,n)=>{g.loadAsync(t).then(function(f){const p=Object.keys(f.files);u=p.length;let i=new Proxy({counter:0,isNameSet:!1},{set(e,o,c){if(o==="isNameSet")return e.isNameSet=c,!0;if(typeof c!="number")throw"value most be number";return e.counter=c,e.isNameSet&&e.counter===u&&m({data:C,sheetNameObject:b,sheetName:y.entries(),maxLengthOfColumn:E}),!0},get(e,o,c){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){f.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let c=o.match(//g);Array.isArray(c)&&c.forEach(S=>{let h=S.match(//g);if(Array.isArray(h)){let w=h.reduce((l,d)=>l+P(d),"");A.push(w)}}),k=!0,x.length>0&&(x.forEach(S=>{V(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(k?V(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;h.indexOf("name=")>=0&&(d=h.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),h.indexOf("sheetId=")>0&&(l=Number(h.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),b["sheet"+l]=d}),i.isNameSet=!0),i.counter++})})})})}).catch(t=>{throw t})}exports.extractExcelData=q; ->>>>>>>> origin/main:dist/read-utils-D8LB9Gmq.cjs diff --git a/dist/read-utils-DODcKE84.js b/dist/read-utils-DODcKE84.js deleted file mode 100644 index 26ca0f0..0000000 --- a/dist/read-utils-DODcKE84.js +++ /dev/null @@ -1 +0,0 @@ -define(["require","exports","./index-BYjrfbvd"],function(M,N,b){"use strict";function P(s){return/t="s".*?(.*?)<\/t>/,r=s.match(a);return r?r[1]:null}function B(s){const a=/(.*?)<\/v>/,r=s.match(a);return r?r[1]:null}function D(s){const a=/r="(.*?)"/,r=s.match(a);return r?r[1]:null}async function $(s,a=!1,r){let O,A=!1;typeof r=="function"?(O=r,A=!0):O=fetch;let x=[],y=new Map,C={},E=[],k={},V={},T=!1;function j(t,I){let g=0,f=[],i=I.match(//g);if(Array.isArray(i)&&i.forEach(n=>{let h=B(n);P(n)&&h&&(h=E[parseInt(h)]);const p=D(n);let c=b.getColRowBaseOnRefString(p,b.cols);typeof f[c.row]>"u"&&(f[c.row]=[]),f[c.row][c.col]=h,g=Math.max(c.col,g)}),t.indexOf("xl/worksheets/sheet")==0){let n=t.substring(14,t.lastIndexOf("."));y.has(n)&&(n=y.get(n)),k[n]=f,V[n]=g}}return await O(s).then(t=>{if(t==null||t==null)throw"response is null";return A?t:a?t.arrayBuffer():t.blob()}).then(async t=>{const g=(await new Promise((i,n)=>M(["./jszip.min-CGrYsaMq"],i,n)).then(i=>i.jszip_min)).default;let f=0;return await new Promise((i,n)=>{g.loadAsync(t).then(function(h){const p=Object.keys(h.files);f=p.length;let c=new Proxy({counter:0,isNameSet:!1},{set(e,o,u){if(o==="isNameSet")return e.isNameSet=u,!0;if(typeof u!="number")throw"value most be number";return e.counter=u,e.isNameSet&&e.counter===f&&i({data:k,sheetNameObject:C,sheetName:y.entries(),maxLengthOfColumn:V}),!0},get(e,o,u){return o==="isNameSet"?e.isNameSet:e.counter}});p.forEach(function(e){h.files[e].async("string").then(function(o){if(e.indexOf("sharedStrings")>=0){let u=o.match(//g);Array.isArray(u)&&u.forEach(S=>{let m=S.match(//g);if(Array.isArray(m)){let w=m.reduce((l,d)=>l+R(d),"");E.push(w)}}),T=!0,x.length>0&&(x.forEach(S=>{j(S.filename,S.fileData)}),x=[])}e.indexOf("sheet")>=0&&(T?j(e,o):x.push({filename:e,fileData:o})),e.indexOf("workbook")>=0&&(o.replace(/(.*[\n\s\S]*)()(.*[\n\s\S]*)/,"$2").split("{let l=w+1,d="Sheet "+l;m.indexOf("name=")>=0&&(d=m.replace(/(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/,"$2")),m.indexOf("sheetId=")>0&&(l=Number(m.replace(/(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/,"$2")),isNaN(l)&&(l=w+1)),y.set("sheet"+l,d),C["sheet"+l]=d}),c.isNameSet=!0),c.counter++})})})})}).catch(t=>{throw t})}N.extractExcelData=$,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/read-utils-YAGe6NNW.js b/dist/read-utils-YAGe6NNW.js deleted file mode 100644 index 69ef23c..0000000 --- a/dist/read-utils-YAGe6NNW.js +++ /dev/null @@ -1,114 +0,0 @@ -<<<<<<<< HEAD:dist/read-utils-CU7cU67B.js -import { g as R, c as T } from "./index-D07Il0Qz.js"; -======== -import { g as R, c as T } from "./index-DMAk0ysA.js"; ->>>>>>>> origin/main:dist/read-utils-YAGe6NNW.js -function B(s) { - return /t="s".*?(.*?)<\/t>/, r = s.match(a); - return r ? r[1] : null; -} -function $(s) { - const a = /(.*?)<\/v>/, r = s.match(a); - return r ? r[1] : null; -} -function j(s) { - const a = /r="(.*?)"/, r = s.match(a); - return r ? r[1] : null; -} -async function P(s, a = !1, r) { - let N, O = !1; - typeof r == "function" ? (N = r, O = !0) : N = fetch; - let x = [], y = /* @__PURE__ */ new Map(), b = {}, A = [], C = {}, k = {}, E = !1; - function V(t, I) { - let g = 0, u = [], m = I.match(//g); - if (Array.isArray(m) && m.forEach((n) => { - let f = $(n); - B(n) && f && (f = A[parseInt(f)]); - const p = j(n); - let i = R(p, T); - typeof u[i.row] > "u" && (u[i.row] = []), u[i.row][i.col] = f, g = Math.max(i.col, g); - }), t.indexOf("xl/worksheets/sheet") == 0) { - let n = t.substring(14, t.lastIndexOf(".")); - y.has(n) && (n = y.get(n)), C[n] = u, k[n] = g; - } - } - return await N(s).then((t) => { - if (t == null || t == null) - throw "response is null"; - return O ? t : a ? t.arrayBuffer() : t.blob(); - }).then(async (t) => { - const g = (await import("./jszip.min-D-TEDr9v.js").then((m) => m.j)).default; - let u = 0; - return await new Promise((m, n) => { - g.loadAsync(t).then(function(f) { - const p = Object.keys(f.files); - u = p.length; - let i = new Proxy( - { - counter: 0, - isNameSet: !1 - }, - { - set(e, o, c) { - if (o === "isNameSet") - return e.isNameSet = c, !0; - if (typeof c != "number") - throw "value most be number"; - return e.counter = c, e.isNameSet && e.counter === u && m({ - data: C, - sheetNameObject: b, - sheetName: y.entries(), - maxLengthOfColumn: k - }), !0; - }, - get(e, o, c) { - return o === "isNameSet" ? e.isNameSet : e.counter; - } - } - ); - p.forEach(function(e) { - f.files[e].async("string").then(function(o) { - if (e.indexOf("sharedStrings") >= 0) { - let c = o.match(//g); - Array.isArray(c) && c.forEach((S) => { - let h = S.match(//g); - if (Array.isArray(h)) { - let w = h.reduce((l, d) => l + M(d), ""); - A.push(w); - } - }), E = !0, x.length > 0 && (x.forEach((S) => { - V(S.filename, S.fileData); - }), x = []); - } - e.indexOf("sheet") >= 0 && (E ? V(e, o) : x.push({ - filename: e, - fileData: o - })), e.indexOf("workbook") >= 0 && (o.replace( - /(.*[\n\s\S]*)()(.*[\n\s\S]*)/, - "$2" - ).split(" { - let l = w + 1, d = "Sheet " + l; - h.indexOf("name=") >= 0 && (d = h.replace( - /(.*[\n\s\S]*?)name="([^"]*)"(.*[\n\s\S]*)/, - "$2" - )), h.indexOf("sheetId=") > 0 && (l = Number( - h.replace( - /(.*[\n\s\S]*?)sheetId="([^"]*)"(.*[\n\s\S]*)/, - "$2" - ) - ), isNaN(l) && (l = w + 1)), y.set("sheet" + l, d), b["sheet" + l] = d; - }), i.isNameSet = !0), i.counter++; - }); - }); - }); - }); - }).catch((t) => { - throw t; - }); -} -export { - P as extractExcelData -};