@node-projects/excelforge 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/.github/FUNDING.yml +4 -0
  2. package/MISSING.md +326 -0
  3. package/README.md +484 -12
  4. package/dist/core/SharedStrings.js +6 -2
  5. package/dist/core/SharedStrings.js.map +1 -1
  6. package/dist/core/Workbook.d.ts +41 -1
  7. package/dist/core/Workbook.js +773 -57
  8. package/dist/core/Workbook.js.map +1 -1
  9. package/dist/core/WorkbookReader.d.ts +18 -4
  10. package/dist/core/WorkbookReader.js +1386 -20
  11. package/dist/core/WorkbookReader.js.map +1 -1
  12. package/dist/core/Worksheet.d.ts +130 -2
  13. package/dist/core/Worksheet.js +792 -66
  14. package/dist/core/Worksheet.js.map +1 -1
  15. package/dist/core/types.d.ts +287 -5
  16. package/dist/core/types.js +12 -1
  17. package/dist/core/types.js.map +1 -1
  18. package/dist/features/ChartBuilder.d.ts +9 -1
  19. package/dist/features/ChartBuilder.js +140 -14
  20. package/dist/features/ChartBuilder.js.map +1 -1
  21. package/dist/features/CsvModule.d.ts +11 -0
  22. package/dist/features/CsvModule.js +137 -0
  23. package/dist/features/CsvModule.js.map +1 -0
  24. package/dist/features/Encryption.d.ts +6 -0
  25. package/dist/features/Encryption.js +806 -0
  26. package/dist/features/Encryption.js.map +1 -0
  27. package/dist/features/FormControlBuilder.d.ts +6 -0
  28. package/dist/features/FormControlBuilder.js +135 -0
  29. package/dist/features/FormControlBuilder.js.map +1 -0
  30. package/dist/features/FormulaEngine.d.ts +22 -0
  31. package/dist/features/FormulaEngine.js +498 -0
  32. package/dist/features/FormulaEngine.js.map +1 -0
  33. package/dist/features/HtmlModule.d.ts +21 -0
  34. package/dist/features/HtmlModule.js +1417 -0
  35. package/dist/features/HtmlModule.js.map +1 -0
  36. package/dist/features/JsonModule.d.ts +10 -0
  37. package/dist/features/JsonModule.js +76 -0
  38. package/dist/features/JsonModule.js.map +1 -0
  39. package/dist/features/PivotTableBuilder.d.ts +7 -0
  40. package/dist/features/PivotTableBuilder.js +170 -0
  41. package/dist/features/PivotTableBuilder.js.map +1 -0
  42. package/dist/features/Signing.d.ts +12 -0
  43. package/dist/features/Signing.js +318 -0
  44. package/dist/features/Signing.js.map +1 -0
  45. package/dist/features/TableBuilder.js +2 -2
  46. package/dist/features/TableBuilder.js.map +1 -1
  47. package/dist/index-min.js +579 -144
  48. package/dist/index.d.ts +17 -1
  49. package/dist/index.js +10 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/styles/StyleRegistry.d.ts +14 -0
  52. package/dist/styles/StyleRegistry.js +95 -30
  53. package/dist/styles/StyleRegistry.js.map +1 -1
  54. package/dist/utils/helpers.d.ts +4 -0
  55. package/dist/utils/helpers.js +64 -14
  56. package/dist/utils/helpers.js.map +1 -1
  57. package/dist/utils/zip.js +145 -73
  58. package/dist/utils/zip.js.map +1 -1
  59. package/dist/vba/VbaProject.d.ts +19 -0
  60. package/dist/vba/VbaProject.js +281 -0
  61. package/dist/vba/VbaProject.js.map +1 -0
  62. package/dist/vba/cfb.d.ts +7 -0
  63. package/dist/vba/cfb.js +352 -0
  64. package/dist/vba/cfb.js.map +1 -0
  65. package/dist/vba/ovba.d.ts +2 -0
  66. package/dist/vba/ovba.js +137 -0
  67. package/dist/vba/ovba.js.map +1 -0
  68. package/package.json +4 -3
  69. package/validator.cs +0 -155
  70. package/validatorEpplus.cs +0 -27
  71. package/validatorReadData.cs +0 -111
package/dist/index-min.js CHANGED
@@ -1,259 +1,694 @@
1
- function W(s){let t="";for(;s>0;){let e=(s-1)%26;t=String.fromCharCode(65+e)+t,s=Math.floor((s-1)/26)}return t}function Nt(s){let t=0;for(let e=0;e<s.length;e++)t=t*26+(s.charCodeAt(e)-64);return t}function H(s){let t=s.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!t)throw new Error(`Invalid cell ref: ${s}`);return{col:Nt(t[2]),row:parseInt(t[4],10)}}function rt(s,t,e=!1){let r=e?"$":"";return`${r}${W(t)}${r}${s}`}function ot(s){let[t,e]=s.split(":"),r=H(t.replace(/\$/g,"")),o=e?H(e.replace(/\$/g,"")):r;return{startRow:r.row,startCol:r.col,endRow:o.row,endCol:o.col}}function g(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var re=new TextEncoder;function C(s){return re.encode(s)}function gt(s,t=!1){let e=t?Date.UTC(1904,0,1):Date.UTC(1899,11,30),r=(s.getTime()-e)/864e5;return t||r>=60,r}function xt(s){return Math.round(s*914400/96)}function ct(s){let t=atob(s),e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}function oe(s){let t="";for(let e=0;e<s.length;e++)t+=String.fromCharCode(s[e]);return btoa(t)}var ne={average:101,count:102,countNums:103,max:104,min:105,stdDev:107,sum:109,var:110,vars:111},J=class{constructor(t,e={}){this.cells=new Map,this.merges=[],this.images=[],this.charts=[],this.conditionalFormats=[],this.tables=[],this.sparklines=[],this.colDefs=new Map,this.rowDefs=new Map,this.dataValidations=new Map,this.sheetIndex=0,this.rId="",this.drawingRId="",this.legacyDrawingRId="",this.tableRIds=[],this.name=t,this.options={...e,name:t}}key(t,e){return`${t},${e}`}getCell(t,e){let r=this.key(t,e);return this.cells.has(r)||this.cells.set(r,{}),this.cells.get(r)}getCellByRef(t){let{row:e,col:r}=H(t);return this.getCell(e,r)}setCell(t,e,r){return this.cells.set(this.key(t,e),r),this}setValue(t,e,r){return this.getCell(t,e).value=r,this}setFormula(t,e,r){return this.getCell(t,e).formula=r,this}setStyle(t,e,r){return this.getCell(t,e).style=r,this}writeArray(t,e,r){for(let o=0;o<r.length;o++)for(let i=0;i<r[o].length;i++)this.setValue(t+o,e+i,r[o][i]);return this}writeColumn(t,e,r){return r.forEach((o,i)=>this.setValue(t+i,e,o)),this}writeRow(t,e,r){return r.forEach((o,i)=>this.setValue(t,e+i,o)),this}setColumn(t,e){return this.colDefs.set(t,e),this}setColumnWidth(t,e){let r=this.colDefs.get(t)??{};return this.colDefs.set(t,{...r,width:e,customWidth:!0}),this}setRow(t,e){return this.rowDefs.set(t,e),this}setRowHeight(t,e){let r=this.rowDefs.get(t)??{};return this.rowDefs.set(t,{...r,height:e}),this}merge(t,e,r,o){return this.merges.push({startRow:t,startCol:e,endRow:r,endCol:o}),this}mergeByRef(t){let[e,r]=t.split(":"),o=H(e),i=H(r);return this.merge(o.row,o.col,i.row,i.col)}addImage(t){return this.images.push(t),this}getImages(){return this.images}getComments(){let t=[];for(let[e,r]of this.cells)if(r.comment){let[o,i]=e.split(",").map(Number);t.push({row:o,col:i,comment:r.comment})}return t}addChart(t){return this.charts.push(t),this}getCharts(){return this.charts}addConditionalFormat(t){return this.conditionalFormats.push(t),this}addTable(t){if(this.tables.push(t),t.totalsRow&&t.columns?.length){let{startRow:e,startCol:r,endRow:o}=ot(t.ref),i=e+1,n=o-1;t.columns.forEach((l,c)=>{let a=r+c;if(l.totalsRowLabel)this.setValue(o,a,l.totalsRowLabel);else if(l.totalsRowFunction&&l.totalsRowFunction!=="none"){let d=ne[l.totalsRowFunction];if(d!==void 0){let m=W(a);this.setFormula(o,a,`SUBTOTAL(${d},${m}${i}:${m}${n})`)}}})}return this}getTables(){return this.tables}addSparkline(t){return this.sparklines.push(t),this}addDataValidation(t,e){return this.dataValidations.set(t,e),this}freeze(t,e){return this.freezePane={row:t,col:e},this}toXml(t,e){let r=this.pageSetup?.fitToPage,o=this.options?.tabColor,i=r||o?`<sheetPr>${o?`<tabColor rgb="${o}"/>`:""}${r?'<pageSetUpPr fitToPage="1"/>':""}</sheetPr>`:"",n=this._sheetViewXml(),l=this._colsXml(t),c=this._sheetDataXml(t,e),a=this._mergesXml(),d=this._conditionalFormatXml(t),m=this._dataValidationsXml(),p=this.autoFilter?`<autoFilter ref="${this.autoFilter.ref}"/>`:"",h=this.tables.length?`<tableParts count="${this.tables.length}">${this.tableRIds.map(T=>`<tablePart r:id="${T}"/>`).join("")}</tableParts>`:"",u=(this.images.length||this.charts.length)&&this.drawingRId?`<drawing r:id="${this.drawingRId}"/>`:"",$=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"",x=this._sparklineXml(),y=this._protectionXml(),b=this._pageSetupXml(),F=this._pageMarginsXml(),I=this._headerFooterXml(),X=this._printOptionsXml();return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1
+ var jt=class o{constructor(t){this.error=t}toString(){return this.error}static{this.NULL=new o("#NULL!")}static{this.DIV0=new o("#DIV/0!")}static{this.VALUE=new o("#VALUE!")}static{this.REF=new o("#REF!")}static{this.NAME=new o("#NAME?")}static{this.NUM=new o("#NUM!")}static{this.NA=new o("#N/A")}static{this.GETTING=new o("#GETTING_DATA")}};var Qe=[];function Dt(o){if(Qe[o])return Qe[o];let t="",e=o;for(;e>0;){let n=(e-1)%26;t=String.fromCharCode(65+n)+t,e=Math.floor((e-1)/26)}return Qe[o]=t,t}function to(o){let t=0;for(let e=0;e<o.length;e++)t=t*26+(o.charCodeAt(e)-64);return t}function Mt(o){let t=o.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!t)throw new Error(`Invalid cell ref: ${o}`);return{col:to(t[2]),row:parseInt(t[4],10)}}function Yt(o,t,e=!1){let n=e?"$":"";return`${n}${Dt(t)}${n}${o}`}function Lt(o){let[t,e]=o.split(":"),n=Mt(t.replace(/\$/g,"")),r=e?Mt(e.replace(/\$/g,"")):n;return{startRow:n.row,startCol:n.col,endRow:r.row,endCol:r.col}}var Bn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"},Je=/[&<>"']/g;function b(o){return Je.test(o)?(Je.lastIndex=0,o.replace(Je,t=>Bn[t])):o}var Ln=new TextEncoder;function q(o){return Ln.encode(o)}function eo(o,t=!1){let e=t?Date.UTC(1904,0,1):Date.UTC(1899,11,30),n=(o.getTime()-e)/864e5;return t||n>=60,n}function oo(o){return Math.round(o*914400/96)}function be(o){let t=atob(o),e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Nn(o){let t=[];for(let e=0;e<o.length;e+=8192)t.push(String.fromCharCode.apply(null,o.subarray(e,e+8192)));return btoa(t.join(""))}function Ro(o,t,e){let n=o.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!n)return o;let r=n[1]==="$",s=to(n[2]),i=n[3]==="$",a=parseInt(n[4],10),l=i?`R${a}`:a===t?"R":`R[${a-t}]`,m=r?`C${s}`:s===e?"C":`C[${s-e}]`;return l+m}function Mo(o,t,e){let n=o.match(/^R(\[(-?\d+)\]|(\d+))?C(\[(-?\d+)\]|(\d+))?$/);if(!n)return o;let r,s,i,a;return n[3]!==void 0?(r=parseInt(n[3],10),s=!0):n[2]!==void 0?(r=t+parseInt(n[2],10),s=!1):(r=t,s=!1),n[6]!==void 0?(i=parseInt(n[6],10),a=!0):n[5]!==void 0?(i=e+parseInt(n[5],10),a=!1):(i=e,a=!1),`${a?"$":""}${Dt(i)}${s?"$":""}${r}`}function jn(o,t,e){return o.replace(/(\$?)([A-Z]+)(\$?)(\d+)/g,(n,r,s,i,a)=>Ro(`${r}${s}${i}${a}`,t,e))}function On(o,t,e){return o.replace(/R(\[(-?\d+)\]|(\d+))?C(\[(-?\d+)\]|(\d+))?/g,n=>Mo(n,t,e))}var no=/[&<>]/g,Xn={"&":"&amp;","<":"&lt;",">":"&gt;"};function ro(o){return no.test(o)?(no.lastIndex=0,o.replace(no,t=>Xn[t])):o}function Eo(o){return o.startsWith("theme:")?`<color theme="${o.slice(6)}"/>`:`<color rgb="${o.startsWith("#")?"FF"+o.slice(1):o}"/>`}var Un={average:101,count:102,countNums:103,max:104,min:105,stdDev:107,sum:109,var:110,vars:111},Jt=class{constructor(t,e={}){this.cells=new Map,this.merges=[],this.images=[],this.cellImages=[],this.charts=[],this.conditionalFormats=[],this.tables=[],this.pivotTables=[],this.sparklines=[],this.formControls=[],this.shapes=[],this.wordArt=[],this.queryTables=[],this.tableSlicers=[],this.mathEquations=[],this.colDefs=new Map,this.rowDefs=new Map,this.dataValidations=new Map,this.rowBreaks=[],this.colBreaks=[],this.preservedXml=[],this._nextSharedIdx=0,this._isChartSheet=!1,this._isDialogSheet=!1,this.sheetIndex=0,this.rId="",this.drawingRId="",this.legacyDrawingRId="",this.tableRIds=[],this.ctrlPropRIds=[],this.slicerRId="",this._slicerDrawingInfo=[],this._cellImageVm=new Map,this.ignoreErrors=[],this.name=t,this.options={...e,name:t}}getCell(t,e){let n=this.cells.get(t);n||(n=new Map,this.cells.set(t,n));let r=n.get(e);return r||(r={},n.set(e,r)),r}getCellByRef(t){let{row:e,col:n}=Mt(t);return this.getCell(e,n)}setCell(t,e,n){let r=this.cells.get(t);return r||(r=new Map,this.cells.set(t,r)),r.set(e,n),this}setValue(t,e,n){return this.getCell(t,e).value=n,this}setFormula(t,e,n){return this.getCell(t,e).formula=n,this}setDynamicArrayFormula(t,e,n){let r=this.getCell(t,e);return r.arrayFormula=n,r._dynamic=!0,this}setSharedFormula(t,e,n,r){let s=this._nextSharedIdx++,i=this.getCell(t,e);i.formula=n,i._sharedRef=r,i._sharedIdx=s;let{startRow:a,startCol:l,endRow:m,endCol:c}=Lt(r);for(let h=a;h<=m;h++)for(let d=l;d<=c;d++){if(h===t&&d===e)continue;let f=this.getCell(h,d);f._sharedIdx=s}return this}setStyle(t,e,n){return this.getCell(t,e).style=n,this}writeArray(t,e,n){for(let r=0;r<n.length;r++)for(let s=0;s<n[r].length;s++)this.setValue(t+r,e+s,n[r][s]);return this}writeColumn(t,e,n){return n.forEach((r,s)=>this.setValue(t+s,e,r)),this}writeRow(t,e,n){return n.forEach((r,s)=>this.setValue(t,e+s,r)),this}setColumn(t,e){return this.colDefs.set(t,e),this}setColumnWidth(t,e){let n=this.colDefs.get(t)??{};return this.colDefs.set(t,{...n,width:e,customWidth:!0}),this}setRow(t,e){return this.rowDefs.set(t,e),this}setRowHeight(t,e){let n=this.rowDefs.get(t)??{};return this.rowDefs.set(t,{...n,height:e}),this}merge(t,e,n,r){return this.merges.push({startRow:t,startCol:e,endRow:n,endCol:r}),this}mergeByRef(t){let[e,n]=t.split(":"),r=Mt(e),s=Mt(n);return this.merge(r.row,r.col,s.row,s.col)}getMerges(){return this.merges}addImage(t){return this.images.push(t),this}getImages(){return this.images}addCellImage(t){return this.cellImages.push(t),this}getCellImages(){return this.cellImages}getComments(){let t=[];for(let[e,n]of this.cells)for(let[r,s]of n)s.comment&&t.push({row:e,col:r,comment:s.comment});return t}addChart(t){return this.charts.push(t),this}getCharts(){return this.charts}addConditionalFormat(t){return this.conditionalFormats.push(t),this}getConditionalFormats(){return this.conditionalFormats}getDataValidations(){return this.dataValidations}addTable(t){if(this.tables.push(t),t.totalsRow&&t.columns?.length){let{startRow:e,startCol:n,endRow:r}=Lt(t.ref),s=e+1,i=r-1;t.columns.forEach((a,l)=>{let m=n+l;if(a.totalsRowLabel)this.setValue(r,m,a.totalsRowLabel);else if(a.totalsRowFunction&&a.totalsRowFunction!=="none"){let c=Un[a.totalsRowFunction];if(c!==void 0){let h=Dt(m);this.setFormula(r,m,`SUBTOTAL(${c},${h}${s}:${h}${i})`)}}})}return this}getTables(){return this.tables}addPivotTable(t){return this.pivotTables.push(t),this}getPivotTables(){return this.pivotTables}readRange(t){let{startRow:e,startCol:n,endRow:r,endCol:s}=Lt(t),i=[];for(let a=e;a<=r;a++){let l=[],m=this.cells.get(a);for(let c=n;c<=s;c++){let h=m?.get(c);l.push(h?.value??null)}i.push(l)}return i}readAllCells(){let t=[];for(let[e,n]of this.cells)for(let[r,s]of n)t.push({row:e,col:r,cell:s});return t}getUsedRange(){let t=1/0,e=0,n=1/0,r=0;for(let[s,i]of this.cells)for(let[a]of i)s<t&&(t=s),s>e&&(e=s),a<n&&(n=a),a>r&&(r=a);return e===0?null:{startRow:t,startCol:n,endRow:e,endCol:r}}getColumn(t){return this.colDefs.get(t)}getRow(t){return this.rowDefs.get(t)}insertRows(t,e){let n=[...this.cells.keys()].filter(s=>s>=t).sort((s,i)=>i-s);for(let s of n){let i=this.cells.get(s);this.cells.delete(s),this.cells.set(s+e,i)}let r=[...this.rowDefs.keys()].filter(s=>s>=t).sort((s,i)=>i-s);for(let s of r){let i=this.rowDefs.get(s);this.rowDefs.delete(s),this.rowDefs.set(s+e,i)}for(let s of this.merges)s.startRow>=t&&(s.startRow+=e),s.endRow>=t&&(s.endRow+=e);return this}deleteRows(t,e){for(let s=t;s<t+e;s++)this.cells.delete(s),this.rowDefs.delete(s);let n=[...this.cells.keys()].filter(s=>s>=t+e).sort((s,i)=>s-i);for(let s of n){let i=this.cells.get(s);this.cells.delete(s),this.cells.set(s-e,i)}let r=[...this.rowDefs.keys()].filter(s=>s>=t+e).sort((s,i)=>s-i);for(let s of r){let i=this.rowDefs.get(s);this.rowDefs.delete(s),this.rowDefs.set(s-e,i)}this.merges=this.merges.filter(s=>!(s.startRow>=t&&s.endRow<t+e));for(let s of this.merges)s.startRow>=t+e&&(s.startRow-=e),s.endRow>=t+e&&(s.endRow-=e);return this}insertColumns(t,e){for(let[,r]of this.cells){let s=[...r.keys()].filter(i=>i>=t).sort((i,a)=>a-i);for(let i of s){let a=r.get(i);r.delete(i),r.set(i+e,a)}}let n=[...this.colDefs.keys()].filter(r=>r>=t).sort((r,s)=>s-r);for(let r of n){let s=this.colDefs.get(r);this.colDefs.delete(r),this.colDefs.set(r+e,s)}for(let r of this.merges)r.startCol>=t&&(r.startCol+=e),r.endCol>=t&&(r.endCol+=e);return this}copyRange(t,e,n){let{startRow:r,startCol:s,endRow:i,endCol:a}=Lt(t);for(let l=r;l<=i;l++)for(let m=s;m<=a;m++){let c=this.getCell(l,m),h=e+(l-r),d=n+(m-s);c.value!=null&&this.setValue(h,d,c.value),c.formula&&this.setFormula(h,d,c.formula),c.style&&this.setStyle(h,d,{...c.style})}return this}moveRange(t,e,n){let{startRow:r,startCol:s,endRow:i,endCol:a}=Lt(t);this.copyRange(t,e,n);let l=e+(i-r),m=n+(a-s);for(let c=r;c<=i;c++)for(let h=s;h<=a;h++){let d=e+(c-r),f=n+(h-s);if(d===c&&f===h)continue;let p=this.cells.get(c);p&&p.delete(h)}return this}sortRange(t,e,n="asc"){let{startRow:r,startCol:s,endRow:i,endCol:a}=Lt(t),l=[];for(let m=r;m<=i;m++){let c=this.cells.get(m),h=new Map;for(let d=s;d<=a;d++){let f=c?.get(d);f&&h.set(d,{...f})}l.push({rowIdx:m,cells:h})}l.sort((m,c)=>{let h=m.cells.get(e)?.value,d=c.cells.get(e)?.value,f=typeof h=="number"||typeof h=="string"?h:"",p=typeof d=="number"||typeof d=="string"?d:"",u=0;return typeof f=="number"&&typeof p=="number"?u=f-p:u=String(f).localeCompare(String(p)),n==="desc"?-u:u});for(let m=0;m<l.length;m++){let c=r+m;for(let h=s;h<=a;h++){let d=l[m].cells.get(h),f=this.cells.get(c)??new Map;this.cells.has(c)||this.cells.set(c,f),d?f.set(h,d):f.delete(h)}}return this}fillNumber(t,e,n,r=0,s=1){for(let i=0;i<n;i++)this.setValue(t+i,e,r+i*s);return this}fillDate(t,e,n,r,s="day",i=1){for(let a=0;a<n;a++){let l=new Date(r);switch(s){case"day":l.setDate(l.getDate()+a*i);break;case"week":l.setDate(l.getDate()+a*i*7);break;case"month":l.setMonth(l.getMonth()+a*i);break;case"year":l.setFullYear(l.getFullYear()+a*i);break}this.setValue(t+a,e,l)}return this}fillList(t,e,n,r){for(let s=0;s<r;s++)this.setValue(t+s,e,n[s%n.length]);return this}autoFitColumns(t=8,e=60){let n=this.getUsedRange();if(!n)return this;for(let r=n.startCol;r<=n.endCol;r++){let s=0;for(let i=n.startRow;i<=n.endRow;i++){let a=this.cells.get(i)?.get(r);if(a?.value!=null){let l=String(a.value);l.length>s&&(s=l.length)}if(a?.richText){let l=a.richText.map(m=>m.text).join("");l.length>s&&(s=l.length)}}if(s>0){let i=Math.max(t,Math.min(e,s*1.2+2));this.setColumn(r,{...this.colDefs.get(r)??{},width:i,customWidth:!0})}}return this}duplicateRow(t,e){this.insertRows(e,1);let n=this.cells.get(t>=e?t+1:t);if(n){let s=new Map;for(let[i,a]of n)s.set(i,{...a,style:a.style?{...a.style}:void 0});this.cells.set(e,s)}let r=this.rowDefs.get(t>=e?t+1:t);return r&&this.rowDefs.set(e,{...r}),this}spliceRows(t,e,n){if(e>0&&this.deleteRows(t,e),n&&n.length>0){this.insertRows(t,n.length);for(let r=0;r<n.length;r++)this.writeRow(t+r,1,n[r])}return this}setAutoFilter(t,e){return this.autoFilter={ref:t},e?.columns&&(this._filterColumns=e.columns),this}addSparkline(t){return this.sparklines.push(t),this}getSparklines(){return this.sparklines}addDataValidation(t,e){return this.dataValidations.set(t,e),this}addRowBreak(t,e=!0){return this.rowBreaks.push({id:t,manual:e}),this}addColBreak(t,e=!0){return this.colBreaks.push({id:t,manual:e}),this}getRowBreaks(){return this.rowBreaks}getColBreaks(){return this.colBreaks}addFormControl(t){if(!t.to&&(t.width||t.height)){let r=t.width??100,s=t.height??30,i=t.from.col+r/64,a=t.from.row+s/20;t={...t,to:{col:Math.floor(i),row:Math.floor(a),colOff:Math.round(i%1*64),rowOff:Math.round(a%1*20)}}}return this.formControls.push(t),this}getFormControls(){return this.formControls}addShape(t){return this.shapes.push(t),this}getShapes(){return this.shapes}addWordArt(t){return this.wordArt.push(t),this}getWordArt(){return this.wordArt}addQueryTable(t){return this.queryTables.push(t),this}getQueryTables(){return this.queryTables}addTableSlicer(t){return this.tableSlicers.push(t),this}getTableSlicers(){return this.tableSlicers}addMathEquation(t){return this.mathEquations.push(t),this}getMathEquations(){return this.mathEquations}addIgnoredError(t,e){return this.ignoreErrors.push({sqref:t,...e}),this}getIgnoredErrors(){return this.ignoreErrors}addPreservedXml(t){return this.preservedXml.push(t),this}freeze(t,e){return this.freezePane={row:t,col:e},this}toXml(t,e){let n=this.pageSetup?.fitToPage,r=this.options?.tabColor,s=n||r?`<sheetPr>${r?`<tabColor rgb="${r}"/>`:""}${n?'<pageSetUpPr fitToPage="1"/>':""}</sheetPr>`:"",i=this._sheetViewXml(),a=this._colsXml(t),l=this._sheetDataXml(t,e),m=this._mergesXml(),c=this._conditionalFormatXml(t),h=this._dataValidationsXml(),d=this.autoFilter&&!this.tables.some(L=>L.ref===this.autoFilter.ref)?this._autoFilterXml():"",f=this.tables.length?`<tableParts count="${this.tables.length}">${this.tableRIds.map(L=>`<tablePart r:id="${L}"/>`).join("")}</tableParts>`:"",p=this.drawingRId?`<drawing r:id="${this.drawingRId}"/>`:"",u=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"",x=this._formControlsXml(),$=this._sparklineXml(),y=this._customIconExtXml(),I=this.slicerRId?`<extLst><ext uri="{A8765BA9-456A-4dab-B4F3-ACF838C121DE}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerList><x14:slicer r:id="${this.slicerRId}"/></x14:slicerList></ext></extLst>`:"",R=this._ignoredErrorsXml(),w=this._protectionXml(),C=this._pageSetupXml(),g=this._pageMarginsXml(),M=this._headerFooterXml(),T=this._printOptionsXml(),S=this._pageBreaksXml("rowBreaks",this.rowBreaks,16383),k=this._pageBreaksXml("colBreaks",this.colBreaks,1048575);return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
2
  <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
3
3
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
4
4
  xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
5
- xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision">
5
+ xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
6
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7
+ xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
8
+ ${s}
6
9
  ${i}
7
- ${n}
8
- ${l}
9
- ${c}
10
- ${y}
11
- ${p}
12
10
  ${a}
11
+ ${l}
12
+ ${w}
13
13
  ${d}
14
14
  ${m}
15
- ${X}
16
- ${F}
17
- ${b}
18
- ${I}
15
+ ${c}
16
+ ${h}
17
+ ${T}
18
+ ${g}
19
+ ${C}
20
+ ${M}
21
+ ${S}
22
+ ${k}
23
+ ${R}
24
+ ${p}
19
25
  ${u}
20
- ${$}
21
26
  ${x}
22
- ${h}
23
- </worksheet>`}_sheetViewXml(){let t=this.view??{},e=['workbookViewId="0"',t.showGridLines===!1?'showGridLines="0"':"",t.showRowColHeaders===!1?'showRowColHeaders="0"':"",t.zoomScale!==void 0?`zoomScale="${t.zoomScale}"`:"",t.rightToLeft?'rightToLeft="1"':"",t.tabSelected?'tabSelected="1"':"",t.view?`view="${t.view}"`:""].filter(Boolean),r="";if(this.freezePane){let{row:o=0,col:i=0}=this.freezePane,n=o&&i?rt(o+1,i+1):o?rt(o+1,1):rt(1,i+1),l=o&&i?"bottomRight":o?"bottomLeft":"topRight";r=`<pane xSplit="${i}" ySplit="${o}" topLeftCell="${n}" activePane="${l}" state="frozen"/>
24
- <selection pane="${l}" activeCell="${n}" sqref="${n}"/>`}return`<sheetViews><sheetView ${e.join(" ")}>${r}</sheetView></sheetViews>`}_colsXml(t){return this.colDefs.size?`<cols>${[...this.colDefs.entries()].sort((o,i)=>o[0]-i[0]).map(([o,i])=>{let n=i.style?t.register(i.style):0;return`<col min="${o}" max="${o}"`+(i.width?` width="${i.width}" customWidth="1"`:"")+(i.hidden?' hidden="1"':"")+(i.bestFit?' bestFit="1"':"")+(i.outlineLevel?` outlineLevel="${i.outlineLevel}"`:"")+(i.collapsed?' collapsed="1"':"")+(n?` style="${n}"`:"")+"/>"}).join("")}</cols>`:""}_sheetDataXml(t,e){let r=new Map;for(let[n,l]of this.cells){let[c,a]=n.split(",").map(Number);r.has(c)||r.set(c,[]),r.get(c).push([a,l])}return`<sheetData>${[...r.entries()].sort((n,l)=>n[0]-l[0]).map(([n,l])=>{let c=this.rowDefs.get(n),a=c?.style?t.register(c.style):0,d=[`r="${n}"`,c?.height?`ht="${c.height}" customHeight="1"`:"",c?.hidden?'hidden="1"':"",c?.outlineLevel?`outlineLevel="${c.outlineLevel}"`:"",c?.collapsed?'collapsed="1"':"",a?`s="${a}" customFormat="1"`:"",c?.thickTop?'thickTop="1"':"",c?.thickBot?'thickBot="1"':""].filter(Boolean).join(" "),p=l.sort((h,u)=>h[0]-u[0]).map(([h,u])=>this._cellXml(n,h,u,t,e)).join("");return`<row ${d}>${p}</row>`}).join("")}</sheetData>`}_cellXml(t,e,r,o,i){let n=`${W(e)}${t}`,l=r.style?o.register(r.style):0,c=l?` s="${l}"`:"";if(r.arrayFormula){let m=`<f t="array" ref="${n}">${g(r.arrayFormula)}</f>`;return`<c r="${n}"${c}>${m}<v>0</v></c>`}if(r.formula){let m=`<f>${g(r.formula)}</f>`;return`<c r="${n}"${c}>${m}</c>`}if(r.richText){let m=i.internRichText(r.richText);return`<c r="${n}" t="s"${c}><v>${m}</v></c>`}let a=r.value;if(a==null)return l?`<c r="${n}"${c}/>`:"";if(typeof a=="boolean")return`<c r="${n}" t="b"${c}><v>${a?1:0}</v></c>`;if(a instanceof Date){let m=gt(a);return`<c r="${n}"${c}><v>${m}</v></c>`}if(typeof a=="number")return`<c r="${n}"${c}><v>${a}</v></c>`;if(typeof a=="string"&&a.startsWith("="))return`<c r="${n}"${c}><f>${g(a.slice(1))}</f></c>`;let d=i.intern(a);return`<c r="${n}" t="s"${c}><v>${d}</v></c>`}_mergesXml(){if(!this.merges.length)return"";let t=this.merges.map(e=>{let r=`${W(e.startCol)}${e.startRow}`,o=`${W(e.endCol)}${e.endRow}`;return`<mergeCell ref="${r}:${o}"/>`});return`<mergeCells count="${this.merges.length}">${t.join("")}</mergeCells>`}_conditionalFormatXml(t){return this.conditionalFormats.map(e=>{let r=e.style?t.registerDxf(e.style):void 0,o="";if(e.colorScale?.type==="colorScale"){let c=e.colorScale,a=c.cfvo.map(m=>`<cfvo type="${m.type}"${m.val?` val="${m.val}"`:""}/>`).join(""),d=c.color.map(m=>`<color rgb="${m.startsWith("#")?"FF"+m.slice(1):m}"/>`).join("");o=`<colorScale>${a}${d}</colorScale>`}else if(e.dataBar?.type==="dataBar"){let c=e.dataBar,a=`<cfvo type="${c.minType??"min"}"${c.minVal!=null?` val="${c.minVal}"`:""}/>`,d=`<cfvo type="${c.maxType??"max"}"${c.maxVal!=null?` val="${c.maxVal}"`:""}/>`,m=c.color??c.minColor??"FF638EC6",p=m.startsWith("#")?"FF"+m.slice(1):m;o=`<dataBar${c.showValue===!1?' showValue="0"':""}>${a}${d}<color rgb="${p}"/></dataBar>`}else if(e.iconSet?.type==="iconSet"){let c=e.iconSet,a=c.cfvo.map(d=>`<cfvo type="${d.type}"${d.val?` val="${d.val}"`:""}/>`).join("");o=`<iconSet iconSet="${c.iconSet}"${c.showValue===!1?' showValue="0"':""}${c.reverse?' reverse="1"':""}>${a}</iconSet>`}let i=[`type="${e.type}"`,e.operator?`operator="${e.operator}"`:"",r!==void 0?`dxfId="${r}"`:"",`priority="${e.priority??1}"`,e.aboveAverage===!1?'aboveAverage="0"':"",e.percent?'percent="1"':"",e.rank?`rank="${e.rank}"`:"",e.timePeriod?`timePeriod="${e.timePeriod}"`:"",e.text?`text="${g(e.text)}"`:""].filter(Boolean).join(" "),n=e.formula?`<formula>${g(e.formula)}</formula>`:"",l=e.formula2?`<formula>${g(e.formula2)}</formula>`:"";return`<conditionalFormatting sqref="${e.sqref}"><cfRule ${i}>${n}${l}${o}</cfRule></conditionalFormatting>`}).join("")}_dataValidationsXml(){if(!this.dataValidations.size)return"";let t=[...this.dataValidations.entries()].map(([e,r])=>{let o=r.type==="list"&&r.list?`<formula1>"${r.list.join(",")}"</formula1>`:r.formula1?`<formula1>${g(r.formula1)}</formula1>`:"",i=r.formula2?`<formula2>${g(r.formula2)}</formula2>`:"";return`<dataValidation ${[`type="${r.type}"`,r.operator?`operator="${r.operator}"`:"",`sqref="${e}"`,r.showDropDown!==!1&&r.type==="list"?"":'showDropDown="1"',r.allowBlank!==!1?'allowBlank="1"':"",r.showErrorAlert?'showErrorMessage="1"':"",r.errorTitle?`errorTitle="${g(r.errorTitle)}"`:"",r.error?`error="${g(r.error)}"`:"",r.showInputMessage?'showInputMessage="1"':"",r.promptTitle?`promptTitle="${g(r.promptTitle)}"`:"",r.prompt?`prompt="${g(r.prompt)}"`:""].filter(Boolean).join(" ")}>${o}${i}</dataValidation>`});return`<dataValidations count="${this.dataValidations.size}">${t.join("")}</dataValidations>`}_protectionXml(){let t=this.protection;return t?`<sheetProtection ${[t.sheet?'sheet="1"':"",t.password?`password="${ie(t.password)}"`:"",t.selectLockedCells===!1?'selectLockedCells="0"':"",t.selectUnlockedCells===!1?'selectUnlockedCells="0"':"",t.formatCells?'formatCells="0"':"",t.formatColumns?'formatColumns="0"':"",t.formatRows?'formatRows="0"':"",t.insertColumns?'insertColumns="0"':"",t.insertRows?'insertRows="0"':"",t.insertHyperlinks?'insertHyperlinks="0"':"",t.deleteColumns?'deleteColumns="0"':"",t.deleteRows?'deleteRows="0"':"",t.sort?'sort="0"':"",t.autoFilter?'autoFilter="0"':"",t.pivotTables?'pivotTables="0"':""].filter(Boolean).join(" ")}/>`:""}_pageSetupXml(){let t=this.pageSetup;return t?`<pageSetup ${[t.paperSize?`paperSize="${t.paperSize}"`:"",t.orientation?`orientation="${t.orientation}"`:"",t.fitToWidth!==void 0?`fitToWidth="${t.fitToWidth}"`:"",t.fitToHeight!==void 0?`fitToHeight="${t.fitToHeight}"`:"",t.scale?`scale="${t.scale}"`:"",t.horizontalDpi?`horizontalDpi="${t.horizontalDpi}"`:"",t.verticalDpi?`verticalDpi="${t.verticalDpi}"`:"",t.firstPageNumber?`firstPageNumber="${t.firstPageNumber}" useFirstPageNumber="1"`:""].filter(Boolean).join(" ")}/>`:""}_pageMarginsXml(){let t=this.pageMargins,r={...{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},...t};return`<pageMargins left="${r.left}" right="${r.right}" top="${r.top}" bottom="${r.bottom}" header="${r.header}" footer="${r.footer}"/>`}_headerFooterXml(){let t=this.headerFooter;if(!t)return"";let e=[t.differentOddEven?'differentOddEven="1"':"",t.differentFirst?'differentFirst="1"':""].filter(Boolean).join(" "),r=t.oddHeader?`<oddHeader>${g(t.oddHeader)}</oddHeader>`:"",o=t.oddFooter?`<oddFooter>${g(t.oddFooter)}</oddFooter>`:"",i=t.evenHeader?`<evenHeader>${g(t.evenHeader)}</evenHeader>`:"",n=t.evenFooter?`<evenFooter>${g(t.evenFooter)}</evenFooter>`:"",l=t.firstHeader?`<firstHeader>${g(t.firstHeader)}</firstHeader>`:"",c=t.firstFooter?`<firstFooter>${g(t.firstFooter)}</firstFooter>`:"";return`<headerFooter${e?" "+e:""}>${r}${o}${i}${n}${l}${c}</headerFooter>`}_printOptionsXml(){let t=this.printOptions;if(!t)return"";let e=[t.gridLines?'gridLines="1"':"",t.gridLinesSet?'gridLinesSet="1"':"",t.headings?'headings="1"':"",t.centerHorizontal?'horizontalCentered="1"':"",t.centerVertical?'verticalCentered="1"':""].filter(Boolean).join(" ");return e?`<printOptions ${e}/>`:""}_sparklineXml(){if(!this.sparklines.length)return"";let t=(o,i)=>{if(!i)return"";let n=i.startsWith("#")?"FF"+i.slice(1):i;return`<x14:${o} rgb="${n}"/>`};return`<extLst><ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">${`<x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">${this.sparklines.map(o=>{let n=[`type="${o.type==="bar"?"column":o.type}"`,o.lineWidth!==void 0?`lineWeight="${o.lineWidth}"`:"",o.showMarkers?'markers="1"':"",o.showFirst?'first="1"':"",o.showLast?'last="1"':"",o.showHigh?'high="1"':"",o.showLow?'low="1"':"",o.showNegative?'negative="1"':"",o.minAxisType?`minAxisType="${o.minAxisType}"`:"",o.maxAxisType?`maxAxisType="${o.maxAxisType}"`:""].filter(Boolean).join(" "),l=[t("colorSeries",o.color),t("colorHigh",o.highColor),t("colorLow",o.lowColor),t("colorFirst",o.firstColor),t("colorLast",o.lastColor),t("colorNegative",o.negativeColor),t("colorMarkers",o.markersColor)].join(""),c=o.dataRange.includes("!")?o.dataRange:`${this.name}!${o.dataRange}`,a=`<x14:sparklines><x14:sparkline><xm:f>${g(c)}</xm:f><xm:sqref>${o.location}</xm:sqref></x14:sparkline></x14:sparklines>`;return`<x14:sparklineGroup ${n}>${l}${a}</x14:sparklineGroup>`}).join("")}</x14:sparklineGroups>`}</ext></extLst>`}toDrawingXml(t,e){let r=[],o=xt;return this.images.forEach((i,n)=>{let l=t[n],c=i.from,a=i.to,d=`<xdr:from><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:from>`,m;if(a){let u=`<xdr:to><xdr:col>${a.col}</xdr:col><xdr:colOff>${a.colOff??0}</xdr:colOff><xdr:row>${a.row}</xdr:row><xdr:rowOff>${a.rowOff??0}</xdr:rowOff></xdr:to>`;m=`<xdr:twoCellAnchor editAs="oneCell">${d}${u}`}else{let u=o(i.width??100),$=o(i.height??100);m=`<xdr:oneCellAnchor>${d}<xdr:ext cx="${u}" cy="${$}"/>`}let p=`<xdr:pic>
27
+ ${$}
28
+ ${y}
29
+ ${f}
30
+ ${I}
31
+ ${this.preservedXml.join(`
32
+ `)}
33
+ </worksheet>`}toChartSheetXml(){let t=this._pageMarginsXml(),e=this._pageSetupXml();return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
34
+ <chartsheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
35
+ xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
36
+ <sheetPr/>
37
+ <sheetViews><sheetView zoomScale="99" workbookViewId="0" zoomToFit="1"/></sheetViews>
38
+ ${t||'<pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/>'}
39
+ ${e}
40
+ <drawing r:id="${this.drawingRId}"/>
41
+ </chartsheet>`}toDialogSheetXml(t,e){let n=this._pageMarginsXml(),r=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
42
+ <dialogsheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
43
+ xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
44
+ <sheetViews><sheetView showRowColHeaders="0" showZeros="0" showOutlineSymbols="0" workbookViewId="0"/></sheetViews>
45
+ <sheetFormatPr baseColWidth="10" defaultColWidth="1" defaultRowHeight="5.65" customHeight="1"/>
46
+ <sheetProtection sheet="1"/>
47
+ ${n||'<pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/>'}
48
+ ${r}
49
+ </dialogsheet>`}_sheetViewXml(){let t=this.view??{},e=['workbookViewId="0"',t.showGridLines===!1?'showGridLines="0"':"",t.showRowColHeaders===!1?'showRowColHeaders="0"':"",t.zoomScale!==void 0?`zoomScale="${t.zoomScale}"`:"",t.rightToLeft?'rightToLeft="1"':"",t.tabSelected?'tabSelected="1"':"",t.view?`view="${t.view}"`:""].filter(Boolean),n="";if(this.freezePane){let{row:r=0,col:s=0}=this.freezePane,i=r&&s?Yt(r+1,s+1):r?Yt(r+1,1):Yt(1,s+1),a=r&&s?"bottomRight":r?"bottomLeft":"topRight";n=`<pane xSplit="${s}" ySplit="${r}" topLeftCell="${i}" activePane="${a}" state="frozen"/>
50
+ <selection pane="${a}" activeCell="${i}" sqref="${i}"/>`}return`<sheetViews><sheetView ${e.join(" ")}>${n}</sheetView></sheetViews>`}_colsXml(t){return this.colDefs.size?`<cols>${[...this.colDefs.entries()].sort((r,s)=>r[0]-s[0]).map(([r,s])=>{let i=s.style?t.register(s.style):0;return`<col min="${r}" max="${r}"`+(s.width?` width="${s.width}" customWidth="1"`:"")+(s.hidden?' hidden="1"':"")+(s.bestFit?' bestFit="1"':"")+(s.outlineLevel?` outlineLevel="${s.outlineLevel}"`:"")+(s.collapsed?' collapsed="1"':"")+(i?` style="${i}"`:"")+"/>"}).join("")}</cols>`:""}_sheetDataXml(t,e){let n=[...this.cells.entries()].sort((s,i)=>s[0]-i[0]),r=["<sheetData>"];for(let s=0;s<n.length;s++){let[i,a]=n[s],l=this.rowDefs.get(i),m=l?.style?t.register(l.style):0,c=`r="${i}"`;l?.height&&(c+=` ht="${l.height}" customHeight="1"`),l?.hidden&&(c+=' hidden="1"'),l?.outlineLevel&&(c+=` outlineLevel="${l.outlineLevel}"`),l?.collapsed&&(c+=' collapsed="1"'),m&&(c+=` s="${m}" customFormat="1"`),l?.thickTop&&(c+=' thickTop="1"'),l?.thickBot&&(c+=' thickBot="1"'),r.push(`<row ${c}>`);let h=[...a.entries()].sort((d,f)=>d[0]-f[0]);for(let d=0;d<h.length;d++)r.push(this._cellXml(i,h[d][0],h[d][1],t,e));r.push("</row>")}return r.push("</sheetData>"),r.join("")}_cellXml(t,e,n,r,s){let i=`${Dt(e)}${t}`,a=n.style?r.register(n.style):0,l=a?` s="${a}"`:"",m=this._cellImageVm.get(i),c=m!==void 0?` vm="${m}"`:"";if(n.arrayFormula){let f=`<f t="array" ref="${i}">${ro(n.arrayFormula)}</f>`;return`<c r="${i}"${l}${c}>${f}<v>0</v></c>`}if(n._sharedIdx!==void 0){let f=n._sharedIdx,p=n._sharedRef;if(n.formula&&p){let u=`<f t="shared" ref="${p}" si="${f}">${ro(n.formula)}</f>`;return`<c r="${i}"${l}${c}>${u}</c>`}return`<c r="${i}"${l}${c}><f t="shared" si="${f}"/></c>`}if(n.formula){let f=`<f>${ro(n.formula)}</f>`;return`<c r="${i}"${l}${c}>${f}</c>`}if(n.richText){let f=s.internRichText(n.richText);return`<c r="${i}" t="s"${l}${c}><v>${f}</v></c>`}let h=n.value;if(h==null)return c?`<c r="${i}"${l} t="e"${c}><v>#VALUE!</v></c>`:a?`<c r="${i}"${l}/>`:"";if(h instanceof jt)return`<c r="${i}" t="e"${l}${c}><v>${b(h.error)}</v></c>`;if(typeof h=="boolean")return`<c r="${i}" t="b"${l}${c}><v>${h?1:0}</v></c>`;if(h instanceof Date){let f=eo(h);return`<c r="${i}"${l}${c}><v>${f}</v></c>`}if(typeof h=="number")return`<c r="${i}"${l}${c}><v>${h}</v></c>`;let d=s.intern(h);return`<c r="${i}" t="s"${l}${c}><v>${d}</v></c>`}_mergesXml(){if(!this.merges.length)return"";let t=this.merges.map(e=>{let n=`${Dt(e.startCol)}${e.startRow}`,r=`${Dt(e.endCol)}${e.endRow}`;return`<mergeCell ref="${n}:${r}"/>`});return`<mergeCells count="${this.merges.length}">${t.join("")}</mergeCells>`}_conditionalFormatXml(t){return this.conditionalFormats.map(e=>{let n=e.style?t.registerDxf(e.style):void 0,r="";if(e.colorScale?.type==="colorScale"){let l=e.colorScale,m=l.cfvo.map(h=>`<cfvo type="${h.type}"${h.val?` val="${h.val}"`:""}/>`).join(""),c=l.color.map(h=>Eo(h)).join("");r=`<colorScale>${m}${c}</colorScale>`}else if(e.dataBar?.type==="dataBar"){let l=e.dataBar,m=`<cfvo type="${l.minType??"min"}"${l.minVal!=null?` val="${l.minVal}"`:""}/>`,c=`<cfvo type="${l.maxType??"max"}"${l.maxVal!=null?` val="${l.maxVal}"`:""}/>`,h=l.color??l.minColor??"FF638EC6";r=`<dataBar${l.showValue===!1?' showValue="0"':""}>${m}${c}${Eo(h)}</dataBar>`}else if(e.iconSet?.type==="iconSet"){let l=e.iconSet,m=l.cfvo.map(c=>`<cfvo type="${c.type}"${c.val?` val="${c.val}"`:""}/>`).join("");r=`<iconSet iconSet="${l.iconSet}"${l.showValue===!1?' showValue="0"':""}${l.reverse?' reverse="1"':""}>${m}</iconSet>`}let s=[`type="${e.type}"`,e.operator?`operator="${e.operator}"`:"",n!==void 0?`dxfId="${n}"`:"",`priority="${e.priority??1}"`,e.aboveAverage===!1?'aboveAverage="0"':"",e.percent?'percent="1"':"",e.rank?`rank="${e.rank}"`:"",e.timePeriod?`timePeriod="${e.timePeriod}"`:"",e.text?`text="${b(e.text)}"`:""].filter(Boolean).join(" "),i=e.formula?`<formula>${b(e.formula)}</formula>`:"",a=e.formula2?`<formula>${b(e.formula2)}</formula>`:"";return`<conditionalFormatting sqref="${e.sqref}"><cfRule ${s}>${i}${a}${r}</cfRule></conditionalFormatting>`}).join("")}_dataValidationsXml(){if(!this.dataValidations.size)return"";let t=[...this.dataValidations.entries()].map(([e,n])=>{let r=n.type==="list"&&n.list?`<formula1>"${n.list.join(",")}"</formula1>`:n.formula1?`<formula1>${b(n.formula1)}</formula1>`:"",s=n.formula2?`<formula2>${b(n.formula2)}</formula2>`:"";return`<dataValidation ${[`type="${n.type}"`,n.operator?`operator="${n.operator}"`:"",`sqref="${e}"`,n.showDropDown!==!1&&n.type==="list"?"":'showDropDown="1"',n.allowBlank!==!1?'allowBlank="1"':"",n.showErrorAlert?'showErrorMessage="1"':"",n.errorTitle?`errorTitle="${b(n.errorTitle)}"`:"",n.error?`error="${b(n.error)}"`:"",n.showInputMessage?'showInputMessage="1"':"",n.promptTitle?`promptTitle="${b(n.promptTitle)}"`:"",n.prompt?`prompt="${b(n.prompt)}"`:""].filter(Boolean).join(" ")}>${r}${s}</dataValidation>`});return`<dataValidations count="${this.dataValidations.size}">${t.join("")}</dataValidations>`}_protectionXml(){let t=this.protection;return t?`<sheetProtection ${[t.sheet?'sheet="1"':"",t.password?`password="${Vn(t.password)}"`:"",t.selectLockedCells===!1?'selectLockedCells="0"':"",t.selectUnlockedCells===!1?'selectUnlockedCells="0"':"",t.formatCells?'formatCells="0"':"",t.formatColumns?'formatColumns="0"':"",t.formatRows?'formatRows="0"':"",t.insertColumns?'insertColumns="0"':"",t.insertRows?'insertRows="0"':"",t.insertHyperlinks?'insertHyperlinks="0"':"",t.deleteColumns?'deleteColumns="0"':"",t.deleteRows?'deleteRows="0"':"",t.sort?'sort="0"':"",t.autoFilter?'autoFilter="0"':"",t.pivotTables?'pivotTables="0"':""].filter(Boolean).join(" ")}/>`:""}_pageSetupXml(){let t=this.pageSetup;return t?`<pageSetup ${[t.paperSize?`paperSize="${t.paperSize}"`:"",t.orientation?`orientation="${t.orientation}"`:"",t.fitToWidth!==void 0?`fitToWidth="${t.fitToWidth}"`:"",t.fitToHeight!==void 0?`fitToHeight="${t.fitToHeight}"`:"",t.scale?`scale="${t.scale}"`:"",t.horizontalDpi?`horizontalDpi="${t.horizontalDpi}"`:"",t.verticalDpi?`verticalDpi="${t.verticalDpi}"`:"",t.firstPageNumber?`firstPageNumber="${t.firstPageNumber}" useFirstPageNumber="1"`:""].filter(Boolean).join(" ")}/>`:""}_pageMarginsXml(){let t=this.pageMargins,n={...{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},...t};return`<pageMargins left="${n.left}" right="${n.right}" top="${n.top}" bottom="${n.bottom}" header="${n.header}" footer="${n.footer}"/>`}_headerFooterXml(){let t=this.headerFooter;if(!t)return"";let e=[t.differentOddEven?'differentOddEven="1"':"",t.differentFirst?'differentFirst="1"':""].filter(Boolean).join(" "),n=t.oddHeader?`<oddHeader>${b(t.oddHeader)}</oddHeader>`:"",r=t.oddFooter?`<oddFooter>${b(t.oddFooter)}</oddFooter>`:"",s=t.evenHeader?`<evenHeader>${b(t.evenHeader)}</evenHeader>`:"",i=t.evenFooter?`<evenFooter>${b(t.evenFooter)}</evenFooter>`:"",a=t.firstHeader?`<firstHeader>${b(t.firstHeader)}</firstHeader>`:"",l=t.firstFooter?`<firstFooter>${b(t.firstFooter)}</firstFooter>`:"";return`<headerFooter${e?" "+e:""}>${n}${r}${s}${i}${a}${l}</headerFooter>`}_printOptionsXml(){let t=this.printOptions;if(!t)return"";let e=[t.gridLines?'gridLines="1"':"",t.gridLinesSet?'gridLinesSet="1"':"",t.headings?'headings="1"':"",t.centerHorizontal?'horizontalCentered="1"':"",t.centerVertical?'verticalCentered="1"':""].filter(Boolean).join(" ");return e?`<printOptions ${e}/>`:""}_pageBreaksXml(t,e,n){if(!e.length)return"";let r=e.filter(i=>i.manual!==!1).length,s=e.map(i=>`<brk id="${i.id}" max="${n}"${i.manual!==!1?' man="1"':""}/>`).join("");return`<${t} count="${e.length}" manualBreakCount="${r}">${s}</${t}>`}_formControlsXml(){if(!this.formControls.length||!this.ctrlPropRIds.length)return"";let t=1025+this.sheetIndex*1e3,e=0;for(let r of this.cells.values())for(let s of r.values())s.comment&&e++;return`<mc:AlternateContent><mc:Choice Requires="x14"><controls>${this.formControls.map((r,s)=>{let i=r._shapeId??t+e+s,a=this.ctrlPropRIds[s];if(!a)return"";let l=r.text??`${r.type} ${s+1}`;return`<mc:AlternateContent><mc:Choice Requires="x14"><control shapeId="${i}" r:id="${a}" name="${b(l)}"><controlPr defaultSize="0" print="0" autoFill="0" autoPict="0"${r.macro?` macro="${b(r.macro)}"`:""}><anchor moveWithCells="1"><from><xdr:col>${r.from.col}</xdr:col><xdr:colOff>${r.from.colOff??0}</xdr:colOff><xdr:row>${r.from.row}</xdr:row><xdr:rowOff>${r.from.rowOff??0}</xdr:rowOff></from><to><xdr:col>${r.to.col}</xdr:col><xdr:colOff>${r.to.colOff??0}</xdr:colOff><xdr:row>${r.to.row}</xdr:row><xdr:rowOff>${r.to.rowOff??0}</xdr:rowOff></to></anchor></controlPr></control></mc:Choice></mc:AlternateContent>`}).join("")}</controls></mc:Choice></mc:AlternateContent>`}_sparklineXml(){if(!this.sparklines.length)return"";let t=(r,s)=>{if(!s)return"";let i=s.startsWith("#")?"FF"+s.slice(1):s;return`<x14:${r} rgb="${i}"/>`};return`<extLst><ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">${`<x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">${this.sparklines.map(r=>{let i=[`type="${r.type==="bar"?"column":r.type}"`,r.lineWidth!==void 0?`lineWeight="${r.lineWidth}"`:"",r.showMarkers?'markers="1"':"",r.showFirst?'first="1"':"",r.showLast?'last="1"':"",r.showHigh?'high="1"':"",r.showLow?'low="1"':"",r.showNegative?'negative="1"':"",r.minAxisType?`minAxisType="${r.minAxisType}"`:"",r.maxAxisType?`maxAxisType="${r.maxAxisType}"`:""].filter(Boolean).join(" "),a=[t("colorSeries",r.color),t("colorHigh",r.highColor),t("colorLow",r.lowColor),t("colorFirst",r.firstColor),t("colorLast",r.lastColor),t("colorNegative",r.negativeColor),t("colorMarkers",r.markersColor)].join(""),l=r.dataRange.includes("!")?r.dataRange:`${this.name}!${r.dataRange}`,m=`<x14:sparklines><x14:sparkline><xm:f>${b(l)}</xm:f><xm:sqref>${r.location}</xm:sqref></x14:sparkline></x14:sparklines>`;return`<x14:sparklineGroup ${i}>${a}${m}</x14:sparklineGroup>`}).join("")}</x14:sparklineGroups>`}</ext></extLst>`}_customIconExtXml(){let t=this.conditionalFormats.filter(n=>n.iconSet?.type==="iconSet"&&"custom"in n.iconSet&&n.iconSet.custom?.length);return t.length?`<extLst><ext uri="{78C0D931-6437-407d-A8EE-F0AAD7539E65}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">${t.map((n,r)=>{let s=n.iconSet,i=s.cfvo.map(l=>`<x14:cfvo type="${l.type}"${l.val?` val="${l.val}"`:""}/>`).join(""),a=s.custom.map(l=>`<x14:cfIcon iconSet="${l.iconSet}" iconId="${l.iconId}"/>`).join("");return`<x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"><x14:cfRule type="iconSet" id="{${this._uuid()}}"><x14:iconSet iconSet="${s.iconSet}" custom="1"${s.showValue===!1?' showValue="0"':""}${s.reverse?' reverse="1"':""}>${i}${a}</x14:iconSet></x14:cfRule><xm:sqref>${n.sqref}</xm:sqref></x14:conditionalFormatting>`}).join("")}</ext></extLst>`:""}_uuid(){let t="0123456789ABCDEF",e="";for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?e+="-":n===14?e+="4":n===19?e+=t[(Math.random()*4|0)+8]:e+=t[Math.random()*16|0];return e}_autoFilterXml(){if(!this.autoFilter)return"";let t=this._filterColumns;if(!t||t.length===0)return`<autoFilter ref="${this.autoFilter.ref}"/>`;let e=t.map(n=>{let r=n.col-1,s="";return n.type==="custom"?s=`<customFilters><customFilter operator="${n.operator??"greaterThan"}" val="${n.val??""}"/></customFilters>`:n.type==="top10"?s=`<top10 ${[n.top===!1?'top="0"':"",n.percent?'percent="1"':"",`val="${n.val??10}"`].filter(Boolean).join(" ")}/>`:n.type==="value"&&n.items?s=`<filters>${n.items.map(i=>`<filter val="${b(String(i))}"/>`).join("")}</filters>`:n.type==="dynamic"&&(s=`<dynamicFilter type="${n.dynamicType??"aboveAverage"}"/>`),`<filterColumn colId="${r}">${s}</filterColumn>`}).join("");return`<autoFilter ref="${this.autoFilter.ref}">${e}</autoFilter>`}_ignoredErrorsXml(){return this.ignoreErrors.length?`<ignoredErrors>${this.ignoreErrors.map(e=>{let n=[`sqref="${e.sqref}"`];return e.numberStoredAsText&&n.push('numberStoredAsText="1"'),e.formula&&n.push('formula="1"'),e.formulaRange&&n.push('formulaRange="1"'),e.unlockedFormula&&n.push('unlockedFormula="1"'),e.evalError&&n.push('evalError="1"'),e.twoDigitTextYear&&n.push('twoDigitTextYear="1"'),e.emptyRef&&n.push('emptyRef="1"'),e.listDataValidation&&n.push('listDataValidation="1"'),e.calculatedColumn&&n.push('calculatedColumn="1"'),`<ignoredError ${n.join(" ")}/>`}).join("")}</ignoredErrors>`:""}toDrawingXml(t,e){let n=[],r=oo;this.images.forEach((a,l)=>{let m=t[l],c=r(a.width??100),h=r(a.height??100),d,f;if(a.position)d=`<xdr:absoluteAnchor><xdr:pos x="${r(a.position.x)}" y="${r(a.position.y)}"/><xdr:ext cx="${c}" cy="${h}"/>`,f="</xdr:absoluteAnchor>";else{let u=a.from,x=a.to,$=`<xdr:from><xdr:col>${u.col}</xdr:col><xdr:colOff>${u.colOff??0}</xdr:colOff><xdr:row>${u.row}</xdr:row><xdr:rowOff>${u.rowOff??0}</xdr:rowOff></xdr:from>`;if(x){let y=`<xdr:to><xdr:col>${x.col}</xdr:col><xdr:colOff>${x.colOff??0}</xdr:colOff><xdr:row>${x.row}</xdr:row><xdr:rowOff>${x.rowOff??0}</xdr:rowOff></xdr:to>`;d=`<xdr:twoCellAnchor editAs="oneCell">${$}${y}`,f="</xdr:twoCellAnchor>"}else d=`<xdr:oneCellAnchor>${$}<xdr:ext cx="${c}" cy="${h}"/>`,f="</xdr:oneCellAnchor>"}let p=`<xdr:pic>
25
51
  <xdr:nvPicPr>
26
- <xdr:cNvPr id="${n+2}" name="Image ${n+1}"${i.altText?` descr="${g(i.altText)}"`:""}/>
52
+ <xdr:cNvPr id="${l+2}" name="Image ${l+1}"${a.altText?` descr="${b(a.altText)}"`:""}/>
27
53
  <xdr:cNvPicPr><a:picLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></xdr:cNvPicPr>
28
54
  </xdr:nvPicPr>
29
55
  <xdr:blipFill>
30
- <a:blip xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:embed="${l}"/>
56
+ <a:blip xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:embed="${m}"/>
31
57
  <a:stretch xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:fillRect/></a:stretch>
32
58
  </xdr:blipFill>
33
59
  <xdr:spPr>
34
60
  <a:xfrm xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
35
- <a:off x="0" y="0"/><a:ext cx="${o(i.width??100)}" cy="${o(i.height??100)}"/>
61
+ <a:off x="0" y="0"/><a:ext cx="${c}" cy="${h}"/>
36
62
  </a:xfrm>
37
63
  <a:prstGeom xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" prst="rect"><a:avLst/></a:prstGeom>
38
64
  </xdr:spPr>
39
- </xdr:pic>`,h=a?"</xdr:twoCellAnchor>":"</xdr:oneCellAnchor>";r.push(`${m}${p}<xdr:clientData/>${h}`)}),this.charts.forEach((i,n)=>{let l=e[n],c=i.from,a=i.to,d=`<xdr:from><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:from>`,m=`<xdr:to><xdr:col>${a.col}</xdr:col><xdr:colOff>${a.colOff??0}</xdr:colOff><xdr:row>${a.row}</xdr:row><xdr:rowOff>${a.rowOff??0}</xdr:rowOff></xdr:to>`,p=`<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
65
+ </xdr:pic>`;n.push(`${d}${p}<xdr:clientData/>${f}`)}),this.charts.forEach((a,l)=>{let m=e[l],c=a.from,h=a.to,d=`<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
40
66
  <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
41
- <c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" r:id="${l}"/>
67
+ <c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" r:id="${m}"/>
42
68
  </a:graphicData>
43
- </a:graphic>`;r.push(`<xdr:twoCellAnchor editAs="oneCell">${d}${m}<xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+n+2}" name="Chart ${n+1}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${p}</xdr:graphicFrame><xdr:clientData/></xdr:twoCellAnchor>`)}),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
69
+ </a:graphic>`;if(this._isChartSheet)n.push(`<xdr:absoluteAnchor><xdr:pos x="0" y="0"/><xdr:ext cx="9294091" cy="6003636"/><xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+l+2}" name="Chart ${l+1}"/><xdr:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noGrp="1"/></xdr:cNvGraphicFramePr></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${d}</xdr:graphicFrame><xdr:clientData/></xdr:absoluteAnchor>`);else{let f=`<xdr:from><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:from>`,p=`<xdr:to><xdr:col>${h.col}</xdr:col><xdr:colOff>${h.colOff??0}</xdr:colOff><xdr:row>${h.row}</xdr:row><xdr:rowOff>${h.rowOff??0}</xdr:rowOff></xdr:to>`;n.push(`<xdr:twoCellAnchor editAs="oneCell">${f}${p}<xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+l+2}" name="Chart ${l+1}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${d}</xdr:graphicFrame><xdr:clientData/></xdr:twoCellAnchor>`)}});let s=this.images.length+this.charts.length+2,i=a=>{let l=a.replace(/^#/,"");return l.length===8&&(l=l.substring(2)),l};this.shapes.forEach(a=>{let l=s++,m=a.from,c=a.to,h=`<xdr:from><xdr:col>${m.col}</xdr:col><xdr:colOff>${m.colOff??0}</xdr:colOff><xdr:row>${m.row}</xdr:row><xdr:rowOff>${m.rowOff??0}</xdr:rowOff></xdr:from>`,d=`<xdr:to><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:to>`,f=a.fillColor?`<a:solidFill><a:srgbClr val="${i(a.fillColor)}"/></a:solidFill>`:"<a:noFill/>",p=a.lineColor?`<a:ln${a.lineWidth?` w="${a.lineWidth*12700}"`:""}><a:solidFill><a:srgbClr val="${i(a.lineColor)}"/></a:solidFill></a:ln>`:"",u=a.rotation?` rot="${a.rotation*6e4}"`:"",x=a.text?`<xdr:txBody><a:bodyPr vertOverflow="clip" wrap="square" rtlCol="0" anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r><a:rPr lang="en-US"${a.font?.bold?' b="1"':""}${a.font?.size?` sz="${a.font.size*100}"`:""}/><a:t>${b(a.text)}</a:t></a:r></a:p></xdr:txBody>`:"";n.push(`<xdr:twoCellAnchor editAs="oneCell">${h}${d}<xdr:sp><xdr:nvSpPr><xdr:cNvPr id="${l}" name="Shape ${l}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr><a:xfrm${u}><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></a:xfrm><a:prstGeom prst="${a.type}"><a:avLst/></a:prstGeom>${f}${p}</xdr:spPr>${x}</xdr:sp><xdr:clientData/></xdr:twoCellAnchor>`)}),this.wordArt.forEach(a=>{let l=s++,m=a.from,c=a.to,h=`<xdr:from><xdr:col>${m.col}</xdr:col><xdr:colOff>${m.colOff??0}</xdr:colOff><xdr:row>${m.row}</xdr:row><xdr:rowOff>${m.rowOff??0}</xdr:rowOff></xdr:from>`,d=`<xdr:to><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:to>`,f=a.preset??"textPlain",p=a.font?.size?a.font.size*100:3600,u=a.fillColor?i(a.fillColor):"",x=a.outlineColor?i(a.outlineColor):"",$=u?`<a:solidFill><a:srgbClr val="${u}"/></a:solidFill>`:'<a:solidFill><a:schemeClr val="tx1"/></a:solidFill>',y=x?`<a:ln w="12700"><a:solidFill><a:srgbClr val="${x}"/></a:solidFill><a:prstDash val="solid"/></a:ln>`:"",I='<a:effectLst><a:outerShdw dist="38100" dir="2700000" algn="bl" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="40000"/></a:srgbClr></a:outerShdw></a:effectLst>',R=['lang="en-US"',`sz="${p}"`,(a.font?.bold,'b="1"'),a.font?.italic?'i="1"':"",'cap="none" spc="0"'].filter(Boolean).join(" "),w=a.font?.name??"Calibri",C=f!=="textPlain"?`<a:prstTxWarp prst="${f}"><a:avLst/></a:prstTxWarp>`:"";n.push(`<xdr:twoCellAnchor editAs="oneCell">${h}${d}<xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="WordArt ${l}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr wrap="square" lIns="91440" tIns="45720" rIns="91440" bIns="45720">${C}<a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r><a:rPr ${R}>${y}${$}${I}<a:latin typeface="${b(w)}"/></a:rPr><a:t>${b(a.text)}</a:t></a:r></a:p></xdr:txBody></xdr:sp><xdr:clientData/></xdr:twoCellAnchor>`)}),this.mathEquations.forEach(a=>{let l=s++,m=a.from,c=`<xdr:from><xdr:col>${m.col}</xdr:col><xdr:colOff>${m.colOff??0}</xdr:colOff><xdr:row>${m.row}</xdr:row><xdr:rowOff>${m.rowOff??0}</xdr:rowOff></xdr:from>`,h=a.width??18e5,d=a.height??5e5,f=`<xdr:ext cx="${h}" cy="${d}"/>`,p=a.fontSize?a.fontSize*100:1100,u=a.fontName??"Cambria Math",x=`<a:rPr lang="en-US" sz="${p}" i="1"><a:latin typeface="${b(u)}" panose="02040503050406030204" pitchFamily="18" charset="0"/></a:rPr>`,$=`<m:ctrlPr>${x}</m:ctrlPr>`,y=g=>{switch(g.type){case"text":return`<m:r>${x}<m:t>${b(g.text??"")}</m:t></m:r>`;case"frac":return`<m:f><m:fPr>${g.hideDegree?'<m:type m:val="noBar"/>':""}${$}</m:fPr><m:num>${(g.base??[]).map(y).join("")}</m:num><m:den>${(g.argument??[]).map(y).join("")}</m:den></m:f>`;case"sup":return`<m:sSup><m:sSupPr>${$}</m:sSupPr><m:e>${(g.base??[]).map(y).join("")}</m:e><m:sup>${(g.argument??[]).map(y).join("")}</m:sup></m:sSup>`;case"sub":return`<m:sSub><m:sSubPr>${$}</m:sSubPr><m:e>${(g.base??[]).map(y).join("")}</m:e><m:sub>${(g.argument??[]).map(y).join("")}</m:sub></m:sSub>`;case"subSup":return`<m:sSubSup><m:sSubSupPr>${$}</m:sSubSupPr><m:e>${(g.base??[]).map(y).join("")}</m:e><m:sub>${(g.subscript??[]).map(y).join("")}</m:sub><m:sup>${(g.superscript??[]).map(y).join("")}</m:sup></m:sSubSup>`;case"nary":{let M=g.operator??"\u2211";return`<m:nary><m:naryPr><m:chr m:val="${b(M)}"/>${$}</m:naryPr><m:sub>${(g.lower??[]).map(y).join("")}</m:sub><m:sup>${(g.upper??[]).map(y).join("")}</m:sup><m:e>${(g.body??[]).map(y).join("")}</m:e></m:nary>`}case"rad":return`<m:rad><m:radPr>${g.hideDegree?'<m:degHide m:val="1"/>':""}${$}</m:radPr><m:deg>${(g.degree??[]).map(y).join("")}</m:deg><m:e>${(g.body??[]).map(y).join("")}</m:e></m:rad>`;case"delim":{let M=g.open??"(",T=g.close??")";return`<m:d><m:dPr>${M!=="("?`<m:begChr m:val="${b(M)}"/>`:""}${T!==")"?`<m:endChr m:val="${b(T)}"/>`:""}${$}</m:dPr><m:e>${(g.body??[]).map(y).join("")}</m:e></m:d>`}case"func":return`<m:func><m:funcPr>${$}</m:funcPr><m:fName>${(g.base??[]).map(y).join("")}</m:fName><m:e>${(g.argument??[]).map(y).join("")}</m:e></m:func>`;case"accent":return`<m:acc><m:accPr>${g.operator?`<m:chr m:val="${b(g.operator)}"/>`:""}${$}</m:accPr><m:e>${(g.body??[]).map(y).join("")}</m:e></m:acc>`;case"bar":return`<m:bar><m:barPr>${$}</m:barPr><m:e>${(g.body??[]).map(y).join("")}</m:e></m:bar>`;case"matrix":return`<m:m><m:mPr>${$}</m:mPr>${(g.rows??[]).map(M=>`<m:mr>${M.map(T=>`<m:e>${y(T)}</m:e>`).join("")}</m:mr>`).join("")}</m:m>`;case"eqArr":return`<m:eqArr><m:eqArrPr>${$}</m:eqArrPr>${(g.rows??[]).map(M=>`<m:e>${M.map(y).join("")}</m:e>`).join("")}</m:eqArr>`;case"limLow":return`<m:limLow><m:limLowPr>${$}</m:limLowPr><m:e>${(g.base??[]).map(y).join("")}</m:e><m:lim>${(g.argument??[]).map(y).join("")}</m:lim></m:limLow>`;case"limUpp":return`<m:limUpp><m:limUppPr>${$}</m:limUppPr><m:e>${(g.base??[]).map(y).join("")}</m:e><m:lim>${(g.argument??[]).map(y).join("")}</m:lim></m:limUpp>`;case"groupChar":return`<m:groupChr><m:groupChrPr>${g.operator?`<m:chr m:val="${b(g.operator)}"/>`:""}${$}</m:groupChrPr><m:e>${(g.body??[]).map(y).join("")}</m:e></m:groupChr>`;default:return`<m:r>${x}<m:t>${b(g.text??"")}</m:t></m:r>`}},R=`<m:oMathPara xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><m:oMathParaPr><m:jc m:val="centerGroup"/></m:oMathParaPr><m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">${a.elements.map(y).join("")}</m:oMath></m:oMathPara>`,w=g=>{if(g.text)return g.text;let M=[g.base,g.argument,g.body,g.lower,g.upper,g.superscript,g.subscript,g.degree].filter(Boolean).map(T=>T.map(w).join("")).join("");return g.type==="frac"?`(${(g.base??[]).map(w).join("")})/(${(g.argument??[]).map(w).join("")})`:g.type==="sup"?`${(g.base??[]).map(w).join("")}^${(g.argument??[]).map(w).join("")}`:g.type==="nary"?`${g.operator??"\u2211"}(${(g.body??[]).map(w).join("")})`:g.type==="delim"?`${g.open??"("}${(g.body??[]).map(w).join("")}${g.close??")"}`:g.type==="rad"?`\u221A(${(g.body??[]).map(w).join("")})`:M},C=a.elements.map(w).join("");n.push(`<xdr:oneCellAnchor>${c}${f}<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" Requires="a14"><xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="MathEq ${l}"/><xdr:cNvSpPr txBox="1"/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${h}" cy="${d}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" rtlCol="0" anchor="t"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a14:m>${R}</a14:m><a:endParaRPr lang="en-US" sz="${p}"/></a:p></xdr:txBody></xdr:sp></mc:Choice><mc:Fallback><xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="MathEq ${l}"/><xdr:cNvSpPr txBox="1"/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${h}" cy="${d}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" rtlCol="0" anchor="t"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" sz="${p}" i="0"><a:latin typeface="${b(u)}" panose="02040503050406030204" pitchFamily="18" charset="0"/></a:rPr><a:t>${b(C)}</a:t></a:r><a:endParaRPr lang="en-US" sz="${p}"/></a:p></xdr:txBody></xdr:sp></mc:Fallback></mc:AlternateContent><xdr:clientData/></xdr:oneCellAnchor>`)});for(let a of this._slicerDrawingInfo){let l=s++,{row:m,col:c}=a.cell?Mt(a.cell):{row:1,col:6},h=c-1,d=m-1,f=h+2,p=d+12;n.push(`<xdr:twoCellAnchor editAs="oneCell"><xdr:from><xdr:col>${h}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${d}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:from><xdr:to><xdr:col>${f}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${p}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:to><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:sle15="http://schemas.microsoft.com/office/drawing/2012/slicer" Requires="sle15"><xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${l}" name="${b(a.name)}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></xdr:xfrm><a:graphic><a:graphicData uri="http://schemas.microsoft.com/office/drawing/2010/slicer"><sle:slicer xmlns:sle="http://schemas.microsoft.com/office/drawing/2010/slicer" name="${b(a.name)}"/></a:graphicData></a:graphic></xdr:graphicFrame></mc:Choice><mc:Fallback/></mc:AlternateContent><xdr:clientData/></xdr:twoCellAnchor>`)}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
44
70
  <xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
71
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
45
72
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
46
- ${r.join(`
73
+ ${n.join(`
47
74
  `)}
48
- </xdr:wsDr>`}};function ie(s){let t=0;for(let e=s.length-1;e>=0;e--)t=t>>14&1|t<<1&32767,t^=s.charCodeAt(e);return t=t>>14&1|t<<1&32767,t^=s.length,t^=52811,t.toString(16).toUpperCase().padStart(4,"0")}function mt(s){let t=[];return s.bold&&t.push("<b/>"),s.italic&&t.push("<i/>"),s.strike&&t.push("<strike/>"),s.underline&&s.underline!=="none"&&t.push(`<u val="${s.underline}"/>`),s.vertAlign&&t.push(`<vertAlign val="${s.vertAlign}"/>`),s.size&&t.push(`<sz val="${s.size}"/>`),s.color&&t.push(`<color rgb="${s.color.startsWith("#")?"FF"+s.color.slice(1):s.color}"/>`),s.name&&t.push(`<name val="${g(s.name)}"/>`),s.family&&t.push(`<family val="${s.family}"/>`),s.scheme&&t.push(`<scheme val="${s.scheme}"/>`),s.charset&&t.push(`<charset val="${s.charset}"/>`),t.join("")}function ht(s){if(s.type==="pattern"){let o=s,i=o.fgColor?`<fgColor rgb="${o.fgColor.startsWith("#")?"FF"+o.fgColor.slice(1):o.fgColor}"/>`:"",n=o.bgColor?`<bgColor rgb="${o.bgColor.startsWith("#")?"FF"+o.bgColor.slice(1):o.bgColor}"/>`:"";return`<patternFill patternType="${o.pattern}">${i}${n}</patternFill>`}let t=s,e=t.stops.map(o=>`<stop position="${o.position}"><color rgb="${o.color.startsWith("#")?"FF"+o.color.slice(1):o.color}"/></stop>`).join("");return`<gradientFill ${[t.gradientType?`type="${t.gradientType}"`:"",t.degree!==void 0?`degree="${t.degree}"`:"",t.left!==void 0?`left="${t.left}"`:"",t.right!==void 0?`right="${t.right}"`:"",t.top!==void 0?`top="${t.top}"`:"",t.bottom!==void 0?`bottom="${t.bottom}"`:""].filter(Boolean).join(" ")}>${e}</gradientFill>`}function nt(s,t){if(!t)return`<${s}/>`;let e=t.color?`<color rgb="${t.color.startsWith("#")?"FF"+t.color.slice(1):t.color}"/>`:"";return t.style?`<${s} style="${t.style}">${e}</${s}>`:`<${s}/>`}function $t(s){let t=[s.diagonalUp?'diagonalUp="1"':"",s.diagonalDown?'diagonalDown="1"':""].filter(Boolean).join(" ");return`<border${t?" "+t:""}>`+nt("left",s.left)+nt("right",s.right)+nt("top",s.top)+nt("bottom",s.bottom)+nt("diagonal",s.diagonal)+"</border>"}function ae(s){return`<alignment ${[s.horizontal?`horizontal="${s.horizontal}"`:"",s.vertical?`vertical="${s.vertical}"`:"",s.wrapText?'wrapText="1"':"",s.shrinkToFit?'shrinkToFit="1"':"",s.textRotation!==void 0?`textRotation="${s.textRotation}"`:"",s.indent?`indent="${s.indent}"`:"",s.readingOrder!==void 0?`readingOrder="${s.readingOrder}"`:""].filter(Boolean).join(" ")}/>`}var Y=class{constructor(){this.fonts=[],this.fills=[],this.borders=[],this.numFmts=new Map,this.xfs=[],this.styleKey=new Map,this.dxfs=[],this.nextNumFmtId=164,this.fonts.push(mt({name:"Calibri",size:11,scheme:"minor"})),this.fills.push(ht({type:"pattern",pattern:"none"})),this.fills.push(ht({type:"pattern",pattern:"gray125"})),this.borders.push($t({})),this.xfs.push('<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>')}internFont(t){if(!t)return 0;let e=JSON.stringify(t),r=this.fonts.findIndex((o,i)=>this.fonts[i]===mt(t));return r>=0?r:(this.fonts.push(mt(t)),this.fonts.length-1)}internFill(t){if(!t)return 0;let e=ht(t),r=this.fills.indexOf(e);return r>=0?r:(this.fills.push(e),this.fills.length-1)}internBorder(t){if(!t)return 0;let e=$t(t),r=this.borders.indexOf(e);return r>=0?r:(this.borders.push(e),this.borders.length-1)}internNumFmt(t,e){if(e!==void 0)return e;if(!t)return 0;if(this.numFmts.has(t.formatCode))return this.numFmts.get(t.formatCode);let r=this.nextNumFmtId++;return this.numFmts.set(t.formatCode,r),r}register(t){if(!t)return 0;let e=JSON.stringify(t);if(this.styleKey.has(e))return this.styleKey.get(e);let r=this.internFont(t.font),o=this.internFill(t.fill),i=this.internBorder(t.border),n=this.internNumFmt(t.numberFormat,t.numFmtId),l=t.font?' applyFont="1"':"",c=t.fill?' applyFill="1"':"",a=t.border?' applyBorder="1"':"",d=t.alignment?' applyAlignment="1"':"",m=t.numberFormat||t.numFmtId!==void 0?' applyNumberFormat="1"':"",p=t.locked!==void 0||t.hidden!==void 0?' applyProtection="1"':"",h=t.alignment?ae(t.alignment):"",u=t.locked!==void 0||t.hidden!==void 0?`<protection${t.locked!==void 0?` locked="${t.locked?"1":"0"}"`:""}${t.hidden!==void 0?` hidden="${t.hidden?"1":"0"}"`:""}/>`:"",$=`<xf numFmtId="${n}" fontId="${r}" fillId="${o}" borderId="${i}" xfId="0"${l}${c}${a}${d}${m}${p}>${h}${u}</xf>`;this.xfs.push($);let x=this.xfs.length-1;return this.styleKey.set(e,x),x}registerDxf(t){let e=[];if(t.font&&e.push(`<font>${mt(t.font)}</font>`),t.fill&&e.push(`<fill>${ht(t.fill)}</fill>`),t.border&&e.push($t(t.border)),t.numberFormat){let o=this.internNumFmt(t.numberFormat);e.push(`<numFmt numFmtId="${o}" formatCode="${g(t.numberFormat.formatCode)}"/>`)}t.alignment&&e.push(`<alignment${t.alignment.horizontal?` horizontal="${t.alignment.horizontal}"`:""}${t.alignment.vertical?` vertical="${t.alignment.vertical}"`:""}${t.alignment.wrapText?' wrapText="1"':""}${t.alignment.textRotation?` textRotation="${t.alignment.textRotation}"`:""}/>`);let r=e.join("");return this.dxfs.push(r),this.dxfs.length-1}toXml(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
75
+ </xdr:wsDr>`}};function Vn(o){let t=0;for(let e=o.length-1;e>=0;e--)t=t>>14&1|t<<1&32767,t^=o.charCodeAt(e);return t=t>>14&1|t<<1&32767,t^=o.length,t^=52811,t.toString(16).toUpperCase().padStart(4,"0")}function Ce(o,t){if(!t)return"";if(t.startsWith("theme:"))return`<${o} theme="${t.slice(6)}"/>`;let e=t.startsWith("#")?"FF"+t.slice(1):t;return`<${o} rgb="${e}"/>`}function so(o){let t=[];return o.bold&&t.push("<b/>"),o.italic&&t.push("<i/>"),o.strike&&t.push("<strike/>"),o.underline&&o.underline!=="none"&&t.push(`<u val="${o.underline}"/>`),o.vertAlign&&t.push(`<vertAlign val="${o.vertAlign}"/>`),o.size&&t.push(`<sz val="${o.size}"/>`),o.color&&t.push(Ce("color",o.color)),o.name&&t.push(`<name val="${b(o.name)}"/>`),o.family&&t.push(`<family val="${o.family}"/>`),o.scheme&&t.push(`<scheme val="${o.scheme}"/>`),o.charset&&t.push(`<charset val="${o.charset}"/>`),t.join("")}function Be(o){if(o.type==="pattern"){let r=o,s=Ce("fgColor",r.fgColor),i=Ce("bgColor",r.bgColor);return`<patternFill patternType="${r.pattern}">${s}${i}</patternFill>`}let t=o,e=t.stops.map(r=>`<stop position="${r.position}">${Ce("color",r.color)}</stop>`).join("");return`<gradientFill ${[t.gradientType?`type="${t.gradientType}"`:"",t.degree!==void 0?`degree="${t.degree}"`:"",t.left!==void 0?`left="${t.left}"`:"",t.right!==void 0?`right="${t.right}"`:"",t.top!==void 0?`top="${t.top}"`:"",t.bottom!==void 0?`bottom="${t.bottom}"`:""].filter(Boolean).join(" ")}>${e}</gradientFill>`}function ve(o,t){if(!t)return`<${o}/>`;let e=Ce("color",t.color);return t.style?`<${o} style="${t.style}">${e}</${o}>`:`<${o}/>`}function ao(o){let t=[o.diagonalUp?'diagonalUp="1"':"",o.diagonalDown?'diagonalDown="1"':""].filter(Boolean).join(" ");return`<border${t?" "+t:""}>`+ve("left",o.left)+ve("right",o.right)+ve("top",o.top)+ve("bottom",o.bottom)+ve("diagonal",o.diagonal)+"</border>"}function _o(o){return`<alignment ${[o.horizontal?`horizontal="${o.horizontal}"`:"",o.vertical?`vertical="${o.vertical}"`:"",o.wrapText?'wrapText="1"':"",o.shrinkToFit?'shrinkToFit="1"':"",o.textRotation!==void 0?`textRotation="${o.textRotation}"`:"",o.indent?`indent="${o.indent}"`:"",o.readingOrder!==void 0?`readingOrder="${o.readingOrder}"`:""].filter(Boolean).join(" ")}/>`}var ie=class{constructor(){this.fonts=[],this.fills=[],this.borders=[],this.fontIdx=new Map,this.fillIdx=new Map,this.borderIdx=new Map,this.numFmts=new Map,this.xfs=[],this.styleKey=new Map,this.dxfs=[],this.nextNumFmtId=164,this.cellStyleXfs=[],this.cellStyleNames=[],this.tableStyleDefs=[];let t=so({name:"Calibri",size:11,scheme:"minor"});this.fonts.push(t),this.fontIdx.set(t,0);let e=Be({type:"pattern",pattern:"none"}),n=Be({type:"pattern",pattern:"gray125"});this.fills.push(e,n),this.fillIdx.set(e,0),this.fillIdx.set(n,1);let r=ao({});this.borders.push(r),this.borderIdx.set(r,0),this.cellStyleXfs.push('<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>'),this.cellStyleNames.push({name:"Normal",xfId:0,builtinId:0}),this.xfs.push('<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>')}registerNamedStyle(t,e,n){let r=this.internFont(e.font),s=this.internFill(e.fill),i=this.internBorder(e.border),a=this.internNumFmt(e.numberFormat,e.numFmtId),l=e.font?' applyFont="1"':"",m=e.fill?' applyFill="1"':"",c=e.border?' applyBorder="1"':"",h=e.alignment?' applyAlignment="1"':"",d=e.numberFormat||e.numFmtId!==void 0?' applyNumberFormat="1"':"",f=e.alignment?_o(e.alignment):"",p=`<xf numFmtId="${a}" fontId="${r}" fillId="${s}" borderId="${i}"${l}${m}${c}${h}${d}>${f}</xf>`;this.cellStyleXfs.push(p);let u=this.cellStyleXfs.length-1;return this.cellStyleNames.push({name:t,xfId:u,builtinId:n}),u}internFont(t){if(!t)return 0;let e=so(t),n=this.fontIdx.get(e);if(n!==void 0)return n;let r=this.fonts.length;return this.fonts.push(e),this.fontIdx.set(e,r),r}internFill(t){if(!t)return 0;let e=Be(t),n=this.fillIdx.get(e);if(n!==void 0)return n;let r=this.fills.length;return this.fills.push(e),this.fillIdx.set(e,r),r}internBorder(t){if(!t)return 0;let e=ao(t),n=this.borderIdx.get(e);if(n!==void 0)return n;let r=this.borders.length;return this.borders.push(e),this.borderIdx.set(e,r),r}internNumFmt(t,e){if(e!==void 0)return e;if(!t)return 0;if(this.numFmts.has(t.formatCode))return this.numFmts.get(t.formatCode);let n=this.nextNumFmtId++;return this.numFmts.set(t.formatCode,n),n}register(t){if(!t)return 0;let e=JSON.stringify(t);if(this.styleKey.has(e))return this.styleKey.get(e);let n=this.internFont(t.font),r=this.internFill(t.fill),s=this.internBorder(t.border),i=this.internNumFmt(t.numberFormat,t.numFmtId),a=t.font?' applyFont="1"':"",l=t.fill?' applyFill="1"':"",m=t.border?' applyBorder="1"':"",c=t.alignment?' applyAlignment="1"':"",h=t.numberFormat||t.numFmtId!==void 0?' applyNumberFormat="1"':"",d=t.locked!==void 0||t.hidden!==void 0?' applyProtection="1"':"",f=t.alignment?_o(t.alignment):"",p=t.locked!==void 0||t.hidden!==void 0?`<protection${t.locked!==void 0?` locked="${t.locked?"1":"0"}"`:""}${t.hidden!==void 0?` hidden="${t.hidden?"1":"0"}"`:""}/>`:"",u=t.namedStyleId??0,x=`<xf numFmtId="${i}" fontId="${n}" fillId="${r}" borderId="${s}" xfId="${u}"${a}${l}${m}${c}${h}${d}>${f}${p}</xf>`;this.xfs.push(x);let $=this.xfs.length-1;return this.styleKey.set(e,$),$}registerDxf(t){let e=[];if(t.font&&e.push(`<font>${so(t.font)}</font>`),t.numberFormat){let r=this.internNumFmt(t.numberFormat);e.push(`<numFmt numFmtId="${r}" formatCode="${b(t.numberFormat.formatCode)}"/>`)}t.fill&&e.push(`<fill>${Be(t.fill)}</fill>`),t.alignment&&e.push(`<alignment${t.alignment.horizontal?` horizontal="${t.alignment.horizontal}"`:""}${t.alignment.vertical?` vertical="${t.alignment.vertical}"`:""}${t.alignment.wrapText?' wrapText="1"':""}${t.alignment.textRotation?` textRotation="${t.alignment.textRotation}"`:""}/>`),t.border&&e.push(ao(t.border));let n=e.join("");return this.dxfs.push(n),this.dxfs.length-1}prependRawDxfs(t){this.dxfs.unshift(...t)}registerTableStyle(t,e){let n=[];e.headerRow&&n.push({type:"headerRow",dxfId:this.registerDxf(e.headerRow)}),e.totalRow&&n.push({type:"totalRow",dxfId:this.registerDxf(e.totalRow)}),e.dataRow1&&n.push({type:"firstRowStripe",dxfId:this.registerDxf(e.dataRow1)}),e.dataRow2&&n.push({type:"secondRowStripe",dxfId:this.registerDxf(e.dataRow2)}),this.tableStyleDefs.push({name:t,elements:n})}toXml(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
49
76
  <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
50
- ${this.numFmts.size?`<numFmts count="${this.numFmts.size}">${[...this.numFmts.entries()].map(([e,r])=>`<numFmt numFmtId="${r}" formatCode="${g(e)}"/>`).join("")}</numFmts>`:""}
77
+ ${this.numFmts.size?`<numFmts count="${this.numFmts.size}">${[...this.numFmts.entries()].map(([e,n])=>`<numFmt numFmtId="${n}" formatCode="${b(e)}"/>`).join("")}</numFmts>`:""}
51
78
  <fonts count="${this.fonts.length}">${this.fonts.map(e=>`<font>${e}</font>`).join("")}</fonts>
52
79
  <fills count="${this.fills.length}">${this.fills.map(e=>`<fill>${e}</fill>`).join("")}</fills>
53
80
  <borders count="${this.borders.length}">${this.borders.join("")}</borders>
54
- <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
81
+ <cellStyleXfs count="${this.cellStyleXfs.length}">${this.cellStyleXfs.join("")}</cellStyleXfs>
55
82
  <cellXfs count="${this.xfs.length}">${this.xfs.join("")}</cellXfs>
56
- <cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
83
+ <cellStyles count="${this.cellStyleNames.length}">${this.cellStyleNames.map(e=>`<cellStyle name="${b(e.name)}" xfId="${e.xfId}"${e.builtinId!==void 0?` builtinId="${e.builtinId}"`:""}/>`).join("")}</cellStyles>
57
84
  ${this.dxfs.length?`<dxfs count="${this.dxfs.length}">${this.dxfs.map(e=>`<dxf>${e}</dxf>`).join("")}</dxfs>`:""}
58
- </styleSheet>`}};var tt=class{constructor(){this.table=new Map,this.strings=[],this._count=0}get count(){return this._count}get uniqueCount(){return this.strings.length}intern(t){this._count++;let e=this.table.get(t);if(e!==void 0)return e;let r=this.strings.length;return this.strings.push(t),this.table.set(t,r),r}internRichText(t){let e=JSON.stringify(t);this._count++;let r=this.table.get(e);if(r!==void 0)return r;let o=t.map(n=>`<r>${n.font?le(n.font):""}<t xml:space="preserve">${g(n.text)}</t></r>`).join(""),i=this.strings.length;return this.strings.push("\0RICH\0"+o),this.table.set(e,i),i}toXml(){let t=this.strings.map(e=>e.startsWith("\0RICH\0")?`<si>${e.slice(6)}</si>`:`<si><t${e!==e.trim()||e.includes(`
59
- `)?' xml:space="preserve"':""}>${g(e)}</t></si>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
85
+ ${this.tableStyleDefs.length?`<tableStyles count="${this.tableStyleDefs.length}">${this.tableStyleDefs.map(e=>`<tableStyle name="${b(e.name)}" count="${e.elements.length}">${e.elements.map(n=>`<tableStyleElement type="${n.type}" dxfId="${n.dxfId}"/>`).join("")}</tableStyle>`).join("")}</tableStyles>`:""}
86
+ </styleSheet>`}};var le=class{constructor(){this.table=new Map,this.strings=[],this._count=0}get count(){return this._count}get uniqueCount(){return this.strings.length}intern(t){this._count++;let e=this.table.get(t);if(e!==void 0)return e;let n=this.strings.length;return this.strings.push(t),this.table.set(t,n),n}internRichText(t){let e=JSON.stringify(t);this._count++;let n=this.table.get(e);if(n!==void 0)return n;let r=t.map(i=>`<r>${i.font?zn(i.font):""}<t xml:space="preserve">${b(i.text)}</t></r>`).join(""),s=this.strings.length;return this.strings.push("\0RICH\0"+r),this.table.set(e,s),s}toXml(){let t=this.strings.map(e=>e.startsWith("\0RICH\0")?`<si>${e.slice(6)}</si>`:`<si><t${e!==e.trim()||e.includes(`
87
+ `)?' xml:space="preserve"':""}>${b(e)}</t></si>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
60
88
  <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${this._count}" uniqueCount="${this.strings.length}">
61
89
  ${t}
62
- </sst>`}};function le(s){let t=[];return s.bold&&t.push("<b/>"),s.italic&&t.push("<i/>"),s.strike&&t.push("<strike/>"),s.underline&&s.underline!=="none"&&t.push(`<u val="${s.underline}"/>`),s.size&&t.push(`<sz val="${s.size}"/>`),s.color&&t.push(`<color rgb="${s.color.startsWith("#")?"FF"+s.color.slice(1):s.color}"/>`),s.name&&t.push(`<name val="${g(s.name)}"/>`),t.length?`<rPr>${t.join("")}</rPr>`:""}var jt=["FF4472C4","FFED7D31","FFA5A5A5","FFFFC000","FF5B9BD5","FF70AD47","FF264478","FF9E480E","FF636363","FF997300"];function ce(s){return`<c:spPr><a:solidFill xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:srgbClr val="${s.replace("FF","")}"/></a:solidFill></c:spPr>`}function K(s,t,e){return t.map((r,o)=>{let i=r.color?r.color.startsWith("#")?"FF"+r.color.slice(1):r.color:jt[o%jt.length],n=r.categories?`<c:cat><c:strRef><c:f>${g(r.categories)}</c:f></c:strRef></c:cat>`:"",l=`<c:val><c:numRef><c:f>${g(r.values)}</c:f></c:numRef></c:val>`,c=r.name?`<c:tx><c:strRef><c:f>"${g(r.name)}"</c:f></c:strRef></c:tx>`:"",a=s.startsWith("line")||s==="scatter"?'<c:marker><c:symbol val="none"/></c:marker>':"";return`<c:ser><c:idx val="${o}"/><c:order val="${o}"/>${c}${ce(i)}${a}${n}${l}</c:ser>`}).join("")}function me(s,t,e,r=!1){if(r)return`<c:valAx><c:axId val="${s}"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="1"/><c:axPos val="b"/><c:crossAx val="${t}"/></c:valAx>`;let o=e?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${g(e.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",i=[e?.min!==void 0?`<c:min val="${e.min}"/>`:"",e?.max!==void 0?`<c:max val="${e.max}"/>`:""].join(""),n=e?.numFmt?`<c:numFmt formatCode="${g(e.numFmt)}" sourceLinked="0"/>`:"",l=e?.gridLines!==!1?"<c:majorGridlines/>":"";return`<c:valAx>
63
- <c:axId val="${s}"/>
64
- <c:scaling><c:orientation val="minMax"/>${i}</c:scaling>
90
+ </sst>`}};function zn(o){let t=[];return o.bold&&t.push("<b/>"),o.italic&&t.push("<i/>"),o.strike&&t.push("<strike/>"),o.underline&&o.underline!=="none"&&t.push(`<u val="${o.underline}"/>`),o.size&&t.push(`<sz val="${o.size}"/>`),o.color&&(o.color.startsWith("theme:")?t.push(`<color theme="${o.color.slice(6)}"/>`):t.push(`<color rgb="${o.color.startsWith("#")?"FF"+o.color.slice(1):o.color}"/>`)),o.name&&t.push(`<name val="${b(o.name)}"/>`),t.length?`<rPr>${t.join("")}</rPr>`:""}var Bo=["FF4472C4","FFED7D31","FFA5A5A5","FFFFC000","FF5B9BD5","FF70AD47","FF264478","FF9E480E","FF636363","FF997300"],Wn={office:["4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47","264478","9E480E","636363","997300"],blue:["5B9BD5","8FAADC","B4C7E7","D6DCE4","4472C4","2F5597","1F4E79","002060","00B0F0","0070C0"],orange:["ED7D31","F4B183","F8CBAD","FCE4D6","C55A11","843C0C","BF8F00","806000","FFD966","FFC000"],green:["70AD47","A9D18E","C5E0B4","E2F0D9","548235","375623","92D050","00B050","00B0F0","00FF00"],red:["FF0000","FF6161","FF9F9F","FFD2D2","C00000","8B0000","FFC000","FF6600","FF3300","CC0000"],purple:["7030A0","9B59B6","BB8FCE","D7BDE2","5B2C6F","4A235A","8E44AD","6C3483","A569BD","D2B4DE"],teal:["00B0F0","00BCD4","26C6DA","80DEEA","0097A7","006064","009688","00796B","4DB6AC","80CBC4"],gray:["595959","808080","A6A6A6","D9D9D9","404040","262626","BFBFBF","F2F2F2","7F7F7F","C0C0C0"],gold:["FFC000","FFD966","FFE699","FFF2CC","BF8F00","806000","ED7D31","F4B183","DBA13A","C09100"],blueWarm:["4472C4","5B9BD5","9DC3E6","BDD7EE","DEEBF7","2E75B6","1F4E79","2F5597","8FAADC","D6DCE4"],blueGreen:["00B0F0","00B050","70AD47","5B9BD5","4472C4","2E75B6","548235","00B0F0","009688","00796B"],greenYellow:["70AD47","92D050","C9E265","FFD966","FFC000","548235","BF8F00","A9D18E","E2F0D9","C5E0B4"],redOrange:["FF0000","ED7D31","FFC000","FF6600","C00000","843C0C","BF8F00","FF3300","F4B183","FFD966"],redViolet:["FF0000","7030A0","ED7D31","C00000","5B2C6F","843C0C","FF6161","9B59B6","F4B183","BB8FCE"],yellowOrange:["FFC000","ED7D31","FFD966","F4B183","BF8F00","C55A11","FFE699","F8CBAD","806000","843C0C"],slipstream:["4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47","255E91","9E480E","636363","997300"],marquee:["ED7D31","4472C4","70AD47","FFC000","5B9BD5","A5A5A5","264478","9E480E","636363","997300"],aspect:["5B9BD5","4472C4","ED7D31","FFC000","70AD47","A5A5A5","9E480E","264478","636363","997300"]},Hn={colorful1:102,colorful2:103,colorful3:104,colorful4:105,monochromatic1:201,monochromatic2:202,monochromatic3:203,monochromatic4:204,monochromatic5:205,monochromatic6:206,monochromatic7:207,monochromatic8:208,monochromatic9:209,monochromatic10:210,monochromatic11:211,monochromatic12:212};function qn(o,t){let e=' xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"',n=o.replace(/^FF/,""),r;t?.fillType==="gradient"&&t.gradientStops?.length?r=`<a:gradFill><a:gsLst>${t.gradientStops.map(l=>`<a:gs pos="${l.pos*1e3}"><a:srgbClr val="${l.color.replace(/^FF/,"").replace(/^#/,"")}"/></a:gs>`).join("")}</a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill>`:r=`<a:solidFill><a:srgbClr val="${n}"/></a:solidFill>`;let s=t?.lineWidth?` w="${Math.round(t.lineWidth*12700)}"`:"",i=s?`<a:ln${s}><a:solidFill><a:srgbClr val="${n}"/></a:solidFill></a:ln>`:"";return`<c:spPr${e}>${r}${i}</c:spPr>`}function Lo(o){return o?`<c:dLbls>${[o.numFmt?`<c:numFmt formatCode="${b(o.numFmt)}" sourceLinked="0"/>`:"",o.position?`<c:dLblPos val="${o.position}"/>`:"",'<c:showLegendKey val="0"/>',`<c:showVal val="${o.showValue?"1":"0"}"/>`,`<c:showCatName val="${o.showCategory?"1":"0"}"/>`,`<c:showSerName val="${o.showSeriesName?"1":"0"}"/>`,`<c:showPercent val="${o.showPercent?"1":"0"}"/>`].join("")}</c:dLbls>`:""}function te(o,t,e,n){return t.map((r,s)=>{let i=r.color?r.color.startsWith("#")?"FF"+r.color.slice(1):r.color:n?"FF"+n[s%n.length]:Bo[s%Bo.length],a=r.categories?`<c:cat><c:strRef><c:f>${b(r.categories)}</c:f></c:strRef></c:cat>`:"",l=`<c:val><c:numRef><c:f>${b(r.values)}</c:f></c:numRef></c:val>`,m=r.name?`<c:tx><c:strRef><c:f>"${b(r.name)}"</c:f></c:strRef></c:tx>`:"",c=o.startsWith("line")||o==="scatter"?'<c:marker><c:symbol val="none"/></c:marker>':"",h=Lo(r.dataLabels);return`<c:ser><c:idx val="${s}"/><c:order val="${s}"/>${m}${qn(i,r)}${c}${h}${a}${l}</c:ser>`}).join("")}function Gn(o,t,e,n=!1){if(n)return`<c:valAx><c:axId val="${o}"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="1"/><c:axPos val="b"/><c:crossAx val="${t}"/></c:valAx>`;let r=e?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${b(e.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",s=[e?.min!==void 0?`<c:min val="${e.min}"/>`:"",e?.max!==void 0?`<c:max val="${e.max}"/>`:""].join(""),i=e?.numFmt?`<c:numFmt formatCode="${b(e.numFmt)}" sourceLinked="0"/>`:"",a=e?.gridLines!==!1?"<c:majorGridlines/>":"";return`<c:valAx>
91
+ <c:axId val="${o}"/>
92
+ <c:scaling><c:orientation val="minMax"/>${s}</c:scaling>
65
93
  <c:delete val="0"/>
66
94
  <c:axPos val="l"/>
67
- ${l}${o}${n}
95
+ ${a}${r}${i}
68
96
  <c:crossAx val="${t}"/>
69
- </c:valAx>`}function he(s,t,e){let r=e?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${g(e.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",o=e?.gridLines?"<c:majorGridlines/>":"";return`<c:catAx>
70
- <c:axId val="${s}"/>
97
+ </c:valAx>`}function Kn(o,t,e){let n=e?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${b(e.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",r=e?.gridLines?"<c:majorGridlines/>":"";return`<c:catAx>
98
+ <c:axId val="${o}"/>
71
99
  <c:scaling><c:orientation val="minMax"/></c:scaling>
72
100
  <c:delete val="0"/>
73
101
  <c:axPos val="b"/>
74
- ${o}${r}
102
+ ${r}${n}
75
103
  <c:crossAx val="${t}"/>
76
- </c:catAx>`}function de(s){return s===!1?"":`<c:legend><c:legendPos val="${typeof s=="string"?s:"b"}"/></c:legend>`}function Mt(s){let t=s.type,e=s.series,r=s.title?`<c:title><c:tx><c:rich>
104
+ </c:catAx>`}function Zn(o){if(o===!1)return"";let t=typeof o=="string"?o:"b";return`<c:legend><c:legendPos val="${{bottom:"b",top:"t",left:"l",right:"r",corner:"tr"}[t]??t}"/></c:legend>`}function No(o){let t=o.type,e=o.series,n=o.colorPalette?Wn[o.colorPalette]:void 0,r=o.title?`<c:title><c:tx><c:rich>
77
105
  <a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/>
78
106
  <a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
79
- <a:r><a:t>${g(s.title)}</a:t></a:r>
107
+ <a:r><a:t>${b(o.title)}</a:t></a:r>
80
108
  </a:p>
81
- </c:rich></c:tx><c:overlay val="0"/></c:title>`:"",o=s.varyColors?'<c:varyColors val="1"/>':"",i="",n=t==="pie"||t==="doughnut",l=t.startsWith("bar")||t.startsWith("column"),c=t.startsWith("line"),a=t.startsWith("scatter")||t==="bubble",d=t.startsWith("area"),m=t.startsWith("radar"),p=t==="stock",h=s.grouping??(t.endsWith("Stacked100")?"percentStacked":t.endsWith("Stacked")?"stacked":l?"clustered":c||d?"standard":void 0);if(n){let y=t==="doughnut"?"doughnutChart":"pieChart",b=t==="doughnut"?'<c:holeSize val="50"/>':"";i=`<c:${y}>${o}${K(t,e,0)}${b}</c:${y}>`}else l?i=`<c:barChart>
109
+ </c:rich></c:tx><c:overlay val="0"/></c:title>`:"",s=o.varyColors?'<c:varyColors val="1"/>':"",i=Lo(o.dataLabels),a="",l=t==="pie"||t==="doughnut",m=t.startsWith("bar")||t.startsWith("column"),c=t.startsWith("line"),h=t.startsWith("scatter")||t==="bubble",d=t.startsWith("area"),f=t.startsWith("radar"),p=t==="stock",u=o.grouping??(t.endsWith("Stacked100")?"percentStacked":t.endsWith("Stacked")?"stacked":m?"clustered":c||d?"standard":void 0);if(l){let g=t==="doughnut"?"doughnutChart":"pieChart",M=t==="doughnut"?'<c:holeSize val="50"/>':"";a=`<c:${g}>${s}${te(t,e,0,n)}${i}${M}</c:${g}>`}else m?a=`<c:barChart>
82
110
  <c:barDir val="${t.startsWith("bar")?"bar":"col"}"/>
83
- ${h?`<c:grouping val="${h}"/>`:""}
84
- ${o}
85
- ${K(t,e,0)}
111
+ ${u?`<c:grouping val="${u}"/>`:""}
112
+ ${s}
113
+ ${te(t,e,0,n)}
114
+ ${i}
86
115
  <c:axId val="1"/><c:axId val="2"/>
87
- </c:barChart>`:c?i=`<c:lineChart>
88
- ${h?`<c:grouping val="${h}"/>`:""}
89
- ${o}
90
- ${K(t,e,0)}
116
+ </c:barChart>`:c?a=`<c:lineChart>
117
+ ${u?`<c:grouping val="${u}"/>`:""}
118
+ ${s}
119
+ ${te(t,e,0,n)}
120
+ ${i}
91
121
  <c:axId val="1"/><c:axId val="2"/>
92
- </c:lineChart>`:a?i=`<c:scatterChart>
122
+ </c:lineChart>`:h?a=`<c:scatterChart>
93
123
  <c:scatterStyle val="${t==="scatterSmooth"?"smoothMarker":"marker"}"/>
94
- ${o}
95
- ${K(t,e,0)}
124
+ ${s}
125
+ ${te(t,e,0,n)}
126
+ ${i}
96
127
  <c:axId val="1"/><c:axId val="2"/>
97
- </c:scatterChart>`:d?i=`<c:areaChart>
98
- ${h?`<c:grouping val="${h}"/>`:""}
99
- ${o}
100
- ${K(t,e,0)}
128
+ </c:scatterChart>`:d?a=`<c:areaChart>
129
+ ${u?`<c:grouping val="${u}"/>`:""}
130
+ ${s}
131
+ ${te(t,e,0,n)}
132
+ ${i}
101
133
  <c:axId val="1"/><c:axId val="2"/>
102
- </c:areaChart>`:m?i=`<c:radarChart>
134
+ </c:areaChart>`:f?a=`<c:radarChart>
103
135
  <c:radarStyle val="${t==="radarFilled"?"filled":"marker"}"/>
104
- ${o}
105
- ${K(t,e,0)}
136
+ ${s}
137
+ ${te(t,e,0,n)}
138
+ ${i}
106
139
  <c:axId val="1"/><c:axId val="2"/>
107
- </c:radarChart>`:i=`<c:barChart>
140
+ </c:radarChart>`:a=`<c:barChart>
108
141
  <c:barDir val="col"/>
109
142
  <c:grouping val="clustered"/>
110
- ${o}
111
- ${K(t,e,0)}
143
+ ${s}
144
+ ${te(t,e,0,n)}
145
+ ${i}
112
146
  <c:axId val="1"/><c:axId val="2"/>
113
- </c:barChart>`;let $=!n?he(1,2,s.xAxis)+me(2,1,s.yAxis):"",x=de(s.legend??"b");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
147
+ </c:barChart>`;let $=!l?Kn(1,2,o.xAxis)+Gn(2,1,o.yAxis):"",y=Zn(o.legend??"b"),I=o.modernStyle?Math.min(Hn[o.modernStyle],48):o.style,R=I?`<c:style val="${I}"/>`:"",w="";if(o.chartFill||o.shadow){let g=o.chartFill==="gradient"?'<a:gradFill><a:gsLst><a:gs pos="0"><a:schemeClr val="lt1"/></a:gs><a:gs pos="100000"><a:schemeClr val="bg1"><a:lumMod val="85000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill>':o.chartFill==="white"?'<a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill>':o.chartFill==="none"?"<a:noFill/>":"",M=o.shadow?'<a:effectLst><a:outerShdw blurRad="50800" dist="38100" dir="5400000" algn="t" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="40000"/></a:srgbClr></a:outerShdw></a:effectLst>':"";w=`<c:spPr>${g}${M}</c:spPr>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
114
148
  <c:chartSpace xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"
115
149
  xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
116
150
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
117
- ${s.style?`<c:style val="${s.style}"/>`:""}
151
+ ${o.roundedCorners?'<c:roundedCorners val="1"/>':""}
152
+ ${R}
118
153
  <c:chart>
119
154
  ${r}
120
- <c:autoTitleDeleted val="${s.title?"0":"1"}"/>
155
+ <c:autoTitleDeleted val="${o.title?"0":"1"}"/>
121
156
  <c:plotArea>
122
- ${i}
157
+ ${a}
123
158
  ${$}
124
159
  </c:plotArea>
125
- ${x}
160
+ ${y}
126
161
  <c:plotVisOnly val="1"/>
127
162
  </c:chart>
128
- </c:chartSpace>`}function wt(s,t){let{startRow:e,startCol:r,endRow:o,endCol:i}=ot(s.ref),n=s.displayName??s.name,l=s.columns.map((h,u)=>{let $=r+u,x=u+1,y=h.totalsRowFunction??"none",b=s.totalsRow&&y!=="none"?` totalsRowFunction="${y}"${h.totalsRowFormula?` totalsRowFormula="${g(h.totalsRowFormula)}"`:""}`:"",F=s.totalsRow&&h.totalsRowLabel?` totalsRowLabel="${g(h.totalsRowLabel)}"`:"";return`<tableColumn id="${x}" name="${g(h.name)}"${b}${F}/>`}).join(""),c=[`name="${g(s.style??"TableStyleMedium2")}"`,s.showFirstColumn?'showFirstColumn="1"':"",s.showLastColumn?'showLastColumn="1"':"",s.showRowStripes!==!1?'showRowStripes="1"':"",s.showColumnStripes?'showColumnStripes="1"':""].filter(Boolean).join(" "),a=s.totalsRow?1:0,d=W(r),m=W(i),p=`${d}${e}:${m}${o-a}`;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
163
+ ${w}
164
+ </c:chartSpace>`}function Yn(o){return{type:o.type,style:o.style,modernStyle:o.modernStyle,colorPalette:o.colorPalette,legend:o.legend,xAxis:o.xAxis,yAxis:o.yAxis,dataLabels:o.dataLabels,chartFill:o.chartFill,roundedCorners:o.roundedCorners,shadow:o.shadow,varyColors:o.varyColors,grouping:o.grouping}}function Qn(o,t){return{type:t.type??o.type,title:t.title,series:t.series,from:t.from,to:t.to,xAxis:t.xAxis??o.xAxis,yAxis:t.yAxis??o.yAxis,legend:t.legend??o.legend,style:t.style??o.style,modernStyle:t.modernStyle??o.modernStyle,colorPalette:t.colorPalette??o.colorPalette,dataLabels:t.dataLabels??o.dataLabels,chartFill:t.chartFill??o.chartFill,roundedCorners:t.roundedCorners??o.roundedCorners,shadow:t.shadow??o.shadow,varyColors:t.varyColors??o.varyColors,grouping:t.grouping??o.grouping}}function Jn(o){return JSON.stringify(o)}function tr(o){return JSON.parse(o)}function io(o,t){let{startRow:e,startCol:n,endRow:r,endCol:s}=Lt(o.ref),i=o.displayName??o.name,a=o.columns.map((f,p)=>{let u=n+p,x=p+1,$=f.totalsRowFunction??"none",y=o.totalsRow?` totalsRowFunction="${$}"${$!=="none"&&f.totalsRowFormula?` totalsRowFormula="${b(f.totalsRowFormula)}"`:""}`:"",I=o.totalsRow&&f.totalsRowLabel?` totalsRowLabel="${b(f.totalsRowLabel)}"`:"";return`<tableColumn id="${x}" name="${b(f.name)}"${y}${I}/>`}).join(""),l=[`name="${b(o.style??"TableStyleMedium2")}"`,o.showFirstColumn?'showFirstColumn="1"':"",o.showLastColumn?'showLastColumn="1"':"",o.showRowStripes!==!1?'showRowStripes="1"':"",o.showColumnStripes?'showColumnStripes="1"':""].filter(Boolean).join(" "),m=o.totalsRow?1:0,c=Dt(n),h=Dt(s),d=`${c}${e}:${h}${r-m}`;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
129
165
  <table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
130
- id="${t}" name="${g(s.name)}" displayName="${g(n)}"
131
- ref="${s.ref}" totalsRowCount="${a}">
132
- <autoFilter ref="${p}"/>
133
- <tableColumns count="${s.columns.length}">${l}</tableColumns>
134
- <tableStyleInfo ${c}/>
135
- </table>`}var it=null;function pe(){if(it)return it;it=new Uint32Array(256);for(let s=0;s<256;s++){let t=s;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;it[s]=t}return it}function fe(s){let t=pe(),e=4294967295;for(let r=0;r<s.length;r++)e=e>>>8^t[(e^s[r])&255];return(e^4294967295)>>>0}var dt=class{constructor(){this.buf=[],this.bits=0,this.bitLen=0}writeBits(t,e){for(this.bits|=(t&(1<<e)-1)<<this.bitLen,this.bitLen+=e;this.bitLen>=8;)this.buf.push(this.bits&255),this.bits>>>=8,this.bitLen-=8}flush(){this.bitLen>0&&(this.buf.push(this.bits&255),this.bits=0,this.bitLen=0)}toBytes(){return new Uint8Array(this.buf)}};function yt(s,t){let e=s.length,r=new Uint8Array(e),o=[];for(let a=0;a<e;a++)s[a]>0&&o.push(a);if(o.length===0)return r;if(o.length===1)return r[o[0]]=1,r;let i=o.map(a=>({freq:s[a],sym:a}));(()=>{for(i.sort((a,d)=>a.freq-d.freq);i.length>1;){let a=i.shift(),d=i.shift(),m={freq:a.freq+d.freq,sym:-1,left:a,right:d},p=0;for(;p<i.length&&i[p].freq<=m.freq;)p++;i.splice(p,0,m)}})();let l=(a,d)=>{if(a){if(a.sym>=0){r[a.sym]=Math.min(d,t);return}l(a.left,d+1),l(a.right,d+1)}};l(i[0],0);let c=0;for(let a=0;a<e;a++)r[a]>t&&(c+=(1<<r[a]-t)-1,r[a]=t);if(c>0)for(let a=t-1;a>=1&&c>0;a--)for(let d=0;d<e&&c>0;d++)r[d]===a&&(r[d]++,c--);return r}function at(s){let t=Math.max(...s),e=new Uint32Array(t+1);for(let n of s)n>0&&e[n]++;let r=new Uint32Array(t+1),o=0;for(let n=1;n<=t;n++)o=o+e[n-1]<<1,r[n]=o;let i=new Uint32Array(s.length);for(let n=0;n<s.length;n++)s[n]>0&&(i[n]=r[s[n]]++);return i}function G(s,t){let e=0;for(let r=0;r<t;r++)e=e<<1|s&1,s>>=1;return e}function ue(){let s=new Uint8Array(288);for(let t=0;t<=143;t++)s[t]=8;for(let t=144;t<=255;t++)s[t]=9;for(let t=256;t<=279;t++)s[t]=7;for(let t=280;t<=287;t++)s[t]=8;return s}function ge(){let s=new Uint8Array(32);return s.fill(5),s}var Et=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],bt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Wt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ft=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function Ut(s){for(let t=0;t<29;t++)if(s<=bt[t]+(1<<Et[t])-1&&s>=bt[t])return[257+t,Et[t],s-bt[t]];return[285,0,0]}function zt(s){for(let t=0;t<30;t++){let e=Ft[t]+(1<<Wt[t])-1;if(s>=Ft[t]&&s<=e)return[t,Wt[t],s-Ft[t]]}return[29,13,0]}var V=32768,vt=258,Ht=3,xe=8,$e=32,we=128;function ye(s,t){let e=t<=1?xe:t<=6?$e:we,r=[],o=s.length,i=65536,n=new Int32Array(i).fill(-1),l=new Int32Array(Math.min(o,V)).fill(-1),c=h=>((s[h]*4129^s[h+1]*155^s[h+2])&i-1)>>>0,a=0,d=-1,m=h=>{r.push({lit:h})},p=(h,u)=>{d>=0&&(m(d),d=-1),r.push({len:h,dist:u})};for(;a<o;){if(a+2>=o){m(s[a++]);continue}let h=c(a),u=Ht-1,$=0,x=n[h],y=0;for(;x>=0&&y<e;){let b=a-x;if(b>V)break;let F=0,I=Math.min(vt,o-a);for(;F<I&&s[x+F]===s[a+F];)F++;if(F>u&&(u=F,$=b),u===vt)break;x=l[x&V-1],y++}if(l[a&V-1]=n[h],n[h]=a,u>=Ht){if(t>=6&&a+3<o){let b=c(a+1),F=n[b],I=0,X=0,T=0;for(;F>=0&&T<e;){let v=a+1-F;if(v>V)break;let f=0,w=Math.min(vt,o-a-1);for(;f<w&&s[F+f]===s[a+1+f];)f++;f>I&&(I=f,X=v),F=l[F&V-1],T++}if(I>u+1){m(s[a]),a++,l[a&V-1]=n[b],n[b]=a,p(I,X);for(let v=1;v<I;v++)if(a++,a+2<o){let f=c(a);l[a&V-1]=n[f],n[f]=a}a++;continue}}p(u,$);for(let b=0;b<u;b++)if(a+b+2<o){let F=c(a+b);l[a+b&V-1]=n[F],n[F]=a+b}a+=u}else m(s[a++])}return r}function be(s,t,e,r){let o=0;for(;o<s.length;){let i=s[o];if(i===0){let n=0;for(;o+n<s.length&&s[o+n]===0&&n<138;)n++;n<3?(t.writeBits(G(e[0],r[0]),r[0]),o++):n<=10?(t.writeBits(G(e[17],r[17]),r[17]),t.writeBits(n-3,3),o+=n):(t.writeBits(G(e[18],r[18]),r[18]),t.writeBits(n-11,7),o+=n)}else{t.writeBits(G(e[i],r[i]),r[i]),o++;let n=0;for(;o+n<s.length&&s[o+n]===i&&n<6;)n++;n>=3&&(t.writeBits(G(e[16],r[16]),r[16]),t.writeBits(n-3,2),o+=n)}}}function Vt(s,t,e,r){let o=new Uint32Array(286),i=new Uint32Array(30);o[256]=1;for(let m of s)if("lit"in m)o[m.lit]++;else{let[p]=Ut(m.len);o[p]++;let[h]=zt(m.dist);i[h]++}let n,l,c,a;if(r){n=yt(o,15),l=yt(i,15),l.every(F=>F===0)&&(l[0]=1),c=at(n),a=at(l);let m=Gt(n,257,286)+1,p=Gt(l,1,30)+1,h=[...n.subarray(0,m),...l.subarray(0,p)],u=new Uint32Array(19);ve(h,u);let $=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],x=yt(u,7),y=at(x),b=Fe($.map(F=>x[F]),4,19)+1;t.writeBits(e?1:0,1),t.writeBits(2,2),t.writeBits(m-257,5),t.writeBits(p-1,5),t.writeBits(b-4,4);for(let F=0;F<b;F++)t.writeBits(x[$[F]],3);be(h,t,y,x)}else n=ue(),l=ge(),c=at(n),a=at(l),t.writeBits(e?1:0,1),t.writeBits(1,2);for(let m of s)if("lit"in m){let p=n[m.lit];t.writeBits(G(c[m.lit],p),p)}else{let[p,h,u]=Ut(m.len),$=n[p];t.writeBits(G(c[p],$),$),h>0&&t.writeBits(u,h);let[x,y,b]=zt(m.dist),F=l[x];t.writeBits(G(a[x],F),F),y>0&&t.writeBits(b,y)}let d=n[256];t.writeBits(G(c[256],d),d)}function Gt(s,t,e){let r=t-1;for(let o=t;o<Math.min(s.length,e);o++)s[o]>0&&(r=o);return Math.max(r,t-1)}function Fe(s,t,e){let r=t-1;for(let o=t;o<Math.min(s.length,e);o++)s[o]>0&&(r=o);return Math.max(r,t-1)}function ve(s,t){let e=0;for(;e<s.length;){let r=s[e];if(r===0){let o=0;for(;e+o<s.length&&s[e+o]===0&&o<138;)o++;o<3?(t[0]++,e++):o<=10?(t[17]++,e+=o):(t[18]++,e+=o)}else{t[r]++,e++;let o=0;for(;e+o<s.length&&s[e+o]===r&&o<6;)o++;o>=3&&(t[16]++,e+=o)}}}var Ct=65536;function Ce(s,t=6){if(t===0){let n=new dt,l=0;for(;l<s.length||s.length===0;){let c=Math.min(Ct,s.length-l),a=l+c>=s.length;n.flush(),n.writeBits(a?1:0,1),n.writeBits(0,2),n.flush();let d=c;n.buf.push(d&255,d>>8&255,~d&255,~d>>8&255);for(let m=0;m<c;m++)n.buf.push(s[l+m]);if(l+=c,s.length===0)break}return n.toBytes()}let e=Math.max(1,Math.min(9,t)),r=e>=2,o=new dt,i=0;for(;i<s.length||s.length===0;){let n=s.subarray(i,i+Ct),l=i+Ct>=s.length,c=ye(n,e);if(Vt(c,o,l,r),i+=n.length,s.length===0){Vt([],o,!0,r);break}}return o.flush(),o.toBytes()}function P(s,t,e){s[t]=e&255,s[t+1]=e>>8&255}function E(s,t,e){s[t]=e&255,s[t+1]=e>>8&255,s[t+2]=e>>16&255,s[t+3]=e>>24&255}var ke=new TextEncoder,Te=new Set(["png","jpg","jpeg","gif","tiff","emf","wmf","bmp","webp"]);function kt(s,t={}){let e=t.level??6,r=t.noCompress?new Set(t.noCompress.map(u=>u.toLowerCase())):Te,o=[],i=[],n=0;for(let u of s){let $=ke.encode(u.name),x=u.name.split(".").pop()?.toLowerCase()??"",y=u.level??(r.has(x)?0:e),b=y>0&&u.data.length>0,F=fe(u.data),I,X;b?(I=Ce(u.data,y),I.length>=u.data.length?(I=u.data,X=0):X=8):(I=u.data,X=0);let T=new Uint8Array(30+$.length);E(T,0,67324752),P(T,4,20),P(T,6,0),P(T,8,X),P(T,10,0),P(T,12,0),E(T,14,F),E(T,18,I.length),E(T,22,u.data.length),P(T,26,$.length),P(T,28,0),T.set($,30);let v=new Uint8Array(46+$.length);E(v,0,33639248),P(v,4,20),P(v,6,20),P(v,8,0),P(v,10,X),P(v,12,0),P(v,14,0),E(v,16,F),E(v,20,I.length),E(v,24,u.data.length),P(v,28,$.length),P(v,30,0),P(v,32,0),P(v,34,0),P(v,36,0),E(v,38,0),E(v,42,n),v.set($,46),o.push(T,I),i.push(v),n+=T.length+I.length}let l=n,c=i.reduce((u,$)=>u+$.length,0),a=new Uint8Array(22);E(a,0,101010256),P(a,4,0),P(a,6,0),P(a,8,i.length),P(a,10,i.length),E(a,12,c),E(a,16,l),P(a,20,0);let d=[...o,...i,a],m=d.reduce((u,$)=>u+$.length,0),p=new Uint8Array(m),h=0;for(let u of d)p.set(u,h),h+=u.length;return p}function Q(s,t){return s[t]|s[t+1]<<8}function et(s,t){return(s[t]|s[t+1]<<8|s[t+2]<<16|s[t+3]<<24)>>>0}async function Ie(s){let t=new DecompressionStream("deflate-raw"),e=t.writable.getWriter(),r=t.readable.getReader();e.write(s),e.close();let o=[],i=!1;for(;!i;){let{value:a,done:d}=await r.read();a&&o.push(a),i=d}let n=o.reduce((a,d)=>a+d.length,0),l=new Uint8Array(n),c=0;for(let a of o)l.set(a,c),c+=a.length;return l}async function qt(s){let t=new TextDecoder("utf-8"),e=new Map,r=-1;for(let l=s.length-22;l>=0;l--)if(s[l]===80&&s[l+1]===75&&s[l+2]===5&&s[l+3]===6){r=l;break}if(r<0)throw new Error("Not a valid ZIP file (EOCD not found)");let o=et(s,r+16),i=Q(s,r+8),n=o;for(let l=0;l<i;l++){if(et(s,n)!==33639248)throw new Error("Invalid central directory entry");let c=Q(s,n+10),a=et(s,n+20),d=et(s,n+24),m=Q(s,n+28),p=Q(s,n+30),h=Q(s,n+32),u=et(s,n+42),$=s.subarray(n+46,n+46+m),x=t.decode($);n+=46+m+p+h;let y=u;if(et(s,y)!==67324752)throw new Error("Invalid local file header");let b=Q(s,y+26),F=Q(s,y+28),I=y+30+b+F,X=s.subarray(I,I+a),T;c===0?T=X.slice():c===8?T=await Ie(X):T=X.slice(),x.endsWith("/")||e.set(x,{name:x,data:T})}return e}function Tt(s){return new TextDecoder("utf-8").decode(s.data)}function It(s){let t=Object.entries(s.attrs).map(([o,i])=>`${o}="${Re(i)}"`).join(" "),e=t?`<${s.tag} ${t}`:`<${s.tag}`,r=(s.text??"")+s.children.map(It).join("");return r?`${e}>${r}</${s.tag}>`:`${e}/>`}function Re(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function U(s){let t=[],e=[],r=0;for(s.startsWith("<?")&&(r=s.indexOf("?>")+2);r<s.length;){if(s[r]!=="<"){let m=s.indexOf("<",r),p=m<0?s.slice(r):s.slice(r,m);if(e.length&&p.trim()){let h=e[e.length-1];h.text=(h.text??"")+Zt(p)}r=m<0?s.length:m;continue}if(s.startsWith("<!--",r)){let m=s.indexOf("-->",r);if(e.length){let p=e[e.length-1];p.text=(p.text??"")+s.slice(r,m+3)}r=m+3;continue}if(s.startsWith("<![CDATA[",r)){let m=s.indexOf("]]>",r),p=s.slice(r+9,m);if(e.length){let h=e[e.length-1];h.text=(h.text??"")+p}r=m+3;continue}if(s[r+1]==="/"){let m=s.indexOf(">",r),p=e.pop();e.length?e[e.length-1].children.push(p):t.push(p),r=m+1;continue}if(s[r+1]==="?"){r=s.indexOf("?>",r)+2;continue}let o=Se(s,r),i=s.slice(r+1,o),n=i.endsWith("/"),l=n?i.slice(0,-1).trim():i.trim(),{tag:c,attrs:a}=Pe(l),d={tag:c,attrs:a,children:[]};n?e.length?e[e.length-1].children.push(d):t.push(d):e.push(d),r=o+1}for(;e.length>1;){let o=e.pop();e[e.length-1].children.push(o)}if(e.length===1&&t.push(e[0]),t.length===0)throw new Error("Empty XML document");return t[0]}function Se(s,t){let e=null;for(let r=t+1;r<s.length;r++){let o=s[r];if(e)o===e&&(e=null);else if(o==='"'||o==="'")e=o;else if(o===">")return r}return s.length-1}function Pe(s){let t={},e=s.search(/\s/),r=e<0?s:s.slice(0,e);if(e<0)return{tag:r,attrs:t};let o=s.slice(e),i=/(\S+?)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,n;for(;(n=i.exec(o))!==null;)t[n[1]]=Zt(n[2]??n[3]??"");return{tag:r,attrs:t}}function Zt(s){return s.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(t,e)=>String.fromCharCode(parseInt(e,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCharCode(parseInt(e,16)))}function S(s,t){return s.children.find(e=>O(e.tag)===t)}function _(s,t){return s.children.filter(e=>O(e.tag)===t)}function O(s){let t=s.indexOf(":");return t<0?s:s.slice(t+1)}function De(s){return s.toISOString()}function Rt(s){let t=(r,o)=>o!==void 0?`<${r}>${g(o)}</${r}>`:"",e=(r,o)=>o?`<${r} xsi:type="dcterms:W3CDTF">${De(o)}</${r}>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
166
+ id="${t}" name="${b(o.name)}" displayName="${b(i)}"
167
+ ref="${o.ref}" totalsRowCount="${m}">
168
+ <autoFilter ref="${d}"/>
169
+ <tableColumns count="${o.columns.length}">${a}</tableColumns>
170
+ <tableStyleInfo ${l}/>
171
+ </table>`}var er={sum:"sum",count:"count",average:"average",max:"max",min:"min",product:"product",countNums:"countNums",stdDev:"stdDev",stdDevp:"stdDevp",var:"var",varp:"varp"};function jo(o,t,e,n){let r=(t[0]??[]).map(F=>String(F??"")),s=t.slice(1),i=r.length,a=o.rowGrandTotals!==!1,l=o.colGrandTotals!==!1,m=new Map(r.map((F,B)=>[F,B])),c=o.rowFields.map(F=>m.get(F)??0),h=o.colFields.map(F=>m.get(F)??0),d=o.dataFields.map(F=>m.get(F.field)??0),f=Array.from({length:i},()=>[]),p=Array.from({length:i},()=>new Map),u=new Array(i).fill(!0);for(let F of s)for(let B=0;B<i;B++){let X=F[B],W=X==null?"":String(X);typeof X!="number"&&(u[B]=!1),p[B].has(W)||(p[B].set(W,f[B].length),f[B].push(W))}let{row:x,col:$}=Mt(o.targetCell),y=h.length>0,I=y?h.reduce((F,B)=>F*Math.max(f[B].length,1),1):1,w=1+(c.length?c.reduce((F,B)=>F*Math.max(f[B].length,1),1):1)+(a?1:0),C=o.dataFields.length+(o.calculatedFields??[]).length,g=c.length+I*C+(l?C:0),M=`${Yt(x,$)}:${Yt(x+w-1,$+g-1)}`,T=c.length+1,S=new Set([...c,...h]),k=o.calculatedFields??[],L=k.map(F=>`<cacheField name="${b(F.name)}" numFmtId="0" formula="${b(F.formula)}" databaseField="0"><sharedItems/></cacheField>`).join(""),P=i+k.length,U=new Map;for(let F of o.fieldGrouping??[]){let B=m.get(F.field);B!==void 0&&U.set(B,F)}let H=r.map((F,B)=>{let X=U.get(B);if(S.has(B)){let W=f[B].map(J=>`<s v="${b(J)}"/>`).join(""),Z="";return X&&(X.groupBy==="numeric"?Z=`<fieldGroup base="${B}"><rangePr startNum="${X.start??0}" endNum="${X.end??100}" groupInterval="${X.interval??10}"/></fieldGroup>`:Z=`<fieldGroup base="${B}"><rangePr groupBy="${{days:"days",months:"months",quarters:"quarters",years:"years"}[X.groupBy]??"months"}"/></fieldGroup>`),`<cacheField name="${b(F)}" numFmtId="0"><sharedItems count="${f[B].length}">${W}</sharedItems>${Z}</cacheField>`}if(u[B]){let W=s.map(mt=>Number(mt[B])).filter(mt=>!isNaN(mt)),Z=W.length?Math.min(...W):0,J=W.length?Math.max(...W):0;return`<cacheField name="${b(F)}" numFmtId="0"><sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" minValue="${Z}" maxValue="${J}"/></cacheField>`}return`<cacheField name="${b(F)}" numFmtId="0"><sharedItems/></cacheField>`}).join("")+L,G=s.map(F=>`<r>${r.map((X,W)=>{let Z=F[W];if(S.has(W)){let J=Z==null?"":String(Z);return`<x v="${p[W].get(J)??0}"/>`}return typeof Z=="number"?`<n v="${Z}"/>`:typeof Z=="boolean"?`<b v="${Z?1:0}"/>`:`<s v="${b(String(Z??""))}"/>`}).join("")}</r>`).join(""),E=r.map((F,B)=>{let X=c.includes(B),W=h.includes(B),Z=d.includes(B);if(X){let J=f[B].map((mt,K)=>`<item x="${K}"/>`).join("")+'<item t="default"/>';return`<pivotField axis="axisRow" showAll="0"><items count="${f[B].length+1}">${J}</items></pivotField>`}if(W){let J=f[B].map((mt,K)=>`<item x="${K}"/>`).join("")+'<item t="default"/>';return`<pivotField axis="axisCol" showAll="0"><items count="${f[B].length+1}">${J}</items></pivotField>`}return Z?'<pivotField dataField="1" showAll="0"/>':'<pivotField showAll="0"/>'}).join("")+k.map(()=>'<pivotField dataField="1" showAll="0"/>').join(""),_="",A="";if(c.length){_=`<rowFields count="${c.length}">${c.map(W=>`<field x="${W}"/>`).join("")}</rowFields>`;let F=c[0],B=f[F].map((W,Z)=>`<i><x v="${Z}"/></i>`).join(""),X=a?'<i t="grand"><x/></i>':"";A=`<rowItems count="${f[F].length+(a?1:0)}">${B}${X}</rowItems>`}let N="",j="";if(y){N=`<colFields count="${h.length}">${h.map(W=>`<field x="${W}"/>`).join("")}</colFields>`;let F=h[0],B=f[F].map((W,Z)=>`<i><x v="${Z}"/></i>`).join(""),X=l?'<i t="grand"><x/></i>':"";j=`<colItems count="${f[F].length+(l?1:0)}">${B}${X}</colItems>`}else if(C>1){N='<colFields count="1"><field x="-2"/></colFields>';let F=Array.from({length:C},(B,X)=>`<i><x v="${X}"/></i>`).join("");j=`<colItems count="${C}">${F}</colItems>`}let O=[];for(let F=0;F<o.dataFields.length;F++){let B=o.dataFields[F],X=d[F],W=er[B.func??"sum"]??"sum",Z=B.name??`Sum of ${B.field}`;O.push(`<dataField name="${b(Z)}" fld="${X}" subtotal="${W}" showDataAs="normal" baseField="0" baseItem="0"/>`)}for(let F=0;F<k.length;F++){let B=k[F],X=i+F;O.push(`<dataField name="${b(B.name)}" fld="${X}" subtotal="sum" showDataAs="normal" baseField="0" baseItem="0"/>`)}let z=`<dataFields count="${O.length}">${O.join("")}</dataFields>`,V=[a?"":'rowGrandTotals="0"',l?"":'colGrandTotals="0"'].filter(Boolean),st=V.length?" "+V.join(" "):"",ct=b(o.style??"PivotStyleMedium9"),at=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
172
+ <pivotTableDefinition xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="${b(o.name)}" cacheId="${n}" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" useAutoFormatting="1" itemPrintTitles="1" createdVersion="6" indent="0" outline="1" outlineData="1" multipleFieldFilters="0"${st}>
173
+ <location ref="${M}" firstHeaderRow="1" firstDataRow="2" firstDataCol="${T}"/>
174
+ <pivotFields count="${P}">${E}</pivotFields>
175
+ ${_}${A}${N}${j}${z}
176
+ <pivotTableStyleInfo name="${ct}" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/>
177
+ </pivotTableDefinition>`,pt=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
178
+ <pivotCacheDefinition xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId1" refreshedBy="ExcelForge" refreshedDate="45000" createdVersion="6" refreshedVersion="6" minRefreshableVersion="3" recordCount="${s.length}" saveData="1">
179
+ <cacheSource type="worksheet"><worksheetSource ref="${o.sourceRef}" sheet="${b(o.sourceSheet)}"/></cacheSource>
180
+ <cacheFields count="${P}">${H}</cacheFields>
181
+ </pivotCacheDefinition>`,v=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
182
+ <pivotCacheRecords xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" count="${s.length}">${G}</pivotCacheRecords>`;return{pivotTableXml:at,cacheDefXml:pt,cacheRecordsXml:v}}var lo={button:"Button",checkBox:"Checkbox",comboBox:"Drop",listBox:"List",optionButton:"Radio",groupBox:"GBox",label:"Label",scrollBar:"Scroll",spinner:"Spin",dialog:"Dialog"},or={...lo,checkBox:"CheckBox",dialog:"Dialog"},Oo={...Object.fromEntries(Object.entries(lo).map(([o,t])=>[t,o])),CheckBox:"checkBox"},Xo={unchecked:"0",checked:"1",mixed:"2"},Uo={0:"unchecked",1:"checked",2:"mixed"};function Vo(o){if(o._ctrlPropXml)return o._ctrlPropXml;let e=[`objectType="${or[o.type]??"Button"}"`,'lockText="1"'];if(o.linkedCell&&e.push(`fmlaLink="${b(o.linkedCell)}"`),o.inputRange&&e.push(`fmlaRange="${b(o.inputRange)}"`),o.checked!==void 0&&e.push(`checked="${Xo[o.checked]??"0"}"`),o.dropLines!==void 0&&e.push(`dropLines="${o.dropLines}"`),o.min!==void 0&&e.push(`min="${o.min}"`),o.max!==void 0&&e.push(`max="${o.max}"`),o.inc!==void 0&&e.push(`inc="${o.inc}"`),o.page!==void 0&&e.push(`page="${o.page}"`),o.val!==void 0&&e.push(`val="${o.val}"`),o.selType){let n={single:"Single",multi:"Multi",extend:"Extend"};e.push(`selType="${n[o.selType]??"Single"}"`)}return o.noThreeD&&e.push('noThreeD="1"'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
183
+ <formControlPr xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" ${e.join(" ")}/>`}function nr(o,t){return`${o.col}, ${o.colOff??0}, ${o.row}, ${o.rowOff??0}, ${t.col}, ${t.colOff??0}, ${t.row}, ${t.rowOff??0}`}function zo(o,t){if(o._vmlShapeXml)return o._vmlShapeXml;let e=lo[o.type]??"Button",n=nr(o.from,o.to),r=[];if(r.push(`<x:Anchor>${n}</x:Anchor>`),r.push("<x:PrintObject>False</x:PrintObject>"),r.push("<x:AutoFill>False</x:AutoFill>"),o.macro&&r.push(`<x:FmlaMacro>${b(o.macro)}</x:FmlaMacro>`),o.linkedCell&&r.push(`<x:FmlaLink>${b(o.linkedCell)}</x:FmlaLink>`),o.inputRange&&r.push(`<x:FmlaRange>${b(o.inputRange)}</x:FmlaRange>`),o.checked!==void 0&&r.push(`<x:Checked>${Xo[o.checked]??"0"}</x:Checked>`),o.dropLines!==void 0&&r.push(`<x:DropLines>${o.dropLines}</x:DropLines>`),o.dropStyle&&r.push(`<x:DropStyle>${b(o.dropStyle)}</x:DropStyle>`),o.min!==void 0&&r.push(`<x:Min>${o.min}</x:Min>`),o.max!==void 0&&r.push(`<x:Max>${o.max}</x:Max>`),o.inc!==void 0&&r.push(`<x:Inc>${o.inc}</x:Inc>`),o.page!==void 0&&r.push(`<x:Page>${o.page}</x:Page>`),o.val!==void 0&&r.push(`<x:Val>${o.val}</x:Val>`),o.selType){let d={single:"Single",multi:"Multi",extend:"Extend"};r.push(`<x:Sel>${d[o.selType]??"Single"}</x:Sel>`)}o.noThreeD&&r.push("<x:NoThreeD/>"),o.isDefault&&r.push("<x:Default/>"),o.isDismiss&&r.push("<x:Dismiss/>"),o.isCancel&&r.push("<x:Cancel/>");let s="";o.text&&(o.type==="button"||o.type==="checkBox"||o.type==="optionButton"||o.type==="groupBox"||o.type==="label"||o.type==="dialog")&&(s=`<v:textbox style="mso-direction-alt:auto"><div style="text-align:${o.type==="button"?"center":"left"}"><font face="Calibri" size="220" color="#000000">${b(o.text)}</font></div></v:textbox>`,r.push("<x:TextHAlign>Center</x:TextHAlign>"),r.push("<x:TextVAlign>Center</x:TextVAlign>"));let i=(o.from.col*64+(o.from.colOff??0))*.75,a=(o.from.row*20+(o.from.rowOff??0))*.75,l=(o.to.col-o.from.col)*64*.75,m=(o.to.row-o.from.row)*20*.75,c=o.text??`${o.type}_${t}`,h=o.type==="dialog"?"":' filled="f" stroked="f"';return`<v:shape o:spid="_x0000_s${t}" id="${b(c)}" type="#_x0000_t201" style="position:absolute;margin-left:${i.toFixed(1)}pt;margin-top:${a.toFixed(1)}pt;width:${l.toFixed(1)}pt;height:${m.toFixed(1)}pt;z-index:${t}"${h} o:insetmode="auto"><o:lock v:ext="edit" rotation="t"/>${s}<x:ClientData ObjectType="${e}">${r.join("")}</x:ClientData></v:shape>`}function Wo(o,t){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">
184
+ <o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout>
185
+ <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>
186
+ <v:shapetype id="_x0000_t201" coordsize="21600,21600" o:spt="201" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path shadowok="f" o:extrusionok="f" strokeok="f" fillok="f" o:connecttype="rect"/><o:lock v:ext="edit" shapetype="t"/></v:shapetype>
187
+ ${o.join(`
188
+ `)}
189
+ ${t.join(`
190
+ `)}
191
+ </xml>`}function Ho(o){return o<=16?4:o<=32?5:o<=64?6:o<=128?7:o<=256?8:o<=512?9:o<=1024?10:o<=2048?11:12}function co(o){let t=[1],e=0;for(;e<o.length;){let n=e,r=Math.min(e+4096,o.length),s=rr(o,n,r);if(s.length<4096){let a=45056|s.length+2-3&4095;t.push(a&255,a>>8&255);for(let l of s)t.push(l)}else{t.push(255,63);for(let a=n;a<r;a++)t.push(o[a]);for(let a=r-n;a<4096;a++)t.push(0)}e=r}return new Uint8Array(t)}function rr(o,t,e){let n=[],r=0;for(;t+r<e;){let s=0,i=n.length;n.push(0);for(let a=0;a<8&&t+r<e;a++){if(r===0){n.push(o[t]),r++;continue}let l=Ho(r),m=1<<l,c=16-l,h=(1<<c)-1+3,d=Math.max(0,r-m),f=0,p=0;for(let u=d;u<r;u++){let x=0;for(;r+x<e-t&&x<h&&o[t+u+x]===o[t+r+x];)x++;x>p&&(p=x,f=r-u)}if(p>=3){s|=1<<a;let u=f-1<<c|p-3;n.push(u&255,u>>8&255),r+=p}else n.push(o[t+r]),r++}n[i]=s}return n}function mo(o){if(o.length===0||o[0]!==1)throw new Error("Invalid OVBA compressed container (bad signature)");let t=[],e=1;for(;e<o.length&&!(e+1>=o.length);){let n=o[e]|o[e+1]<<8;e+=2;let r=(n&4095)+3,s=n>>15&1,i=r-2,a=e+i;if(s){let l=t.length;for(;e<a&&e<o.length;){let m=o[e++];for(let c=0;c<8&&e<a&&e<o.length;c++)if((m&1<<c)===0)t.push(o[e++]);else{if(e+1>=o.length)break;let h=o[e]|o[e+1]<<8;e+=2;let d=t.length-l,p=16-Ho(d),u=(h>>p)+1,x=(h&(1<<p)-1)+3,$=t.length-u;for(let y=0;y<x;y++)t.push(t[$+y])}}}else{for(let l=0;l<4096&&e<o.length;l++)t.push(o[e++]);e=Math.max(e,a)}}return new Uint8Array(t)}var qo=new Uint8Array([208,207,17,224,161,177,26,225]),ee=4294967294,he=4294967295,sr=4294967293,me=4294967295,Et=512,Le=64,Go=4096,je=128;function ho(o,t){return o[t]|o[t+1]<<8}function Ot(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0}function ce(o,t,e){o[t]=e&255,o[t+1]=e>>8&255}function wt(o,t,e){o[t]=e&255,o[t+1]=e>>8&255,o[t+2]=e>>16&255,o[t+3]=e>>24&255}function ar(o){if(o.length>31)throw new Error(`CFB entry name too long (${o.length} chars, max 31): "${o}"`);let t=new Uint8Array(64),e=0;for(let n of o){let r=n.charCodeAt(0);t[e++]=r&255,t[e++]=r>>8&255}return t[e++]=0,t[e++]=0,{bytes:t,size:e}}function ir(o,t,e){let n="",r=Math.max(0,e-2);for(let s=0;s<r;s+=2){let i=o[t+s]|o[t+s+1]<<8;if(i===0)break;n+=String.fromCharCode(i)}return n}function Fe(o,t){let e=[],n=t;for(;n!==ee&&n<o.length;)e.push(n),n=o[n];return e}function Ne(o,t){return Math.ceil(o/t)}function Ko(o){for(let T=0;T<8;T++)if(o[T]!==qo[T])throw new Error("Not a CFB file");let e=1<<ho(o,30),r=1<<ho(o,32),s=Ot(o,44),i=Ot(o,48),a=Ot(o,60),l=T=>512+T*e,m=[];for(let T=0;T<109&&T<s;T++){let S=Ot(o,76+T*4);S!==he&&m.push(S)}let c=Math.floor((o.length-512)/e),h=new Uint32Array(c);h.fill(he);for(let T=0;T<m.length;T++){let S=l(m[T]),k=e/4;for(let L=0;L<k&&T*k+L<c;L++)h[T*k+L]=Ot(o,S+L*4)}let d=Fe(h,i),f=new Uint8Array(d.length*e);for(let T=0;T<d.length;T++)f.set(o.subarray(l(d[T]),l(d[T])+e),T*e);let p=f.length/je,u=[];for(let T=0;T<p;T++){let S=T*je,k=ho(f,S+64);k!==0&&u.push({name:ir(f,S,k),type:f[S+66],child:Ot(f,S+76),left:Ot(f,S+68),right:Ot(f,S+72),startSector:Ot(f,S+116),size:Ot(f,S+120),index:T})}let x=u.find(T=>T.type===5);if(!x)throw new Error("No root entry in CFB");let $=Fe(h,x.startSector),y=new Uint8Array($.length*e);for(let T=0;T<$.length;T++)y.set(o.subarray(l($[T]),l($[T])+e),T*e);let I=Fe(h,a),R=I.length*(e/4),w=new Uint32Array(R);w.fill(he);for(let T=0;T<I.length;T++){let S=l(I[T]),k=e/4;for(let L=0;L<k;L++)w[T*k+L]=Ot(o,S+L*4)}let C=new Map;function g(T,S){let k=u.find(P=>P.index===T);if(!k||k.child===me)return;let L=P=>{if(P===me||P>=p)return;let U=u.find(H=>H.index===P);U&&(C.set(P,S),U.type===1&&g(P,U.name),L(U.left),L(U.right))};L(k.child)}g(x.index,"");let M=[];for(let T of u){if(T.type!==2)continue;let S;if(T.size<Go){let k=Fe(w,T.startSector),L=new Uint8Array(k.length*r);for(let P=0;P<k.length;P++){let U=k[P]*r;L.set(y.subarray(U,U+r),P*r)}S=L.subarray(0,T.size)}else{let k=Fe(h,T.startSector),L=new Uint8Array(k.length*e);for(let P=0;P<k.length;P++)L.set(o.subarray(l(k[P]),l(k[P])+e),P*e);S=L.subarray(0,T.size)}M.push({name:T.name,data:S,storage:C.get(T.index)||void 0})}return M}function Zo(o){let t={name:"Root Entry",type:5,children:[]},e=new Map;e.set("",t);for(let P of o){let U=P.storage??"",H=e.get(U);H||(H={name:U,type:1,children:[]},e.set(U,H),t.children.push(H));let G={name:P.name,type:2,data:P.data};H.children.push(G)}let n=[],r=[t];for(;r.length;){let P=r.shift();if(n.push({node:P,parentIdx:-1,childIdx:me,leftIdx:me,rightIdx:me,miniStart:0,size:P.data?.length??0}),P.children)for(let U of P.children)r.push(U)}for(let P=0;P<n.length;P++){let U=n[P].node;if(!U.children?.length)continue;let H=n.map((_,A)=>({e:_,idx:A})).filter(({e:_})=>U.children.includes(_.node)).map(({idx:_})=>_);if(H.length===0)continue;let G=H.sort((_,A)=>{let N=n[_].node.name,j=n[A].node.name;return N.length!==j.length?N.length-j.length:N.toUpperCase()<j.toUpperCase()?-1:N.toUpperCase()>j.toUpperCase()?1:0}),E=_=>{if(_.length===0)return me;let A=_.length>>1;return n[_[A]].leftIdx=E(_.slice(0,A)),n[_[A]].rightIdx=E(_.slice(A+1)),_[A]};n[P].childIdx=E(G)}let s=[],i=new Map,a=0;for(let P=0;P<n.length;P++){let U=n[P].node.data;if(!U||U.length===0)continue;let H=Ne(U.length,Le),G=[];for(let E=0;E<H;E++){G.push(a++);let _=U.subarray(E*Le,Math.min((E+1)*Le,U.length));for(let A of _)s.push(A);for(let A=_.length;A<Le;A++)s.push(0)}n[P].miniStart=G[0],i.set(P,G)}let m=Math.max(a,1),c=Ne(m*4,Et),h=new Uint32Array(c*(Et/4));h.fill(he);for(let P of i.values())for(let U=0;U<P.length;U++)h[P[U]]=U+1<P.length?P[U+1]:ee;let d=new Uint8Array(s),f=Ne(d.length||1,Et),p=n.length,u=Ne(p*je,Et),x=0,$=1,y=$+u,I=y+c,R=1+u+c+f,w=new Uint32Array(Et/4);w.fill(he),w[x]=sr;for(let P=0;P<u;P++)w[$+P]=P+1<u?$+P+1:ee;for(let P=0;P<c;P++)w[y+P]=P+1<c?y+P+1:ee;for(let P=0;P<f;P++)w[I+P]=P+1<f?I+P+1:ee;n[0].miniStart=I,n[0].size=d.length;let C=new Uint8Array(u*Et);for(let P=0;P<n.length;P++){let U=P*je,H=n[P],{bytes:G,size:E}=ar(H.node.name);C.set(G,U),ce(C,U+64,E),C[U+66]=H.node.type,C[U+67]=1,wt(C,U+68,H.leftIdx),wt(C,U+72,H.rightIdx),wt(C,U+76,H.childIdx),H.node.type===5?(wt(C,U+116,I),wt(C,U+120,d.length)):H.node.type===2&&H.node.data&&H.node.data.length>0?(wt(C,U+116,H.miniStart),wt(C,U+120,H.node.data.length)):H.node.type===1?(wt(C,U+116,0),wt(C,U+120,0)):(wt(C,U+116,ee),wt(C,U+120,0))}let g=new Uint8Array(512);g.set(qo,0),ce(g,24,62),ce(g,26,3),ce(g,28,65534),ce(g,30,9),ce(g,32,6),wt(g,44,1),wt(g,48,$),wt(g,56,Go),wt(g,60,y),wt(g,64,c),wt(g,68,ee),wt(g,72,0),wt(g,76,x);for(let P=1;P<109;P++)wt(g,76+P*4,he);let M=512+R*Et,T=new Uint8Array(M);T.set(g,0);let S=new Uint8Array(Et);for(let P=0;P<w.length;P++)wt(S,P*4,w[P]);T.set(S,512+x*Et),T.set(C,512+$*Et);let k=new Uint8Array(c*Et);for(let P=0;P<h.length;P++)wt(k,P*4,h[P]);T.set(k,512+y*Et);let L=new Uint8Array(f*Et);return L.set(d),T.set(L,512+I*Et),T}var Oe=new TextEncoder,Xe=new TextDecoder("utf-8");function oe(o){return[o&255,o>>8&255]}function zt(o){return[o&255,o>>8&255,o>>16&255,o>>24&255]}function lr(o,t){return o[t]|o[t+1]<<8}function Yo(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0}function ht(o,t){let e=t instanceof Uint8Array?Array.from(t):t;return[...oe(o),...zt(e.length),...e]}function cr(o){let t=[];for(let e of o){let n=e.charCodeAt(0);t.push(n&255,n>>8&255)}return t}function mr(o){let t=[`Attribute VB_Name = "${o.name}"`];if(o.type==="document"){let e=o.name==="ThisWorkbook"?"0{00020819-0000-0000-C000-000000000046}":"0{00020820-0000-0000-C000-000000000046}";t.push(`Attribute VB_Base = "${e}"`,"Attribute VB_GlobalNameSpace = False","Attribute VB_Creatable = False","Attribute VB_PredeclaredId = True","Attribute VB_Exposed = True","Attribute VB_TemplateDerived = False","Attribute VB_Customizable = True")}else o.type==="class"&&t.push("Attribute VB_GlobalNameSpace = False","Attribute VB_Creatable = False","Attribute VB_PredeclaredId = False","Attribute VB_Exposed = False");return t.join(`\r
192
+ `)+`\r
193
+ `}var Se=class o{constructor(){this.modules=[],this._dirty=!1}addModule(t){return this.modules.push(t),this._dirty=!0,this}removeModule(t){return this.modules=this.modules.filter(e=>e.name!==t),this._dirty=!0,this}getModule(t){return this.modules.find(e=>e.name===t)}build(){if(this._raw&&!this._dirty)return this._raw;let e=this.modules.some(p=>p.name==="ThisWorkbook"&&p.type==="document")?this.modules:[{name:"ThisWorkbook",type:"document",code:""},...this.modules],n=[...e.filter(p=>p.type==="document"),...e.filter(p=>p.type!=="document")],r=[];for(let p of n){let u=mr(p)+p.code,x=co(Oe.encode(u));r.push({name:p.name,data:x,storage:"VBA"})}let s={name:"_VBA_PROJECT",data:new Uint8Array([204,97,255,255,0,0,0]),storage:"VBA"},i=this._buildDirStream(n),l={name:"dir",data:co(i),storage:"VBA"},m=this._buildProjectText(n),c={name:"PROJECT",data:Oe.encode(m)},h=this._buildProjectWm(n),d={name:"PROJECTwm",data:new Uint8Array(h)},f=[s,l,...r,c,d];return Zo(f)}_buildDirStream(t){let e=[],r=Oe.encode("VBAProject");e.push(...ht(1,zt(1))),e.push(...ht(2,zt(1033))),e.push(...ht(20,zt(1033))),e.push(...ht(3,oe(1252))),e.push(...ht(4,Array.from(r))),e.push(...ht(5,[])),e.push(...ht(64,[])),e.push(...ht(6,[])),e.push(...ht(61,[])),e.push(...ht(7,zt(0))),e.push(...ht(8,zt(0))),e.push(...oe(9),...zt(4),...zt(1443),...oe(2)),e.push(...ht(12,[])),e.push(...ht(60,[])),e.push(...ht(15,oe(t.length))),e.push(...ht(19,oe(65535)));for(let s of t){let i=Oe.encode(s.name),a=cr(s.name);e.push(...ht(25,Array.from(i))),e.push(...ht(71,a)),e.push(...ht(26,Array.from(i))),e.push(...ht(50,a)),e.push(...ht(28,[])),e.push(...ht(72,[])),e.push(...ht(49,zt(0))),e.push(...ht(30,zt(0))),e.push(...ht(44,oe(65535))),s.type==="document"?e.push(...ht(34,[])):e.push(...ht(33,[])),e.push(...ht(43,[]))}return e.push(...ht(16,[])),new Uint8Array(e)}_buildProjectText(t){let e=['ID="{00000000-0000-0000-0000-000000000000}"'],n=t.filter(s=>s.type==="document"),r=t.filter(s=>s.type!=="document");for(let s of n)e.push(`Document=${s.name}/&H00000000`);for(let s of r)s.type==="class"?e.push(`Class=${s.name}`):e.push(`Module=${s.name}`);e.push('Name="VBAProject"',"HelpContextID=0",'VersionCompatible32="393222000"',"","[Host Extender Info]","&H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000","","[Workspace]");for(let s of[...n,...r])e.push(`${s.name}=0, 0, 0, 0, C `);return e.join(`\r
194
+ `)+`\r
195
+ `}_buildProjectWm(t){let e=[];for(let n of t){for(let r of n.name)e.push(r.charCodeAt(0));e.push(0);for(let r of n.name){let s=r.charCodeAt(0);e.push(s&255,s>>8&255)}e.push(0,0)}return e.push(0),e}static fromBytes(t){let e=new o;e._raw=t;let n=Ko(t),r=new Map;for(let c of n){let h=c.storage?`${c.storage}/${c.name}`:c.name;r.set(h,c.data)}let s=r.get("VBA/dir");if(!s)return e;let i;try{i=mo(s)}catch{return e}let a=new Set,l=r.get("PROJECT");if(l){let c=Xe.decode(l);for(let h of c.split(/\r?\n/)){let d=h.match(/^Class=(.+)$/);d&&a.add(d[1])}}let m=hr(i);for(let c of m){let h=`VBA/${c.name}`,d=r.get(h);if(!d)continue;let f="";try{let x=d.subarray(c.offset),$=mo(x);f=Xe.decode($)}catch{f=Xe.decode(d.subarray(c.offset))}let p=dr(f),u=a.has(c.name)?"class":c.type;e.modules.push({name:c.name,type:u,code:p})}return e._dirty=!1,e}};function hr(o){let t=[],e=0,n=null;for(;e+6<=o.length;){let r=lr(o,e),s=Yo(o,e+2);if(e+=6,r===9){e+=6;continue}if(e+s>o.length)break;let i=o.subarray(e,e+s);switch(e+=s,r){case 25:n={name:Xe.decode(i),type:"standard",offset:0};break;case 49:n&&i.length>=4&&(n.offset=Yo(i,0));break;case 33:n&&(n.type="standard");break;case 34:n&&(n.type="document");break;case 43:n?.name&&t.push(n),n=null;break}}return t}function dr(o){let t=o.split(/\r?\n/),e=t.findIndex(r=>!r.startsWith("Attribute "));return e<0?o:t.slice(e).join(`
196
+ `)}var Ie=null;function fr(){if(Ie)return Ie;Ie=new Uint32Array(256);for(let o=0;o<256;o++){let t=o;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;Ie[o]=t}return Ie}function pr(o){let t=fr(),e=4294967295;for(let n=0;n<o.length;n++)e=e>>>8^t[(e^o[n])&255];return(e^4294967295)>>>0}var Ue=class{constructor(t=65536){this.pos=0,this.bits=0,this.bitLen=0,this.buf=new Uint8Array(t)}grow(){let t=new Uint8Array(this.buf.length*2);t.set(this.buf),this.buf=t}writeBits(t,e){for(this.bits|=(t&(1<<e)-1)<<this.bitLen,this.bitLen+=e;this.bitLen>=8;)this.pos>=this.buf.length&&this.grow(),this.buf[this.pos++]=this.bits&255,this.bits>>>=8,this.bitLen-=8}writeByte(t){this.pos>=this.buf.length&&this.grow(),this.buf[this.pos++]=t}flush(){this.bitLen>0&&(this.writeByte(this.bits&255),this.bits=0,this.bitLen=0)}toBytes(){return this.buf.subarray(0,this.pos)}};function fo(o,t){let e=o.length,n=new Uint8Array(e),r=[];for(let c=0;c<e;c++)o[c]>0&&r.push(c);if(r.length===0)return n;if(r.length===1)return n[r[0]]=1,n;let s=r.map(c=>({freq:o[c],sym:c})),i=(c,h,d)=>{for(;;){let f=h,p=2*h+1,u=2*h+2;if(p<d&&c[p].freq<c[f].freq&&(f=p),u<d&&c[u].freq<c[f].freq&&(f=u),f===h)break;let x=c[h];c[h]=c[f],c[f]=x,h=f}},a=(c,h)=>{for(;h>0;){let d=h-1>>1;if(c[d].freq<=c[h].freq)break;let f=c[h];c[h]=c[d],c[d]=f,h=d}};for(let c=(s.length>>1)-1;c>=0;c--)i(s,c,s.length);let l=s.length;for(;l>1;){let c=s[0];s[0]=s[--l],i(s,0,l);let h=s[0];s[0]={freq:c.freq+h.freq,sym:-1,left:c,right:h},i(s,0,l)}let m=(c,h)=>{if(c){if(c.sym>=0){n[c.sym]=Math.min(h,t);return}m(c.left,h+1),m(c.right,h+1)}};m(s[0],0);{let c=()=>{let f=0;for(let p=0;p<e;p++)n[p]>0&&(f+=1<<t-n[p]);return f},h=1<<t,d=c();if(d>h){let f=d-h;for(let p=t-1;p>=1&&f>0;p--){let u=1<<t-p-1;for(let x=0;x<e&&f>0;x++)n[x]===p&&(n[x]=p+1,f-=u)}}for(d=c();d<h;){let f=!1;for(let p=0;p<e;p++)if(n[p]===t){n[p]--,d++,f=!0;break}if(!f)break}}return n}function Te(o){let t=Math.max(...o),e=new Uint32Array(t+1);for(let i of o)i>0&&e[i]++;let n=new Uint32Array(t+1),r=0;for(let i=1;i<=t;i++)r=r+e[i-1]<<1,n[i]=r;let s=new Uint32Array(o.length);for(let i=0;i<o.length;i++)o[i]>0&&(s[i]=n[o[i]]++);return s}function qt(o,t){let e=0;for(let n=0;n<t;n++)e=e<<1|o&1,o>>=1;return e}function ur(){let o=new Uint8Array(288);for(let t=0;t<=143;t++)o[t]=8;for(let t=144;t<=255;t++)o[t]=9;for(let t=256;t<=279;t++)o[t]=7;for(let t=280;t<=287;t++)o[t]=8;return o}function gr(){let o=new Uint8Array(32);return o.fill(5),o}var xr=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],$r=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],yr=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],wr=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],go=new Array(259);for(let o=0;o<29;o++){let t=$r[o],e=xr[o];for(let n=t;n<t+(1<<e);n++)n<=258&&(go[n]=[257+o,e,n-t])}go[258]=[285,0,0];function Qo(o){return go[o]}var nn=new Array(32769);for(let o=0;o<30;o++){let t=wr[o],e=yr[o];for(let n=t;n<t+(1<<e);n++)n<=32768&&(nn[n]=[o,e,n-t])}function Jo(o){return nn[o]}var Ht=32768,po=258,tn=3,br=8,vr=32,Cr=128;function Fr(o,t){let e=t<=1?br:t<=6?vr:Cr,n=o.length,r=Math.min(n+1,65536),s=new Uint16Array(r),i=new Uint16Array(r),a=0,l=()=>{if(a>=r){r=r*2;let x=new Uint16Array(r);x.set(s),s=x;let $=new Uint16Array(r);$.set(i),i=$}},m=65536,c=new Int32Array(m).fill(-1),h=new Int32Array(Math.min(n,Ht)).fill(-1),d=x=>((o[x]*4129^o[x+1]*155^o[x+2])&m-1)>>>0,f=0,p=x=>{l(),s[a]=x+1,i[a]=0,a++},u=(x,$)=>{l(),s[a]=x,i[a]=$,a++};for(;f<n;){if(f+2>=n){p(o[f++]);continue}let x=d(f),$=tn-1,y=0,I=c[x],R=0;for(;I>=0&&R<e;){let w=f-I;if(w>Ht)break;let C=0,g=Math.min(po,n-f);for(;C<g&&o[I+C]===o[f+C];)C++;if(C>$&&($=C,y=w),$===po)break;I=h[I&Ht-1],R++}if(h[f&Ht-1]=c[x],c[x]=f,$>=tn){if(t>=6&&f+3<n){let w=d(f+1),C=c[w],g=0,M=0,T=0;for(;C>=0&&T<e;){let S=f+1-C;if(S>Ht)break;let k=0,L=Math.min(po,n-f-1);for(;k<L&&o[C+k]===o[f+1+k];)k++;k>g&&(g=k,M=S),C=h[C&Ht-1],T++}if(g>$+1){p(o[f]),f++,h[f&Ht-1]=c[w],c[w]=f,u(g,M);for(let S=1;S<g;S++)if(f++,f+2<n){let k=d(f);h[f&Ht-1]=c[k],c[k]=f}f++;continue}}u($,y);for(let w=0;w<$;w++)if(f+w+2<n){let C=d(f+w);h[f+w&Ht-1]=c[C],c[C]=f+w}f+=$}else p(o[f++])}return{litLen:s,dist:i,count:a}}function Sr(o,t,e,n){let r=0;for(;r<o.length;){let s=o[r];if(s===0){let i=0;for(;r+i<o.length&&o[r+i]===0&&i<138;)i++;i<3?(t.writeBits(qt(e[0],n[0]),n[0]),r++):i<=10?(t.writeBits(qt(e[17],n[17]),n[17]),t.writeBits(i-3,3),r+=i):(t.writeBits(qt(e[18],n[18]),n[18]),t.writeBits(i-11,7),r+=i)}else{t.writeBits(qt(e[s],n[s]),n[s]),r++;let i=0;for(;r+i<o.length&&o[r+i]===s&&i<6;)i++;i>=3&&(t.writeBits(qt(e[16],n[16]),n[16]),t.writeBits(i-3,2),r+=i)}}}function en(o,t,e,n){let r=new Uint32Array(286),s=new Uint32Array(30);r[256]=1;let{litLen:i,dist:a,count:l}=o;for(let p=0;p<l;p++)if(a[p]===0)r[i[p]-1]++;else{let[u]=Qo(i[p]);r[u]++;let[x]=Jo(a[p]);s[x]++}let m,c,h,d;if(n){m=fo(r,15),c=fo(s,15),c.every(C=>C===0)&&(c[0]=1),h=Te(m),d=Te(c);let p=on(m,257,286)+1,u=on(c,1,30)+1,x=[...m.subarray(0,p),...c.subarray(0,u)],$=new Uint32Array(19);Tr(x,$);let y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I=fo($,7),R=Te(I),w=Ir(y.map(C=>I[C]),4,19)+1;t.writeBits(e?1:0,1),t.writeBits(2,2),t.writeBits(p-257,5),t.writeBits(u-1,5),t.writeBits(w-4,4);for(let C=0;C<w;C++)t.writeBits(I[y[C]],3);Sr(x,t,R,I)}else m=ur(),c=gr(),h=Te(m),d=Te(c),t.writeBits(e?1:0,1),t.writeBits(1,2);for(let p=0;p<l;p++)if(a[p]===0){let u=i[p]-1,x=m[u];t.writeBits(qt(h[u],x),x)}else{let[u,x,$]=Qo(i[p]),y=m[u];t.writeBits(qt(h[u],y),y),x>0&&t.writeBits($,x);let[I,R,w]=Jo(a[p]),C=c[I];t.writeBits(qt(d[I],C),C),R>0&&t.writeBits(w,R)}let f=m[256];t.writeBits(qt(h[256],f),f)}function on(o,t,e){let n=t-1;for(let r=t;r<Math.min(o.length,e);r++)o[r]>0&&(n=r);return Math.max(n,t-1)}function Ir(o,t,e){let n=t-1;for(let r=t;r<Math.min(o.length,e);r++)o[r]>0&&(n=r);return Math.max(n,t-1)}function Tr(o,t){let e=0;for(;e<o.length;){let n=o[e];if(n===0){let r=0;for(;e+r<o.length&&o[e+r]===0&&r<138;)r++;r<3?(t[0]++,e++):r<=10?(t[17]++,e+=r):(t[18]++,e+=r)}else{t[n]++,e++;let r=0;for(;e+r<o.length&&o[e+r]===n&&r<6;)r++;r>=3&&(t[16]++,e+=r)}}}var uo=65536;function Ar(o,t=6){if(t===0){let i=new Ue,a=0;for(;a<o.length||o.length===0;){let l=Math.min(uo,o.length-a),m=a+l>=o.length;i.flush(),i.writeBits(m?1:0,1),i.writeBits(0,2),i.flush();let c=l;for(i.writeByte(c&255),i.writeByte(c>>8&255),i.writeByte(~c&255),i.writeByte(~c>>8&255);i.pos+l>i.buf.length;)i.buf=(()=>{let h=new Uint8Array(i.buf.length*2);return h.set(i.buf),h})();if(i.buf.set(o.subarray(a,a+l),i.pos),i.pos+=l,a+=l,o.length===0)break}return i.toBytes()}let e=Math.max(1,Math.min(9,t)),n=e>=2,r=new Ue,s=0;for(;s<o.length||o.length===0;){let i=o.subarray(s,s+uo),a=s+uo>=o.length,l=Fr(i,e);if(en(l,r,a,n),s+=i.length,o.length===0){en({litLen:new Uint16Array(0),dist:new Uint16Array(0),count:0},r,!0,n);break}}return r.flush(),r.toBytes()}function $t(o,t,e){o[t]=e&255,o[t+1]=e>>8&255}function _t(o,t,e){o[t]=e&255,o[t+1]=e>>8&255,o[t+2]=e>>16&255,o[t+3]=e>>24&255}var kr=new TextEncoder,Dr=new Set(["png","jpg","jpeg","gif","tiff","emf","wmf","bmp","webp"]);function xo(o,t={}){let e=t.level??6,n=t.noCompress?new Set(t.noCompress.map(p=>p.toLowerCase())):Dr,r=[],s=[],i=0;for(let p of o){let u=kr.encode(p.name),x=p.name.split(".").pop()?.toLowerCase()??"",$=p.level??(n.has(x)?0:e),y=$>0&&p.data.length>0,I=pr(p.data),R,w;y?(R=Ar(p.data,$),R.length>=p.data.length?(R=p.data,w=0):w=8):(R=p.data,w=0);let C=new Uint8Array(30+u.length);_t(C,0,67324752),$t(C,4,20),$t(C,6,0),$t(C,8,w),$t(C,10,0),$t(C,12,0),_t(C,14,I),_t(C,18,R.length),_t(C,22,p.data.length),$t(C,26,u.length),$t(C,28,0),C.set(u,30);let g=new Uint8Array(46+u.length);_t(g,0,33639248),$t(g,4,20),$t(g,6,20),$t(g,8,0),$t(g,10,w),$t(g,12,0),$t(g,14,0),_t(g,16,I),_t(g,20,R.length),_t(g,24,p.data.length),$t(g,28,u.length),$t(g,30,0),$t(g,32,0),$t(g,34,0),$t(g,36,0),_t(g,38,0),_t(g,42,i),g.set(u,46),r.push(C,R),s.push(g),i+=C.length+R.length}let a=i,l=s.reduce((p,u)=>p+u.length,0),m=new Uint8Array(22);_t(m,0,101010256),$t(m,4,0),$t(m,6,0),$t(m,8,s.length),$t(m,10,s.length),_t(m,12,l),_t(m,16,a),$t(m,20,0);let c=[...r,...s,m],h=c.reduce((p,u)=>p+u.length,0),d=new Uint8Array(h),f=0;for(let p of c)d.set(p,f),f+=p.length;return d}function ne(o,t){return o[t]|o[t+1]<<8}function de(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0}async function Pr(o){let t=new DecompressionStream("deflate-raw"),e=t.writable.getWriter(),n=t.readable.getReader();e.write(o),e.close();let r=[],s=!1;for(;!s;){let{value:m,done:c}=await n.read();m&&r.push(m),s=c}let i=r.reduce((m,c)=>m+c.length,0),a=new Uint8Array(i),l=0;for(let m of r)a.set(m,l),l+=m.length;return a}async function $o(o){let t=new TextDecoder("utf-8"),e=new Map,n=-1;for(let a=o.length-22;a>=0;a--)if(o[a]===80&&o[a+1]===75&&o[a+2]===5&&o[a+3]===6){n=a;break}if(n<0)throw new Error("Not a valid ZIP file (EOCD not found)");let r=de(o,n+16),s=ne(o,n+8),i=r;for(let a=0;a<s;a++){if(de(o,i)!==33639248)throw new Error("Invalid central directory entry");let l=ne(o,i+10),m=de(o,i+20),c=de(o,i+24),h=ne(o,i+28),d=ne(o,i+30),f=ne(o,i+32),p=de(o,i+42),u=o.subarray(i+46,i+46+h),x=t.decode(u);i+=46+h+d+f;let $=p;if(de(o,$)!==67324752)throw new Error("Invalid local file header");let y=ne(o,$+26),I=ne(o,$+28),R=$+30+y+I,w=o.subarray(R,R+m),C;l===0?C=w.slice():l===8?C=await Pr(w):C=w.slice(),x.endsWith("/")||e.set(x,{name:x,data:C})}return e}function Ve(o){return new TextDecoder("utf-8").decode(o.data)}function Ae(o){let t=Object.entries(o.attrs).map(([r,s])=>`${r}="${Rr(s)}"`).join(" "),e=t?`<${o.tag} ${t}`:`<${o.tag}`,n=(o.text??"")+o.children.map(Ae).join("");return n?`${e}>${n}</${o.tag}>`:`${e}/>`}function Rr(o){return o.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function It(o){let t=[],e=[],n=0;for(o.startsWith("<?")&&(n=o.indexOf("?>")+2);n<o.length;){if(o[n]!=="<"){let h=o.indexOf("<",n),d=h<0?o.slice(n):o.slice(n,h);if(e.length&&d.trim()){let f=e[e.length-1];f.text=(f.text??"")+rn(d)}n=h<0?o.length:h;continue}if(o.startsWith("<!--",n)){let h=o.indexOf("-->",n);if(e.length){let d=e[e.length-1];d.text=(d.text??"")+o.slice(n,h+3)}n=h+3;continue}if(o.startsWith("<![CDATA[",n)){let h=o.indexOf("]]>",n),d=o.slice(n+9,h);if(e.length){let f=e[e.length-1];f.text=(f.text??"")+d}n=h+3;continue}if(o[n+1]==="/"){let h=o.indexOf(">",n),d=e.pop();e.length?e[e.length-1].children.push(d):t.push(d),n=h+1;continue}if(o[n+1]==="?"){n=o.indexOf("?>",n)+2;continue}let r=Mr(o,n),s=o.slice(n+1,r),i=s.endsWith("/"),a=i?s.slice(0,-1).trim():s.trim(),{tag:l,attrs:m}=Er(a),c={tag:l,attrs:m,children:[]};i?e.length?e[e.length-1].children.push(c):t.push(c):e.push(c),n=r+1}for(;e.length>1;){let r=e.pop();e[e.length-1].children.push(r)}if(e.length===1&&t.push(e[0]),t.length===0)throw new Error("Empty XML document");return t[0]}function Mr(o,t){let e=null;for(let n=t+1;n<o.length;n++){let r=o[n];if(e)r===e&&(e=null);else if(r==='"'||r==="'")e=r;else if(r===">")return n}return o.length-1}function Er(o){let t={},e=o.search(/\s/),n=e<0?o:o.slice(0,e);if(e<0)return{tag:n,attrs:t};let r=o.slice(e),s=/(\S+?)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,i;for(;(i=s.exec(r))!==null;)t[i[1]]=rn(i[2]??i[3]??"");return{tag:n,attrs:t}}function rn(o){return o.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(t,e)=>String.fromCharCode(parseInt(e,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCharCode(parseInt(e,16)))}function D(o,t){return o.children.find(e=>Q(e.tag)===t)}function tt(o,t){return o.children.filter(e=>Q(e.tag)===t)}function sn(o,t){if(o.attrs[t]!==void 0)return o.attrs[t];let e=Q(t);for(let[n,r]of Object.entries(o.attrs))if(Q(n)===e)return r}function Q(o){let t=o.indexOf(":");return t<0?o:o.slice(t+1)}function _r(o){return o.toISOString()}function yo(o){let t=(n,r)=>r!==void 0?`<${n}>${b(r)}</${n}>`:"",e=(n,r)=>r?`<${n} xsi:type="dcterms:W3CDTF">${_r(r)}</${n}>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
136
197
  <cp:coreProperties
137
198
  xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
138
199
  xmlns:dc="http://purl.org/dc/elements/1.1/"
139
200
  xmlns:dcterms="http://purl.org/dc/terms/"
140
201
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
141
- ${t("dc:title",s.title)}
142
- ${t("dc:subject",s.subject)}
143
- ${t("dc:creator",s.creator)}
144
- ${t("cp:keywords",s.keywords)}
145
- ${t("dc:description",s.description)}
146
- ${t("cp:lastModifiedBy",s.lastModifiedBy)}
147
- ${t("cp:revision",s.revision??"1")}
148
- ${t("dc:language",s.language)}
149
- ${t("dc:identifier",s.identifier)}
150
- ${t("cp:version",s.version)}
151
- ${t("cp:category",s.category)}
152
- ${t("cp:contentStatus",s.contentStatus)}
153
- ${e("dcterms:created",s.created??new Date)}
154
- ${e("dcterms:modified",s.modified??new Date)}
155
- </cp:coreProperties>`}function St(s,t){let e=(i,n)=>n!==void 0?`<${i}>${g(String(n))}</${i}>`:"",r="",o="";if(s.headingPairs?.length){let i=s.headingPairs.map(n=>`<vt:variant><vt:lpstr>${g(n.name)}</vt:lpstr></vt:variant><vt:variant><vt:i4>${n.count}</vt:i4></vt:variant>`).join("");r=`<HeadingPairs><vt:vector size="${s.headingPairs.length*2}" baseType="variant">${i}</vt:vector></HeadingPairs>`}if(s.titlesOfParts?.length){let i=s.titlesOfParts.map(n=>`<vt:lpstr>${g(n)}</vt:lpstr>`).join("");o=`<TitlesOfParts><vt:vector size="${s.titlesOfParts.length}" baseType="lpstr">${i}</vt:vector></TitlesOfParts>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
202
+ ${t("dc:title",o.title)}
203
+ ${t("dc:subject",o.subject)}
204
+ ${t("dc:creator",o.creator)}
205
+ ${t("cp:keywords",o.keywords)}
206
+ ${t("dc:description",o.description)}
207
+ ${t("cp:lastModifiedBy",o.lastModifiedBy)}
208
+ ${t("cp:revision",o.revision??"1")}
209
+ ${t("dc:language",o.language)}
210
+ ${t("dc:identifier",o.identifier)}
211
+ ${t("cp:version",o.version)}
212
+ ${t("cp:category",o.category)}
213
+ ${t("cp:contentStatus",o.contentStatus)}
214
+ ${e("dcterms:created",o.created??new Date)}
215
+ ${e("dcterms:modified",o.modified??new Date)}
216
+ </cp:coreProperties>`}function wo(o,t){let e=(s,i)=>i!==void 0?`<${s}>${b(String(i))}</${s}>`:"",n="",r="";if(o.headingPairs?.length){let s=o.headingPairs.map(i=>`<vt:variant><vt:lpstr>${b(i.name)}</vt:lpstr></vt:variant><vt:variant><vt:i4>${i.count}</vt:i4></vt:variant>`).join("");n=`<HeadingPairs><vt:vector size="${o.headingPairs.length*2}" baseType="variant">${s}</vt:vector></HeadingPairs>`}if(o.titlesOfParts?.length){let s=o.titlesOfParts.map(i=>`<vt:lpstr>${b(i)}</vt:lpstr>`).join("");r=`<TitlesOfParts><vt:vector size="${o.titlesOfParts.length}" baseType="lpstr">${s}</vt:vector></TitlesOfParts>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
156
217
  <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
157
218
  xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
158
- ${e("Application",s.application??"ExcelForge")}
159
- ${e("AppVersion",s.appVersion)}
160
- ${e("Company",s.company)}
161
- ${e("Manager",s.manager)}
162
- ${e("DocSecurity",s.docSecurity??0)}
163
- ${e("ScaleCrop",s.scaleCrop??!1)}
164
- ${e("LinksUpToDate",s.linksUpToDate??!1)}
165
- ${e("SharedDoc",s.sharedDoc??!1)}
166
- ${e("HyperlinksChanged",s.hyperlinksChanged??!1)}
167
- ${e("Characters",s.characters)}
168
- ${e("CharactersWithSpaces",s.charactersByWord)}
169
- ${e("Words",s.words)}
170
- ${e("Lines",s.lines)}
171
- ${e("Paragraphs",s.paragraphs)}
172
- ${e("Pages",s.pages)}
173
- ${e("Slides",s.slides)}
174
- ${e("Notes",s.notes)}
175
- ${e("HiddenSlides",s.hiddenSlides)}
176
- ${e("MMClips",s.mmClips)}
177
- ${e("Template",s.template)}
178
- ${e("PresentationFormat",s.presentationFormat)}
179
- ${e("TotalTime",s.totalTime)}
180
- ${e("HyperlinkBase",s.hyperlinkBase)}
219
+ ${e("Application",o.application??"ExcelForge")}
220
+ ${e("AppVersion",o.appVersion)}
221
+ ${e("Company",o.company)}
222
+ ${e("Manager",o.manager)}
223
+ ${e("DocSecurity",o.docSecurity??0)}
224
+ ${e("ScaleCrop",o.scaleCrop??!1)}
225
+ ${e("LinksUpToDate",o.linksUpToDate??!1)}
226
+ ${e("SharedDoc",o.sharedDoc??!1)}
227
+ ${e("HyperlinksChanged",o.hyperlinksChanged??!1)}
228
+ ${e("Characters",o.characters)}
229
+ ${e("CharactersWithSpaces",o.charactersByWord)}
230
+ ${e("Words",o.words)}
231
+ ${e("Lines",o.lines)}
232
+ ${e("Paragraphs",o.paragraphs)}
233
+ ${e("Pages",o.pages)}
234
+ ${e("Slides",o.slides)}
235
+ ${e("Notes",o.notes)}
236
+ ${e("HiddenSlides",o.hiddenSlides)}
237
+ ${e("MMClips",o.mmClips)}
238
+ ${e("Template",o.template)}
239
+ ${e("PresentationFormat",o.presentationFormat)}
240
+ ${e("TotalTime",o.totalTime)}
241
+ ${e("HyperlinkBase",o.hyperlinkBase)}
242
+ ${n}
181
243
  ${r}
182
- ${o}
183
244
  ${t??""}
184
- </Properties>`}function Pt(s){let t=2;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
245
+ </Properties>`}function bo(o){let t=2;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
185
246
  <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
186
247
  xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
187
- ${s.map(r=>{let o,i=r.value;switch(i.type){case"string":o=`<vt:lpwstr>${g(i.value)}</vt:lpwstr>`;break;case"int":o=`<vt:i4>${i.value}</vt:i4>`;break;case"decimal":o=`<vt:decimal>${i.value}</vt:decimal>`;break;case"bool":o=`<vt:bool>${i.value}</vt:bool>`;break;case"date":o=`<vt:filetime>${i.value.toISOString()}</vt:filetime>`;break;case"r8":o=`<vt:r8>${i.value}</vt:r8>`;break;case"i8":o=`<vt:i8>${i.value}</vt:i8>`;break;case"error":o=`<vt:error>${g(i.value)}</vt:error>`;break;default:o="<vt:lpwstr></vt:lpwstr>";break}return`<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="${t++}" name="${g(r.name)}">${o}</property>`}).join(`
248
+ ${o.map(n=>{let r,s=n.value;switch(s.type){case"string":r=`<vt:lpwstr>${b(s.value)}</vt:lpwstr>`;break;case"int":r=`<vt:i4>${s.value}</vt:i4>`;break;case"decimal":r=`<vt:decimal>${s.value}</vt:decimal>`;break;case"bool":r=`<vt:bool>${s.value}</vt:bool>`;break;case"date":r=`<vt:filetime>${s.value.toISOString()}</vt:filetime>`;break;case"r8":r=`<vt:r8>${s.value}</vt:r8>`;break;case"i8":r=`<vt:i8>${s.value}</vt:i8>`;break;case"error":r=`<vt:error>${b(s.value)}</vt:error>`;break;default:r="<vt:lpwstr></vt:lpwstr>";break}return`<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="${t++}" name="${b(n.name)}">${r}</property>`}).join(`
188
249
  `)}
189
- </Properties>`}function Jt(s){let t=U(s),e=o=>{let i=t.children.find(n=>O(n.tag)===o);return i?.text??i?.children[0]?.text},r=o=>{let i=e(o);return i?new Date(i):void 0};return{title:e("title"),subject:e("subject"),creator:e("creator"),keywords:e("keywords"),description:e("description"),lastModifiedBy:e("lastModifiedBy"),revision:e("revision"),created:r("created"),modified:r("modified"),category:e("category"),contentStatus:e("contentStatus"),language:e("language"),identifier:e("identifier"),version:e("version")}}function Kt(s){let t=U(s),e=p=>t.children.find(h=>O(h.tag)===p)?.text,r=p=>{let h=e(p);return h!==void 0?Number(h):void 0},o=p=>{let h=e(p);return h!==void 0?h==="true"||h==="1":void 0},i,n=t.children.find(p=>O(p.tag)==="HeadingPairs");if(n){let p=n.children[0];if(p){let h=p.children.filter(u=>O(u.tag)==="variant");i=[];for(let u=0;u<h.length-1;u+=2){let $=h[u].children[0],x=h[u+1].children[0];i.push({name:$?.text??"",count:parseInt(x?.text??"0",10)})}}}let l,c=t.children.find(p=>O(p.tag)==="TitlesOfParts");if(c){let p=c.children[0];p&&(l=p.children.map(h=>h.text??""))}let a=new Set(["Application","AppVersion","Company","Manager","DocSecurity","ScaleCrop","LinksUpToDate","SharedDoc","HyperlinksChanged","Characters","CharactersWithSpaces","Words","Lines","Paragraphs","Pages","Slides","Notes","HiddenSlides","MMClips","Template","PresentationFormat","TotalTime","HyperlinkBase","HeadingPairs","TitlesOfParts"]),m=t.children.filter(p=>!a.has(O(p.tag))).map(p=>{let h=Object.entries(p.attrs).map(([$,x])=>` ${$}="${x}"`).join(""),u=p.text??"";return!u&&!p.children.length?`<${p.tag}${h}/>`:`<${p.tag}${h}>${u}</${p.tag}>`}).join(`
190
- `);return{props:{application:e("Application"),appVersion:e("AppVersion"),company:e("Company"),manager:e("Manager"),docSecurity:r("DocSecurity"),scaleCrop:o("ScaleCrop"),linksUpToDate:o("LinksUpToDate"),sharedDoc:o("SharedDoc"),hyperlinksChanged:o("HyperlinksChanged"),characters:r("Characters"),charactersByWord:r("CharactersWithSpaces"),words:r("Words"),lines:r("Lines"),paragraphs:r("Paragraphs"),pages:r("Pages"),slides:r("Slides"),notes:r("Notes"),hiddenSlides:r("HiddenSlides"),mmClips:r("MMClips"),template:e("Template"),presentationFormat:e("PresentationFormat"),totalTime:r("TotalTime"),hyperlinkBase:e("HyperlinkBase"),headingPairs:i,titlesOfParts:l},unknownRaw:m}}function Qt(s){return U(s).children.filter(e=>O(e.tag)==="property").map(e=>{let r=e.attrs.name??"",o=e.children[0];if(!o)return null;let i=O(o.tag),n=o.text??"",l;switch(i){case"lpwstr":case"lpstr":case"bstr":l={type:"string",value:n};break;case"i4":case"int":l={type:"int",value:parseInt(n,10)};break;case"decimal":l={type:"decimal",value:parseFloat(n)};break;case"bool":l={type:"bool",value:n==="true"||n==="1"};break;case"filetime":l={type:"date",value:new Date(n)};break;case"r8":l={type:"r8",value:parseFloat(n)};break;case"i8":l={type:"i8",value:BigInt(n)};break;case"error":l={type:"error",value:n};break;default:l={type:"string",value:n};break}return{name:r,value:l}}).filter(Boolean)}function Yt(s){let t=new Map;try{let e=U(s);for(let r of e.children)O(r.tag)==="Relationship"&&t.set(r.attrs.Id??"",{type:r.attrs.Type??"",target:r.attrs.Target??""})}catch{}return t}function Xe(s){let t=new Map;try{let e=U(s);for(let r of e.children)if(O(r.tag)==="Override"){let i=r.attrs.PartName??"",n=r.attrs.ContentType??"";t.set(i.startsWith("/")?i.slice(1):i,n)}}catch{}return t}function Le(s){let t=U(s),e=new Map,r=[],o={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"mm-dd-yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"},i=q(t,"numFmts");if(i)for(let h of _(i,"numFmt")){let u=parseInt(h.attrs.numFmtId??"0",10),$=h.attrs.formatCode??"";e.set(u,$)}let n=q(t,"fonts"),l=[];if(n)for(let h of _(n,"font"))l.push(Be(h));let c=q(t,"fills"),a=[];if(c)for(let h of _(c,"fill"))a.push(Ae(h));let d=q(t,"borders"),m=[];if(d)for(let h of _(d,"border"))m.push(_e(h));let p=q(t,"cellXfs");if(p)for(let h of _(p,"xf")){let u=parseInt(h.attrs.fontId??"0",10),$=parseInt(h.attrs.fillId??"0",10),x=parseInt(h.attrs.borderId??"0",10),y=parseInt(h.attrs.numFmtId??"0",10),b=h.attrs.applyFont==="1",F=h.attrs.applyFill==="1",I=h.attrs.applyBorder==="1",X=h.attrs.applyAlignment==="1",T=h.attrs.applyNumberFormat==="1",v=h.attrs.applyProtection==="1",f={};b&&l[u]&&(f.font=l[u]),F&&a[$]&&(f.fill=a[$]),I&&m[x]&&(f.border=m[x]),T&&y!==0&&(e.has(y)?f.numberFormat={formatCode:e.get(y)}:o[y]&&(f.numFmtId=y));let w=S(h,"alignment");X&&w&&(f.alignment=Oe(w));let D=S(h,"protection");v&&D&&(D.attrs.locked!==void 0&&(f.locked=D.attrs.locked!=="0"),D.attrs.hidden!==void 0&&(f.hidden=D.attrs.hidden!=="0")),r.push(f)}return{xfs:r,numFmts:e}}function q(s,t){if(O(s.tag)===t)return s;for(let e of s.children){let r=q(e,t);if(r)return r}}function Be(s){let t={};for(let e of s.children)switch(O(e.tag)){case"b":t.bold=e.attrs.val!=="0";break;case"i":t.italic=e.attrs.val!=="0";break;case"strike":t.strike=e.attrs.val!=="0";break;case"u":t.underline=e.attrs.val??"single";break;case"sz":t.size=parseFloat(e.attrs.val??"11");break;case"name":t.name=e.attrs.val;break;case"family":t.family=parseInt(e.attrs.val??"0",10);break;case"scheme":t.scheme=e.attrs.val;break;case"charset":t.charset=parseInt(e.attrs.val??"0",10);break;case"vertAlign":t.vertAlign=e.attrs.val;break;case"color":{let r=e.attrs.rgb??e.attrs.theme;r&&(t.color=r);break}}return t}function Ae(s){let t=S(s,"patternFill");if(t){let r=S(t,"fgColor"),o=S(t,"bgColor");return{type:"pattern",pattern:t.attrs.patternType??"none",fgColor:r?.attrs.rgb??r?.attrs.theme,bgColor:o?.attrs.rgb??o?.attrs.theme}}let e=S(s,"gradientFill");if(e){let r=_(e,"stop").concat(_(e,"gradientStop")).map(o=>{let i=S(o,"color");return{position:parseFloat(o.attrs.position??"0"),color:i?.attrs.rgb??i?.attrs.theme??"FF000000"}});return{type:"gradient",gradientType:e.attrs.type,degree:e.attrs.degree?parseFloat(e.attrs.degree):void 0,stops:r}}return{type:"pattern",pattern:"none"}}function _e(s){let t=e=>{let r=S(s,e);if(!r)return;let o=r.attrs.style,i=S(r,"color");if(!(!o&&!i))return{style:o,color:i?.attrs.rgb}};return{left:t("left"),right:t("right"),top:t("top"),bottom:t("bottom"),diagonal:t("diagonal"),diagonalUp:s.attrs.diagonalUp==="1",diagonalDown:s.attrs.diagonalDown==="1"}}function Oe(s){let t={};return s.attrs.horizontal&&(t.horizontal=s.attrs.horizontal),s.attrs.vertical&&(t.vertical=s.attrs.vertical),s.attrs.wrapText&&(t.wrapText=s.attrs.wrapText!=="0"),s.attrs.shrinkToFit&&(t.shrinkToFit=s.attrs.shrinkToFit!=="0"),s.attrs.textRotation&&(t.textRotation=parseInt(s.attrs.textRotation,10)),s.attrs.indent&&(t.indent=parseInt(s.attrs.indent,10)),s.attrs.readingOrder&&(t.readingOrder=parseInt(s.attrs.readingOrder,10)),t}function Ne(s){let t=U(s);return _(t,"si").map(e=>{let r=S(e,"t");return r&&!S(e,"r")?r.text??"":_(e,"r").map(o=>S(o,"t")?.text??"").join("")})}function je(s,t,e,r){let o=new J(t),i=U(s),n=[],l=[],c=new Set(["sheetPr","dimension","sheetViews","sheetFormatPr","cols","sheetData","mergeCells","conditionalFormatting","dataValidations","sheetProtection","printOptions","pageMargins","pageSetup","headerFooter","drawing","tableParts","autoFilter","rowBreaks","colBreaks","picture","oleObjects","ctrlProps"]);for(let a of i.children){let d=O(a.tag);switch(d){case"sheetViews":Me(a,o);break;case"cols":Ee(a,o,e);break;case"sheetData":We(a,o,e,r);break;case"mergeCells":Ue(a,o);break;case"autoFilter":o.autoFilter={ref:a.attrs.ref??""};break;case"tableParts":for(let m of _(a,"tablePart")){let p=m.attrs["r:id"]??"";p&&l.push(p)}break;case"sheetProtection":ze(a,o);break;case"pageMargins":He(a,o);break;case"pageSetup":Ve(a,o);break;case"headerFooter":Ge(a,o);break;case"printOptions":qe(a,o);break;default:c.has(d)||n.push(It(a));break}}return{ws:o,originalXml:s,unknownParts:n,tableRIds:l}}function Me(s,t){let e=_(s,"sheetView")[0];if(!e)return;t.view={showGridLines:e.attrs.showGridLines!=="0",showRowColHeaders:e.attrs.showRowColHeaders!=="0",zoomScale:e.attrs.zoomScale?parseInt(e.attrs.zoomScale,10):void 0,rightToLeft:e.attrs.rightToLeft==="1",tabSelected:e.attrs.tabSelected==="1",view:e.attrs.view};let r=S(e,"pane");r&&r.attrs.state==="frozen"&&(t.freezePane={col:r.attrs.xSplit?parseInt(r.attrs.xSplit,10):void 0,row:r.attrs.ySplit?parseInt(r.attrs.ySplit,10):void 0})}function Ee(s,t,e){for(let r of _(s,"col")){let o=parseInt(r.attrs.min??"1",10),i=parseInt(r.attrs.max??"1",10),n={width:r.attrs.width?parseFloat(r.attrs.width):void 0,hidden:r.attrs.hidden==="1",customWidth:r.attrs.customWidth==="1",outlineLevel:r.attrs.outlineLevel?parseInt(r.attrs.outlineLevel,10):void 0,style:r.attrs.style?e.xfs[parseInt(r.attrs.style,10)]:void 0};for(let l=o;l<=i;l++)t.setColumn(l,n)}}function We(s,t,e,r){for(let o of _(s,"row")){let i=parseInt(o.attrs.r??"0",10);if(!i)continue;let n={};o.attrs.ht&&(n.height=parseFloat(o.attrs.ht)),o.attrs.hidden&&(n.hidden=o.attrs.hidden==="1"),o.attrs.outlineLevel&&(n.outlineLevel=parseInt(o.attrs.outlineLevel,10)),o.attrs.collapsed&&(n.collapsed=o.attrs.collapsed==="1"),o.attrs.s&&(n.style=e.xfs[parseInt(o.attrs.s,10)]),Object.keys(n).length&&t.setRow(i,n);for(let l of _(o,"c")){let c=l.attrs.r??"";if(!c)continue;let{row:a,col:d}=H(c),m=l.attrs.s?parseInt(l.attrs.s,10):0,p=m>0?e.xfs[m]:void 0,h=l.attrs.t??"",u=S(l,"f"),$=S(l,"v"),x={};if(p&&(x.style=p),u)u.attrs.t==="array"?x.arrayFormula=u.text??"":x.formula=u.text??"";else if($){let y=$.text??"";switch(h){case"s":{let b=parseInt(y,10);x.value=r[b]??"";break}case"b":x.value=y==="1"||y==="true";break;case"str":case"inlineStr":{let b=S(l,"is");x.value=b?S(b,"t")?.text??y:y;break}case"e":x.value=y;break;default:{let b=parseFloat(y);x.value=isNaN(b)?y:b;break}}}(Object.keys(x).length||x.value!==void 0)&&t.setCell(a,d,x)}}}function Ue(s,t){for(let e of _(s,"mergeCell")){let r=e.attrs.ref??"";r.includes(":")&&t.mergeByRef(r)}}function ze(s,t){t.protection={sheet:s.attrs.sheet!=="0",password:void 0,selectLockedCells:s.attrs.selectLockedCells!=="0",selectUnlockedCells:s.attrs.selectUnlockedCells!=="0",formatCells:s.attrs.formatCells==="0",formatColumns:s.attrs.formatColumns==="0",formatRows:s.attrs.formatRows==="0",insertColumns:s.attrs.insertColumns==="0",insertRows:s.attrs.insertRows==="0",insertHyperlinks:s.attrs.insertHyperlinks==="0",deleteColumns:s.attrs.deleteColumns==="0",deleteRows:s.attrs.deleteRows==="0",sort:s.attrs.sort==="0",autoFilter:s.attrs.autoFilter==="0",pivotTables:s.attrs.pivotTables==="0"}}function He(s,t){t.pageMargins={left:parseFloat(s.attrs.left??"0.7"),right:parseFloat(s.attrs.right??"0.7"),top:parseFloat(s.attrs.top??"0.75"),bottom:parseFloat(s.attrs.bottom??"0.75"),header:parseFloat(s.attrs.header??"0.3"),footer:parseFloat(s.attrs.footer??"0.3")}}function Ve(s,t){t.pageSetup={paperSize:s.attrs.paperSize?parseInt(s.attrs.paperSize,10):void 0,orientation:s.attrs.orientation,fitToPage:s.attrs.fitToPage==="1",fitToWidth:s.attrs.fitToWidth?parseInt(s.attrs.fitToWidth,10):void 0,fitToHeight:s.attrs.fitToHeight?parseInt(s.attrs.fitToHeight,10):void 0,scale:s.attrs.scale?parseInt(s.attrs.scale,10):void 0,horizontalDpi:s.attrs.horizontalDpi?parseInt(s.attrs.horizontalDpi,10):void 0,verticalDpi:s.attrs.verticalDpi?parseInt(s.attrs.verticalDpi,10):void 0}}function Ge(s,t){t.headerFooter={oddHeader:S(s,"oddHeader")?.text,oddFooter:S(s,"oddFooter")?.text,evenHeader:S(s,"evenHeader")?.text,evenFooter:S(s,"evenFooter")?.text,firstHeader:S(s,"firstHeader")?.text,firstFooter:S(s,"firstFooter")?.text,differentOddEven:s.attrs.differentOddEven==="1",differentFirst:s.attrs.differentFirst==="1"}}function qe(s,t){t.printOptions={gridLines:s.attrs.gridLines==="1",gridLinesSet:s.attrs.gridLinesSet==="1",headings:s.attrs.headings==="1",centerHorizontal:s.attrs.horizontalCentered==="1",centerVertical:s.attrs.verticalCentered==="1"}}function Ze(s){try{let t=U(s);if(O(t.tag)!=="table")return null;let r=t.attrs.name??"",o=t.attrs.displayName??r,i=t.attrs.ref??"",n=parseInt(t.attrs.totalsRowCount??"0",10),l=[],c=q(t,"tableColumns");if(c)for(let m of _(c,"tableColumn")){let p={name:m.attrs.name??""};m.attrs.totalsRowFunction&&(p.totalsRowFunction=m.attrs.totalsRowFunction),m.attrs.totalsRowFormula&&(p.totalsRowFormula=m.attrs.totalsRowFormula),m.attrs.totalsRowLabel&&(p.totalsRowLabel=m.attrs.totalsRowLabel),l.push(p)}let a={name:r,ref:i,columns:l};o&&o!==r&&(a.displayName=o),n>0&&(a.totalsRow=!0);let d=q(t,"tableStyleInfo");return d&&(d.attrs.name&&(a.style=d.attrs.name),d.attrs.showFirstColumn==="1"&&(a.showFirstColumn=!0),d.attrs.showLastColumn==="1"&&(a.showLastColumn=!0),d.attrs.showRowStripes==="1"&&(a.showRowStripes=!0),d.attrs.showColumnStripes==="1"&&(a.showColumnStripes=!0)),a}catch{return null}}function Je(s,t){let e=s.replace(/\/$/,"").split("/");for(let r of t.split("/"))r===".."?e.pop():r!=="."&&e.push(r);return e.join("/")}async function te(s){let t=await qt(s),e=R=>t.get(R)??t.get(R.replace(/^\//,"")),r=R=>{let N=e(R);return N?Tt(N):void 0},o=r("[Content_Types].xml")??"<Types/>",i=Xe(o),n=r("xl/_rels/workbook.xml.rels")??"<Relationships/>",l=Yt(n),c=r("xl/workbook.xml")??"<workbook/>",a=r("xl/styles.xml")??"<styleSheet/>",d=Le(a),m=r("xl/sharedStrings.xml")??"<sst/>",p=m!=="<sst/>"?Ne(m):[],h=r("docProps/core.xml")??"",u=h?Jt(h):{},$=r("docProps/app.xml")??"",x={},y="";if($){let R=Kt($);x=R.props,y=R.unknownRaw}let b=r("docProps/custom.xml")??"",F=b?Qt(b):[],I=U(c),X=q(I,"sheets"),T=X?_(X,"sheet"):[],v=new Map;for(let[R,N]of t)R.includes("_rels/")&&v.set(R,Yt(Tt(N)));let f=[];for(let R of T){let N=R.attrs["r:id"]??Object.values(R.attrs).find(ut=>ut.startsWith("rId"))??"",Z=R.attrs.sheetId??"",j=R.attrs.name??`Sheet${Z}`,A=l.get(N);if(!A)continue;let k=A.target.startsWith("/")?A.target.slice(1):`xl/${A.target}`,M=r(k)??"";if(!M)continue;let{ws:L,originalXml:z,unknownParts:st,tableRIds:ft}=je(M,j,d,p);L.sheetIndex=f.length+1,L.rId=N;let Xt=[];if(ft.length){let ut=k.split("/").pop()??"",Lt=k.substring(0,k.lastIndexOf("/")+1),ee=`${Lt}_rels/${ut}.rels`,Bt=v.get(ee);if(Bt){for(let se of ft){let lt=Bt.get(se);if(!lt)continue;let At=lt.target.startsWith("/")?lt.target.slice(1):Je(Lt,lt.target),_t=r(At);if(_t){let Ot=Ze(_t);Ot&&L.addTable(Ot),Xt.push(At)}}L.tableRIds=ft}}f.push({ws:L,sheetId:Z,rId:N,originalXml:z,unknownParts:st,tablePaths:Xt})}let w=new Set(["xl/workbook.xml","xl/styles.xml","xl/sharedStrings.xml","xl/worksheets/","docProps/","[Content_Types].xml","_rels/","xl/_rels/"]),D=new Map;for(let[R,N]of t){if(R.endsWith("_rels/")||R==="[Content_Types].xml")continue;[...w].some(j=>R.startsWith(j))||D.set(R,N.data)}return{sheets:f,styles:d,stylesXml:a,sharedStrings:p,sharedXml:m,workbookXml:c,workbookRels:l,contentTypes:i,contentTypesXml:o,core:u,extended:x,extendedUnknownRaw:y,custom:F,hasCustomProps:F.length>0,unknownParts:D,allRels:v}}var Dt=class s{constructor(){this.sheets=[],this.namedRanges=[],this.properties={},this.compressionLevel=6,this.coreProperties={},this.extendedProperties={},this.customProperties=[],this._dirtySheets=new Set}markDirty(t){if(typeof t=="string"){let e=this.sheets.findIndex(r=>r.name===t);e>=0&&this._dirtySheets.add(e)}else this._dirtySheets.add(t)}static async fromBytes(t){let e=new s,r=await te(t);return e._readResult=r,e.coreProperties=r.core,e.extendedProperties=r.extended,e.customProperties=r.custom,e.properties={title:r.core.title,author:r.core.creator,subject:r.core.subject,description:r.core.description,keywords:r.core.keywords,company:r.extended.company,lastModifiedBy:r.core.lastModifiedBy,created:r.core.created,modified:r.core.modified,category:r.core.category,status:r.core.contentStatus},e.sheets=r.sheets.map(o=>o.ws),e}static async fromBase64(t){return s.fromBytes(ct(t))}static async fromFile(t){let r=await(await import("fs/promises")).readFile(t);return s.fromBytes(new Uint8Array(r))}static async fromBlob(t){return s.fromBytes(new Uint8Array(await t.arrayBuffer()))}addSheet(t,e={}){let r=new J(t,e);return r.sheetIndex=this.sheets.length+1,this.sheets.push(r),this._dirtySheets.add(r.sheetIndex-1),r}getSheet(t){return this.sheets.find(e=>e.name===t)}getSheetByIndex(t){return this.sheets[t]}getSheetNames(){return this.sheets.map(t=>t.name)}removeSheet(t){return this.sheets=this.sheets.filter(e=>e.name!==t),this}addNamedRange(t){return this.namedRanges.push(t),this}getCustomProperty(t){return this.customProperties.find(e=>e.name===t)}setCustomProperty(t,e){let r=this.customProperties.findIndex(o=>o.name===t);return r>=0?this.customProperties[r]={name:t,value:e}:this.customProperties.push({name:t,value:e}),this}removeCustomProperty(t){return this.customProperties=this.customProperties.filter(e=>e.name!==t),this}async build(){return this._syncLegacyProperties(),this._readResult?this._buildPatched():this._buildFresh()}async _buildPatched(){let t=this._readResult,e=[],r=this._dirtySheets.size>0,o=new Y,i=new tt,n=new Map;if(r)for(let a=0;a<this.sheets.length;a++)n.set(a,this.sheets[a].toXml(o,i));e.push({name:"docProps/core.xml",data:C(Rt({...t.core,...this.coreProperties,modified:new Date}))}),e.push({name:"docProps/app.xml",data:C(St({...t.extended,...this.extendedProperties,titlesOfParts:this.sheets.map(a=>a.name),headingPairs:[{name:"Worksheets",count:this.sheets.length}]},t.extendedUnknownRaw))});let l=this.customProperties.length>0?this.customProperties:t.hasCustomProps?t.custom:null;l&&l.length>0&&e.push({name:"docProps/custom.xml",data:C(Pt(l))}),e.push({name:"xl/workbook.xml",data:C(this._patchWorkbookXml(t.workbookXml))}),r?(e.push({name:"xl/styles.xml",data:C(o.toXml())}),e.push({name:"xl/sharedStrings.xml",data:C(i.toXml())})):(e.push({name:"xl/styles.xml",data:C(t.stylesXml)}),e.push({name:"xl/sharedStrings.xml",data:C(t.sharedXml)}));for(let a=0;a<this.sheets.length;a++){let d=`xl/worksheets/sheet${a+1}.xml`;if(r)e.push({name:d,data:C(n.get(a)??"")});else{let m=t.sheets[a]?.originalXml??"",p=t.sheets[a]?.unknownParts.join(`
191
- `)??"";e.push({name:d,data:C(p?m.replace("</worksheet>",`${p}</worksheet>`):m)})}}let c=new Set;if(r){for(let a=0;a<this.sheets.length;a++)if(t.sheets[a]?.tablePaths)for(let d of t.sheets[a].tablePaths)c.add(d)}for(let[a,d]of t.unknownParts)c.has(a)||e.push({name:a,data:d});if(r)for(let a=0;a<this.sheets.length;a++){let m=this.sheets[a].getTables(),p=t.sheets[a]?.tablePaths??[];for(let h=0;h<m.length;h++){let u=p[h];if(u){let $=u.match(/table(\d+)\.xml$/),x=$?parseInt($[1],10):h+1;e.push({name:u,data:C(wt(m[h],x))})}}}e.push({name:"_rels/.rels",data:C(this._buildRootRels(l!=null&&l.length>0))}),e.push({name:"xl/_rels/workbook.xml.rels",data:C(this._buildWorkbookRels(t))});for(let[a,d]of t.allRels)a==="xl/_rels/workbook.xml.rels"||a==="_rels/.rels"||e.push({name:a,data:C(this._relsToXml(d))});return e.push({name:"[Content_Types].xml",data:C(this._patchContentTypes(t.contentTypesXml,l!=null&&l.length>0))}),kt(e,{level:this.compressionLevel})}async _buildFresh(){let t=new Y,e=new tt,r=[],o=1;for(let f of this.sheets)f.rId=`rId${o++}`;let i=[],n=[],l=[],c=new Map,a=new Map,d=new Map,m=1,p=1,h=1,u=1;for(let f of this.sheets){let w=f.getImages(),D=f.getCharts(),R=f.getTables(),N=[],Z=[],j=[];(w.length||D.length)&&(f.drawingRId=`rId${o++}`),f.getComments().length&&(f.legacyDrawingRId=`rId${o++}`);for(let A of w){let k=`rId${o++}`;N.push(k),i.push({ws:f,img:A,ext:A.format==="jpeg"?"jpg":A.format,idx:m++})}for(let A=0;A<D.length;A++){let k=`rId${o++}`;Z.push(k),n.push({ws:f,chartIdx:A,globalIdx:p++})}for(let A=0;A<R.length;A++){let k=`rId${o++}`;j.push(k),l.push({ws:f,tableIdx:A,globalTableId:h++})}c.set(f,N),a.set(f,Z),d.set(f,j),f.tableRIds=j}let $=this.customProperties.length>0,x=new Set;for(let{ext:f}of i){let w=f==="jpg"?"image/jpeg":f==="png"?"image/png":`image/${f}`;x.add(`<Default Extension="${f}" ContentType="${w}"/>`)}let y=this.sheets.filter(f=>f.getComments().length),b=y.length?'<Default Extension="vml" ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>':"",F=0,I=y.map(()=>`<Override PartName="/xl/comments${++F}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"/>`).join("");r.push({name:"[Content_Types].xml",data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
250
+ </Properties>`}function an(o){let t=It(o),e=r=>{let s=t.children.find(i=>Q(i.tag)===r);return s?.text??s?.children[0]?.text},n=r=>{let s=e(r);return s?new Date(s):void 0};return{title:e("title"),subject:e("subject"),creator:e("creator"),keywords:e("keywords"),description:e("description"),lastModifiedBy:e("lastModifiedBy"),revision:e("revision"),created:n("created"),modified:n("modified"),category:e("category"),contentStatus:e("contentStatus"),language:e("language"),identifier:e("identifier"),version:e("version")}}function ln(o){let t=It(o),e=d=>t.children.find(f=>Q(f.tag)===d)?.text,n=d=>{let f=e(d);return f!==void 0?Number(f):void 0},r=d=>{let f=e(d);return f!==void 0?f==="true"||f==="1":void 0},s,i=t.children.find(d=>Q(d.tag)==="HeadingPairs");if(i){let d=i.children[0];if(d){let f=d.children.filter(p=>Q(p.tag)==="variant");s=[];for(let p=0;p<f.length-1;p+=2){let u=f[p].children[0],x=f[p+1].children[0];s.push({name:u?.text??"",count:parseInt(x?.text??"0",10)})}}}let a,l=t.children.find(d=>Q(d.tag)==="TitlesOfParts");if(l){let d=l.children[0];d&&(a=d.children.map(f=>f.text??""))}let m=new Set(["Application","AppVersion","Company","Manager","DocSecurity","ScaleCrop","LinksUpToDate","SharedDoc","HyperlinksChanged","Characters","CharactersWithSpaces","Words","Lines","Paragraphs","Pages","Slides","Notes","HiddenSlides","MMClips","Template","PresentationFormat","TotalTime","HyperlinkBase","HeadingPairs","TitlesOfParts"]),h=t.children.filter(d=>!m.has(Q(d.tag))).map(d=>{let f=Object.entries(d.attrs).map(([u,x])=>` ${u}="${x}"`).join(""),p=d.text??"";return!p&&!d.children.length?`<${d.tag}${f}/>`:`<${d.tag}${f}>${p}</${d.tag}>`}).join(`
251
+ `);return{props:{application:e("Application"),appVersion:e("AppVersion"),company:e("Company"),manager:e("Manager"),docSecurity:n("DocSecurity"),scaleCrop:r("ScaleCrop"),linksUpToDate:r("LinksUpToDate"),sharedDoc:r("SharedDoc"),hyperlinksChanged:r("HyperlinksChanged"),characters:n("Characters"),charactersByWord:n("CharactersWithSpaces"),words:n("Words"),lines:n("Lines"),paragraphs:n("Paragraphs"),pages:n("Pages"),slides:n("Slides"),notes:n("Notes"),hiddenSlides:n("HiddenSlides"),mmClips:n("MMClips"),template:e("Template"),presentationFormat:e("PresentationFormat"),totalTime:n("TotalTime"),hyperlinkBase:e("HyperlinkBase"),headingPairs:s,titlesOfParts:a},unknownRaw:h}}function cn(o){return It(o).children.filter(e=>Q(e.tag)==="property").map(e=>{let n=e.attrs.name??"",r=e.children[0];if(!r)return null;let s=Q(r.tag),i=r.text??"",a;switch(s){case"lpwstr":case"lpstr":case"bstr":a={type:"string",value:i};break;case"i4":case"int":a={type:"int",value:parseInt(i,10)};break;case"decimal":a={type:"decimal",value:parseFloat(i)};break;case"bool":a={type:"bool",value:i==="true"||i==="1"};break;case"filetime":a={type:"date",value:new Date(i)};break;case"r8":a={type:"r8",value:parseFloat(i)};break;case"i8":a={type:"i8",value:BigInt(i)};break;case"error":a={type:"error",value:i};break;default:a={type:"string",value:i};break}return{name:n,value:a}}).filter(Boolean)}function vo(o){let t=new Map;try{let e=It(o);for(let n of e.children)if(Q(n.tag)==="Relationship"){let r={type:n.attrs.Type??"",target:n.attrs.Target??""};n.attrs.TargetMode&&(r.targetMode=n.attrs.TargetMode),t.set(n.attrs.Id??"",r)}}catch{}return t}function Br(o){let t=new Map;try{let e=It(o);for(let n of e.children)if(Q(n.tag)==="Override"){let s=n.attrs.PartName??"",i=n.attrs.ContentType??"";t.set(s.startsWith("/")?s.slice(1):s,i)}}catch{}return t}function Lr(o){let t=It(o),e=new Map,n=[],r={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"mm-dd-yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"},s=Xt(t,"numFmts");if(s)for(let u of tt(s,"numFmt")){let x=parseInt(u.attrs.numFmtId??"0",10),$=u.attrs.formatCode??"";e.set(x,$)}let i=Xt(t,"fonts"),a=[];if(i)for(let u of tt(i,"font"))a.push(Co(u));let l=Xt(t,"fills"),m=[];if(l)for(let u of tt(l,"fill"))m.push(mn(u));let c=Xt(t,"borders"),h=[];if(c)for(let u of tt(c,"border"))h.push(hn(u));let d=Xt(t,"cellXfs");if(d)for(let u of tt(d,"xf")){let x=parseInt(u.attrs.fontId??"0",10),$=parseInt(u.attrs.fillId??"0",10),y=parseInt(u.attrs.borderId??"0",10),I=parseInt(u.attrs.numFmtId??"0",10),R=u.attrs.applyFont==="1",w=u.attrs.applyFill==="1",C=u.attrs.applyBorder==="1",g=u.attrs.applyAlignment==="1",M=u.attrs.applyNumberFormat==="1",T=u.attrs.applyProtection==="1",S={};R&&a[x]&&(S.font=a[x]),w&&m[$]&&(S.fill=m[$]),C&&h[y]&&(S.border=h[y]),M&&I!==0&&(e.has(I)?S.numberFormat={formatCode:e.get(I)}:r[I]&&(S.numFmtId=I));let k=D(u,"alignment");g&&k&&(S.alignment=dn(k));let L=D(u,"protection");T&&L&&(L.attrs.locked!==void 0&&(S.locked=L.attrs.locked!=="0"),L.attrs.hidden!==void 0&&(S.hidden=L.attrs.hidden!=="0")),n.push(S)}let f=[],p=Xt(t,"dxfs");if(p)for(let u of tt(p,"dxf")){let x={},$=D(u,"font");$&&(x.font=Co($));let y=D(u,"fill");y&&(x.fill=mn(y));let I=D(u,"border");I&&(x.border=hn(I));let R=D(u,"numFmt");if(R){let C=R.attrs.formatCode??"";C&&(x.numberFormat={formatCode:C})}let w=D(u,"alignment");w&&(x.alignment=dn(w)),f.push(x)}return{xfs:n,numFmts:e,dxfs:f}}function Xt(o,t){if(Q(o.tag)===t)return o;for(let e of o.children){let n=Xt(e,t);if(n)return n}}function Co(o){let t={};for(let e of o.children)switch(Q(e.tag)){case"b":t.bold=e.attrs.val!=="0";break;case"i":t.italic=e.attrs.val!=="0";break;case"strike":t.strike=e.attrs.val!=="0";break;case"u":t.underline=e.attrs.val??"single";break;case"sz":t.size=parseFloat(e.attrs.val??"11");break;case"name":t.name=e.attrs.val;break;case"family":t.family=parseInt(e.attrs.val??"0",10);break;case"scheme":t.scheme=e.attrs.val;break;case"charset":t.charset=parseInt(e.attrs.val??"0",10);break;case"vertAlign":t.vertAlign=e.attrs.val;break;case"color":{let n=e.attrs.rgb,r=e.attrs.theme;n?t.color=n:r&&(t.color=`theme:${r}`);break}}return t}function mn(o){let t=D(o,"patternFill");if(t){let n=D(t,"fgColor"),r=D(t,"bgColor");return{type:"pattern",pattern:t.attrs.patternType??"none",fgColor:n?.attrs.rgb??(n?.attrs.theme?`theme:${n.attrs.theme}`:void 0),bgColor:r?.attrs.rgb??(r?.attrs.theme?`theme:${r.attrs.theme}`:void 0)}}let e=D(o,"gradientFill");if(e){let n=tt(e,"stop").concat(tt(e,"gradientStop")).map(r=>{let s=D(r,"color");return{position:parseFloat(r.attrs.position??"0"),color:s?.attrs.rgb??(s?.attrs.theme?`theme:${s.attrs.theme}`:"FF000000")}});return{type:"gradient",gradientType:e.attrs.type,degree:e.attrs.degree?parseFloat(e.attrs.degree):void 0,stops:n}}return{type:"pattern",pattern:"none"}}function hn(o){let t=e=>{let n=D(o,e);if(!n)return;let r=n.attrs.style,s=D(n,"color");if(!r&&!s)return;let i=s?.attrs.rgb??(s?.attrs.theme?`theme:${s.attrs.theme}`:void 0);return{style:r,color:i}};return{left:t("left"),right:t("right"),top:t("top"),bottom:t("bottom"),diagonal:t("diagonal"),diagonalUp:o.attrs.diagonalUp==="1",diagonalDown:o.attrs.diagonalDown==="1"}}function dn(o){let t={};return o.attrs.horizontal&&(t.horizontal=o.attrs.horizontal),o.attrs.vertical&&(t.vertical=o.attrs.vertical),o.attrs.wrapText&&(t.wrapText=o.attrs.wrapText!=="0"),o.attrs.shrinkToFit&&(t.shrinkToFit=o.attrs.shrinkToFit!=="0"),o.attrs.textRotation&&(t.textRotation=parseInt(o.attrs.textRotation,10)),o.attrs.indent&&(t.indent=parseInt(o.attrs.indent,10)),o.attrs.readingOrder&&(t.readingOrder=parseInt(o.attrs.readingOrder,10)),t}function Nr(o){let t=It(o);return tt(t,"si").map(e=>{let n=D(e,"t"),r=tt(e,"r");if(n&&!r.length)return{text:n.text??""};let s=r.map(l=>{let m=D(l,"t")?.text??"",c=D(l,"rPr"),h={text:m};return c&&(h.font=Co(c)),h}),i=s.map(l=>l.text).join("");return s.some(l=>l.font&&Object.keys(l.font).length>0)?{text:i,richText:s}:{text:i}})}function jr(o,t,e,n){let r=new Jt(t),s=It(o),i=[],a=[],l="",m="",c=[],h=new Map,d=new Set(["sheetPr","dimension","sheetViews","sheetFormatPr","cols","sheetData","mergeCells","conditionalFormatting","dataValidations","sheetProtection","printOptions","pageMargins","pageSetup","headerFooter","drawing","tableParts","autoFilter","rowBreaks","colBreaks","picture","oleObjects","ctrlProps","legacyDrawing","AlternateContent","extLst"]);for(let f of s.children){let p=Q(f.tag);switch(p){case"sheetViews":Or(f,r);break;case"cols":Xr(f,r,e);break;case"sheetData":Ur(f,r,e,n,h);break;case"mergeCells":Vr(f,r);break;case"autoFilter":r.autoFilter={ref:f.attrs.ref??""};break;case"tableParts":for(let u of tt(f,"tablePart")){let x=u.attrs["r:id"]??"";x&&a.push(x)}break;case"sheetProtection":zr(f,r);break;case"pageMargins":Wr(f,r);break;case"pageSetup":Hr(f,r);break;case"headerFooter":qr(f,r);break;case"printOptions":Gr(f,r);break;case"conditionalFormatting":Kr(f,r,e);break;case"dataValidations":Zr(f,r);break;case"rowBreaks":for(let u of tt(f,"brk")){let x=parseInt(u.attrs.id??"0",10);x>0&&r.addRowBreak(x,u.attrs.man==="1")}break;case"colBreaks":for(let u of tt(f,"brk")){let x=parseInt(u.attrs.id??"0",10);x>0&&r.addColBreak(x,u.attrs.man==="1")}break;case"drawing":m=f.attrs["r:id"]??"";break;case"legacyDrawing":l=f.attrs["r:id"]??"";break;case"AlternateContent":{let u=f.children.find($=>typeof $!="string"&&Q($.tag)==="Choice"),x=u?u.children.find($=>typeof $!="string"&&Q($.tag)==="controls"):void 0;if(x)for(let $ of x.children){if(typeof $=="string")continue;let y;if(Q($.tag)==="control"?y=$:Q($.tag)==="AlternateContent"&&(y=$.children.find(C=>typeof C!="string"&&Q(C.tag)==="Choice")?.children.find(C=>typeof C!="string"&&Q(C.tag)==="control")),!y)continue;let I=y.children.find(w=>typeof w!="string"&&Q(w.tag)==="controlPr"),R=y.attrs["r:id"]??I?.attrs["r:id"]??"";R&&c.push(R)}break}case"extLst":es(f,r);break;default:d.has(p)||i.push(Ae(f));break}}return{ws:r,originalXml:o,unknownParts:i,tableRIds:a,legacyDrawingRId:l,ctrlPropRIds:c,drawingRId:m,vmCells:h}}function Or(o,t){let e=tt(o,"sheetView")[0];if(!e)return;t.view={showGridLines:e.attrs.showGridLines!=="0",showRowColHeaders:e.attrs.showRowColHeaders!=="0",zoomScale:e.attrs.zoomScale?parseInt(e.attrs.zoomScale,10):void 0,rightToLeft:e.attrs.rightToLeft==="1",tabSelected:e.attrs.tabSelected==="1",view:e.attrs.view};let n=D(e,"pane");n&&n.attrs.state==="frozen"&&(t.freezePane={col:n.attrs.xSplit?parseInt(n.attrs.xSplit,10):void 0,row:n.attrs.ySplit?parseInt(n.attrs.ySplit,10):void 0})}function Xr(o,t,e){for(let n of tt(o,"col")){let r=parseInt(n.attrs.min??"1",10),s=parseInt(n.attrs.max??"1",10),i={width:n.attrs.width?parseFloat(n.attrs.width):void 0,hidden:n.attrs.hidden==="1",customWidth:n.attrs.customWidth==="1",outlineLevel:n.attrs.outlineLevel?parseInt(n.attrs.outlineLevel,10):void 0,style:n.attrs.style?e.xfs[parseInt(n.attrs.style,10)]:void 0};for(let a=r;a<=s;a++)t.setColumn(a,i)}}function Ur(o,t,e,n,r){for(let s of tt(o,"row")){let i=parseInt(s.attrs.r??"0",10);if(!i)continue;let a={};s.attrs.ht&&(a.height=parseFloat(s.attrs.ht)),s.attrs.hidden&&(a.hidden=s.attrs.hidden==="1"),s.attrs.outlineLevel&&(a.outlineLevel=parseInt(s.attrs.outlineLevel,10)),s.attrs.collapsed&&(a.collapsed=s.attrs.collapsed==="1"),s.attrs.s&&(a.style=e.xfs[parseInt(s.attrs.s,10)]),Object.keys(a).length&&t.setRow(i,a);for(let l of tt(s,"c")){let m=l.attrs.r??"";if(!m)continue;let{row:c,col:h}=Mt(m),d=l.attrs.s?parseInt(l.attrs.s,10):0,f=d>0?e.xfs[d]:void 0,p=l.attrs.t??"",u=D(l,"f"),x=D(l,"v"),$={};f&&($.style=f);let y=l.attrs.vm;if(y&&r&&r.set(m,parseInt(y,10)),u)u.attrs.t==="array"?$.arrayFormula=u.text??"":$.formula=u.text??"";else if(x){let I=x.text??"";switch(p){case"s":{let R=parseInt(I,10),w=n[R];w?($.value=w.text,w.richText&&($.richText=w.richText)):$.value="";break}case"b":$.value=I==="1"||I==="true";break;case"str":case"inlineStr":{let R=D(l,"is");$.value=R?D(R,"t")?.text??I:I;break}case"e":$.value=new jt(I);break;default:{let R=parseFloat(I);$.value=isNaN(R)?I:R;break}}}(Object.keys($).length||$.value!==void 0)&&t.setCell(c,h,$)}}}function Vr(o,t){for(let e of tt(o,"mergeCell")){let n=e.attrs.ref??"";n.includes(":")&&t.mergeByRef(n)}}function zr(o,t){t.protection={sheet:o.attrs.sheet!=="0",password:void 0,selectLockedCells:o.attrs.selectLockedCells!=="0",selectUnlockedCells:o.attrs.selectUnlockedCells!=="0",formatCells:o.attrs.formatCells==="0",formatColumns:o.attrs.formatColumns==="0",formatRows:o.attrs.formatRows==="0",insertColumns:o.attrs.insertColumns==="0",insertRows:o.attrs.insertRows==="0",insertHyperlinks:o.attrs.insertHyperlinks==="0",deleteColumns:o.attrs.deleteColumns==="0",deleteRows:o.attrs.deleteRows==="0",sort:o.attrs.sort==="0",autoFilter:o.attrs.autoFilter==="0",pivotTables:o.attrs.pivotTables==="0"}}function Wr(o,t){t.pageMargins={left:parseFloat(o.attrs.left??"0.7"),right:parseFloat(o.attrs.right??"0.7"),top:parseFloat(o.attrs.top??"0.75"),bottom:parseFloat(o.attrs.bottom??"0.75"),header:parseFloat(o.attrs.header??"0.3"),footer:parseFloat(o.attrs.footer??"0.3")}}function Hr(o,t){t.pageSetup={paperSize:o.attrs.paperSize?parseInt(o.attrs.paperSize,10):void 0,orientation:o.attrs.orientation,fitToPage:o.attrs.fitToPage==="1",fitToWidth:o.attrs.fitToWidth?parseInt(o.attrs.fitToWidth,10):void 0,fitToHeight:o.attrs.fitToHeight?parseInt(o.attrs.fitToHeight,10):void 0,scale:o.attrs.scale?parseInt(o.attrs.scale,10):void 0,horizontalDpi:o.attrs.horizontalDpi?parseInt(o.attrs.horizontalDpi,10):void 0,verticalDpi:o.attrs.verticalDpi?parseInt(o.attrs.verticalDpi,10):void 0}}function qr(o,t){t.headerFooter={oddHeader:D(o,"oddHeader")?.text,oddFooter:D(o,"oddFooter")?.text,evenHeader:D(o,"evenHeader")?.text,evenFooter:D(o,"evenFooter")?.text,firstHeader:D(o,"firstHeader")?.text,firstFooter:D(o,"firstFooter")?.text,differentOddEven:o.attrs.differentOddEven==="1",differentFirst:o.attrs.differentFirst==="1"}}function Gr(o,t){t.printOptions={gridLines:o.attrs.gridLines==="1",gridLinesSet:o.attrs.gridLinesSet==="1",headings:o.attrs.headings==="1",centerHorizontal:o.attrs.horizontalCentered==="1",centerVertical:o.attrs.verticalCentered==="1"}}function Kr(o,t,e){let n=o.attrs.sqref??"";for(let r of tt(o,"cfRule")){let s=r.attrs.type??"cellIs",i={sqref:n,type:s};if(r.attrs.operator&&(i.operator=r.attrs.operator),r.attrs.priority&&(i.priority=parseInt(r.attrs.priority,10)),r.attrs.text&&(i.text=r.attrs.text),r.attrs.aboveAverage==="0"&&(i.aboveAverage=!1),r.attrs.percent==="1"&&(i.percent=!0),r.attrs.rank&&(i.rank=parseInt(r.attrs.rank,10)),r.attrs.timePeriod&&(i.timePeriod=r.attrs.timePeriod),r.attrs.dxfId!==void 0){let h=parseInt(r.attrs.dxfId,10);e.dxfs[h]&&(i.style=e.dxfs[h])}let a=tt(r,"formula");a[0]?.text&&(i.formula=a[0].text),a[1]?.text&&(i.formula2=a[1].text);let l=D(r,"colorScale");if(l){let h=tt(l,"cfvo").map(f=>({type:f.attrs.type??"min",val:f.attrs.val})),d=tt(l,"color").map(f=>f.attrs.rgb??f.attrs.theme??"");i.colorScale={type:"colorScale",cfvo:h,color:d}}let m=D(r,"dataBar");if(m){let h=tt(m,"cfvo"),d=D(m,"color");i.dataBar={type:"dataBar",showValue:m.attrs.showValue!=="0"?void 0:!1,minType:h[0]?.attrs.type,minVal:h[0]?.attrs.val,maxType:h[1]?.attrs.type,maxVal:h[1]?.attrs.val,color:d?.attrs.rgb}}let c=D(r,"iconSet");if(c){let h=tt(c,"cfvo").map(d=>({type:d.attrs.type??"percent",val:d.attrs.val}));i.iconSet={type:"iconSet",iconSet:c.attrs.iconSet??"3TrafficLights1",cfvo:h,showValue:c.attrs.showValue==="0"?!1:void 0,reverse:c.attrs.reverse==="1"?!0:void 0}}t.addConditionalFormat(i)}}function Zr(o,t){for(let e of tt(o,"dataValidation")){let n=e.attrs.sqref??"";if(!n)continue;let r=e.attrs.type??"whole",s={type:r};e.attrs.operator&&(s.operator=e.attrs.operator),e.attrs.allowBlank==="1"&&(s.allowBlank=!0),e.attrs.showErrorMessage==="1"&&(s.showErrorAlert=!0),e.attrs.errorTitle&&(s.errorTitle=e.attrs.errorTitle),e.attrs.error&&(s.error=e.attrs.error),e.attrs.showInputMessage==="1"&&(s.showInputMessage=!0),e.attrs.promptTitle&&(s.promptTitle=e.attrs.promptTitle),e.attrs.prompt&&(s.prompt=e.attrs.prompt),e.attrs.showDropDown==="1"&&(s.showDropDown=!1);let i=D(e,"formula1"),a=D(e,"formula2");i?.text&&(r==="list"&&i.text.startsWith('"')&&i.text.endsWith('"')?s.list=i.text.slice(1,-1).split(","):s.formula1=i.text),a?.text&&(s.formula2=a.text),t.addDataValidation(n,s)}}function Yr(o){try{let t=It(o);if(Q(t.tag)!=="table")return null;let n=t.attrs.name??"",r=t.attrs.displayName??n,s=t.attrs.ref??"",i=parseInt(t.attrs.totalsRowCount??"0",10),a=[],l=Xt(t,"tableColumns");if(l)for(let h of tt(l,"tableColumn")){let d={name:h.attrs.name??""};h.attrs.totalsRowFunction&&(d.totalsRowFunction=h.attrs.totalsRowFunction),h.attrs.totalsRowFormula&&(d.totalsRowFormula=h.attrs.totalsRowFormula),h.attrs.totalsRowLabel&&(d.totalsRowLabel=h.attrs.totalsRowLabel),a.push(d)}let m={name:n,ref:s,columns:a};r&&r!==n&&(m.displayName=r),i>0&&(m.totalsRow=!0);let c=Xt(t,"tableStyleInfo");return c&&(c.attrs.name&&(m.style=c.attrs.name),c.attrs.showFirstColumn==="1"&&(m.showFirstColumn=!0),c.attrs.showLastColumn==="1"&&(m.showLastColumn=!0),c.attrs.showRowStripes==="1"&&(m.showRowStripes=!0),c.attrs.showColumnStripes==="1"&&(m.showColumnStripes=!0)),m}catch{return null}}var re=9525;function fn(o){return{col:parseInt(D(o,"col")?.text??"0",10),row:parseInt(D(o,"row")?.text??"0",10),colOff:parseInt(D(o,"colOff")?.text??"0",10),rowOff:parseInt(D(o,"rowOff")?.text??"0",10)}}function pn(o){return{png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",emf:"emf",wmf:"wmf",tiff:"tiff",tif:"tiff",svg:"svg",ico:"ico",webp:"webp",bmp:"bmp"}[o.toLowerCase()]??"png"}function Qr(o,t,e,n,r){let s=It(o);for(let i of s.children){if(typeof i=="string")continue;let a=Q(i.tag);if(a!=="twoCellAnchor"&&a!=="oneCellAnchor"&&a!=="absoluteAnchor")continue;let l=os(i,a),m=rt(i,"pic");if(m){ns(m,i,a,l,t,e,n,r);continue}let c=rt(i,"graphicFrame");if(c){Jr(c,i,a,t,e,n,r);continue}let h=rt(i,"oMath");if(h){rs(h,i,a,l,r);continue}let d=rt(i,"sp");if(d){ts(d,i,a,r);continue}}}function Jr(o,t,e,n,r,s,i){let a=rt(o,"chart");if(!a||!n)return;let l=a.attrs["r:id"]??sn(a,"r:id")??"";if(!l)return;let m=n.get(l);if(!m)return;let c=m.target.startsWith("/")?m.target.slice(1):fe(r,m.target),h=s(c);if(!h)return;let f=new TextDecoder().decode(h.data),p=It(f),u={col:0,row:0},x={col:8,row:15};if(e==="twoCellAnchor"){let E=D(t,"from"),_=D(t,"to");E&&(u={col:parseInt(D(E,"col")?.text??"0",10),row:parseInt(D(E,"row")?.text??"0",10)}),_&&(x={col:parseInt(D(_,"col")?.text??"0",10),row:parseInt(D(_,"row")?.text??"0",10)})}let $=rt(p,"plotArea");if(!$)return;let y={barChart:"column",bar3DChart:"column",lineChart:"line",line3DChart:"line",areaChart:"area",area3DChart:"area",pieChart:"pie",pie3DChart:"pie",doughnutChart:"doughnut",scatterChart:"scatter",bubbleChart:"bubble",radarChart:"radar",stockChart:"stock"},I="column",R;for(let E of $.children){if(typeof E=="string")continue;let _=Q(E.tag);if(y[_]){if(I=y[_],R=E,_==="barChart"||_==="bar3DChart"){(D(E,"barDir")?.attrs.val??"")==="bar"&&(I="bar");let O=D(E,"grouping")?.attrs.val??"";O==="stacked"&&(I=I==="bar"?"barStacked":"columnStacked"),O==="percentStacked"&&(I=I==="bar"?"barStacked100":"columnStacked100")}if(_==="lineChart"){let A=rt(E,"marker");if(A){let N=D(A,"symbol")?.attrs.val??"";N&&N!=="none"&&(I="lineMarker")}}_==="scatterChart"&&D(E,"scatterStyle")?.attrs.val?.includes("Smooth")&&(I="scatterSmooth"),_==="radarChart"&&D(E,"radarStyle")?.attrs.val==="filled"&&(I="radarFilled");break}}if(!R)return;let w=[];for(let E of tt(R,"ser")){let _={values:""},A=D(E,"tx");if(A){let z=rt(A,"strRef");if(z){let st=D(z,"f");st?.text&&(_.name=st.text);let ct=D(z,"strCache");if(ct){let at=rt(ct,"pt"),pt=at?rt(at,"v"):void 0;pt?.text&&(_.name=pt.text)}}let V=rt(A,"v");V?.text&&!_.name&&(_.name=V.text)}let N=D(E,"val")||D(E,"yVal");if(N){let z=rt(N,"numRef");if(z){let V=D(z,"f");V?.text&&(_.values=V.text)}}let j=D(E,"cat")||D(E,"xVal");if(j){let z=rt(j,"strRef"),V=rt(j,"numRef"),st=z||V;if(st){let ct=D(st,"f");ct?.text&&(_.categories=ct.text)}}let O=D(E,"spPr");if(O){let z=D(O,"solidFill");if(z){let V=D(z,"srgbClr");V?.attrs.val&&(_.color="#"+V.attrs.val)}}_.values&&w.push(_)}if(!w.length)return;let C,g=D(p,"title")||rt(p,"title");if(g){let E=rt(g,"t");E?.text&&(C=E.text)}let M,T,S=rt($,"catAx")||rt($,"dateAx"),k=rt($,"valAx");if(S){M={};let E=rt(S,"title");if(E){let _=rt(E,"t");_?.text&&(M.title=_.text)}}if(k){T={};let E=rt(k,"title");if(E){let A=rt(E,"t");A?.text&&(T.title=A.text)}D(k,"majorGridlines")&&(T.gridLines=!0)}let L=!1,P=rt(p,"legend");P&&(L=D(P,"legendPos")?.attrs.val||!0);let H=D(R,"varyColors")?.attrs.val!=="0",G={type:I,series:w,from:u,to:x};C&&(G.title=C),M&&(G.xAxis=M),T&&(G.yAxis=T),L!==!1&&(G.legend=L),H&&(G.varyColors=!0),i.addChart(G)}function ts(o,t,e,n){let r={col:0,row:0},s={col:2,row:2};if(e==="twoCellAnchor"){let x=D(t,"from"),$=D(t,"to");x&&(r={col:parseInt(D(x,"col")?.text??"0",10),row:parseInt(D(x,"row")?.text??"0",10)}),$&&(s={col:parseInt(D($,"col")?.text??"0",10),row:parseInt(D($,"row")?.text??"0",10)})}let i=rt(o,"spPr"),a="rect",l,m,c,h;if(i){let x=rt(i,"prstGeom");if(x){let R=x.attrs.prst??"";new Set(["rect","roundRect","ellipse","triangle","diamond","pentagon","hexagon","octagon","star5","star6","rightArrow","leftArrow","upArrow","downArrow","line","curvedConnector3","callout1","callout2","cloud","heart","lightningBolt","sun","moon","smileyFace","flowChartProcess","flowChartDecision","flowChartTerminator","flowChartDocument"]).has(R)&&(a=R)}let $=D(i,"solidFill");if($){let R=D($,"srgbClr");R?.attrs.val&&(l="#"+R.attrs.val);let w=D($,"schemeClr");w?.attrs.val&&(l="theme:"+w.attrs.val)}let y=D(i,"ln");if(y){let R=y.attrs.w;R&&(c=Math.round(parseInt(R,10)/re));let w=D(y,"solidFill");if(w){let C=D(w,"srgbClr");C?.attrs.val&&(m="#"+C.attrs.val)}}let I=rt(i,"xfrm");I?.attrs.rot&&(h=parseInt(I.attrs.rot,10)/6e4)}let d,f,p=rt(o,"txBody");if(p){let x=D(p,"bodyPr"),y=(x?D(x,"prstTxWarp"):void 0)?.attrs.prst??x?.attrs.prstTxWarp??"",I=[];for(let w of tt(p,"p"))for(let C of tt(w,"r")){let g=D(C,"t");if(g?.text&&I.push(g.text),!f){let M=D(C,"rPr");if(M){f={},M.attrs.sz&&(f.size=parseInt(M.attrs.sz,10)/100),M.attrs.b==="1"&&(f.bold=!0),M.attrs.i==="1"&&(f.italic=!0);let T=rt(M,"latin");T?.attrs.typeface&&(f.name=T.attrs.typeface);let S=D(M,"solidFill");if(S){let k=D(S,"srgbClr");k?.attrs.val&&(f.color="#"+k.attrs.val)}}}}if(d=I.join(""),y&&new Set(["textPlain","textArchUp","textArchDown","textCircle","textWave1","textWave2","textInflate","textDeflate","textFadeUp","textFadeDown","textFadeLeft","textFadeRight","textSlantUp","textSlantDown","textCascadeUp","textCascadeDown","textChevron","textRingInside","textRingOutside","textStop"]).has(y)&&d){let w={text:d,from:r,to:s};y!=="textPlain"&&(w.preset=y),f&&(w.font=f),l&&(w.fillColor=l),m&&(w.outlineColor=m),n.addWordArt(w);return}}let u={type:a,from:r,to:s};d&&(u.text=d),l&&(u.fillColor=l),m&&(u.lineColor=m),c&&(u.lineWidth=c),f&&(u.font=f),h&&(u.rotation=h),n.addShape(u)}function es(o,t){for(let e of tt(o,"ext")){let n=e.children?.filter(r=>typeof r!="string"&&Q(r.tag)==="sparklineGroups");if(n?.length)for(let r of n)for(let s of tt(r,"sparklineGroup")){let i=s.attrs.type??"line",a=i==="column"?"bar":i==="stacked"?"stacked":"line",l=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorSeries"),m=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorHigh"),c=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorLow"),h=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorFirst"),d=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorLast"),f=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorNegative"),p=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="colorMarkers"),u=s.attrs.high==="1",x=s.attrs.low==="1",$=s.attrs.first==="1",y=s.attrs.last==="1",I=s.attrs.negative==="1",R=s.attrs.markers==="1",w=s.attrs.lineWeight,C=w?parseFloat(w):void 0,g=s.attrs.minAxisType==="individual"?"individual":s.attrs.minAxisType==="custom"?"custom":void 0,M=s.attrs.maxAxisType==="individual"?"individual":s.attrs.maxAxisType==="custom"?"custom":void 0,T=s.children?.find(k=>typeof k!="string"&&Q(k.tag)==="sparklines");if(!T)continue;let S=T.children?.filter(k=>typeof k!="string"&&Q(k.tag)==="sparkline");if(S)for(let k of S){let L=k.children?.find(E=>typeof E!="string"&&Q(E.tag)==="f"),P=k.children?.find(E=>typeof E!="string"&&Q(E.tag)==="sqref"),U=L?.text??"",H=P?.text??"";if(!U||!H)continue;let G={type:a,dataRange:U,location:H};if(l){let E=l.attrs.rgb;E&&(G.color="#"+E.slice(2));let _=l.attrs.theme;_&&(G.color="theme:"+_)}if(m){let E=m.attrs.rgb;E&&(G.highColor="#"+E.slice(2));let _=m.attrs.theme;_&&(G.highColor="theme:"+_)}if(c){let E=c.attrs.rgb;E&&(G.lowColor="#"+E.slice(2));let _=c.attrs.theme;_&&(G.lowColor="theme:"+_)}if(h){let E=h.attrs.rgb;E&&(G.firstColor="#"+E.slice(2));let _=h.attrs.theme;_&&(G.firstColor="theme:"+_)}if(d){let E=d.attrs.rgb;E&&(G.lastColor="#"+E.slice(2));let _=d.attrs.theme;_&&(G.lastColor="theme:"+_)}if(f){let E=f.attrs.rgb;E&&(G.negativeColor="#"+E.slice(2));let _=f.attrs.theme;_&&(G.negativeColor="theme:"+_)}if(p){let E=p.attrs.rgb;E&&(G.markersColor="#"+E.slice(2));let _=p.attrs.theme;_&&(G.markersColor="theme:"+_)}u&&(G.showHigh=!0),x&&(G.showLow=!0),$&&(G.showFirst=!0),y&&(G.showLast=!0),I&&(G.showNegative=!0),R&&(G.showMarkers=!0),C!==void 0&&(G.lineWidth=C),g&&(G.minAxisType=g),M&&(G.maxAxisType=M),t.addSparkline(G)}}}}function os(o,t){let e={};if(t==="twoCellAnchor"||t==="oneCellAnchor"){let n=D(o,"from");n&&(e.from={col:parseInt(D(n,"col")?.text??"0",10),row:parseInt(D(n,"row")?.text??"0",10),colOff:parseInt(D(n,"colOff")?.text??"0",10),rowOff:parseInt(D(n,"rowOff")?.text??"0",10)})}if(t==="oneCellAnchor"){let n=rt(o,"ext");n&&(e.width=parseInt(n.attrs.cx??"0",10),e.height=parseInt(n.attrs.cy??"0",10))}return e}function ns(o,t,e,n,r,s,i,a){let l=rt(o,"blipFill"),m=l?rt(l,"blip"):void 0,c=m?.attrs["r:embed"]??m?.attrs.embed??"";if(!c||!r)return;let h=r.get(c);if(!h)return;let d=h.target.startsWith("/")?h.target.slice(1):fe(s,h.target),f=i(d);if(!f)return;let p=d.split(".").pop()??"png",u=pn(p),$=rt(o,"cNvPr")?.attrs.descr||void 0,y={data:f.data,format:u};if($&&(y.altText=$),e==="twoCellAnchor"){let I=D(t,"from"),R=D(t,"to");I&&(y.from=fn(I)),R&&(y.to=fn(R))}else if(e==="oneCellAnchor")n.from&&(y.from=n.from),n.width&&(y.width=Math.round(n.width/re)),n.height&&(y.height=Math.round(n.height/re));else{let I=D(t,"pos"),R=D(t,"ext");I&&(y.position={x:Math.round(parseInt(I.attrs.x??"0",10)/re),y:Math.round(parseInt(I.attrs.y??"0",10)/re)}),R&&(y.width=Math.round(parseInt(R.attrs.cx??"0",10)/re),y.height=Math.round(parseInt(R.attrs.cy??"0",10)/re))}a.addImage(y)}function rs(o,t,e,n,r){let s=dt(o);if(!s.length)return;let i=n.from??{col:0,row:0},a={elements:s,from:i};n.width&&(a.width=n.width),n.height&&(a.height=n.height);let l=rt(o,"rPr");if(l){let m=l.attrs.sz;m&&(a.fontSize=parseInt(m,10)/100);let c=rt(l,"latin");c?.attrs.typeface&&(a.fontName=c.attrs.typeface)}r.addMathEquation(a)}function dt(o){let t=[];for(let e of o.children){if(typeof e=="string")continue;let n=ss(e);n&&t.push(n)}return t}function ss(o){switch(Q(o.tag)){case"r":return{type:"text",text:rt(o,"t")?.text??""};case"f":{let e=D(o,"num"),n=D(o,"den");return{type:"frac",base:e?dt(e):[],argument:n?dt(n):[]}}case"sSup":{let e=D(o,"e"),n=D(o,"sup");return{type:"sup",base:e?dt(e):[],argument:n?dt(n):[]}}case"sSub":{let e=D(o,"e"),n=D(o,"sub");return{type:"sub",base:e?dt(e):[],argument:n?dt(n):[]}}case"sSubSup":{let e=D(o,"e"),n=D(o,"sub"),r=D(o,"sup");return{type:"subSup",base:e?dt(e):[],subscript:n?dt(n):[],superscript:r?dt(r):[]}}case"nary":{let e=D(o,"naryPr"),n=e?D(e,"chr"):void 0,r=n?.attrs["m:val"]??n?.attrs.val??"\u2211",s=D(o,"sub"),i=D(o,"sup"),a=D(o,"e");return{type:"nary",operator:r,lower:s?dt(s):[],upper:i?dt(i):[],body:a?dt(a):[]}}case"rad":{let e=D(o,"radPr"),n=e?D(e,"degHide"):void 0,r=n?.attrs["m:val"]==="1"||n?.attrs.val==="1",s=D(o,"deg"),i=D(o,"e");return{type:"rad",hideDegree:r,degree:s?dt(s):[],body:i?dt(i):[]}}case"d":{let e=D(o,"dPr"),n=e?D(e,"begChr"):void 0,r=e?D(e,"endChr"):void 0,s=D(o,"e");return{type:"delim",open:n?.attrs["m:val"]??n?.attrs.val??"(",close:r?.attrs["m:val"]??r?.attrs.val??")",body:s?dt(s):[]}}case"func":{let e=D(o,"fName"),n=D(o,"e");return{type:"func",base:e?dt(e):[],argument:n?dt(n):[]}}case"groupChr":{let e=D(o,"groupChrPr"),n=e?D(e,"chr"):void 0,r=D(o,"e");return{type:"groupChar",operator:n?.attrs["m:val"]??n?.attrs.val??"\u23DF",base:r?dt(r):[]}}case"acc":{let e=D(o,"accPr"),n=e?D(e,"chr"):void 0,r=D(o,"e");return{type:"accent",operator:n?.attrs["m:val"]??n?.attrs.val??"\u0302",base:r?dt(r):[]}}case"bar":{let e=D(o,"e");return{type:"bar",base:e?dt(e):[]}}case"limLow":{let e=D(o,"e"),n=D(o,"lim");return{type:"limLow",base:e?dt(e):[],argument:n?dt(n):[]}}case"limUpp":{let e=D(o,"e"),n=D(o,"lim");return{type:"limUpp",base:e?dt(e):[],argument:n?dt(n):[]}}case"m":{let e=[];for(let n of tt(o,"mr")){let r=[];for(let s of tt(n,"e")){let i=dt(s);i.length===1?r.push(i[0]):r.push({type:"text",text:i.map(a=>a.text??"").join("")})}e.push(r)}return{type:"matrix",rows:e}}case"eqArr":{let e=[];for(let n of tt(o,"e"))e.push(dt(n));return{type:"eqArr",rows:e}}default:return null}}function as(o,t,e,n){let r=t("xl/metadata.xml");if(!r)return;let s=It(r),i=D(s,"valueMetadata");if(!i)return;let a=tt(i,"bk"),l=s.children.find(y=>typeof y!="string"&&Q(y.tag)==="futureMetadata"),m=l?tt(l,"bk"):[],c=t("xl/richData/rdrichvalue.xml");if(!c)return;let h=It(c),d=tt(h,"rv"),f=t("xl/richData/_rels/richValueRel.xml.rels");if(!f)return;let p=vo(f),u=t("xl/richData/richValueRel.xml");if(!u)return;let x=It(u),$=tt(x,"rel");for(let[y,I]of o){let R=a[I-1];if(!R)continue;let w=R.children.find(N=>typeof N!="string"&&Q(N.tag)==="rc");if(!w)continue;let C=parseInt(w.attrs.v??"-1",10);if(C<0)continue;let g=m[C];if(!g)continue;let M=rt(g,"rvb"),T=parseInt(M?.attrs.i??"-1",10);if(T<0)continue;let S=d[T];if(!S)continue;let k=tt(S,"v"),L=parseInt(k[0]?.text??"-1",10);if(L<0)continue;let P=$[L];if(!P)continue;let U=P.attrs["r:id"]??"",H=p.get(U);if(!H)continue;let G=H.target.startsWith("/")?H.target.slice(1):`xl/richData/${H.target}`,E=e(G);if(!E)continue;let _=G.split(".").pop()??"png",A=pn(_);n.addCellImage({data:E.data,format:A,cell:y})}}function rt(o,t){for(let e of o.children){if(typeof e=="string")continue;if(Q(e.tag)===t)return e;let n=rt(e,t);if(n)return n}}function fe(o,t){let e=o.replace(/\/$/,"").split("/");for(let n of t.split("/"))n===".."?e.pop():n!=="."&&e.push(n);return e.join("/")}async function un(o){let t=await $o(o),e=E=>t.get(E)??t.get(E.replace(/^\//,"")),n=E=>{let _=e(E);return _?Ve(_):void 0},r=n("[Content_Types].xml")??"<Types/>",s=Br(r),i=n("xl/_rels/workbook.xml.rels")??"<Relationships/>",a=vo(i),l=n("xl/workbook.xml")??"<workbook/>",m=n("xl/styles.xml")??"<styleSheet/>",c=Lr(m),h=n("xl/sharedStrings.xml")??"<sst/>",d=h!=="<sst/>"?Nr(h):[],f=n("docProps/core.xml")??"",p=f?an(f):{},u=n("docProps/app.xml")??"",x={},$="";if(u){let E=ln(u);x=E.props,$=E.unknownRaw}let y=n("docProps/custom.xml")??"",I=y?cn(y):[],R=It(l),w=Xt(R,"sheets"),C=w?tt(w,"sheet"):[],g=[],M=Xt(R,"definedNames");if(M)for(let E of tt(M,"definedName")){let _=E.attrs.name??"",A=E.text??"";if(!_||!A)continue;let N={name:_,ref:A};if(E.attrs.localSheetId!==void 0){let j=parseInt(E.attrs.localSheetId,10),O=C[j];O&&(N.scope=O.attrs.name??void 0)}E.attrs.comment&&(N.comment=E.attrs.comment),g.push(N)}let T=new Map;for(let[E,_]of t)E.includes("_rels/")&&T.set(E,vo(Ve(_)));let S=[];for(let E of C){let _=E.attrs["r:id"]??Object.values(E.attrs).find(Z=>Z.startsWith("rId"))??"",A=E.attrs.sheetId??"",N=E.attrs.name??`Sheet${A}`,j=a.get(_);if(!j)continue;let O=j.target.startsWith("/")?j.target.slice(1):`xl/${j.target}`,z=n(O)??"";if(!z)continue;let{ws:V,originalXml:st,unknownParts:ct,tableRIds:at,legacyDrawingRId:pt,ctrlPropRIds:v,drawingRId:F,vmCells:B}=jr(z,N,c,d);V.sheetIndex=S.length+1,V.rId=_;let X=[],W=[];if(at.length){let Z=O.split("/").pop()??"",J=O.substring(0,O.lastIndexOf("/")+1),mt=`${J}_rels/${Z}.rels`,K=T.get(mt);if(K){for(let nt of at){let et=K.get(nt);if(!et)continue;let ut=et.target.startsWith("/")?et.target.slice(1):fe(J,et.target),yt=n(ut);if(yt){let Ft=Yr(yt);Ft&&V.addTable(Ft),X.push(ut),W.push(yt)}}V.tableRIds=at}}if(pt&&v.length){let Z=O.split("/").pop()??"",J=O.substring(0,O.lastIndexOf("/")+1),mt=`${J}_rels/${Z}.rels`,K=T.get(mt);if(K){let nt=K.get(pt),et=nt?nt.target.startsWith("/")?nt.target.slice(1):fe(J,nt.target):"",ut=et?n(et):"",yt=[];if(ut){let Ft=It(ut);for(let ot of Ft.children){if(typeof ot=="string"||Q(ot.tag)!=="shape")continue;let St=ot.children.find(kt=>typeof kt!="string"&&Q(kt.tag)==="ClientData");if(!St)continue;let gt=St.attrs.ObjectType??"";if(gt==="Note"||!gt)continue;let it=(ot.attrs.id??"").replace(/\D/g,""),At=parseInt(it,10)||0;yt.push({objectType:gt,shapeXml:Ae(ot),clientData:St,shapeId:At})}}for(let Ft=0;Ft<v.length;Ft++){let ot=K.get(v[Ft]);if(!ot)continue;let St=ot.target.startsWith("/")?ot.target.slice(1):fe(J,ot.target),gt=n(St)??"",it=gt?It(gt):null,At=it?.attrs.objectType??"",kt=Oo[At]??"button",Nt=yt[Ft],_e=is(Nt?.clientData),Pt={type:kt,from:_e.from,to:_e.to,_ctrlPropXml:gt||void 0,_vmlShapeXml:Nt?.shapeXml,_shapeId:Nt?.shapeId};if(it){if(it.attrs.fmlaLink&&(Pt.linkedCell=it.attrs.fmlaLink),it.attrs.fmlaRange&&(Pt.inputRange=it.attrs.fmlaRange),it.attrs.checked&&(Pt.checked=Uo[it.attrs.checked]??"unchecked"),it.attrs.dropLines&&(Pt.dropLines=parseInt(it.attrs.dropLines,10)),it.attrs.min&&(Pt.min=parseInt(it.attrs.min,10)),it.attrs.max&&(Pt.max=parseInt(it.attrs.max,10)),it.attrs.inc&&(Pt.inc=parseInt(it.attrs.inc,10)),it.attrs.page&&(Pt.page=parseInt(it.attrs.page,10)),it.attrs.val&&(Pt.val=parseInt(it.attrs.val,10)),it.attrs.selType){let we={Single:"single",Multi:"multi",Extend:"extend"};Pt.selType=we[it.attrs.selType]??"single"}it.attrs.noThreeD==="1"&&(Pt.noThreeD=!0)}if(Nt?.clientData){let we=Nt.clientData.children.find(Po=>typeof Po!="string"&&Q(Po.tag)==="FmlaMacro");we&&(Pt.macro=we.text??"")}V.addFormControl(Pt)}V.legacyDrawingRId=pt,V.ctrlPropRIds=v}}if(F){let Z=O.split("/").pop()??"",J=O.substring(0,O.lastIndexOf("/")+1),mt=`${J}_rels/${Z}.rels`,K=T.get(mt);if(K){let nt=K.get(F);if(nt){let et=nt.target.startsWith("/")?nt.target.slice(1):fe(J,nt.target),ut=n(et);if(ut){let yt=et.substring(0,et.lastIndexOf("/")+1),Ft=et.split("/").pop()??"",ot=`${yt}_rels/${Ft}.rels`,St=T.get(ot);Qr(ut,St,yt,e,V)}}}}B.size>0&&as(B,n,e,V),S.push({ws:V,sheetId:A,rId:_,originalXml:st,unknownParts:ct,tablePaths:X,tableXmls:W})}let k=n("xl/connections.xml")??"",L=[];if(k){let E=It(k);for(let _ of tt(E,"connection")){let A=parseInt(_.attrs.id??"0",10),N=_.attrs.name??"",j=parseInt(_.attrs.type??"0",10),O=cs(j);if(!N||!O)continue;let z={id:A,name:N,type:O};_.attrs.description&&(z.description=_.attrs.description),_.attrs.refreshOnLoad==="1"&&(z.refreshOnLoad=!0),_.attrs.background==="1"&&(z.background=!0),_.attrs.saveData==="1"&&(z.saveData=!0),_.attrs.keepAlive==="1"&&(z.keepAlive=!0),_.attrs.interval&&(z.interval=parseInt(_.attrs.interval,10));let V=D(_,"dbPr");V&&(V.attrs.connection&&(z.connectionString=V.attrs.connection),V.attrs.command&&(z.command=V.attrs.command),V.attrs.commandType&&(z.commandType=hs(parseInt(V.attrs.commandType,10)))),z._rawXml=Ae(_),L.push(z)}}let P=[];for(let[E,_]of t)if(!(!E.startsWith("customXml/item")||E.includes("Props")||E.includes("_rels")))try{let A=await ds(_.data);if(A.length){P.push(...A);break}}catch{}let U=new Set(["xl/workbook.xml","xl/styles.xml","xl/sharedStrings.xml","xl/worksheets/","docProps/","[Content_Types].xml","_rels/","xl/_rels/","xl/connections.xml"]),H=new Map;for(let[E,_]of t){if(E.endsWith("_rels/")||E==="[Content_Types].xml")continue;[...U].some(N=>E.startsWith(N))||H.set(E,_.data)}let G=[];for(let E of g)if(E.name==="_xlnm.Print_Area"&&E.scope){let _=S.find(A=>A.ws.name===E.scope);_&&(_.ws.printArea=E.ref)}else G.push(E);return{sheets:S,styles:c,stylesXml:m,sharedStrings:d,sharedXml:h,workbookXml:l,workbookRels:a,contentTypes:s,contentTypesXml:r,core:p,extended:x,extendedUnknownRaw:$,custom:I,hasCustomProps:I.length>0,namedRanges:G,connections:L,connectionsXml:k,powerQueries:P,unknownParts:H,allRels:T}}function is(o){let t={from:{col:0,row:0},to:{col:2,row:2}};if(!o)return t;let e=o.children.find(s=>typeof s!="string"&&Q(s.tag)==="Anchor");if(!e)return t;let r=(e.text??"").split(",").map(s=>parseInt(s.trim(),10));return r.length<8||r.some(isNaN)?t:{from:{col:r[0],colOff:r[1],row:r[2],rowOff:r[3]},to:{col:r[4],colOff:r[5],row:r[6],rowOff:r[7]}}}var gn={1:"odbc",2:"dao",3:"file",4:"web",5:"oledb",6:"text",7:"dsp"},ls=Object.fromEntries(Object.entries(gn).map(([o,t])=>[t,Number(o)]));function cs(o){return gn[o]}function xn(o){return ls[o]}var $n={1:"sql",2:"table",3:"default",4:"web",5:"oledb"},ms=Object.fromEntries(Object.entries($n).map(([o,t])=>[t,Number(o)]));function hs(o){return $n[o]}function yn(o){return ms[o]}async function ds(o){if(o.length<12)return[];let t=new DataView(o.buffer,o.byteOffset,o.byteLength);if(t.getUint32(0,!0)!==0)return[];let n=t.getUint32(4,!0);if(n<4||8+n>o.length)return[];let r=o.subarray(8,8+n);if(r[0]!==80||r[1]!==75)return[];let s=await $o(r),i=[];for(let[a,l]of s){if(!a.includes("/Formula/")||!a.endsWith(".m"))continue;let m=Ve(l);if(!m)continue;let c=a.match(/Formulas\/([^/]+)\//),h=c?c[1]:void 0,d=/shared\s+(?:#"([^"]+)"|(\w+))\s*=/g,f,p=new Set;for(;(f=d.exec(m))!==null;){let u=f[1]??f[2];p.add(u)}if(p.size>0){let u=/shared\s+(?:#"([^"]+)"|(\w+))\s*=\s*([\s\S]*?)(?=,\s*shared\s|\]\s*$)/g,x;for(;(x=u.exec(m))!==null;){let $=x[1]??x[2],y=x[3].replace(/,\s*$/,"").trim();i.push({name:$,formula:y})}i.length===0&&i.push({name:h??"Section1",formula:m})}else h&&i.push({name:h,formula:m})}return i}var ke=class o{constructor(){this.sheets=[],this.namedRanges=[],this.connections=[],this.powerQueries=[],this.externalLinks=[],this.customPivotStyles=[],this.pivotSlicers=[],this.properties={},this.compressionLevel=6,this.coreProperties={},this.extendedProperties={},this.customProperties=[],this.isTemplate=!1,this._dirtySheets=new Set,this._customTableStyles=new Map}markDirty(t){if(typeof t=="string"){let e=this.sheets.findIndex(n=>n.name===t);e>=0&&this._dirtySheets.add(e)}else this._dirtySheets.add(t)}static async fromBytes(t){let e=new o,n=await un(t);e._readResult=n,e.coreProperties=n.core,e.extendedProperties=n.extended,e.customProperties=n.custom,e.properties={title:n.core.title,author:n.core.creator,subject:n.core.subject,description:n.core.description,keywords:n.core.keywords,company:n.extended.company,lastModifiedBy:n.core.lastModifiedBy,created:n.core.created,modified:n.core.modified,category:n.core.category,status:n.core.contentStatus},e.sheets=n.sheets.map(s=>s.ws),e.namedRanges=n.namedRanges,e.connections=n.connections,e.powerQueries=n.powerQueries;let r=n.unknownParts.get("xl/vbaProject.bin");if(r)try{e.vbaProject=Se.fromBytes(r)}catch{}return e}static async fromBase64(t){return o.fromBytes(be(t))}static async fromFile(t){let n=await(await import("fs/promises")).readFile(t);return o.fromBytes(new Uint8Array(n))}static async fromBlob(t){return o.fromBytes(new Uint8Array(await t.arrayBuffer()))}addSheet(t,e={}){let n=new Jt(t,e);return n.sheetIndex=this.sheets.length+1,this.sheets.push(n),this._dirtySheets.add(n.sheetIndex-1),n}getSheet(t){return this.sheets.find(e=>e.name===t)}getSheetByIndex(t){return this.sheets[t]}getSheetNames(){return this.sheets.map(t=>t.name)}getSheets(){return this.sheets}removeSheet(t){return this.sheets=this.sheets.filter(e=>e.name!==t),this}addChartSheet(t,e){let n=this.addSheet(t);return n._isChartSheet=!0,n.addChart(e),n}addDialogSheet(t){let e=this.addSheet(t);return e._isDialogSheet=!0,e}copySheet(t,e){let n=this.getSheet(t);if(!n)throw new Error(`Sheet "${t}" not found`);let r=this.addSheet(e),s=n.readAllCells();for(let{row:a,col:l,cell:m}of s){let c=r.getCell(a,l);m.value!=null&&(c.value=m.value),m.formula&&(c.formula=m.formula),m.arrayFormula&&(c.arrayFormula=m.arrayFormula),m.richText&&(c.richText=m.richText.map(h=>({...h,font:h.font?{...h.font}:void 0}))),m.style&&(c.style={...m.style}),m.comment&&(c.comment={...m.comment}),m.hyperlink&&(c.hyperlink={...m.hyperlink})}for(let a of n.getMerges())r.merge(a.startRow,a.startCol,a.endRow,a.endCol);let i=n.getUsedRange();if(i)for(let a=i.startCol;a<=i.endCol;a++){let l=n.getColumn(a);l&&r.setColumn(a,{...l})}return n.pageSetup&&(r.pageSetup={...n.pageSetup}),n.printArea&&(r.printArea=n.printArea),r}registerTableStyle(t,e){return this._customTableStyles.set(t,e),this}addNamedRange(t){return this.namedRanges.push(t),this}getNamedRanges(){return this.namedRanges}getNamedRange(t){return this.namedRanges.find(e=>e.name===t)}removeNamedRange(t){return this.namedRanges=this.namedRanges.filter(e=>e.name!==t),this}addConnection(t){return this.connections.push(t),this}getConnections(){return this.connections}getConnection(t){return this.connections.find(e=>e.name===t)}removeConnection(t){return this.connections=this.connections.filter(e=>e.name!==t),this}getPowerQueries(){return this.powerQueries}getPowerQuery(t){return this.powerQueries.find(e=>e.name===t)}getCustomProperty(t){return this.customProperties.find(e=>e.name===t)}setCustomProperty(t,e){let n=this.customProperties.findIndex(r=>r.name===t);return n>=0?this.customProperties[n]={name:t,value:e}:this.customProperties.push({name:t,value:e}),this}removeCustomProperty(t){return this.customProperties=this.customProperties.filter(e=>e.name!==t),this}addExternalLink(t){return this.externalLinks.push(t),this}getExternalLinks(){return this.externalLinks}registerPivotStyle(t){return this.customPivotStyles.push(t),this}addPivotSlicer(t){return this.pivotSlicers.push(t),this}getPivotSlicers(){return this.pivotSlicers}async build(){return this._syncLegacyProperties(),this._readResult?this._buildPatched():this._buildFresh()}async _buildPatched(){let t=this._readResult,e=[],n=this._dirtySheets.size>0,r=new ie,s=new le,i=new Map;if(n){let c=/<dxf>([\s\S]*?)<\/dxf>|<dxf\/>/g,h=[],d;for(;(d=c.exec(t.stylesXml))!==null;)h.push(d[1]??"");h.length&&r.prependRawDxfs(h);for(let f=0;f<this.sheets.length;f++)i.set(f,this.sheets[f].toXml(r,s))}e.push({name:"docProps/core.xml",data:q(yo({...t.core,...this.coreProperties,modified:new Date}))}),e.push({name:"docProps/app.xml",data:q(wo({...t.extended,...this.extendedProperties,titlesOfParts:this.sheets.map(c=>c.name),headingPairs:this._headingPairs()},t.extendedUnknownRaw))});let a=this.customProperties.length>0?this.customProperties:t.hasCustomProps?t.custom:null;a&&a.length>0&&e.push({name:"docProps/custom.xml",data:q(bo(a))}),e.push({name:"xl/workbook.xml",data:q(this._patchWorkbookXml(t.workbookXml))});let l=this._connectionsXml(t.connectionsXml);l&&e.push({name:"xl/connections.xml",data:q(l)}),n?(e.push({name:"xl/styles.xml",data:q(r.toXml())}),e.push({name:"xl/sharedStrings.xml",data:q(s.toXml())})):(e.push({name:"xl/styles.xml",data:q(t.stylesXml)}),e.push({name:"xl/sharedStrings.xml",data:q(t.sharedXml)}));for(let c=0;c<this.sheets.length;c++){let h=this.sheets[c],f=`xl/${h._isChartSheet?"chartsheets":h._isDialogSheet?"dialogsheets":"worksheets"}/sheet${c+1}.xml`;n?h._isChartSheet?e.push({name:f,data:q(h.toChartSheetXml())}):h._isDialogSheet?e.push({name:f,data:q(h.toDialogSheetXml(r,s))}):e.push({name:f,data:q(i.get(c)??"")}):e.push({name:f,data:q(t.sheets[c]?.originalXml??"")})}let m=new Set;for(let c=0;c<this.sheets.length;c++){let d=this.sheets[c].getTables(),f=t.sheets[c]?.tablePaths??[],p=t.sheets[c]?.tableXmls??[];for(let u=0;u<d.length;u++){let x=f[u];if(x)if(m.add(x),u<p.length){let $=p[u],y=$.match(/\bref="([^"]+)"/);y&&y[1]!==d[u].ref&&($=$.replace(`ref="${y[1]}"`,`ref="${d[u].ref}"`)),e.push({name:x,data:q($)})}else{let $=x.match(/table(\d+)\.xml$/),y=$?parseInt($[1],10):u+1;e.push({name:x,data:q(io(d[u],y))})}}}for(let[c,h]of t.unknownParts)m.has(c)||c==="xl/vbaProject.bin"&&this.vbaProject||t.allRels.has(c)||n&&c==="xl/calcChain.xml"||e.push({name:c,data:h});this.vbaProject&&(this._ensureVbaSheetModules(),e.push({name:"xl/vbaProject.bin",data:this.vbaProject.build()})),e.push({name:"_rels/.rels",data:q(this._buildRootRels(a!=null&&a.length>0))}),e.push({name:"xl/_rels/workbook.xml.rels",data:q(this._buildWorkbookRels(t,n))});for(let[c,h]of t.allRels)c==="xl/_rels/workbook.xml.rels"||c==="_rels/.rels"||e.push({name:c,data:q(this._relsToXml(h))});return e.push({name:"[Content_Types].xml",data:q(this._patchContentTypes(t.contentTypesXml,a!=null&&a.length>0,n))}),xo(e,{level:this.compressionLevel})}async _buildFresh(){let t=new ie,e=new le,n=[];for(let[v,F]of this._customTableStyles)t.registerTableStyle(v,F);let r=1;for(let v of this.sheets)v.rId=`rId${r++}`;let s=[],i=[],a=[],l=[],m=new Map,c=new Map,h=new Map,d=new Map,f=1,p=1,u=1,x=1,$=1,y=0,I=0;for(let v of this.sheets){let F=v.getImages(),B=v.getCharts(),X=v.getTables(),W=[],Z=[],J=[];(F.length||B.length||v.getShapes().length||v.getWordArt().length||v.getMathEquations().length||v.getTableSlicers().length)&&(v.drawingRId=`rId${r++}`);let mt=v.getFormControls();(v.getComments().length||mt.length)&&(v.legacyDrawingRId=`rId${r++}`);for(let et of F){let ut=`rId${r++}`;W.push(ut),s.push({ws:v,img:et,ext:wn(et.format),idx:f++})}for(let et=0;et<B.length;et++){let ut=`rId${r++}`;Z.push(ut),i.push({ws:v,chartIdx:et,globalIdx:p++})}for(let et=0;et<X.length;et++){let ut=`rId${r++}`;J.push(ut),a.push({ws:v,tableIdx:et,globalTableId:u++})}let K=[];for(let et=0;et<mt.length;et++)K.push(`rId${r++}`);v.ctrlPropRIds=K,m.set(v,W),c.set(v,Z),h.set(v,J),v.tableRIds=J;let nt=[];for(let et of v.getPivotTables()){let ut=`rId${r++}`,yt=`rId${r++}`;nt.push(ut),l.push({ws:v,pt:et,pivotIdx:$++,cacheId:y++,pivotRId:ut,cacheRId:yt})}d.set(v,nt)}let R=[],w=f,C=1;for(let v of this.sheets){v._cellImageVm=new Map;for(let F of v.getCellImages()){let B=wn(F.format);R.push({img:F,ext:B,idx:w++}),v._cellImageVm.set(F.cell,C++),v.getCellByRef(F.cell)}}let g=R.length>0,M=new Map,T=[],S=0,k=0;for(let v of this.sheets)v.getTableSlicers().length&&M.set(v,{tableSlicers:[],pivotSlicers:[],slicerDefRId:"",slicerDefIdx:0});for(let v of this.pivotSlicers)for(let F of this.sheets)if(F.getPivotTables().some(B=>B.name===v.pivotTableName)){M.has(F)||M.set(F,{tableSlicers:[],pivotSlicers:[],slicerDefRId:"",slicerDefIdx:0});break}for(let[v,F]of M){v.drawingRId||(v.drawingRId=`rId${r++}`),F.slicerDefRId=`rId${r++}`,F.slicerDefIdx=++S,v.slicerRId=F.slicerDefRId;let B=[];for(let X of v.getTableSlicers()){let W=v.getTables().find(K=>K.name===X.tableName),J=a.find(K=>K.ws===v&&v.getTables()[K.tableIdx]===W)?.globalTableId??1,mt=W?(W.columns?.findIndex(K=>K.name===X.columnName)??0)+1:1;F.tableSlicers.push({slicer:X,tableId:J,columnIndex:mt}),B.push({name:X.name,cell:X.cell}),T.push({name:X.name+"_cache",sourceName:X.columnName,type:"table",rId:`rId${r++}`,idx:++k,tableId:J,columnIndex:mt,sortOrder:X.sortOrder??"ascending"})}for(let X of this.pivotSlicers){let W=v.getPivotTables().find(nt=>nt.name===X.pivotTableName);if(!W)continue;let Z=l.find(nt=>nt.ws===v&&nt.pt===W),J=this.sheets.indexOf(v)+1,mt=[],K=this.sheets.find(nt=>nt.name===W.sourceSheet);if(K){let nt=K.readRange(W.sourceRef),ut=(nt[0]??[]).map(yt=>String(yt??"")).indexOf(X.fieldName);if(ut>=0){let yt=new Set;for(let Ft=1;Ft<nt.length;Ft++)yt.add(String(nt[Ft][ut]??""));mt=[...yt]}}F.pivotSlicers.push({slicer:X,pivotCacheId:Z?.cacheId??0}),B.push({name:X.name,cell:X.cell}),T.push({name:X.name+"_cache",sourceName:X.fieldName,type:"pivot",rId:`rId${r++}`,idx:++k,pivotTableName:X.pivotTableName,pivotCacheId:Z?.cacheId??0,tabId:J,items:mt})}v._slicerDrawingInfo=B}let L=M.size>0,P=this.customProperties.length>0,U=!!this.vbaProject,H=new Set;for(let{ext:v}of[...s,...R]){let F=fs(v);H.add(`<Default Extension="${v}" ContentType="${F}"/>`)}let G=this.sheets.filter(v=>v.getComments().length),_=this.sheets.filter(v=>v.getComments().length||v.getFormControls().length).length?'<Default Extension="vml" ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>':"",A=0,N=G.map(()=>`<Override PartName="/xl/comments${++A}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"/>`).join(""),j=0,O=[];for(let v of this.sheets)if(!v._isDialogSheet)for(let F=0;F<v.getFormControls().length;F++)O.push(`<Override PartName="/xl/ctrlProps/ctrlProp${++j}.xml" ContentType="application/vnd.ms-excel.controlproperties+xml"/>`);n.push({name:"[Content_Types].xml",data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
192
252
  <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
193
253
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
194
254
  <Default Extension="xml" ContentType="application/xml"/>
195
- ${b}
196
- ${[...x].join("")}
197
- <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>
255
+ ${_}
256
+ ${[...H].join("")}
257
+ <Override PartName="/xl/workbook.xml" ContentType="${U?"application/vnd.ms-excel.sheet.macroEnabled.main+xml":this.isTemplate?"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"}"/>
258
+ ${U?'<Override PartName="/xl/vbaProject.bin" ContentType="application/vnd.ms-office.vbaProject"/>':""}
198
259
  <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
199
260
  <Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
200
- ${this.sheets.map((f,w)=>`<Override PartName="/xl/worksheets/sheet${w+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}
201
- ${this.sheets.filter(f=>f.drawingRId).map((f,w)=>`<Override PartName="/xl/drawings/drawing${w+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawing+xml"/>`).join("")}
202
- ${n.map(({globalIdx:f})=>`<Override PartName="/xl/charts/chart${f}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`).join("")}
203
- ${l.map(({globalTableId:f})=>`<Override PartName="/xl/tables/table${f}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"/>`).join("")}
204
- ${I}
261
+ <Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
262
+ ${this.sheets.filter(v=>!v._isChartSheet&&!v._isDialogSheet).map(v=>`<Override PartName="/xl/worksheets/sheet${this.sheets.indexOf(v)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}
263
+ ${this.sheets.filter(v=>v._isChartSheet).map(v=>`<Override PartName="/xl/chartsheets/sheet${this.sheets.indexOf(v)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"/>`).join("")}
264
+ ${this.sheets.filter(v=>v._isDialogSheet).map(v=>`<Override PartName="/xl/dialogsheets/sheet${this.sheets.indexOf(v)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml"/>`).join("")}
265
+ ${this.sheets.filter(v=>v.drawingRId).map((v,F)=>`<Override PartName="/xl/drawings/drawing${F+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawing+xml"/>`).join("")}
266
+ ${i.map(({globalIdx:v})=>`<Override PartName="/xl/charts/chart${v}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`).join("")}
267
+ ${a.map(({globalTableId:v})=>`<Override PartName="/xl/tables/table${v}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"/>`).join("")}
268
+ ${l.map(v=>`<Override PartName="/xl/pivotTables/pivotTable${v.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"/>`).join(`
269
+ `)}
270
+ ${l.map(v=>`<Override PartName="/xl/pivotCache/pivotCacheDefinition${v.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"/>`).join(`
271
+ `)}
272
+ ${l.map(v=>`<Override PartName="/xl/pivotCache/pivotCacheRecords${v.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"/>`).join(`
273
+ `)}
274
+ ${N}
275
+ ${O.join("")}
205
276
  <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
206
277
  <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
207
- ${$?'<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>':""}
208
- </Types>`)}),r.push({name:"_rels/.rels",data:C(this._buildRootRels($))}),r.push({name:"xl/_rels/workbook.xml.rels",data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
278
+ ${P?'<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>':""}
279
+ ${this.connections.length?'<Override PartName="/xl/connections.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"/>':""}
280
+ ${this.externalLinks.map((v,F)=>`<Override PartName="/xl/externalLinks/externalLink${F+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"/>`).join(`
281
+ `)}
282
+ ${[...M.values()].map(v=>`<Override PartName="/xl/slicers/slicer${v.slicerDefIdx}.xml" ContentType="application/vnd.ms-excel.slicer+xml"/>`).join(`
283
+ `)}
284
+ ${T.map(v=>`<Override PartName="/xl/slicerCaches/slicerCache${v.idx}.xml" ContentType="application/vnd.ms-excel.slicerCache+xml"/>`).join(`
285
+ `)}
286
+ ${this.sheets.flatMap(v=>v.getQueryTables()).map((v,F)=>`<Override PartName="/xl/queryTables/queryTable${F+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml"/>`).join(`
287
+ `)}
288
+ ${g?`<Override PartName="/xl/metadata.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml"/>
289
+ <Override PartName="/xl/richData/rdrichvalue.xml" ContentType="application/vnd.ms-excel.rdrichvalue+xml"/>
290
+ <Override PartName="/xl/richData/rdRichValueStructure.xml" ContentType="application/vnd.ms-excel.rdrichvaluestructure+xml"/>
291
+ <Override PartName="/xl/richData/richValueRel.xml" ContentType="application/vnd.ms-excel.richvaluerel+xml"/>
292
+ <Override PartName="/xl/richData/rdRichValueTypes.xml" ContentType="application/vnd.ms-excel.rdrichvaluetypes+xml"/>
293
+ <Override PartName="/xl/richData/rdarray.xml" ContentType="application/vnd.ms-excel.rdarray+xml"/>`:""}
294
+ </Types>`)}),n.push({name:"_rels/.rels",data:q(this._buildRootRels(P))}),n.push({name:"xl/_rels/workbook.xml.rels",data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
209
295
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
210
- ${this.sheets.map((f,w)=>`<Relationship Id="${f.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${w+1}.xml"/>`).join("")}
296
+ ${this.sheets.map((v,F)=>{let B=v._isChartSheet?"chartsheet":v._isDialogSheet?"dialogsheet":"worksheet",X=v._isChartSheet?"chartsheets":v._isDialogSheet?"dialogsheets":"worksheets";return`<Relationship Id="${v.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/${B}" Target="${X}/sheet${F+1}.xml"/>`}).join("")}
211
297
  <Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
212
298
  <Relationship Id="rIdShared" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>
213
- </Relationships>`)});let X=this.properties.date1904?'<workbookPr date1904="1"/>':"<workbookPr/>",T=this.namedRanges.length?`<definedNames>${this.namedRanges.map(f=>`<definedName name="${g(f.name)}"${f.scope?` localSheetId="${this.sheets.findIndex(w=>w.name===f.scope)}"`:""}>${g(f.ref)}</definedName>`).join("")}</definedNames>`:"";r.push({name:"xl/workbook.xml",data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
299
+ <Relationship Id="rIdTheme" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
300
+ ${l.map(v=>`<Relationship Id="${v.cacheRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" Target="pivotCache/pivotCacheDefinition${v.pivotIdx}.xml"/>`).join(`
301
+ `)}
302
+ ${T.map(v=>`<Relationship Id="${v.rId}" Type="http://schemas.microsoft.com/office/2007/relationships/slicerCache" Target="slicerCaches/slicerCache${v.idx}.xml"/>`).join(`
303
+ `)}
304
+ ${U?'<Relationship Id="rIdVBA" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" Target="vbaProject.bin"/>':""}
305
+ ${this.connections.length?'<Relationship Id="rIdConns" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections" Target="connections.xml"/>':""}
306
+ ${this.externalLinks.map((v,F)=>`<Relationship Id="rIdExtLink${F+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink" Target="externalLinks/externalLink${F+1}.xml"/>`).join(`
307
+ `)}
308
+ ${g?'<Relationship Id="rIdMeta" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata" Target="metadata.xml"/>':""}
309
+ ${g?'<Relationship Id="rIdRichValueRel" Type="http://schemas.microsoft.com/office/2022/10/relationships/richValueRel" Target="richData/richValueRel.xml"/>':""}
310
+ ${g?'<Relationship Id="rIdRichValue" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValue" Target="richData/rdrichvalue.xml"/>':""}
311
+ ${g?'<Relationship Id="rIdRichValueStruct" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValueStructure" Target="richData/rdRichValueStructure.xml"/>':""}
312
+ ${g?'<Relationship Id="rIdRichValueTypes" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValueTypes" Target="richData/rdRichValueTypes.xml"/>':""}
313
+ ${g?'<Relationship Id="rIdRdArray" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdArray" Target="richData/rdarray.xml"/>':""}
314
+ </Relationships>`)}),U&&(this._ensureVbaSheetModules(),n.push({name:"xl/vbaProject.bin",data:this.vbaProject.build()}));let z=[this.properties.date1904?'date1904="1"':"",U?'codeName="ThisWorkbook"':""].filter(Boolean).join(" "),V=`<workbookPr${z?" "+z:""}/>`,st=this._definedNamesXml(T),ct=l.length?`<pivotCaches>${l.map(v=>`<pivotCache cacheId="${v.cacheId}" r:id="${v.cacheRId}"/>`).join("")}</pivotCaches>`:"";n.push({name:"xl/workbook.xml",data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
214
315
  <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
215
- ${X}
316
+ ${V}
216
317
  <bookViews><workbookView xWindow="0" yWindow="0" windowWidth="14400" windowHeight="8260"/></bookViews>
217
- <sheets>${this.sheets.map((f,w)=>`<sheet name="${g(f.name)}" sheetId="${w+1}" r:id="${f.rId}"${f.options?.state&&f.options.state!=="visible"?` state="${f.options.state}"`:""}/>`).join("")}</sheets>
218
- ${T}
318
+ <sheets>${this.sheets.map((v,F)=>`<sheet name="${b(v.name)}" sheetId="${F+1}" r:id="${v.rId}"${v.options?.state&&v.options.state!=="visible"?` state="${v.options.state}"`:""}/>`).join("")}</sheets>
319
+ ${st}
219
320
  <calcPr calcId="191028"/>
220
- </workbook>`)});for(let f=0;f<this.sheets.length;f++){let w=this.sheets[f],D=c.get(w)??[],R=a.get(w)??[],N=l.filter(k=>k.ws===w),Z=d.get(w)??[];r.push({name:`xl/worksheets/sheet${f+1}.xml`,data:C(w.toXml(t,e))});let j=[];if(w.drawingRId){let k=this.sheets.filter((M,L)=>L<=f&&M.drawingRId).length;j.push(`<Relationship Id="${w.drawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing" Target="../drawings/drawing${k}.xml"/>`)}for(let k=0;k<w.getImages().length;k++){let M=i.filter(L=>L.ws===w)[k];M&&j.push(`<Relationship Id="${D[k]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${M.idx}.${M.ext}"/>`)}for(let k=0;k<N.length;k++)j.push(`<Relationship Id="${Z[k]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/table" Target="../tables/table${N[k].globalTableId}.xml"/>`);let A=w.getComments();if(A.length&&w.legacyDrawingRId){let k=u++,M=`rId${o++}`;j.push(`<Relationship Id="${w.legacyDrawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing" Target="../drawings/vmlDrawing${k}.vml"/>`),j.push(`<Relationship Id="${M}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="../comments${k}.xml"/>`),r.push({name:`xl/comments${k}.xml`,data:C(this._buildCommentsXml(A))}),r.push({name:`xl/drawings/vmlDrawing${k}.vml`,data:C(this._buildVmlXml(A,f))})}if(j.length&&r.push({name:`xl/worksheets/_rels/sheet${f+1}.xml.rels`,data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
321
+ ${ct}
322
+ ${L?(()=>{let v=T.filter(X=>X.type==="table"),F=T.filter(X=>X.type==="pivot"),B="<extLst>";return F.length&&(B+=`<ext uri="{BBE1A952-AA13-448e-AADC-164F8A28A991}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerCaches>${F.map(X=>`<x14:slicerCache r:id="${X.rId}"/>`).join("")}</x14:slicerCaches></ext>`),v.length&&(B+=`<ext uri="{46BE6895-7355-4a93-B00E-2C351335B9C9}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x15:slicerCaches>${v.map(X=>`<x14:slicerCache r:id="${X.rId}"/>`).join("")}</x15:slicerCaches></ext>`),B+="</extLst>",B})():""}
323
+ </workbook>`)}),this.connections.length&&n.push({name:"xl/connections.xml",data:q(this._connectionsXml())});for(let v=0;v<this.sheets.length;v++){let F=this.sheets[v],B=m.get(F)??[],X=c.get(F)??[],W=a.filter(ot=>ot.ws===F),Z=h.get(F)??[],J=F._isChartSheet?"chartsheets":F._isDialogSheet?"dialogsheets":"worksheets",mt=`xl/${J}/sheet${v+1}.xml`;F._isChartSheet?n.push({name:mt,data:q(F.toChartSheetXml())}):F._isDialogSheet?n.push({name:mt,data:q(F.toDialogSheetXml(t,e))}):n.push({name:mt,data:q(F.toXml(t,e))});let K=[];if(F.drawingRId){let ot=this.sheets.filter((St,gt)=>gt<=v&&St.drawingRId).length;K.push(`<Relationship Id="${F.drawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing" Target="../drawings/drawing${ot}.xml"/>`)}for(let ot=0;ot<F.getImages().length;ot++){let St=s.filter(gt=>gt.ws===F)[ot];St&&K.push(`<Relationship Id="${B[ot]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${St.idx}.${St.ext}"/>`)}for(let ot=0;ot<W.length;ot++)K.push(`<Relationship Id="${Z[ot]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/table" Target="../tables/table${W[ot].globalTableId}.xml"/>`);let nt=d.get(F)??[],et=l.filter(ot=>ot.ws===F);for(let ot=0;ot<et.length;ot++)K.push(`<Relationship Id="${nt[ot]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" Target="../pivotTables/pivotTable${et[ot].pivotIdx}.xml"/>`);let ut=M.get(F);ut&&K.push(`<Relationship Id="${ut.slicerDefRId}" Type="http://schemas.microsoft.com/office/2007/relationships/slicer" Target="../slicers/slicer${ut.slicerDefIdx}.xml"/>`);let yt=F.getComments(),Ft=F.getFormControls();if((yt.length||Ft.length)&&F.legacyDrawingRId){let ot=x++;if(K.push(`<Relationship Id="${F.legacyDrawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing" Target="../drawings/vmlDrawing${ot}.vml"/>`),yt.length){let At=`rId${r++}`;K.push(`<Relationship Id="${At}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="../comments${ot}.xml"/>`),n.push({name:`xl/comments${ot}.xml`,data:q(this._buildCommentsXml(yt))})}let St=yt.map(({row:At,col:kt},Nt)=>{let _e=(kt+1)*64,Pt=(At-1)*20;return`<v:shape id="_x0000_s${1025+v*1e3+Nt}" type="#_x0000_t202" style="position:absolute;margin-left:${_e}pt;margin-top:${Pt}pt;width:108pt;height:59.25pt;z-index:${Nt+1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto">
324
+ <v:fill color2="#ffffe1"/>
325
+ <v:shadow color="black" obscured="t"/>
326
+ <v:path o:connecttype="none"/>
327
+ <v:textbox style="mso-direction-alt:auto"><div style="text-align:left"/></v:textbox>
328
+ <x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${kt+1},15,${At-1},10,${kt+3},15,${At+4},4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${At-1}</x:Row><x:Column>${kt-1}</x:Column></x:ClientData>
329
+ </v:shape>`}),gt=1025+F.sheetIndex*1e3+yt.length,it=Ft.map((At,kt)=>zo(At,gt+kt));if(n.push({name:`xl/drawings/vmlDrawing${ot}.vml`,data:q(Wo(St,it))}),!F._isDialogSheet){let At=F.ctrlPropRIds;for(let kt=0;kt<Ft.length;kt++){let Nt=++I;K.push(`<Relationship Id="${At[kt]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp" Target="../ctrlProps/ctrlProp${Nt}.xml"/>`),n.push({name:`xl/ctrlProps/ctrlProp${Nt}.xml`,data:q(Vo(Ft[kt]))})}}}if(K.length&&n.push({name:`xl/${J}/_rels/sheet${v+1}.xml.rels`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
221
330
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
222
- ${j.join(`
331
+ ${K.join(`
223
332
  `)}
224
- </Relationships>`)}),w.drawingRId){let k=this.sheets.filter((L,z)=>z<=f&&L.drawingRId).length;r.push({name:`xl/drawings/drawing${k}.xml`,data:C(w.toDrawingXml(D,R))});let M=[];for(let L=0;L<w.getImages().length;L++){let z=i.filter(st=>st.ws===w)[L];z&&M.push(`<Relationship Id="${D[L]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${z.idx}.${z.ext}"/>`)}for(let L=0;L<w.getCharts().length;L++){let z=n.filter(st=>st.ws===w)[L];z&&M.push(`<Relationship Id="${R[L]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="../charts/chart${z.globalIdx}.xml"/>`)}M.length&&r.push({name:`xl/drawings/_rels/drawing${k}.xml.rels`,data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
333
+ </Relationships>`)}),F.drawingRId){let ot=this.sheets.filter((gt,it)=>it<=v&&gt.drawingRId).length;n.push({name:`xl/drawings/drawing${ot}.xml`,data:q(F.toDrawingXml(B,X))});let St=[];for(let gt=0;gt<F.getImages().length;gt++){let it=s.filter(At=>At.ws===F)[gt];it&&St.push(`<Relationship Id="${B[gt]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${it.idx}.${it.ext}"/>`)}for(let gt=0;gt<F.getCharts().length;gt++){let it=i.filter(At=>At.ws===F)[gt];it&&St.push(`<Relationship Id="${X[gt]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="../charts/chart${it.globalIdx}.xml"/>`)}St.length&&n.push({name:`xl/drawings/_rels/drawing${ot}.xml.rels`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
225
334
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
226
- ${M.join(`
335
+ ${St.join(`
227
336
  `)}
228
- </Relationships>`)})}}for(let{img:f,ext:w,idx:D}of i)r.push({name:`xl/media/image${D}.${w}`,data:typeof f.data=="string"?ct(f.data):f.data});for(let{ws:f,chartIdx:w,globalIdx:D}of n)r.push({name:`xl/charts/chart${D}.xml`,data:C(Mt(f.getCharts()[w]))});for(let{ws:f,tableIdx:w,globalTableId:D}of l)r.push({name:`xl/tables/table${D}.xml`,data:C(wt(f.getTables()[w],D))});r.push({name:"xl/styles.xml",data:C(t.toXml())}),r.push({name:"xl/sharedStrings.xml",data:C(e.toXml())});let v={...this.coreProperties,created:this.coreProperties.created??new Date,modified:new Date};return!v.creator&&this.properties.author&&(v.creator=this.properties.author),r.push({name:"docProps/core.xml",data:C(Rt(v))}),r.push({name:"docProps/app.xml",data:C(St({...this.extendedProperties,application:this.extendedProperties.application??"ExcelForge",company:this.extendedProperties.company??this.properties.company,titlesOfParts:this.sheets.map(f=>f.name),headingPairs:[{name:"Worksheets",count:this.sheets.length}]}))}),$&&r.push({name:"docProps/custom.xml",data:C(Pt(this.customProperties))}),kt(r,{level:this.compressionLevel})}_syncLegacyProperties(){let t=this.properties;t.title&&(this.coreProperties.title??=t.title),t.author&&(this.coreProperties.creator??=t.author),t.subject&&(this.coreProperties.subject??=t.subject),t.description&&(this.coreProperties.description??=t.description),t.keywords&&(this.coreProperties.keywords??=t.keywords),t.company&&(this.extendedProperties.company??=t.company),t.lastModifiedBy&&(this.coreProperties.lastModifiedBy??=t.lastModifiedBy),t.created&&(this.coreProperties.created??=t.created),t.category&&(this.coreProperties.category??=t.category),t.status&&(this.coreProperties.contentStatus??=t.status)}_patchWorkbookXml(t){let e=t;for(let r=0;r<this.sheets.length;r++)e=e.replace(new RegExp(`(<sheet[^>]+sheetId="${r+1}"[^>]+)name="[^"]*"`),`$1name="${g(this.sheets[r].name)}"`);return e}_buildWorkbookRels(t){let e=[...t.workbookRels.entries()].map(([r,o])=>`<Relationship Id="${r}" Type="${o.type}" Target="${o.target}"/>`);return[...t.workbookRels.values()].some(r=>r.type.includes("/styles"))||e.push('<Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>'),[...t.workbookRels.values()].some(r=>r.type.includes("/sharedStrings"))||e.push('<Relationship Id="rIdShared" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
337
+ </Relationships>`)})}}for(let{img:v,ext:F,idx:B}of s)n.push({name:`xl/media/image${B}.${F}`,data:typeof v.data=="string"?be(v.data):v.data});if(g){let v=[],F=[];for(let B=0;B<R.length;B++){let{img:X,ext:W,idx:Z}=R[B],J=`rId${B+1}`;v.push(J),F.push(`<Relationship Id="${J}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="/xl/media/image${Z}.${W}"/>`),n.push({name:`xl/media/image${Z}.${W}`,data:typeof X.data=="string"?be(X.data):X.data})}n.push({name:"xl/metadata.xml",data:q(ps(R.length))}),n.push({name:"xl/richData/rdrichvalue.xml",data:q(us(R.length))}),n.push({name:"xl/richData/richValueRel.xml",data:q(gs(v))}),n.push({name:"xl/richData/rdRichValueStructure.xml",data:q(xs())}),n.push({name:"xl/richData/rdRichValueTypes.xml",data:q($s())}),n.push({name:"xl/richData/rdarray.xml",data:q('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><arrayData xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2" count="0"></arrayData>')}),n.push({name:"xl/richData/_rels/richValueRel.xml.rels",data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
229
338
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
230
- ${e.join(`
339
+ ${F.join(`
340
+ `)}
341
+ </Relationships>`)})}for(let{ws:v,chartIdx:F,globalIdx:B}of i)n.push({name:`xl/charts/chart${B}.xml`,data:q(No(v.getCharts()[F]))});for(let{ws:v,tableIdx:F,globalTableId:B}of a)n.push({name:`xl/tables/table${B}.xml`,data:q(io(v.getTables()[F],B))});for(let{ws:v,pt:F,pivotIdx:B,cacheId:X}of l){let W=this.sheets.find(et=>et.name===F.sourceSheet),Z=W?W.readRange(F.sourceRef):[[]],{pivotTableXml:J,cacheDefXml:mt,cacheRecordsXml:K}=jo(F,Z,B,X),nt=(et,ut)=>`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
342
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
343
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/${et}" Target="${ut}"/>
344
+ </Relationships>`;n.push({name:`xl/pivotTables/pivotTable${B}.xml`,data:q(J)}),n.push({name:`xl/pivotTables/_rels/pivotTable${B}.xml.rels`,data:q(nt("pivotCacheDefinition",`../pivotCache/pivotCacheDefinition${B}.xml`))}),n.push({name:`xl/pivotCache/pivotCacheDefinition${B}.xml`,data:q(mt)}),n.push({name:`xl/pivotCache/_rels/pivotCacheDefinition${B}.xml.rels`,data:q(nt("pivotCacheRecords",`pivotCacheRecords${B}.xml`))}),n.push({name:`xl/pivotCache/pivotCacheRecords${B}.xml`,data:q(K)})}n.push({name:"xl/styles.xml",data:q(t.toXml())}),n.push({name:"xl/sharedStrings.xml",data:q(e.toXml())}),n.push({name:"xl/theme/theme1.xml",data:q(this._buildThemeXml())});for(let v=0;v<this.externalLinks.length;v++){let F=this.externalLinks[v],B=v+1,X=F.sheets.map(W=>{let Z=W.definedNames?.map(J=>`<definedName name="${b(J.name)}" refersTo="${b(J.ref)}"/>`).join("")??"";return`<sheetName val="${b(W.name)}"/>${Z?`<sheetDataSet>${Z}</sheetDataSet>`:""}`}).join("");n.push({name:`xl/externalLinks/externalLink${B}.xml`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
345
+ <externalLink xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
346
+ <externalBook r:id="rId1"><sheetNames>${X}</sheetNames></externalBook>
347
+ </externalLink>`)}),n.push({name:`xl/externalLinks/_rels/externalLink${B}.xml.rels`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
348
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
349
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="${b(F.target)}" TargetMode="External"/>
350
+ </Relationships>`)})}for(let[v,F]of M){let B=[];for(let X of F.tableSlicers){let W=X.slicer;B.push(`<slicer name="${b(W.name)}" cache="${b(W.name+"_cache")}" caption="${b(W.caption??W.columnName)}" rowHeight="241300" columnCount="${W.columnCount??1}" style="${W.style??"SlicerStyleLight1"}"/>`)}for(let X of F.pivotSlicers){let W=X.slicer;B.push(`<slicer name="${b(W.name)}" cache="${b(W.name+"_cache")}" caption="${b(W.caption??W.fieldName)}" rowHeight="241300" columnCount="${W.columnCount??1}" style="${W.style??"SlicerStyleLight1"}"/>`)}n.push({name:`xl/slicers/slicer${F.slicerDefIdx}.xml`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
351
+ <slicers xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" mc:Ignorable="x">
352
+ ${B.join(`
353
+ `)}
354
+ </slicers>`)})}for(let v of T){let F;if(v.type==="table")F=`<extLst><x:ext uri="{2F2917AC-EB37-4324-AD4E-5DD8C200BD13}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:tableSlicerCache tableId="${v.tableId}" column="${v.columnIndex}" sortOrder="${v.sortOrder??"ascending"}"/></x:ext></extLst>`;else{let B=(v.items??[]).map((X,W)=>`<i x="${W}" s="1"/>`).join("");F=`<pivotTables><pivotTable tabId="${v.tabId}" name="${b(v.pivotTableName??"")}"/></pivotTables>`+(v.items?.length?`<data><tabular pivotCacheId="${v.pivotCacheId}" showMissing="0"><items count="${v.items.length}">${B}</items></tabular></data>`:"")}n.push({name:`xl/slicerCaches/slicerCache${v.idx}.xml`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
355
+ <slicerCacheDefinition xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x" name="${b(v.name)}" sourceName="${b(v.sourceName)}">
356
+ ${F}
357
+ </slicerCacheDefinition>`)})}let at=this.sheets.flatMap(v=>v.getQueryTables());for(let v=0;v<at.length;v++){let F=at[v];n.push({name:`xl/queryTables/queryTable${v+1}.xml`,data:q(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
358
+ <queryTable xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" name="${b(F.name)}" connectionId="${F.connectionId}" autoFormatId="16" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="0">
359
+ <queryTableRefresh nextId="${(F.columns?.length??0)+1}">
360
+ <queryTableFields count="${F.columns?.length??0}">
361
+ ${(F.columns??[]).map((B,X)=>`<queryTableField id="${X+1}" name="${b(B)}" tableColumnId="${X+1}"/>`).join(`
362
+ `)}
363
+ </queryTableFields>
364
+ </queryTableRefresh>
365
+ </queryTable>`)})}let pt={...this.coreProperties,created:this.coreProperties.created??new Date,modified:new Date};return!pt.creator&&this.properties.author&&(pt.creator=this.properties.author),n.push({name:"docProps/core.xml",data:q(yo(pt))}),n.push({name:"docProps/app.xml",data:q(wo({...this.extendedProperties,application:this.extendedProperties.application??"ExcelForge",company:this.extendedProperties.company??this.properties.company,titlesOfParts:this.sheets.map(v=>v.name),headingPairs:this._headingPairs()}))}),P&&n.push({name:"docProps/custom.xml",data:q(bo(this.customProperties))}),xo(n,{level:this.compressionLevel})}_headingPairs(){let t=this.sheets.filter(s=>!s._isChartSheet&&!s._isDialogSheet).length,e=this.sheets.filter(s=>s._isChartSheet).length,n=this.sheets.filter(s=>s._isDialogSheet).length,r=[];return t&&r.push({name:"Worksheets",count:t}),e&&r.push({name:"Charts",count:e}),n&&r.push({name:"Dialogs",count:n}),r.length||r.push({name:"Worksheets",count:0}),r}_syncLegacyProperties(){let t=this.properties;t.title&&(this.coreProperties.title??=t.title),t.author&&(this.coreProperties.creator??=t.author),t.subject&&(this.coreProperties.subject??=t.subject),t.description&&(this.coreProperties.description??=t.description),t.keywords&&(this.coreProperties.keywords??=t.keywords),t.company&&(this.extendedProperties.company??=t.company),t.lastModifiedBy&&(this.coreProperties.lastModifiedBy??=t.lastModifiedBy),t.created&&(this.coreProperties.created??=t.created),t.category&&(this.coreProperties.category??=t.category),t.status&&(this.coreProperties.contentStatus??=t.status)}_ensureVbaSheetModules(){if(!(!this.vbaProject||this.vbaProject.modules.filter(e=>e.type==="document"&&e.name!=="ThisWorkbook").length>=this.sheets.length))for(let e of this.sheets){let n=e.name.replace(/[^A-Za-z0-9_]/g,"_");this.vbaProject.getModule(n)||this.vbaProject.addModule({name:n,type:"document",code:""})}}_patchWorkbookXml(t){let e=t;for(let r=0;r<this.sheets.length;r++)e=e.replace(new RegExp(`(<sheet[^>]+sheetId="${r+1}"[^>]+)name="[^"]*"`),`$1name="${b(this.sheets[r].name)}"`);this.vbaProject&&!e.includes("codeName=")&&(e=e.replace("<workbookPr",'<workbookPr codeName="ThisWorkbook"'),e.includes("<workbookPr")||(e=e.replace("<bookViews",'<workbookPr codeName="ThisWorkbook"/><bookViews')));let n=this._definedNamesXml();return e.includes("<definedNames")?e=e.replace(/<definedNames[\s\S]*?<\/definedNames>/,n):n&&(e=e.replace("</sheets>",`</sheets>${n}`)),e}_definedNamesXml(t){let e=[];for(let s of this.sheets)if(s.printArea){let i=s.printArea.includes("!")?s.printArea:`'${s.name}'!${s.printArea}`;e.push({name:"_xlnm.Print_Area",ref:i,scope:s.name})}let n=(t??[]).map(s=>({name:s.name,ref:"#N/A"})),r=[...this.namedRanges,...e,...n];return r.length?`<definedNames>${r.map(s=>{let i=`name="${b(s.name)}"`;if(s.scope){let a=this.sheets.findIndex(l=>l.name===s.scope);a>=0&&(i+=` localSheetId="${a}"`)}return s.comment&&(i+=` comment="${b(s.comment)}"`),`<definedName ${i}>${b(s.ref)}</definedName>`}).join("")}</definedNames>`:""}_connectionsXml(t){return this.connections.length?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
366
+ <connections xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">${this.connections.map(e=>{if(e._rawXml)return e._rawXml;let n=` id="${e.id}" name="${b(e.name)}" type="${xn(e.type)}" refreshedVersion="6"`;e.description&&(n+=` description="${b(e.description)}"`),e.refreshOnLoad&&(n+=' refreshOnLoad="1"'),e.background&&(n+=' background="1"'),e.saveData&&(n+=' saveData="1"'),e.keepAlive&&(n+=' keepAlive="1"'),e.interval&&(n+=` interval="${e.interval}"`);let r=e.connectionString||e.command?`<dbPr${e.connectionString?` connection="${b(e.connectionString)}"`:""}${e.command?` command="${b(e.command)}"`:""}${e.commandType?` commandType="${yn(e.commandType)}"`:""}/>`:"";return`<connection${n}>${r}</connection>`}).join("")}</connections>`:""}_buildWorkbookRels(t,e=!1){let n=[...t.workbookRels.entries()].filter(([r,s])=>!(e&&s.type.includes("/calcChain"))).map(([r,s])=>`<Relationship Id="${r}" Type="${s.type}" Target="${s.target}"/>`);return[...t.workbookRels.values()].some(r=>r.type.includes("/styles"))||n.push('<Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>'),[...t.workbookRels.values()].some(r=>r.type.includes("/sharedStrings"))||n.push('<Relationship Id="rIdShared" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>'),this.vbaProject&&![...t.workbookRels.values()].some(r=>r.type.includes("vbaProject"))&&n.push('<Relationship Id="rIdVBA" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" Target="vbaProject.bin"/>'),this.connections.length&&![...t.workbookRels.values()].some(r=>r.type.includes("/connections"))&&n.push('<Relationship Id="rIdConns" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections" Target="connections.xml"/>'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
367
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
368
+ ${n.join(`
231
369
  `)}
232
370
  </Relationships>`}_relsToXml(t){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
233
371
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
234
- ${[...t.entries()].map(([e,r])=>`<Relationship Id="${e}" Type="${r.type}" Target="${r.target}"/>`).join(`
372
+ ${[...t.entries()].map(([e,n])=>`<Relationship Id="${b(e)}" Type="${b(n.type)}" Target="${b(n.target)}"${n.targetMode?` TargetMode="${b(n.targetMode)}"`:""}/>`).join(`
235
373
  `)}
236
- </Relationships>`}_buildRootRels(t){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
374
+ </Relationships>`}_buildThemeXml(){let t=this.theme,e=t?.majorFont??"Calibri Light",n=t?.minorFont??"Calibri",r=[{name:"dk1",color:"000000"},{name:"lt1",color:"FFFFFF"},{name:"dk2",color:"44546A"},{name:"lt2",color:"E7E6E6"},{name:"accent1",color:"4472C4"},{name:"accent2",color:"ED7D31"},{name:"accent3",color:"A5A5A5"},{name:"accent4",color:"FFC000"},{name:"accent5",color:"5B9BD5"},{name:"accent6",color:"70AD47"},{name:"hlink",color:"0563C1"},{name:"folHlink",color:"954F72"}],i=(t?.colors?.map(a=>{let l=a.color.replace(/^#/,"");return l.length===8&&(l=l.substring(2)),{name:a.name,color:l}})??r).map(a=>a.name==="dk1"||a.name==="lt1"?`<a:${a.name}><a:sysClr val="${a.name==="dk1"?"windowText":"window"}" lastClr="${a.color}"/></a:${a.name}>`:`<a:${a.name}><a:srgbClr val="${a.color}"/></a:${a.name}>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
375
+ <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${b(t?.name??"Office Theme")}">
376
+ <a:themeElements>
377
+ <a:clrScheme name="Office">${i}</a:clrScheme>
378
+ <a:fontScheme name="Office">
379
+ <a:majorFont><a:latin typeface="${b(e)}"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont>
380
+ <a:minorFont><a:latin typeface="${b(n)}"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont>
381
+ </a:fontScheme>
382
+ <a:fmtScheme name="Office">
383
+ <a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst>
384
+ <a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst>
385
+ <a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst>
386
+ <a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst>
387
+ </a:fmtScheme>
388
+ </a:themeElements>
389
+ <a:objectDefaults/>
390
+ <a:extraClrSchemeLst/>
391
+ </a:theme>`}_buildRootRels(t){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
237
392
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
238
393
  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
239
394
  <Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
240
395
  <Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
241
396
  ${t?'<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" Target="docProps/custom.xml"/>':""}
242
- </Relationships>`}_patchContentTypes(t,e){let r=t;return r.includes("sharedStrings")||(r=r.replace("</Types>",`<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
397
+ </Relationships>`}_patchContentTypes(t,e,n=!1){let r=t;return n&&(r=r.replace(/<Override[^>]*calcChain[^>]*\/>/g,"")),r.includes("sharedStrings")||(r=r.replace("</Types>",`<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
243
398
  </Types>`)),e&&!r.includes("custom-properties")&&(r=r.replace("</Types>",`<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>
244
- </Types>`)),r}async buildBase64(){let t=await this.build(),e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}async writeFile(t){let e=await this.build();await(await import("fs/promises")).writeFile(t,e)}_buildCommentsXml(t){let e=[...new Set(t.map(i=>i.comment.author??""))],r=e.map(i=>`<author>${g(i)}</author>`).join(""),o=t.map(({row:i,col:n,comment:l})=>{let c=`${W(n)}${i}`,a=e.indexOf(l.author??"");return`<comment ref="${c}" authorId="${a}"><text><r><t>${g(l.text)}</t></r></text></comment>`}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
399
+ </Types>`)),this.vbaProject&&(r.includes("vbaProject.bin")||(r=r.replace("</Types>",`<Override PartName="/xl/vbaProject.bin" ContentType="application/vnd.ms-office.vbaProject"/>
400
+ </Types>`)),r=r.replace("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml","application/vnd.ms-excel.sheet.macroEnabled.main+xml")),this.isTemplate&&!this.vbaProject&&(r=r.replace("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml")),this.connections.length&&!r.includes("connections.xml")&&(r=r.replace("</Types>",`<Override PartName="/xl/connections.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"/>
401
+ </Types>`)),r}async buildBase64(){let t=await this.build(),e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}async writeFile(t){let e=await this.build();await(await import("fs/promises")).writeFile(t,e)}_buildCommentsXml(t){let e=[...new Set(t.map(s=>s.comment.author??""))],n=e.map(s=>`<author>${b(s)}</author>`).join(""),r=t.map(({row:s,col:i,comment:a})=>{let l=`${Dt(i)}${s}`,m=e.indexOf(a.author??""),c;return a.richText&&a.richText.length>0?c=a.richText.map(h=>{let d="";if(h.font){let p=h.font;p.bold&&(d+="<b/>"),p.italic&&(d+="<i/>"),p.underline&&p.underline!=="none"&&(d+=`<u val="${p.underline==="single"?"single":p.underline}"/>`),p.strike&&(d+="<strike/>"),p.size&&(d+=`<sz val="${p.size}"/>`),p.color&&(d+=`<color rgb="${p.color}"/>`),p.name&&(d+=`<rFont val="${b(p.name)}"/>`),p.family!=null&&(d+=`<family val="${p.family}"/>`)}return`<r>${d?`<rPr>${d}</rPr>`:""}<t xml:space="preserve">${b(h.text)}</t></r>`}).join(""):c=`<r><t>${b(a.text)}</t></r>`,`<comment ref="${l}" authorId="${m}"><text>${c}</text></comment>`}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
245
402
  <comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
246
- <authors>${r}</authors>
247
- <commentList>${o}</commentList>
403
+ <authors>${n}</authors>
404
+ <commentList>${r}</commentList>
248
405
  </comments>`}_buildVmlXml(t,e){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">
249
406
  <o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout>
250
407
  <v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>
251
- ${t.map(({row:o,col:i},n)=>{let l=(i+1)*64,c=(o-1)*20;return`<v:shape id="_x0000_s${1025+e*1e3+n}" type="#_x0000_t202" style="position:absolute;margin-left:${l}pt;margin-top:${c}pt;width:108pt;height:59.25pt;z-index:${n+1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto">
408
+ ${t.map(({row:r,col:s},i)=>{let a=(s+1)*64,l=(r-1)*20;return`<v:shape id="_x0000_s${1025+e*1e3+i}" type="#_x0000_t202" style="position:absolute;margin-left:${a}pt;margin-top:${l}pt;width:108pt;height:59.25pt;z-index:${i+1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto">
252
409
  <v:fill color2="#ffffe1"/>
253
410
  <v:shadow color="black" obscured="t"/>
254
411
  <v:path o:connecttype="none"/>
255
412
  <v:textbox style="mso-direction-alt:auto"><div style="text-align:left"/></v:textbox>
256
- <x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${i+1},15,${o-1},10,${i+3},15,${o+4},4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${o-1}</x:Row><x:Column>${i-1}</x:Column></x:ClientData>
413
+ <x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${s+1},15,${r-1},10,${s+3},15,${r+4},4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${r-1}</x:Row><x:Column>${s-1}</x:Column></x:ClientData>
257
414
  </v:shape>`}).join(`
258
415
  `)}
259
- </xml>`}async download(t="workbook.xlsx"){let e=await this.build(),r=new Blob([e.buffer],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=t,i.click(),URL.revokeObjectURL(o)}};var pt=class{constructor(){this.s={}}font(t){return this.s.font={...this.s.font??{},...t},this}fontSize(t){return this.font({size:t})}fontName(t){return this.font({name:t})}bold(t=!0){return this.font({bold:t})}italic(t=!0){return this.font({italic:t})}strike(t=!0){return this.font({strike:t})}underline(t="single"){return this.font({underline:t})}fontColor(t){return this.font({color:t})}fill(t,e,r){return this.s.fill={type:"pattern",pattern:t,fgColor:e,bgColor:r},this}bg(t){return this.fill("solid",t)}border(t,e){let r={style:t,color:e};return this.s.border={left:r,right:r,top:r,bottom:r},this}borderLeft(t,e){return this.s.border={...this.s.border??{},left:{style:t,color:e}},this}borderRight(t,e){return this.s.border={...this.s.border??{},right:{style:t,color:e}},this}borderTop(t,e){return this.s.border={...this.s.border??{},top:{style:t,color:e}},this}borderBottom(t,e){return this.s.border={...this.s.border??{},bottom:{style:t,color:e}},this}align(t,e){return this.s.alignment={...this.s.alignment??{},horizontal:t,vertical:e},this}center(){return this.align("center","center")}wrap(t=!0){return this.s.alignment={...this.s.alignment??{},wrapText:t},this}rotate(t){return this.s.alignment={...this.s.alignment??{},textRotation:t},this}indent(t){return this.s.alignment={...this.s.alignment??{},indent:t},this}shrink(t=!0){return this.s.alignment={...this.s.alignment??{},shrinkToFit:t},this}numFmt(t){return this.s.numberFormat={formatCode:t},this}numFmtId(t){return this.s.numFmtId=t,this}locked(t=!0){return this.s.locked=t,this}hidden(t=!0){return this.s.hidden=t,this}build(){return{...this.s}}};function B(){return new pt}var Ke={headerBlue:B().bold().bg("FF4472C4").fontColor("FFFFFFFF").center().build(),headerGray:B().bold().bg("FF595959").fontColor("FFFFFFFF").center().build(),headerGreen:B().bold().bg("FF70AD47").fontColor("FFFFFFFF").center().build(),currency:B().numFmt('"$"#,##0.00').build(),percent:B().numFmt("0.00%").build(),integer:B().numFmt("#,##0").build(),date:B().numFmtId(14).build(),dateTime:B().numFmtId(22).build(),bold:B().bold().build(),centered:B().center().build(),wrapped:B().wrap().build(),bordered:B().border("thin").build(),borderedBlack:B().border("thin","FF000000").build(),highlight:B().bg("FFFFFF00").build(),lightBlue:B().bg("FFDCE6F1").build(),redText:B().fontColor("FFFF0000").build(),blueText:B().fontColor("FF0000FF").build(),greenText:B().fontColor("FF00B050").build(),tableHeader:B().bold().border("thin").center().bg("FFD9E1F2").build(),deleted:B().strike().fontColor("FF808080").build()},Qe={General:"General",Integer:"#,##0",Decimal2:"#,##0.00",Currency:'"$"#,##0.00',CurrencyNeg:'"$"#,##0.00;[Red]("$"#,##0.00)',Percent:"0%",Percent2:"0.00%",Scientific:"0.00E+00",Fraction:"# ?/?",ShortDate:"mm/dd/yyyy",LongDate:"mmmm d, yyyy",Time:"h:mm AM/PM",DateTime:"mm/dd/yyyy h:mm",Text:"@",Accounting:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',FinancialPos:"#,##0;(#,##0)",ZeroDash:'#,##0;(#,##0);"-"',Multiple:'0.0"x"'},Ye={White:"FFFFFFFF",Black:"FF000000",Red:"FFFF0000",Green:"FF00B050",Blue:"FF0070C0",Yellow:"FFFFFF00",Orange:"FFFFA500",Gray:"FF808080",LightGray:"FFD3D3D3",DarkBlue:"FF003366",ExcelBlue:"FF4472C4",ExcelOrange:"FFED7D31",ExcelGreen:"FF70AD47",ExcelRed:"FFFF0000",ExcelPurple:"FF7030A0",Transparent:"00FFFFFF"};export{Ye as Colors,Qe as NumFmt,tt as SharedStrings,pt as StyleBuilder,Y as StyleRegistry,Ke as Styles,Dt as Workbook,J as Worksheet,ct as base64ToBytes,oe as bytesToBase64,H as cellRefToIndices,W as colIndexToLetter,Nt as colLetterToIndex,gt as dateToSerial,rt as indicesToCellRef,ot as parseRange,xt as pxToEmu,B as style};
416
+ </xml>`}async download(t="workbook.xlsx"){let e=await this.build(),n=new Blob([e.buffer],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}};function fs(o){switch(o){case"jpg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tiff":return"image/tiff";case"emf":return"image/x-emf";case"wmf":return"image/x-wmf";case"svg":return"image/svg+xml";case"ico":return"image/x-icon";case"webp":return"image/webp";default:return`image/${o}`}}function wn(o){return o==="jpeg"?"jpg":o}function ps(o){let t=Array.from({length:o},(n,r)=>`<bk><extLst><ext uri="{3e2802c4-a4d2-4d8b-9148-e3be6c30e623}"><xlrd:rvb i="${r}"/></ext></extLst></bk>`).join(""),e=Array.from({length:o},(n,r)=>`<bk><rc t="1" v="${r}"/></bk>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata"><metadataTypes count="1"><metadataType name="XLRICHVALUE" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1"/></metadataTypes><futureMetadata name="XLRICHVALUE" count="${o}">${t}</futureMetadata><valueMetadata count="${o}">${e}</valueMetadata></metadata>`}function us(o){let t=Array.from({length:o},(e,n)=>`<rv s="0"><v>${n}</v><v>5</v><v></v></rv>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvData xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" count="${o}">${t}</rvData>`}function gs(o){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><richValueRels xmlns="http://schemas.microsoft.com/office/spreadsheetml/2022/richvaluerel" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+o.map(t=>`<rel r:id="${t}"/>`).join("")+"</richValueRels>"}function xs(){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvStructures xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" count="1"><s t="_localImage"><k n="_rvRel:LocalImageIdentifier" t="i"/><k n="CalcOrigin" t="i"/><k n="Text" t="s"/></s></rvStructures>'}function $s(){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvTypesInfo xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><global><keyFlags><key name="_Self"><flag name="ExcludeFromFile" value="1"/><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_DisplayString"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Flags"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Format"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_SubLabel"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Attribution"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Icon"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Display"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_CanonicalPropertyNames"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_ClassificationId"><flag name="ExcludeFromCalcComparison" value="1"/></key></keyFlags></global><types></types></rvTypesInfo>'}var ze=class{constructor(){this.s={}}font(t){return this.s.font={...this.s.font??{},...t},this}fontSize(t){return this.font({size:t})}fontName(t){return this.font({name:t})}bold(t=!0){return this.font({bold:t})}italic(t=!0){return this.font({italic:t})}strike(t=!0){return this.font({strike:t})}underline(t="single"){return this.font({underline:t})}fontColor(t){return this.font({color:t})}fill(t,e,n){return this.s.fill={type:"pattern",pattern:t,fgColor:e,bgColor:n},this}bg(t){return this.fill("solid",t)}border(t,e){let n={style:t,color:e};return this.s.border={left:n,right:n,top:n,bottom:n},this}borderLeft(t,e){return this.s.border={...this.s.border??{},left:{style:t,color:e}},this}borderRight(t,e){return this.s.border={...this.s.border??{},right:{style:t,color:e}},this}borderTop(t,e){return this.s.border={...this.s.border??{},top:{style:t,color:e}},this}borderBottom(t,e){return this.s.border={...this.s.border??{},bottom:{style:t,color:e}},this}align(t,e){return this.s.alignment={...this.s.alignment??{},horizontal:t,vertical:e},this}center(){return this.align("center","center")}wrap(t=!0){return this.s.alignment={...this.s.alignment??{},wrapText:t},this}rotate(t){return this.s.alignment={...this.s.alignment??{},textRotation:t},this}indent(t){return this.s.alignment={...this.s.alignment??{},indent:t},this}shrink(t=!0){return this.s.alignment={...this.s.alignment??{},shrinkToFit:t},this}numFmt(t){return this.s.numberFormat={formatCode:t},this}numFmtId(t){return this.s.numFmtId=t,this}locked(t=!0){return this.s.locked=t,this}hidden(t=!0){return this.s.hidden=t,this}build(){return{...this.s}}};function vt(){return new ze}var ys={headerBlue:vt().bold().bg("FF4472C4").fontColor("FFFFFFFF").center().build(),headerGray:vt().bold().bg("FF595959").fontColor("FFFFFFFF").center().build(),headerGreen:vt().bold().bg("FF70AD47").fontColor("FFFFFFFF").center().build(),currency:vt().numFmt('"$"#,##0.00').build(),percent:vt().numFmt("0.00%").build(),integer:vt().numFmt("#,##0").build(),date:vt().numFmtId(14).build(),dateTime:vt().numFmtId(22).build(),bold:vt().bold().build(),centered:vt().center().build(),wrapped:vt().wrap().build(),bordered:vt().border("thin").build(),borderedBlack:vt().border("thin","FF000000").build(),highlight:vt().bg("FFFFFF00").build(),lightBlue:vt().bg("FFDCE6F1").build(),redText:vt().fontColor("FFFF0000").build(),blueText:vt().fontColor("FF0000FF").build(),greenText:vt().fontColor("FF00B050").build(),tableHeader:vt().bold().border("thin").center().bg("FFD9E1F2").build(),deleted:vt().strike().fontColor("FF808080").build()},ws={General:"General",Integer:"#,##0",Decimal2:"#,##0.00",Currency:'"$"#,##0.00',CurrencyNeg:'"$"#,##0.00;[Red]("$"#,##0.00)',Percent:"0%",Percent2:"0.00%",Scientific:"0.00E+00",Fraction:"# ?/?",ShortDate:"mm/dd/yyyy",LongDate:"mmmm d, yyyy",Time:"h:mm AM/PM",DateTime:"mm/dd/yyyy h:mm",Text:"@",Accounting:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',FinancialPos:"#,##0;(#,##0)",ZeroDash:'#,##0;(#,##0);"-"',Multiple:'0.0"x"'},bs={White:"FFFFFFFF",Black:"FF000000",Red:"FFFF0000",Green:"FF00B050",Blue:"FF0070C0",Yellow:"FFFFFF00",Orange:"FFFFA500",Gray:"FF808080",LightGray:"FFD3D3D3",DarkBlue:"FF003366",ExcelBlue:"FF4472C4",ExcelOrange:"FFED7D31",ExcelGreen:"FF70AD47",ExcelRed:"FFFF0000",ExcelPurple:"FF7030A0",Transparent:"00FFFFFF"};function vs(o,t={}){let e=t.delimiter??",",n=t.lineEnding??`\r
417
+ `,r=t.quote??'"',s=[],i=o.readAllCells(),a=0,l=0;for(let{row:c,col:h}of i)c>a&&(a=c),h>l&&(l=h);let m=new Map;for(let{row:c,col:h,cell:d}of i)m.set(`${c},${h}`,d.value??null);for(let c=1;c<=a;c++){let h=[];for(let d=1;d<=l;d++){let f=m.get(`${c},${d}`),p=Cs(f);p.includes(e)||p.includes(r)||p.includes(`
418
+ `)||p.includes("\r")?h.push(r+p.replace(new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r+r)+r):h.push(p)}s.push(h.join(e))}return s.join(n)}function Cs(o){return o==null?"":o instanceof jt?o.error:o instanceof Date?o.toISOString():String(o)}function Fs(o,t={}){let e=t.delimiter??",",n=t.quote??'"',r=t.sheetName??"Sheet1",s=Ss(o,e,n),i=new ke,a=i.addSheet(r);for(let l=0;l<s.length;l++)for(let m=0;m<s[l].length;m++){let c=s[l][m];if(c==="")continue;let h=Number(c);!isNaN(h)&&c.trim()!==""?a.setValue(l+1,m+1,h):c.toLowerCase()==="true"?a.setValue(l+1,m+1,!0):c.toLowerCase()==="false"?a.setValue(l+1,m+1,!1):a.setValue(l+1,m+1,c)}return i}function Ss(o,t,e){let n=[],r=[],s="",i=!1,a=0,l=o.length;for(;a<l;){let m=o[a];i?m===e?a+1<l&&o[a+1]===e?(s+=e,a+=2):(i=!1,a++):(s+=m,a++):m===e?(i=!0,a++):m===t?(r.push(s),s="",a++):m==="\r"?(r.push(s),s="",n.push(r),r=[],a++,a<l&&o[a]===`
419
+ `&&a++):m===`
420
+ `?(r.push(s),s="",n.push(r),r=[],a++):(s+=m,a++)}return(s||r.length)&&(r.push(s),n.push(r)),n}function vn(o,t={}){let e=t.header!==!1,n=t.includeEmpty??!1,r=t.range?o.readRange(t.range):Ts(o);if(r.length===0)return[];if(e){let s=r[0].map(i=>String(i??""));return r.slice(1).map(i=>{let a={};for(let l=0;l<s.length;l++){let m=l<i.length?i[l]:null;!n&&m==null||(a[s[l]]=bn(m,t))}return a})}else return r.map(s=>s.map(i=>bn(i,t)))}function Is(o,t={}){let e={};for(let n of o.getSheets())e[n.name]=vn(n,t);return e}function bn(o,t){if(o==null)return null;if(o instanceof jt)return o.error;if(o instanceof Date)switch(t.dateFormat){case"epoch":return o.getTime();case"serial":return(o.getTime()-Date.UTC(1899,11,30))/864e5;default:return o.toISOString()}return o}function Ts(o){let t=o.readAllCells();if(t.length===0)return[];let e=0,n=0;for(let{row:i,col:a}of t)i>e&&(e=i),a>n&&(n=a);let r=[],s=new Map;for(let{row:i,col:a,cell:l}of t)s.has(i)||s.set(i,new Map),s.get(i).set(a,l.value??null);for(let i=1;i<=e;i++){let a=[],l=s.get(i);for(let m=1;m<=n;m++)a.push(l?.get(m)??null);r.push(a)}return r}var As=["#000000","#FFFFFF","#44546A","#E7E6E6","#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47"];function Tt(o){if(!o)return"";if(o.startsWith("#"))return o;if(o.startsWith("theme:")){let t=parseInt(o.slice(6),10);return As[t]??"#000"}return o.length===8&&!o.startsWith("#")?"#"+o.slice(2):"#"+o}function Cn(o){let t=o.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function Fo(o,t,e){let[n,r,s]=Cn(Tt(o)||"#FFFFFF"),[i,a,l]=Cn(Tt(t)||"#000000"),m=Math.round(n+(i-n)*e),c=Math.round(r+(a-r)*e),h=Math.round(s+(l-s)*e);return`#${m.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}${h.toString(16).padStart(2,"0")}`}function Fn(o){let t=[];o.bold&&t.push("font-weight:bold"),o.italic&&t.push("font-style:italic");let e=[];return o.underline&&o.underline!=="none"&&e.push("underline"),o.strike&&e.push("line-through"),e.length&&t.push(`text-decoration:${e.join(" ")}`),o.size&&t.push(`font-size:${o.size}pt`),o.color&&t.push(`color:${Tt(o.color)}`),o.name&&t.push(`font-family:'${o.name}',sans-serif`),o.vertAlign==="superscript"?t.push("vertical-align:super;font-size:smaller"):o.vertAlign==="subscript"&&t.push("vertical-align:sub;font-size:smaller"),t.join(";")}function ks(o){if(o.type==="pattern"){let t=o;if(t.pattern==="solid"&&t.fgColor)return`background-color:${Tt(t.fgColor)}`}if(o.type==="gradient"){let t=o;if(t.stops&&t.stops.length>=2){let e=t.stops.map(r=>`${Tt(r.color)} ${Math.round(r.position*100)}%`).join(",");return`background:linear-gradient(${t.degree??0}deg,${e})`}}return""}function We(o){if(!o||!o.style)return"";let t={thin:"1px",medium:"2px",thick:"3px",dashed:"1px",dotted:"1px",double:"3px",hair:"1px",mediumDashed:"2px",dashDot:"1px",mediumDashDot:"2px",dashDotDot:"1px",mediumDashDotDot:"2px",slantDashDot:"2px"},e={thin:"solid",medium:"solid",thick:"solid",dashed:"dashed",dotted:"dotted",double:"double",hair:"solid",mediumDashed:"dashed",dashDot:"dashed",mediumDashDot:"dashed",dashDotDot:"dotted",mediumDashDotDot:"dotted",slantDashDot:"dashed"},n=t[o.style]??"1px",r=e[o.style]??"solid",s=o.color?Tt(o.color):"#000";return`${n} ${r} ${s}`}function Ds(o){let t=[];if(o.horizontal){let e={left:"left",center:"center",right:"right",fill:"justify",justify:"justify",distributed:"justify"};t.push(`text-align:${e[o.horizontal]??o.horizontal}`)}if(o.vertical){let e={top:"top",center:"middle",bottom:"bottom",distributed:"middle"};t.push(`vertical-align:${e[o.vertical]??"bottom"}`)}return o.wrapText&&t.push("white-space:normal;word-wrap:break-word"),o.textRotation&&t.push(`transform:rotate(-${o.textRotation}deg)`),o.indent&&t.push(`padding-left:${o.indent*8}px`),t.join(";")}function Ps(o){let t=[];return o.font&&t.push(Fn(o.font)),o.fill&&t.push(ks(o.fill)),o.alignment&&t.push(Ds(o.alignment)),o.border&&(o.border.top&&t.push(`border-top:${We(o.border.top)}`),o.border.bottom&&t.push(`border-bottom:${We(o.border.bottom)}`),o.border.left&&t.push(`border-left:${We(o.border.left)}`),o.border.right&&t.push(`border-right:${We(o.border.right)}`)),t.filter(Boolean).join(";")}function Rs(o,t){if(o==null)return"";if(!t||t==="General")return String(o);let e=typeof o=="number"?o:parseFloat(String(o));if(isNaN(e))return String(o);if(t.includes("%")){let s=(t.match(/0\.(0+)%/)??[])[1]?.length??0;return(e*100).toFixed(s)+"%"}let n=t.match(/[$€£¥]|"CHF"/);if(n){let s=n[0].replace(/"/g,""),i=(t.match(/\.(0+)/)??[])[1]?.length??2,a=Math.abs(e).toFixed(i).replace(/\B(?=(\d{3})+(?!\d))/g,",");return t.indexOf(n[0])<t.indexOf("0")?(e<0?"-":"")+s+a:(e<0?"-":"")+a+" "+s}if(t.includes("#,##0")||t.includes("#,###")){let s=(t.match(/\.(0+)/)??[])[1]?.length??0;return e.toFixed(s).replace(/\B(?=(\d{3})+(?!\d))/g,",")}let r=t.match(/^0\.(0+)$/);if(r)return e.toFixed(r[1].length);if(/[ymdh]/i.test(t))return Ms(e,t);if(t.includes("?/?")||t.includes("??/??"))return Es(e);if(/0\.0+E\+0+/i.test(t)){let s=(t.match(/0\.(0+)/)??[])[1]?.length??2;return e.toExponential(s).toUpperCase()}return String(o)}function Ms(o,t){let e=new Date(1899,11,30),n=new Date(e.getTime()+o*864e5),r=n.getFullYear(),s=n.getMonth()+1,i=n.getDate(),a=n.getHours(),l=n.getMinutes(),m=n.getSeconds();return t.replace(/yyyy/gi,String(r)).replace(/yy/gi,String(r).slice(-2)).replace(/mmmm/gi,n.toLocaleDateString("en",{month:"long"})).replace(/mmm/gi,n.toLocaleDateString("en",{month:"short"})).replace(/mm/gi,String(s).padStart(2,"0")).replace(/m/gi,String(s)).replace(/dd/gi,String(i).padStart(2,"0")).replace(/d/gi,String(i)).replace(/hh/gi,String(a).padStart(2,"0")).replace(/h/gi,String(a)).replace(/ss/gi,String(m).padStart(2,"0")).replace(/nn|MM/g,String(l).padStart(2,"0"))}function Es(o){let t=Math.floor(Math.abs(o)),e=Math.abs(o)-t;if(e<1e-4)return String(o<0?-t:t);let n=0,r=1,s=1;for(let a=1;a<=100;a++){let l=Math.round(e*a),m=Math.abs(e-l/a);if(m<s&&(n=l,r=a,s=m),m<1e-4)break}let i=o<0?"-":"";return t>0?`${i}${t} ${n}/${r}`:`${i}${n}/${r}`}function _s(o,t,e){if(o.colorScale){let n=[...e].sort((m,c)=>m-c),r=n[0],i=n[n.length-1]-r||1,a=(t-r)/i,l=o.colorScale;if(l.color.length===2)return`background-color:${Fo(l.color[0],l.color[1],a)}`;if(l.color.length>=3)return a<=.5?`background-color:${Fo(l.color[0],l.color[1],a*2)}`:`background-color:${Fo(l.color[1],l.color[2],(a-.5)*2)}`}if(o.dataBar){let n=[...e].sort((l,m)=>l-m),r=n[0],s=n[n.length-1],i=Math.round((t-r)/(s-r||1)*100);return`background:linear-gradient(90deg,${Tt(o.dataBar.color)||"#638EC6"} ${i}%,transparent ${i}%)`}if(o.iconSet){let n=[...e].sort((c,h)=>c-h),r=n[0],s=n[n.length-1],i=(t-r)/(s-r||1),l={"3Arrows":["\u2193","\u2192","\u2191"],"3ArrowsGray":["\u21E9","\u21E8","\u21E7"],"3TrafficLights1":["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],"3TrafficLights2":["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],"3Signs":["\u26D4","\u26A0\uFE0F","\u2705"],"3Symbols":["\u2716","!","\u2714"],"3Symbols2":["\u2716","!","\u2714"],"3Flags":["\u{1F3F4}","\u{1F3F3}","\u{1F3C1}"],"3Stars":["\u2606","\u2605","\u2605"],"4Arrows":["\u2193","\u2198","\u2197","\u2191"],"4ArrowsGray":["\u21E9","\u21D8","\u21D7","\u21E7"],"4Rating":["\u25D4","\u25D1","\u25D5","\u25CF"],"4RedToBlack":["\u2B24","\u2B24","\u2B24","\u2B24"],"4TrafficLights":["\u2B24","\u2B24","\u2B24","\u2B24"],"5Arrows":["\u2193","\u2198","\u2192","\u2197","\u2191"],"5ArrowsGray":["\u21E9","\u21D8","\u21E8","\u21D7","\u21E7"],"5Quarters":["\u25CB","\u25D4","\u25D1","\u25D5","\u25CF"],"5Rating":["\u25D4","\u25D4","\u25D1","\u25D5","\u25CF"]}[o.iconSet.iconSet??"3TrafficLights1"]??["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],m=Math.min(Math.floor(i*l.length),l.length-1);return`data-icon="${l[m]}"`}return""}function Bs(o,t){if(!t.length)return"";let e=100,n=20,r=Math.min(...t),i=Math.max(...t)-r||1,a=Tt(o.color)||"#4472C4",l=t.indexOf(Math.max(...t)),m=t.indexOf(Math.min(...t));if(o.type==="bar"||o.type==="stacked"){let u=e/t.length,x=t.map(($,y)=>{let I=o.type==="stacked"?($>=0,n/2):Math.max(1,($-r)/i*n),R=o.type==="stacked"?$>=0?n/2-I:n/2:n-I,w=a;return $<0&&o.negativeColor?w=Tt(o.negativeColor):o.showHigh&&y===l&&o.highColor?w=Tt(o.highColor):o.showLow&&y===m&&o.lowColor?w=Tt(o.lowColor):o.showFirst&&y===0&&o.firstColor?w=Tt(o.firstColor):o.showLast&&y===t.length-1&&o.lastColor&&(w=Tt(o.lastColor)),`<rect x="${y*u+u*.1}" y="${R}" width="${u*.8}" height="${I}" fill="${w}" rx="1"/>`}).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${n}" viewBox="0 0 ${e} ${n}" style="display:inline-block;vertical-align:middle">${x}</svg>`}let c=o.lineWidth??1.5,h=t.map((u,x)=>`${x/(t.length-1||1)*e},${n-(u-r)/i*n}`).join(" "),d="";o.showMarkers&&(d=t.map((u,x)=>{let $=x/(t.length-1||1)*e,y=n-(u-r)/i*n;return`<circle cx="${$}" cy="${y}" r="1.5" fill="${Tt(o.markersColor)||a}"/>`}).join(""));let f=[],p=(u,x)=>{let $=u/(t.length-1||1)*e,y=n-(t[u]-r)/i*n;f.push(`<circle cx="${$}" cy="${y}" r="2.5" fill="${x}" stroke="white" stroke-width="0.5"/>`)};return o.showHigh&&o.highColor&&p(l,Tt(o.highColor)),o.showLow&&o.lowColor&&p(m,Tt(o.lowColor)),o.showFirst&&o.firstColor&&p(0,Tt(o.firstColor)),o.showLast&&o.lastColor&&p(t.length-1,Tt(o.lastColor)),o.showNegative&&o.negativeColor&&t.forEach((u,x)=>{if(u<0){let $=x/(t.length-1||1)*e,y=n-(u-r)/i*n;f.push(`<circle cx="${$}" cy="${y}" r="2" fill="${Tt(o.negativeColor)}"/>`)}}),`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${n}" viewBox="0 0 ${e} ${n}" style="display:inline-block;vertical-align:middle"><polyline points="${h}" fill="none" stroke="${a}" stroke-width="${c}"/>${d}${f.join("")}</svg>`}var pe=["#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47","#264478","#9B57A0","#636363","#EB7E3A"];function Sn(o,t){let e=[],s=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"").match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(!s)return e;let i=Ut(s[1]),a=parseInt(s[2],10),l=Ut(s[3]),m=parseInt(s[4],10);for(let c=a;c<=m;c++)for(let h=i;h<=l;h++){let d=o.getCell(c,h);e.push(typeof d.value=="number"?d.value:null)}return e}function Ls(o,t){let e=[],s=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"").match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(!s)return e;let i=Ut(s[1]),a=parseInt(s[2],10),l=Ut(s[3]),m=parseInt(s[4],10);for(let c=a;c<=m;c++)for(let h=i;h<=l;h++){let d=o.getCell(c,h);e.push(d.value!=null?String(d.value):"")}return e}function Ns(o,t){let c=o.title??"",h=o.type,d=[],f=[];for(let A=0;A<o.series.length;A++){let N=o.series[A],O=Sn(t,N.values).map(z=>z??0);N.categories&&!f.length&&(f=Ls(t,N.categories)),d.push({name:N.name??`Series ${A+1}`,values:O,color:N.color?Tt(N.color):pe[A%pe.length]})}if(!d.length||!d[0].values.length)return`<div style="display:inline-block;width:520px;height:340px;border:1px solid #ccc;background:#f9f9f9;text-align:center;line-height:340px;color:#666;font-size:14px" data-chart-type="${h}">[Chart: ${b(c||h)} \u2014 no data]</div>`;let p=Math.max(...d.map(A=>A.values.length));if(f.length||(f=Array.from({length:p},(A,N)=>String(N+1))),h==="pie"||h==="doughnut")return js(o,d,f,520,340);if(h==="radar"||h==="radarFilled")return Os(o,d,f,520,340);if(h==="scatter"||h==="scatterSmooth"||h==="bubble")return Xs(o,d,t,520,340);let u=d.flatMap(A=>A.values),x=o.yAxis?.min??Math.min(0,...u),$=o.yAxis?.max??Math.max(...u);$===x&&($=x+1);let y=$-x,I=5,R=[],w=[];for(let A=0;A<=I;A++){let N=x+y*A/I,j=285-240*(N-x)/y;R.push(`<line x1="65" y1="${j}" x2="500" y2="${j}" stroke="#e0e0e0" stroke-width="1"/>`);let O=Math.abs(N)>=1e3?(N/1e3).toFixed(1)+"k":Number.isInteger(N)?String(N):N.toFixed(1);w.push(`<text x="57" y="${j+4}" text-anchor="end" font-size="10" fill="#666">${O}</text>`)}let C=285-240*(0-x)/y,g="",M=h==="bar"||h==="barStacked"||h==="barStacked100",T=h==="column"||h==="columnStacked"||h==="columnStacked100",S=h==="area"||h==="areaStacked",k=h==="line"||h==="lineStacked"||h==="lineMarker",L=h.includes("Stacked"),P=h.includes("100");if(M){let A=240/p,N=L?A*.7:A*.7/d.length;for(let j=0;j<p;j++)if(L){let O=0,z=P&&d.reduce((V,st)=>V+Math.abs(st.values[j]??0),0)||1;for(let V=0;V<d.length;V++){let st=d[V].values[j]??0;P&&(st=st/z*($-x));let ct=Math.abs(st)/y*435,at=65+O/y*435,pt=45+j*A+A*.15;g+=`<rect x="${at}" y="${pt}" width="${ct}" height="${N}" fill="${d[V].color}" rx="2"><title>${d[V].name}: ${d[V].values[j]??0}</title></rect>`,O+=Math.abs(st)}}else for(let O=0;O<d.length;O++){let z=d[O].values[j]??0,V=Math.abs(z-x)/y*435,st=45+j*A+A*.15+O*N;g+=`<rect x="65" y="${st}" width="${V}" height="${N}" fill="${d[O].color}" rx="2"><title>${d[O].name}: ${z}</title></rect>`}for(let j=0;j<p;j++){let O=45+j*A+A/2+4;w.push(`<text x="57" y="${O}" text-anchor="end" font-size="10" fill="#666">${b(f[j]??"")}</text>`)}}else if(T||!k&&!S){let A=435/p,N=L?A*.6:A*.6/d.length;for(let j=0;j<p;j++)if(L){let O=0,z=P&&d.reduce((V,st)=>V+Math.abs(st.values[j]??0),0)||1;for(let V=0;V<d.length;V++){let st=d[V].values[j]??0;P&&(st=st/z*y);let ct=Math.abs(st)/y*240,at=65+j*A+A*.2,pt=C-O-ct;g+=`<rect x="${at}" y="${pt}" width="${N}" height="${ct}" fill="${d[V].color}" rx="2"><title>${d[V].name}: ${d[V].values[j]??0}</title></rect>`,O+=ct}}else for(let O=0;O<d.length;O++){let z=d[O].values[j]??0,V=Math.abs(z-x)/y*240,st=65+j*A+A*.2+O*N,ct=285-V;g+=`<rect x="${st}" y="${ct}" width="${N}" height="${V}" fill="${d[O].color}" rx="2"><title>${d[O].name}: ${z}</title></rect>`}}if(S)for(let A=0;A<d.length;A++){let N=[];for(let V=0;V<p;V++){let st=d[A].values[V]??0,ct=65+V/(p-1||1)*435,at=285-(st-x)/y*240;N.push(`${ct},${at}`)}let j=65,O=65+(p-1)/(p-1||1)*435,z=`M${j},${C} L${N.join(" L")} L${O},${C} Z`;g+=`<path d="${z}" fill="${d[A].color}" fill-opacity="0.3"/>`,g+=`<polyline points="${N.join(" ")}" fill="none" stroke="${d[A].color}" stroke-width="2"/>`}if(k)for(let A=0;A<d.length;A++){let N=[];for(let j=0;j<p;j++){let O=d[A].values[j]??0,z=65+j/(p-1||1)*435,V=285-(O-x)/y*240;N.push(`${z},${V}`)}if(g+=`<polyline points="${N.join(" ")}" fill="none" stroke="${d[A].color}" stroke-width="2.5"/>`,h==="lineMarker"||d[A].values.length<=20)for(let j=0;j<p;j++){let O=d[A].values[j]??0,z=65+j/(p-1||1)*435,V=285-(O-x)/y*240;g+=`<circle cx="${z}" cy="${V}" r="3.5" fill="${d[A].color}" stroke="white" stroke-width="1.5"><title>${d[A].name}: ${O}</title></circle>`}}let U="";if(!M){let A=p>20?Math.ceil(p/15):1;for(let N=0;N<p;N+=A){let j=T||!k&&!S?65+N*(435/p)+435/p/2:65+N/(p-1||1)*435;U+=`<text x="${j}" y="303" text-anchor="middle" font-size="10" fill="#666" transform="rotate(-30 ${j} 303)">${b((f[N]??"").slice(0,12))}</text>`}}let H="";if(o.legend!==!1&&d.length>1){let j=(520-d.reduce((O,z)=>O+z.name.length*7+25,0))/2;for(let O of d)H+=`<rect x="${j}" y="320" width="12" height="12" rx="2" fill="${O.color}"/>`,H+=`<text x="${j+16}" y="330" font-size="10" fill="#444">${b(O.name)}</text>`,j+=O.name.length*7+25}let G="";return o.xAxis?.title&&(G+=`<text x="${520/2}" y="338" text-anchor="middle" font-size="11" fill="#444">${b(o.xAxis.title)}</text>`),o.yAxis?.title&&(G+=`<text x="14" y="${45+240/2}" text-anchor="middle" font-size="11" fill="#444" transform="rotate(-90 14 ${45+240/2})">${b(o.yAxis.title)}</text>`),`<svg xmlns="http://www.w3.org/2000/svg" width="520" height="340" viewBox="0 0 520 340" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
421
+ ${c?`<text x="${520/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${b(c)}</text>`:""}
422
+ ${R.join(`
423
+ `)}
424
+ <rect x="65" y="45" width="435" height="240" fill="none" stroke="#ccc" stroke-width="0.5"/>
425
+ ${g}
426
+ ${U}
427
+ ${w.join(`
428
+ `)}
429
+ ${H}
430
+ ${G}
431
+ </svg>`}function js(o,t,e,n,r){let s=n/2,i=r/2+10,a=Math.min(n,r)/2-40,l=o.type==="doughnut"?a*.5:0,m=t[0].values,c=m.reduce(($,y)=>$+Math.abs(y),0)||1,h=o.title??"",d=-Math.PI/2,f=[],p=[];for(let $=0;$<m.length;$++){let y=Math.abs(m[$])/c,I=y*Math.PI*2,R=d+I/2,w=I>Math.PI?1:0,C=s+a*Math.cos(d),g=i+a*Math.sin(d),M=s+a*Math.cos(d+I),T=i+a*Math.sin(d+I),S;if(l>0){let L=s+l*Math.cos(d),P=i+l*Math.sin(d),U=s+l*Math.cos(d+I),H=i+l*Math.sin(d+I);S=`M${C},${g} A${a},${a} 0 ${w} 1 ${M},${T} L${U},${H} A${l},${l} 0 ${w} 0 ${L},${P} Z`}else S=m.length===1?`M${s-a},${i} A${a},${a} 0 1 1 ${s+a},${i} A${a},${a} 0 1 1 ${s-a},${i} Z`:`M${s},${i} L${C},${g} A${a},${a} 0 ${w} 1 ${M},${T} Z`;let k=pe[$%pe.length];if(f.push(`<path d="${S}" fill="${k}" stroke="white" stroke-width="1.5"><title>${b(e[$]??"")}: ${m[$]} (${(y*100).toFixed(1)}%)</title></path>`),y>.04){let L=a+16,P=s+L*Math.cos(R),U=i+L*Math.sin(R),H=R>Math.PI/2&&R<Math.PI*1.5?"end":"start";p.push(`<text x="${P}" y="${U+4}" text-anchor="${H}" font-size="10" fill="#444">${b((e[$]??"").slice(0,10))} ${(y*100).toFixed(0)}%</text>`)}d+=I}let u="";if(o.legend!==!1){let $=n-10;for(let y=0;y<Math.min(m.length,10);y++){let I=40+y*18;u+=`<rect x="${$-80}" y="${I-8}" width="10" height="10" rx="2" fill="${pe[y%pe.length]}"/>`,u+=`<text x="${$-65}" y="${I+2}" font-size="10" fill="#444">${b((e[y]??"").slice(0,10))}</text>`}}let x=h?`<text x="${n/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${b(h)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
432
+ ${x}
433
+ ${f.join(`
434
+ `)}
435
+ ${p.join(`
436
+ `)}
437
+ ${u}
438
+ </svg>`}function Os(o,t,e,n,r){let s=n/2,i=r/2+10,a=Math.min(n,r)/2-50,l=e.length||1,m=o.type==="radarFilled",c=t.flatMap(x=>x.values),h=Math.max(...c,1),d=[];for(let x=1;x<=4;x++){let $=a*x/4,y=Array.from({length:l},(I,R)=>{let w=-Math.PI/2+2*Math.PI*R/l;return`${s+$*Math.cos(w)},${i+$*Math.sin(w)}`});d.push(`<polygon points="${y.join(" ")}" fill="none" stroke="#e0e0e0" stroke-width="0.5"/>`)}let f=[];for(let x=0;x<l;x++){let $=-Math.PI/2+2*Math.PI*x/l,y=s+a*Math.cos($),I=i+a*Math.sin($);f.push(`<line x1="${s}" y1="${i}" x2="${y}" y2="${I}" stroke="#ccc" stroke-width="0.5"/>`);let R=s+(a+14)*Math.cos($),w=i+(a+14)*Math.sin($);f.push(`<text x="${R}" y="${w+4}" text-anchor="middle" font-size="9" fill="#666">${b((e[x]??"").slice(0,8))}</text>`)}let p=[];for(let x of t){let $=x.values.map((y,I)=>{let R=-Math.PI/2+2*Math.PI*I/l,w=y/h*a;return`${s+w*Math.cos(R)},${i+w*Math.sin(R)}`});m?p.push(`<polygon points="${$.join(" ")}" fill="${x.color}" fill-opacity="0.2" stroke="${x.color}" stroke-width="2"/>`):p.push(`<polygon points="${$.join(" ")}" fill="none" stroke="${x.color}" stroke-width="2"/>`),x.values.forEach((y,I)=>{let R=-Math.PI/2+2*Math.PI*I/l,w=y/h*a;p.push(`<circle cx="${s+w*Math.cos(R)}" cy="${i+w*Math.sin(R)}" r="3" fill="${x.color}" stroke="white" stroke-width="1"><title>${x.name}: ${y}</title></circle>`)})}let u=o.title?`<text x="${n/2}" y="20" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${b(o.title)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
439
+ ${u}
440
+ ${d.join(`
441
+ `)}
442
+ ${f.join(`
443
+ `)}
444
+ ${p.join(`
445
+ `)}
446
+ </svg>`}function Xs(o,t,e,n,r){let m=n-60-20,c=r-45-40,h=o.series[0]?.categories?Sn(e,o.series[0].categories):[],d=[];for(let g of t)for(let M=0;M<g.values.length;M++)d.push({x:h[M]??M,y:g.values[M],name:g.name,color:g.color});if(!d.length)return"";let f=Math.min(...d.map(g=>g.x)),p=Math.max(...d.map(g=>g.x)),u=Math.min(0,...d.map(g=>g.y)),x=Math.max(...d.map(g=>g.y)),$=p-f||1,y=x-u||1,I=[];for(let g=0;g<=4;g++){let M=45+c-c*g/4;I.push(`<line x1="60" y1="${M}" x2="${n-20}" y2="${M}" stroke="#e0e0e0" stroke-width="0.5"/>`);let T=u+y*g/4;I.push(`<text x="52" y="${M+4}" text-anchor="end" font-size="10" fill="#666">${T.toFixed(0)}</text>`)}let R=d.map(g=>{let M=60+(g.x-f)/$*m,T=45+c-(g.y-u)/y*c,S=o.type==="bubble"?Math.max(4,Math.min(20,Math.sqrt(Math.abs(g.y))*2)):4;return`<circle cx="${M}" cy="${T}" r="${S}" fill="${g.color}" fill-opacity="${o.type==="bubble"?"0.6":"1"}" stroke="white" stroke-width="1"><title>${g.name}: (${g.x}, ${g.y})</title></circle>`}).join(`
447
+ `),w="";if(o.type==="scatterSmooth")for(let g of t){let M=g.values.map((T,S)=>{let L=60+((h[S]??S)-f)/$*m,P=45+c-(T-u)/y*c;return`${L},${P}`});w+=`<polyline points="${M.join(" ")}" fill="none" stroke="${g.color}" stroke-width="2"/>`}let C=o.title?`<text x="${n/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${b(o.title)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
448
+ ${C}
449
+ ${I.join(`
450
+ `)}
451
+ <rect x="60" y="45" width="${m}" height="${c}" fill="none" stroke="#ccc" stroke-width="0.5"/>
452
+ ${w}
453
+ ${R}
454
+ </svg>`}function Us(o,t){return`<div class="xl-chart" data-from-col="${o.from.col}" data-from-row="${o.from.row}" data-to-col="${o.to.col}" data-to-row="${o.to.row}" style="position:absolute;z-index:4">${Ns(o,t)}</div>`}function Vs(o,t,e){switch(o){case"rect":return`<rect x="0" y="0" width="${t}" height="${e}"/>`;case"roundRect":return`<rect x="0" y="0" width="${t}" height="${e}" rx="${Math.min(t,e)*.15}"/>`;case"ellipse":return`<ellipse cx="${t/2}" cy="${e/2}" rx="${t/2}" ry="${e/2}"/>`;case"triangle":return`<polygon points="${t/2},0 ${t},${e} 0,${e}"/>`;case"diamond":return`<polygon points="${t/2},0 ${t},${e/2} ${t/2},${e} 0,${e/2}"/>`;case"pentagon":return`<polygon points="${Array.from({length:5},(r,s)=>{let i=-Math.PI/2+2*Math.PI*s/5;return`${t/2+t/2*Math.cos(i)},${e/2+e/2*Math.sin(i)}`}).join(" ")}"/>`;case"hexagon":return`<polygon points="${Array.from({length:6},(r,s)=>{let i=-Math.PI/6+2*Math.PI*s/6;return`${t/2+t/2*Math.cos(i)},${e/2+e/2*Math.sin(i)}`}).join(" ")}"/>`;case"octagon":return`<polygon points="${Array.from({length:8},(r,s)=>{let i=-Math.PI/8+2*Math.PI*s/8;return`${t/2+t/2*Math.cos(i)},${e/2+e/2*Math.sin(i)}`}).join(" ")}"/>`;case"star5":case"star6":{let n=o==="star5"?5:6,r=[];for(let s=0;s<n*2;s++){let i=-Math.PI/2+Math.PI*s/n,a=s%2===0?Math.min(t,e)/2:Math.min(t,e)/4.5;r.push(`${t/2+a*Math.cos(i)},${e/2+a*Math.sin(i)}`)}return`<polygon points="${r.join(" ")}"/>`}case"rightArrow":return`<polygon points="0,${e*.25} ${t*.65},${e*.25} ${t*.65},0 ${t},${e/2} ${t*.65},${e} ${t*.65},${e*.75} 0,${e*.75}"/>`;case"leftArrow":return`<polygon points="${t},${e*.25} ${t*.35},${e*.25} ${t*.35},0 0,${e/2} ${t*.35},${e} ${t*.35},${e*.75} ${t},${e*.75}"/>`;case"upArrow":return`<polygon points="${t*.25},${e} ${t*.25},${e*.35} 0,${e*.35} ${t/2},0 ${t},${e*.35} ${t*.75},${e*.35} ${t*.75},${e}"/>`;case"downArrow":return`<polygon points="${t*.25},0 ${t*.75},0 ${t*.75},${e*.65} ${t},${e*.65} ${t/2},${e} 0,${e*.65} ${t*.25},${e*.65}"/>`;case"heart":{let n=t/2,r=e;return`<path d="M${n},${r*.35} C${n},${r*.15} ${n*.5},0 ${n*.25},0 C0,0 0,${r*.35} 0,${r*.35} C0,${r*.6} ${n*.5},${r*.8} ${n},${r} C${n*1.5},${r*.8} ${t},${r*.6} ${t},${r*.35} C${t},${r*.35} ${t},0 ${n*1.75},0 C${n*1.5},0 ${n},${r*.15} ${n},${r*.35} Z"/>`}case"lightningBolt":return`<polygon points="${t*.55},0 ${t*.2},${e*.45} ${t*.45},${e*.45} ${t*.15},${e} ${t*.8},${e*.4} ${t*.55},${e*.4}"/>`;case"sun":return`<circle cx="${t/2}" cy="${e/2}" r="${Math.min(t,e)*.3}"/>`;case"moon":return`<path d="M${t*.6},${e*.1} A${t*.4},${e*.4} 0 1 0 ${t*.6},${e*.9} A${t*.3},${e*.35} 0 1 1 ${t*.6},${e*.1} Z"/>`;case"smileyFace":return`<circle cx="${t/2}" cy="${e/2}" r="${Math.min(t,e)*.45}"/><circle cx="${t*.35}" cy="${e*.38}" r="${Math.min(t,e)*.04}" fill="white"/><circle cx="${t*.65}" cy="${e*.38}" r="${Math.min(t,e)*.04}" fill="white"/><path d="M${t*.3},${e*.58} Q${t/2},${e*.78} ${t*.7},${e*.58}" fill="none" stroke="white" stroke-width="2"/>`;case"cloud":return`<ellipse cx="${t*.35}" cy="${e*.55}" rx="${t*.25}" ry="${e*.25}"/><ellipse cx="${t*.55}" cy="${e*.35}" rx="${t*.22}" ry="${e*.22}"/><ellipse cx="${t*.7}" cy="${e*.5}" rx="${t*.2}" ry="${e*.2}"/><rect x="${t*.15}" y="${e*.5}" width="${t*.7}" height="${e*.25}" rx="4"/>`;case"callout1":return`<path d="M0,0 L${t},0 L${t},${e*.7} L${t*.4},${e*.7} L${t*.25},${e} L${t*.3},${e*.7} L0,${e*.7} Z"/>`;case"callout2":return`<path d="M${t*.1},0 L${t*.9},0 Q${t},0 ${t},${e*.1} L${t},${e*.6} Q${t},${e*.7} ${t*.9},${e*.7} L${t*.4},${e*.7} L${t*.25},${e} L${t*.3},${e*.7} L${t*.1},${e*.7} Q0,${e*.7} 0,${e*.6} L0,${e*.1} Q0,0 ${t*.1},0 Z"/>`;case"flowChartProcess":return`<rect x="0" y="0" width="${t}" height="${e}" rx="2"/>`;case"flowChartDecision":return`<polygon points="${t/2},0 ${t},${e/2} ${t/2},${e} 0,${e/2}"/>`;case"flowChartTerminator":return`<rect x="0" y="0" width="${t}" height="${e}" rx="${e/2}"/>`;case"flowChartDocument":return`<path d="M0,0 L${t},0 L${t},${e*.8} Q${t*.75},${e*.65} ${t*.5},${e*.8} Q${t*.25},${e*.95} 0,${e*.8} Z"/>`;case"line":return`<line x1="0" y1="${e/2}" x2="${t}" y2="${e/2}" stroke-width="2"/>`;case"curvedConnector3":return`<path d="M0,${e/2} C${t*.3},${e*.1} ${t*.7},${e*.9} ${t},${e/2}" fill="none" stroke-width="2"/>`;default:return`<rect x="0" y="0" width="${t}" height="${e}" rx="4"/>`}}function zs(o){let t=h=>{let d=h.replace(/^#/,"");return d.length===8&&(d=d.substring(2)),"#"+d},e=o.fillColor?t(o.fillColor):"#4472C4",n=o.lineColor?t(o.lineColor):"#2F5496",r=o.lineWidth??2,s=160,i=80,a=o.rotation?` transform="rotate(${o.rotation} ${s/2} ${i/2})"`:"",l=o.text?`<text x="${s/2}" y="${i/2+5}" text-anchor="middle" fill="white" font-size="13" font-weight="600"${o.font?.name?` font-family="'${b(o.font.name)}'"`:""}>${b(o.text)}</text>`:"",c=o.type==="line"||o.type==="curvedConnector3"?`fill="none" stroke="${e}"`:`fill="${e}" stroke="${n}" stroke-width="${r}"`;return`<div class="xl-shape" data-from-col="${o.from.col}" data-from-row="${o.from.row}" data-to-col="${o.to.col}" data-to-row="${o.to.row}" style="position:absolute;z-index:2">
455
+ <svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${i}" viewBox="0 0 ${s} ${i}"${a}>
456
+ <g ${c}>${Vs(o.type,s,i)}</g>
457
+ ${l}
458
+ </svg></div>`}function Ws(o){let t=c=>{let h=c.replace(/^#/,"");return h.length===8&&(h=h.substring(2)),"#"+h},e=o.fillColor?t(o.fillColor):"#333",n=o.outlineColor?t(o.outlineColor):"",r=o.font?.name??"Impact",s=o.font?.size??36,i=o.font?.bold!==!1?"font-weight:bold;":"",a=o.font?.italic?"font-style:italic;":"",l=n?`-webkit-text-stroke:1px ${n};paint-order:stroke fill;`:"",m=Hs(o.preset);return`<div class="xl-wordart" data-from-col="${o.from.col}" data-from-row="${o.from.row}" data-to-col="${o.to.col}" data-to-row="${o.to.row}" style="position:absolute;z-index:2;font-family:'${b(r)}',sans-serif;font-size:${s}px;${i}${a}color:${e};${l}text-shadow:2px 2px 4px rgba(0,0,0,.3);${m}padding:8px 16px;white-space:nowrap;line-height:1.2">${b(o.text)}</div>`}function Hs(o){return!o||o==="textPlain"?"":{textArchUp:"letter-spacing:4px;",textArchDown:"letter-spacing:4px;transform:scaleY(-1);",textCircle:"letter-spacing:6px;",textWave1:"letter-spacing:2px;font-style:italic;transform:skewX(-5deg);",textWave2:"letter-spacing:2px;font-style:italic;transform:skewX(5deg);",textInflate:"letter-spacing:3px;transform:scaleY(1.3);",textDeflate:"letter-spacing:1px;transform:scaleY(0.7);",textSlantUp:"transform:perspective(300px) rotateY(-8deg) rotateX(3deg);",textSlantDown:"transform:perspective(300px) rotateY(8deg) rotateX(-3deg);",textFadeUp:"transform:perspective(200px) rotateX(-8deg);",textFadeDown:"transform:perspective(200px) rotateX(8deg);",textFadeLeft:"transform:perspective(200px) rotateY(8deg);",textFadeRight:"transform:perspective(200px) rotateY(-8deg);",textCascadeUp:"letter-spacing:3px;transform:rotate(-5deg) scaleX(1.1);",textCascadeDown:"letter-spacing:3px;transform:rotate(5deg) scaleX(1.1);",textChevron:"letter-spacing:5px;transform:scaleX(1.15);",textRingInside:"letter-spacing:8px;",textRingOutside:"letter-spacing:6px;",textStop:"letter-spacing:2px;transform:scaleY(0.85) scaleX(1.1);"}[o]??""}function qs(o){let t="";for(let e=0;e<o.length;e+=3){let n=o[e],r=o[e+1]??0,s=o[e+2]??0,i=n<<16|r<<8|s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";t+=a[i>>18&63]+a[i>>12&63],t+=e+1<o.length?a[i>>6&63]:"=",t+=e+2<o.length?a[i&63]:"="}return t}function In(o,t){let e=Zs(t),n=typeof o=="string"?o:qs(o);return`data:${e};base64,${n}`}function Gs(o){let t=In(o.data,o.format),e=o.altText?` alt="${b(o.altText)}"`:"",n=o.width?`width:${o.width}px;`:"max-width:400px;",r=o.height?`height:${o.height}px;`:"max-height:300px;",s=o.from?.col??0,i=o.from?.row??0;return`<img src="${t}"${e} class="xl-img" data-from-col="${s}" data-from-row="${i}" style="${n}${r}border:1px solid #ddd;border-radius:4px"/>`}function Ks(o){let t=In(o.data,o.format),e=o.altText?` alt="${b(o.altText)}"`:"";return`<img src="${t}"${e} style="max-width:100%;max-height:100%;object-fit:contain"/>`}function Zs(o){switch(o){case"jpeg":case"jpg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"webp":return"image/webp";case"bmp":return"image/bmp";default:return"image/png"}}function ft(o){switch(o.type){case"text":{let t=b(o.text??"");return o.font==="normal"||/^[a-zA-Z]{2,}$/.test(o.text??"")?`<mi mathvariant="normal">${t}</mi>`:/^[0-9.]+$/.test(o.text??"")?`<mn>${t}</mn>`:o.text&&o.text.length===1&&/[+\-*/=<>±×÷≤≥≠∞∈∉∪∩⊂⊃∧∨¬→←↔∀∃∑∏∫]/.test(o.text)?`<mo>${t}</mo>`:`<mi>${t}</mi>`}case"frac":return`<mfrac><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.argument??[]).map(ft).join("")}</mrow></mfrac>`;case"sup":return`<msup><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.argument??[]).map(ft).join("")}</mrow></msup>`;case"sub":return`<msub><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.argument??[]).map(ft).join("")}</mrow></msub>`;case"subSup":return`<msubsup><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.subscript??[]).map(ft).join("")}</mrow><mrow>${(o.superscript??[]).map(ft).join("")}</mrow></msubsup>`;case"nary":return`<munderover><mo>${b(o.operator??"\u2211")}</mo><mrow>${(o.lower??[]).map(ft).join("")}</mrow><mrow>${(o.upper??[]).map(ft).join("")}</mrow></munderover><mrow>${(o.body??[]).map(ft).join("")}</mrow>`;case"rad":return!o.hideDegree&&o.degree?.length?`<mroot><mrow>${(o.body??[]).map(ft).join("")}</mrow><mrow>${o.degree.map(ft).join("")}</mrow></mroot>`:`<msqrt><mrow>${(o.body??[]).map(ft).join("")}</mrow></msqrt>`;case"delim":return`<mrow><mo>${b(o.open??"(")}</mo>${(o.body??[]).map(ft).join("")}<mo>${b(o.close??")")}</mo></mrow>`;case"func":return`<mrow><mi mathvariant="normal">${(o.base??[]).map(t=>b(t.text??"")).join("")}</mi><mo>&#x2061;</mo>${(o.argument??[]).map(ft).join("")}</mrow>`;case"groupChar":return`<munder><mrow>${(o.base??[]).map(ft).join("")}</mrow><mo>${b(o.operator??"\u23DF")}</mo></munder>`;case"accent":return`<mover accent="true"><mrow>${(o.base??[]).map(ft).join("")}</mrow><mo>${b(o.operator??"\u0302")}</mo></mover>`;case"bar":return`<mover><mrow>${(o.base??[]).map(ft).join("")}</mrow><mo>\xAF</mo></mover>`;case"limLow":return`<munder><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.argument??[]).map(ft).join("")}</mrow></munder>`;case"limUpp":return`<mover><mrow>${(o.base??[]).map(ft).join("")}</mrow><mrow>${(o.argument??[]).map(ft).join("")}</mrow></mover>`;case"eqArr":return`<mtable>${(o.rows??[]).map(t=>`<mtr><mtd>${t.map(ft).join("")}</mtd></mtr>`).join("")}</mtable>`;case"matrix":return`<mrow><mo>(</mo><mtable>${(o.rows??[]).map(t=>`<mtr>${t.map(e=>`<mtd>${ft(e)}</mtd>`).join("")}</mtr>`).join("")}</mtable><mo>)</mo></mrow>`;default:return o.text?`<mi>${b(o.text)}</mi>`:"<mrow></mrow>"}}function Ys(o){let t=o.fontSize??11,e=o.fontName??"Cambria Math";return`<div class="xl-math" data-from-col="${o.from.col}" data-from-row="${o.from.row}" style="position:absolute;z-index:2;font-family:'${b(e)}',serif;font-size:${t}pt;padding:4px;background:white"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>${o.elements.map(ft).join("")}</mrow></math></div>`}function Qs(o){let t=o.from.col,e=o.from.row,n=o.to?.col,r=o.to?.row,s=n!=null&&r!=null?` data-to-col="${n}" data-to-row="${r}"`:"",i=o.linkedCell?` data-linked-cell="${b(o.linkedCell)}"`:"",a=o.inputRange?` data-input-range="${b(o.inputRange)}"`:"",l=o.macro?` data-macro="${b(o.macro)}"`:"",m="";switch(o.type){case"button":case"dialog":m=`<button style="width:100%;height:100%;padding:4px 12px;font-size:13px;border:1px outset #ccc;background:linear-gradient(180deg,#f8f8f8,#e0e0e0);cursor:pointer;border-radius:3px;white-space:nowrap"${l}>${b(o.text??"Button")}</button>`;break;case"checkBox":{let c=o.checked==="checked"?" checked":"",h=o.checked==="mixed"?' data-indeterminate="true"':"";m=`<label style="font-size:13px;display:inline-flex;align-items:center;gap:4px;width:100%;height:100%;padding:2px 4px;cursor:pointer"><input type="checkbox"${c}${h}${i}/> ${b(o.text??"Checkbox")}</label>`;break}case"optionButton":{m=`<label style="font-size:13px;display:inline-flex;align-items:center;gap:4px;width:100%;height:100%;padding:2px 4px;cursor:pointer"><input type="radio" name="group"${o.checked==="checked"?" checked":""}${i}/> ${b(o.text??"Option")}</label>`;break}case"comboBox":{let c=o.dropLines??8;m=`<select style="width:100%;height:100%;padding:2px 4px;font-size:13px;border:1px solid #aaa;background:white"${i}${a} size="1" data-drop-lines="${c}"><option>${b(o.text??"Select...")}</option></select>`;break}case"listBox":{let c=o.dropLines??5,h=o.selType??"single";m=`<select style="width:100%;height:100%;padding:2px;font-size:13px;border:1px solid #aaa;background:white"${i}${a} size="${c}"${h==="multi"||h==="extend"?" multiple":""}><option>${b(o.text??"Item")}</option></select>`;break}case"spinner":{let c=o.min??0,h=o.max??100,d=o.inc??1;m=`<input type="number" value="${o.val??c}" min="${c}" max="${h}" step="${d}" style="width:100%;height:100%;padding:2px 4px;font-size:13px;border:1px solid #aaa"${i}/>`;break}case"scrollBar":{let c=o.min??0,h=o.max??100,d=o.inc??1;m=`<input type="range" value="${o.val??c}" min="${c}" max="${h}" step="${d}" style="width:100%;height:100%"${i}/>`;break}case"label":m=`<span style="font-size:13px;display:flex;align-items:center;width:100%;height:100%;padding:2px 4px">${b(o.text??"Label")}</span>`;break;case"groupBox":m=`<fieldset style="width:100%;height:100%;padding:8px;border:1px solid #999;font-size:13px;margin:0;box-sizing:border-box"><legend>${b(o.text??"Group")}</legend></fieldset>`;break;default:m=`<span style="font-size:13px">[${b(o.type)}]</span>`}return`<div class="xl-fc" data-from-col="${t}" data-from-row="${e}"${s} style="position:absolute;overflow:hidden">${m}</div>`}function Ut(o){let t=0;for(let e=0;e<o.length;e++)t=t*26+(o.charCodeAt(e)-64);return t}function Js(o,t){let e=[],r=(t.includes("!")?t.split("!")[1]:t).match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(r){let s=Ut(r[1]),i=parseInt(r[2],10),a=Ut(r[3]),l=parseInt(r[4],10);for(let m=i;m<=l;m++)for(let c=s;c<=a;c++){let h=o.getCell(m,c);typeof h.value=="number"&&e.push(h.value)}}return e}function So(o,t={}){let e=o.getUsedRange();if(!e)return t.fullDocument!==!1?`<!DOCTYPE html><html><head><title>${b(t.title??"")}</title></head><body><p>Empty worksheet</p></body></html>`:"<table></table>";let{startRow:n,startCol:r,endRow:s,endCol:i}=e;if(t.printAreaOnly&&o.printArea){let N=o.printArea.match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);N&&(r=Ut(N[1]),n=parseInt(N[2],10),i=Ut(N[3]),s=parseInt(N[4],10))}let a=o.getMerges(),l=t.includeConditionalFormatting!==!1?o.getConditionalFormats():[],m=t.includeSparklines!==!1?o.getSparklines():[],c=new Map;for(let A of m){let N=A.location.match(/^([A-Z]+)(\d+)$/);N&&c.set(`${parseInt(N[2],10)},${Ut(N[1])}`,A)}let h=new Map;for(let A of l){if(!A.colorScale&&!A.dataBar&&!A.iconSet)continue;let N=[],j=A.sqref.split(" ");for(let O of j){let z=O.match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(z)for(let V=parseInt(z[2],10);V<=parseInt(z[4],10);V++)for(let st=Ut(z[1]);st<=Ut(z[3]);st++){let ct=o.getCell(V,st);typeof ct.value=="number"&&N.push(ct.value)}}h.set(A,N)}let d=new Map;for(let A of a){let N=A.endRow-A.startRow+1,j=A.endCol-A.startCol+1;d.set(`${A.startRow},${A.startCol}`,{rowSpan:N,colSpan:j});for(let O=A.startRow;O<=A.endRow;O++)for(let z=A.startCol;z<=A.endCol;z++)(O!==A.startRow||z!==A.startCol)&&d.set(`${O},${z}`,"skip")}let f=[];if(t.includeColumnWidths!==!1)for(let A=r;A<=i;A++){let N=o.getColumn(A);if(t.skipHidden&&N?.hidden)continue;let j=N?.width?Math.round(N.width*7.5):void 0;f.push(j?`<col style="width:${j}px">`:"<col>")}let p=new Map,u=o.getCellImages?.();if(u)for(let A of u)p.set(A.cell,A);let x=[];for(let A=n;A<=s;A++){let N=o.getRow(A);if(t.skipHidden&&N?.hidden)continue;let j=N?.height?` style="height:${N.height}px"`:"",O=[];for(let z=r;z<=i;z++){let V=o.getColumn(z);if(t.skipHidden&&V?.hidden)continue;let st=`${A},${z}`,ct=d.get(st);if(ct==="skip")continue;let at=o.getCell(A,z),pt="",v=`${Dt(z)}${A}`,F=p.get(v);if(F)pt=Ks(F);else if(at.richText)pt=at.richText.map(K=>{let nt=K.font?Fn(K.font):"";return nt?`<span style="${nt}">${b(K.text)}</span>`:b(K.text)}).join("");else if(at.value!=null){let K=at.style?.numberFormat?Rs(at.value,at.style.numberFormat.formatCode):String(at.value);pt=b(K)}if(at.hyperlink){let K=b(at.hyperlink.href??""),nt=at.hyperlink.tooltip?` title="${b(at.hyperlink.tooltip)}"`:"";pt=`<a href="${K}"${nt} style="color:#0563C1;text-decoration:underline">${pt}</a>`}if(at.comment){let K=at.comment.richText?at.comment.richText.map(nt=>nt.text).join(""):at.comment.text;pt=`<span title="${b(K)}" style="cursor:help">${pt}</span>`}let B=[];ct&&typeof ct!="string"&&(ct.rowSpan>1&&B.push(`rowspan="${ct.rowSpan}"`),ct.colSpan>1&&B.push(`colspan="${ct.colSpan}"`));let X=[];t.includeStyles!==!1&&at.style&&X.push(Ps(at.style));let W="";if(typeof at.value=="number")for(let K of l){let nt=h.get(K);if(!nt)continue;let et=_s(K,at.value,nt);et.startsWith("data-icon=")?W=` ${et}`:et&&X.push(et)}let Z=X.filter(Boolean).join(";");Z&&B.push(`style="${Z}"`),B.push(`data-cell="${Dt(z)}${A}"`);let J=c.get(st);J&&(pt+=Bs(J,Js(o,J.dataRange)));let mt=B.length?" "+B.join(" "):"";O.push(`<td${mt}${W}>${pt}</td>`)}x.push(`<tr${j}>${O.join("")}</tr>`)}let y=`<div class="xl-sheet-wrapper" style="position:relative;display:inline-block"><table border="0" cellpadding="4" cellspacing="0">
459
+ ${f.length?`<colgroup>${f.join("")}</colgroup>`:""}
460
+ ${x.join(`
461
+ `)}
462
+ </table>`,I="";if(t.includeCharts!==!1){let A=o.getCharts();A.length&&(I=`
463
+ <div class="xl-charts">`+A.map(N=>Us(N,o)).join(`
464
+ `)+"</div>")}let R="",w=o.getImages?.();w?.length&&(R=`
465
+ <div class="xl-images">`+w.map(Gs).join(`
466
+ `)+"</div>");let C="",g=o.getShapes?.();g?.length&&(C=`
467
+ <div class="xl-shapes">`+g.map(zs).join(`
468
+ `)+"</div>");let M="",T=o.getWordArt?.();T?.length&&(M=`
469
+ <div class="xl-wordarts">`+T.map(Ws).join(`
470
+ `)+"</div>");let S="",k=o.getMathEquations?.();k?.length&&(S=`
471
+ <div class="xl-math-equations">`+k.map(Ys).join(`
472
+ `)+"</div>");let L="",P=o.getFormControls?.();P?.length&&(L=`
473
+ <div class="xl-form-controls">`+P.map(Qs).join(`
474
+ `)+"</div>");let U=I+R+C+M+S+L,H="</div>";return t.fullDocument===!1?y+U+H:`<!DOCTYPE html>
475
+ <html lang="en">
476
+ <head>
477
+ <meta charset="UTF-8">
478
+ <title>${b(t.title??t.sheetName??"Export")}</title>
479
+ <style>
480
+ * { box-sizing: border-box; }
481
+ body { font-family: 'Segoe UI', Calibri, sans-serif; margin: 20px; background: #f5f6fa; }
482
+ .xl-sheet-wrapper { position: relative; display: inline-block; }
483
+ table { border-collapse: collapse; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
484
+ td { padding: 4px 8px; border: 1px solid #d4d4d4; vertical-align: bottom; }
485
+ td[data-icon]::before { content: attr(data-icon); margin-right: 4px; }
486
+ .xl-images { position: absolute; top: 0; left: 0; pointer-events: none; }
487
+ .xl-images .xl-img { pointer-events: auto; position: absolute; z-index: 2; }
488
+ .xl-charts { position: absolute; top: 0; left: 0; pointer-events: none; }
489
+ .xl-charts .xl-chart { pointer-events: auto; }
490
+ .xl-shapes { position: absolute; top: 0; left: 0; pointer-events: none; }
491
+ .xl-shapes .xl-shape { pointer-events: auto; }
492
+ .xl-wordarts { position: absolute; top: 0; left: 0; pointer-events: none; }
493
+ .xl-wordarts .xl-wordart { pointer-events: auto; }
494
+ .xl-math-equations { position: absolute; top: 0; left: 0; pointer-events: none; }
495
+ .xl-math-equations .xl-math { pointer-events: auto; }
496
+ .xl-form-controls { position: absolute; top: 0; left: 0; pointer-events: none; }
497
+ .xl-form-controls .xl-fc { pointer-events: auto; z-index: 3; }
498
+ a { color: #0563C1; }
499
+ </style>
500
+ </head>
501
+ <body>
502
+ ${y}${U}${H}
503
+ <script>
504
+ (function(){
505
+ document.querySelectorAll('.xl-sheet-wrapper').forEach(function(wrapper){
506
+ var table = wrapper.querySelector('table');
507
+ if (!table) return;
508
+ var startRow = parseInt((table.rows[0] && table.rows[0].cells[0] || {}).getAttribute && table.rows[0].cells[0].getAttribute('data-cell') ? table.rows[0].cells[0].getAttribute('data-cell').replace(/[A-Z]+/,'') : '1', 10) || 1;
509
+ var startCol = 1;
510
+ var firstCell = table.rows[0] && table.rows[0].cells[0] ? table.rows[0].cells[0].getAttribute('data-cell') : null;
511
+ if (firstCell) {
512
+ var colStr = firstCell.replace(/[0-9]+/g,'');
513
+ startCol = 0;
514
+ for (var ci = 0; ci < colStr.length; ci++) startCol = startCol * 26 + (colStr.charCodeAt(ci) - 64);
515
+ }
516
+ function cellRect(sheetRow, sheetCol) {
517
+ var ri = sheetRow - startRow;
518
+ var colIdx = sheetCol - startCol;
519
+ if (ri < 0) ri = 0;
520
+ if (colIdx < 0) colIdx = 0;
521
+ var tr = table.rows[ri];
522
+ if (!tr) tr = table.rows[table.rows.length - 1] || table.rows[0];
523
+ if (!tr) return {x:0, y:0, w:0, h:0};
524
+ var td = tr.cells[colIdx];
525
+ if (!td) td = tr.cells[tr.cells.length - 1] || tr.cells[0];
526
+ if (!td) return {x:0, y:0, w:0, h:0};
527
+ return {x: td.offsetLeft, y: td.offsetTop, w: td.offsetWidth, h: td.offsetHeight};
528
+ }
529
+ wrapper.querySelectorAll('[data-from-col][data-from-row]').forEach(function(el){
530
+ var fc = parseInt(el.getAttribute('data-from-col'),10);
531
+ var fr = parseInt(el.getAttribute('data-from-row'),10);
532
+ var from = cellRect(fr, fc);
533
+ el.style.left = from.x + 'px';
534
+ el.style.top = from.y + 'px';
535
+ var tc = el.getAttribute('data-to-col');
536
+ var tr2 = el.getAttribute('data-to-row');
537
+ if (tc !== null && tr2 !== null) {
538
+ var to = cellRect(parseInt(tr2,10), parseInt(tc,10));
539
+ var w = to.x + to.w - from.x;
540
+ var h = to.y + to.h - from.y;
541
+ if (w > 0) el.style.width = w + 'px';
542
+ if (h > 0) el.style.height = h + 'px';
543
+ }
544
+ });
545
+ });
546
+ })();
547
+ </script>
548
+ </body>
549
+ </html>`}function ta(o,t={}){let e=o.getSheets(),n=o.getSheetNames(),r=t.sheets??n,s=t.includeTabs!==!1,i=[];for(let c=0;c<e.length;c++){if(!r.includes(n[c])||e[c]._isChartSheet||e[c]._isDialogSheet)continue;let h=So(e[c],{...t,fullDocument:!1,sheetName:n[c]});i.push({name:n[c],html:h})}if(i.length===1&&!s)return So(e[0],t);let a=b(t.title??"Workbook Export"),l=i.map((c,h)=>`<button class="tab${h===0?" active":""}" onclick="switchTab(${h})">${b(c.name)}</button>`).join(""),m=i.map((c,h)=>`<div class="panel${h===0?" active":""}" id="panel-${h}">${c.html}</div>`).join(`
550
+ `);return`<!DOCTYPE html>
551
+ <html lang="en">
552
+ <head>
553
+ <meta charset="UTF-8">
554
+ <title>${a}</title>
555
+ <style>
556
+ * { box-sizing: border-box; }
557
+ body { font-family: 'Segoe UI', Calibri, sans-serif; margin: 0; background: #f5f6fa; }
558
+ .tab-bar { display: flex; background: #2b579a; padding: 0 16px; gap: 2px; position: sticky; top: 0; z-index: 10; }
559
+ .tab { padding: 8px 20px; border: none; background: rgba(255,255,255,.15); color: white; cursor: pointer;
560
+ font-size: 13px; border-radius: 4px 4px 0 0; margin-top: 4px; transition: background .15s; }
561
+ .tab:hover { background: rgba(255,255,255,.3); }
562
+ .tab.active { background: white; color: #2b579a; font-weight: 600; }
563
+ .panel { display: none; padding: 20px; overflow: auto; }
564
+ .panel.active { display: block; }
565
+ .xl-sheet-wrapper { position: relative; display: inline-block; }
566
+ table { border-collapse: collapse; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
567
+ td { padding: 4px 8px; border: 1px solid #d4d4d4; vertical-align: bottom; }
568
+ td[data-icon]::before { content: attr(data-icon); margin-right: 4px; }
569
+ .xl-images { position: absolute; top: 0; left: 0; pointer-events: none; }
570
+ .xl-images .xl-img { pointer-events: auto; position: absolute; z-index: 2; }
571
+ .xl-charts { position: absolute; top: 0; left: 0; pointer-events: none; }
572
+ .xl-charts .xl-chart { pointer-events: auto; }
573
+ .xl-shapes { position: absolute; top: 0; left: 0; pointer-events: none; }
574
+ .xl-shapes .xl-shape { pointer-events: auto; }
575
+ .xl-wordarts { position: absolute; top: 0; left: 0; pointer-events: none; }
576
+ .xl-wordarts .xl-wordart { pointer-events: auto; }
577
+ .xl-math-equations { position: absolute; top: 0; left: 0; pointer-events: none; }
578
+ .xl-math-equations .xl-math { pointer-events: auto; }
579
+ .xl-form-controls { position: absolute; top: 0; left: 0; pointer-events: none; }
580
+ .xl-form-controls .xl-fc { pointer-events: auto; z-index: 3; }
581
+ a { color: #0563C1; }
582
+ </style>
583
+ </head>
584
+ <body>
585
+ ${s?`<div class="tab-bar">${l}</div>`:""}
586
+ ${m}
587
+ <script>
588
+ function switchTab(idx) {
589
+ document.querySelectorAll('.tab').forEach((t,i) => t.classList.toggle('active', i===idx));
590
+ document.querySelectorAll('.panel').forEach((p,i) => p.classList.toggle('active', i===idx));
591
+ // Re-run positioning after tab switch since hidden panels may have 0 dimensions
592
+ setTimeout(positionOverlays, 50);
593
+ }
594
+ function positionOverlays() {
595
+ document.querySelectorAll('.xl-sheet-wrapper').forEach(function(wrapper){
596
+ var table = wrapper.querySelector('table');
597
+ if (!table) return;
598
+ var startRow = 1, startCol = 1;
599
+ var firstCell = table.rows[0] && table.rows[0].cells[0] ? table.rows[0].cells[0].getAttribute('data-cell') : null;
600
+ if (firstCell) {
601
+ startRow = parseInt(firstCell.replace(/[A-Z]+/,''), 10) || 1;
602
+ var colStr = firstCell.replace(/[0-9]+/g,'');
603
+ startCol = 0;
604
+ for (var ci = 0; ci < colStr.length; ci++) startCol = startCol * 26 + (colStr.charCodeAt(ci) - 64);
605
+ }
606
+ function cellRect(sheetRow, sheetCol) {
607
+ var ri = sheetRow - startRow;
608
+ var colIdx = sheetCol - startCol;
609
+ if (ri < 0) ri = 0;
610
+ if (colIdx < 0) colIdx = 0;
611
+ var tr = table.rows[ri];
612
+ if (!tr) tr = table.rows[table.rows.length - 1] || table.rows[0];
613
+ if (!tr) return {x:0, y:0, w:0, h:0};
614
+ var td = tr.cells[colIdx];
615
+ if (!td) td = tr.cells[tr.cells.length - 1] || tr.cells[0];
616
+ if (!td) return {x:0, y:0, w:0, h:0};
617
+ return {x: td.offsetLeft, y: td.offsetTop, w: td.offsetWidth, h: td.offsetHeight};
618
+ }
619
+ wrapper.querySelectorAll('[data-from-col][data-from-row]').forEach(function(el){
620
+ var fc = parseInt(el.getAttribute('data-from-col'),10);
621
+ var fr = parseInt(el.getAttribute('data-from-row'),10);
622
+ var from = cellRect(fr, fc);
623
+ el.style.left = from.x + 'px';
624
+ el.style.top = from.y + 'px';
625
+ var tc = el.getAttribute('data-to-col');
626
+ var tr2 = el.getAttribute('data-to-row');
627
+ if (tc !== null && tr2 !== null) {
628
+ var to = cellRect(parseInt(tr2,10), parseInt(tc,10));
629
+ var w = to.x + to.w - from.x;
630
+ var h = to.y + to.h - from.y;
631
+ if (w > 0) el.style.width = w + 'px';
632
+ if (h > 0) el.style.height = h + 'px';
633
+ }
634
+ });
635
+ });
636
+ }
637
+ positionOverlays();
638
+ </script>
639
+ </body>
640
+ </html>`}function Y(o){if(typeof o=="number")return o;if(typeof o=="boolean")return o?1:0;if(typeof o=="string"){let t=Number(o);return isNaN(t)?0:t}return 0}var Io=class{constructor(){this.calculating=new Set}calculateWorkbook(t){let e=t.getSheets();for(let n of e)this.calculateSheet(n)}calculateSheet(t){this.ws=t;let e=t.readAllCells();for(let{row:n,col:r,cell:s}of e)if(s.formula){this.calculating.clear();let i=this.evaluate(s.formula,n,r);s.value=i}}getCellValue(t,e){let n=this.ws.getCell(t,e);if(n.formula){let r=`${t},${e}`;if(this.calculating.has(r))return 0;this.calculating.add(r);let s=this.evaluate(n.formula,t,e);n.value=s,this.calculating.delete(r)}return n.value??null}resolveRange(t){let n=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"");if(n.includes(":")){let{startRow:i,startCol:a,endRow:l,endCol:m}=Lt(n),c=[];for(let h=i;h<=l;h++)for(let d=a;d<=m;d++)c.push(this.getCellValue(h,d));return c}let{row:r,col:s}=Mt(n);return[this.getCellValue(r,s)]}evaluate(t,e,n){try{return this.parseExpression(t.trim(),0,e,n).value}catch{return"#VALUE!"}}parseExpression(t,e,n,r){return this.parseComparison(t,e,n,r)}parseComparison(t,e,n,r){let s=this.parseAddSub(t,e,n,r),{value:i,pos:a}=s;a=this.skipSpaces(t,a);let l=[">=","<=","<>",">","<","="];for(let m of l)if(t.slice(a,a+m.length)===m){let c=this.parseAddSub(t,a+m.length,n,r),h=i,d=c.value;switch(m){case">=":i=Y(h)>=Y(d);break;case"<=":i=Y(h)<=Y(d);break;case"<>":i=h!==d;break;case">":i=Y(h)>Y(d);break;case"<":i=Y(h)<Y(d);break;case"=":i=h===d||Y(h)===Y(d);break}a=c.pos;break}return{value:i,pos:a}}parseAddSub(t,e,n,r){let s=this.parseMulDiv(t,e,n,r),{value:i,pos:a}=s;for(;a<t.length;)if(a=this.skipSpaces(t,a),t[a]==="+"){let l=this.parseMulDiv(t,a+1,n,r);i=Y(i)+Y(l.value),a=l.pos}else if(t[a]==="-"){let l=this.parseMulDiv(t,a+1,n,r);i=Y(i)-Y(l.value),a=l.pos}else if(t[a]==="&"){let l=this.parseMulDiv(t,a+1,n,r);i=String(i??"")+String(l.value??""),a=l.pos}else break;return{value:i,pos:a}}parseMulDiv(t,e,n,r){let s=this.parsePower(t,e,n,r),{value:i,pos:a}=s;for(;a<t.length;)if(a=this.skipSpaces(t,a),t[a]==="*"){let l=this.parsePower(t,a+1,n,r);i=Y(i)*Y(l.value),a=l.pos}else if(t[a]==="/"){let l=this.parsePower(t,a+1,n,r),m=Y(l.value);i=m===0?"#DIV/0!":Y(i)/m,a=l.pos}else break;return{value:i,pos:a}}parsePower(t,e,n,r){let s=this.parseUnary(t,e,n,r),{value:i,pos:a}=s;if(a=this.skipSpaces(t,a),a<t.length&&t[a]==="^"){let l=this.parseUnary(t,a+1,n,r);i=Math.pow(Y(i),Y(l.value)),a=l.pos}return{value:i,pos:a}}parseUnary(t,e,n,r){if(e=this.skipSpaces(t,e),t[e]==="-"){let s=this.parseAtom(t,e+1,n,r);return{value:-Y(s.value),pos:s.pos}}return t[e]==="+"?this.parseAtom(t,e+1,n,r):this.parseAtom(t,e,n,r)}parseAtom(t,e,n,r){if(e=this.skipSpaces(t,e),t[e]==="("){let l=this.parseExpression(t,e+1,n,r),m=this.skipSpaces(t,l.pos);return t[m]===")"&&m++,{value:l.value,pos:m}}if(t[e]==='"'){let l=e+1,m="";for(;l<t.length;){if(t[l]==='"'){if(t[l+1]==='"'){m+='"',l+=2;continue}break}m+=t[l++]}return{value:m,pos:l+1}}if(/[0-9.]/.test(t[e])){let l=e;for(;l<t.length&&/[0-9.eE+-]/.test(t[l])&&!(l>e&&(t[l]==="+"||t[l]==="-")&&!/[eE]/.test(t[l-1]));)l++;return{value:parseFloat(t.slice(e,l)),pos:l}}if(t.slice(e,e+4).toUpperCase()==="TRUE")return{value:!0,pos:e+4};if(t.slice(e,e+5).toUpperCase()==="FALSE")return{value:!1,pos:e+5};let s=e;for(;s<t.length&&/[A-Za-z0-9_$!:]/.test(t[s]);)s++;let i=t.slice(e,s),a=this.skipSpaces(t,s);if(t[a]==="("){let l=i.toUpperCase(),m=this.parseArgList(t,a,n,r);return{value:this.callFunction(l,m.args,n,r),pos:m.pos}}if(i.includes(":")||/^[A-Z]+[0-9]+$/i.test(i.replace(/\$/g,""))||i.includes("!")){let l=this.resolveRange(i);return{value:(l.length===1,l[0]),pos:s}}return{value:i,pos:s}}parseArgList(t,e,n,r){e++;let s=[];if(this.skipSpaces(t,e)<t.length&&t[this.skipSpaces(t,e)]===")")return{args:[],pos:this.skipSpaces(t,e)+1};for(;e<t.length;){e=this.skipSpaces(t,e);let i=t.slice(e).match(/^([A-Z$]+[0-9$]+:[A-Z$]+[0-9$]+|[A-Za-z]+![A-Z$]+[0-9$]+:[A-Z$]+[0-9$]+)/i);if(i){let a=i[1];s.push(this.resolveRange(a)),e+=a.length}else{let a=this.parseExpression(t,e,n,r);s.push([a.value]),e=a.pos}if(e=this.skipSpaces(t,e),t[e]===","){e++;continue}if(t[e]===")"){e++;break}break}return{args:s,pos:e}}skipSpaces(t,e){for(;e<t.length&&t[e]===" ";)e++;return e}callFunction(t,e,n,r){let s=a=>a.flat(),i=a=>s(a).filter(l=>typeof l=="number"||typeof l=="string"&&l!==""&&!isNaN(Number(l))).map(l=>Number(l));switch(t){case"SUM":return i(e).reduce((a,l)=>a+l,0);case"AVERAGE":{let a=i(e);return a.length?a.reduce((l,m)=>l+m,0)/a.length:0}case"COUNT":return i(e).length;case"COUNTA":return s(e).filter(a=>a!=null&&a!=="").length;case"COUNTBLANK":return s(e).filter(a=>a==null||a==="").length;case"MAX":{let a=i(e);return a.length?Math.max(...a):0}case"MIN":{let a=i(e);return a.length?Math.min(...a):0}case"ABS":return Math.abs(Y(s(e)[0]));case"ROUND":{let a=Y(s(e)[0]),l=Y(s(e)[1]??0),m=Math.pow(10,l);return Math.round(a*m)/m}case"ROUNDUP":{let a=Y(s(e)[0]),l=Y(s(e)[1]??0),m=Math.pow(10,l);return Math.ceil(a*m)/m}case"ROUNDDOWN":{let a=Y(s(e)[0]),l=Y(s(e)[1]??0),m=Math.pow(10,l);return Math.floor(a*m)/m}case"INT":return Math.floor(Y(s(e)[0]));case"MOD":return Y(s(e)[0])%Y(s(e)[1]);case"POWER":return Math.pow(Y(s(e)[0]),Y(s(e)[1]));case"SQRT":return Math.sqrt(Y(s(e)[0]));case"PI":return Math.PI;case"RAND":return Math.random();case"RANDBETWEEN":{let a=Y(s(e)[0]),l=Y(s(e)[1]);return Math.floor(Math.random()*(l-a+1))+a}case"SUMPRODUCT":{if(e.length<2)return 0;let a=e[0].length,l=0;for(let m=0;m<a;m++){let c=1;for(let h of e)c*=Y(h[m]??0);l+=c}return l}case"SUMIF":{let a=e[0]??[],l=String(s(e.slice(1,2))[0]??""),m=e[2]??a,c=0;for(let h=0;h<a.length;h++)this.matchCriteria(a[h],l)&&(c+=Y(m[h]??0));return c}case"COUNTIF":{let a=e[0]??[],l=String(s(e.slice(1,2))[0]??"");return a.filter(m=>this.matchCriteria(m,l)).length}case"IF":{let a=s(e.slice(0,1))[0],l=s(e.slice(1,2))[0]??!0,m=e.length>2?s(e.slice(2,3))[0]??!1:!1;return a?l:m}case"AND":return s(e).every(a=>!!a);case"OR":return s(e).some(a=>!!a);case"NOT":return!s(e)[0];case"IFERROR":{let a=s(e.slice(0,1))[0];return typeof a=="string"&&a.startsWith("#")?s(e.slice(1,2))[0]??"":a}case"IFNA":{let a=s(e.slice(0,1))[0];return a==="#N/A"?s(e.slice(1,2))[0]??"":a}case"CONCATENATE":case"CONCAT":return s(e).map(a=>String(a??"")).join("");case"TEXTJOIN":{let a=String(s(e.slice(0,1))[0]??""),l=!!s(e.slice(1,2))[0],m=s(e.slice(2));return(l?m.filter(h=>h!=null&&h!==""):m).map(h=>String(h??"")).join(a)}case"LEN":return String(s(e)[0]??"").length;case"LEFT":return String(s(e)[0]??"").slice(0,Y(s(e)[1])||1);case"RIGHT":{let a=String(s(e)[0]??""),l=Y(s(e)[1])||1;return a.slice(-l)}case"MID":{let a=String(s(e)[0]??""),l=Y(s(e)[1])-1,m=Y(s(e)[2]);return a.slice(l,l+m)}case"UPPER":return String(s(e)[0]??"").toUpperCase();case"LOWER":return String(s(e)[0]??"").toLowerCase();case"TRIM":return String(s(e)[0]??"").trim().replace(/\s+/g," ");case"SUBSTITUTE":{let a=String(s(e)[0]??""),l=String(s(e)[1]??""),m=String(s(e)[2]??"");return a.split(l).join(m)}case"FIND":case"SEARCH":{let a=String(s(e)[0]??""),l=String(s(e)[1]??""),m=Y(s(e)[2])||1,c=t==="SEARCH"?d=>d.toLowerCase():d=>d,h=c(l).indexOf(c(a),m-1);return h>=0?h+1:"#VALUE!"}case"REPLACE":{let a=String(s(e)[0]??""),l=Y(s(e)[1])-1,m=Y(s(e)[2]),c=String(s(e)[3]??"");return a.slice(0,l)+c+a.slice(l+m)}case"REPT":return String(s(e)[0]??"").repeat(Y(s(e)[1]));case"TEXT":return String(s(e)[0]??"");case"VALUE":return Y(s(e)[0]);case"EXACT":return String(s(e)[0]??"")===String(s(e)[1]??"");case"VLOOKUP":{let a=s(e.slice(0,1))[0],l=e[1]??[],m=Y(s(e.slice(2,3))[0])-1;return"#N/A"}case"INDEX":{let a=e[0]??[],l=Y(s(e.slice(1,2))[0])-1;return a[l]??"#REF!"}case"MATCH":{let a=s(e.slice(0,1))[0],m=(e[1]??[]).findIndex(c=>c===a||String(c)===String(a));return m>=0?m+1:"#N/A"}case"ISBLANK":return s(e)[0]==null||s(e)[0]==="";case"ISNUMBER":return typeof s(e)[0]=="number";case"ISTEXT":return typeof s(e)[0]=="string";case"ISLOGICAL":return typeof s(e)[0]=="boolean";case"ISERROR":{let a=s(e)[0];return typeof a=="string"&&a.startsWith("#")}case"ISNA":return s(e)[0]==="#N/A";case"TYPE":{let a=s(e)[0];return typeof a=="number"?1:typeof a=="string"?2:typeof a=="boolean"?4:1}case"ROW":return n;case"COLUMN":return r;case"NA":return"#N/A";case"TODAY":return new Date().toISOString().slice(0,10);case"NOW":return new Date().toISOString();case"YEAR":return new Date(String(s(e)[0])).getFullYear();case"MONTH":return new Date(String(s(e)[0])).getMonth()+1;case"DAY":return new Date(String(s(e)[0])).getDate();case"GETPIVOTDATA":return String(s(e.slice(0,1))[0]??"")||"#REF!";default:return"#NAME?"}}matchCriteria(t,e){let n=[">=","<=","<>",">","<","="];for(let r of n)if(e.startsWith(r)){let s=e.slice(r.length),i=Y(t),a=Number(s);if(!isNaN(a))switch(r){case">=":return i>=a;case"<=":return i<=a;case"<>":return i!==a;case">":return i>a;case"<":return i<a;case"=":return i===a}switch(r){case"<>":return String(t)!==s;case"=":return String(t)===s}}return typeof t=="number"?t===Number(e):String(t)===e}};var To=new Uint8Array([208,207,17,224,161,177,26,225]),Rt=4294967294,Qt=4294967295,ea=4294967293,Wt=512,De=64,Tn=4096,Ge=128;function xt(o,t,e){o[t]=e&255,o[t+1]=e>>8&255}function lt(o,t,e){o[t]=e&255,o[t+1]=e>>8&255,o[t+2]=e>>16&255,o[t+3]=e>>24&255}function He(o,t){return o[t]|o[t+1]<<8}function Vt(o,t){return(o[t]|o[t+1]<<8|o[t+2]<<16|o[t+3]<<24)>>>0}function oa(o){let t=new Uint8Array(64),e=Math.min(o.length,31);for(let n=0;n<e;n++)xt(t,n*2,o.charCodeAt(n));return xt(t,e*2,0),{bytes:t,size:(e+1)*2}}function An(o){for(let C=0;C<8;C++)if(o[C]!==To[C])throw new Error("Not a CFB file");let e=1<<He(o,30),r=1<<He(o,32),s=Vt(o,56),i=Vt(o,44),a=Vt(o,48),l=Vt(o,60),m=C=>e+C*e,c=[];for(let C=0;C<109;C++){let g=Vt(o,76+C*4);if(g===Qt||g===Rt)break;c.push(g)}let h=[];for(let C of c){let g=m(C);for(let M=0;M<e/4;M++)h.push(Vt(o,g+M*4))}let d=C=>{let g=[],M=C;for(;M!==Rt&&M!==Qt&&g.length<1e4;)g.push(M),M=h[M]??Rt;return g},f=(C,g)=>{let M=d(C),T=new Uint8Array(g),S=0;for(let k of M){let L=m(k),P=Math.min(e,g-S);T.set(o.subarray(L,L+P),S),S+=P}return T},p=d(a),u=new Uint8Array(p.length*e);p.forEach((C,g)=>u.set(o.subarray(m(C),m(C)+e),g*e));let x=[];for(let C=0;C<u.length/Ge;C++){let g=C*Ge,M=He(u,g+64);if(M===0)continue;let T="";for(let S=0;S<(M-2)/2;S++)T+=String.fromCharCode(He(u,g+S*2));x.push({name:T,type:u[g+66],start:Vt(u,g+116),size:Vt(u,g+120),child:Vt(u,g+76)})}let $=x[0],y=new Uint8Array(0);$&&$.start!==Rt&&(y=new Uint8Array(f($.start,$.size)));let I=[];if(l!==Rt){let C=d(l);for(let g of C){let M=m(g);for(let T=0;T<e/4;T++)I.push(Vt(o,M+T*4))}}let R=(C,g)=>{let M=new Uint8Array(g),T=C,S=0;for(;T!==Rt&&S<g;){let k=T*r,L=Math.min(r,g-S);M.set(y.subarray(k,k+L),S),S+=L,T=I[T]??Rt}return M},w=[];for(let C=1;C<x.length;C++){let g=x[C];if(g.type!==2)continue;let M;g.size<s?M=R(g.start,g.size):M=f(g.start,g.size),w.push({name:g.name,data:M})}return w}function ae(){if(typeof globalThis.crypto<"u")return globalThis.crypto;throw new Error("Web Crypto API not available. Requires Node.js 18+ or a modern browser.")}function Pe(o){return ae().getRandomValues(new Uint8Array(o))}async function Zt(o){let t=await ae().subtle.digest("SHA-512",o);return new Uint8Array(t)}async function na(o,t){let e=await ae().subtle.importKey("raw",o,{name:"HMAC",hash:"SHA-512"},!1,["sign"]),n=await ae().subtle.sign("HMAC",e,t);return new Uint8Array(n)}async function xe(o,t,e,n,r){let s=new Uint8Array(o.length*2);for(let d=0;d<o.length;d++)s[d*2]=o.charCodeAt(d)&255,s[d*2+1]=o.charCodeAt(d)>>8&255;let i=new Uint8Array(t.length+s.length);i.set(t),i.set(s,t.length);let a=await Zt(i);for(let d=0;d<e;d++){let f=new Uint8Array(4+a.length);f[0]=d&255,f[1]=d>>8&255,f[2]=d>>16&255,f[3]=d>>24&255,f.set(a,4),a=await Zt(f)}let l=new Uint8Array(a.length+r.length);l.set(a),l.set(r,a.length);let m=await Zt(l),c=n/8;if(m.length>=c)return m.subarray(0,c);let h=new Uint8Array(c);return h.set(m),h.fill(54,m.length),h}async function ue(o,t,e){let n=await ae().subtle.importKey("raw",o,{name:"AES-CBC"},!1,["encrypt"]),r=await ae().subtle.encrypt({name:"AES-CBC",iv:t},n,e);return new Uint8Array(r).subarray(0,e.length)}async function qe(o,t,e){let n=ae().subtle,r=e.subarray(e.length-16),s=new Uint8Array(16).fill(16),i=new Uint8Array(16);for(let f=0;f<16;f++)i[f]=s[f]^r[f];let a=await n.importKey("raw",o,{name:"AES-CBC"},!1,["encrypt"]),l=await n.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},a,i),m=new Uint8Array(l).subarray(0,16),c=Kt(e,m),h=await n.importKey("raw",o,{name:"AES-CBC"},!1,["decrypt"]),d=await n.decrypt({name:"AES-CBC",iv:t},h,c);return new Uint8Array(d)}function ge(o,t){let e=o.length%t;if(e===0)return o;let n=new Uint8Array(o.length+(t-e));return n.set(o),n}function Kt(...o){let t=0;for(let r of o)t+=r.length;let e=new Uint8Array(t),n=0;for(let r of o)e.set(r,n),n+=r.length;return e}var kn=new Uint8Array([254,167,210,118,59,75,158,121]),Dn=new Uint8Array([215,170,15,109,48,97,52,78]),Pn=new Uint8Array([20,110,11,231,171,172,208,214]),ra=new Uint8Array([95,178,173,1,12,185,225,246]),sa=new Uint8Array([160,103,127,2,178,44,132,51]);function aa(o,t,e,n,r,s,i,a){let l=m=>{let c="",h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let d=0;d<m.length;d+=3){let f=m[d],p=m[d+1]??0,u=m[d+2]??0,x=f<<16|p<<8|u;c+=h[x>>18&63]+h[x>>12&63],c+=d+1<m.length?h[x>>6&63]:"=",c+=d+2<m.length?h[x&63]:"="}return c};return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
641
+ <encryption xmlns="http://schemas.microsoft.com/office/2006/encryption"
642
+ xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
643
+ <keyData saltSize="16" blockSize="16" keyBits="256" hashSize="64"
644
+ cipherAlgorithm="AES" cipherChaining="ChainingModeCBC"
645
+ hashAlgorithm="SHA512"
646
+ saltValue="${l(o)}"/>
647
+ <dataIntegrity encryptedHmacKey="${l(r)}"
648
+ encryptedHmacValue="${l(s)}"/>
649
+ <keyEncryptors>
650
+ <keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
651
+ <p:encryptedKey spinCount="${a}" saltSize="16" blockSize="16"
652
+ keyBits="256" hashSize="64"
653
+ cipherAlgorithm="AES" cipherChaining="ChainingModeCBC"
654
+ hashAlgorithm="SHA512"
655
+ saltValue="${l(i)}"
656
+ encryptedVerifierHashInput="${l(e)}"
657
+ encryptedVerifierHashValue="${l(n)}"
658
+ encryptedKeyValue="${l(t)}"/>
659
+ </keyEncryptor>
660
+ </keyEncryptors>
661
+ </encryption>`}function se(o){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=new Uint8Array(128);for(let m=0;m<t.length;m++)e[t.charCodeAt(m)]=m;let n=o.replace(/[^A-Za-z0-9+/]/g,""),r=o.endsWith("==")?2:o.endsWith("=")?1:0,i=(n.length+r)/4*3-r,a=new Uint8Array(i),l=0;for(let m=0;m<n.length;m+=4){let c=e[n.charCodeAt(m)],h=e[n.charCodeAt(m+1)],d=e[n.charCodeAt(m+2)],f=e[n.charCodeAt(m+3)],p=c<<18|h<<12|d<<6|f;l<i&&(a[l++]=p>>16&255),l<i&&(a[l++]=p>>8&255),l<i&&(a[l++]=p&255)}return a}function Gt(o,t){let e=new RegExp(`${t}="([^"]*)"`,"i"),n=o.match(e);return n?n[1]:""}function ia(o){return{keySalt:se(Gt(o.split("keyData")[1]??o,"saltValue")),passwordSalt:se(Gt(o.split("encryptedKey")[1]??o,"saltValue")),spinCount:parseInt(Gt(o,"spinCount"),10)||1e5,keyBits:parseInt(Gt(o.split("encryptedKey")[1]??o,"keyBits"),10)||256,encryptedVerifierInput:se(Gt(o,"encryptedVerifierHashInput")),encryptedVerifierHash:se(Gt(o,"encryptedVerifierHashValue")),encryptedKeyValue:se(Gt(o,"encryptedKeyValue")),encryptedHmacKey:se(Gt(o,"encryptedHmacKey")),encryptedHmacValue:se(Gt(o,"encryptedHmacValue"))}}function Re(o){let t=o.length*2,e=(4-t%4)%4,n=new Uint8Array(4+t+e);lt(n,0,t);for(let r=0;r<o.length;r++)xt(n,4+r*2,o.charCodeAt(r));return n}function la(){let o="Microsoft.Container.DataSpaces",t=o.length*2,e=new Uint8Array(4+t+12);lt(e,0,t);for(let r=0;r<o.length;r++)xt(e,4+r*2,o.charCodeAt(r));let n=4+t;return xt(e,n,1),xt(e,n+2,0),xt(e,n+4,1),xt(e,n+6,0),xt(e,n+8,1),xt(e,n+10,0),e}function ca(){let o=Re("EncryptedPackage"),t=Re("StrongEncryptionDataSpace"),e=8+o.length+t.length,n=new Uint8Array(12+e);lt(n,0,8),lt(n,4,1),lt(n,8,e);let r=12;return lt(n,r,1),r+=4,lt(n,r,0),r+=4,n.set(o,r),r+=o.length,n.set(t,r),n}function ma(){let o=Re("StrongEncryptionTransform"),t=new Uint8Array(8+o.length);return lt(t,0,8),lt(t,4,1),t.set(o,8),t}function ha(){let o=Re("{FF9A3F03-56EF-4613-BDD5-5A41C1D07246}"),t=Re("Microsoft.Container.EncryptionTransform"),e=4+o.length+t.length+12,n=new Uint8Array(4+e);lt(n,0,e);let r=4;return lt(n,r,1),r+=4,n.set(o,r),r+=o.length,n.set(t,r),r+=t.length,xt(n,r,1),xt(n,r+2,0),r+=4,xt(n,r,1),xt(n,r+2,0),r+=4,xt(n,r,1),xt(n,r+2,0),n}function da(o,t){let e=la(),n=ca(),r=ma(),s=ha(),i=[{name:"Root Entry",type:5,childId:2,leftId:-1,rightId:-1,size:0},{name:"DataSpaces",type:1,childId:5,leftId:-1,rightId:-1,size:0},{name:"EncryptionInfo",type:2,childId:-1,leftId:1,rightId:3,data:o,size:o.length},{name:"EncryptedPackage",type:2,childId:-1,leftId:-1,rightId:-1,data:t,size:t.length},{name:"Version",type:2,childId:-1,leftId:-1,rightId:-1,data:e,size:e.length},{name:"DataSpaceMap",type:2,childId:-1,leftId:4,rightId:6,data:n,size:n.length},{name:"DataSpaceInfo",type:1,childId:8,leftId:-1,rightId:7,size:0},{name:"TransformInfo",type:1,childId:9,leftId:-1,rightId:-1,size:0},{name:"StrongEncryptionDataSpace",type:2,childId:-1,leftId:-1,rightId:-1,data:r,size:r.length},{name:"StrongEncryptionTransform",type:1,childId:10,leftId:-1,rightId:-1,size:0},{name:"Primary",type:2,childId:-1,leftId:-1,rightId:-1,data:s,size:s.length}],a=new Uint8Array(0),l=0,m=[],c=[];for(let S of i){if(!S.data){m.push({inMini:!1,miniStart:0,regularStart:0});continue}if(S.data.length<Tn){let k=Math.ceil(S.data.length/De)*De,L=new Uint8Array(a.length+k);L.set(a),L.set(S.data,a.length),m.push({inMini:!0,miniStart:l/De,regularStart:0}),l+=k,a=L}else m.push({inMini:!1,miniStart:0,regularStart:0})}let h=i.length,d=Math.ceil(h*Ge/Wt),f=Math.ceil(a.length/Wt),p=1+d+f;for(let S=0;S<i.length;S++)i[S].data&&!m[S].inMini&&(m[S].regularStart=p,c.push({data:i[S].data,startSector:p}),p+=Math.ceil(i[S].data.length/Wt));let u=p+1,x=new Uint32Array(Math.max(u+8,128));x.fill(Qt),x[0]=ea;for(let S=1;S<1+d;S++)x[S]=S<d?S+1:Rt;for(let S=1+d;S<1+d+f;S++)x[S]=S<d+f?S+1:Rt;for(let S of c){let k=Math.ceil(S.data.length/Wt);for(let L=0;L<k;L++)x[S.startSector+L]=L<k-1?S.startSector+L+1:Rt}let $=Math.max(Math.ceil(a.length/De),1),y=new Uint32Array(Math.max($,128));y.fill(Qt);for(let S=0;S<i.length;S++)if(i[S].data&&m[S].inMini){let k=Math.ceil(i[S].data.length/De),L=m[S].miniStart;for(let P=0;P<k;P++)y[L+P]=P<k-1?L+P+1:Rt}let I=p;x[I]=Rt;let R=(1+I+1)*Wt,w=new Uint8Array(R);w.set(To,0),xt(w,24,62),xt(w,26,3),xt(w,28,65534),xt(w,30,9),xt(w,32,6),lt(w,44,1),lt(w,48,1),lt(w,56,Tn),lt(w,60,I),lt(w,64,1),lt(w,68,Rt),lt(w,72,0);for(let S=0;S<109;S++)lt(w,76+S*4,Qt);lt(w,76,0);let C=Wt;for(let S=0;S<128;S++)lt(w,C+S*4,x[S]);let g=Wt*2;for(let S=0;S<i.length;S++){let k=i[S],L=g+S*Ge,P=oa(k.name);w.set(P.bytes,L),xt(w,L+64,P.size),w[L+66]=k.type,w[L+67]=1,lt(w,L+68,k.leftId>=0?k.leftId:Qt),lt(w,L+72,k.rightId>=0?k.rightId:Qt),lt(w,L+76,k.childId>=0?k.childId:Qt),k.type===5?(lt(w,L+116,f>0?1+d:Rt),lt(w,L+120,a.length)):k.data?(m[S].inMini?lt(w,L+116,m[S].miniStart):lt(w,L+116,m[S].regularStart),lt(w,L+120,k.data.length)):(lt(w,L+116,Rt),lt(w,L+120,0))}let M=Wt*(2+d);w.set(a,M);for(let S of c)w.set(S.data,Wt*(1+S.startSector));let T=Wt*(1+I);for(let S=0;S<128;S++)lt(w,T+S*4,y[S]);return w}async function fa(o,t,e){let n=e?.spinCount??1e5,r=Pe(16),s=Pe(16),i=Pe(16),a=await xe(t,s,n,256,Pn),l=Pe(32),m=await ue(a,s,ge(l,16)),c=await xe(t,s,n,256,kn),h=await ue(c,s,ge(i,16)),d=await Zt(i),f=await xe(t,s,n,256,Dn),p=await ue(f,s,ge(d,16)),u=o,x=4096,$=[];for(let H=0;H<u.length;H+=x){let G=u.subarray(H,Math.min(H+x,u.length)),E=ge(G,16),_=H/x,A=new Uint8Array(4);A[0]=_&255,A[1]=_>>8&255,A[2]=_>>16&255,A[3]=_>>24&255;let j=(await Zt(Kt(r,A))).subarray(0,16),O=await ue(l,j,E);$.push(O)}let y=Kt(...$),I=new Uint8Array(8);lt(I,0,o.length);let R=Kt(I,y),w=Pe(64),C=(await Zt(Kt(r,ra))).subarray(0,16),g=await ue(l,C,ge(w,16)),M=await na(w,R),T=(await Zt(Kt(r,sa))).subarray(0,16),S=await ue(l,T,ge(M,16)),k=aa(r,m,h,p,g,S,s,n),L=new TextEncoder().encode(k),P=new Uint8Array(8);xt(P,0,4),xt(P,2,4),lt(P,4,64);let U=Kt(P,L);return da(U,R)}async function pa(o,t){let e=An(o),n=e.find(I=>I.name==="EncryptionInfo"),r=e.find(I=>I.name==="EncryptedPackage");if(!n||!r)throw new Error("Not an encrypted Office file");let s=n.data.subarray(8),i=new TextDecoder().decode(s),a=ia(i),l=await xe(t,a.passwordSalt,a.spinCount,a.keyBits,Pn),m;try{m=await qe(l,a.passwordSalt,a.encryptedKeyValue),m=m.subarray(0,a.keyBits/8)}catch{throw new Error("Incorrect password")}let c=await xe(t,a.passwordSalt,a.spinCount,a.keyBits,kn),h;try{h=await qe(c,a.passwordSalt,a.encryptedVerifierInput),h=h.subarray(0,16)}catch{throw new Error("Incorrect password")}let d=await xe(t,a.passwordSalt,a.spinCount,a.keyBits,Dn);try{let I=await qe(d,a.passwordSalt,a.encryptedVerifierHash),R=await Zt(h);for(let w=0;w<64;w++)if(I[w]!==R[w])throw new Error("Incorrect password")}catch(I){throw I.message==="Incorrect password"?I:new Error("Incorrect password")}let f=a.keySalt,p=Vt(r.data,0),u=r.data.subarray(8),x=4096,$=[];for(let I=0;I<u.length;I+=x){let R=I+x;R>u.length&&(R=u.length);let w=Math.ceil((R-I)/16)*16,C=u.subarray(I,I+w),g=I/x,M=new Uint8Array(4);M[0]=g&255,M[1]=g>>8&255,M[2]=g>>16&255,M[3]=g>>24&255;let S=(await Zt(Kt(f,M))).subarray(0,16);try{let k=await qe(m,S,C);$.push(k)}catch{throw new Error("Decryption failed \u2014 data may be corrupted")}}return Kt(...$).subarray(0,p)}function ua(o){if(o.length<8)return!1;for(let t=0;t<8;t++)if(o[t]!==To[t])return!1;try{return An(o).some(e=>e.name==="EncryptionInfo")}catch{return!1}}function ga(o){return o<128?new Uint8Array([o]):o<256?new Uint8Array([129,o]):o<65536?new Uint8Array([130,o>>8,o&255]):new Uint8Array([131,o>>16&255,o>>8&255,o&255])}function Ct(o,t){let e=ga(t.length),n=new Uint8Array(1+e.length+t.length);return n[0]=o,n.set(e,1),n.set(t,1+e.length),n}function bt(...o){let t=0;for(let r of o)t+=r.length;let e=new Uint8Array(t),n=0;for(let r of o)e.set(r,n),n+=r.length;return Ct(48,e)}function ye(...o){let t=0;for(let r of o)t+=r.length;let e=new Uint8Array(t),n=0;for(let r of o)e.set(r,n),n+=r.length;return Ct(49,e)}function Bt(o){let t=[40*o[0]+o[1]];for(let e=2;e<o.length;e++){let n=o[e];if(n<128)t.push(n);else{let r=[];for(;n>0;)r.unshift(n&127),n>>=7;for(let s=0;s<r.length-1;s++)r[s]|=128;t.push(...r)}}return Ct(6,new Uint8Array(t))}function Ao(o){if(o===0)return Ct(2,new Uint8Array([0]));let t=[],e=o;for(;e>0;)t.unshift(e&255),e>>=8;return t[0]&128&&t.unshift(0),Ct(2,new Uint8Array(t))}function Ke(o){return Ct(4,o)}function xa(o){return Ct(12,new TextEncoder().encode(o))}function Ze(o,t){return Ct(160|o,t)}var ko=[2,16,840,1,101,3,4,2,1],$a=[1,2,840,113549,1,1,1],ya=[1,2,840,113549,1,1,11],wa=[1,2,840,113549,1,7,2];var ba=[1,2,840,113549,1,9,3],va=[1,2,840,113549,1,9,4],Ca=[1,2,840,113549,1,9,5],Rn=[1,3,6,1,4,1,311,2,1,4];function Me(o){let t=o.replace(/-----[A-Z\s]+-----/g,"").replace(/\s+/g,""),e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}function Ye(o){let t="";for(let e=0;e<o.length;e++)t+=String.fromCharCode(o[e]);return btoa(t)}function $e(o,t){let e=o[t],n=t+1,r=o[n++];if(r&128){let s=r&127;r=0;for(let i=0;i<s;i++)r=r<<8|o[n++]}return{tag:e,content:o.slice(n,n+r),next:n+r}}async function Ee(o){let t=await crypto.subtle.digest("SHA-256",o);return new Uint8Array(t)}async function Do(o){return crypto.subtle.importKey("pkcs8",o,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["sign"])}async function Mn(o,t){let e=await crypto.subtle.sign("RSASSA-PKCS1-v1_5",o,t);return new Uint8Array(e)}async function Fa(o,t,e,n){let r=await Ee(t),s=$e(e,0),i=$e(s.content,0),a=0,l=$e(i.content,a);l.tag===160&&(a=l.next,l=$e(i.content,a));let m=l.content;a=l.next,l=$e(i.content,a),a=l.next,l=$e(i.content,a);let c=i.content.slice(a,l.next),d=new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)+"Z",f=new TextEncoder().encode(d),p=bt(Bt(ko),Ct(5,new Uint8Array(0))),u=[bt(Bt(ba),ye(Bt(o))),bt(Bt(Ca),ye(Ct(23,f))),bt(Bt(va),ye(Ke(r)))],x=new Uint8Array(0);for(let M of u){let T=new Uint8Array(x.length+M.length);T.set(x),T.set(M,x.length),x=T}let $=Ct(49,x),y=Ct(160,x),R=await Mn(n,$),w=bt(Ao(1),bt(c,Ct(2,m)),p,y,bt(Bt($a),Ct(5,new Uint8Array(0))),Ke(R)),C=bt(Bt(o),Ze(0,Ke(t))),g=bt(Ao(1),ye(p),C,Ze(0,e),ye(w));return bt(Bt(wa),Ze(0,g))}var Sa=[2,5,4,3];function Ia(o){let t=new Uint8Array(1+o.length);return t[0]=0,t.set(o,1),Ct(3,t)}async function Ta(o,t,e){let n=Me(t),r=await Do(n),s=bt(Bt(ya),Ct(5,new Uint8Array(0))),i=bt(ye(bt(Bt(Sa),xa(o)))),a=new Date,l=new Date(a.getFullYear()+10,a.getMonth(),a.getDate()),m=C=>{let g=C.toISOString().replace(/[-:T]/g,"").slice(2,14)+"Z";return Ct(23,new TextEncoder().encode(g))},c=bt(m(a),m(l)),h=Ct(2,new Uint8Array([1])),d=Ze(0,Ao(2)),f=bt(d,h,s,i,c,i,Ct(48,e.slice((e.indexOf(48,1)>=0,0)))),u=bt(d,h,s,i,c,i,e),x=await Ee(u),$=await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,u),y=new Uint8Array($),I=bt(u,s,Ia(y));return`-----BEGIN CERTIFICATE-----
662
+ ${Ye(I).match(/.{1,64}/g).join(`
663
+ `)}
664
+ -----END CERTIFICATE-----`}async function En(o,t){let e=Me(t.certificate),n=Me(t.privateKey),r=await Do(n),s=new TextEncoder,i=new Map,a=[];for(let[p,u]of o){let x=await Ee(u),$=Ye(x);a.push(`<Reference URI="/${p}?ContentType=${Aa(p)}">
665
+ <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
666
+ <DigestValue>${$}</DigestValue>
667
+ </Reference>`)}let l=`<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
668
+ <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
669
+ <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
670
+ ${a.join(`
671
+ `)}
672
+ </SignedInfo>`,m=s.encode(l),c=await Mn(r,await Ee(m)),h=Ye(c),d=Ye(e),f=`<?xml version="1.0" encoding="UTF-8"?>
673
+ <Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="idPackageSignature">
674
+ ${l}
675
+ <SignatureValue>${h}</SignatureValue>
676
+ <KeyInfo>
677
+ <X509Data>
678
+ <X509Certificate>${d}</X509Certificate>
679
+ </X509Data>
680
+ </KeyInfo>
681
+ <Object>
682
+ <SignatureProperties>
683
+ <SignatureProperty Id="idSignatureTime" Target="#idPackageSignature">
684
+ <mdssi:SignatureTime xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature">
685
+ <mdssi:Format>YYYY-MM-DDThh:mm:ssTZD</mdssi:Format>
686
+ <mdssi:Value>${new Date().toISOString()}</mdssi:Value>
687
+ </mdssi:SignatureTime>
688
+ </SignatureProperty>
689
+ </SignatureProperties>
690
+ </Object>
691
+ </Signature>`;return i.set("_xmlsignatures/sig1.xml",s.encode(f)),i.set("_xmlsignatures/origin.sigs",new Uint8Array(0)),i.set("_xmlsignatures/_rels/origin.sigs.rels",s.encode(`<?xml version="1.0" encoding="UTF-8"?>
692
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
693
+ <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature" Target="sig1.xml"/>
694
+ </Relationships>`)),i}function Aa(o){return o.endsWith(".xml")?"application/xml":o.endsWith(".rels")?"application/vnd.openxmlformats-package.relationships+xml":o.endsWith(".bin")?"application/vnd.ms-office.vbaProject":"application/octet-stream"}async function _n(o,t){let e=Me(t.certificate),n=Me(t.privateKey),r=await Do(n),s=await Ee(o),i=bt(bt(Bt(Rn),bt(Bt(ko),Ct(5,new Uint8Array(0)))),bt(bt(Bt(ko),Ct(5,new Uint8Array(0))),Ke(s))),a=await Fa(Rn,i,e,r),l=new Uint8Array(8+a.length),m=new DataView(l.buffer);return m.setUint32(0,3,!0),m.setUint32(4,a.length,!0),l.set(a,8),l}async function ka(o,t,e){let n=await En(o,t),r;return e&&(r=await _n(e,t)),{packageSignatureEntries:n,vbaSignature:r}}export{jt as CellError,bs as Colors,Io as FormulaEngine,ws as NumFmt,le as SharedStrings,ze as StyleBuilder,ie as StyleRegistry,ys as Styles,Se as VbaProject,ke as Workbook,Jt as Worksheet,Ro as a1ToR1C1,Qn as applyChartTemplate,be as base64ToBytes,Nn as bytesToBase64,Mt as cellRefToIndices,Dt as colIndexToLetter,to as colLetterToIndex,Fs as csvToWorkbook,eo as dateToSerial,pa as decryptWorkbook,tr as deserializeChartTemplate,fa as encryptWorkbook,On as formulaFromR1C1,jn as formulaToR1C1,Ta as generateTestCertificate,Yt as indicesToCellRef,ua as isEncrypted,Lt as parseRange,oo as pxToEmu,Mo as r1c1ToA1,Yn as saveChartTemplate,Jn as serializeChartTemplate,En as signPackage,_n as signVbaProject,ka as signWorkbook,vt as style,ta as workbookToHtml,Is as workbookToJson,vs as worksheetToCsv,So as worksheetToHtml,vn as worksheetToJson};