From 7e5da306bc05dcb970a6073a3180a3320fefb045 Mon Sep 17 00:00:00 2001 From: mohammadrezaeicode <131792366+mohammadrezaeicode@users.noreply.github.com> Date: Sun, 16 Feb 2025 19:36:37 +0330 Subject: [PATCH 1/2] 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 --- .../manually-npm-publish-github-packages.yaml | 44 + .../workflows/manually-release-publish.yml | 102 + .github/workflows/manually-test.yml | 39 + .github/workflows/release.yml | 61 - .npmrc | 4 +- CHANGELOG.md | 19 + README.md | 105 +- _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 +- change-log | 21 +- ...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 | 548 +++- 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-BPuSW_h3.js | 44 + dist/index-BYjrfbvd.js | 44 + dist/index-CzrjgJVS.cjs | 44 + dist/index-D4WU6E--.js | 2518 ----------------- dist/index-DMAk0ysA.js | 2479 ++++++++++++++++ dist/index-Ol2dJD1V.js | 44 - dist/index-Sti7hi3g.js | 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-C-k9a0yr.js => read-utils-CwMyWpVb.js} | 2 +- ...s-D5nfIasC.cjs => read-utils-D8LB9Gmq.cjs} | 2 +- dist/read-utils-DODcKE84.js | 1 + ...ils-BRep2QN2.js => read-utils-YAGe6NNW.js} | 4 +- dist/read-utils-cd06gBiy.js | 1 - package-lock.json | 716 +++-- package.json | 7 +- src/data-model/excel-table.ts | 530 +++- src/functions/generate-excel.ts | 42 +- src/functions/replacer.ts | 94 + src/index.ts | 72 +- src/utils/content-generator/content-types.ts | 2 +- src/utils/drop-down-utils.ts | 24 + src/utils/multi-value.ts | 266 +- src/utils/store.ts | 40 +- 55 files changed, 5967 insertions(+), 4326 deletions(-) create mode 100644 .github/workflows/manually-npm-publish-github-packages.yaml create mode 100644 .github/workflows/manually-release-publish.yml create mode 100644 .github/workflows/manually-test.yml delete mode 100644 .github/workflows/release.yml 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-BPuSW_h3.js create mode 100644 dist/index-BYjrfbvd.js create mode 100644 dist/index-CzrjgJVS.cjs delete mode 100644 dist/index-D4WU6E--.js create mode 100644 dist/index-DMAk0ysA.js delete mode 100644 dist/index-Ol2dJD1V.js delete mode 100644 dist/index-Sti7hi3g.js 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-C-k9a0yr.js => read-utils-CwMyWpVb.js} (94%) rename dist/{read-utils-D5nfIasC.cjs => read-utils-D8LB9Gmq.cjs} (94%) create mode 100644 dist/read-utils-DODcKE84.js rename dist/{read-utils-BRep2QN2.js => read-utils-YAGe6NNW.js} (96%) delete mode 100644 dist/read-utils-cd06gBiy.js create mode 100644 src/functions/replacer.ts create mode 100644 src/utils/drop-down-utils.ts diff --git a/.github/workflows/manually-npm-publish-github-packages.yaml b/.github/workflows/manually-npm-publish-github-packages.yaml new file mode 100644 index 0000000..fcf4692 --- /dev/null +++ b/.github/workflows/manually-npm-publish-github-packages.yaml @@ -0,0 +1,44 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Manually Publish Github Package + +# on: +# release: +# types: [created] +# name: Manually Test +on: + workflow_dispatch + # inputs: + # branch: + # description: 'Branch for Publish' + # required: true + # default: 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-gpr: + needs: build + 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}} diff --git a/.github/workflows/manually-release-publish.yml b/.github/workflows/manually-release-publish.yml new file mode 100644 index 0000000..2fbf8eb --- /dev/null +++ b/.github/workflows/manually-release-publish.yml @@ -0,0 +1,102 @@ +name: Manually Release & Publish Package +on: + 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 + # paths: + # - CHANGELOG.md + # pull_request: + # branches: + # - main + # paths: + # - CHANGELOG.md +jobs: + release: + if: ${{ github.event.inputs.skip-release == 'false' }} + name: Create release package + runs-on: ubuntu-latest + steps: + - name: Checkout to code + uses: actions/checkout@v4 + - name: install Node js Version 20.x + uses: actions/setup-node@v4 + with: + node-version: '20.x' + - name: Retrieve Release Version + run: echo "PV=$(node version.js)" >> $GITHUB_ENV + - run: cat change-log + - name: Retrieve Release Body + run: | + { + echo 'PB<> $GITHUB_ENV + - run: echo ${{env.PV}} + - name: Create Github Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{env.PV}} + release_name: Release v${{env.PV}} + body: ${{env.PB}} + 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 + # 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: publish-gpr + if: ${{always() && (needs.publish-gpr.result == 'success' || needs.publish-gpr.result == 'skipped') }} + runs-on: ubuntu-latest + steps: + - name: Checkout to code + uses: actions/checkout@v4 + - name: install Node js Version 20.x + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - name: publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/manually-test.yml b/.github/workflows/manually-test.yml new file mode 100644 index 0000000..6c23654 --- /dev/null +++ b/.github/workflows/manually-test.yml @@ -0,0 +1,39 @@ +name: Manually Test +on: + workflow_dispatch: + inputs: + branch: + description: 'Test Branch' + required: true + default: 'main' + os: + description: 'Operating System' + type: choice + 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 915438a..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Release & Publish Package -on: - push: - branches: - - main - paths: - - CHANGELOG.md - # pull_request: - # branches: - # - main - # paths: - # - CHANGELOG.md -jobs: - release: - name: Create release package - runs-on: ubuntu-latest - steps: - - name: Checkout to code - uses: actions/checkout@v4 - - name: install Node js Version 20.x - uses: actions/setup-node@v4 - with: - node-version: '20.x' - - name: Retrieve Release Version - run: echo "PV=$(node version.js)" >> $GITHUB_ENV - - run: cat change-log - - name: Retrieve Release Body - run: | - { - echo 'PB<> $GITHUB_ENV - - run: echo ${{env.PV}} - - name: Create Github Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{env.PV}} - release_name: Release v${{env.PV}} - body: ${{env.PB}} - publish: - name: Publish to NPM - needs: release - runs-on: ubuntu-latest - steps: - - name: Checkout to code - uses: actions/checkout@v4 - - name: install Node js Version 20.x - uses: actions/setup-node@v4 - with: - node-version: '20.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - name: publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - - 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/CHANGELOG.md b/CHANGELOG.md index d054bc7..5c45dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 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. + +### 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. + + ## Version 6.0.1 (2024-08-11) ### New Features diff --git a/README.md b/README.md index f8cb7fa..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. @@ -34,14 +34,26 @@ 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)) +## Related Projects + +The following list includes new repositories related to this project. Documentation and improvements for these projects can be found in the repositories below. + +- **`MR Excel Java`**:A similar project using Java is in development. The release version is coming soon; currently, it is available as a snapshot version.["`repository`"](https://github.com/mohammadrezaeicode/mr-excel-java) + +- **`MR Excel Editor`**: An editor that utilizes the library is currently under development. At present, it only generates simple results.["`repository`"](https:///github.com/mohammadrezaeicode/mr-excel-editor)["`Demo`"](https://mohammadrezaeicode.github.io/mr-excel-editor/) + ## Table of Contents @@ -88,16 +100,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) @@ -463,7 +479,7 @@ ExcelTable.themeBaseGenerate(data, { negativeColor: true }); -[More Example](example/CDN/themeBaseGenerate) +[More Example](https://github.com/mohammadrezaeicode/mr-excel-example-gallery/blob/main/CDN/themeBaseGenerate) @@ -490,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)
@@ -659,9 +675,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
@@ -820,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) @@ -985,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) @@ -7156,6 +7197,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 +7285,28 @@ 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) +### 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. + +#### 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. + ### 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/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/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..7620f9f 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-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 cf0c758..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-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-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 bec3099..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,11 +259,13 @@ declare namespace DataModel { HeaderFooterTypes, PageOption, Header, + HeaderOption, StyleType, StyleBody, Styles, Data, DataOptions, + DropDown, RowMap, ProtectionOption, ProtectionOptionKey, @@ -189,13 +310,21 @@ declare namespace DataModel { ExtractedData, ExtractResult, ReadResult, - Buffer_2 as Buffer + 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 | 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; @@ -204,30 +333,79 @@ 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>; -export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: { +/** + * 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; returnTableNodes?: boolean; @@ -239,7 +417,7 @@ export declare function excelToNode(uri: string, queryForTable?: string | null, buttonContainerStyle?: object; buttonStyle?: object; activeButtonStyle?: object; -}): Promise; +} declare const exportedForTesting: { checkSheetValidWithOneRef: typeof checkSheetValidWithOneRef; @@ -247,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; @@ -262,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; @@ -273,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; @@ -335,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; + [key: string]: MultiStyleValue[]; } +/** + * Represents a map of merge row conditions. + * @interface + */ declare interface MergeRowConditionMap { [columnKey: string]: { inProgress: boolean; @@ -350,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; -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 + * @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 { - [key: string]: string | undefined | MultiStyleRexValue[]; - reg?: MultiStyleRexValue[]; + 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; @@ -385,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; @@ -403,8 +753,27 @@ declare interface ReadResult { 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; @@ -413,49 +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; @@ -468,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; @@ -477,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; @@ -534,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; @@ -552,6 +1039,10 @@ declare interface ThemeOption { filterKeys?: string[]; } +/** + * Represents the title of the sheet. + * @interface + */ declare interface Title { shiftTop?: number; shiftLeft?: number; @@ -560,7 +1051,7 @@ declare interface Title { height?: number; styleId?: string; text?: string; - multiStyleValue?: MultiStyleValue; + multiStyleValue?: MultiStyleValue[]; comment?: Comment_2 | string; } @@ -593,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; @@ -615,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 a24a888..b550970 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[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:` +`};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[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:` +`};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+=''),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 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-DMAk0ysA.js b/dist/index-DMAk0ysA.js new file mode 100644 index 0000000..d527ce9 --- /dev/null +++ b/dist/index-DMAk0ysA.js @@ -0,0 +1,2479 @@ +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/index-Ol2dJD1V.js b/dist/index-Ol2dJD1V.js deleted file mode 100644 index d119a33..0000000 --- a/dist/index-Ol2dJD1V.js +++ /dev/null @@ -1,44 +0,0 @@ -define(["require","exports"],function(ke,ae){"use strict";function pt(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 Ut(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 ut(e){const t=Ut(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 yt(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 Ue(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function fe(e){e=pt(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:(Ue(t[0])+Ue(t[1])+Ue(t[2])).toUpperCase()}function pe(e,t){if(typeof e>"u"||e===null)return null;if(!t){let l=pt(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=fe(e);e=l||""}return e.replace(/^#/,"")}function Wt(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 gt(e,t){let l=Object.keys(e).filter(n=>!t.includes(n)),o=[];return l.reduce((n,y)=>(n.push({label:y,text:Wt(y)}),n),o)}const We={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Gt=function(e,t={...We}){let l;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let d=[];for(let a=0;a0){const b=gt(m[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);d.push({headers:b,data:m})}}l={sheet:d}}else e.length>0?l={sheet:[{headers:gt(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:We.headerBackgroundColor,r=t&&t.rowBackgroundColor?t.rowBackgroundColor:We.rowBackgroundColor,n=t&&t.negativeColor?yt(o):t&&t.headerColor?t.headerColor:ut(o),y=t&&t.negativeColor?yt(r):t&&t.rowColor?t.rowColor:ut(r);typeof l.styles>"u"&&(l.styles={}),l.styles.themeStyleHeader={backgroundColor:o,color:n},l.styles.themeStyleBody={backgroundColor:r,color:y};const u=l.sheet.length;for(let d=0;d=1?(b["c"+v]=n,n="",y+="*",T--):t>=2&&l==v?(b["c"+v]=n,n="",y+="+"):y+="-":I>0&&(y+="-");d.push({...b,mergeString:y}),b={},y=""}return d}function Zt(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 y=[],u=[],d={header:{},rows:[]},a=40;if(n){let I=!1,T=0;n.forEach((v,c)=>{var D=[].slice.call(v.children);const M=window.getComputedStyle(v,null);let z=fe(M.backgroundColor);if(!I)T=D.length,I=!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)),D.forEach((B,oe)=>{let R=window.getComputedStyle(B,null),$=null;if(R.borderBottomWidth!=="0px"){const G=fe(R.borderBottomColor);G&&($||($={}),$.bottom={style:"thin",color:G})}if(R.borderTopWidth!=="0px"){const G=fe(R.borderTopColor);G&&($||($={}),$.top={style:"thin",color:G})}if(R.borderLeftWidth!=="0px"){const G=fe(R.borderLeftColor);G&&($||($={}),$.left={style:"thin",color:G})}if(R.borderRightWidth!=="0px"){const G=fe(R.borderRightColor);G&&($||($={}),$.right={style:"thin",color:G})}let Z=fe(R.backgroundColor);!Z&&z&&(Z=z);const Y=parseInt(R.fontSize.substring(0,R.fontSize.indexOf("p")));let H={...Z?{backgroundColor:Z}:{},bold:parseInt(R.fontWeight)>500,...isNaN(Y)?{}:{size:Y},...$?{border:$}:{},alignment:{...typeof R.textAlign=="string"&&R.textAlign.length>0?{horizontal:R.textAlign}:{},vertical:"center",...R.direction=="rtl"?{rtl:!0}:{ltr:!0}}};d.header[c+"-"+oe]=H;let S;typeof r=="function"?S=r(Number(R.width.substring(0,R.width.length-2)),oe):S=Number(R.width.substring(0,R.width.length-2))*.15;const K=B.getAttribute("colspan"),V=B.getAttribute("rowspan");y.push({label:"c"+oe,...K?{colspan:K}:{},...V?{rowspan:V}:{},text:B.textContent,...isNaN(S)||S<=0?{}:{size:S}})});else{let B={},oe="",R=!1;u.length>=c&&(B=u[c-1],oe="mergeString"in B?B.mergeString:"",R=!0);let $=0;D.forEach((Z,Y)=>{if("c"+(Y+$)in B)for(let q=0;q<=T+1&&"c"+(Y+q)in B;q++)$++;Y+=$;let H=window.getComputedStyle(Z,null);if(Z.getAttribute("colspan")||Z.getAttribute("rowspan")){let q=Xt(Z.getAttribute("colspan")*1,Z.getAttribute("rowspan")*1,Y,T,B,Z.textContent,oe,B);u.length{u.length500,...isNaN(V)?{}:{size:V},...S?{border:S}:{},alignment:{...typeof H.textAlign=="string"&&H.textAlign.length>0?{horizontal:H.textAlign}:{},vertical:"center",...H.direction=="rtl"?{rtl:!0}:{ltr:!0}}};d.header[c+"-"+Y]=G,B["c"+Y]=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,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 Qt(e,t,l,o,r,n,y){let u={};return` -`+l.reduce((d,a)=>(a=a.toLowerCase(),u[a]?d:a=="svg"?(u.png=!0,u.svg=!0,d+''):a=="jpeg"||a=="jpg"?(u.jpeg=!0,u.jpg=!0,d+''):(u.curr=!0,d+'')),"")+t.reduce((d,a)=>d+'',"")+e+(y.length>0?y.reduce((d,a)=>d+'',""):"")+''+(n?'':"")+''+o.reduce((d,a)=>d+'',"")+(r.length>0?r.reduce((d,a,m)=>d+'',""):"")+''}function eo(e,t){return` -Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function Ge(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,I=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)),D=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+'"':"",z=a.isArray||b?' t="array" ref="'+I+'"':"";return r='"+m+"",{column:v,row:c,needCalcChain:!1,isCustom:!0,cell:r}}let n=e.replace(/[0-9]/g,""),y=parseInt(e.substr(n.length)),u=!1,d="";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+")"}d='',u=!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 I="styleId"in a&&o&&typeof a.styleId=="string"&&o[a.styleId]?' s="'+o[a.styleId].index+'"':"";r='"+b+a.type+"("+a.referenceCell.toUpperCase()+m+")",d='',u=!0}else{const a=t;r='"+a.type+"("+a.start.toUpperCase()+":"+a.end.toUpperCase()+")"}return{column:n,row:y,cell:r,needCalcChain:u,chainCell:d}}function Xe(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 y=t[e.styleId];typeof y=="string"&&(l=y)}r="comment"in e&&typeof e.comment=="string"?xt(e.comment):[""]}else r=e?xt(e):[""];return o&&r.unshift(n+":"),{hasAuthor:o,author:n,commentStyle:l,commentStr:r}}function xt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,l,o){let r='',n="";return t.forEach((y,u)=>{let d="";if(y.length==0){n+=` -`;return}u>0&&(d=' xml:space="preserve"',n+=` -`),r+=""+l+""+n+y+"",n=""}),n.length>0&&r.indexOf("")>0&&(r=r.substring(0,r.length-8)+n+""),r+="",r}const to='',je=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Be(e,t){let l={result:[],str:t},o=e.reduce((r,n)=>{let y=r.str.indexOf(n);return r.result.push(r.str.substring(0,y)),r.str=r.str.substring(y+n.length),r},l);return o.result.push(o.str),o.result}function bt(e,t,l,o,r,n,y,u,d){if(o){let a=[],m=[],b=[];const I=n.length;r.forEach((T,v)=>{let c;try{c=T.match(e)}catch(D){if(typeof e=="string")c=T.match("\\"+e);else throw D}if(c)if(u){let D;d?D=Be(c,T):D=T.split(e),a.push(...D),m.push(...c),b.push(...c.reduce((M,z)=>[...M,t],[]))}else{let D;d?D=Be(c,T):D=T.split(e).reduce((M,z,B)=>B>=2?(M[1]+=e+z,M):[...M,z],[]),a.push(...D),b.push(t),m.push(e.toString())}else a.push(T);I>v&&(m.push(n[v]),b.push(y[v]))}),r=a,n=m,y=b}else{let a;try{a=l.match(e)}catch(m){if(typeof e=="string")a=l.match("\\"+e);else throw m}a?u?(n.push(...a),y.push(...a.reduce((m,b)=>[...m,t],[])),d?r=Be(a,l):r=l.split(e)):(n.push(e.toString()),y.push(t),d?r=Be(a,l):r=l.split(e).reduce((m,b,I)=>I>=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:y}}function Je(e,t,l,o,r){if(typeof e=="object"){let n="",y=[],u=[],d=[],a=!1;if(Object.keys(e).forEach(T=>{const v=e[T];if(T!=="reg"){let c=bt(T,typeof v=="string"?v:"",t,a,d,y,u,!1,r);a=c.splittedText,d=c.splitValue,y=c.matchValue,u=c.styleMatchValue}}),"reg"in e&&Array.isArray(e.reg)){const T=e.reg.length;for(let v=0;v0&&(n+=""+I+''+v+""),c.length>0&&(n+=""+(l[D]?l[D]:I)+''+c+"")}return d[b].length>0?n=""+n+""+I+""+je(d[b])+"":n=""+n+"",n}else return""+je(t)+""}const Ct={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:''}},vt=["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"],wt=(e,t,l=!1,o)=>{let r,n=!1;return typeof o=="function"?(r=o,n=!0):r=fetch,r(e).then(y=>n?y:l?y.arrayBuffer():y.blob()).then(y=>n||l?y:new File([y],t)).catch(y=>{throw y})};function _e(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=Ne(t,Math.pow(10,l.length+1),""),r=t.indexOf(l),r<0&&(r=0)),{col:r,row:o}}let oo={},Qe=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 Tt(e,t,l){Qe[e],Qe[e][t]=l}function Et(e,t,l){Object.keys(l).forEach(r=>{const n=l[r];typeof n=="object"?r!="data"&&r!="headers"&&Et(e,t.length>0?t+"."+r:r,n):Tt(e,t.length>0?t+"."+r:r,n)})}function ro(e,t){Et(e,"",t)}function no(e,t){let l=t,o=Qe[e];return Object.keys(o).forEach(n=>{const y=n.split(".");let u=l,d=o[n];for(let a=0;a0&&(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=Ct;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=[...vt];e.numberOfColumn&&e.numberOfColumn>25&&(n=Ne(n,e.numberOfColumn));const u=(await new Promise((E,i)=>ke(["./jszip.min-BoDw5mwd"],E,i)).then(E=>E.jszip_min)).default;let d=new u;const a=e.sheet.length;let m=d.folder("xl"),b=null,I=null,T=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const v=Object.keys(e.styles),c=to,D=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,M={},z={};let B=v.reduce((E,i,C)=>{const x=e.styles[i];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let w="",X="-",me="Regular";if(x.fontFamily&&(X=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(X!="-"||me!="Regular")&&(w='&"'+X+","+me+'"'),x.size&&(w+="&"+x.size),x.doubleUnderline?w+="&E":x.underline&&(w+="&U"),x.color){const Ee=pe(x.color,o);typeof Ee=="string"&&Ee.length>0&&(w+="&K"+Ee.toUpperCase())}return M[i]=w,E}if(D&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){z[i]=E.conditionalFormatting.count;let w=pe(x.color,o),X=pe(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=pe(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=pe(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 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">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" ':"")+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