diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c45dee..5e2f3ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Version 7.0.1 (2025-03-13) + +### Bug Fixes + +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio Fernández](https://github.com/xergiodf)) +- Data range error. + ## Version 7.0.0 (2025-02-16) ### New Features diff --git a/README.md b/README.md index 87942c0..5ac54d7 100644 --- a/README.md +++ b/README.md @@ -7289,6 +7289,13 @@ To migrate from Version 2 to Version 3, you need to follow the steps below: ## Release Notes [⬆️](#table-of-contents) +### Version 7.0.1 (2025-03-13) + +#### Bug Fixes + +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio Fernández](https://github.com/xergiodf)) +- Data range error. + ### Version 7.0.0 (2025-02-16) #### New Features diff --git a/change-log b/change-log index 434d0f7..b8dba39 100644 --- a/change-log +++ b/change-log @@ -1,19 +1,7 @@ -## Version 7.0.0 (2025-02-16) - -### New Features - -- A drop-down option (multi-select option) provides the ability to create a cell that contains multiple selectable values.`sheet`->`[n]`->`dropDowns` -- The `replaceInExcel` functionality in Excel allows you to replace data in an existing file using flags provided within the spreadsheet. +## Version 7.0.1 (2025-03-13) ### Bug Fixes -- `generateExcel` supports empty objects and will generate an empty Excel file. - -> [!NOTE] -> The related interface has not changed, so the sheet needs to be provided in TypeScript. - -### Improvements - -- Begin adding JSDoc comments to the main functions and interfaces. - +- Related to formating. (more info-PR)[https://github.com/mohammadrezaeicode/mr-excel-repo/pull/5/] (by [Sergio Fernández](https://github.com/xergiodf)) +- Data range error. diff --git a/dist/excel-table.amd.js b/dist/excel-table.amd.js index 7620f9f..7b26b50 100644 --- a/dist/excel-table.amd.js +++ b/dist/excel-table.amd.js @@ -1 +1 @@ -define(["exports","./index-BYjrfbvd"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); +define(["exports","./index-D3jbCDy2"],function(e,a){"use strict";e.Validator=a.validateExcelTable,e.addGlobalOptionFromExcelTable=a.addGlobalOptionFromExcelTable,e.addGlobalOptions=a.addGlobalOptions,e.convertTableToExcel=a.convertTableToExcel,e.excelToJson=a.excelToJson,e.excelToNode=a.excelToNode,e.extractExcelData=a.extractExcelData,e.generateCSV=a.generateCSV,e.generateExcel=a.generateExcel,e.generateText=a.generateText,e.replaceInExcel=a.replaceInExcel,e.sideBySideLineByLine=a.sideBySideLineByLine,e.themeBaseGenerate=a.themeBaseGenerate,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}); diff --git a/dist/excel-table.cjs b/dist/excel-table.cjs index 7b54219..9474d68 100644 --- a/dist/excel-table.cjs +++ b/dist/excel-table.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CzrjgJVS.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; +"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CNq3yjRY.cjs");exports.Validator=e.validateExcelTable;exports.addGlobalOptionFromExcelTable=e.addGlobalOptionFromExcelTable;exports.addGlobalOptions=e.addGlobalOptions;exports.convertTableToExcel=e.convertTableToExcel;exports.excelToJson=e.excelToJson;exports.excelToNode=e.excelToNode;exports.extractExcelData=e.extractExcelData;exports.generateCSV=e.generateCSV;exports.generateExcel=e.generateExcel;exports.generateText=e.generateText;exports.replaceInExcel=e.replaceInExcel;exports.sideBySideLineByLine=e.sideBySideLineByLine;exports.themeBaseGenerate=e.themeBaseGenerate; diff --git a/dist/excel-table.d.ts b/dist/excel-table.d.ts index 10a8c76..d2ad689 100644 --- a/dist/excel-table.d.ts +++ b/dist/excel-table.d.ts @@ -215,7 +215,7 @@ declare type ConditionalFormattingTopOperation = "belowAverage" | "aboveAverage" * @param {boolean} [config.keepStyle] - Whether to keep the style. * @param {RowHeightScaleFunction} [config.rowHeightScaleFunction] - The function to scale row height. * @param {ColWidthScaleFunction} [config.colWidthScaleFunction] - The function to scale column width. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function convertTableToExcel(queryForTable?: string, table?: HTMLTableElement, config?: { keepStyle?: boolean; @@ -396,8 +396,8 @@ export declare function excelToJson(uri: string, fetchFunc?: Function, withHeade * @param {string} uri - The URI of the Excel file. * @param {string | null} [queryForTable] - The query selector for the table. * @param {HTMLDivElement | null} [containerElement] - The container element. - * @param {ExcelToNodeConfig} [config={}] - The configuration options. - * @returns {Promise} The result of the conversion. + * @param {ExcelToNodeConfig} [config=defaultConfig] - The configuration options. + * @returns {Promise} The result of the conversion. */ export declare function excelToNode(uri: string, queryForTable?: string | null, containerElement?: HTMLDivElement | null, config?: ExcelToNodeConfig): Promise; @@ -436,7 +436,7 @@ declare type ExtractedData = (string | null | undefined)[][]; * @param {string} uri - The URI of the Excel file. * @param {boolean} [isBackend=false] - Whether the extraction is done on the backend. * @param {Function} [fetchFunc] - The function to fetch data. - * @returns {Promise} The extracted data. + * @returns {Promise} The extracted data. */ export declare function extractExcelData(uri: string, isBackend?: boolean, fetchFunc?: Function): Promise; @@ -487,20 +487,20 @@ declare type FormulaType = "AVERAGE" | "SUM" | "COUNT" | "MAX" | "MIN"; declare function generalValidationCheck(value: never, validateProperty: ValidationObject, property: string, strict: boolean, warn: boolean): boolean; /** - * Generates a CSV file from an Excel table. + * Generates a CSV file from an Excel table Object. * @param {ExcelTable} excelTable - The Excel table. * @param {boolean} [asZip=false] - Whether to generate the CSV as a ZIP file. - * @returns {Promise} The generated CSV file. + * @returns {Promise} The generated CSV file. */ export declare function generateCSV(excelTable: ExcelTable, asZip?: boolean): Promise; export declare function generateExcel(data: ExcelTable, styleKey?: string): Promise; /** - * Generates a text file from an Excel table. + * Generates a text file from an Excel table Object. * @param {ExcelTable} excelTable - The Excel table. * @param {boolean} [asZip=false] - Whether to generate the text file as a ZIP file. - * @returns {Promise} The generated text file. + * @returns {Promise} The generated text file. */ export declare function generateText(excelTable: ExcelTable, asZip?: boolean): Promise; @@ -891,7 +891,7 @@ declare interface SideBySide { /** * Generates an Excel file with side-by-side data. * @param {SideBySide[][]} data - The side-by-side data. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function sideBySideLineByLine(data: SideBySide[][]): Promise; @@ -1021,7 +1021,7 @@ declare type StyleType = "conditionalFormatting" | "CF" | "headerFooter" | "HF"; * Generates an Excel file with a theme. * @param {ExcelTable | Data[] | Data[][]} data - The data for the Excel file. * @param {ThemeOption} [option] - The theme options. - * @returns {Promise} The generated Excel table. + * @returns {Promise} The generated Excel table. */ export declare function themeBaseGenerate(data: ExcelTable | Data[] | Data[][], option?: ThemeOption): Promise; diff --git a/dist/excel-table.iife.js b/dist/excel-table.iife.js index b550970..868600f 100644 --- a/dist/excel-table.iife.js +++ b/dist/excel-table.iife.js @@ -1,9 +1,9 @@ -var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;oy[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),y=h.charAt(2);return w+w+o+o+y+y}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((y,c)=>y&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,y)=>o+y.charAt(0)+y.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),y=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),y)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let y=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(y):w&&w.headerColor?w.headerColor:Tt(y),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:y,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),y[_]=a})}return l});if(Object.keys(y).forEach(l=>{i.file(l,y[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,y,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,y,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var b=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=b.length,v=!0,typeof y=="function"?s=y(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),b.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;b.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof y=="function"?S.height=y(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length -`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,y,c,r,f){let i={};return` -`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+y.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` -Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,y){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),b=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&y&&typeof s.styleId=="string"&&y[s.styleId]?' s="'+y[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let y=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(y=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return y&&c.unshift(r+":"),{hasAuthor:y,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,y){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` +var ExcelTable=function(Ie){"use strict";function kt(h,w){for(var o=0;ob[c]})}}}return Object.freeze(Object.defineProperty(h,Symbol.toStringTag,{value:"Module"}))}function St(h){return h.replace(/ /g,"")}function Et(h){if(h=h.replace(/^#/,""),h.length==3){const w=h.charAt(0),o=h.charAt(1),b=h.charAt(2);return w+w+o+o+b+b}else return h}function rr(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?[parseInt(w[1],16),parseInt(w[2],16),parseInt(w[3],16)]:[0,0,0]}function Tt(h){const w=rr(h);return w==null?void 0:(.299*w[0]+.587*w[1]+.114*w[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function At(h){/^#?([a-f\d]{3})$/i.test(h)&&(h=Et(h));var w=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);return w?"rgb("+(255-parseInt(w[1],16))+","+(255-parseInt(w[2],16))+","+(255-parseInt(w[3],16))+")":"rgb(0,0,0)"}function ft(h){h=Number(h);var w=h.toString(16);return w.length==1?"0"+w:w}function je(h){h=St(h);let w=h.indexOf("rgba")>=0?h.substring(5,h.length-1).split(","):h.substring(4,h.length-1).split(","),o=w.reduce((b,c)=>b&&!Number.isNaN(Number(c)),!0);return w.length==4&&w[3]=="0"||w.length!=3&&w.length!=4||!o?null:(ft(w[0])+ft(w[1])+ft(w[2])).toUpperCase()}function Ue(h,w){if(typeof h>"u"||h===null)return null;if(!w){let o=St(h);o.indexOf("var(")==0&&o.lastIndexOf(")")==o.length-1&&(o=o.substring(4,o.length-1),h=getComputedStyle(document.documentElement).getPropertyValue(o))}if(h.indexOf("rgb")>=0){const o=je(h);h=o||""}return h.replace(/^#/,"")}function nr(h){let w="";return h.indexOf("_")>0?h.replace(/[a-z]/g,"").length==h.length?w=h.split(/_/).reduce((o,b)=>o+b.charAt(0)+b.substring(1).toLowerCase()+" ","").trim():w=h.replace(/_/g," ").trim():(w=h.replace(/([A-Z])/g," $1").trim(),w=w.charAt(0).toUpperCase()+w.substring(1).trim()),w}function Ot(h,w){let o=Object.keys(h).filter(r=>!w.includes(r)),b=[];return o.reduce((r,f)=>(r.push({label:f,text:nr(f)}),r),b)}const ct={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},ir=function(h,w={...ct}){let o;if(typeof h=="object"&&Array.isArray(h))if(h.length>0)if(Array.isArray(h[0])){let l=[];for(let s=0;s0){const _=Ot(u[0],Array.isArray(w.filterKeys)?w.filterKeys:[]);l.push({headers:_,data:u})}}o={sheet:l}}else h.length>0?o={sheet:[{headers:Ot(h[0],Array.isArray(w.filterKeys)?w.filterKeys:[]),data:h}]}:o={sheet:[]};else o={sheet:[]};else o=h;let b=w&&w.headerBackgroundColor?w.headerBackgroundColor:ct.headerBackgroundColor,c=w&&w.rowBackgroundColor?w.rowBackgroundColor:ct.rowBackgroundColor,r=w&&w.negativeColor?At(b):w&&w.headerColor?w.headerColor:Tt(b),f=w&&w.negativeColor?At(c):w&&w.rowColor?w.rowColor:Tt(c);typeof o.styles>"u"&&(o.styles={}),o.styles.themeStyleHeader={backgroundColor:b,color:r},o.styles.themeStyleBody={backgroundColor:c,color:f};const i=o.sheet.length;for(let l=0;lot)).default;let f;if(typeof h=="string"&&h.length){let l,s=!1;typeof(o==null?void 0:o.fetch)=="function"?(l=o==null?void 0:o.fetch,s=!0):l=fetch,f=await l(h).then(u=>{if(u==null||u==null)throw"response is null";return s?u:o!=null&&o.backend?u.arrayBuffer():u.blob()})}else f=o==null?void 0:o.data;let i=await r.loadAsync(f).then(async function(l){let s=Object.keys(l.files).filter(u=>u.indexOf("xl/worksheets/")==0&&u.length-4==u.lastIndexOf(".xml")||u=="xl/sharedStrings.xml");for(let u=0;u{let a=v;Object.keys(w).forEach(g=>{var t;a=a.replace(new RegExp("{{"+g+"}}","g"),(t=w[g])==null?void 0:t.toString())}),b[_]=a})}return l});if(Object.keys(b).forEach(l=>{i.file(l,b[l])}),o!=null&&o.backend)return i.generateAsync({type:o.generateType?o.generateType:"nodebuffer"}).then(l=>l);if(o!=null&&o.notSave)return i.generateAsync({type:"blob"}).then(l=>l.slice(0,l.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let l=await i.generateAsync({type:"blob"});(await Promise.resolve().then(()=>bt)).saveAs(l,(o!=null&&o.fileName?o==null?void 0:o.fileName:"tableRecord")+".xlsx")}}function ar(h,w,o,b,c,r,f,i){let l=[],s="both",u=[];!w||w===0?(w=1,s="col"):u.push(w-1),!h||h===0?(h=0,s="row"):u.push(h-1);let _=c||{};_.mergeType=i&&i.mergeType?[...i.mergeType,s]:[s],_.mergeValue=i&&i.mergeValue?[...i.mergeValue,u]:[u],_.mergeStart=i&&i.mergeStart?[...i.mergeStart,o]:[o];for(let v=0;v=1?(_["c"+g]=r,r="",f+="*",a--):w>=2&&o==g?(_["c"+g]=r,r="",f+="+"):f+="-":v>0&&(f+="-");l.push({..._,mergeString:f}),_={},f=""}return l}function sr(h,w,o,b,c){var _;if(!h&&!w)throw"Error: One of the function inputs is required.";let r;h?r=(_=document.querySelector(h))==null?void 0:_.querySelectorAll("tr"):r=w==null?void 0:w.querySelectorAll("tr");let f=[],i=[],l={header:{},rows:[]},s=40;if(r){let v=!1,a=0;r.forEach((g,t)=>{var y=[].slice.call(g.children);const m=window.getComputedStyle(g,null);let x=je(m.backgroundColor);if(!v)a=y.length,v=!0,typeof b=="function"?s=b(Number(m.height.substring(0,m.height.length-2)),t,!0):s=Number(m.height.substring(0,m.height.length-2)),y.forEach((S,I)=>{let E=window.getComputedStyle(S,null),R=null;if(E.borderBottomWidth!=="0px"){const j=je(E.borderBottomColor);j&&(R||(R={}),R.bottom={style:"thin",color:j})}if(E.borderTopWidth!=="0px"){const j=je(E.borderTopColor);j&&(R||(R={}),R.top={style:"thin",color:j})}if(E.borderLeftWidth!=="0px"){const j=je(E.borderLeftColor);j&&(R||(R={}),R.left={style:"thin",color:j})}if(E.borderRightWidth!=="0px"){const j=je(E.borderRightColor);j&&(R||(R={}),R.right={style:"thin",color:j})}let D=je(E.backgroundColor);!D&&x&&(D=x);const U=parseInt(E.fontSize.substring(0,E.fontSize.indexOf("p")));let F={...D?{backgroundColor:D}:{},bold:parseInt(E.fontWeight)>500,...isNaN(U)?{}:{size:U},...R?{border:R}:{},alignment:{...typeof E.textAlign=="string"&&E.textAlign.length>0?{horizontal:E.textAlign}:{},vertical:"center",...E.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+I]=F;let L;typeof c=="function"?L=c(Number(E.width.substring(0,E.width.length-2)),I):L=Number(E.width.substring(0,E.width.length-2))*.15;const V=S.getAttribute("colspan"),k=S.getAttribute("rowspan");f.push({label:"c"+I,...V?{colspan:V}:{},...k?{rowspan:k}:{},text:S.textContent,...isNaN(L)||L<=0?{}:{size:L}})});else{let S={},I="",E=!1;i.length>=t&&(S=i[t-1],I="mergeString"in S?S.mergeString:"",E=!0);let R=0;y.forEach((D,U)=>{if("c"+(U+R)in S)for(let n=0;n<=a+1&&"c"+(U+n)in S;n++)R++;U+=R;let F=window.getComputedStyle(D,null);if(D.getAttribute("colspan")||D.getAttribute("rowspan")){let n=ar(D.getAttribute("colspan")*1,D.getAttribute("rowspan")*1,U,a,S,D.textContent,I,S);i.length{i.length500,...isNaN(k)?{}:{size:k},...L?{border:L}:{},alignment:{...typeof F.textAlign=="string"&&F.textAlign.length>0?{horizontal:F.textAlign}:{},vertical:"center",...F.direction=="rtl"?{rtl:!0}:{ltr:!0}}};l.header[t+"-"+U]=j,S["c"+U]=D.textContent}),typeof b=="function"?S.height=b(Number(m.height.substring(0,m.height.length-2)),t,!1):S.height=m.height.substring(0,m.height.length-2),typeof S.height=="string"&&S.height.length==0&&delete S.height,i.length +`+(h.format.count>0?''+h.format.value+"":"")+''+h.font.value+''+h.fill.value+''+h.border.value+''+h.cell.value+' '+(w?''+h.conditionalFormatting.value+"":'')+""}function fr(h,w,o,b,c,r,f){let i={};return` +`+o.reduce((l,s)=>(s=s.toLowerCase(),i[s]?l:s=="svg"?(i.png=!0,i.svg=!0,l+''):s=="jpeg"||s=="jpg"?(i.jpeg=!0,i.jpg=!0,l+''):(i[s]=!0,l+'')),"")+w.reduce((l,s)=>l+'',"")+h+(f.length>0?f.reduce((l,s)=>l+'',""):"")+''+(r?'':"")+''+b.reduce((l,s)=>l+'',"")+(c.length>0?c.reduce((l,s,u)=>l+'',""):"")+''}function cr(h,w){return` +Microsoft Excel0falseWorksheets`+h+' '+w+"falsefalsefalse16.0300"}function ht(h,w,o,b){h=h.toUpperCase();let c="";if(w.formula){let s=w,u=s.formula.indexOf("=")==0?s.formula.substring(1):s.formula,_=h.indexOf(":")>0,v=s.referenceCells?s.referenceCells:h,a=_?h.substring(0,h.indexOf(":")):h,g=a.replace(/[0-9]/g,""),t=parseInt(h.substr(g.length)),y=s.returnType?s.returnType:s.isArray||_?' t="str"':"",m="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"",x=s.isArray||_?' t="array" ref="'+v+'"':"";return c='"+u+"",{column:g,row:t,needCalcChain:!1,isCustom:!0,cell:c}}let r=h.replace(/[0-9]/g,""),f=parseInt(h.substr(r.length)),i=!1,l="";if(w.noArgType){const s=w;if(s.noArgType=="NOW"||s.noArgType=="TODAY"){const u="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType+"()"}else{let u="NOW()";const _="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+s.noArgType.substring(4)+"("+u+")"}l='',i=!0}else if(w.referenceCell){const s=w;let u="";typeof s.value<"u"&&(u=","+s.value);let _="";s.type=="COT"&&(_="_xlfn.");const v="styleId"in s&&b&&typeof s.styleId=="string"&&b[s.styleId]?' s="'+b[s.styleId].index+'"':"";c='"+_+s.type+"("+s.referenceCell.toUpperCase()+u+")",l='',i=!0}else{const s=w;c='"+s.type+"("+s.start.toUpperCase()+":"+s.end.toUpperCase()+")"}return{column:r,row:f,cell:c,needCalcChain:i,chainCell:l}}function dt(h,w,o){let b=!1,c,r;if(typeof h=="object"){if("author"in h&&h.author&&(b=!0,r=h.author),"styleId"in h&&typeof h.styleId=="string"){let f=w[h.styleId];typeof f=="string"&&(o=f)}c="comment"in h&&typeof h.comment=="string"?It(h.comment):[""]}else c=h?It(h):[""];return b&&c.unshift(r+":"),{hasAuthor:b,author:r,commentStyle:o,commentStr:c}}function It(h){var w=h.split(/\r?\n|\r|\n/g);return w}function ut(h,w,o,b){let c='',r="";return w.forEach((f,i)=>{let l="";if(f.length==0){r+=` `;return}i>0&&(l=' xml:space="preserve"',r+=` -`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let y="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),y+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+y+""}const Ft={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"¥":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"₼1":{key:175,value:''},"₽1":{key:174,value:''},"₽2":{key:173,value:''},"₽3":{key:172,value:''},ريال:{key:171,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,y)=>{let c,r=!1;return typeof y=="function"?(c=y,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let y=parseInt(h.substring(o.length));if(isNaN(y))throw"Invalid Row";y=Math.max(0,y-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:y}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,y){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,y=pt[h];return Object.keys(y).forEach(r=>{const f=r.split(".");let i=o,l=y[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const y=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,b=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,y);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(b&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,y),K=Ue(d.backgroundColor,y);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,y);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,y);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` +`),c+=""+o+""+r+f+"",r=""}),r.length>0&&c.indexOf("")>0&&(c=c.substring(0,c.length-8)+r+""),c+="",c}const hr='',tt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function mt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=tt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"¥":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},ريال:{key:171,value:''},"₽3":{key:172,value:''},"₽2":{key:173,value:''},"₽1":{key:174,value:''},"₼1":{key:175,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function qe(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=et(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},pt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){pt[h],pt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=pt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function rt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=et(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>ot)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` `};let he=1024;const Z={checkbox:` - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ye="",Ve=[],at=[],Ge=[],Me=[],Le={},Je="",Qe=!1,vt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;vt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;vt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(Qe=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Oe=G[ae];let xe="";if(Object.keys(Oe).reduce((de,ce)=>(ce=="l"?de.splice(0,0,ce):ce=="c"?de.splice(1,0,ce):ce=="r"&&de.splice(2,0,ce),de),[]).forEach(de=>{const ce=Oe[de];xe+="&"+de.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Je=ee+Y+W,Je.length>0){Qe=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Je=""+Je+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(Qe=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=et(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(Qe&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=qe(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),he++;let W=e+""+he++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=qe(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=qe(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let xt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;xt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,h.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let wt;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),wt=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,h.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Oe=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",de=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Oe-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=dt(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Ee=Pe.indexOf(ke);Ee<0?Pe.push(ke):Ne=Ee}Ve.push({row:P+se-1,col:G}),Ye+=ut(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(d[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,de):E+=""+tt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Ge.push(fe),W.conditionalFormatting&&Me.push(fe),at.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=dt(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Oe=G.author.toString();const xe=Pe.indexOf(Oe);xe<0?Pe.push(Oe):ae=xe}Ve.push({row:P-1,col:fe}),Ye+=ut(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,h.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=mt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+tt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";d[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const N=h.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),h.format){const T=o[h.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,d.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:b?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,b));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,M=[],te=1;const $={checkbox:` -`};let de=1024;const Z={checkbox:`',rt=function(h){return h.replace(/\&/g,"&").replace(/\/g,">")};function pt(h,w,o){let b="";return h.forEach(c=>{typeof c.value=="string"&&(c.value=rt(c.value)),b+=""+(c.styleId&&w[c.styleId]?w[c.styleId]:w[o])+''+c.value+""}),""+b+""}const Ft={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"¥":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},ريال:{key:171,value:''},"₽3":{key:172,value:''},"₽2":{key:173,value:''},"₽1":{key:174,value:''},"₼1":{key:175,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Rt=(h,w,o=!1,b)=>{let c,r=!1;return typeof b=="function"?(c=b,r=!0):c=fetch,c(h).then(f=>r?f:o?f.arrayBuffer():f.blob()).then(f=>r||o?f:new File([f],w)).catch(f=>{throw f})};function Ye(h,w){h=h.toUpperCase();let o=h.replace(/[0-9]/g,"");if(o.length==0)throw"Invalid Column";let b=parseInt(h.substring(o.length));if(isNaN(b))throw"Invalid Row";b=Math.max(0,b-1);let c=w.indexOf(o);return c<0&&(w=tt(w,Math.pow(10,o.length+1),""),c=w.indexOf(o),c<0&&(c=0)),{col:c,row:b}}let dr={},gt=new Proxy(dr,{get(h,w){return w in h?h[w]:(this.set(h,w,{},!0),{})},set(h,w,o,b){return h[w]=o,!0}});function Pt(h,w,o){gt[h],gt[h][w]=o}function Bt(h,w,o){Object.keys(o).forEach(c=>{const r=o[c];typeof r=="object"?c!="data"&&c!="headers"&&Bt(h,w.length>0?w+"."+c:c,r):Pt(h,w.length>0?w+"."+c:c,r)})}function ur(h,w){Bt(h,"",w)}function mr(h,w){let o=w,b=gt[h];return Object.keys(b).forEach(r=>{const f=r.split(".");let i=o,l=b[r];for(let s=0;si+" "+l,""),f=c.option.join(",");o+='"'+f+"""}return o+="",o}async function nt(h,w=""){if(typeof w=="string"&&w.length>0&&(h=mr(w,h)),typeof h.creator=="string"&&h.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof h.created=="string"&&new Date(h.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof h.modified=="string"&&new Date(h.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let o=Ft;h.formatMap&&typeof h.formatMap=="object"&&(o={...o,...h.formatMap});const b=h.backend,c={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let r=[...zt];h.numberOfColumn&&h.numberOfColumn>25&&(r=tt(r,h.numberOfColumn));const i=(await Promise.resolve().then(()=>at)).default;let l=new i;h.sheet||(h.sheet=[{headers:[],data:[]}]);const s=h.sheet.length;let u=l.folder("xl"),_=null,v=null,a=null;h.styles||(h.styles={}),h.addDefaultTitleStyle&&(h.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const g=Object.keys(h.styles),t=hr,y=h.activateConditionalFormatting?h.activateConditionalFormatting:!1,m={},x={};let S=g.reduce((e,C,A)=>{const d=h.styles[C];if(d.type&&(d.type=="headerFooter"||d.type=="HF")){let T="",K="-",J="Regular";if(d.fontFamily&&(K=d.fontFamily),d.bold&&(J="Bold"),d.italic&&(J=="Regular"&&(J=""),J+="Italic"),(K!="-"||J!="Regular")&&(T='&"'+K+","+J+'"'),d.size&&(T+="&"+d.size),d.doubleUnderline?T+="&E":d.underline&&(T+="&U"),d.color){const q=Ue(d.color,b);typeof q=="string"&&q.length>0&&(T+="&K"+q.toUpperCase())}return m[C]=T,e}if(y&&typeof d.type=="string"&&d.type&&(d.type=="conditionalFormatting"||d.type.toUpperCase()=="CF")){x[C]=e.conditionalFormatting.count;let T=Ue(d.color,b),K=Ue(d.backgroundColor,b);return e.conditionalFormatting.value+=' ',e.conditionalFormatting.count++,e}const p={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(d.backgroundColor){let T=Ue(d.backgroundColor,b);p.fillIndex=e.fill.count,e.fill.count++,e.fill.value=e.fill.value+''+(T?'':"")+""}if(d.color||d.fontFamily||d.size||d.bold||d.italic||d.underline||d.doubleUnderline){const T=Ue(d.color,b);p.fontIndex=e.font.count,e.font.count++,e.font.value=e.font.value+""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+(d.size?'':"")+(T?'':"")+(d.fontFamily?'':"")+"",e.commentSyntax.value[C]=""+(d.bold?"":"")+(d.italic?"":"")+(d.underline||d.doubleUnderline?"":"")+''+(T?'':"")+''}let O="/>";d.alignment&&(d.alignment.rtl&&(d.alignment.readingOrder=2),delete d.alignment.rtl,d.alignment.ltr&&(d.alignment.readingOrder=1),delete d.alignment.ltr,O=' applyAlignment="1">T+" "+K+'="'+d.alignment[K]+'" ',"")+" />");const N=d.border;let P="";if(typeof N=="object"&&((N.left||N.full)&&(P+=''),(N.right||N.full)&&(P+=''),(N.top||N.full)&&(P+=''),(N.bottom||N.full)&&(P+=''),p.borderIndex=e.border.count,e.border.count++,e.border.value+=""+P+""),d.format){const T=o[d.format];T&&(p.formatIndex=T.key,"value"in T&&(e.format.count++,e.format.value+=T.value))}return e.cell.value=e.cell.value+'0?' applyBorder="1" ':"")+(p.fillIndex>0?' applyFill="1" ':"")+(p.fontIndex>=0?' applyFont="1" ':"")+(p.formatIndex>0?' applyNumberFormat="1" ':"")+O,h.styles[C].index=e.cell.count,e.cell.count++,e},{conditionalFormatting:{count:y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});u==null||u.file("styles.xml",lr(S,y));let I='',E="",R=0,D="",U="",F={};const L={};let V="",k=4,j=!1,n=-1,H=[],te=1;const $={checkbox:` +`};let he=1024;const Z={checkbox:` @@ -27,21 +27,21 @@ - `};let B=[],z="",ne=!1,Q=null;for(let e=0;e=0?C.shiftTop+1:1,T="",K="",J="",q="",re="",ge="",me=!1,Fe="",Ke="",De="",$e="",ye=Object.assign([],C.merges),ze=Object.assign({},C.formula),Ze=Object.assign([],C.conditionalFormatting),Re=!1,Pe=[],Ve="",Ge=[],st=[],Xe=[],Me=[],Le={},Qe="",et=!1,xt="";if(C.rtl&&(re+=' rightToLeft="1" '),C.pageBreak){const ie=C.pageBreak;if(ie.row&&Array.isArray(ie.row)){ge="pageBreakPreview";const H=ie.row.length;xt+=''+ie.row.reduce((ee,Y)=>ee+'',"")+""}if(ie.column&&Array.isArray(ie.column)){ge="pageBreakPreview";const H=ie.column.length;xt+=''+ie.column.reduce((ee,Y)=>ee+'',"")+""}}let qt="";if(C.pageOption){const ie=C.pageOption;if(ie.isPortrait&&(et=!0),ie.margin){const se=ie.margin;let le={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(le).forEach(G=>{typeof se[G]=="number"&&(le[G]=se[G])}),qt=''}let H="",ee="",Y="",W="";if(["header","footer"].forEach(se=>{const le=se.charAt(0).toUpperCase()+se.substring(1);if(ie[se]){const G=ie[se];typeof G=="object"&&Object.keys(G).forEach(ae=>{H.indexOf(ae)<0&&(H+=ae);const Ie=G[ae];let xe="";if(Object.keys(Ie).reduce((he,ce)=>(ce=="l"?he.splice(0,0,ce):ce=="c"?he.splice(1,0,ce):ce=="r"&&he.splice(2,0,ce),he),[]).forEach(he=>{const ce=Ie[he];xe+="&"+he.toUpperCase(),ce.styleId&&m[ce.styleId]&&(xe+=m[ce.styleId]),ce.text&&(xe+=ce.text)}),xe="<"+ae+le+">"+xe+"",ae=="odd")ee+=xe;else if(ae=="even")Y+=xe;else if(ae=="first")W+=xe;else throw"type error"})}}),Qe=ee+Y+W,Qe.length>0){et=!0;const se=H.length==7||H.length==12?' differentOddEven="1"':"",le=H.indexOf("first")>=0?' differentFirst="1"':"";Qe=""+Qe+""}}if(C.viewOption){let ie="";const H=C.viewOption;H.type&&(ge=H.type),H.hideRuler&&(re+=' showRuler="0" '),H.hideGrid&&(re+=' showGridLines="0" '),H.hideHeadlines&&(re+=' showRowColHeaders="0" ');let ee=H.splitOption;if(typeof ee>"u"&&(et=!1,typeof H.frozenOption=="object")){const Y=H.frozenOption;if(ie=' state="frozen" ',Y.type=="R"||Y.type=="ROW"){let W;typeof Y.index=="object"?W=Y.index.r:W=Y.index,ee={startAt:{b:"A"+(W+1)},type:"H",split:W}}else if(Y.type=="C"||Y.type=="COLUMN"){let W;typeof Y.index=="object"?W=Y.index.c:W=Y.index,W>r.length-1&&(r=tt(r,W)),ee={type:"V",startAt:{r:r[W]+1},split:W}}else if(Y.type=="B"||Y.type=="BOTH"){let W="",fe;typeof Y.index=="number"?(fe=Y.index,W=r[Y.index]+(Y.index+1)):(fe={y:Y.index.r,x:Y.index.c},W=r[Y.index.c]+(Y.index.r+1)),ee={startAt:{two:W},type:"B",split:fe}}}if(ee)if(ee.type=="H"||ee.type=="HORIZONTAL"){let Y;ee.startAt&&(Y=ee.startAt.b,ee.startAt.t&&(re+=' topLeftCell="'+ee.startAt.t+'"')),Y||(Y="A1"),q='"}else if(ee.type=="V"||ee.type=="VERTICAL"){let Y;ee.startAt&&(Y=ee.startAt.r,ee.startAt.l&&(re+=' topLeftCell="'+ee.startAt.l+'"')),Y||(Y="A1"),q='"}else{let Y;ee.startAt&&(Y=ee.startAt.two,ee.startAt.one&&(re+=' topLeftCell="'+ee.startAt.one+'"')),Y||(Y="A1"),q='"}}if(et&&(ge="pageLayout"),C.checkbox){me=!0;const ie=$.checkbox;C.checkbox.forEach((H,ee)=>{let Y=ie;if(H.link){let ae=Ye(H.link,r);Y=Y.replace("**fmlaLink**",'fmlaLink="$'+r[ae.col]+"$"+(ae.row+1)+'"')}else Y=Y.replace("**fmlaLink**","");H.mixed?Y=Y.replace("**value**",'checked="Mixed"'):H.checked?Y=Y.replace("**value**",'checked="Checked"'):Y=Y.replace("**value**",""),H.threeD&&Y.replace('noThreeD="1"',""),B.push(Y),de++;let W=e+""+de++;const fe="_x0000_s"+W;Ke+=Z.checkbox.replace("***id***",fe).replace("***text***",H.text);let se=H.startStr,le=H.endStr,G={start:{col:0,row:0},end:{col:1,row:1}};if(H.col&&H.row&&(G={start:{col:H.col,row:H.row-1},end:{col:H.col,row:H.row}}),typeof se=="string"&&se.length>=2){let ae=Ye(se,r);G.start={...ae},G.end={col:ae.col+1,row:ae.row+1}}if(typeof le=="string"&&le.length>=2){let ae=Ye(le,r);ae.row+=1,ae.col+=1,G.end={...ae}}$e+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+"0",De+='',Fe+=''+G.start.col+"19050"+G.start.row+"19050"+G.end.col+"819150"+G.end.row+'0'+H.text+""})}let wt;if(C.backgroundImage){_==null&&(_=u==null?void 0:u.folder("media"));const ie=C.backgroundImage;wt=new Promise(async(H,ee)=>{let Y=ie.lastIndexOf("."),W;Y>0?(W=ie.substring(Y+1).toLowerCase(),W.length>4&&(W.indexOf("gif")>=0?W="gif":W.indexOf("jpg")>=0?W="jpg":W.indexOf("jpeg")>=0?W="jpeg":W="png")):W="png";const fe=te++,se="image"+fe+"."+W,le=await Rt(ie,se,y,d.fetch);le||ee("image not load"),M.push(W),H({name:se,type:W,image:le,ref:fe})})}let Ct;if(C.images&&(_==null&&(_=u==null?void 0:u.folder("media")),Ct=Promise.all([...C.images.map(async(ie,H)=>{let ee=ie.url.lastIndexOf("."),Y;ee>0?(Y=ie.url.substring(ee+1).toLowerCase(),Y.length>4&&(Y.indexOf("gif")>=0?Y="gif":Y.indexOf("jpg")>=0?Y="jpg":Y.indexOf("jpeg")>=0?Y="jpeg":Y="png")):Y="png",M.push(Y);const W="image"+te+++"."+Y;return{type:Y,image:await Rt(ie.url,W,y,d.fetch),obj:ie,i:H,name:W}})])),Array.isArray(C.headers)&&C.headers.length){const ie=C.headers.length;let H="";if(C.title){const W=C.title,fe=W.comment,se=W.shiftTop&&W.shiftTop>=0?W.shiftTop:0,le=C.shiftLeft&&C.shiftLeft>=0?C.shiftLeft:0,G=W.shiftLeft&&W.shiftLeft+le>=0?W.shiftLeft+le:le,ae=W.consommeRow?W.consommeRow-1:1,Ie=W.consommeCol?W.consommeCol:ie,xe=ae==0&&typeof W.height=="number"?' ht="'+W.height+'" customHeight="1" ':"",he=W.styleId?W.styleId:"titleStyle",ce=r[G]+""+(P+se);if(ye.push(ce+":"+r[G+Ie-1]+(P+ae+se)),typeof fe<"u"){Re=!0;const Ce=ut(fe,S.commentSyntax.value,t);let Ne=Pe.length;if(Ce.hasAuthor&&typeof Ce.author<"u"){let ke=Ce.author.toString();const Te=Pe.indexOf(ke);Te<0?Pe.push(ke):Ne=Te}Ge.push({row:P+se-1,col:G}),Ve+=mt(ce,Ce.commentStr,Ce.commentStyle,Ne)}typeof W.text=="string"&&(h[P+se]={startTag:'',details:''+R+"",endTag:""},H+='',H+=''+R+"",H+="",R++,F[W.text]=W.text,W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,he):E+=""+rt(W.text)+""),P+=se+ae+1}let ee=C.headerStyleKey?C.headerStyleKey:null,Y=0;if(typeof C.shiftLeft=="number"&&C.shiftLeft>=0&&(Y=C.shiftLeft),O&&(N+='',Q||(Q=u==null?void 0:u.folder("tables"))),p.start=r[Y]+""+P,p.end=r[Y+C.headers.length-1]+""+(P+C.data.length),C.headers.forEach((W,fe)=>{if(O&&(N+=''),Y&&(fe+=Y),W.formula&&Xe.push(fe),W.conditionalFormatting&&Me.push(fe),st.push(W.label),C.mergeRowDataCondition&&typeof C.mergeRowDataCondition=="function"&&C.mergeRowDataCondition(W,null,fe,!0)===!0&&(Le[r[fe]]={inProgress:!0,start:P}),C.styleCellCondition&&typeof C.styleCellCondition=="function"&&(ee=C.styleCellCondition(W,W,P,fe,!0,g)||ee),W.size&&W.size>0&&(K+=''),C.withoutHeader)return;const se=r[fe]+""+P;if(typeof C.commentCondition=="function"){const G=C.commentCondition(W,null,W.label,P,fe,!0);(typeof G=="string"||typeof G=="object"&&G!=null)&&(W.comment=G)}if(W.comment){Re=!0;const G=ut(W.comment,S.commentSyntax.value,t);let ae=Pe.length;if(G.hasAuthor&&typeof G.author<"u"){let Ie=G.author.toString();const xe=Pe.indexOf(Ie);xe<0?Pe.push(Ie):ae=xe}Ge.push({row:P-1,col:fe}),Ve+=mt(se,G.commentStr,G.commentStyle,ae)}const le=ze&&ze[se];if(le){const G=ht(se,le,A,d.styles);G.needCalcChain&&(ne=!0,z+=G.chainCell),T+=G.cell,delete ze[se]}else{if(T+=''+R+"",typeof C.multiStyleCondition=="function"){const G=C.multiStyleCondition(W,null,W.label,P,fe,!0);G&&(W.multiStyleValue=G)}W.multiStyleValue&&Array.isArray(W.multiStyleValue)?E+=pt(W.multiStyleValue,S.commentSyntax.value,ee||""):E+=""+rt(W.text)+"",F[W.text]=W.text,R++}}),O&&(N+=""),C.withoutHeader)T+=H;else{const W='fe+" "+se+'="'+C.headerRowOption[se]+'" '," "):"")+">";h[P]={startTag:W,endTag:"",details:T},T=H+W+T+"",P++}if(Array.isArray(C.data)){const W=C.mapSheetDataOption&&C.mapSheetDataOption.outlineLevel?C.mapSheetDataOption.outlineLevel:"outlineLevel",fe=C.mapSheetDataOption&&C.mapSheetDataOption.hidden?C.mapSheetDataOption.hidden:"hidden",se=C.mapSheetDataOption&&C.mapSheetDataOption.height?C.mapSheetDataOption.height:"height",le=C.data.length;C.data.forEach((G,ae)=>{if(G.mergeType)for(let ce=0;ce");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,G));let oe='',P="",B=0,X="",K="",L={};const E={};let $="",q=4,U=!1,M=-1,ve=[],J=1;const ge={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const Qt='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Xe(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"¥":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},ريال:{key:171,value:''},"₽3":{key:172,value:''},"₽2":{key:173,value:''},"₽1":{key:174,value:''},"₼1":{key:175,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},eo=Pe("c",["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]),bt=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Fe(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Je=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Ct(e,t,r){Je[e],Je[e][t]=r}function vt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&vt(e,t.length>0?t+"."+n:n,l):Ct(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){vt(e,"",t)}function ro(e,t){let r=t,o=Je[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...eo];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await ye.import("./jszip.min-49JP7itW.js").then(w=>w.j)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=Qt,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},X={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",fe="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(fe="Bold"),x.italic&&(fe=="Regular"&&(fe=""),fe+="Italic"),(G!="-"||fe!="Regular")&&(C='&"'+G+","+fe+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Ee=de(x.color,o);typeof Ee=="string"&&Ee.length>0&&(C+="&K"+Ee.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){X[a]=w.conditionalFormatting.count;let C=de(x.color,o),G=de(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=de(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=de(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Zt(N,q));let oe='',P="",B=0,J="",M="",L={};const E={};let $="",Y=4,W=!1,K=-1,ve=[],Q=1;const ge={checkbox:` `};let we=1024;const Te={checkbox:` - `};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+=''),Y.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(Y.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(Y.fillIndex>0?' applyFill="1" ':"")+(Y.fontIndex>=0?' applyFont="1" ':"")+(Y.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const E={};let $="",M=4,U=!1,q=-1,Ce=[],X=1;const ye={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Me=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function at(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Me(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const Lt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"¥":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},ريال:{key:171,value:''},"₽3":{key:172,value:''},"₽2":{key:173,value:''},"₽1":{key:174,value:''},"₼1":{key:175,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_t=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function _e(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=$e(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},it=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function Nt(e,t,r){it[e],it[e][t]=r}function Bt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&Bt(e,t.length>0?t+"."+n:n,l):Nt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){Bt(e,"",t)}function ro(e,t){let r=t,o=it[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let s=0;su+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Ke(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=Lt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...Ht];e.numberOfColumn&&e.numberOfColumn>25&&(l=$e(l,e.numberOfColumn));const u=(await Promise.resolve().then(()=>require("./jszip.min-jYEVHKmD.cjs")).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const s=e.sheet.length;let f=m.folder("xl"),v=null,D=null,j=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,q=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",ce="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(ce="Bold"),x.italic&&(ce=="Regular"&&(ce=""),ce+="Italic"),(G!="-"||ce!="Regular")&&(C='&"'+G+","+ce+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Te=he(x.color,o);typeof Te=="string"&&Te.length>0&&(C+="&K"+Te.toUpperCase())}return U[a]=C,w}if(q&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=he(x.color,o),G=he(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=he(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=he(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let se="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,se=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+se,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:q?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,q));let oe='',P="",B=0,X="",$="",L={};const E={};let M="",Y=4,W=!1,K=-1,Ce=[],Q=1;const ye={checkbox:` `};let ve=1024;const we={checkbox:` - `};let ae=[],ie="",ge=!1,de=null;for(let w=0;w=0?a.shiftTop+1:1,C="",W="",ce="",Te="",Ee="",Ie="",Ue=!1,dt="",pt="",ht="",ut="",xe=Object.assign([],a.merges),ue=Object.assign({},a.formula),We=Object.assign([],a.conditionalFormatting),Pe=!1,pe=[],Le="",He=[],yt=[],Ge=[],Ze=[],ke={},je="",Re=!1,Je="";if(a.rtl&&(Ee+=' rightToLeft="1" '),a.pageBreak){const T=a.pageBreak;if(T.row&&Array.isArray(T.row)){Ie="pageBreakPreview";const i=T.row.length;Je+=''+T.row.reduce((y,p)=>y+'',"")+""}if(T.column&&Array.isArray(T.column)){Ie="pageBreakPreview";const i=T.column.length;Je+=''+T.column.reduce((y,p)=>y+'',"")+""}}let gt="";if(a.pageOption){const T=a.pageOption;if(T.isPortrait&&(Re=!0),T.margin){const F=T.margin;let A={left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3};Object.keys(A).forEach(h=>{typeof F[h]=="number"&&(A[h]=F[h])}),gt=''}let i="",y="",p="",c="";if(["header","footer"].forEach(F=>{const A=F.charAt(0).toUpperCase()+F.substring(1);if(T[F]){const h=T[F];typeof h=="object"&&Object.keys(h).forEach(O=>{i.indexOf(O)<0&&(i+=O);const le=h[O];let V="";if(Object.keys(le).reduce((R,I)=>(I=="l"?R.splice(0,0,I):I=="c"?R.splice(1,0,I):I=="r"&&R.splice(2,0,I),R),[]).forEach(R=>{const I=le[R];V+="&"+R.toUpperCase(),I.styleId&&z[I.styleId]&&(V+=z[I.styleId]),I.text&&(V+=I.text)}),V="<"+O+A+">"+V+"",O=="odd")y+=V;else if(O=="even")p+=V;else if(O=="first")c+=V;else throw"type error"})}}),je=y+p+c,je.length>0){Re=!0;const F=i.length==7||i.length==12?' differentOddEven="1"':"",A=i.indexOf("first")>=0?' differentFirst="1"':"";je=""+je+""}}if(a.viewOption){let T="";const i=a.viewOption;i.type&&(Ie=i.type),i.hideRuler&&(Ee+=' showRuler="0" '),i.hideGrid&&(Ee+=' showGridLines="0" '),i.hideHeadlines&&(Ee+=' showRowColHeaders="0" ');let y=i.splitOption;if(typeof y>"u"&&(Re=!1,typeof i.frozenOption=="object")){const p=i.frozenOption;if(T=' state="frozen" ',p.type=="R"||p.type=="ROW"){let c;typeof p.index=="object"?c=p.index.r:c=p.index,y={startAt:{b:"A"+(c+1)},type:"H",split:c}}else if(p.type=="C"||p.type=="COLUMN"){let c;typeof p.index=="object"?c=p.index.c:c=p.index,c>l.length-1&&(l=Ke(l,c)),y={type:"V",startAt:{r:l[c]+1},split:c}}else if(p.type=="B"||p.type=="BOTH"){let c="",_;typeof p.index=="number"?(_=p.index,c=l[p.index]+(p.index+1)):(_={y:p.index.r,x:p.index.c},c=l[p.index.c]+(p.index.r+1)),y={startAt:{two:c},type:"B",split:_}}}if(y)if(y.type=="H"||y.type=="HORIZONTAL"){let p;y.startAt&&(p=y.startAt.b,y.startAt.t&&(Ee+=' topLeftCell="'+y.startAt.t+'"')),p||(p="A1"),Te='"}else if(y.type=="V"||y.type=="VERTICAL"){let p;y.startAt&&(p=y.startAt.r,y.startAt.l&&(Ee+=' topLeftCell="'+y.startAt.l+'"')),p||(p="A1"),Te='"}else{let p;y.startAt&&(p=y.startAt.two,y.startAt.one&&(Ee+=' topLeftCell="'+y.startAt.one+'"')),p||(p="A1"),Te='"}}if(Re&&(Ie="pageLayout"),a.checkbox){Ue=!0;const T=ye.checkbox;a.checkbox.forEach((i,y)=>{let p=T;if(i.link){let O=_e(i.link,l);p=p.replace("**fmlaLink**",'fmlaLink="$'+l[O.col]+"$"+(O.row+1)+'"')}else p=p.replace("**fmlaLink**","");i.mixed?p=p.replace("**value**",'checked="Mixed"'):i.checked?p=p.replace("**value**",'checked="Checked"'):p=p.replace("**value**",""),i.threeD&&p.replace('noThreeD="1"',""),ae.push(p),ve++;let c=w+""+ve++;const _="_x0000_s"+c;pt+=we.checkbox.replace("***id***",_).replace("***text***",i.text);let F=i.startStr,A=i.endStr,h={start:{col:0,row:0},end:{col:1,row:1}};if(i.col&&i.row&&(h={start:{col:i.col,row:i.row-1},end:{col:i.col,row:i.row}}),typeof F=="string"&&F.length>=2){let O=_e(F,l);h.start={...O},h.end={col:O.col+1,row:O.row+1}}if(typeof A=="string"&&A.length>=2){let O=_e(A,l);O.row+=1,O.col+=1,h.end={...O}}ut+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+"0",ht+='',dt+=''+h.start.col+"19050"+h.start.row+"19050"+h.end.col+"819150"+h.end.row+'0'+i.text+""})}let Xe;if(a.backgroundImage){v==null&&(v=f==null?void 0:f.folder("media"));const T=a.backgroundImage;Xe=new Promise(async(i,y)=>{let p=T.lastIndexOf("."),c;p>0?(c=T.substring(p+1).toLowerCase(),c.length>4&&(c.indexOf("gif")>=0?c="gif":c.indexOf("jpg")>=0?c="jpg":c.indexOf("jpeg")>=0?c="jpeg":c="png")):c="png";const _=X++,F="image"+_+"."+c,A=await _t(T,F,o,e.fetch);A||y("image not load"),Ce.push(c),i({name:F,type:c,image:A,ref:_})})}let Qe;if(a.images&&(v==null&&(v=f==null?void 0:f.folder("media")),Qe=Promise.all([...a.images.map(async(T,i)=>{let y=T.url.lastIndexOf("."),p;y>0?(p=T.url.substring(y+1).toLowerCase(),p.length>4&&(p.indexOf("gif")>=0?p="gif":p.indexOf("jpg")>=0?p="jpg":p.indexOf("jpeg")>=0?p="jpeg":p="png")):p="png",Ce.push(p);const c="image"+X+++"."+p;return{type:p,image:await _t(T.url,c,o,e.fetch),obj:T,i,name:c}})])),Array.isArray(a.headers)&&a.headers.length){const T=a.headers.length;let i="";if(a.title){const c=a.title,_=c.comment,F=c.shiftTop&&c.shiftTop>=0?c.shiftTop:0,A=a.shiftLeft&&a.shiftLeft>=0?a.shiftLeft:0,h=c.shiftLeft&&c.shiftLeft+A>=0?c.shiftLeft+A:A,O=c.consommeRow?c.consommeRow-1:1,le=c.consommeCol?c.consommeCol:T,V=O==0&&typeof c.height=="number"?' ht="'+c.height+'" customHeight="1" ':"",R=c.styleId?c.styleId:"titleStyle",I=l[h]+""+(k+F);if(xe.push(I+":"+l[h+le-1]+(k+O+F)),typeof _<"u"){Pe=!0;const Q=nt(_,N.commentSyntax.value,d);let fe=pe.length;if(Q.hasAuthor&&typeof Q.author<"u"){let ee=Q.author.toString();const re=pe.indexOf(ee);re<0?pe.push(ee):fe=re}He.push({row:k+F-1,col:h}),Le+=lt(I,Q.commentStr,Q.commentStyle,fe)}typeof c.text=="string"&&(x[k+F]={startTag:'',details:''+B+"",endTag:""},i+='',i+=''+B+"",i+="",B++,L[c.text]=c.text,c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,R):P+=""+$e(c.text)+""),k+=F+O+1}let y=a.headerStyleKey?a.headerStyleKey:null,p=0;if(typeof a.shiftLeft=="number"&&a.shiftLeft>=0&&(p=a.shiftLeft),se&&(H+='',de||(de=f==null?void 0:f.folder("tables"))),Y.start=l[p]+""+k,Y.end=l[p+a.headers.length-1]+""+(k+a.data.length),a.headers.forEach((c,_)=>{if(se&&(H+=''),p&&(_+=p),c.formula&&Ge.push(_),c.conditionalFormatting&&Ze.push(_),yt.push(c.label),a.mergeRowDataCondition&&typeof a.mergeRowDataCondition=="function"&&a.mergeRowDataCondition(c,null,_,!0)===!0&&(ke[l[_]]={inProgress:!0,start:k}),a.styleCellCondition&&typeof a.styleCellCondition=="function"&&(y=a.styleCellCondition(c,c,k,_,!0,S)||y),c.size&&c.size>0&&(W+=''),a.withoutHeader)return;const F=l[_]+""+k;if(typeof a.commentCondition=="function"){const h=a.commentCondition(c,null,c.label,k,_,!0);(typeof h=="string"||typeof h=="object"&&h!=null)&&(c.comment=h)}if(c.comment){Pe=!0;const h=nt(c.comment,N.commentSyntax.value,d);let O=pe.length;if(h.hasAuthor&&typeof h.author<"u"){let le=h.author.toString();const V=pe.indexOf(le);V<0?pe.push(le):O=V}He.push({row:k-1,col:_}),Le+=lt(F,h.commentStr,h.commentStyle,O)}const A=ue&&ue[F];if(A){const h=rt(F,A,b,e.styles);h.needCalcChain&&(ge=!0,ie+=h.chainCell),C+=h.cell,delete ue[F]}else{if(C+=''+B+"",typeof a.multiStyleCondition=="function"){const h=a.multiStyleCondition(c,null,c.label,k,_,!0);h&&(c.multiStyleValue=h)}c.multiStyleValue&&Array.isArray(c.multiStyleValue)?P+=at(c.multiStyleValue,N.commentSyntax.value,y||""):P+=""+$e(c.text)+"",L[c.text]=c.text,B++}}),se&&(H+=""),a.withoutHeader)C+=i;else{const c='_+" "+F+'="'+a.headerRowOption[F]+'" '," "):"")+">";x[k]={startTag:c,endTag:"",details:C},C=i+c+C+"",k++}if(Array.isArray(a.data)){const c=a.mapSheetDataOption&&a.mapSheetDataOption.outlineLevel?a.mapSheetDataOption.outlineLevel:"outlineLevel",_=a.mapSheetDataOption&&a.mapSheetDataOption.hidden?a.mapSheetDataOption.hidden:"hidden",F=a.mapSheetDataOption&&a.mapSheetDataOption.height?a.mapSheetDataOption.height:"height",A=a.data.length;a.data.forEach((h,O)=>{if(h.mergeType)for(let I=0;I"); + x.alignment && (x.alignment.rtl && (x.alignment.readingOrder = 2), delete x.alignment.rtl, x.alignment.ltr && (x.alignment.readingOrder = 1), delete x.alignment.ltr, se = ' applyAlignment="1"> C + " " + G + '="' + x.alignment[G] + '" ', "") + " />"); const H = x.border; - let k = ""; - if (typeof H == "object" && ((H.left || H.full) && (k += ''), (H.right || H.full) && (k += ''), (H.right || H.full) && (O += ''), (H.top || H.full) && (k += ''), (H.top || H.full) && (O += ''), (H.bottom || H.full) && (k += ''), (H.bottom || H.full) && (O += ''), Y.borderIndex = w.border.count, w.border.count++, w.border.value += "" + k + ""), x.format) { + ).replace("#", "") + '" />'), V.borderIndex = w.border.count, w.border.count++, w.border.value += "" + O + ""), x.format) { const C = r[x.format]; - C && (Y.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); + C && (V.formatIndex = C.key, "value" in C && (w.format.count++, w.format.value += C.value)); } - return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (Y.fillIndex > 0 ? ' applyFill="1" ' : "") + (Y.fontIndex >= 0 ? ' applyFont="1" ' : "") + (Y.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; + return w.cell.value = w.cell.value + ' 0 ? ' applyBorder="1" ' : "") + (V.fillIndex > 0 ? ' applyFill="1" ' : "") + (V.fontIndex >= 0 ? ' applyFont="1" ' : "") + (V.formatIndex > 0 ? ' applyNumberFormat="1" ' : "") + se, e.styles[a].index = w.cell.count, w.cell.count++, w; }, { conditionalFormatting: { - count: G ? 1 : 0, + count: q ? 1 : 0, value: ' ' }, commentSyntax: { @@ -826,10 +826,10 @@ async function ct(e, t = "") { } } ); - f == null || f.file("styles.xml", Gt(N, G)); - let oe = '', P = "", B = 0, X = "", K = "", L = {}; + f == null || f.file("styles.xml", Gt(N, q)); + let oe = '', P = "", B = 0, J = "", $ = "", L = {}; const E = {}; - let $ = "", q = 4, U = !1, M = -1, Ce = [], J = 1; + let M = "", Y = 4, W = !1, K = -1, Ce = [], Q = 1; const ye = { checkbox: ` ` @@ -866,12 +866,12 @@ async function ct(e, t = "") { let ae = [], ie = "", ge = !1, de = null; for (let w = 0; w < s; w++) { const a = e.sheet[w], b = w + 1; - let x = {}, Y = { + let x = {}, V = { start: "", end: "" }; const se = a.asTable; - let H = "", k = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", W = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( + let H = "", O = a.shiftTop && a.shiftTop >= 0 ? a.shiftTop + 1 : 1, C = "", G = "", ce = "", Te = "", Ee = "", _e = "", ze = !1, dt = "", pt = "", ht = "", ut = "", xe = Object.assign([], a.merges), ue = Object.assign({}, a.formula), Ue = Object.assign( [], a.conditionalFormatting ), Ie = !1, pe = [], Le = "", He = [], yt = [], We = [], Ge = [], ke = {}, Pe = "", je = !1, Ze = ""; @@ -898,8 +898,8 @@ async function ct(e, t = "") { if (a.pageOption) { const T = a.pageOption; if (T.isPortrait && (je = !0), T.margin) { - const F = T.margin; - let A = { + const S = T.margin; + let F = { left: 0.7, right: 0.7, top: 0.75, @@ -907,36 +907,36 @@ async function ct(e, t = "") { header: 0.3, footer: 0.3 }; - Object.keys(A).forEach((h) => { - typeof F[h] == "number" && (A[h] = F[h]); - }), gt = ''; + Object.keys(F).forEach((h) => { + typeof S[h] == "number" && (F[h] = S[h]); + }), gt = ''; } let i = "", y = "", p = "", c = ""; - if (["header", "footer"].forEach((F) => { - const A = F.charAt(0).toUpperCase() + F.substring(1); - if (T[F]) { - const h = T[F]; - typeof h == "object" && Object.keys(h).forEach((O) => { - i.indexOf(O) < 0 && (i += O); - const le = h[O]; - let V = ""; + if (["header", "footer"].forEach((S) => { + const F = S.charAt(0).toUpperCase() + S.substring(1); + if (T[S]) { + const h = T[S]; + typeof h == "object" && Object.keys(h).forEach((A) => { + i.indexOf(A) < 0 && (i += A); + const le = h[A]; + let z = ""; if (Object.keys(le).reduce((R, I) => (I == "l" ? R.splice(0, 0, I) : I == "c" ? R.splice(1, 0, I) : I == "r" && R.splice(2, 0, I), R), []).forEach((R) => { const I = le[R]; - V += "&" + R.toUpperCase(), I.styleId && z[I.styleId] && (V += z[I.styleId]), I.text && (V += I.text); - }), V = "<" + O + A + ">" + V + "", O == "odd") - y += V; - else if (O == "even") - p += V; - else if (O == "first") - c += V; + z += "&" + R.toUpperCase(), I.styleId && U[I.styleId] && (z += U[I.styleId]), I.text && (z += I.text); + }), z = "<" + A + F + ">" + z + "", A == "odd") + y += z; + else if (A == "even") + p += z; + else if (A == "first") + c += z; else throw "type error"; }); } }), Pe = y + p + c, Pe.length > 0) { je = !0; - const F = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", A = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; - Pe = "" + Pe + ""; + const S = i.length == 7 || i.length == 12 ? ' differentOddEven="1"' : "", F = i.indexOf("first") >= 0 ? ' differentFirst="1"' : ""; + Pe = "" + Pe + ""; } } if (a.viewOption) { @@ -957,7 +957,7 @@ async function ct(e, t = "") { }; } else if (p.type == "C" || p.type == "COLUMN") { let c; - typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = Ke(l, c)), y = { + typeof p.index == "object" ? c = p.index.c : c = p.index, c > l.length - 1 && (l = $e(l, c)), y = { type: "V", startAt: { r: l[c] + 1 @@ -996,10 +996,10 @@ async function ct(e, t = "") { a.checkbox.forEach((i, y) => { let p = T; if (i.link) { - let O = Re(i.link, l); + let A = Re(i.link, l); p = p.replace( "**fmlaLink**", - 'fmlaLink="$' + l[O.col] + "$" + (O.row + 1) + '"' + 'fmlaLink="$' + l[A.col] + "$" + (A.row + 1) + '"' ); } else p = p.replace("**fmlaLink**", ""); @@ -1007,7 +1007,7 @@ async function ct(e, t = "") { let c = w + "" + ve++; const _ = "_x0000_s" + c; pt += we.checkbox.replace("***id***", _).replace("***text***", i.text); - let F = i.startStr, A = i.endStr, h = { + let S = i.startStr, F = i.endStr, h = { start: { col: 0, row: 0 @@ -1026,19 +1026,19 @@ async function ct(e, t = "") { col: i.col, row: i.row } - }), typeof F == "string" && F.length >= 2) { - let O = Re(F, l); + }), typeof S == "string" && S.length >= 2) { + let A = Re(S, l); h.start = { - ...O + ...A }, h.end = { - col: O.col + 1, - row: O.row + 1 + col: A.col + 1, + row: A.row + 1 }; } - if (typeof A == "string" && A.length >= 2) { - let O = Re(A, l); - O.row += 1, O.col += 1, h.end = { - ...O + if (typeof F == "string" && F.length >= 2) { + let A = Re(F, l); + A.row += 1, A.col += 1, h.end = { + ...A }; } ut += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + "0", ht += '', dt += '' + h.start.col + "19050" + h.start.row + "19050" + h.end.col + "819150" + h.end.row + '0' + i.text + ""; @@ -1051,11 +1051,11 @@ async function ct(e, t = "") { Xe = new Promise(async (i, y) => { let p = T.lastIndexOf("."), c; p > 0 ? (c = T.substring(p + 1).toLowerCase(), c.length > 4 && (c.indexOf("gif") >= 0 ? c = "gif" : c.indexOf("jpg") >= 0 ? c = "jpg" : c.indexOf("jpeg") >= 0 ? c = "jpeg" : c = "png")) : c = "png"; - const _ = J++, F = "image" + _ + "." + c, A = await _t(T, F, o, e.fetch); - A || y("image not load"), Ce.push(c), i({ - name: F, + const _ = Q++, S = "image" + _ + "." + c, F = await _t(T, S, o, e.fetch); + F || y("image not load"), Ce.push(c), i({ + name: S, type: c, - image: A, + image: F, ref: _ }); }); @@ -1065,7 +1065,7 @@ async function ct(e, t = "") { ...a.images.map(async (T, i) => { let y = T.url.lastIndexOf("."), p; y > 0 ? (p = T.url.substring(y + 1).toLowerCase(), p.length > 4 && (p.indexOf("gif") >= 0 ? p = "gif" : p.indexOf("jpg") >= 0 ? p = "jpg" : p.indexOf("jpeg") >= 0 ? p = "jpeg" : p = "png")) : p = "png", Ce.push(p); - const c = "image" + J++ + "." + p; + const c = "image" + Q++ + "." + p; return { type: p, image: await _t(T.url, c, o, e.fetch), @@ -1078,68 +1078,68 @@ async function ct(e, t = "") { const T = a.headers.length; let i = ""; if (a.title) { - const c = a.title, _ = c.comment, F = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, A = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + A >= 0 ? c.shiftLeft + A : A, O = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, V = O == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (k + F); + const c = a.title, _ = c.comment, S = c.shiftTop && c.shiftTop >= 0 ? c.shiftTop : 0, F = a.shiftLeft && a.shiftLeft >= 0 ? a.shiftLeft : 0, h = c.shiftLeft && c.shiftLeft + F >= 0 ? c.shiftLeft + F : F, A = c.consommeRow ? c.consommeRow - 1 : 1, le = c.consommeCol ? c.consommeCol : T, z = A == 0 && typeof c.height == "number" ? ' ht="' + c.height + '" customHeight="1" ' : "", R = c.styleId ? c.styleId : "titleStyle", I = l[h] + "" + (O + S); if (xe.push( - I + ":" + l[h + le - 1] + (k + O + F) + I + ":" + l[h + le - 1] + (O + A + S) ), typeof _ < "u") { Ie = !0; - const Q = rt( + const ee = rt( _, N.commentSyntax.value, d ); let fe = pe.length; - if (Q.hasAuthor && typeof Q.author < "u") { - let ee = Q.author.toString(); - const re = pe.indexOf(ee); - re < 0 ? pe.push(ee) : fe = re; + if (ee.hasAuthor && typeof ee.author < "u") { + let Z = ee.author.toString(); + const re = pe.indexOf(Z); + re < 0 ? pe.push(Z) : fe = re; } He.push({ - row: k + F - 1, + row: O + S - 1, col: h }), Le += nt( I, - Q.commentStr, - Q.commentStyle, + ee.commentStr, + ee.commentStyle, fe ); } - typeof c.text == "string" && (x[k + F] = { - startTag: '', + typeof c.text == "string" && (x[O + S] = { + startTag: '', details: '' + B + "", endTag: "" - }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( + }, i += '', i += '' + B + "", i += "", B++, L[c.text] = c.text, c.multiStyleValue && Array.isArray(c.multiStyleValue) ? P += lt( c.multiStyleValue, N.commentSyntax.value, R - ) : P += "" + $e(c.text) + ""), k += F + O + 1; + ) : P += "" + Me(c.text) + ""), O += S + A + 1; } let y = a.headerStyleKey ? a.headerStyleKey : null, p = 0; - if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), Y.start = l[p] + "" + k, Y.end = l[p + a.headers.length - 1] + "" + (k + a.data.length), a.headers.forEach((c, _) => { - if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( + if (typeof a.shiftLeft == "number" && a.shiftLeft >= 0 && (p = a.shiftLeft), se && (H += '', de || (de = f == null ? void 0 : f.folder("tables"))), V.start = l[p] + "" + O, V.end = l[p + a.headers.length - 1] + "" + (O + a.data.length), a.headers.forEach((c, _) => { + if (se && (H += ''), p && (_ += p), c.formula && We.push(_), c.conditionalFormatting && q && Ge.push(_), yt.push(c.label), a.mergeRowDataCondition && typeof a.mergeRowDataCondition == "function" && a.mergeRowDataCondition( c, null, _, !0 ) === !0 && (ke[l[_]] = { inProgress: !0, - start: k + start: O }), a.styleCellCondition && typeof a.styleCellCondition == "function" && (y = a.styleCellCondition( c, c, - k, + O, _, !0, - S - ) || y), c.size && c.size > 0 && (W += ''), a.withoutHeader) + k + ) || y), c.size && c.size > 0 && (G += ''), a.withoutHeader) return; - const F = l[_] + "" + k; + const S = l[_] + "" + O; if (typeof a.commentCondition == "function") { const h = a.commentCondition( c, null, c.label, - k, + O, _, !0 ); @@ -1152,38 +1152,38 @@ async function ct(e, t = "") { N.commentSyntax.value, d ); - let O = pe.length; + let A = pe.length; if (h.hasAuthor && typeof h.author < "u") { let le = h.author.toString(); - const V = pe.indexOf(le); - V < 0 ? pe.push(le) : O = V; + const z = pe.indexOf(le); + z < 0 ? pe.push(le) : A = z; } He.push({ - row: k - 1, + row: O - 1, col: _ }), Le += nt( - F, + S, h.commentStr, h.commentStyle, - O + A ); } - const A = ue && ue[F]; - if (A) { + const F = ue && ue[S]; + if (F) { const h = ot( + S, F, - A, b, e.styles ); - h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[F]; + h.needCalcChain && (ge = !0, ie += h.chainCell), C += h.cell, delete ue[S]; } else { - if (C += '' + B + "", typeof a.multiStyleCondition == "function") { + if (C += '' + B + "", typeof a.multiStyleCondition == "function") { const h = a.multiStyleCondition( c, null, c.label, - k, + O, _, !0 ); @@ -1193,69 +1193,71 @@ async function ct(e, t = "") { c.multiStyleValue, N.commentSyntax.value, y || "" - ) : P += "" + $e(c.text) + "", L[c.text] = c.text, B++; + ) : P += "" + Me(c.text) + "", L[c.text] = c.text, B++; } }), se && (H += ""), a.withoutHeader) C += i; else { - const c = ' _ + " " + F + '="' + a.headerRowOption[F] + '" ', " ") : "") + ">"; - x[k] = { + const c = ' _ + " " + S + '="' + a.headerRowOption[S] + '" ', " ") : "") + ">"; + x[O] = { startTag: c, endTag: "", details: C - }, C = i + c + C + "", k++; + }, C = i + c + C + "", O++; } if (Array.isArray(a.data)) { - const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", F = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", A = a.data.length; - a.data.forEach((h, O) => { + const c = a.mapSheetDataOption && a.mapSheetDataOption.outlineLevel ? a.mapSheetDataOption.outlineLevel : "outlineLevel", _ = a.mapSheetDataOption && a.mapSheetDataOption.hidden ? a.mapSheetDataOption.hidden : "hidden", S = a.mapSheetDataOption && a.mapSheetDataOption.height ? a.mapSheetDataOption.height : "height", F = a.data.length; + a.data.forEach((h, A) => { if (h.mergeType) for (let I = 0; I < h.mergeType.length; I++) { - const Q = h.mergeType[I], fe = h.mergeStart[I], ee = h.mergeValue[w]; + const ee = h.mergeType[I], fe = h.mergeStart[I], Z = h.mergeValue[w]; let re = ""; - Q == "both" ? re = l[fe] + "" + k + ":" + l[fe + ee[1]] + (k + ee[0]) : Q == "col" ? re = l[fe] + "" + k + ":" + l[fe + ee[0]] + k : re = l[fe] + "" + k + ":" + l[fe] + (k + ee[0]), xe.push(re); + ee == "both" ? re = l[fe] + "" + O + ":" + l[fe + Z[1]] + (O + Z[0]) : ee == "col" ? re = l[fe] + "" + O + ":" + l[fe + Z[0]] + O : re = l[fe] + "" + O + ":" + l[fe] + (O + Z[0]), xe.push(re); } - const le = h.rowStyle, V = '"; - }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); + }, O++, C += ""; + }), a.sortAndFilter && (a.sortAndFilter.mode == "all" ? ce += '' : typeof a.sortAndFilter.ref == "string" && a.sortAndFilter.ref.length > 0 && (ce += '')); } if (We.length > 0 && We.forEach((c) => { - const _ = a.shiftLeft ? a.shiftLeft : 0, F = a.headers[c - _], A = l[c]; - ue[A + "" + k] = { - start: a.withoutHeader ? A + "1" : A + "2", - end: A + "" + (k - 1), - type: F.formula.type, - ...F.formula.styleId ? { styleId: F.formula.styleId } : {} + const _ = a.shiftLeft ? a.shiftLeft : 0, S = a.headers[c - _], F = l[c]; + ue[F + "" + O] = { + start: a.withoutHeader ? F + "1" : F + "2", + end: F + "" + (O - 1), + type: S.formula.type, + ...S.formula.styleId ? { styleId: S.formula.styleId } : {} }; - }), Ge.length > 0 && Ge.forEach((c) => { + }), Ge.length > 0 && q && Ge.forEach((c) => { const _ = a.headers[c]; _.conditionalFormatting && Ue.push({ ..._.conditionalFormatting, start: a.withoutHeader ? l[c] + "1" : l[c] + "2", - end: l[c] + "" + (k - 1) + end: l[c] + "" + (O - 1) }); }), ue) { const c = Object.keys(ue).sort( - (_, F) => _ > F ? 1 : -1 + (_, S) => _ > S ? 1 : -1 ); if (c.length) { let _ = {}; - c.forEach((F) => { - const A = ot( - F, - ue[F], + c.forEach((S) => { + const F = ot( + S, + ue[S], b, e.styles ); - A.needCalcChain && (ge = !0, ie += A.chainCell), _[A.row] ? _[A.row] += A.cell : _[A.row] = A.cell; - }), Object.keys(_).forEach((F) => { - const A = F, h = _[A]; - let O = x[A]; - if (O) { - const le = O.startTag + O.details + h + O.endTag; - let V = new RegExp(O.startTag + "[\\n\\s\\S]*?"); - C = C.replace(V, le); + F.needCalcChain && (ge = !0, ie += F.chainCell), _[F.row] ? _[F.row] += F.cell : _[F.row] = F.cell; + }), Object.keys(_).sort((S, F) => +S > +F ? 1 : -1).forEach((S) => { + const F = S, h = _[F]; + let A = x[F]; + if (A) { + const le = A.startTag + A.details + h + A.endTag; + let z = new RegExp( + A.startTag + "[\\n\\s\\S]*?" + ); + C = C.replace(z, le); } else - C += '' + h + "", x[A] = { - startTag: '', + C += '' + h + "", x[F] = { + startTag: '', endTag: "", details: h }; @@ -1370,7 +1374,7 @@ async function ct(e, t = "") { } w > 0 && (oe += ''); const xt = a.name ? a.name : "sheet" + (w + 1), qt = a.state ? a.state : "visible"; - X += '', K += '', $ += "" + ("sheet" + (w + 1)) + "", a.selected && (U = !0, M = w); + J += '', $ += '', M += "" + ("sheet" + (w + 1)) + "", a.selected && (W = !0, K = w); const bt = a.sortAndFilter ? 'filterMode="1"' : ""; let Ct = -1; Xe && await Xe.then((T) => { @@ -1383,11 +1387,9 @@ async function ct(e, t = "") { T.forEach((y, p) => { const c = p + 1; let _ = y.image; - const F = y.name; - let A = y.obj.from, h = y.obj.to, O = y.obj.margin; - y.type; - let le = y.obj.type, V = y.obj.extent; - typeof V > "u" && (V = { + const S = y.name; + let F = y.obj.from, h = y.obj.to, A = y.obj.margin, le = y.obj.type, z = y.obj.extent; + typeof z > "u" && (z = { cx: 2e5, cy: 2e5 }); @@ -1405,8 +1407,8 @@ async function ct(e, t = "") { mB: 0 } }; - if (typeof A == "string" && A.length >= 2) { - let I = Re(A, l); + if (typeof F == "string" && F.length >= 2) { + let I = Re(F, l); R.start = { ...I }, R.end = { @@ -1420,27 +1422,27 @@ async function ct(e, t = "") { ...I }; } - R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, O && ((O.all || O.right) && (R.end.mR = O.all || O.right), (O.all || O.bottom) && (R.end.mB = O.all || O.bottom), (O.all || O.left) && (R.start.mL = O.all || O.left), (O.all || O.top) && (R.start.mT = O.all || O.top)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(F, _), i += ''; + R.end.mR = 0, R.end.mB = 0, R.start.mL = 0, R.start.mT = 0, A && ((A.right || A.all) && (R.end.mR = A.right || A.all), (A.bottom || A.all) && (R.end.mB = A.bottom || A.all), (A.left || A.all) && (R.start.mL = A.left || A.all), (A.top || A.all) && (R.start.mT = A.top || A.all)), le == "one" ? Qe += "" + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + '' : Qe += '' + R.start.col + "" + R.start.mT + "" + R.start.row + "" + R.start.mL + "" + R.end.col + "" + R.end.mB + "" + R.end.row + "" + R.end.mR + '', v == null || v.file(S, _), i += ''; }), vt = ` ` + i + ""; })), xe = [...new Set(xe)]; let wt = "", Ae = 1; - Ue.length > 0 && (wt = Ue.reduce((T, i) => { + Ue.length > 0 && q && (wt = Ue.reduce((T, i) => { if (i.type == "cells") - return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; + return i.operator == "ct" ? T + 'NOT(ISERROR(SEARCH("' + i.value + '",' + i.start + ")))" : typeof i.operator > "u" || typeof n[i.operator] > "u" ? T : T + '' + (Array.isArray(i.value) ? i.value.reduce((y, p) => y + "" + p.value + "", "") : "" + i.value + "") + ""; if (i.type == "top") - return T + '"; + return T + '"; if (i.type == "iconSet") { let y = ""; return typeof i.operator > "u" ? T : (i.operator.indexOf("5") == 0 ? y = '' : i.operator.indexOf("4") == 0 ? y = '' : y = '', T + '' + y + ""); } else return i.type == "colorScale" ? T + '' + (i.operator == "percentile" ? '' : "") + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : i.type == "dataBar" ? T + '' + (i.colors && Array.isArray(i.colors) ? i.colors.reduce((y, p) => y + '', "") : '') + "" : T; }, "")), (ze || Ie || Ne) && D == null && (D = f == null ? void 0 : f.folder("drawings")), Ne && j == null && (j = D == null ? void 0 : D.folder("_rels")), E["sheet" + (w + 1)] = { - indexId: q + 1, + indexId: Y + 1, key: "sheet" + (w + 1), sheetName: xt, sheetDataTableColumns: H, backgroundImageRef: Ct, - sheetDimensions: Y, + sheetDimensions: V, asTable: se || !1, sheetDataString: C, sheetDropDown: ro(a.dropDowns), @@ -1465,20 +1467,20 @@ async function ct(e, t = "") { shapeCommentRowCol: He, splitOption: Te, sheetViewProperties: Ee, - sheetSizeString: W.length > 0 ? "" + W + "" : "", + sheetSizeString: G.length > 0 ? "" + G + "" : "", protectionOption: a.protectionOption ? Object.keys(a.protectionOption).reduce((T, i) => T + " " + i + '="' + a.protectionOption[i] + '" ', "" : "", merges: xe.length > 0 ? xe.reduce((T, i) => T + ' ', '') + " " : "", selectedView: !!a.selected, sheetSortFilter: ce, tabColor: a.tabColor ? '' : "' - }, q++; + }, Y++; } - ge && (q++, K += '', f == null || f.file( + ge && (Y++, $ += '', f == null || f.file( "calcChain.xml", ` ` + ie + "" )); - let Mt = Object.keys(E), qe = m.folder("_rels"); + let Kt = Object.keys(E), qe = m.folder("_rels"); qe == null || qe.file( ".rels", ` @@ -1489,10 +1491,10 @@ async function ct(e, t = "") { "core.xml", ` ` + (e.creator ? "" + e.creator + "" : "") + (e.created ? '' + e.created + "" : "") + (e.modified ? '' + e.modified + "" : "") + "" - ), Oe == null || Oe.file("app.xml", Xt(s, $)), f == null || f.file( + ), Oe == null || Oe.file("app.xml", Xt(s, M)), f == null || f.file( "workbook.xml", ` - ` + (U ? '' : "") + " " + X + " " + ` + (W ? '' : "") + " " + J + " " ), f == null || f.file( "sharedStrings.xml", ` @@ -1502,7 +1504,7 @@ async function ct(e, t = "") { Ye == null || Ye.file( "workbook.xml.rels", ` - ` + K + " " + ` + $ + " " ); let Ve = f == null ? void 0 : f.folder("theme"); Ve == null || Ve.file( @@ -1511,9 +1513,9 @@ async function ct(e, t = "") { ` ); let Fe = f == null ? void 0 : f.folder("worksheets"), ft = [], mt = [], De = []; - if (Mt.forEach((w, a) => { + if (Kt.forEach((w, a) => { const b = E[w]; - let x = "", Y = { + let x = "", V = { form: !1, drawing: !1, vmlDrwing: !1, @@ -1524,18 +1526,18 @@ async function ct(e, t = "") { const se = b.sheetDataTableColumns; if (se.length > 0) { mt.push("table" + (a + 1) + ".xml"); - const C = b.asTable, W = b.sheetDimensions; + const C = b.asTable, G = b.sheetDimensions; de == null || de.file( "table" + (a + 1) + ".xml", ` -' + se + '
' +' + se + '
' ), x += ''; } const H = "drawing" + (De.length + 1) + ".xml"; - if (b.hasImages && (De.push(H), Y.sheetDrawingsPushed = !0, j == null || j.file( + if (b.hasImages && (De.push(H), V.sheetDrawingsPushed = !0, j == null || j.file( H + ".rels", b.drawersRels.toString() - ), Y.drawing = !0, x += ''), b.hasCheckbox && (Y.sheetDrawingsPushed || De.push(H), x += '' + (Y.drawing ? "" : ''), Y.drawing = !0, Y.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( + ), V.drawing = !0, x += ''), b.hasCheckbox && (V.sheetDrawingsPushed || De.push(H), x += '' + (V.drawing ? "" : ''), V.drawing = !0, V.vmlDrwing = !0, x += b.formRel), (b.hasCheckbox || b.hasImages) && (D == null || D.file( H, ` ` + (b.hasImages ? b.drawersContent : "") + (b.hasCheckbox ? b.checkboxDrawingContent : "") + "" @@ -1546,14 +1548,14 @@ async function ct(e, t = "") { "comments" + (a + 1) + ".xml", ` ` + (Array.isArray(C) && C.length > 0 ? C.reduce( - (W, ce) => W + "" + ce + "", + (G, ce) => G + "" + ce + "", "" ) : "") + "" + b.commentString + "" - ), x += '' + (Y.vmlDrwing ? "" : ''); + ), x += '' + (V.vmlDrwing ? "" : ''); } if ((b.hasComment || b.hasCheckbox) && (D == null || D.file( "vmlDrawing" + (a + 1) + ".vml", - '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, W) => C + `", "") : "") + "" + '' + (b.hasCheckbox ? Se.checkbox + b.checkboxShape : "") + (b.hasComment ? ' ' + b.shapeCommentRowCol.reduce((C, G) => C + `", "") : "") + "" )), b.backgroundImageRef > 0 && (x += ''), b.hasImages || b.hasComment || b.hasCheckbox || se.length > 0 || b.backgroundImageRef > 0) { const C = Fe == null ? void 0 : Fe.folder("_rels"); C == null || C.file( @@ -1562,11 +1564,11 @@ async function ct(e, t = "") { ` + x + "" ); } - let k = ""; - b.selectedView || b.splitOption ? k = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : k = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( + let O = ""; + b.selectedView || b.splitOption ? O = ' 0 ? ' view="' + b.viewType + '"' : "") + ' workbookViewId="0">' + b.splitOption + (b.selectedView ? '' : "") + "" : O = ' 0 ? ' view="' + b.viewType + '"' : "") + "/>", Fe == null || Fe.file( b.key + ".xml", ` -` + b.tabColor + k + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" +` + b.tabColor + O + '' + b.sheetSizeString + "" + b.sheetDataString + "" + b.sheetDropDown + b.protectionOption + b.sheetSortFilter + b.merges + b.cFDataString + (b.hasImages || b.hasCheckbox ? '' : "") + (b.hasComment || b.hasCheckbox ? '' : "") + (b.hasCheckbox ? '' + b.checkboxSheetContent + "" : "") + b.sheetMargin + (b.isPortrait || b.sheetBreakLine.length > 0 ? '' : "") + b.sheetBreakLine + b.sheetHeaderFooter + (b.backgroundImageRef > 0 ? '' : "") + (se.length > 0 ? ' ' : "") + "" ); }), ae.length > 0) { let w = f == null ? void 0 : f.folder("ctrlProps"); @@ -1613,9 +1615,9 @@ function no(e) { let D = {}; for (let j = 0; j < v; j++) { r++; - const S = f[j]; + const k = f[j]; let d; - S.sheetName ? d = S.sheetName : d = "Sheet 1", d in o || (o[d] = { + k.sheetName ? d = k.sheetName : d = "Sheet 1", d in o || (o[d] = { headers: [], data: [], labelCounter: 0, @@ -1624,41 +1626,41 @@ function no(e) { index: s, value: 0 }), d in l || (o[d].labelCounter = 0, l[d] = !0); - let G = []; - const z = o[d].headers.length; - let Z = {}, N = o[d].seenAt == s, oe = S.headers.reduce((K, L, E) => (o[d].labelCounter++, z < o[d].labelCounter && G.push({ + let q = []; + const U = o[d].headers.length; + let X = {}, N = o[d].seenAt == s, oe = k.headers.reduce(($, L, E) => (o[d].labelCounter++, U < o[d].labelCounter && q.push({ label: "c" + o[d].labelCounter, text: N ? L.text : "" - }), Z["c" + o[d].labelCounter] = L.text, { - ...K, + }), X["c" + o[d].labelCounter] = L.text, { + ...$, [L.label]: "c" + o[d].labelCounter }), {}); - if (o[d].headers.push(...G), S.spaceX) - for (let K = 0; K < S.spaceX; K++) - o[d].labelCounter++, z <= o[d].labelCounter && o[d].headers.push({ + if (o[d].headers.push(...q), k.spaceX) + for (let $ = 0; $ < k.spaceX; $++) + o[d].labelCounter++, U <= o[d].labelCounter && o[d].headers.push({ label: "c" + o[d].labelCounter, text: "" }); n[d].index + 1 == s && (D[d] = n[d].value); let P = D[d] || 0; - P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(Z) : o[d].data[P] = { + P > 0 && (!o[d].headerIndex || o[d].headerIndex && o[d].headerIndex != P ? o[d].data.push(X) : o[d].data[P] = { ...o[d].data[P], - ...Z + ...X }, o[d].headerIndex = P, P++); - let B = Object.keys(oe), X = S.data.length >= o[d].data.length; - if (o[d].data = S.data.reduce((K, L, E) => { - let $ = {}; - return K.length > E + P ? $ = K[E + P] : K.push($), B.forEach((q) => { - let U = oe[q]; - $[U] = L[q] ? L[q] : ""; - }), $.tableIndex = r, $.tableStringIndex = E + "," + j, K[E + P] = $, K; - }, o[d].data), X && S.spaceY) { - const K = o[d].headers.length; - for (let L = 0; L < S.spaceY; L++) { + let B = Object.keys(oe), J = k.data.length >= o[d].data.length; + if (o[d].data = k.data.reduce(($, L, E) => { + let M = {}; + return $.length > E + P ? M = $[E + P] : $.push(M), B.forEach((Y) => { + let W = oe[Y]; + M[W] = L[Y] ? L[Y] : ""; + }), M.tableIndex = r, M.tableStringIndex = E + "," + j, $[E + P] = M, $; + }, o[d].data), J && k.spaceY) { + const $ = o[d].headers.length; + for (let L = 0; L < k.spaceY; L++) { let E = {}; - for (let $ = 0; $ < K; $++) { - const q = o[d].headers[$]; - E[q.label] = ""; + for (let M = 0; M < $; M++) { + const Y = o[d].headers[M]; + E[Y.label] = ""; } o[d].data.push(E); } @@ -2130,16 +2132,16 @@ function Bt(e, t = !0, r = !0) { l.underline && l.doubleUnderline, g.forEach((u) => { let m = l[u]; const s = lo[u]; - if (Me(m, s, u, t, r)) + if (Ke(m, s, u, t, r)) return !0; }); }); } -function $t(e, t = !0, r = !0) { +function Mt(e, t = !0, r = !0) { Array.isArray(e) || (e = [e]), e.forEach((o) => { Object.keys(o).forEach((l) => { const g = o[l], u = io[l]; - Me(g, u, l, t, r); + Ke(g, u, l, t, r); }); }); } @@ -2147,16 +2149,16 @@ function so(e, t = !0, r = !0) { Object.keys(e).forEach((n) => { let l = e[n]; const g = ao[n]; - if (Me(l, g, n, t, r)) + if (Ke(l, g, n, t, r)) if (n == "sheet") if (Array.isArray(l)) - $t(l); + Mt(l); else throw "Sheet must be Array."; else n == "styles" && Bt(l); }); } -function Me(e, t, r, o, n) { +function Ke(e, t, r, o, n) { if (t) { if (typeof e != t.type) { if (t.type == "object" || t.type == "string" || o) @@ -2180,12 +2182,12 @@ function Me(e, t, r, o, n) { const co = { checkSheetValidWithOneRef: st, checkSheetValidWithTwoRef: it, - generalValidationCheck: Me + generalValidationCheck: Ke }, ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, exportedForTesting: co, validateExcelTableObjectFunction: so, - validateSheetArrayFunction: $t, + validateSheetArrayFunction: Mt, validateStyleObjectFunction: Bt }, Symbol.toStringTag, { value: "Module" })); function It(e) { @@ -2202,23 +2204,23 @@ function Pt(e, t) { return e.substring(0, e.length - t) + ` `; } -async function Kt(e, t = !1, r = !1) { +async function $t(e, t = !1, r = !1) { const o = fo(r), n = r ? ".txt" : ".csv", l = o.length; let g = []; if (e.sheet.forEach((m) => { let s = "", f = ""; const v = m.headers; let D = [], j = v.length; - for (let S = 0; S < j; S++) { - const d = v[S]; + for (let k = 0; k < j; k++) { + const d = v[k]; D.push(d.label), m.withoutHeader || (f += It(d.text) + o); } s += Pt(f, l), j = m.data.length; - for (let S = 0; S < j; S++) { + for (let k = 0; k < j; k++) { f = ""; - const d = m.data[S]; - D.forEach((G) => { - f += It(d[G]) + o; + const d = m.data[k]; + D.forEach((q) => { + f += It(d[q]) + o; }), s += Pt(f, l); } g.push(s); @@ -2308,91 +2310,91 @@ async function mo(e, t, r, o, n = !0, l = !1, g = " ", u = !0, m = { }, j = { background: "#EEEDEB" }) { - let S = await import("./read-utils-YAGe6NNW.js").then( + let k = await import("./read-utils-CU7cU67B.js").then( async (E) => await E.extractExcelData(e, !1, o) ), d = null; if (t ? d = document.querySelector(t) : r && (d = r), d == null && !l) throw "Container Node not found"; - const G = Object.keys(m), z = Object.keys(s), Z = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); + const q = Object.keys(m), U = Object.keys(s), X = Object.keys(f), N = Object.keys(v), oe = Object.keys(D), P = Object.keys(j); let B = document.createElement("div"); N.forEach((E) => { B.style[E] = v[E]; - }), l || (u && d != null && (d.innerText = ""), G.forEach((E) => { + }), l || (u && d != null && (d.innerText = ""), q.forEach((E) => { d.style[E] = m[E]; }), d.appendChild(B)); - let X = [], K = !1, L = 0; + let J = [], $ = !1, L = 0; do { L++; - const E = S.sheetName.next(); + const E = k.sheetName.next(); if (!E.value) break; - const $ = document.createElement("div"); - if ($.style.display = "none", !l) { - const J = document.createElement("button"); + const M = document.createElement("div"); + if (M.style.display = "none", !l) { + const Q = document.createElement("button"); oe.forEach((ye) => { - J.style[ye] = D[ye]; - }), J.addEventListener("click", (ye) => { - const ve = J.getAttribute("data-sheet"), we = d.querySelector( + Q.style[ye] = D[ye]; + }), Q.addEventListener("click", (ye) => { + const ve = Q.getAttribute("data-sheet"), we = d.querySelector( 'div[data-sheet="' + ve + '"]' ); if (we) { P.forEach((ie) => { - J.style[ie] = j[ie]; + Q.style[ie] = j[ie]; }); const Se = d.querySelector( "[data-sheet-button-activate]" ); let ae = d.querySelector("[data-sheet-activate]"); - we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", J.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { + we.setAttribute("data-sheet-activate", "1"), we.style.display = "flex", Q.setAttribute("data-sheet-button-activate", "1"), Se && (oe.forEach((ie) => { Se.style[ie] = D[ie]; }), Se.removeAttribute("data-sheet-button-activate")), ae && (ae.style.display = "none", ae.removeAttribute("data-sheet-activate")); } else console.error("Sheet content not found!! id is " + ve); - }), J.setAttribute("data-sheet", L + ""), $.setAttribute("data-sheet", L + ""), J.innerText = E.value[1] || E.value[0], B.appendChild(J), d.appendChild($); + }), Q.setAttribute("data-sheet", L + ""), M.setAttribute("data-sheet", L + ""), Q.innerText = E.value[1] || E.value[0], B.appendChild(Q), d.appendChild(M); } - let q = n ? "th" : "td"; - const U = document.createElement("table"); - z.forEach((J) => { - U.style[J] = s[J]; + let Y = n ? "th" : "td"; + const W = document.createElement("table"); + U.forEach((Q) => { + W.style[Q] = s[Q]; }); - const M = S.data[E.value[0]] || S.data[E.value[1]], Ce = S.maxLengthOfColumn[E.value[0]] || S.maxLengthOfColumn[E.value[1]]; - if (Array.isArray(M)) { - const J = M.length; - for (let ye = 0; ye < J; ye++) { - const ve = M[ye], we = document.createElement("tr"), Se = Array.isArray(ve); + const K = k.data[E.value[0]] || k.data[E.value[1]], Ce = k.maxLengthOfColumn[E.value[0]] || k.maxLengthOfColumn[E.value[1]]; + if (Array.isArray(K)) { + const Q = K.length; + for (let ye = 0; ye < Q; ye++) { + const ve = K[ye], we = document.createElement("tr"), Se = Array.isArray(ve); for (let ae = 0; ae <= Ce; ae++) { let ie = g; if (Se) { const de = ve[ae]; typeof de == "string" && (ie = de); } - const ge = document.createElement(q); - Z.forEach((de) => { + const ge = document.createElement(Y); + X.forEach((de) => { ge.style[de] = f[de]; }), ge.innerText = ie, we.appendChild(ge); } - U.appendChild(we), q = "td"; + W.appendChild(we), Y = "td"; } } - l ? X.push(U) : ($.appendChild(U), d == null || d.appendChild($)), K = E.done; - } while (!K); + l ? J.push(W) : (M.appendChild(W), d == null || d.appendChild(M)), $ = E.done; + } while (!$); if (l) - return X; + return J; { const E = d.querySelector( 'div[data-sheet="1"]' ); E && (E.style.display = "flex", E.setAttribute("data-sheet-activate", "1")); - const $ = d.querySelector( + const M = d.querySelector( 'button[data-sheet="1"]' ); - return $ && (P.forEach((q) => { - $.style[q] = j[q]; - }), $.setAttribute("data-sheet-button-activate", "1")), "Done"; + return M && (P.forEach((Y) => { + M.style[Y] = j[Y]; + }), M.setAttribute("data-sheet-button-activate", "1")), "Done"; } } async function uo(e, t, r = !0, o = "property") { - let n = await import("./read-utils-YAGe6NNW.js").then( + let n = await import("./read-utils-CU7cU67B.js").then( async (u) => await u.extractExcelData(e, !1, t) ), l = {}, g = []; return Object.keys(n.sheetNameObject).forEach((u) => { @@ -2401,10 +2403,10 @@ async function uo(e, t, r = !0, o = "property") { g[j] = o + (j + 1); let v = r, D = []; s.forEach((j) => { - let S = {}; - j.forEach((d, G) => { - typeof d == "string" && (v ? g[G] = d : S[g[G]] = d); - }), v = !1, D.push(S); + let k = {}; + j.forEach((d, q) => { + typeof d == "string" && (v ? g[q] = d : k[g[q]] = d); + }), v = !1, D.push(k); }), l = Object.assign(l, { [m]: D }); @@ -2429,15 +2431,15 @@ function Co(e, t) { return ct(zt(e, t)); } function vo(e, t = !1, r) { - return import("./read-utils-YAGe6NNW.js").then( + return import("./read-utils-CU7cU67B.js").then( (o) => o.extractExcelData(e, t, r) ); } function wo(e, t = !1) { - return Kt(e, t, !1); + return $t(e, t, !1); } function To(e, t = !1) { - return Kt(e, t, !0); + return $t(e, t, !0); } function Eo(e, t, r, o = { ...jt }) { return o = { diff --git a/dist/index-BYjrfbvd.js b/dist/index-D3jbCDy2.js similarity index 64% rename from dist/index-BYjrfbvd.js rename to dist/index-D3jbCDy2.js index 0d288d4..b9cc395 100644 --- a/dist/index-BYjrfbvd.js +++ b/dist/index-D3jbCDy2.js @@ -1,9 +1,9 @@ -define(["require","exports"],function(ge,ae){"use strict";function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function qt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=qt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function fe(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function pe(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=fe(e);e=r||""}return e.replace(/^#/,"")}function zt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:zt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Ut=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let i=0;i0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mge(["./jszip.min-CGrYsaMq"],m,i)).then(m=>m.jszip_min)).default;let g;if(typeof e=="string"&&e.length){let m,i=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,i=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return i?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let i=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let R=j;Object.keys(t).forEach(S=>{var d;R=R.replace(new RegExp("{{"+S+"}}","g"),(d=t[S])==null?void 0:d.toString())}),o[v]=R})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await new Promise((f,v)=>ge(["./FileSaver.min-DbxQUYqv"],f,v)).then(f=>f.FileSaver_min)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Gt(e,t,r,o,n,l,g,u){let m=[],i="both",f=[];!t||t===0?(t=1,i="col"):f.push(t-1),!e||e===0?(e=0,i="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,i]:[i],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let j=0;j=1?(v["c"+S]=l,l="",g+="*",R--):t>=2&&r==S?(v["c"+S]=l,l="",g+="+"):g+="-":j>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Zt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},i=40;if(l){let j=!1,R=0;l.forEach((S,d)=>{var G=[].slice.call(S.children);const z=window.getComputedStyle(S,null);let Z=fe(z.backgroundColor);if(!j)R=G.length,j=!0,typeof o=="function"?i=o(Number(z.height.substring(0,z.height.length-2)),d,!0):i=Number(z.height.substring(0,z.height.length-2)),G.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const U=fe(P.borderBottomColor);U&&(B||(B={}),B.bottom={style:"thin",color:U})}if(P.borderTopWidth!=="0px"){const U=fe(P.borderTopColor);U&&(B||(B={}),B.top={style:"thin",color:U})}if(P.borderLeftWidth!=="0px"){const U=fe(P.borderLeftColor);U&&(B||(B={}),B.left={style:"thin",color:U})}if(P.borderRightWidth!=="0px"){const U=fe(P.borderRightColor);U&&(B||(B={}),B.right={style:"thin",color:U})}let J=fe(P.backgroundColor);!J&&Z&&(J=Z);const K=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...J?{backgroundColor:J}:{},bold:parseInt(P.fontWeight)>500,...isNaN(K)?{}:{size:K},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let T;typeof n=="function"?T=n(Number(P.width.substring(0,P.width.length-2)),oe):T=Number(P.width.substring(0,P.width.length-2))*.15;const $=N.getAttribute("colspan"),Y=N.getAttribute("rowspan");g.push({label:"c"+oe,...$?{colspan:$}:{},...Y?{rowspan:Y}:{},text:N.textContent,...isNaN(T)||T<=0?{}:{size:T}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;G.forEach((J,K)=>{if("c"+(K+B)in N)for(let M=0;M<=R+1&&"c"+(K+M)in N;M++)B++;K+=B;let L=window.getComputedStyle(J,null);if(J.getAttribute("colspan")||J.getAttribute("rowspan")){let M=Gt(J.getAttribute("colspan")*1,J.getAttribute("rowspan")*1,K,R,N,J.textContent,oe,N);u.length{u.length500,...isNaN(Y)?{}:{size:Y},...T?{border:T}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+K]=U,N["c"+K]=J.textContent}),typeof o=="function"?N.height=o(Number(z.height.substring(0,z.height.length-2)),d,!1):N.height=z.height.substring(0,z.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length +define(["require","exports"],function(ge,ae){"use strict";function dt(e){return e.replace(/ /g,"")}function pt(e){if(e=e.replace(/^#/,""),e.length==3){const t=e.charAt(0),r=e.charAt(1),o=e.charAt(2);return t+t+r+r+o+o}else return e}function qt(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]}function ht(e){const t=qt(e);return t==null?void 0:(.299*t[0]+.587*t[1]+.114*t[2])/255>.5?"rgb(0,0,0)":"rgb(255,255,255)"}function ut(e){/^#?([a-f\d]{3})$/i.test(e)&&(e=pt(e));var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?"rgb("+(255-parseInt(t[1],16))+","+(255-parseInt(t[2],16))+","+(255-parseInt(t[3],16))+")":"rgb(0,0,0)"}function ze(e){e=Number(e);var t=e.toString(16);return t.length==1?"0"+t:t}function fe(e){e=dt(e);let t=e.indexOf("rgba")>=0?e.substring(5,e.length-1).split(","):e.substring(4,e.length-1).split(","),r=t.reduce((o,n)=>o&&!Number.isNaN(Number(n)),!0);return t.length==4&&t[3]=="0"||t.length!=3&&t.length!=4||!r?null:(ze(t[0])+ze(t[1])+ze(t[2])).toUpperCase()}function pe(e,t){if(typeof e>"u"||e===null)return null;if(!t){let r=dt(e);r.indexOf("var(")==0&&r.lastIndexOf(")")==r.length-1&&(r=r.substring(4,r.length-1),e=getComputedStyle(document.documentElement).getPropertyValue(r))}if(e.indexOf("rgb")>=0){const r=fe(e);e=r||""}return e.replace(/^#/,"")}function zt(e){let t="";return e.indexOf("_")>0?e.replace(/[a-z]/g,"").length==e.length?t=e.split(/_/).reduce((r,o)=>r+o.charAt(0)+o.substring(1).toLowerCase()+" ","").trim():t=e.replace(/_/g," ").trim():(t=e.replace(/([A-Z])/g," $1").trim(),t=t.charAt(0).toUpperCase()+t.substring(1).trim()),t}function yt(e,t){let r=Object.keys(e).filter(l=>!t.includes(l)),o=[];return r.reduce((l,g)=>(l.push({label:g,text:zt(g)}),l),o)}const Ue={fileName:"MR-Excel",headerBackgroundColor:"#393E46",headerColor:"#EEEEEE",negativeColor:!1,rowBackgroundColor:"#EEEEEE",rowColor:"#393E46",filterKeys:[]},Ut=function(e,t={...Ue}){let r;if(typeof e=="object"&&Array.isArray(e))if(e.length>0)if(Array.isArray(e[0])){let m=[];for(let i=0;i0){const v=yt(f[0],Array.isArray(t.filterKeys)?t.filterKeys:[]);m.push({headers:v,data:f})}}r={sheet:m}}else e.length>0?r={sheet:[{headers:yt(e[0],Array.isArray(t.filterKeys)?t.filterKeys:[]),data:e}]}:r={sheet:[]};else r={sheet:[]};else r=e;let o=t&&t.headerBackgroundColor?t.headerBackgroundColor:Ue.headerBackgroundColor,n=t&&t.rowBackgroundColor?t.rowBackgroundColor:Ue.rowBackgroundColor,l=t&&t.negativeColor?ut(o):t&&t.headerColor?t.headerColor:ht(o),g=t&&t.negativeColor?ut(n):t&&t.rowColor?t.rowColor:ht(n);typeof r.styles>"u"&&(r.styles={}),r.styles.themeStyleHeader={backgroundColor:o,color:l},r.styles.themeStyleBody={backgroundColor:n,color:g};const u=r.sheet.length;for(let m=0;mge(["./jszip.min-CGrYsaMq"],m,i)).then(m=>m.jszip_min)).default;let g;if(typeof e=="string"&&e.length){let m,i=!1;typeof(r==null?void 0:r.fetch)=="function"?(m=r==null?void 0:r.fetch,i=!0):m=fetch,g=await m(e).then(f=>{if(f==null||f==null)throw"response is null";return i?f:r!=null&&r.backend?f.arrayBuffer():f.blob()})}else g=r==null?void 0:r.data;let u=await l.loadAsync(g).then(async function(m){let i=Object.keys(m.files).filter(f=>f.indexOf("xl/worksheets/")==0&&f.length-4==f.lastIndexOf(".xml")||f=="xl/sharedStrings.xml");for(let f=0;f{let R=j;Object.keys(t).forEach(k=>{var d;R=R.replace(new RegExp("{{"+k+"}}","g"),(d=t[k])==null?void 0:d.toString())}),o[v]=R})}return m});if(Object.keys(o).forEach(m=>{u.file(m,o[m])}),r!=null&&r.backend)return u.generateAsync({type:r.generateType?r.generateType:"nodebuffer"}).then(m=>m);if(r!=null&&r.notSave)return u.generateAsync({type:"blob"}).then(m=>m.slice(0,m.size,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));{let m=await u.generateAsync({type:"blob"});(await new Promise((f,v)=>ge(["./FileSaver.min-DbxQUYqv"],f,v)).then(f=>f.FileSaver_min)).saveAs(m,(r!=null&&r.fileName?r==null?void 0:r.fileName:"tableRecord")+".xlsx")}}function Gt(e,t,r,o,n,l,g,u){let m=[],i="both",f=[];!t||t===0?(t=1,i="col"):f.push(t-1),!e||e===0?(e=0,i="row"):f.push(e-1);let v=n||{};v.mergeType=u&&u.mergeType?[...u.mergeType,i]:[i],v.mergeValue=u&&u.mergeValue?[...u.mergeValue,f]:[f],v.mergeStart=u&&u.mergeStart?[...u.mergeStart,r]:[r];for(let j=0;j=1?(v["c"+k]=l,l="",g+="*",R--):t>=2&&r==k?(v["c"+k]=l,l="",g+="+"):g+="-":j>0&&(g+="-");m.push({...v,mergeString:g}),v={},g=""}return m}function Zt(e,t,r,o,n){var v;if(!e&&!t)throw"Error: One of the function inputs is required.";let l;e?l=(v=document.querySelector(e))==null?void 0:v.querySelectorAll("tr"):l=t==null?void 0:t.querySelectorAll("tr");let g=[],u=[],m={header:{},rows:[]},i=40;if(l){let j=!1,R=0;l.forEach((k,d)=>{var Y=[].slice.call(k.children);const U=window.getComputedStyle(k,null);let J=fe(U.backgroundColor);if(!j)R=Y.length,j=!0,typeof o=="function"?i=o(Number(U.height.substring(0,U.height.length-2)),d,!0):i=Number(U.height.substring(0,U.height.length-2)),Y.forEach((N,oe)=>{let P=window.getComputedStyle(N,null),B=null;if(P.borderBottomWidth!=="0px"){const W=fe(P.borderBottomColor);W&&(B||(B={}),B.bottom={style:"thin",color:W})}if(P.borderTopWidth!=="0px"){const W=fe(P.borderTopColor);W&&(B||(B={}),B.top={style:"thin",color:W})}if(P.borderLeftWidth!=="0px"){const W=fe(P.borderLeftColor);W&&(B||(B={}),B.left={style:"thin",color:W})}if(P.borderRightWidth!=="0px"){const W=fe(P.borderRightColor);W&&(B||(B={}),B.right={style:"thin",color:W})}let X=fe(P.backgroundColor);!X&&J&&(X=J);const $=parseInt(P.fontSize.substring(0,P.fontSize.indexOf("p")));let L={...X?{backgroundColor:X}:{},bold:parseInt(P.fontWeight)>500,...isNaN($)?{}:{size:$},...B?{border:B}:{},alignment:{...typeof P.textAlign=="string"&&P.textAlign.length>0?{horizontal:P.textAlign}:{},vertical:"center",...P.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+oe]=L;let T;typeof n=="function"?T=n(Number(P.width.substring(0,P.width.length-2)),oe):T=Number(P.width.substring(0,P.width.length-2))*.15;const M=N.getAttribute("colspan"),V=N.getAttribute("rowspan");g.push({label:"c"+oe,...M?{colspan:M}:{},...V?{rowspan:V}:{},text:N.textContent,...isNaN(T)||T<=0?{}:{size:T}})});else{let N={},oe="",P=!1;u.length>=d&&(N=u[d-1],oe="mergeString"in N?N.mergeString:"",P=!0);let B=0;Y.forEach((X,$)=>{if("c"+($+B)in N)for(let K=0;K<=R+1&&"c"+($+K)in N;K++)B++;$+=B;let L=window.getComputedStyle(X,null);if(X.getAttribute("colspan")||X.getAttribute("rowspan")){let K=Gt(X.getAttribute("colspan")*1,X.getAttribute("rowspan")*1,$,R,N,X.textContent,oe,N);u.length{u.length500,...isNaN(V)?{}:{size:V},...T?{border:T}:{},alignment:{...typeof L.textAlign=="string"&&L.textAlign.length>0?{horizontal:L.textAlign}:{},vertical:"center",...L.direction=="rtl"?{rtl:!0}:{ltr:!0}}};m.header[d+"-"+$]=W,N["c"+$]=X.textContent}),typeof o=="function"?N.height=o(Number(U.height.substring(0,U.height.length-2)),d,!1):N.height=U.height.substring(0,U.height.length-2),typeof N.height=="string"&&N.height.length==0&&delete N.height,u.length `+(e.format.count>0?''+e.format.value+"":"")+''+e.font.value+''+e.fill.value+''+e.border.value+''+e.cell.value+' '+(t?''+e.conditionalFormatting.value+"":'')+""}function Xt(e,t,r,o,n,l,g){let u={};return` `+r.reduce((m,i)=>(i=i.toLowerCase(),u[i]?m:i=="svg"?(u.png=!0,u.svg=!0,m+''):i=="jpeg"||i=="jpg"?(u.jpeg=!0,u.jpg=!0,m+''):(u[i]=!0,m+'')),"")+t.reduce((m,i)=>m+'',"")+e+(g.length>0?g.reduce((m,i)=>m+'',""):"")+''+(l?'':"")+''+o.reduce((m,i)=>m+'',"")+(n.length>0?n.reduce((m,i,f)=>m+'',""):"")+''}function Qt(e,t){return` -Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let i=t,f=i.formula.indexOf("=")==0?i.formula.substring(1):i.formula,v=e.indexOf(":")>0,j=i.referenceCells?i.referenceCells:e,R=v?e.substring(0,e.indexOf(":")):e,S=R.replace(/[0-9]/g,""),d=parseInt(e.substr(S.length)),G=i.returnType?i.returnType:i.isArray||v?' t="str"':"",z="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"",Z=i.isArray||v?' t="array" ref="'+j+'"':"";return n='"+f+"",{column:S,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const i=t;if(i.noArgType=="NOW"||i.noArgType=="TODAY"){const f="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType+"()"}else{let f="NOW()";const v="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const i=t;let f="";typeof i.value<"u"&&(f=","+i.value);let v="";i.type=="COT"&&(v="_xlfn.");const j="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+v+i.type+"("+i.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const i=t;n='"+i.type+"("+i.start.toUpperCase()+":"+i.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` +Microsoft Excel0falseWorksheets`+e+' '+t+"falsefalsefalse16.0300"}function We(e,t,r,o){e=e.toUpperCase();let n="";if(t.formula){let i=t,f=i.formula.indexOf("=")==0?i.formula.substring(1):i.formula,v=e.indexOf(":")>0,j=i.referenceCells?i.referenceCells:e,R=v?e.substring(0,e.indexOf(":")):e,k=R.replace(/[0-9]/g,""),d=parseInt(e.substr(k.length)),Y=i.returnType?i.returnType:i.isArray||v?' t="str"':"",U="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"",J=i.isArray||v?' t="array" ref="'+j+'"':"";return n='"+f+"",{column:k,row:d,needCalcChain:!1,isCustom:!0,cell:n}}let l=e.replace(/[0-9]/g,""),g=parseInt(e.substr(l.length)),u=!1,m="";if(t.noArgType){const i=t;if(i.noArgType=="NOW"||i.noArgType=="TODAY"){const f="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType+"()"}else{let f="NOW()";const v="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+i.noArgType.substring(4)+"("+f+")"}m='',u=!0}else if(t.referenceCell){const i=t;let f="";typeof i.value<"u"&&(f=","+i.value);let v="";i.type=="COT"&&(v="_xlfn.");const j="styleId"in i&&o&&typeof i.styleId=="string"&&o[i.styleId]?' s="'+o[i.styleId].index+'"':"";n='"+v+i.type+"("+i.referenceCell.toUpperCase()+f+")",m='',u=!0}else{const i=t;n='"+i.type+"("+i.start.toUpperCase()+":"+i.end.toUpperCase()+")"}return{column:l,row:g,cell:n,needCalcChain:u,chainCell:m}}function Ge(e,t,r){let o=!1,n,l;if(typeof e=="object"){if("author"in e&&e.author&&(o=!0,l=e.author),"styleId"in e&&typeof e.styleId=="string"){let g=t[e.styleId];typeof g=="string"&&(r=g)}n="comment"in e&&typeof e.comment=="string"?gt(e.comment):[""]}else n=e?gt(e):[""];return o&&n.unshift(l+":"),{hasAuthor:o,author:l,commentStyle:r,commentStr:n}}function gt(e){var t=e.split(/\r?\n|\r|\n/g);return t}function Ze(e,t,r,o){let n='',l="";return t.forEach((g,u)=>{let m="";if(g.length==0){l+=` `;return}u>0&&(m=' xml:space="preserve"',l+=` -`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Je(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={time:{key:165,value:''},date:{key:187,value:''},short_date:{key:14},fraction:{key:13},percentage:{key:9},float_1:{key:180,value:''},float_2:{key:181,value:''},float_3:{key:164,value:''},float_4:{key:182,value:''},dollar_rounded:{key:183,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},dollar:{key:163,value:''},$:{key:163,value:''},pound:{key:162,value:''},"£":{key:162,value:''},euro:{key:161,value:''},"€":{key:161,value:''},yen:{key:160,value:''},"¥":{key:160,value:''},CHF:{key:179,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},"֏":{key:177,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"₼1":{key:175,value:''},"₽1":{key:174,value:''},"₽2":{key:173,value:''},"₽3":{key:172,value:''},ريال:{key:171,value:''}},bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ct=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Ae(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Xe=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function vt(e,t,r){Xe[e],Xe[e][t]=r}function wt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&wt(e,t.length>0?t+"."+n:n,l):vt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){wt(e,"",t)}function ro(e,t){let r=t,o=Xe[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let i=0;iu+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...bt];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await new Promise((w,a)=>ge(["./jszip.min-CGrYsaMq"],w,a)).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const i=e.sheet.length;let f=m.folder("xl"),v=null,j=null,R=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const S=Object.keys(e.styles),d=eo,G=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,z={},Z={};let N=S.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",W="-",me="Regular";if(x.fontFamily&&(W=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(W!="-"||me!="Regular")&&(C='&"'+W+","+me+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Se=pe(x.color,o);typeof Se=="string"&&Se.length>0&&(C+="&K"+Se.toUpperCase())}return z[a]=C,w}if(G&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){Z[a]=w.conditionalFormatting.count;let C=pe(x.color,o),W=pe(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const V={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=pe(x.backgroundColor,o);V.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=pe(x.color,o);V.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let ce="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,ce=' applyAlignment="1">C+" "+W+'="'+x.alignment[W]+'" ',"")+" />
");const H=x.border;let k="";if(typeof H=="object"&&((H.left||H.full)&&(k+=''),(H.right||H.full)&&(k+=''),(H.top||H.full)&&(k+=''),(H.bottom||H.full)&&(k+=''),V.borderIndex=w.border.count,w.border.count++,w.border.value+=""+k+""),x.format){const C=r[x.format];C&&(V.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(V.fillIndex>0?' applyFill="1" ':"")+(V.fontIndex>=0?' applyFont="1" ':"")+(V.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:G?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,G));let oe='',P="",B=0,J="",K="",L={};const T={};let $="",Y=4,U=!1,M=-1,we=[],X=1;const xe={checkbox:` +`),n+=""+r+""+l+g+"",l=""}),l.length>0&&n.indexOf("")>0&&(n=n.substring(0,n.length-8)+l+""),n+="",n}const eo='',Ne=function(e){return e.replace(/\&/g,"&").replace(/\/g,">")};function Je(e,t,r){let o="";return e.forEach(n=>{typeof n.value=="string"&&(n.value=Ne(n.value)),o+=""+(n.styleId&&t[n.styleId]?t[n.styleId]:t[r])+''+n.value+""}),""+o+""}const xt={percentage:{key:9},fraction:{key:13},short_date:{key:14},yen:{key:160,value:''},"¥":{key:160,value:''},euro:{key:161,value:''},"€":{key:161,value:''},pound:{key:162,value:''},"£":{key:162,value:''},dollar:{key:163,value:''},$:{key:163,value:''},float_3:{key:164,value:''},time:{key:165,value:''},ريال:{key:171,value:''},"₽3":{key:172,value:''},"₽2":{key:173,value:''},"₽1":{key:174,value:''},"₼1":{key:175,value:''},manat:{key:176,value:''},"₼":{key:176,value:''},"֏":{key:177,value:''},ruble:{key:178,value:''},"₽":{key:178,value:''},CHF:{key:179,value:''},float_1:{key:180,value:''},float_2:{key:181,value:''},float_4:{key:182,value:''},dollar_2:{key:183,value:''},num_sep:{key:184,value:''},num_sep_1:{key:185,value:''},num_sep_2:{key:186,value:''},date:{key:187,value:''},dollar_rounded:{key:188,value:''}},bt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],Ct=(e,t,r=!1,o)=>{let n,l=!1;return typeof o=="function"?(n=o,l=!0):n=fetch,n(e).then(g=>l?g:r?g.arrayBuffer():g.blob()).then(g=>l||r?g:new File([g],t)).catch(g=>{throw g})};function Ae(e,t){e=e.toUpperCase();let r=e.replace(/[0-9]/g,"");if(r.length==0)throw"Invalid Column";let o=parseInt(e.substring(r.length));if(isNaN(o))throw"Invalid Row";o=Math.max(0,o-1);let n=t.indexOf(r);return n<0&&(t=He(t,Math.pow(10,r.length+1),""),n=t.indexOf(r),n<0&&(n=0)),{col:n,row:o}}let to={},Xe=new Proxy(to,{get(e,t){return t in e?e[t]:(this.set(e,t,{},!0),{})},set(e,t,r,o){return e[t]=r,!0}});function vt(e,t,r){Xe[e],Xe[e][t]=r}function wt(e,t,r){Object.keys(r).forEach(n=>{const l=r[n];typeof l=="object"?n!="data"&&n!="headers"&&wt(e,t.length>0?t+"."+n:n,l):vt(e,t.length>0?t+"."+n:n,l)})}function oo(e,t){wt(e,"",t)}function ro(e,t){let r=t,o=Xe[e];return Object.keys(o).forEach(l=>{const g=l.split(".");let u=r,m=o[l];for(let i=0;iu+" "+m,""),g=n.option.join(",");r+='"'+g+"""}return r+="",r}async function Be(e,t=""){if(typeof t=="string"&&t.length>0&&(e=ro(t,e)),typeof e.creator=="string"&&e.creator.trim().length<=0)throw'length of "creator" most be bigger then 0';if(typeof e.created=="string"&&new Date(e.created).toString()=="Invalid Date")throw'"created" is not valid date';if(typeof e.modified=="string"&&new Date(e.modified).toString()=="Invalid Date")throw'"modified" is not valid date';let r=xt;e.formatMap&&typeof e.formatMap=="object"&&(r={...r,...e.formatMap});const o=e.backend,n={lt:"lessThan",gt:"greaterThan",between:"between",ct:"containsText",eq:"equal"};let l=[...bt];e.numberOfColumn&&e.numberOfColumn>25&&(l=He(l,e.numberOfColumn));const u=(await new Promise((w,a)=>ge(["./jszip.min-CGrYsaMq"],w,a)).then(w=>w.jszip_min)).default;let m=new u;e.sheet||(e.sheet=[{headers:[],data:[]}]);const i=e.sheet.length;let f=m.folder("xl"),v=null,j=null,R=null;e.styles||(e.styles={}),e.addDefaultTitleStyle&&(e.styles.titleStyle={alignment:{horizontal:"center",vertical:"center"}});const k=Object.keys(e.styles),d=eo,Y=e.activateConditionalFormatting?e.activateConditionalFormatting:!1,U={},J={};let N=k.reduce((w,a,b)=>{const x=e.styles[a];if(x.type&&(x.type=="headerFooter"||x.type=="HF")){let C="",G="-",me="Regular";if(x.fontFamily&&(G=x.fontFamily),x.bold&&(me="Bold"),x.italic&&(me=="Regular"&&(me=""),me+="Italic"),(G!="-"||me!="Regular")&&(C='&"'+G+","+me+'"'),x.size&&(C+="&"+x.size),x.doubleUnderline?C+="&E":x.underline&&(C+="&U"),x.color){const Se=pe(x.color,o);typeof Se=="string"&&Se.length>0&&(C+="&K"+Se.toUpperCase())}return U[a]=C,w}if(Y&&typeof x.type=="string"&&x.type&&(x.type=="conditionalFormatting"||x.type.toUpperCase()=="CF")){J[a]=w.conditionalFormatting.count;let C=pe(x.color,o),G=pe(x.backgroundColor,o);return w.conditionalFormatting.value+=' ',w.conditionalFormatting.count++,w}const q={fillIndex:0,fontIndex:0,borderIndex:0,formatIndex:0};if(x.backgroundColor){let C=pe(x.backgroundColor,o);q.fillIndex=w.fill.count,w.fill.count++,w.fill.value=w.fill.value+''+(C?'':"")+""}if(x.color||x.fontFamily||x.size||x.bold||x.italic||x.underline||x.doubleUnderline){const C=pe(x.color,o);q.fontIndex=w.font.count,w.font.count++,w.font.value=w.font.value+""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+(x.size?'':"")+(C?'':"")+(x.fontFamily?'':"")+"",w.commentSyntax.value[a]=""+(x.bold?"":"")+(x.italic?"":"")+(x.underline||x.doubleUnderline?"":"")+''+(C?'':"")+''}let ce="/>";x.alignment&&(x.alignment.rtl&&(x.alignment.readingOrder=2),delete x.alignment.rtl,x.alignment.ltr&&(x.alignment.readingOrder=1),delete x.alignment.ltr,ce=' applyAlignment="1">C+" "+G+'="'+x.alignment[G]+'" ',"")+" />");const H=x.border;let O="";if(typeof H=="object"&&((H.left||H.full)&&(O+=''),(H.right||H.full)&&(O+=''),(H.top||H.full)&&(O+=''),(H.bottom||H.full)&&(O+=''),q.borderIndex=w.border.count,w.border.count++,w.border.value+=""+O+""),x.format){const C=r[x.format];C&&(q.formatIndex=C.key,"value"in C&&(w.format.count++,w.format.value+=C.value))}return w.cell.value=w.cell.value+'0?' applyBorder="1" ':"")+(q.fillIndex>0?' applyFill="1" ':"")+(q.fontIndex>=0?' applyFont="1" ':"")+(q.formatIndex>0?' applyNumberFormat="1" ':"")+ce,e.styles[a].index=w.cell.count,w.cell.count++,w},{conditionalFormatting:{count:Y?1:0,value:' '},commentSyntax:{value:{}},format:{count:0,value:""},border:{count:1,value:""},fill:{count:2,value:""},font:{count:2,value:""},cell:{count:2,value:""}});f==null||f.file("styles.xml",Jt(N,Y));let oe='',P="",B=0,X="",$="",L={};const T={};let M="",V=4,W=!1,K=-1,we=[],Q=1;const xe={checkbox:` `};let Te=1024;const Ee={checkbox:` - `};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