@cj-tech-master/excelts 1.6.3-canary.20251224193141.8bff9dd → 1.6.3-canary.20251226035947.ef0b4f2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/README_zh.md +5 -4
- package/dist/browser/excelts.esm.js +2447 -3094
- package/dist/browser/excelts.esm.js.map +1 -1
- package/dist/browser/excelts.esm.min.js +23 -25
- package/dist/browser/excelts.iife.js +2448 -3095
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +23 -25
- package/dist/cjs/csv/csv-core.js +2 -2
- package/dist/cjs/csv/csv-stream.js +1 -1
- package/dist/cjs/csv/csv.base.js +10 -27
- package/dist/cjs/csv/csv.js +4 -12
- package/dist/cjs/doc/column.js +21 -0
- package/dist/cjs/doc/worksheet.js +4 -0
- package/dist/cjs/stream/xlsx/workbook-writer.js +4 -4
- package/dist/cjs/stream/xlsx/worksheet-writer.js +8 -1
- package/dist/cjs/utils/datetime.js +648 -0
- package/dist/cjs/utils/parse-sax.js +1190 -12
- package/dist/cjs/utils/unzip/zip-parser.js +11 -0
- package/dist/cjs/utils/zip/compress.base.js +3 -0
- package/dist/cjs/utils/zip/compress.browser.js +74 -30
- package/dist/cjs/utils/zip/deflate-fallback.js +575 -0
- package/dist/cjs/utils/zip/streaming-zip.js +264 -0
- package/dist/cjs/xlsx/xform/sheet/col-breaks-xform.js +38 -0
- package/dist/cjs/xlsx/xform/sheet/page-breaks-xform.js +13 -1
- package/dist/cjs/xlsx/xform/sheet/row-breaks-xform.js +11 -13
- package/dist/cjs/xlsx/xform/sheet/worksheet-xform.js +7 -2
- package/dist/cjs/xlsx/xlsx.browser.js +10 -53
- package/dist/cjs/xlsx/xlsx.js +27 -59
- package/dist/esm/csv/csv-core.js +2 -2
- package/dist/esm/csv/csv-stream.js +1 -1
- package/dist/esm/csv/csv.base.js +10 -24
- package/dist/esm/csv/csv.js +4 -12
- package/dist/esm/doc/column.js +21 -0
- package/dist/esm/doc/worksheet.js +4 -0
- package/dist/esm/stream/xlsx/workbook-writer.js +1 -1
- package/dist/esm/stream/xlsx/worksheet-writer.js +8 -1
- package/dist/esm/utils/datetime.js +639 -0
- package/dist/esm/utils/parse-sax.js +1188 -12
- package/dist/esm/utils/unzip/zip-parser.js +11 -0
- package/dist/esm/utils/zip/compress.base.js +3 -0
- package/dist/esm/utils/zip/compress.browser.js +76 -31
- package/dist/esm/utils/zip/deflate-fallback.js +570 -0
- package/dist/esm/utils/zip/streaming-zip.js +259 -0
- package/dist/esm/xlsx/xform/sheet/col-breaks-xform.js +35 -0
- package/dist/esm/xlsx/xform/sheet/page-breaks-xform.js +13 -1
- package/dist/esm/xlsx/xform/sheet/row-breaks-xform.js +11 -13
- package/dist/esm/xlsx/xform/sheet/worksheet-xform.js +7 -2
- package/dist/esm/xlsx/xlsx.browser.js +10 -53
- package/dist/esm/xlsx/xlsx.js +27 -59
- package/dist/types/csv/csv-core.d.ts +6 -6
- package/dist/types/csv/csv.base.d.ts +4 -3
- package/dist/types/doc/column.d.ts +6 -0
- package/dist/types/doc/worksheet.d.ts +3 -1
- package/dist/types/stream/xlsx/workbook-writer.d.ts +1 -1
- package/dist/types/stream/xlsx/worksheet-writer.d.ts +3 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/utils/datetime.d.ts +85 -0
- package/dist/types/utils/parse-sax.d.ts +108 -1
- package/dist/types/utils/unzip/zip-parser.d.ts +5 -0
- package/dist/types/utils/zip/compress.base.d.ts +3 -0
- package/dist/types/utils/zip/compress.browser.d.ts +27 -18
- package/dist/types/utils/zip/deflate-fallback.d.ts +39 -0
- package/dist/types/utils/zip/streaming-zip.d.ts +96 -0
- package/dist/types/xlsx/xform/sheet/col-breaks-xform.d.ts +16 -0
- package/dist/types/xlsx/xform/sheet/page-breaks-xform.d.ts +4 -0
- package/dist/types/xlsx/xform/sheet/row-breaks-xform.d.ts +4 -0
- package/package.json +7 -28
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v1.6.3-canary.
|
|
2
|
+
* @cj-tech-master/excelts v1.6.3-canary.20251226035947.ef0b4f2
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2025 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const l=/^[A-Z]+\d+$/,u={_dictionary:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_l2nFill:0,_l2n:{},_n2l:[],_level(e){return e<=26?1:e<=676?2:3},_fill(e){let t,n,r,i,a,o=1;if(e>=4)throw Error(`Out of bounds. Excel supports columns from 1 to 16384`);if(this._l2nFill<1&&e>=1){for(;o<=26;)t=this._dictionary[o-1],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&e>=2){for(o=27;o<=702;)n=o-27,r=n%26,i=Math.floor(n/26),t=this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&e>=3){for(o=703;o<=16384;)n=o-703,r=n%26,i=Math.floor(n/26)%26,a=Math.floor(n/676),t=this._dictionary[a]+this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=3}},l2n(e){if(this._l2n[e]||this._fill(e.length),!this._l2n[e])throw Error(`Out of bounds. Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw Error(`${e} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},validateAddress(e){if(!l.test(e))throw Error(`Invalid Address: ${e}`);return!0},decodeAddress(e){let t=e.length<5&&this._hash[e];if(t)return t;let n=!1,r=``,i=0,a=!1,o=``,s=0;for(let t=0,c;t<e.length;t++)if(c=e.charCodeAt(t),!a&&c>=65&&c<=90)n=!0,r+=e[t],i=i*26+c-64;else if(c>=48&&c<=57)a=!0,o+=e[t],s=s*10+c-48;else if(a&&n&&c!==36)break;if(!n)i=void 0;else if(i>16384)throw Error(`Out of bounds. Invalid column letter: ${r}`);a||(s=void 0),e=r+o;let c={address:e,col:i,row:s,$col$row:`$${r}$${o}`};return i<=100&&s<=100&&(this._hash[e]=c,this._hash[c.$col$row]=c),c},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,t){return u.n2l(t)+e},encode(...e){switch(e.length){case 2:return u.encodeAddress(e[0],e[1]);case 4:return`${u.encodeAddress(e[0],e[1])}:${u.encodeAddress(e[2],e[3])}`;default:throw Error(`Can only encode with 2 or 4 arguments`)}},inRange(e,t){let[n,r,,i,a]=e,[o,s]=t;return o>=n&&o<=i&&s>=r&&s<=a}};var d=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,t,n,r,i){if(typeof e==`string`&&typeof t==`string`){let r=u.decodeAddress(e),i=u.decodeAddress(t);this.model={top:Math.min(r.row,i.row),left:Math.min(r.col,i.col),bottom:Math.max(r.row,i.row),right:Math.max(r.col,i.col),sheetName:typeof n==`string`?n:void 0}}else typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`&&(this.model={top:Math.min(e,n),left:Math.min(t,r),bottom:Math.max(e,n),right:Math.max(t,r),sheetName:i})}decode(t){switch(t.length){case 5:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&typeof t[4]==`string`&&this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:typeof t[0]==`string`&&typeof t[1]==`string`&&typeof t[2]==`string`&&this.setTLBR(t[0],t[1],t[2]);break;case 2:typeof t[0]==`string`&&typeof t[1]==`string`&&this.setTLBR(t[0],t[1]);break;case 1:{let n=t[0];if(n instanceof e)this.model={top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right,sheetName:n.sheetName};else if(Array.isArray(n))this.decode(n);else if(typeof n==`object`&&`top`in n&&`left`in n&&`bottom`in n&&`right`in n)this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName};else if(typeof n==`string`){let e=u.decodeEx(n);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw Error(`Invalid number of arguments to _getDimensions() - ${t.length}`)}}get top(){return this.model.top||1}set top(e){this.model.top=e}get left(){return this.model.left||1}set left(e){this.model.left=e}get bottom(){return this.model.bottom||1}set bottom(e){this.model.bottom=e}get right(){return this.model.right||1}set right(e){this.model.right=e}get sheetName(){return this.model.sheetName}set sheetName(e){this.model.sheetName=e}get _serialisedSheetName(){let{sheetName:e}=this.model;return e?/^[a-zA-Z0-9]*$/.test(e)?`${e}!`:`'${e}'!`:``}expand(e,t,n,r){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||r>this.right)&&(this.right=r)}expandRow(e){if(e){let{dimensions:t,number:n}=e;t&&this.expand(n,t.min,n,t.max)}}expandToAddress(e){let t=u.decodeEx(e);`row`in t&&`col`in t&&this.expand(t.row,t.col,t.row,t.col)}get tl(){return u.n2l(this.left)+this.top}get $t$l(){return`$${u.n2l(this.left)}$${this.top}`}get br(){return u.n2l(this.right)+this.bottom}get $b$r(){return`$${u.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottom<this.top||e.top>this.bottom||e.right<this.left||e.left>this.right)}contains(e){let t=u.decodeEx(e);return`row`in t&&`col`in t?this.containsEx(t):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let n=this.top;n<=this.bottom;n++)e(u.encodeAddress(n,t),n,t)}};let f=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e}({}),p=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),m=function(e){return e[e.None=0]=`None`,e[e.OfficeDocument=1]=`OfficeDocument`,e[e.Worksheet=2]=`Worksheet`,e[e.CalcChain=3]=`CalcChain`,e[e.SharedStrings=4]=`SharedStrings`,e[e.Styles=5]=`Styles`,e[e.Theme=6]=`Theme`,e[e.Hyperlink=7]=`Hyperlink`,e}({}),h=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),g=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({});const _={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},v={ValueType:f,FormulaType:p,RelationshipType:m,DocumentType:h,ReadingOrder:g,ErrorValue:_},{toString:y}=Object.prototype,b=/["&<>]/;function x(e,t){let n=typeof e,r=typeof t,i=Array.isArray(e),a=Array.isArray(t),o;if(n!==r)return!1;switch(typeof e){case`object`:if(i||a)return i&&a?e.length===t.length&&e.every((e,n)=>{let r=t[n];return x(e,r)}):!1;if(e===null||t===null)return e===t;if(o=Object.keys(e),Object.keys(t).length!==o.length)return!1;for(let e of o)if(!Object.prototype.hasOwnProperty.call(t,e))return!1;return o.every(n=>{let r=e[n],i=t[n];return x(r,i)});default:return e===t}}function S(e){let t=b.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){switch(e.charAt(a)){case`"`:r=`"`;break;case`&`:r=`&`;break;case`<`:r=`<`;break;case`>`:r=`>`;break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=r}return i===a?n:n+e.substring(i,a)}function C(e){return y.call(e)===`[object Undefined]`}function w(e){return y.call(e)===`[object Object]`}function T(...e){let t=e[0]||{},{length:n}=e,r,i,a;function o(e,n){r=t[n],a=Array.isArray(e),w(e)||a?(a?(a=!1,i=r&&Array.isArray(r)?r:[]):i=r&&w(r)?r:{},t[n]=T(i,e)):C(e)||(t[n]=e)}for(let t=0;t<n;t++){let n=e[t];n&&(Array.isArray(n)?n.forEach((e,t)=>o(e,t)):Object.entries(n).forEach(([e,t])=>{e===`__proto__`||e===`constructor`||e===`prototype`||o(t,e)}))}return t}var E=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t=null;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note};break}return T({},e.DEFAULT_CONFIGS,t)}set model(e){let{note:t}=e,{texts:n}=t;n&&n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=t}static fromModel(t){let n=new e;return n.model=t,n}};const D=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,ee=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function O(e,t,n){let r=u.decode(t),i=u.decode(n);return e.replace(D,(e,t,n,a,o)=>{if(o)return e;let s=ee.exec(a);if(s){let n=s[1],a=s[2].toUpperCase(),o=s[3],c=s[4];if(a.length>3||a.length===3&&a>`XFD`)return e;let l=u.l2n(a),d=parseInt(c,10);return n||(l+=i.col-r.col),o||(d+=i.row-r.row),(t||``)+(n||``)+u.n2l(l)+(o||``)+d}return e})}var k=class e{static{this.Types=v.ValueType}constructor(t,n,r){if(!t||!n)throw Error(`A Cell needs a Row`);this._row=t,this._column=n,u.validateAddress(r),this._address=r,this._value=P.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,n.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&e.font||t&&t.font;i&&(n.font=i);let a=e&&e.alignment||t&&t.alignment;a&&(n.alignment=a);let o=e&&e.border||t&&t.border;o&&(n.border=o);let s=e&&e.fill||t&&t.fill;s&&(n.fill=s);let c=e&&e.protection||t&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=P.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=P.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(t){return this._value.type===e.Types.Merge?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=P.create(P.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new E(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof E?this._comment=e:this._comment=new E(e)}get text(){return this._value.toString()}get html(){return S(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=P.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=P.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=E.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},A=class{constructor(e){this.model={address:e.address,type:k.Types.Null}}get value(){return null}set value(e){}get type(){return k.Types.Null}get effectiveType(){return k.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},te=class{constructor(e,t){this.model={address:e.address,type:k.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.Number}get effectiveType(){return k.Types.Number}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},j=class{constructor(e,t){this.model={address:e.address,type:k.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.String}get effectiveType(){return k.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.model.value.replace(/"/g,`""`)}"`}release(){}toString(){return this.model.value}},ne=class{constructor(e,t){this.model={address:e.address,type:k.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}toString(){return this.model.value.richText.map(e=>e.text).join(``)}get type(){return k.Types.RichText}get effectiveType(){return k.Types.RichText}get address(){return this.model.address}set address(e){this.model.address=e}get text(){return this.toString()}toCsvString(){return`"${this.text.replace(/"/g,`""`)}"`}release(){}},M=class{constructor(e,t){this.model={address:e.address,type:k.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.Date}get effectiveType(){return k.Types.Date}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}},re=class{constructor(e,t){this.model={address:e.address,type:k.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text||``,hyperlink:this.model.hyperlink||``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return k.Types.Hyperlink}get effectiveType(){return k.Types.Hyperlink}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.hyperlink||``}release(){}toString(){return this.model.text||``}},ie=class{constructor(e,t){this.model={address:e.address,type:k.Types.Merge,master:t?t.address:void 0},this._master=t,t&&t.addMergeRef()}get value(){return this._master.value}set value(e){e instanceof k?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}isMergedTo(e){return e===this._master}get master(){return this._master}get type(){return k.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}},N=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:k.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(P.getType(e)){case k.Types.Null:case k.Types.String:case k.Types.Number:case k.Types.Date:break;case k.Types.Hyperlink:case k.Types.Formula:default:throw Error(`Cannot process that type of result value`)}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,``).match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()||``}set formula(e){this.model.formula=e}get formulaType(){return this.model.formula?v.FormulaType.Master:this.model.sharedFormula?v.FormulaType.Shared:v.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return k.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?v.ValueType.Null:e instanceof String||typeof e==`string`?v.ValueType.String:typeof e==`number`?v.ValueType.Number:e instanceof Date?v.ValueType.Date:typeof e==`object`&&`error`in e?v.ValueType.Error:v.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&O(t.formula,t.address,this.model.address)}return this._translatedFormula}toCsvString(){return`${this.model.result||``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},ae=class{constructor(e,t){this.model={address:e.address,type:k.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.SharedString}get effectiveType(){return k.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},oe=class{constructor(e,t){this.model={address:e.address,type:k.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.Boolean}get effectiveType(){return k.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},se=class{constructor(e,t){this.model={address:e.address,type:k.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return k.Types.Error}get effectiveType(){return k.Types.Error}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}},ce=class{constructor(e,t){this.model={address:e.address,type:k.Types.String,value:JSON.stringify(t),rawValue:t}}get value(){return this.model.rawValue}set value(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}get type(){return k.Types.String}get effectiveType(){return k.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}};const P={getType(e){if(e==null)return k.Types.Null;if(e instanceof String||typeof e==`string`)return k.Types.String;if(typeof e==`number`)return k.Types.Number;if(typeof e==`boolean`)return k.Types.Boolean;if(e instanceof Date)return k.Types.Date;if(typeof e==`object`){if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return k.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return k.Types.Formula;if(`richText`in e&&e.richText)return k.Types.RichText;if(`sharedString`in e&&e.sharedString)return k.Types.SharedString;if(`error`in e&&e.error)return k.Types.Error}return k.Types.JSON},types:[{t:k.Types.Null,f:A},{t:k.Types.Number,f:te},{t:k.Types.String,f:j},{t:k.Types.Date,f:M},{t:k.Types.Hyperlink,f:re},{t:k.Types.Formula,f:N},{t:k.Types.Merge,f:ie},{t:k.Types.JSON,f:ce},{t:k.Types.SharedString,f:ae},{t:k.Types.RichText,f:ne},{t:k.Types.Boolean,f:oe},{t:k.Types.Error,f:se}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw Error(`Could not create Value of type ${e}`);return new r(t,n)}};var le=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new k(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let t;if(typeof e==`string`){let n=this._worksheet.getColumnKey(e);t=n?n.number:u.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:u.encodeAddress(this._number,t),row:this._number,col:t})}splice(e,t,...n){let r=e+t,i=n.length-t,a=this._cells.length,o,s,c;if(i<0)for(o=e+n.length;o<=a;o++)c=this._cells[o-1],s=this._cells[o-i-1],s?(c=this.getCell(o),c.value=s.value,c.style=s.style,c.comment=s.comment):c&&(c.value=null,c.style={},c.comment=void 0);else if(i>0)for(o=a;o>=r;o--)s=this._cells[o-1],s?(c=this.getCell(o+i),c.value=s.value,c.style=s.style,c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==v.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e||0)-1)||0,i=Math.max(0,(t||0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==v.ValueType.Null&&(e[t.col]=t.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let t=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(t=1),e.forEach((e,n)=>{e!==void 0&&(this.getCellEx({address:u.encodeAddress(this._number,n+t),row:this._number,col:n+t}).value=e)})}else this._worksheet.eachColumnKey((t,n)=>{e[n]!==void 0&&(this.getCellEx({address:u.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}get hasValues(){return this._cells.some(e=>e&&e.type!==v.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,t=0;return this._cells.forEach(n=>{n&&n.type!==v.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(e){if(e.number!==this._number)throw Error(`Invalid row number in model`);this._cells=[];let t;e.cells.forEach(e=>{switch(e.type){case k.Types.Merge:break;default:{let n;if(e.address)n=u.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:u.encodeAddress(e,r),$col$row:`$${u.n2l(r)}$${e}`}}t=n;let r=this.getCellEx(n);r.model=e;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},ue=class e{constructor(e,t,n){this._worksheet=e,this._number=t,n!==!1&&(this.defn=n)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return u.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&x(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&x(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==v.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){n||=[];let r=[],i=1,a=0;for(n=n.sort(function(e,t){return e.min-t.min});a<n.length;){let o=n[a++];for(;i<o.min;)r.push(new e(t,i++));for(;i<=o.max;)r.push(new e(t,i++,o))}return r.length?r:null}};function de(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function fe(e){return typeof e==`object`&&`col`in e&&`row`in e}var pe=class e{constructor(e,t,n=0){if(this.worksheet=e,!t)this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;else if(typeof t==`string`){let e=u.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else de(t)?(this.nativeCol=t.nativeCol||0,this.nativeColOff=t.nativeColOff||0,this.nativeRow=t.nativeRow||0,this.nativeRowOff=t.nativeRowOff||0):fe(t)?(this.col=t.col+n,this.row=t.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(this.worksheet.getRow(this.nativeRow+1).height*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}},me=class{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId};case`image`:return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw Error(`Invalid Image Type`)}}set model({type:e,imageId:t,range:n,hyperlinks:r}){if(this.type=e,this.imageId=t,e===`image`)if(typeof n==`string`){let e=u.decode(n);`top`in e&&(this.range={tl:new pe(this.worksheet,{col:e.left,row:e.top},-1),br:new pe(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else n&&(this.range={tl:new pe(this.worksheet,n.tl,0),br:n.br?new pe(this.worksheet,n.br,0):void 0,ext:n.ext,editAs:n.editAs,hyperlinks:r||(`hyperlinks`in n?n.hyperlinks:void 0)})}},he=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},ge=class{constructor(e,t){this.worksheet=e,t&&(this.table=t,this.validate(),this.store())}getFormula(e){switch(e.totalsRowFunction){case`none`:return null;case`average`:return`SUBTOTAL(101,${this.table.name}[${e.name}])`;case`countNums`:return`SUBTOTAL(102,${this.table.name}[${e.name}])`;case`count`:return`SUBTOTAL(103,${this.table.name}[${e.name}])`;case`max`:return`SUBTOTAL(104,${this.table.name}[${e.name}])`;case`min`:return`SUBTOTAL(105,${this.table.name}[${e.name}])`;case`stdDev`:return`SUBTOTAL(106,${this.table.name}[${e.name}])`;case`var`:return`SUBTOTAL(107,${this.table.name}[${e.name}])`;case`sum`:return`SUBTOTAL(109,${this.table.name}[${e.name}])`;case`custom`:return e.totalsRowFormula||null;default:throw Error(`Invalid Totals Row Function: ${e.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{}),t(e.style,`theme`,`TableStyleMedium2`),t(e.style,`showFirstColumn`,!1),t(e.style,`showLastColumn`,!1),t(e.style,`showRowStripes`,!1),t(e.style,`showColumnStripes`,!1);let n=(e,t)=>{if(!e)throw Error(t)};n(!!e.ref,`Table must have ref`),n(!!e.columns,`Table must have column definitions`),n(!!e.rows,`Table must have row definitions`),e.tl=u.decodeAddress(e.ref);let{row:r,col:i}=e.tl;n(r>0,`Table must be on valid row`),n(i>0,`Table must be on valid col`);let{width:a,filterHeight:o,tableHeight:s}=this;e.autoFilterRef=u.encode(r,i,r+o-1,i+a-1),e.tableRef=u.encode(r,i,r+s-1,i+a-1),e.columns.forEach((e,r)=>{n(!!e.name,`Column ${r} must have a name`),r===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)||void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r);a.value=t,e(a,n.columns[r].style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);n===0?r.value=t.totalsRowLabel:this.getFormula(t)?r.value={formula:t.totalsRowFormula,result:t.totalsRowResult}:r.value=null,e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);t===0?n.value=e.totalsRowLabel:this.getFormula(e)&&(n.value={formula:e.totalsRowFormula,result:e.totalsRowResult})})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=u.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store()}addRow(e,t){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e)}removeRows(e,t=1){this.cacheState(),this.table.rows.splice(e,t)}getColumn(e){let t=this.table.columns[e];return new he(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.table.name=e}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.table.displayName=e}get headerRow(){return this.table.headerRow}set headerRow(e){this._assign(this.table,`headerRow`,e)}get totalsRow(){return this.table.totalsRow}set totalsRow(e){this._assign(this.table,`totalsRow`,e)}get theme(){return this.table.style.theme}set theme(e){this.table.style.theme=e}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(e){this.table.style.showFirstColumn=e}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(e){this.table.style.showLastColumn=e}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(e){this.table.style.showRowStripes=e}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(e){this.table.style.showColumnStripes=e}},_e=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){let t=this.model[e];if(t!==void 0)return t;let n=Object.keys(this.model).filter(e=>e.startsWith(`range:`));if(n.length===0)return;let r=u.decodeAddress(e);for(let e of n){let t=e.slice(6),n=u.decodeEx(t);if(n.dimensions){let t=n.tl,i=n.br;if(r.row>=t.row&&r.row<=i.row&&r.col>=t.col&&r.col<=i.col)return this.model[e]}}}remove(e){this.model[e]=void 0}};function ve(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function ye(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var be=class e extends Uint8Array{toString(e){return e===`base64`?ve(this):new TextDecoder().decode(this)}static from(t){let n=new e(t.length);return n.set(t),n}};function xe(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}function Se(...e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ce(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}const we=new BigUint64Array([4794697086780616226n,8158064640168781261n,13096744586834688815n,16840607885511220148n,4131703408338449720n,6480981068601479193n,10538285296894168987n,12329834152419229976n,15566598209576043074n,1334009975649890238n,2608012711638119052n,6128411473006802146n,8268148722764581231n,9286055187155687089n,11230858885718282805n,13951009754708518548n,16472876342353939154n,17275323862435702243n,1135362057144423861n,2597628984639134821n,3308224258029322869n,5365058923640841347n,6679025012923562964n,8573033837759648693n,10970295158949994411n,12119686244451234320n,12683024718118986047n,13788192230050041572n,14330467153632333762n,15395433587784984357n,489312712824947311n,1452737877330783856n,2861767655752347644n,3322285676063803686n,5560940570517711597n,5996557281743188959n,7280758554555802590n,8532644243296465576n,9350256976987008742n,10552545826968843579n,11727347734174303076n,12113106623233404929n,14000437183269869457n,14369950271660146224n,15101387698204529176n,15463397548674623760n,17586052441742319658n,1182934255886127544n,1847814050463011016n,2177327727835720531n,2830643537854262169n,3796741975233480872n,4115178125766777443n,5681478168544905931n,6601373596472566643n,7507060721942968483n,8399075790359081724n,8693463985226723168n,9568029438360202098n,10144078919501101548n,10430055236837252648n,11840083180663258601n,13761210420658862357n,14299343276471374635n,14566680578165727644n,15097957966210449927n,16922976911328602910n,17689382322260857208n,500013540394364858n,748580250866718886n,1242879168328830382n,1977374033974150939n,2944078676154940804n,3659926193048069267n,4368137639120453308n,4836135668995329356n,5532061633213252278n,6448918945643986474n,6902733635092675308n,7801388544844847127n]),Te=new BigUint64Array([7640891576956012808n,13503953896175478587n,4354685564936845355n,11912009170470909681n,5840696475078001361n,11170449401992604703n,2270897969802886507n,6620516959819538809n]);function F(e,t){return(e>>BigInt(t)|e<<BigInt(64-t))&18446744073709551615n}function Ee(e){let t=e.length,n=BigInt(t*8),r=(128-(t+17)%128)%128,i=t+1+r+16,a=new Uint8Array(i);a.set(e),a[t]=128;let o=new DataView(a.buffer);o.setBigUint64(i-16,0n,!1),o.setBigUint64(i-8,n,!1);let s=new BigUint64Array(Te),c=new BigUint64Array(80);for(let e=0;e<i;e+=128){let t=new DataView(a.buffer,e,128);for(let e=0;e<16;e++)c[e]=t.getBigUint64(e*8,!1);for(let e=16;e<80;e++){let t=F(c[e-15],1)^F(c[e-15],8)^c[e-15]>>7n,n=F(c[e-2],19)^F(c[e-2],61)^c[e-2]>>6n;c[e]=c[e-16]+t+c[e-7]+n&18446744073709551615n}let n=s[0],r=s[1],i=s[2],o=s[3],l=s[4],u=s[5],d=s[6],f=s[7];for(let e=0;e<80;e++){let t=F(l,14)^F(l,18)^F(l,41),a=l&u^~l&d,s=f+t+a+we[e]+c[e]&18446744073709551615n,p=(F(n,28)^F(n,34)^F(n,39))+(n&r^n&i^r&i)&18446744073709551615n;f=d,d=u,u=l,l=o+s&18446744073709551615n,o=i,i=r,r=n,n=s+p&18446744073709551615n}s[0]=s[0]+n&18446744073709551615n,s[1]=s[1]+r&18446744073709551615n,s[2]=s[2]+i&18446744073709551615n,s[3]=s[3]+o&18446744073709551615n,s[4]=s[4]+l&18446744073709551615n,s[5]=s[5]+u&18446744073709551615n,s[6]=s[6]+d&18446744073709551615n,s[7]=s[7]+f&18446744073709551615n}let l=new Uint8Array(64),u=new DataView(l.buffer);for(let e=0;e<8;e++)u.setBigUint64(e*8,s[e],!1);return l}const De={hash(e,...t){let n=Se(...t);if(e.toLowerCase().replace(`-`,``)===`sha512`)return Ee(n);throw Error(`Hash algorithm '${e}' not supported in browser sync mode!`)},convertPasswordToHash(e,t,n,r){if(t.toLowerCase().replace(`-`,``)!==`sha512`)throw Error(`Hash algorithm '${t}' not supported in browser!`);let i=xe(e),a=ye(n),o=this.hash(t,a,i);for(let e=0;e<r;e++){let n=Ce(e);o=this.hash(t,o,n)}return ve(o)},randomBytes(e){let t=new be(e);return crypto.getRandomValues(t),t}};function Oe(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function ke(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}const Ae={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function je(e){return e.replace(/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,(e,t)=>{if(t[0]===`#`){let e=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1));return String.fromCodePoint(e)}return Ae[t]||e})}function Me(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function Ne(e){if(!e||e.indexOf(`@`)>-1)return!1;let t=e.replace(/\[[^\]]*]/g,``);return t=t.replace(/"[^"]*"/g,``),t.match(/[ymdhMsb]+/)!==null}function I(e){return e===!0||e===`true`||e===1||e===`1`}function*Pe(e,t,n=1){let r=n>0?(e,t)=>e<t:(e,t)=>e>t;for(let i=e;r(i,t);i+=n)yield i}function Fe(e){let t=Array.from(e);return t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.sort()}const Ie=new TextDecoder(`utf-8`);function Le(e){return typeof e==`string`?e:Ie.decode(e)}const Re={"<":`<`,">":`>`,"&":`&`,'"':`"`,"'":`'`};function ze(e){let t=e.replace(/[<>&"']/g,e=>Re[e]||e);return t=t.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F\uFFFE\uFFFF]/g,e=>`&#x${e.charCodeAt(0).toString(16).toUpperCase()};`),t=t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,()=>`�`),t}function Be(e){let t=e.model;if(t.headerRow===!1)throw Error(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!t.rows||t.rows.length===0)throw Error(`Cannot create pivot table from an empty table. Add data rows to the table.`);let n=t.columns.map(e=>e.name),r=new Set;for(let e of n){if(r.has(e))throw Error(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);r.add(e)}let i=[void 0,...n],a=t.rows.map(e=>[void 0,...e]),o=t.tl,s=o.row,c=o.col,l=s+t.rows.length,d=c+n.length-1,f=u.encode(s,c,l,d);return{name:t.name,getRow(e){if(e===1)return{values:i};let t=e-2;return t>=0&&t<a.length?{values:a[t]}:{values:[]}},getColumn(e){if(e<1||e>n.length)return{values:[]};let r=[];r[1]=n[e-1];for(let n=0;n<t.rows.length;n++)r[n+2]=t.rows[n][e-1];return{values:r}},getSheetValues(){let e=[];e[1]=i;for(let t=0;t<a.length;t++)e[t+2]=a[t];return e},dimensions:{shortRange:f}}}function Ve(e){return e.sourceTable?Be(e.sourceTable):e.sourceSheet}function He(e,t){if(!t.sourceSheet&&!t.sourceTable)throw Error(`Either sourceSheet or sourceTable must be provided.`);if(t.sourceSheet&&t.sourceTable)throw Error(`Cannot specify both sourceSheet and sourceTable. Choose one.`);let n=Ve(t);Ue(e,t,n);let{rows:r,values:i}=t,a=t.columns??[],o=We(n,[...r,...a]),s=o.reduce((e,t,n)=>(e[t.name]=n,e),{}),c=r.map(e=>s[e]),l=a.map(e=>s[e]),u=i.map(e=>s[e]),d=e.workbook.pivotTables.length+1;return{source:n,rows:c,columns:l,values:u,metric:t.metric??`sum`,cacheFields:o,cacheId:String(10+d-1),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:d}}function Ue(e,t,n){if(t.metric&&t.metric!==`sum`&&t.metric!==`count`)throw Error(`Only the "sum" and "count" metrics are supported at this time.`);let r=t.columns??[],i=n.getRow(1).values.slice(1),a=new Set(i);for(let e of[...t.rows,...r,...t.values])if(!a.has(e))throw Error(`The header name "${e}" was not found in ${n.name}.`);if(!t.rows.length)throw Error(`No pivot table rows specified.`);if(t.values.length<1)throw Error(`Must have at least one value.`);if(t.values.length>1&&r.length>0)throw Error(`It is currently not possible to have multiple values when columns are specified. Please either supply an empty array for columns or a single value.`)}function We(e,t){let n=e.getRow(1).values,r=new Set(t),i=t=>{let n=e.getColumn(t).values,r=new Set;for(let e=2;e<n.length;e++){let t=n[e];t!=null&&r.add(t)}return Fe(r)},a=[];for(let e of Pe(1,n.length)){let t=n[e],o=r.has(t)?i(e):null;a.push({name:t,sharedItems:o})}return a}const Ge=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),L=(e,t,n,r=[])=>{e[n]&&(t[n]=Ge(e[n],r))},Ke=e=>Object.keys(e).length===0,qe=e=>{if(!e)return e;if(Ke(e))return{};let t={...e};return L(e,t,`font`,[`color`]),L(e,t,`alignment`),L(e,t,`protection`),e.border&&(L(e,t,`border`),L(e.border,t.border,`top`,[`color`]),L(e.border,t.border,`left`,[`color`]),L(e.border,t.border,`bottom`,[`color`]),L(e.border,t.border,`right`,[`color`]),L(e.border,t.border,`diagonal`,[`color`])),e.fill&&(L(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>Ge(e,[`color`])))),t};var Je=class{constructor(e){e||={},this._workbook=e.workbook,this.id=e.id||0,this.orderNo=e.orderNo||0,this.name=e.name||`sheet${this.id}`,this.state=e.state||`visible`,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.dataValidations=new _e,this.views=e.views||[],this.autoFilter=e.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name!==e){if(typeof e!=`string`)throw Error(`The name has to be a string.`);if(e===``)throw Error(`The name can't be empty.`);if(e===`History`)throw Error(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw Error(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw Error(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);if(e&&e.length>31&&(e=e.substring(0,31)),this._workbook.worksheets.find(t=>t&&t.name.toLowerCase()===e.toLowerCase()))throw Error(`Worksheet name already exists: ${e}`);this._name=e}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new d;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:t.header?1:0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new ue(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){let t;if(typeof e==`string`){let n=this._keys[e];if(n)return n;t=u.l2n(e)}else t=e;if(this._columns||=[],t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new ue(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]||null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns?this._columns.length:0;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;this.workbook.definedNames.spliceColumns(this.name,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new le(this,e),t}getRows(e,t){if(t<1)return;let n=[];for(let r=e;r<e+t;r++)n.push(this.getRow(r));return n}addRow(e,t=`n`){let n=this._nextRow,r=this.getRow(n);return r.values=e,this._setStyleOption(n,t[0]===`i`?t:`n`),r}addRows(e,t=`n`){let n=[];return e.forEach(e=>{n.push(this.addRow(e,t))}),n}insertRow(e,t,n=`n`){return this.spliceRows(e,0,t),this._setStyleOption(e,n),this.getRow(e)}insertRows(e,t,n=`n`){if(this.spliceRows(e,0,...t),n!==`n`)for(let r=0;r<t.length;r++)n[0]===`o`&&this.findRow(t.length+e+r)!==void 0?this._copyStyle(t.length+e+r,e+r,n[1]===`+`):n[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e+r,n[1]===`+`);return this.getRows(e,t.length)}_setStyleOption(e,t=`n`){t[0]===`o`&&this.findRow(e+1)!==void 0?this._copyStyle(e+1,e,t[1]===`+`):t[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e,t[1]===`+`)}_copyStyle(e,t,n=!1){let r=this.getRow(e),i=this.getRow(t);i.style=qe(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=qe(e.style)}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this._rows[e-1],i=Array.from({length:t}).fill(r.values);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=r.style,t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=e.style})}}spliceRows(e,t,...n){let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=t.style}),this._rows[s-1]=void 0}else this._rows[s+a-1]=void 0;else if(a>0)for(s=o;s>=r;s--)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{if(e.getCell(n).style=t.style,t.type===v.ValueType.Merge){let e=this.getRow(t.row+i).getCell(n),r=t.master,a=this.getRow(r.row+i).getCell(r.col);e.merge(a)}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}this.workbook.definedNames.spliceRows(this.name,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=u.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,t){let n=u.getAddress(e,t);return this.getRow(n.row).getCellEx(n)}mergeCells(...e){let t=new d(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new d(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw Error(`Cannot merge already merged cells`)});let n=this.getCell(e.top,e.left);for(let r=e.top;r<=e.bottom;r++)for(let i=e.left;i<=e.right;i++)(r>e.top||i>e.left)&&this.getCell(r,i).merge(n,t);this._merges[n.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new d(e);for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++){let t=this.findCell(e,n);t&&(t.type===v.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,t,n,r=`shared`){let{top:i,left:a,bottom:o,right:s}=u.decode(e),c=s-a+1,l=u.encodeAddress(i,a),d=r===`shared`,f;f=typeof n==`function`?n:Array.isArray(n)?Array.isArray(n[0])?(e,t)=>n[e-i][t-a]:(e,t)=>n[(e-i)*c+(t-a)]:()=>void 0;let p=!0;for(let n=i;n<=o;n++)for(let i=a;i<=s;i++)if(p){let a=this.getCell(n,i);a.value={shareType:r,formula:t,ref:e,result:f(n,i)},p=!1}else this.getCell(n,i).value=d?{sharedFormula:l,result:f(n,i)}:f(n,i)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new me(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new me(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}protect(e,t){return new Promise(n=>{this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=De.randomBytes(16).toString(`base64`),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=De.convertPasswordToHash(e,`SHA512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount),n()})}unprotect(){this.sheetProtection=null}addTable(e){let t=new ge(this,e);return this.tables[e.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=He(this,e);return this.pivotTables.push(t),this.workbook.pivotTables.push(t),t}addConditionalFormatting(e){this.conditionalFormattings.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormattings.splice(e,1):e instanceof Function?this.conditionalFormattings=this.conditionalFormattings.filter(e):this.conditionalFormattings=[]}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings};e.cols=ue.toModel(this.columns||[]);let t=e.rows=[],n=e.dimensions=new d;return this._rows.forEach(e=>{let r=e&&e.model;r&&(n.expand(r.number,r.min,r.number,r.max),t.push(r))}),e.merges=[],Object.values(this._merges).forEach(t=>{e.merges.push(t.range)}),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new le(this,e.number);this._rows[t.number-1]=t,t.model=e})}_parseMergeCells(e){e.mergeCells&&e.mergeCells.forEach(e=>{this.mergeCellsWithoutStyle(e)})}set model(e){this.name=e.name,this._columns=ue.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new _e(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new me(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new ge(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings}};function Ye(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function Xe(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>Xe(e));let t={};for(let n of Object.keys(e))Ye(n)&&(t[n]=Xe(e[n]));return t}var Ze=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(u.decodeEx(e))}getCell(e){return this.findCellEx(u.decodeEx(e),!0)}findCell(e){return this.findCellEx(u.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets[e],i=r&&r[t];return i&&i[n]}addCellEx(e){if(e.top!==void 0)for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++)this.getCellAt(e.sheetName,t,n);else this.findCellEx(e,!0)}getCellEx(e){return this.findCellEx(e,!0)}findCellEx(e,t){let n=this.findSheet(e,t),r=this.findSheetRow(n,e,t);return this.findRowCell(r,e,t)}getCellAt(e,t,n){if(!Ye(e))throw Error(`Invalid sheet name: ${e}`);let r=this.sheets[e]||(this.sheets[e]=[]),i=r[t]||(r[t]=[]);return i[n]||(i[n]={sheetName:e,address:u.n2l(n)+t,row:t,col:n})}removeCellEx(e){let t=this.findSheet(e,!1);if(!t)return;let n=this.findSheetRow(t,e,!1);n&&delete n[e.col]}forEachInSheet(e,t){let n=this.sheets[e];n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){Object.keys(this.sheets).forEach(t=>{this.forEachInSheet(t,e)})}map(e){let t=[];return this.forEach(n=>{t.push(e(n))}),t}findSheet(e,t){let n=e.sheetName;if(!Ye(n))throw Error(`Invalid sheet name: ${n}`);if(Object.prototype.hasOwnProperty.call(this.sheets,n))return this.sheets[n];if(t)return this.sheets[n]=[]}findSheetRow(e,t,n){let{row:r}=t;if(!Ye(r))throw Error(`Invalid row: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let{col:r}=t;if(!Ye(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...Xe(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push([]);i.splice(t,n,...e)}}spliceColumns(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push(null);Object.values(i).forEach(r=>{r.splice(t,n,...e)})}}};const Qe=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var $e=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new Ze)}add(e,t){let n=u.decodeEx(e);`error`in n||this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let i={sheetName:e.sheetName,address:u.n2l(t)+r,row:r,col:t};n.addCellEx(i)}else n.addCellEx(e)}remove(e,t){let n=u.decodeEx(e);`error`in n||this.removeEx(n,t)}removeEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++)n.removeCellEx({sheetName:e.sheetName,address:u.n2l(t)+r,row:r,col:t});else n.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{if(`top`in e)for(let n=e.left;n<=e.right;n++)for(let r=e.top;r<=e.bottom;r++)t.removeCellEx({sheetName:e.sheetName,address:u.n2l(n)+r,row:r,col:n});else t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let t=u.decodeEx(e);return`error`in t||`top`in t?[]:this.getNamesEx(t)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let{sheetName:n}=t,r=new d(t.row,t.col,t.row,t.col,n),i,a,o=(t,r)=>e.findCellAt(n,t,r);function s(e,n){let i=o(e,t.col);return!i||!i.mark?!1:(r[n]=e,i.mark=!1,!0)}for(a=t.row-1;s(a,`top`);a--);for(a=t.row+1;s(a,`bottom`);a++);function c(e,t){let n=[];for(a=r.top;a<=r.bottom;a++){let t=o(a,e);if(t&&t.mark)n.push(t);else return!1}r[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(i=t.col-1;c(i,`left`);i--);for(i=t.col+1;c(i,`right`);i++);return r}getRanges(e,t){return t||=this.matrixMap[e],t?(t.forEach(e=>{e.mark=!0}),{name:e,ranges:t.map(e=>e.mark&&this._explore(t,e)).filter(Boolean).map(e=>e.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,t){e.forEachInSheet(t,(e,t,n)=>{e&&(e.row!==t||e.col!==n)&&(e.row=t,e.col=n,e.address=u.n2l(n)+t)})}spliceRows(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceRows(e,t,n,r),this.normaliseMatrix(i,e)})}spliceColumns(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceColumns(e,t,n,r),this.normaliseMatrix(i,e)})}get model(){return Object.entries(this.matrixMap).map(([e,t])=>this.getRanges(e,t)).filter(e=>e.ranges.length)}set model(e){let t=this.matrixMap={};e.forEach(e=>{let n=t[e.name]=new Ze;e.ranges.forEach(e=>{Qe.test(e.split(`!`).pop()||``)&&n.addCell(e)})})}},et=class{constructor(){this.category=``,this.company=``,this.created=new Date,this.description=``,this.keywords=``,this.manager=``,this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject=``,this.title=``,this.views=[],this.media=[],this.pivotTables=[],this._definedNames=new $e}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,t){let n=this.nextId,r=this._worksheets.reduce((e,t)=>(t&&t.orderNo)>e?t.orderNo:e,0),i=new Je({...t,id:n,name:e,orderNo:r+1,workbook:this});return this._worksheets[n]=i,i}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){let t=this.getWorksheet(e);t&&t.destroy()}getWorksheet(e){if(e===void 0)return this._worksheets.find(Boolean);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t&&t.name===e)}get worksheets(){return this._worksheets.slice(1).sort((e,t)=>e.orderNo-t.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(t=>{e(t,t.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){let t=this.media.length;return this.media.push({...e,type:`image`}),t}getImage(e){return this.media[Number(e)]}get model(){return{creator:this.creator||`Unknown`,lastModifiedBy:this.lastModifiedBy||`Unknown`,lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,pivotTables:this.pivotTables,calcProperties:this.calcProperties}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(t=>{let{id:n,name:r,state:i}=t,a=e.sheets&&e.sheets.findIndex(e=>e.id===n),o=this._worksheets[n]=new Je({id:n,name:r,orderNo:a===-1?void 0:a,state:i,workbook:this});o.model=t}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media||[],this.pivotTables=e.pivotTables||e.loadedPivotTables||[]}},R=Uint8Array,tt=Uint16Array,nt=Int32Array,rt=new R([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,0]),it=new R([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,0,0]),at=new R([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ot=function(e,t){for(var n=new tt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new nt(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},st=ot(rt,2),ct=st.b,lt=st.r;ct[28]=258,lt[258]=28;var ut=ot(it,0),dt=ut.b;ut.r;for(var ft=new tt(32768),z=0;z<32768;++z){var B=(z&43690)>>1|(z&21845)<<1;B=(B&52428)>>2|(B&13107)<<2,B=(B&61680)>>4|(B&3855)<<4,ft[z]=((B&65280)>>8|(B&255)<<8)>>1}for(var pt=(function(e,t,n){for(var r=e.length,i=0,a=new tt(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new tt(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new tt(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ft[d]>>c]=l}else for(s=new tt(r),i=0;i<r;++i)e[i]&&(s[i]=ft[o[e[i]-1]++]>>15-e[i]);return s}),mt=new R(288),z=0;z<144;++z)mt[z]=8;for(var z=144;z<256;++z)mt[z]=9;for(var z=256;z<280;++z)mt[z]=7;for(var z=280;z<288;++z)mt[z]=8;for(var ht=new R(32),z=0;z<32;++z)ht[z]=5;var gt=pt(mt,9,1),_t=pt(ht,5,1),vt=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},V=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},yt=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},bt=function(e){return(e+7)/8|0},xt=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new R(e.subarray(t,n))},St=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],H=function(e,t,n){var r=Error(t||St[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,H),!n)throw r;return r},Ct=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new R(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new R(i*3));var l=function(e){var t=n.length;if(e>t){var r=new R(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=V(e,d,1);var v=V(e,d+1,3);if(d+=3,v)if(v==1)p=gt,m=_t,h=9,g=5;else if(v==2){var y=V(e,d,31)+257,b=V(e,d+10,15)+4,x=y+V(e,d+5,31)+1;d+=14;for(var S=new R(x),C=new R(19),w=0;w<b;++w)C[at[w]]=V(e,d+w*3,7);d+=b*3;for(var T=vt(C),E=(1<<T)-1,D=pt(C,T,1),w=0;w<x;){var ee=D[V(e,d,E)];d+=ee&15;var O=ee>>4;if(O<16)S[w++]=O;else{var k=0,A=0;for(O==16?(A=3+V(e,d,3),d+=2,k=S[w-1]):O==17?(A=3+V(e,d,7),d+=3):O==18&&(A=11+V(e,d,127),d+=7);A--;)S[w++]=k}}var te=S.subarray(0,y),j=S.subarray(y);h=vt(te),g=vt(j),p=pt(te,h,1),m=pt(j,g,1)}else H(1);else{var O=bt(d)+4,ne=e[O-4]|e[O-3]<<8,M=O+ne;if(M>i){c&&H(0);break}s&&l(f+ne),n.set(e.subarray(O,M),f),t.b=f+=ne,t.p=d=M*8,t.f=u;continue}if(d>_){c&&H(0);break}}s&&l(f+131072);for(var re=(1<<h)-1,ie=(1<<g)-1,N=d;;N=d){var k=p[yt(e,d)&re],ae=k>>4;if(d+=k&15,d>_){c&&H(0);break}if(k||H(2),ae<256)n[f++]=ae;else if(ae==256){N=d,p=null;break}else{var oe=ae-254;if(ae>264){var w=ae-257,se=rt[w];oe=V(e,d,(1<<se)-1)+ct[w],d+=se}var ce=m[yt(e,d)&ie],P=ce>>4;ce||H(3),d+=ce&15;var j=dt[P];if(P>3){var se=it[P];j+=yt(e,d)&(1<<se)-1,d+=se}if(d>_){c&&H(0);break}s&&l(f+131072);var le=f+oe;if(f<j){var ue=a-j,de=Math.min(j,le);for(ue+f<0&&H(3);f<de;++f)n[f]=r[ue+f]}for(;f<le;++f)n[f]=n[f-j]}}t.l=p,t.p=N,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?xt(n,0,f):n.subarray(0,f)},wt=new R(0),Tt=function(e,t){return e[t]|e[t+1]<<8},Et=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Dt=function(e,t){return Et(e,t)+Et(e,t+4)*4294967296},Ot=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new R(32768),this.p=new R(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||H(5),this.d&&H(4),!this.p.length)this.p=e;else if(e.length){var t=new R(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Ct(this.p,this.s,this.o);this.ondata(xt(n,t,this.s.b),this.d),this.o=xt(n,this.s.b-32768),this.s.b=this.o.length,this.p=xt(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),kt=typeof TextDecoder<`u`&&new TextDecoder;try{kt.decode(wt,{stream:!0})}catch{}var At=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:xt(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function jt(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(kt)return kt.decode(e);else{var i=At(e),a=i.s,n=i.r;return n.length&&H(8),a}}var Mt=function(e,t){for(;Tt(e,t)!=1;t+=4+Tt(e,t+2));return[Dt(e,t+12),Dt(e,t+4),Dt(e,t+20)]},Nt=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Pt=function(){function e(){var e=this;this.i=new Ot(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),Ft=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Nt},this.p=wt}return e.prototype.push=function(e,t){var n=this;if(this.onfile||H(5),this.p||H(4),this.c>0){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),e=e.subarray(r),e.length)return this.push(e,t)}else{var a=0,o=0,s=void 0,c=void 0;this.p.length?e.length?(c=new R(this.p.length+e.length),c.set(this.p),c.set(e,this.p.length)):c=this.p:c=e;for(var l=c.length,u=this.c,d=u&&this.d,f=function(){var e,t=Et(c,o);if(t==67324752){a=1,s=o,p.d=null,p.c=0;var r=Tt(c,o+6),i=Tt(c,o+8),d=r&2048,f=r&8,m=Tt(c,o+26),h=Tt(c,o+28);if(l>o+30+m+h){var g=[];p.k.unshift(g),a=2;var _=Et(c,o+18),v=Et(c,o+22),y=jt(c.subarray(o+30,o+=30+m),!d);_==4294967295?(e=f?[-2]:Mt(c,o),_=e[0],v=e[1]):f&&(_=-1),o+=h,p.c=_;var b,x={name:y,compression:i,start:function(){if(x.ondata||H(5),!_)x.ondata(null,wt,!0);else{var e=n.o[i];e||x.ondata(H(14,`unknown compression type `+i,1),null,!1),b=_<0?new e(y):new e(y,_,v),b.ondata=function(e,t,n){x.ondata(e,t,n)};for(var t=0,r=g;t<r.length;t++){var a=r[t];b.push(a,!1)}n.k[0]==g&&n.c?n.d=b:b.push(wt,!0)}},terminate:function(){b&&b.terminate&&b.terminate()}};_>=0&&(x.size=_,x.originalSize=v),p.onfile(x)}return`break`}else if(u){if(t==134695760)return s=o+=12+(u==-2&&8),a=3,p.c=0,`break`;if(t==33639248)return s=o-=4,a=3,p.c=0,`break`}},p=this;o<l-4&&f()!==`break`;++o);if(this.p=wt,u<0){var m=a?c.subarray(0,s-12-(u==-2&&8)-(Et(c,s-16)==134695760&&4)):c.subarray(0,o);d?d.push(m,!!a):this.k[+(a==2)].push(m)}if(a&2)return this.push(c.subarray(o),t);this.p=c.subarray(o)}t&&(this.c&&H(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}();const It=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e})();function Lt(e){let t=4294967295;for(let n=0;n<e.length;n++)t=It[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}async function Rt(e){let t=new CompressionStream(`deflate-raw`),n=t.writable.getWriter(),r=t.readable.getReader();n.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),n.close();let i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}async function zt(e,t={}){return(t.level??6)===0?e:typeof CompressionStream<`u`?Rt(e):(console.warn(`No native compression available, returning uncompressed data`),e)}function Bt(e,t={}){throw Error(`Synchronous compression is not available in browser environment`)}function Vt(e){return[(e.getHours()&31)<<11|(e.getMinutes()&63)<<5|e.getSeconds()>>1&31,(e.getFullYear()-1980&127)<<9|(e.getMonth()+1&15)<<5|e.getDate()&31]}const Ht=new TextEncoder;function Ut(e){return Ht.encode(e)}function Wt(e){let t=new Uint8Array(30+e.name.length),n=new DataView(t.buffer);return n.setUint32(0,67324752,!0),n.setUint16(4,20,!0),n.setUint16(6,2048,!0),n.setUint16(8,e.compressionMethod,!0),n.setUint16(10,e.modTime,!0),n.setUint16(12,e.modDate,!0),n.setUint32(14,e.crc,!0),n.setUint32(18,e.compressedData.length,!0),n.setUint32(22,e.data.length,!0),n.setUint16(26,e.name.length,!0),n.setUint16(28,0,!0),t.set(e.name,30),t}function Gt(e){let t=new Uint8Array(46+e.name.length+e.comment.length),n=new DataView(t.buffer);return n.setUint32(0,33639248,!0),n.setUint16(4,20,!0),n.setUint16(6,20,!0),n.setUint16(8,2048,!0),n.setUint16(10,e.compressionMethod,!0),n.setUint16(12,e.modTime,!0),n.setUint16(14,e.modDate,!0),n.setUint32(16,e.crc,!0),n.setUint32(20,e.compressedData.length,!0),n.setUint32(24,e.data.length,!0),n.setUint16(28,e.name.length,!0),n.setUint16(30,0,!0),n.setUint16(32,e.comment.length,!0),n.setUint16(34,0,!0),n.setUint16(36,0,!0),n.setUint32(38,0,!0),n.setUint32(42,e.offset,!0),t.set(e.name,46),e.comment.length>0&&t.set(e.comment,46+e.name.length),t}function Kt(e,t,n,r){let i=new Uint8Array(22+r.length),a=new DataView(i.buffer);return a.setUint32(0,101010256,!0),a.setUint16(4,0,!0),a.setUint16(6,0,!0),a.setUint16(8,e,!0),a.setUint16(10,e,!0),a.setUint32(12,t,!0),a.setUint32(16,n,!0),a.setUint16(20,r.length,!0),r.length>0&&i.set(r,22),i}var qt=class{constructor(e={}){this.entries=[],this.currentOffset=0,this.finalized=!1,this.level=e.level??6,this.zipComment=Ut(e.comment??``)}async addFile(e){if(this.finalized)throw Error(`Cannot add files after finalizing`);let t=Ut(e.name),n=Ut(e.comment??``),[r,i]=Vt(e.modTime??new Date),a=this.level>0&&e.data.length>0,o=a?await zt(e.data,{level:this.level}):e.data,s={name:t,data:e.data,compressedData:o,crc:Lt(e.data),compressionMethod:a?8:0,modTime:r,modDate:i,comment:n,offset:this.currentOffset};return this.entries.push(s),this.currentOffset+=30+t.length+o.length,[Wt(s),o]}addFileSync(e){if(this.finalized)throw Error(`Cannot add files after finalizing`);let t=Ut(e.name),n=Ut(e.comment??``),[r,i]=Vt(e.modTime??new Date),a=this.level>0&&e.data.length>0,o=a?Bt(e.data,{level:this.level}):e.data,s={name:t,data:e.data,compressedData:o,crc:Lt(e.data),compressionMethod:a?8:0,modTime:r,modDate:i,comment:n,offset:this.currentOffset};return this.entries.push(s),this.currentOffset+=30+t.length+o.length,[Wt(s),o]}finalize(){if(this.finalized)throw Error(`ZIP already finalized`);this.finalized=!0;let e=[];for(let t of this.entries)e.push(Gt(t));let t=e.reduce((e,t)=>e+t.length,0);return e.push(Kt(this.entries.length,t,this.currentOffset,this.zipComment)),e}get entryCount(){return this.entries.length}get dataSize(){return this.currentOffset}},Jt=class{constructor(e){this._buf=Buffer.alloc(e&&e.size||16384),this._encoding=e&&e.encoding||`utf8`,this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(e){e||=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=Buffer.alloc(t);this._buf.copy(n,0),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+this._buf.write(e,this._inPos,this._encoding);for(;t>=this._buf.length-4;)this._grow(this._inPos+e.length),t=this._inPos+this._buf.write(e,this._inPos,this._encoding);this._inPos=t}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),e._buf.copy(this._buf,this._inPos,0,e.length),this._inPos+=e.length)}},Yt=class{constructor(e,t){this._data=e,this._encoding=t}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=new TextEncoder().encode(this._data),this._buffer}},Xt=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Zt=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);e.set(this._data.subarray(n,n+i),t)}toBuffer(){return this._data}},Qt=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.slice(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.slice(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,t+r),this.iWrite+=r,r}},$t=class{constructor(e){e||={},this.bufSize=e.bufSize||1024*1024,this.buffers=[],this.batch=e.batch||!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this.events=new Map}on(e,t){let n=this.events.get(e)||[];return n.push(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){let n=this.events.get(e)||[];return n.forEach(e=>e(...t)),n.length>0}removeListener(e,t){return this.off(e,t)}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new Qt(this.bufSize);return this.buffers.push(e),e}async _pipe(e){await Promise.all(this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>{n()})})))}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){t instanceof Function&&(n=t,t=`utf8`),n||=()=>{};let r;if(e instanceof Jt||e&&e.constructor?.name===`StringBuf`)r=new Xt(e);else if(e instanceof Uint8Array)r=new Zt(e);else if(ArrayBuffer.isView(e))r=new Zt(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Zt(new Uint8Array(e));else if(typeof e==`string`||e instanceof String)r=new Yt(String(e),t);else throw Error(`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;)await this._pipe(new Zt(this.buffers.shift().toBuffer()));else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipe(r),n());else this.paused||this.emit(`data`,r.toBuffer()),this._writeToBuffers(r),this.emit(`readable`);return!0}cork(){this.corked=!0}_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(new Zt(this.buffers.shift().toBuffer()))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{e?n?.(e):(this._flush(),this.pipes.forEach(e=>{e.end()}),this.emit(`finish`))};e?this.write(e,t,r):r()}read(e){let t;if(e){for(t=[];e&&this.buffers.length&&!this.buffers[0].eod;){let n=this.buffers[0],r=n.read(e);r&&(e-=r.length,t.push(r)),n.eod&&n.full&&this.buffers.shift()}return en(t)}return t=this.buffers.map(e=>e.toBuffer()).filter(Boolean),this.buffers=[],en(t)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw Error(`Not Implemented`)}wrap(){throw Error(`Not Implemented`)}push(e){return e!==null&&this.write(e),!0}};function en(e){if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function tn(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var nn=class{constructor(e){this.finalized=!1,this.pendingWrites=[],this.events=new Map;let t=e?.compression===`STORE`?0:Math.max(0,Math.min(9,e?.compressionOptions?.level??1));this.stream=new $t,this.zipBuilder=new qt({level:t})}on(e,t){let n=this.events.get(e)||[];return n.push(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){let n=this.events.get(e)||[];return n.forEach(e=>e(...t)),n.length>0}removeListener(e,t){return this.off(e,t)}append(e,t){let n;n=Object.prototype.hasOwnProperty.call(t,`base64`)&&t.base64?tn(typeof e==`string`?e:String(e)):typeof e==`string`?new TextEncoder().encode(e):e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):e;let r=this.zipBuilder.addFile({name:t.name,data:n}).then(e=>{for(let t of e)this.stream.write(new Uint8Array(t))});this.pendingWrites.push(r)}push(e){return this.stream.push(e)}async finalize(){if(this.finalized)return;this.finalized=!0,await Promise.all(this.pendingWrites);let e=this.zipBuilder.finalize();for(let t of e)this.stream.write(new Uint8Array(t));this.stream.end(),this.emit(`finish`)}read(e){return this.stream.read(e)}setEncoding(e){return this.stream.setEncoding(e)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(e){return this.stream.pipe(e)}unpipe(e){return this.stream.unpipe(e)}unshift(){return this.stream.unshift()}wrap(){return this.stream.wrap()}};const rn=1e4;function an(e,t,n){e.push(` ${t}="${ze(n.toString())}"`)}function on(e,t){if(t){let n=[];Object.entries(t).forEach(([e,t])=>{t!==void 0&&an(n,e,t)}),e.push(n.join(``))}}var U=class{constructor(){this._xml=[],this._chunks=[],this._stack=[],this._rollbacks=[]}_consolidate(){this._xml.length>=rn&&(this._chunks.push(this._xml.join(``)),this._xml=[])}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._chunks.length*rn+this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),on(t,e),t.push(`?>
|
|
8
|
-
`)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),
|
|
9
|
-
|
|
10
|
-
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`--�𐀀-`,e.RESTRICTED_CHAR=`-\b\v\f---`,e.S=` \r
|
|
11
|
-
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),un=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SaxesParser=e.EVENTS=void 0;let t=sn(),n=cn(),r=ln();var i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE;let m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=8232,y=e=>e===34||e===39,b=[34,39],x=[...b,91,62],S=[...b,60,93],C=[61,63,...c],w=[...c,62,38,60];function T(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
|
|
12
|
-
${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function E(e,t){for(let n of Object.keys(t))T(e,n,t[n])}let D=e=>p.test(e),ee=e=>l.test(e);e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];let O={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=D,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(E(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=ee,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?13:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[O[e]]=t}off(e){this[O[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===13||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=32||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:return e.charCodeAt(t+1)===10&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==v||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:{let n=e.charCodeAt(t+1);(n===10||n===133)&&(this.i=t+2)}case 133:case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===-2?10:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===-2,a=i?10:r;if(a===-1||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case-2:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=10;break;case-1:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===-1)return this.name+=e.slice(t),-1;if(!s(n))return this.name+=e.slice(t,this.prevI),n===-2?10:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===-1||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case 60:if(this.state=15,this.text.length!==0)throw Error(`no-empty text at start`);break;case-1:break;default:this.unget(),this.state=13,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(x);switch(t){case 62:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=13,this.doctype=!0;break;case-1:break;default:this.text+=String.fromCodePoint(t),t===91?this.state=4:y(t)&&(this.state=3,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){let e=this.captureTo(S);e!==-1&&(this.text+=String.fromCodePoint(e),e===93?this.state=2:e===60?this.state=6:y(e)&&(this.state=5,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang=``;break;case 63:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?8:4,this.openWakaBang=``)}sDTDComment(){this.captureToChar(45)&&(this.text+=`-`,this.state=9)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===45?10:8}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62?this.state=4:(this.fail(`malformed comment.`),this.state=8)}sDTDPI(){this.captureToChar(63)&&(this.text+=`?`,this.state=12)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62&&(this.state=4)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case-2:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==13||this.textHandler!==void 0)&&(this.text+=i);break loop}case-1:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case 63:this.state=23;break;default:this.fail(`disallowed character in tag name`),this.state=13,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang=``;break;case`--`:this.state=17,this.openWakaBang=``;break;case`DOCTYPE`:this.state=2,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var e;let t=this.getCodeNorm();t===45?(this.state=19,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=17)}sCommentEnded(){let e=this.getCodeNorm();e===62?this.state=13:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=17)}sCData(){this.captureToChar(93)&&(this.state=21)}sCDataEnding(){let e=this.getCodeNorm();e===93?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case 62:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=13;break;case 93:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=20}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===63||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===63?26:25):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===-1){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===63;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?33:27):this.state=r?26:25:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===63?this.state=26:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(63)&&(this.state=26)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===62){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=13}else t===63?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===63){this.state=33;return}e!==-1&&(this.state=28,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(C);if(e===63){this.state=33,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===61){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===61?30:29}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==61&&this.fail(`value required.`),this.state=30)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(y(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=32),this.state=31)}sXMLDeclValue(){let e=this.captureTo([this.q,63]);if(e===63){this.state=33,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===-1)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=32}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===63){this.state=33;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=27}sXMLDeclEnding(){var e;this.getCodeNorm()===62?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=13):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===-1)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case 62:this.openTag();break;case 47:this.state=35;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=36}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=36)}sAttrib(){let e=this.skipSpaces();e!==-1&&(o(e)?(this.unget(),this.state=37):e===62?this.openTag():e===47?this.state=35:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===61?this.state=39:i(e)?this.state=38:e===62?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==-1&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case-1:return;case 61:this.state=39;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===62?this.openTag():o(e)?(this.unget(),this.state=37):(this.fail(`disallowed character in attribute name.`),this.state=36)}}sAttribValue(){let e=this.getCodeNorm();y(e)?(this.q=e,this.state=40):i(e)||(this.fail(`unquoted attribute value.`),this.state=42,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=41;return;case 38:this.text+=t.slice(n,this.prevI),this.state=14,this.entityReturnState=40;return;case 10:case-2:case 9:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case 60:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case-1:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=36:e===62?this.openTag():e===47?this.state=35:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=37):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(w);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case 60:this.fail(`disallowed character.`);break;case-1:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===62?this.openTag():this.state=36}}sCloseTag(){let e=this.captureNameChars();e===62?this.closeTag():i(e)?this.state=44:e!==-1&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case 62:this.closeTag();break;case-1:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case 60:if(this.state=15,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=0;break scanLoop;case 38:this.state=14,this.entityReturnState=13,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=0;break scanLoop;case 93:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw Error(`impossible state`)}break;case 62:t===2&&this.fail(`the string "]]>" is disallowed in char data.`),t=0;break;case-2:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case-1:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case 60:if(this.state=15,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case 38:this.state=14,this.entityReturnState=13,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case-2:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case-1:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,T(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,T(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==0&&this.state!==13&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=13,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=13,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=13,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}}))();async function*dn(e){let t=new un.SaxesParser({xmlns:!1,defaultXMLVersion:`1.0`}),n;t.on(`error`,e=>{n=e});let r=[];t.on(`opentag`,e=>r.push({eventType:`opentag`,value:e})),t.on(`text`,e=>r.push({eventType:`text`,value:e})),t.on(`closetag`,e=>r.push({eventType:`closetag`,value:e}));for await(let i of e){if(t.write(Le(i)),n)throw n;yield r,r=[]}}var W=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=null,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){for await(let t of e)for(let{eventType:e,value:n}of t)if(e===`opentag`)this.parseOpen(n);else if(e===`text`)this.parseText(n);else if(e===`closetag`&&!this.parseClose(n.name))return this.model;return this.model}async parseStream(e){return this.parse(dn(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new U;return this.render(t,e),t.xml}static toAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e.toString()}static toStringAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toStringValue(e,t){return e===void 0?t:e}static toBoolAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e?`1`:`0`}static toBoolValue(e,t){return e===void 0?t:e===`1`}static toIntAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toIntValue(e,t){return e===void 0?t:parseInt(e,10)}static toFloatAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toFloatValue(e,t){return e===void 0?t:parseFloat(e)}};function fn(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{fn(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var G=class extends W{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new U;fn(e,this._model),this._xml=e.xml}e.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},K=class extends W{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count||`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t&&t.length||0);let{childXform:n}=this;(t||[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model=[],!0;default:return this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw Error(`Max ${this.childXform.tag} count (${this.maxItems}) exceeded`);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},q=class extends W{constructor(e){super(),this.name=e||`color`}get tag(){return this.name}render(e,t){return t?(e.openNode(this.name),t.argb?e.addAttribute(`rgb`,t.argb):t.theme===void 0?t.indexed===void 0?e.addAttribute(`auto`,`1`):e.addAttribute(`indexed`,t.indexed):(e.addAttribute(`theme`,t.theme),t.tint!==void 0&&e.addAttribute(`tint`,t.tint)),e.closeNode(),!0):!1}parseOpen(e){return e.name===this.name?(e.attributes.rgb?this.model={argb:e.attributes.rgb}:e.attributes.theme?(this.model={theme:parseInt(e.attributes.theme,10)},e.attributes.tint&&(this.model.tint=parseFloat(e.attributes.tint))):e.attributes.indexed?this.model={indexed:parseInt(e.attributes.indexed,10)}:this.model=void 0,!0):!1}parseText(){}parseClose(){return!1}},pn=class extends W{constructor(e){super(),this.tag=e.tag,this.attr=e.attr}render(e,t){t&&(e.openNode(this.tag),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}},mn=class extends W{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.zero=e.zero,this.text=[]}render(e,t){(t||this.zero)&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){return e.name===this.tag?(this.attr?this.model=parseInt(e.attributes[this.attr],10):this.text=[],!0):!1}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=parseInt(this.text.join(``)||`0`,10)),!1}},J=class extends W{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[]}render(e,t){t!==void 0&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=e.attributes[this.attr]:this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this.text.join(``)),!1}},hn=class e extends W{static{this.Attributes={single:{},double:{val:`double`},singleAccounting:{val:`singleAccounting`},doubleAccounting:{val:`doubleAccounting`}}}constructor(e){super(),this.model=e}get tag(){return`u`}render(t,n){if(n||=this.model,n===!0)t.leafNode(`u`);else{let r=e.Attributes[n];r&&t.leafNode(`u`,r)}}parseOpen(e){e.name===`u`&&(this.model=e.attributes.val||!0)}parseText(){}parseClose(){return!1}},gn=class e extends W{constructor(t){super(),this.options=t||e.OPTIONS,this.map={b:{prop:`bold`,xform:new pn({tag:`b`,attr:`val`})},i:{prop:`italic`,xform:new pn({tag:`i`,attr:`val`})},u:{prop:`underline`,xform:new hn},charset:{prop:`charset`,xform:new mn({tag:`charset`,attr:`val`})},color:{prop:`color`,xform:new q},condense:{prop:`condense`,xform:new pn({tag:`condense`,attr:`val`})},extend:{prop:`extend`,xform:new pn({tag:`extend`,attr:`val`})},family:{prop:`family`,xform:new mn({tag:`family`,attr:`val`})},outline:{prop:`outline`,xform:new pn({tag:`outline`,attr:`val`})},vertAlign:{prop:`vertAlign`,xform:new J({tag:`vertAlign`,attr:`val`})},scheme:{prop:`scheme`,xform:new J({tag:`scheme`,attr:`val`})},shadow:{prop:`shadow`,xform:new pn({tag:`shadow`,attr:`val`})},strike:{prop:`strike`,xform:new pn({tag:`strike`,attr:`val`})},sz:{prop:`size`,xform:new mn({tag:`sz`,attr:`val`})}},this.map[this.options.fontNameTag]={prop:`name`,xform:new J({tag:this.options.fontNameTag,attr:`val`})}}get tag(){return this.options.tagName}render(e,t){let{map:n}=this;e.openNode(this.options.tagName),Object.entries(this.map).forEach(([r,i])=>{n[r].xform.render(e,t[i.prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},_n=class extends W{constructor(){super(),this.map={color:new q}}get tag(){return`stop`}render(e,t){e.openNode(`stop`),e.addAttribute(`position`,t.position),this.map.color.render(e,t.color),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`stop`:return this.model={position:parseFloat(e.attributes.position)},!0;case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(){}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.color=this.parser.model,this.parser=void 0),!0):!1}},vn=class extends W{constructor(){super(),this.map={fgColor:new q(`fgColor`),bgColor:new q(`bgColor`)}}get name(){return`pattern`}get tag(){return`patternFill`}render(e,t){e.openNode(`patternFill`),e.addAttribute(`patternType`,t.pattern),t.fgColor&&this.map.fgColor.render(e,t.fgColor),t.bgColor&&this.map.bgColor.render(e,t.bgColor),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`patternFill`:return this.model={type:`pattern`,pattern:e.attributes.patternType},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser.model&&(this.model[e]=this.parser.model),this.parser=void 0),!0):!1}},yn=class extends W{constructor(){super(),this.map={stop:new _n}}get name(){return`gradient`}get tag(){return`gradientFill`}render(e,t){switch(e.openNode(`gradientFill`),t.gradient){case`angle`:e.addAttribute(`degree`,t.degree);break;case`path`:e.addAttribute(`type`,`path`),t.center.left&&(e.addAttribute(`left`,t.center.left),t.center.right===void 0&&e.addAttribute(`right`,t.center.left)),t.center.right&&e.addAttribute(`right`,t.center.right),t.center.top&&(e.addAttribute(`top`,t.center.top),t.center.bottom===void 0&&e.addAttribute(`bottom`,t.center.top)),t.center.bottom&&e.addAttribute(`bottom`,t.center.bottom);break;default:break}let n=this.map.stop;t.stops.forEach(t=>{n.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`gradientFill`:{let t=this.model={stops:[]};return e.attributes.degree?(t.gradient=`angle`,t.degree=parseInt(e.attributes.degree,10)):e.attributes.type===`path`&&(t.gradient=`path`,t.center={left:e.attributes.left?parseFloat(e.attributes.left):0,top:e.attributes.top?parseFloat(e.attributes.top):0},e.attributes.right!==e.attributes.left&&(t.center.right=e.attributes.right?parseFloat(e.attributes.right):0),e.attributes.bottom!==e.attributes.top&&(t.center.bottom=e.attributes.bottom?parseFloat(e.attributes.bottom):0)),!0}case`stop`:return this.parser=this.map.stop,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0):!1}},bn=class e extends W{constructor(){super(),this.map={patternFill:new vn,gradientFill:new yn}}get tag(){return`fill`}render(e,t){switch(e.addRollback(),e.openNode(`fill`),t.type){case`pattern`:this.map.patternFill.render(e,t);break;case`gradient`:this.map.gradientFill.render(e,t);break;default:e.rollback();return}e.closeNode(),e.commit()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`fill`:return this.model={},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0):!1}validStyle(t){return e.validPatternValues[t]}static{this.validPatternValues=[`none`,`solid`,`darkVertical`,`darkGray`,`mediumGray`,`lightGray`,`gray125`,`gray0625`,`darkHorizontal`,`darkVertical`,`darkDown`,`darkUp`,`darkGrid`,`darkTrellis`,`lightHorizontal`,`lightVertical`,`lightDown`,`lightUp`,`lightGrid`,`lightTrellis`,`lightGrid`].reduce((e,t)=>(e[t]=!0,e),{})}static{this.StopXform=_n}static{this.PatternFillXform=vn}static{this.GradientFillXform=yn}},xn=class e extends W{constructor(e){super(),this.name=e,this.map={color:new q}}get tag(){return this.name}render(e,t,n){let r=t&&t.color||n||this.defaultColor;e.openNode(this.name),t&&t.style&&(e.addAttribute(`style`,t.style),r&&this.map.color.render(e,r)),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.name:{let{style:t}=e.attributes;return t?this.model={style:t}:this.model=void 0,!0}case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(e===this.name&&this.map.color.model&&(this.model||={},this.model.color=this.map.color.model),!1)}validStyle(t){return e.validStyleValues[t]}static{this.validStyleValues=[`thin`,`dashed`,`dotted`,`dashDot`,`hair`,`dashDotDot`,`slantDashDot`,`mediumDashed`,`mediumDashDotDot`,`mediumDashDot`,`medium`,`double`,`thick`].reduce((e,t)=>(e[t]=!0,e),{})}},Sn=class extends W{constructor(){super(),this.map={top:new xn(`top`),left:new xn(`left`),bottom:new xn(`bottom`),right:new xn(`right`),diagonal:new xn(`diagonal`)}}render(e,t){let{color:n}=t;e.openNode(`border`),t.diagonal&&t.diagonal.style&&(t.diagonal.up&&e.addAttribute(`diagonalUp`,`1`),t.diagonal.down&&e.addAttribute(`diagonalDown`,`1`));let r=(r,i)=>{let a=r;a&&!a.color&&t.color&&(a={...a,color:t.color}),i.render(e,a,n)};r(t.left,this.map.left),r(t.right,this.map.right),r(t.top,this.map.top),r(t.bottom,this.map.bottom),r(t.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`border`:return this.reset(),this.diagonalUp=I(e.attributes.diagonalUp),this.diagonalDown=I(e.attributes.diagonalDown),!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`border`){let e=this.model={},t=(t,n,r)=>{n&&(r&&Object.assign(n,r),e[t]=n)};t(`left`,this.map.left.model),t(`right`,this.map.right.model),t(`top`,this.map.top.model),t(`bottom`,this.map.bottom.model),t(`diagonal`,this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}};const Cn={0:{f:`General`},1:{f:`0`},2:{f:`0.00`},3:{f:`#,##0`},4:{f:`#,##0.00`},9:{f:`0%`},10:{f:`0.00%`},11:{f:`0.00E+00`},12:{f:`# ?/?`},13:{f:`# ??/??`},14:{f:`mm-dd-yy`},15:{f:`d-mmm-yy`},16:{f:`d-mmm`},17:{f:`mmm-yy`},18:{f:`h:mm AM/PM`},19:{f:`h:mm:ss AM/PM`},20:{f:`h:mm`},21:{f:`h:mm:ss`},22:{f:`m/d/yy "h":mm`},27:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},28:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},29:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},30:{"zh-tw":`m/d/yy `,"zh-cn":`m-d-yy`,"ja-jp":`m/d/yy`,"ko-kr":`mm-dd-yy`},31:{"zh-tw":`yyyy"年"m"月"d"日"`,"zh-cn":`yyyy"年"m"月"d"日"`,"ja-jp":`yyyy"年"m"月"d"日"`,"ko-kr":`yyyy"년" mm"월" dd"일"`},32:{"zh-tw":`hh"時"mm"分"`,"zh-cn":`h"时"mm"分"`,"ja-jp":`h"時"mm"分"`,"ko-kr":`h"시" mm"분"`},33:{"zh-tw":`hh"時"mm"分"ss"秒"`,"zh-cn":`h"时"mm"分"ss"秒"`,"ja-jp":`h"時"mm"分"ss"秒"`,"ko-kr":`h"시" mm"분" ss"초"`},34:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},35:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},36:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},37:{f:`#,##0 ;(#,##0)`},38:{f:`#,##0 ;[Red](#,##0)`},39:{f:`#,##0.00 ;(#,##0.00)`},40:{f:`#,##0.00 ;[Red](#,##0.00)`},45:{f:`mm:ss`},46:{f:`[h]:mm:ss`},47:{f:`mmss.0`},48:{f:`##0.0E+0`},49:{f:`@`},50:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},51:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},52:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},53:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`m"月"d"日"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},54:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},55:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},56:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},57:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},58:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},59:{"th-th":`t0`},60:{"th-th":`t0.00`},61:{"th-th":`t#,##0`},62:{"th-th":`t#,##0.00`},67:{"th-th":`t0%`},68:{"th-th":`t0.00%`},69:{"th-th":`t# ?/?`},70:{"th-th":`t# ??/??`},81:{"th-th":`d/m/bb`}};function wn(){let e={};return Object.entries(Cn).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}const Tn=wn();var En=class extends W{constructor(e,t){super(),this.id=e,this.formatCode=t}get tag(){return`numFmt`}render(e,t){e.leafNode(`numFmt`,{numFmtId:t.id,formatCode:t.formatCode})}parseOpen(e){switch(e.name){case`numFmt`:return this.model={id:parseInt(e.attributes.numFmtId,10),formatCode:e.attributes.formatCode.replace(/[\\](.)/g,`$1`)},!0;default:return!1}}parseText(){}parseClose(){return!1}static getDefaultFmtId(e){return Tn[e]}static getDefaultFmtCode(e){return Cn[e]&&Cn[e].f}};const Dn={ReadingOrder:{LeftToRight:1,RightToLeft:2}},On={horizontalValues:[`left`,`center`,`right`,`fill`,`centerContinuous`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),horizontal(e){return this.horizontalValues[e]?e:void 0},verticalValues:[`top`,`middle`,`bottom`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),vertical(e){return e===`middle`?`center`:this.verticalValues[e]?e:void 0},wrapText(e){return e?!0:void 0},shrinkToFit(e){return e?!0:void 0},textRotation(e){switch(e){case`vertical`:return e;default:{let t=Me(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=Me(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Dn.ReadingOrder.LeftToRight;case`rtl`:return Dn.ReadingOrder.RightToLeft;default:return}}},kn={toXml(e){let t=On.textRotation(e);if(t){if(t===`vertical`)return 255;let e=Math.round(t);if(e>=0&&e<=90)return e;if(e<0&&e>=-90)return 90-e}},toModel(e){let t=Me(e);if(t!==void 0){if(t===255)return`vertical`;if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}}};var An=class extends W{get tag(){return`alignment`}render(e,t){e.addRollback(),e.openNode(`alignment`);let n=!1;function r(t,r){r&&(e.addAttribute(t,r),n=!0)}r(`horizontal`,On.horizontal(t.horizontal)),r(`vertical`,On.vertical(t.vertical)),r(`wrapText`,On.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,On.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,On.indent(t.indent)),r(`textRotation`,kn.toXml(t.textRotation)),r(`readingOrder`,On.readingOrder(t.readingOrder)),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={},n=!1;function r(e,r,i){e&&(t[r]=i,n=!0)}r(e.attributes.horizontal,`horizontal`,e.attributes.horizontal),r(e.attributes.vertical,`vertical`,e.attributes.vertical===`center`?`middle`:e.attributes.vertical),r(e.attributes.wrapText,`wrapText`,I(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,I(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,kn.toModel(e.attributes.textRotation)),r(e.attributes.readingOrder,`readingOrder`,e.attributes.readingOrder===`2`?`rtl`:`ltr`),this.model=n?t:null}parseText(){}parseClose(){return!1}};const jn={boolean(e,t){return e===void 0?t:e}};var Mn=class extends W{get tag(){return`protection`}render(e,t){e.addRollback(),e.openNode(`protection`);let n=!1;function r(t,r){r!==void 0&&(e.addAttribute(t,r),n=!0)}r(`locked`,jn.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,jn.boolean(t.hidden,!1)?`1`:void 0),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={locked:e.attributes.locked!==`0`,hidden:e.attributes.hidden===`1`};this.model=!t.locked||t.hidden?t:null}parseText(){}parseClose(){return!1}},Nn=class extends W{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new An,protection:new Mn}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId||0,fontId:t.fontId||0,fillId:t.fillId||0,borderId:t.borderId||0}),this.xfId&&e.addAttribute(`xfId`,t.xfId||0),t.numFmtId&&e.addAttribute(`applyNumberFormat`,`1`),t.fontId&&e.addAttribute(`applyFont`,`1`),t.fillId&&e.addAttribute(`applyFill`,`1`),t.borderId&&e.addAttribute(`applyBorder`,`1`),t.alignment&&e.addAttribute(`applyAlignment`,`1`),t.protection&&e.addAttribute(`applyProtection`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:return this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},Pn=class extends W{constructor(){super(),this.map={alignment:new An,border:new Sn,fill:new bn,font:new gn,numFmt:new En,protection:new Mn}}get tag(){return`dxf`}render(e,t){if(e.openNode(this.tag),t.font&&this.map.font.render(e,t.font),t.numFmt&&t.numFmtId){let n={id:t.numFmtId,formatCode:t.numFmt};this.map.numFmt.render(e,n)}t.fill&&this.map.fill.render(e,t.fill),t.alignment&&this.map.alignment.render(e,t.alignment),t.border&&this.map.border.render(e,t.border),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.reset(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e===this.tag?(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1):!0}},Fn=class e extends W{constructor(t){super(),this.map={numFmts:new K({tag:`numFmts`,count:!0,childXform:new En}),fonts:new K({tag:`fonts`,count:!0,childXform:new gn,$:{"x14ac:knownFonts":1}}),fills:new K({tag:`fills`,count:!0,childXform:new bn}),borders:new K({tag:`borders`,count:!0,childXform:new Sn}),cellStyleXfs:new K({tag:`cellStyleXfs`,count:!0,childXform:new Nn}),cellXfs:new K({tag:`cellXfs`,count:!0,childXform:new Nn({xfId:!0})}),dxfs:new K({tag:`dxfs`,always:!0,count:!0,childXform:new Pn}),numFmt:new En,font:new gn,fill:new bn,border:new Sn,style:new Nn({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap}render(t,n){let r=n||this.model;t.openXml(U.StdDocAttributes),t.openNode(`styleSheet`,e.STYLESHEET_ATTRIBUTES),this.index?(r.numFmts&&r.numFmts.length&&(t.openNode(`numFmts`,{count:r.numFmts.length}),r.numFmts.forEach(e=>{t.writeXml(e)}),t.closeNode()),r.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeXml(e)}),t.closeNode(),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),t.openNode(`cellXfs`,{count:r.styles.length}),r.styles.forEach(e=>{t.writeXml(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let n={},r=t||v.ValueType.Number;if(e.numFmt)n.numFmtId=this._addNumFmtStr(e.numFmt);else switch(r){case v.ValueType.Number:n.numFmtId=this._addNumFmtStr(`General`);break;case v.ValueType.Date:n.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(n.fontId=this._addFont(e.font)),e.border&&(n.borderId=this._addBorder(e.border)),e.fill&&(n.fillId=this._addFill(e.fill)),e.alignment&&(n.alignment=e.alignment),e.protection&&(n.protection=e.protection);let i=this._addStyle(n);return this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||En.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}return r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection),n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=En.getDefaultFmtId(e);if(t!==void 0||(t=this.index.numFmt[e],t!==void 0))return t;t=this.index.numFmt[e]=164+this.model.numFmts.length;let n=this.map.numFmt.toXml({id:t,formatCode:e});return this.model.numFmts.push(n),t}_addFont(e){let t=this.map.font.toXml(e),n=this.index.font[t];return n===void 0&&(n=this.index.font[t]=this.model.fonts.length,this.model.fonts.push(t)),n}_addBorder(e){let t=this.map.border.toXml(e),n=this.index.border[t];return n===void 0&&(n=this.index.border[t]=this.model.borders.length,this.model.borders.push(t)),n}_addFill(e){let t=this.map.fill.toXml(e),n=this.index.fill[t];return n===void 0&&(n=this.index.fill[t]=this.model.fills.length,this.model.fills.push(t)),n}static{this.STYLESHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac x16r2`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"xmlns:x16r2":`http://schemas.microsoft.com/office/spreadsheetml/2015/02/main`}}static{this.STATIC_XFORMS={cellStyles:new G({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new G({tag:`dxfs`,$:{count:0}}),tableStyles:new G({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new G({tag:`extLst`,c:[{tag:`ext`,$:{uri:`{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`},c:[{tag:`x14:slicerStyles`,$:{defaultSlicerStyle:`SlicerStyleLight1`}}]},{tag:`ext`,$:{uri:`{9260A510-F301-46a8-8635-F512D64BE5F5}`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`},c:[{tag:`x15:timelineStyles`,$:{defaultTimelineStyle:`TimeSlicerStyleLight1`}}]}]})}}};Fn.Mock=class extends Fn{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}],borders:[{}],fills:[{type:`pattern`,pattern:`none`},{type:`pattern`,pattern:`gray125`}]}}parseStream(e){return e.autodrain(),Promise.resolve()}addStyleModel(e,t){switch(t){case v.ValueType.Date:return this.dateStyleId;default:return 0}}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:En.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var In=class extends W{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}},Ln=class e extends W{constructor(){super(),this.map={"dc:creator":new J({tag:`dc:creator`}),"dc:title":new J({tag:`dc:title`}),"dc:subject":new J({tag:`dc:subject`}),"dc:description":new J({tag:`dc:description`}),"dc:identifier":new J({tag:`dc:identifier`}),"dc:language":new J({tag:`dc:language`}),"cp:keywords":new J({tag:`cp:keywords`}),"cp:category":new J({tag:`cp:category`}),"cp:lastModifiedBy":new J({tag:`cp:lastModifiedBy`}),"cp:lastPrinted":new In({tag:`cp:lastPrinted`,format:e.DateFormat}),"cp:revision":new mn({tag:`cp:revision`}),"cp:version":new J({tag:`cp:version`}),"cp:contentStatus":new J({tag:`cp:contentStatus`}),"cp:contentType":new J({tag:`cp:contentType`}),"dcterms:created":new In({tag:`dcterms:created`,attrs:e.DateAttrs,format:e.DateFormat}),"dcterms:modified":new In({tag:`dcterms:modified`,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(U.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES),this.map[`dc:creator`].render(t,n.creator),this.map[`dc:title`].render(t,n.title),this.map[`dc:subject`].render(t,n.subject),this.map[`dc:description`].render(t,n.description),this.map[`dc:identifier`].render(t,n.identifier),this.map[`dc:language`].render(t,n.language),this.map[`cp:keywords`].render(t,n.keywords),this.map[`cp:category`].render(t,n.category),this.map[`cp:lastModifiedBy`].render(t,n.lastModifiedBy),this.map[`cp:lastPrinted`].render(t,n.lastPrinted),this.map[`cp:revision`].render(t,n.revision),this.map[`cp:version`].render(t,n.version),this.map[`cp:contentStatus`].render(t,n.contentStatus),this.map[`cp:contentType`].render(t,n.contentType),this.map[`dcterms:created`].render(t,n.created),this.map[`dcterms:modified`].render(t,n.modified),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`cp:coreProperties`:case`coreProperties`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`cp:coreProperties`:case`coreProperties`:return this.model={creator:this.map[`dc:creator`].model,title:this.map[`dc:title`].model,subject:this.map[`dc:subject`].model,description:this.map[`dc:description`].model,identifier:this.map[`dc:identifier`].model,language:this.map[`dc:language`].model,keywords:this.map[`cp:keywords`].model,category:this.map[`cp:category`].model,lastModifiedBy:this.map[`cp:lastModifiedBy`].model,lastPrinted:this.map[`cp:lastPrinted`].model,revision:this.map[`cp:revision`].model,contentStatus:this.map[`cp:contentStatus`].model,contentType:this.map[`cp:contentType`].model,created:this.map[`dcterms:created`].model,modified:this.map[`dcterms:modified`].model},!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},Rn=class extends W{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(t),e.closeNode()}parseOpen(e){switch(e.name){case`t`:return this._text=[],this.model=``,!0;default:return!1}}parseText(e){this._text.push(e),this.model=this._text.join(``).replace(/_x([0-9A-F]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}parseClose(){return!1}},zn=class e extends W{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new Rn}get fontXform(){return this._fontXform||=new gn(e.FONT_OPTIONS)}render(e,t){let n=t||this.model;e.openNode(`r`),n.font&&this.fontXform.render(e,n.font),this.textXform.render(e,n.text),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`r`:return this.model={},!0;case`t`:return this.parser=this.textXform,this.parser.parseOpen(e),!0;case`rPr`:return this.parser=this.fontXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`r`:return!1;case`t`:return this.model.text=this.parser.model,this.parser=void 0,!0;case`rPr`:return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.FONT_OPTIONS={tagName:`rPr`,fontNameTag:`rFont`}}},Bn=class extends W{constructor(){super(),this.map={r:new zn,t:new Rn}}get tag(){return`rPh`}render(e,t){if(e.openNode(this.tag,{sb:t.sb||0,eb:t.eb||0}),t&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText){let{r:n}=this.map;t.richText.forEach(t=>{n.render(e,t)})}else t&&this.map.t.render(e,t.text);e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={sb:parseInt(e.attributes.sb,10),eb:parseInt(e.attributes.eb,10)},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model.text=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Vn=class extends W{constructor(e){super(),this.model=e,this.map={r:new zn,t:new Rn,rPh:new Bn}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Hn=class extends W{constructor(e){super(),this.model=e||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||=new Vn}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(e){return this.model.values[e]}add(e){return e.richText?this.addRichText(e):this.addText(e)}addText(e){let t=this.hash[e];return t===void 0&&(t=this.hash[e]=this.model.values.length,this.model.values.push(e)),this.model.count++,t}addRichText(e){let t=this.sharedStringXform.toXml(e),n=this.rich[t];return n===void 0&&(n=this.rich[t]=this.model.values.length,this.model.values.push(e)),this.model.count++,n}render(e,t){let n=t||this._values;e.openXml(U.StdDocAttributes),e.openNode(`sst`,{xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,count:n.count,uniqueCount:n.values.length});let r=this.sharedStringXform;n.values.forEach(t=>{r.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`sst`:return!0;case`si`:return this.parser=this.sharedStringXform,this.parser.parseOpen(e),!0;default:throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;switch(e){case`sst`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Un=class extends W{render(e,t){e.leafNode(`Relationship`,t)}parseOpen(e){switch(e.name){case`Relationship`:return this.model=e.attributes,!0;default:return!1}}parseText(){}parseClose(){return!1}},Y=class e extends W{constructor(){super(),this.map={Relationship:new Un}}render(t,n){let r=n||this._values;t.openXml(U.StdDocAttributes),t.openNode(`Relationships`,e.RELATIONSHIPS_ATTRIBUTES),r.forEach(e=>{this.map.Relationship.render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Relationships`:return this.model=[],!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.push(this.parser.model),this.parser=void 0),!0;switch(e){case`Relationships`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}},Wn=class e extends W{render(t,n){t.openXml(U.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};(n.media||[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:`/xl/workbook.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach((e,n)=>{let r=`/xl/worksheets/sheet${e.fileIndex||n+1}.xml`;t.leafNode(`Override`,{PartName:r,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables||[]).length&&(n.pivotTables||[]).forEach(e=>{let n=e.tableNumber;t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheDefinition${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheRecords${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotTables/pivotTable${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})}),t.leafNode(`Override`,{PartName:`/xl/theme/theme1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:`/xl/styles.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:`/xl/sharedStrings.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/tables/${e.target}`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/drawings/${e.name}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})}),n.commentRefs&&(t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:`/xl/${e}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})})),t.leafNode(`Override`,{PartName:`/docProps/core.xml`,ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:`/docProps/app.xml`,ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},Gn=class extends W{render(e,t){e.openNode(`HeadingPairs`),e.openNode(`vt:vector`,{size:2,baseType:`variant`}),e.openNode(`vt:variant`),e.leafNode(`vt:lpstr`,void 0,`Worksheets`),e.closeNode(),e.openNode(`vt:variant`),e.leafNode(`vt:i4`,void 0,t.length),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`HeadingPairs`}parseText(){}parseClose(e){return e!==`HeadingPairs`}},Kn=class extends W{render(e,t){e.openNode(`TitlesOfParts`),e.openNode(`vt:vector`,{size:t.length,baseType:`lpstr`}),t.forEach(t=>{e.leafNode(`vt:lpstr`,void 0,t.name)}),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`TitlesOfParts`}parseText(){}parseClose(e){return e!==`TitlesOfParts`}},qn=class e extends W{constructor(){super(),this.map={Company:new J({tag:`Company`}),Manager:new J({tag:`Manager`}),HeadingPairs:new Gn,TitleOfParts:new Kn}}render(t,n){t.openXml(U.StdDocAttributes),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitleOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company||``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitleOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},Jn=class extends W{constructor(){super(),this._parsedText=[]}render(e,t){e.openNode(`definedName`,{name:t.name,localSheetId:t.localSheetId}),e.writeText(t.ranges.join(`,`)),e.closeNode()}parseOpen(e){switch(e.name){case`definedName`:return this._parsedName=e.attributes.name,this._parsedLocalSheetId=e.attributes.localSheetId,this._parsedText=[],!0;default:return!1}}parseText(e){this._parsedText.push(e)}parseClose(){return this.model={name:this._parsedName,ranges:$n(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};const Yn=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,Xn=/^[$]?\d+:[$]?\d+$/,Zn=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function Qn(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let t=e.split(`!`).pop()||``;if(!Yn.test(t)&&!Xn.test(t)&&!Zn.test(t))return!1;try{let t=u.decodeEx(e);return`row`in t&&typeof t.row==`number`||`top`in t&&typeof t.top==`number`||`left`in t&&typeof t.left==`number`}catch{return!1}}function $n(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)||[]).length;if(!t){r?i+=`${e},`:Qn(e)&&n.push(e);return}let a=t%2==0;!r&&a&&Qn(e)?n.push(e):r&&!a?(r=!1,Qn(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}var er=class extends W{render(e,t){e.leafNode(`sheet`,{sheetId:t.id,name:t.name,state:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:je(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},tr=class extends W{render(e,t){let n={xWindow:t.x||0,yWindow:t.y||0,windowWidth:t.width||12e3,windowHeight:t.height||24e3,firstSheet:t.firstSheet,activeTab:t.activeTab};t.visibility&&t.visibility!==`visible`&&(n.visibility=t.visibility),e.leafNode(`workbookView`,n)}parseOpen(e){if(e.name===`workbookView`){let t=this.model={},n=function(e,n,r){t[e]=n===void 0?r:n},r=function(e,n,r){let i=n===void 0?r:parseInt(n,10);i!==void 0&&(t[e]=i)};return r(`x`,e.attributes.xWindow,0),r(`y`,e.attributes.yWindow,0),r(`width`,e.attributes.windowWidth,25e3),r(`height`,e.attributes.windowHeight,1e4),n(`visibility`,e.attributes.visibility,`visible`),r(`activeTab`,e.attributes.activeTab,void 0),r(`firstSheet`,e.attributes.firstSheet,void 0),!0}return!1}parseText(){}parseClose(){return!1}},nr=class extends W{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,defaultThemeVersion:164011,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},rr=class extends W{render(e,t){e.leafNode(`calcPr`,{calcId:171027,fullCalcOnLoad:t.fullCalcOnLoad?1:void 0})}parseOpen(e){return e.name===`calcPr`?(this.model={},!0):!1}parseText(){}parseClose(){return!1}},ir=class extends W{render(e,t){e.leafNode(`pivotCache`,{cacheId:t.cacheId,"r:id":t.rId})}parseOpen(e){return e.name===`pivotCache`?(this.model={cacheId:e.attributes.cacheId,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},ar=class e extends W{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new nr,bookViews:new K({tag:`bookViews`,count:!1,childXform:new tr}),sheets:new K({tag:`sheets`,count:!1,childXform:new er}),definedNames:new K({tag:`definedNames`,count:!1,childXform:new Jn}),calcPr:new rr,pivotCaches:new K({tag:`pivotCaches`,count:!1,childXform:new ir})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${i[0]}:$${i[1]}`],localSheetId:n};t.push(a)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media||[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(U.StdDocAttributes),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties),this.map.pivotCaches.render(t,n.pivotTables),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let t=(e.workbookRels||[]).reduce((e,t)=>(e[t.Id]=t,e),{}),n=[],r,i=0;(e.sheets||[]).forEach(a=>{let o=t[a.rId];o&&(r=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],r&&(r.name=a.name,r.id=a.id,r.state=a.state,n[i++]=r))});let a=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=u.decodeEx(e.ranges[0]);r.pageSetup.printArea=r.pageSetup.printArea?`${r.pageSetup.printArea}&&${t.dimensions}`:t.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,i=t.match(/\$\d+:\$\d+/);if(i&&i.length){let e=i[0];r.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];r.pageSetup.printTitlesColumn=e.replace(n,``)}}}else a.push(e)}),e.definedNames=a,e.media.forEach((e,t)=>{e.index=t})}static{this.WORKBOOK_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x15`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`}}static{this.STATIC_XFORMS={fileVersion:new G({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};const X={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`};var or=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{let t=`${e.master}:${e.address}`;this.merges[e.master]=new d(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let n=u.decode(e);for(let e=n.top;e<=n.bottom;e++){let r=t[e-1];for(let t=n.left;t<=n.right;t++){let i=r.cells[t-1];i?i.type===v.ValueType.Merge&&(i.master=n.tl):r.cells[t]={type:v.ValueType.Null,address:u.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function sr(e){if(e==null)return v.ValueType.Null;if(e instanceof String||typeof e==`string`)return v.ValueType.String;if(typeof e==`number`)return v.ValueType.Number;if(typeof e==`boolean`)return v.ValueType.Boolean;if(e instanceof Date)return v.ValueType.Date;if(e.text&&e.hyperlink)return v.ValueType.Hyperlink;if(e.formula)return v.ValueType.Formula;if(e.error)return v.ValueType.Error;throw Error(`I could not understand type of value`)}function cr(e){switch(e.type){case v.ValueType.Formula:return sr(e.result);default:return e.type}}var lr=class extends W{constructor(){super(),this.richTextXform=new zn}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},cr(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case v.ValueType.String:case v.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case v.ValueType.Date:t.date1904&&(e.date1904=!0);break;case v.ValueType.Hyperlink:t.sharedStrings&&e.text!==void 0&&e.text!==null&&(e.ssId=t.sharedStrings.add(e.text)),t.hyperlinks.push({address:e.address,target:e.hyperlink,tooltip:e.tooltip});break;case v.ValueType.Merge:t.merges.add(e);break;case v.ValueType.Formula:if(t.date1904&&(e.date1904=!0),e.shareType===`shared`&&(e.si=t.siFormulae++),e.formula)t.formulae[e.address]=e;else if(e.sharedFormula){let n=t.formulae[e.sharedFormula];if(!n)throw Error(`Shared Formula master must exist above and or left of clone for cell ${e.address}`);n.si===void 0?(n.shareType=`shared`,n.si=t.siFormulae++,n.range=new d(n.address,e.address)):n.range&&n.range.expandToAddress(e.address),e.si=n.si}break;default:break}}renderFormula(e,t){let n=null;switch(t.shareType){case`shared`:n={t:`shared`,ref:t.ref||t.range.range,si:t.si};break;case`array`:n={t:`array`,ref:t.ref};break;default:t.si!==void 0&&(n={t:`shared`,si:t.si});break}switch(sr(t.result)){case v.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case v.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case v.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case v.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case v.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case v.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,Oe(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===v.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case v.ValueType.Null:break;case v.ValueType.Number:e.leafNode(`v`,null,t.value);break;case v.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case v.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case v.ValueType.String:case v.ValueType.RichText:t.ssId===void 0?t.value&&t.value.richText?(e.addAttribute(`t`,`inlineStr`),e.openNode(`is`),t.value.richText.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(`is`)):(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.value)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case v.ValueType.Date:e.leafNode(`v`,null,Oe(t.value,t.date1904));break;case v.ValueType.Hyperlink:t.ssId===void 0?(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.text)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case v.ValueType.Formula:this.renderFormula(e,t);break;case v.ValueType.Merge:break;default:break}e.closeNode()}}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`c`:return this.model={address:e.attributes.r},this.t=e.attributes.t,e.attributes.s&&(this.model.styleId=parseInt(e.attributes.s,10)),!0;case`f`:return this.currentNode=`f`,this.model.si=e.attributes.si,this.model.shareType=e.attributes.t,this.model.ref=e.attributes.ref,!0;case`v`:return this.currentNode=`v`,!0;case`t`:return this.currentNode=`t`,!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){if(this.parser){this.parser.parseText(e);return}switch(this.currentNode){case`f`:this.model.formula=this.model.formula?this.model.formula+e:e;break;case`v`:case`t`:this.model.value&&this.model.value.richText?this.model.value.richText.text=this.model.value.richText.text?this.model.value.richText.text+e:e:this.model.value=this.model.value?this.model.value+e:e;break;default:break}}parseClose(e){switch(e){case`c`:{let{model:e}=this;if(e.formula||e.shareType)e.type=v.ValueType.Formula,e.value&&=(this.t===`str`?e.result=je(e.value):this.t===`b`?e.result=parseInt(e.value,10)!==0:this.t===`e`?e.result={error:e.value}:e.result=parseFloat(e.value),void 0);else if(e.value!==void 0)switch(this.t){case`s`:e.type=v.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=v.ValueType.String,e.value=je(e.value);break;case`inlineStr`:e.type=v.ValueType.String;break;case`b`:e.type=v.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=v.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=v.ValueType.Date,e.value=new Date(e.value);break;default:e.type=v.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=v.ValueType.Null:e.type=v.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText||[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case v.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=v.ValueType.RichText);break;case v.ValueType.Number:n&&Ne(n.numFmt)&&(e.type=v.ValueType.Date,e.value=ke(e.value,t.date1904));break;case v.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&Ne(n.numFmt)&&(e.result=ke(e.result,t.date1904)),e.shareType===`shared`&&(e.ref?t.formulae[e.si]=e.address:(e.sharedFormula=t.formulae[e.si],delete e.shareType),delete e.si);break;default:break}let r=t.hyperlinkMap[e.address];r&&(e.type===v.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=v.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},ur=class extends W{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new lr}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height&&(e.addAttribute(`ht`,t.height),e.addAttribute(`customHeight`,`1`)),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),e.addAttribute(`x14ac:dyDescent`,`0.25`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),I(e.attributes.hidden)&&(n.hidden=!0),I(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),I(e.attributes.collapsed)&&(n.collapsed=!0),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=u.decodeAddress(e.address).col:(this.lastCellCol+=1,e.address=u.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId?t.styles.getStyleModel(e.styleId):{},e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},dr=class extends W{get tag(){return`col`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{});n&&(e.styleId=n)}render(e,t){e.openNode(`col`),e.addAttribute(`min`,t.min),e.addAttribute(`max`,t.max),t.width&&e.addAttribute(`width`,t.width),t.styleId&&e.addAttribute(`style`,t.styleId),t.hidden&&e.addAttribute(`hidden`,`1`),t.bestFit&&e.addAttribute(`bestFit`,`1`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`),e.addAttribute(`customWidth`,`1`),e.closeNode()}parseOpen(e){if(e.name===`col`){let t=this.model={min:parseInt(e.attributes.min||`0`,10),max:parseInt(e.attributes.max||`0`,10),width:e.attributes.width===void 0?void 0:parseFloat(e.attributes.width||`0`)};return e.attributes.style&&(t.styleId=parseInt(e.attributes.style,10)),I(e.attributes.hidden)&&(t.hidden=!0),I(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),I(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId&&(e.style=t.styles.getStyleModel(e.styleId))}},fr=class extends W{get tag(){return`dimension`}render(e,t){t&&e.leafNode(`dimension`,{ref:t})}parseOpen(e){return e.name===`dimension`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},pr=class extends W{get tag(){return`hyperlink`}render(e,t){this.isInternalLink(t)?e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip,location:t.target}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){return e.name===`hyperlink`?(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location&&(this.model.target=e.attributes.location),!0):!1}parseText(){}parseClose(){return!1}isInternalLink(e){return!!(e.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(e.target))}},mr=class extends W{get tag(){return`mergeCell`}render(e,t){e.leafNode(`mergeCell`,{ref:t})}parseOpen(e){return e.name===`mergeCell`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}};function hr(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function gr(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=I(i)}function _r(e){if(!e)return[];let t=[],n={};for(let[r,i]of Object.entries(e))if(i!=null)if(r.startsWith(`range:`)){let e=r.slice(6),{sqref:n,...a}=i;t.push({...a,sqref:e})}else n[r]=i;if(Object.keys(n).length===0)return t;let r=Object.entries(n).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),i=Object.fromEntries(r.map(e=>[e.address,e])),a=(e,t,r)=>{for(let i=0;i<t;i++){let t=u.encodeAddress(e.row+i,r);if(!n[t]||!x(n[e.address],n[t]))return!1}return!0},o=r.map(e=>{if(!e.marked){let t=u.decodeEx(e.address);if(t.dimensions)return i[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let r=1,o=u.encodeAddress(t.row+r,t.col);for(;n[o]&&x(e.dataValidation,n[o]);)r++,o=u.encodeAddress(t.row+r,t.col);let s=1;for(;a(t,r,t.col+s);)s++;for(let e=0;e<r;e++)for(let n=0;n<s;n++)o=u.encodeAddress(t.row+e,t.col+n),i[o].marked=!0;if(r>1||s>1){let n=t.row+(r-1),i=t.col+(s-1);return{...e.dataValidation,sqref:`${e.address}:${u.encodeAddress(n,i)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...o]}var vr=class extends W{get tag(){return`dataValidations`}render(e,t){let n=_r(t);n.length&&(e.openNode(`dataValidations`,{count:n.length}),n.forEach(t=>{e.openNode(`dataValidation`),t.type!==`any`&&(e.addAttribute(`type`,t.type),t.operator&&t.type!==`list`&&t.operator!==`between`&&e.addAttribute(`operator`,t.operator),t.allowBlank&&e.addAttribute(`allowBlank`,`1`)),t.showInputMessage&&e.addAttribute(`showInputMessage`,`1`),t.promptTitle&&e.addAttribute(`promptTitle`,t.promptTitle),t.prompt&&e.addAttribute(`prompt`,t.prompt),t.showErrorMessage&&e.addAttribute(`showErrorMessage`,`1`),t.errorStyle&&e.addAttribute(`errorStyle`,t.errorStyle),t.errorTitle&&e.addAttribute(`errorTitle`,t.errorTitle),t.error&&e.addAttribute(`error`,t.error),e.addAttribute(`sqref`,t.sqref),(t.formulae||[]).forEach((n,r)=>{e.openNode(`formula${r+1}`),t.type===`date`?e.writeText(Oe(new Date(n))):e.writeText(n),e.closeNode()}),e.closeNode()}),e.closeNode())}parseOpen(e){switch(e.name){case`dataValidations`:return this.model={},!0;case`dataValidation`:{this._address=e.attributes.sqref;let t={type:e.attributes.type||`any`,formulae:[]};switch(e.attributes.type&&gr(t,e.attributes,`allowBlank`),gr(t,e.attributes,`showInputMessage`),gr(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:hr(t,e.attributes,`operator`,`between`);break}return hr(t,e.attributes,`promptTitle`),hr(t,e.attributes,`prompt`),hr(t,e.attributes,`errorStyle`),hr(t,e.attributes,`errorTitle`),hr(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach(e=>{if(e.includes(`:`)){let t=new d(e);(t.bottom-t.top+1)*(t.right-t.left+1)<=1e3?t.forEachAddress(e=>{this.model[e]=this._dataValidation}):this.model[`range:${e}`]=this._dataValidation}else this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=ke(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},yr=class extends W{get tag(){return`pageSetUpPr`}render(e,t){return t&&t.fitToPage?(e.leafNode(this.tag,{fitToPage:t.fitToPage?`1`:void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={fitToPage:e.attributes.fitToPage===`1`},!0):!1}parseText(){}parseClose(){return!1}};const br=e=>e!==void 0;var xr=class extends W{get tag(){return`outlinePr`}render(e,t){return t&&(br(t.summaryBelow)||br(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:br(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:br(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:br(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:br(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},Sr=class extends W{constructor(){super(),this.map={tabColor:new q(`tabColor`),pageSetUpPr:new yr,outlinePr:new xr}}get tag(){return`sheetPr`}render(e,t){if(t){e.addRollback(),e.openNode(`sheetPr`);let n=!1;n=this.map.tabColor.render(e,t.tabColor)||n,n=this.map.pageSetUpPr.render(e,t.pageSetup)||n,n=this.map.outlinePr.render(e,t.outlineProperties)||n,n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):this.map[e.name]?(this.parser=this.map[e.name],this.parser.parseOpen(e),!0):!1}parseText(e){return this.parser?(this.parser.parseText(e),!0):!1}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}},Cr=class extends W{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow,outlineLevelCol:t.outlineLevelCol,"x14ac:dyDescent":t.dyDescent};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),(!t.defaultRowHeight||t.defaultRowHeight!==15)&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight||`0`),dyDescent:parseFloat(e.attributes[`x14ac:dyDescent`]||`0`),outlineLevelRow:parseInt(e.attributes.outlineLevelRow||`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol||`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),!0):!1}parseText(){}parseClose(){return!1}};const wr={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var Tr=class extends W{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){e.openNode(`sheetView`,{workbookViewId:t.workbookViewId||0});let n=function(t,n,r){r&&e.addAttribute(t,n)};n(`rightToLeft`,`1`,t.rightToLeft===!0),n(`tabSelected`,`1`,t.tabSelected),n(`showRuler`,`0`,t.showRuler===!1),n(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),n(`showGridLines`,`0`,t.showGridLines===!1),n(`zoomScale`,t.zoomScale,t.zoomScale),n(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal),n(`view`,t.style,t.style);let r,i,a,o;switch(t.state){case`frozen`:i=t.xSplit||0,a=t.ySplit||0,r=t.topLeftCell||u.getAddress(a+1,i+1).address,o=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:r,activePane:o,state:`frozen`}),e.leafNode(`selection`,{pane:o,activeCell:t.activeCell,sqref:t.activeCell});break;case`split`:t.activePane===`topLeft`&&(t.activePane=void 0),e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode(`selection`,{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case`normal`:t.activeCell&&e.leafNode(`selection`,{activeCell:t.activeCell,sqref:t.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale||`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal||`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit||`0`,10),ySplit:parseInt(e.attributes.ySplit||`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane||`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane||`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:wr[this.pane.state]||`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function Z(e,t){return e?t:void 0}function Q(e,t){return e===t?!0:void 0}var Er=class extends W{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:Z(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:Z(t.formatCells,`0`),formatColumns:Z(t.formatColumns,`0`),formatRows:Z(t.formatRows,`0`),insertColumns:Z(t.insertColumns,`0`),insertRows:Z(t.insertRows,`0`),insertHyperlinks:Z(t.insertHyperlinks,`0`),deleteColumns:Z(t.deleteColumns,`0`),deleteRows:Z(t.deleteRows,`0`),sort:Z(t.sort,`0`),autoFilter:Z(t.autoFilter,`0`),pivotTables:Z(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=Z(t.objects===!1,`1`),n.scenarios=Z(t.scenarios===!1,`1`)),Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={sheet:Q(e.attributes.sheet,`1`),objects:e.attributes.objects===`1`?!1:void 0,scenarios:e.attributes.scenarios===`1`?!1:void 0,selectLockedCells:e.attributes.selectLockedCells===`1`?!1:void 0,selectUnlockedCells:e.attributes.selectUnlockedCells===`1`?!1:void 0,formatCells:Q(e.attributes.formatCells,`0`),formatColumns:Q(e.attributes.formatColumns,`0`),formatRows:Q(e.attributes.formatRows,`0`),insertColumns:Q(e.attributes.insertColumns,`0`),insertRows:Q(e.attributes.insertRows,`0`),insertHyperlinks:Q(e.attributes.insertHyperlinks,`0`),deleteColumns:Q(e.attributes.deleteColumns,`0`),deleteRows:Q(e.attributes.deleteRows,`0`),sort:Q(e.attributes.sort,`0`),autoFilter:Q(e.attributes.autoFilter,`0`),pivotTables:Q(e.attributes.pivotTables,`0`)},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0;default:return!1}}parseText(){}parseClose(){return!1}},Dr=class extends W{get tag(){return`pageMargins`}render(e,t){if(t){let n={left:t.left,right:t.right,top:t.top,bottom:t.bottom,header:t.header,footer:t.footer};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={left:parseFloat(e.attributes.left||.7),right:parseFloat(e.attributes.right||.7),top:parseFloat(e.attributes.top||.75),bottom:parseFloat(e.attributes.bottom||.75),header:parseFloat(e.attributes.header||.3),footer:parseFloat(e.attributes.footer||.3)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Or(e){return e?`1`:void 0}function kr(e){switch(e){case`overThenDown`:return e;default:return}}function Ar(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function jr(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Mr(e){return e===void 0?void 0:parseInt(e,10)}var Nr=class extends W{get tag(){return`pageSetup`}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:t.horizontalDpi,verticalDpi:t.verticalDpi,pageOrder:kr(t.pageOrder),blackAndWhite:Or(t.blackAndWhite),draft:Or(t.draft),cellComments:Ar(t.cellComments),errors:jr(t.errors),scale:t.scale,fitToWidth:t.fitToWidth,fitToHeight:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Or(!!t.firstPageNumber),usePrinterDefaults:Or(t.usePrinterDefaults),copies:t.copies};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={paperSize:Mr(e.attributes.paperSize),orientation:e.attributes.orientation||`portrait`,horizontalDpi:parseInt(e.attributes.horizontalDpi||`4294967295`,10),verticalDpi:parseInt(e.attributes.verticalDpi||`4294967295`,10),pageOrder:e.attributes.pageOrder||`downThenOver`,blackAndWhite:e.attributes.blackAndWhite===`1`,draft:e.attributes.draft===`1`,cellComments:e.attributes.cellComments||`None`,errors:e.attributes.errors||`displayed`,scale:parseInt(e.attributes.scale||`100`,10),fitToWidth:parseInt(e.attributes.fitToWidth||`1`,10),fitToHeight:parseInt(e.attributes.fitToHeight||`1`,10),firstPageNumber:parseInt(e.attributes.firstPageNumber||`1`,10),useFirstPageNumber:e.attributes.useFirstPageNumber===`1`,usePrinterDefaults:e.attributes.usePrinterDefaults===`1`,copies:parseInt(e.attributes.copies||`1`,10)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Pr(e){return e?`1`:void 0}var Fr=class extends W{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:Pr(t.showRowColHeaders),gridLines:Pr(t.showGridLines),horizontalCentered:Pr(t.horizontalCentered),verticalCentered:Pr(t.verticalCentered)};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={showRowColHeaders:e.attributes.headings===`1`,showGridLines:e.attributes.gridLines===`1`,horizontalCentered:e.attributes.horizontalCentered===`1`,verticalCentered:e.attributes.verticalCentered===`1`},!0;default:return!1}}parseText(){}parseClose(){return!1}},Ir=class extends W{get tag(){return`autoFilter`}render(e,t){if(t)if(typeof t==`string`)e.leafNode(`autoFilter`,{ref:t});else{let n=function(e){return typeof e==`string`?e:u.getAddress(e.row,e.column).address},r=n(t.from),i=n(t.to);r&&i&&e.leafNode(`autoFilter`,{ref:`${r}:${i}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},Lr=class extends W{get tag(){return`picture`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Rr=class extends W{get tag(){return`drawing`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},zr=class extends W{get tag(){return`tablePart`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Br=class extends W{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){return e.name===`brk`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},Vr=class extends K{constructor(){let e={tag:`rowBreaks`,count:!0,childXform:new Br};super(e)}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),this.count&&(e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length));let{childXform:n}=this;t.forEach(t=>{n.render(e,t)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}},Hr=class extends W{get tag(){return`headerFooter`}render(e,t){if(t){e.addRollback();let n=!1;e.openNode(`headerFooter`),t.differentFirst&&(e.addAttribute(`differentFirst`,`1`),n=!0),t.differentOddEven&&(e.addAttribute(`differentOddEven`,`1`),n=!0),t.oddHeader&&typeof t.oddHeader==`string`&&(e.leafNode(`oddHeader`,null,t.oddHeader),n=!0),t.oddFooter&&typeof t.oddFooter==`string`&&(e.leafNode(`oddFooter`,null,t.oddFooter),n=!0),t.evenHeader&&typeof t.evenHeader==`string`&&(e.leafNode(`evenHeader`,null,t.evenHeader),n=!0),t.evenFooter&&typeof t.evenFooter==`string`&&(e.leafNode(`evenFooter`,null,t.evenFooter),n=!0),t.firstHeader&&typeof t.firstHeader==`string`&&(e.leafNode(`firstHeader`,null,t.firstHeader),n=!0),t.firstFooter&&typeof t.firstFooter==`string`&&(e.leafNode(`firstFooter`,null,t.firstFooter),n=!0),n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){switch(e.name){case`headerFooter`:return this.model={},e.attributes.differentFirst&&(this.model.differentFirst=parseInt(e.attributes.differentFirst,0)===1),e.attributes.differentOddEven&&(this.model.differentOddEven=parseInt(e.attributes.differentOddEven,0)===1),!0;case`oddHeader`:return this.currentNode=`oddHeader`,!0;case`oddFooter`:return this.currentNode=`oddFooter`,!0;case`evenHeader`:return this.currentNode=`evenHeader`,!0;case`evenFooter`:return this.currentNode=`evenFooter`,!0;case`firstHeader`:return this.currentNode=`firstHeader`,!0;case`firstFooter`:return this.currentNode=`firstFooter`,!0;default:return!1}}parseText(e){switch(this.currentNode){case`oddHeader`:this.model.oddHeader=(this.model.oddHeader||``)+e;break;case`oddFooter`:this.model.oddFooter=(this.model.oddFooter||``)+e;break;case`evenHeader`:this.model.evenHeader=(this.model.evenHeader||``)+e;break;case`evenFooter`:this.model.evenFooter=(this.model.evenFooter||``)+e;break;case`firstHeader`:this.model.firstHeader=(this.model.firstHeader||``)+e;break;case`firstFooter`:this.model.firstFooter=(this.model.firstFooter||``)+e;break;default:break}}parseClose(){switch(this.currentNode){case`oddHeader`:case`oddFooter`:case`evenHeader`:case`evenFooter`:case`firstHeader`:case`firstFooter`:return this.currentNode=void 0,!0;default:return!1}}},$=class extends W{createNewModel(e){return{}}parseOpen(e){return this.parser=this.parser||this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=this.createNewModel(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}onParserClose(e,t){this.model[e]=t.model}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.onParserClose(e,this.parser),this.parser=void 0),!0):e!==this.tag}get tag(){return``}},Ur=class extends W{get tag(){return`cfvo`}render(e,t){e.leafNode(this.tag,{type:t.type,val:t.value})}parseOpen(e){this.model={type:e.attributes.type,value:W.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},Wr=class extends ${constructor(){super(),this.map={cfvo:this.cfvoXform=new Ur,color:this.colorXform=new q}}get tag(){return`dataBar`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.colorXform.render(e,t.color),e.closeNode()}createNewModel(){return{cfvo:[]}}onParserClose(e,t){switch(e){case`cfvo`:this.model.cfvo.push(t.model);break;case`color`:this.model.color=t.model;break}}},Gr=class extends W{get tag(){return`x14:id`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Kr=class extends ${constructor(){super(),this.map={"x14:id":this.idXform=new Gr}}get tag(){return`ext`}render(e,t){e.openNode(this.tag,{uri:`{B025F937-C7B1-47D3-B67F-A62EFF666E3E}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.idXform.render(e,t.x14Id),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model.x14Id=t.model}},qr=class extends ${constructor(){super(),this.map={ext:new Kr}}get tag(){return`extLst`}render(e,t){e.openNode(this.tag),this.map.ext.render(e,t),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){Object.assign(this.model,t.model)}},Jr=class extends W{get tag(){return`formula`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Yr=class extends ${constructor(){super(),this.map={cfvo:this.cfvoXform=new Ur,color:this.colorXform=new q}}get tag(){return`colorScale`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.color.forEach(t=>{this.colorXform.render(e,t)}),e.closeNode()}createNewModel(e){return{cfvo:[],color:[]}}onParserClose(e,t){this.model[e].push(t.model)}},Xr=class extends ${constructor(){super(),this.map={cfvo:this.cfvoXform=new Ur}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:W.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:W.toBoolAttribute(t.reverse,!1),showValue:W.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:W.toStringValue(e.iconSet,`3TrafficLights`),reverse:W.toBoolValue(e.reverse),showValue:W.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};const Zr={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},Qr=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new d(e.ref);switch(e.operator){case`containsText`:return`NOT(ISERROR(SEARCH("${e.text}",${t})))`;case`containsBlanks`:return`LEN(TRIM(${t}))=0`;case`notContainsBlanks`:return`LEN(TRIM(${t}))>0`;case`containsErrors`:return`ISERROR(${t})`;case`notContainsErrors`:return`NOT(ISERROR(${t}))`;default:return}},$r=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new d(e.ref);switch(e.timePeriod){case`thisWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(${t},0)-TODAY()<=7-WEEKDAY(TODAY()))`;case`lastWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(${t},0)<(WEEKDAY(TODAY())+7))`;case`nextWeek`:return`AND(ROUNDDOWN(${t},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(${t},0)-TODAY()<(15-WEEKDAY(TODAY())))`;case`yesterday`:return`FLOOR(${t},1)=TODAY()-1`;case`today`:return`FLOOR(${t},1)=TODAY()`;case`tomorrow`:return`FLOOR(${t},1)=TODAY()+1`;case`last7Days`:return`AND(TODAY()-FLOOR(${t},1)<=6,FLOOR(${t},1)<=TODAY())`;case`lastMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0-1)),YEAR(${t})=YEAR(EDATE(TODAY(),0-1)))`;case`thisMonth`:return`AND(MONTH(${t})=MONTH(TODAY()),YEAR(${t})=YEAR(TODAY()))`;case`nextMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0+1)),YEAR(${t})=YEAR(EDATE(TODAY(),0+1)))`;default:return}},ei=e=>{let{type:t,operator:n}=e;switch(t){case`containsText`:case`containsBlanks`:case`notContainsBlanks`:case`containsErrors`:case`notContainsErrors`:return{type:`containsText`,operator:t};default:return{type:t,operator:n}}};var ti=class e extends ${constructor(){super(),this.map={dataBar:this.databarXform=new Wr,extLst:this.extLstRefXform=new qr,formula:this.formulaXform=new Jr,colorScale:this.colorScaleXform=new Yr,iconSet:this.iconSetXform=new Xr}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||Zr[e.iconSet]))}render(e,t){switch(t.type){case`expression`:this.renderExpression(e,t);break;case`cellIs`:this.renderCellIs(e,t);break;case`top10`:this.renderTop10(e,t);break;case`aboveAverage`:this.renderAboveAverage(e,t);break;case`dataBar`:this.renderDataBar(e,t);break;case`colorScale`:this.renderColorScale(e,t);break;case`iconSet`:this.renderIconSet(e,t);break;case`containsText`:this.renderText(e,t);break;case`timePeriod`:this.renderTimePeriod(e,t);break}}renderExpression(e,t){e.openNode(this.tag,{type:`expression`,dxfId:t.dxfId,priority:t.priority}),this.formulaXform.render(e,t.formulae[0]),e.closeNode()}renderCellIs(e,t){e.openNode(this.tag,{type:`cellIs`,dxfId:t.dxfId,priority:t.priority,operator:t.operator}),t.formulae.forEach(t=>{this.formulaXform.render(e,t)}),e.closeNode()}renderTop10(e,t){e.leafNode(this.tag,{type:`top10`,dxfId:t.dxfId,priority:t.priority,percent:W.toBoolAttribute(t.percent,!1),bottom:W.toBoolAttribute(t.bottom,!1),rank:W.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:W.toBoolAttribute(t.aboveAverage,!0)})}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,priority:t.priority}),this.databarXform.render(e,t),this.extLstRefXform.render(e,t),e.closeNode()}renderColorScale(e,t){e.openNode(this.tag,{type:`colorScale`,priority:t.priority}),this.colorScaleXform.render(e,t),e.closeNode()}renderIconSet(t,n){e.isPrimitive(n)&&(t.openNode(this.tag,{type:`iconSet`,priority:n.priority}),this.iconSetXform.render(t,n),t.closeNode())}renderText(e,t){e.openNode(this.tag,{type:t.operator,dxfId:t.dxfId,priority:t.priority,operator:W.toStringAttribute(t.operator,`containsText`)});let n=Qr(t);n&&this.formulaXform.render(e,n),e.closeNode()}renderTimePeriod(e,t){e.openNode(this.tag,{type:`timePeriod`,dxfId:t.dxfId,priority:t.priority,timePeriod:t.timePeriod});let n=$r(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...ei(e),dxfId:W.toIntValue(e.dxfId),priority:W.toIntValue(e.priority),timePeriod:e.timePeriod,percent:W.toBoolValue(e.percent),bottom:W.toBoolValue(e.bottom),rank:W.toIntValue(e.rank),aboveAverage:W.toBoolValue(e.aboveAverage)}}onParserClose(e,t){switch(e){case`dataBar`:case`extLst`:case`colorScale`:case`iconSet`:Object.assign(this.model,t.model);break;case`formula`:this.model.formulae=this.model.formulae||[],this.model.formulae.push(t.model);break}}},ni=class extends ${constructor(){super(),this.map={cfRule:new ti}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(ti.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{ti.isPrimitive(n)&&(n.ref=t.ref,this.map.cfRule.render(e,n))}),e.closeNode())}createNewModel({attributes:e}){return{ref:e.sqref,rules:[]}}onParserClose(e,t){this.model.rules.push(t.model)}},ri=class extends W{constructor(){super(),this.cfXform=new ni}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority||0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style))})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},ii=class extends W{get tag(){return`xm:f`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},ai=class extends ${constructor(){super(),this.map={"xm:f":this.fExtXform=new ii}}get tag(){return`x14:cfvo`}render(e,t){e.openNode(this.tag,{type:t.type}),t.value!==void 0&&this.fExtXform.render(e,t.value),e.closeNode()}createNewModel(e){return{type:e.attributes.type}}onParserClose(e,t){switch(e){case`xm:f`:this.model.value=t.model?parseFloat(t.model):0;break}}},oi=class extends ${constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ai,"x14:borderColor":this.borderColorXform=new q(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new q(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new q(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new q(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:W.toIntAttribute(t.minLength,0,!0),maxLength:W.toIntAttribute(t.maxLength,100,!0),border:W.toBoolAttribute(t.border,!1),gradient:W.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:W.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:W.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:W.toAttribute(t.axisPosition,`auto`),direction:W.toAttribute(t.direction,`leftToRight`)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.borderColorXform.render(e,t.borderColor),this.negativeBorderColorXform.render(e,t.negativeBorderColor),this.negativeFillColorXform.render(e,t.negativeFillColor),this.axisColorXform.render(e,t.axisColor),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],minLength:W.toIntValue(e.minLength,0),maxLength:W.toIntValue(e.maxLength,100),border:W.toBoolValue(e.border,!1),gradient:W.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:W.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:W.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:W.toStringValue(e.axisPosition,`auto`),direction:W.toStringValue(e.direction,`leftToRight`)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;default:this.model[n]=t.model;break}}},si=class extends W{get tag(){return`x14:cfIcon`}render(e,t){e.leafNode(this.tag,{iconSet:t.iconSet,iconId:t.iconId})}parseOpen({attributes:e}){this.model={iconSet:e.iconSet,iconId:W.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},ci=class extends ${constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ai,"x14:cfIcon":this.cfIconXform=new si}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:W.toStringAttribute(t.iconSet),reverse:W.toBoolAttribute(t.reverse,!1),showValue:W.toBoolAttribute(t.showValue,!0),custom:W.toBoolAttribute(t.icons,!1)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.icons&&t.icons.forEach((t,n)=>{t.iconId=n,this.cfIconXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],iconSet:W.toStringValue(e.iconSet,`3TrafficLights`),reverse:W.toBoolValue(e.reverse,!1),showValue:W.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};const li={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var ui=class e extends ${constructor(){super(),this.map={"x14:dataBar":this.databarXform=new oi,"x14:iconSet":this.iconSetXform=new ci}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?oi.isExt(e):!!(e.type===`iconSet`&&(e.custom||li[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${crypto.randomUUID()}}`.toUpperCase())}render(t,n){if(e.isExt(n))switch(n.type){case`dataBar`:this.renderDataBar(t,n);break;case`iconSet`:this.renderIconSet(t,n);break}}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,id:t.x14Id}),this.databarXform.render(e,t),e.closeNode()}renderIconSet(e,t){e.openNode(this.tag,{type:`iconSet`,priority:t.priority,id:t.x14Id||`{${crypto.randomUUID()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:W.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},di=class extends W{get tag(){return`xm:sqref`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},fi=class extends ${constructor(){super(),this.map={"xm:sqref":this.sqRef=new di,"x14:cfRule":this.cfRule=new ui}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(ui.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(ui.isExt).forEach(t=>this.cfRule.render(e,t)),this.sqRef.render(e,t.ref),e.closeNode())}createNewModel(){return{rules:[]}}onParserClose(e,t){switch(e){case`xm:sqref`:this.model.ref=t.model;break;case`x14:cfRule`:this.model.rules.push(t.model);break}}},pi=class extends ${constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new fi}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(ui.isExt))),e.hasExtContent}prepare(e){e.forEach(e=>{this.cfXform.prepare(e)})}render(e,t){this.hasContent(t)&&(e.openNode(this.tag),t.forEach(t=>this.cfXform.render(e,t)),e.closeNode())}createNewModel(){return[]}onParserClose(e,t){this.model.push(t.model)}},mi=class extends ${constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new pi}}get tag(){return`ext`}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e){this.conditionalFormattings.prepare(e.conditionalFormattings)}render(e,t){e.openNode(`ext`,{uri:`{78C0D931-6437-407d-A8EE-F0AAD7539E65}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.conditionalFormattings.render(e,t.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}},hi=class extends ${constructor(){super(),this.map={ext:this.ext=new mi}}get tag(){return`extLst`}prepare(e,t){this.ext.prepare(e)}hasContent(e){return this.ext.hasContent(e)}render(e,t){this.hasContent(t)&&(e.openNode(`extLst`),this.ext.render(e,t),e.closeNode())}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}};const gi=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},_i=(e,t)=>{if(!t||!t.length)return e;if(!e||!e.length)return t;let n={},r={};return e.forEach(e=>{n[e.ref]=e,e.rules.forEach(e=>{let{x14Id:t}=e;t&&(r[t]=e)})}),t.forEach(t=>{t.rules.forEach(i=>{let a=r[i.x14Id];a?gi(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var vi=class e extends W{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r||[],this.map={sheetPr:new Sr,dimension:new fr,sheetViews:new K({tag:`sheetViews`,count:!1,childXform:new Tr}),sheetFormatPr:new Cr,cols:new K({tag:`cols`,count:!1,childXform:new dr}),sheetData:new K({tag:`sheetData`,count:!1,empty:!0,childXform:new ur({maxItems:n}),maxItems:t}),autoFilter:new Ir,mergeCells:new K({tag:`mergeCells`,count:!0,childXform:new mr}),rowBreaks:new Vr,hyperlinks:new K({tag:`hyperlinks`,count:!1,childXform:new pr}),pageMargins:new Dr,dataValidations:new vr,pageSetup:new Nr,headerFooter:new Hr,printOptions:new Fr,picture:new Lr,drawing:new Rr,sheetProtection:new Er,tableParts:new K({tag:`tableParts`,count:!0,childXform:new zr}),conditionalFormatting:new ri,extLst:new hi}}prepare(e,t){t.merges=new or,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;let n=e.rels=[];function r(e){return`rId${e.length+1}`}if(e.hyperlinks.forEach(e=>{let t=r(n);e.rId=t,n.push({Id:t,Type:X.Hyperlink,Target:e.target,TargetMode:`External`})}),e.comments.length>0){let i={Id:r(n),Type:X.Comments,Target:`../comments${e.id}.xml`};n.push(i);let a={Id:r(n),Type:X.VmlDrawing,Target:`../drawings/vmlDrawing${e.id}.vml`};n.push(a),e.comments.forEach(e=>{e.refAddress=u.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${e.id}`,vmlDrawing:`vmlDrawing${e.id}`})}let i=[],a;e.media.forEach(o=>{if(o.type===`background`){let i=r(n);a=t.media[o.imageId],n.push({Id:i,Type:X.Image,Target:`../media/${a.name}.${a.extension}`}),e.background={rId:i},e.image=t.media[o.imageId]}else if(o.type===`image`){let{drawing:s}=e;a=t.media[o.imageId],s||(s=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(s),n.push({Id:s.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:`../drawings/${s.name}.xml`}));let c=this.preImageId===o.imageId?i[o.imageId]:i[s.rels.length];c||(c=r(s.rels),i[s.rels.length]=c,s.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:`../media/${a.name}.${a.extension}`}));let l={picture:{rId:c},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){let e=r(s.rels);i[s.rels.length]=e,l.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:e},s.rels.push({Id:e,Type:X.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=o.imageId,s.anchors.push(l)}}),e.tables.forEach(e=>{let i=r(n);e.rId=i,n.push({Id:i,Type:X.Table,Target:`../tables/${e.target}`}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables||[]).forEach(e=>{n.push({Id:r(n),Type:X.PivotTable,Target:`../pivotTables/pivotTable${e.tableNumber}.xml`})}),this.map.extLst.prepare(e,t)}render(t,n){t.openXml(U.StdDocAttributes),t.openNode(`worksheet`,e.WORKSHEET_ATTRIBUTES);let r=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow}:void 0;n.properties&&n.properties.defaultColWidth&&(r.defaultColWidth=n.properties.defaultColWidth);let i={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},a=n.pageSetup&&n.pageSetup.margins,o={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},s=n.sheetProtection;this.map.sheetPr.render(t,i),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,r),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,s),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,o),this.map.pageMargins.render(t,a),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),n.rels&&n.rels.forEach(e=>{e.Type===X.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=_i(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships||[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===X.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===X.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings[r.Target].comments;e.comments.forEach((e,t)=>{e.note=Object.assign({},e.note,n[t])})}return n},{});if(t.commentsMap=(e.comments||[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks||[]).reduce((e,t)=>(t.rId&&(e[t.address]=n[t.rId].Target),e),{}),t.formulae={},e.rows=e.rows&&e.rows.filter(Boolean)||[],e.rows.forEach(e=>{e.cells=e.cells&&e.cells.filter(Boolean)||[]}),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){let r=n[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(r){let n=r[1];t.drawings[n].anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}})}}let r=e.background&&n[e.background.rId];if(r){let n=r.Target.split(`/media/`)[1],i=t.mediaIndex&&t.mediaIndex[n];i!==void 0&&e.media.push({type:`background`,imageId:i})}e.tables=(e.tables||[]).map(e=>{let r=n[e.rId];return t.tables[r.Target]}),e.pivotTables=[],(e.relationships||[]).forEach(n=>{if(n.Type===X.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},yi=class extends W{parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={range:{editAs:e.attributes.editAs||`oneCell`}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}reconcilePicture(e,t){if(e&&e.rId){let n=t.rels[e.rId].Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);if(n){let e=n[1],r=t.mediaIndex[e];return t.media[r]}}}},bi=class extends W{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new mn({tag:`xdr:col`,zero:!0}),"xdr:colOff":new mn({tag:`xdr:colOff`,zero:!0}),"xdr:row":new mn({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new mn({tag:`xdr:rowOff`,zero:!0})},this.model={nativeCol:0,nativeColOff:0,nativeRow:0,nativeRowOff:0}}render(e,t){e.openNode(this.tag),this.map[`xdr:col`].render(e,t.nativeCol),this.map[`xdr:colOff`].render(e,t.nativeColOff),this.map[`xdr:row`].render(e,t.nativeRow),this.map[`xdr:rowOff`].render(e,t.nativeRowOff),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model={nativeCol:this.map[`xdr:col`].model,nativeColOff:this.map[`xdr:colOff`].model,nativeRow:this.map[`xdr:row`].model,nativeRowOff:this.map[`xdr:rowOff`].model},!1;default:return!0}}},xi=class extends W{constructor(){super(),this.model={rId:``}}get tag(){return`a:blip`}render(e,t){e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:embed":t.rId,cstate:`print`})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:embed`]},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Si=class extends W{constructor(){super(),this.map={"a:blip":new xi}}get tag(){return`xdr:blipFill`}render(e,t){e.openNode(this.tag),this.map[`a:blip`].render(e,t),e.openNode(`a:stretch`),e.leafNode(`a:fillRect`),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:blip`].model,!1;default:return!0}}},Ci=class extends W{constructor(){super(),this.model={}}get tag(){return`a:hlinkClick`}render(e,t){t.hyperlinks&&t.hyperlinks.rId&&e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:id":t.hyperlinks.rId,tooltip:t.hyperlinks.tooltip})}parseOpen(e){switch(e.name){case this.tag:return this.model={hyperlinks:{rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip}},!0;default:return!0}}parseText(){}parseClose(){return!1}},wi=class extends W{get tag(){return`a:extLst`}render(e){e.openNode(this.tag),e.openNode(`a:ext`,{uri:`{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}`}),e.leafNode(`a16:creationId`,{"xmlns:a16":`http://schemas.microsoft.com/office/drawing/2014/main`,id:`{00000000-0008-0000-0000-000002000000}`}),e.closeNode(),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Ti=class extends W{constructor(){super(),this.map={"a:hlinkClick":new Ci,"a:extLst":new wi}}get tag(){return`xdr:cNvPr`}render(e,t){e.openNode(this.tag,{id:t.index,name:`Picture ${t.index}`}),this.map[`a:hlinkClick`].render(e,t),this.map[`a:extLst`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:hlinkClick`].model,!1;default:return!0}}},Ei=class extends W{get tag(){return`xdr:cNvPicPr`}render(e){e.openNode(this.tag),e.leafNode(`a:picLocks`,{noChangeAspect:`1`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Di=class extends W{constructor(){super(),this.map={"xdr:cNvPr":new Ti,"xdr:cNvPicPr":new Ei}}get tag(){return`xdr:nvPicPr`}render(e,t){e.openNode(this.tag),this.map[`xdr:cNvPr`].render(e,t),this.map[`xdr:cNvPicPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`xdr:cNvPr`].model,!1;default:return!0}}};const Oi={tag:`xdr:spPr`,c:[{tag:`a:xfrm`,c:[{tag:`a:off`,$:{x:`0`,y:`0`}},{tag:`a:ext`,$:{cx:`0`,cy:`0`}}]},{tag:`a:prstGeom`,$:{prst:`rect`},c:[{tag:`a:avLst`}]}]};var ki=class extends W{constructor(){super(),this.map={"xdr:nvPicPr":new Di,"xdr:blipFill":new Si,"xdr:spPr":new G(Oi)}}get tag(){return`xdr:pic`}prepare(e,t){e.index=t.index+1}render(e,t){e.openNode(this.tag),this.map[`xdr:nvPicPr`].render(e,t),this.map[`xdr:blipFill`].render(e,t),this.map[`xdr:spPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.mergeModel(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}},Ai=class extends yi{constructor(){super(),this.map={"xdr:from":new bi({tag:`xdr:from`}),"xdr:to":new bi({tag:`xdr:to`}),"xdr:pic":new ki,"xdr:clientData":new G({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs||`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};const ji=9525;var Mi=class extends W{constructor(e){super(),this.tag=e.tag,this.map={},this.model={width:0,height:0}}render(e,t){e.openNode(this.tag);let n=Math.floor(t.width*ji),r=Math.floor(t.height*ji);e.addAttribute(`cx`,n),e.addAttribute(`cy`,r),e.closeNode()}parseOpen(e){return e.name===this.tag?(this.model={width:parseInt(e.attributes.cx||`0`,10)/ji,height:parseInt(e.attributes.cy||`0`,10)/ji},!0):!1}parseText(e){}parseClose(e){return!1}},Ni=class extends yi{constructor(){super(),this.map={"xdr:from":new bi({tag:`xdr:from`}),"xdr:ext":new Mi({tag:`xdr:ext`}),"xdr:pic":new ki,"xdr:clientData":new G({tag:`xdr:clientData`})}}get tag(){return`xdr:oneCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs||`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:ext`].render(e,t.range.ext),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.ext=this.map[`xdr:ext`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};function Pi(e){return(typeof e.range==`string`?u.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Fi=class e extends W{constructor(){super(),this.map={"xdr:twoCellAnchor":new Ai,"xdr:oneCellAnchor":new Ni},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Pi(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(U.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),r.anchors.forEach(e=>{this.map[e.anchorType].render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={anchors:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.anchors.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:xdr":`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,"xmlns:a":`http://schemas.openxmlformats.org/drawingml/2006/main`}}},Ii=class extends W{constructor(){super(),this.model={val:``}}get tag(){return`customFilter`}render(e,t){e.leafNode(this.tag,{val:t.val,operator:t.operator})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val,operator:e.attributes.operator},!0):!1}parseText(){}parseClose(){return!1}},Li=class extends W{constructor(){super(),this.model={val:``}}get tag(){return`filter`}render(e,t){e.leafNode(this.tag,{val:t.val})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val},!0):!1}parseText(){}parseClose(){return!1}},Ri=class extends W{constructor(){super(),this.map={customFilters:new K({tag:`customFilters`,count:!1,empty:!0,childXform:new Ii}),filters:new K({tag:`filters`,count:!1,empty:!0,childXform:new Li})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.customFilters=this.map.customFilters.model,!1;default:return!0}}},zi=class extends W{constructor(){super(),this.map={filterColumn:new Ri},this.model={autoFilterRef:``,columns:[]}}get tag(){return`autoFilter`}prepare(e){e.columns.forEach((e,t)=>{this.map.filterColumn.prepare(e,{index:t})})}render(e,t){e.openNode(this.tag,{ref:t.autoFilterRef}),t.columns.forEach(t=>{this.map.filterColumn.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model={autoFilterRef:e.attributes.ref,columns:[]},!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Bi=class extends W{constructor(){super(),this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}render(e,t){e.leafNode(this.tag,{id:t.id.toString(),name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return!1}parseText(){}parseClose(){return!1}},Vi=class extends W{constructor(){super(),this.model={theme:null,showFirstColumn:!1,showLastColumn:!1,showRowStripes:!1,showColumnStripes:!1}}get tag(){return`tableStyleInfo`}render(e,t){e.leafNode(this.tag,{name:t.theme?t.theme:void 0,showFirstColumn:t.showFirstColumn?`1`:`0`,showLastColumn:t.showLastColumn?`1`:`0`,showRowStripes:t.showRowStripes?`1`:`0`,showColumnStripes:t.showColumnStripes?`1`:`0`})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={theme:t.name?t.name:null,showFirstColumn:t.showFirstColumn===`1`,showLastColumn:t.showLastColumn===`1`,showRowStripes:t.showRowStripes===`1`,showColumnStripes:t.showColumnStripes===`1`},!0}return!1}parseText(){}parseClose(){return!1}},Hi=class e extends W{constructor(){super(),this.map={autoFilter:new zi,tableColumns:new K({tag:`tableColumns`,count:!0,empty:!0,childXform:new Bi}),tableStyleInfo:new Vi},this.model={id:0,name:``,tableRef:``,columns:[]}}prepare(e,t){this.map.autoFilter.prepare(e),this.map.tableColumns.prepare(e.columns,t)}get tag(){return`table`}render(t,n){t.openXml(U.StdDocAttributes),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,totalsRowShown:n.totalsRow?void 0:`1`,headerRowCount:n.headerRow?`1`:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount===`1`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr xr3`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,"xmlns:xr3":`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`}}},Ui=class e extends W{constructor(){super(),this.map={},this.model=null,this.currentRecord=null}prepare(e){}get tag(){return`pivotCacheRecords`}reset(){this.model=null,this.currentRecord=null}render(e,t){t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2);t.openXml(U.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(this.renderTableNew(a,i)),t.closeNode()}renderLoaded(t,n){t.openXml(U.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:n.count});for(let e of n.records){t.writeXml(`
|
|
7
|
+
const e=/^[A-Z]+\d+$/,t={_dictionary:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_l2nFill:0,_l2n:{},_n2l:[],_level(e){return e<=26?1:e<=676?2:3},_fill(e){let t,n,r,i,a,o=1;if(e>=4)throw Error(`Out of bounds. Excel supports columns from 1 to 16384`);if(this._l2nFill<1&&e>=1){for(;o<=26;)t=this._dictionary[o-1],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&e>=2){for(o=27;o<=702;)n=o-27,r=n%26,i=Math.floor(n/26),t=this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&e>=3){for(o=703;o<=16384;)n=o-703,r=n%26,i=Math.floor(n/26)%26,a=Math.floor(n/676),t=this._dictionary[a]+this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=3}},l2n(e){if(this._l2n[e]||this._fill(e.length),!this._l2n[e])throw Error(`Out of bounds. Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw Error(`${e} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},validateAddress(t){if(!e.test(t))throw Error(`Invalid Address: ${t}`);return!0},decodeAddress(e){let t=e.length<5&&this._hash[e];if(t)return t;let n=!1,r=``,i=0,a=!1,o=``,s=0;for(let t=0,c;t<e.length;t++)if(c=e.charCodeAt(t),!a&&c>=65&&c<=90)n=!0,r+=e[t],i=i*26+c-64;else if(c>=48&&c<=57)a=!0,o+=e[t],s=s*10+c-48;else if(a&&n&&c!==36)break;if(!n)i=void 0;else if(i>16384)throw Error(`Out of bounds. Invalid column letter: ${r}`);a||(s=void 0),e=r+o;let c={address:e,col:i,row:s,$col$row:`$${r}$${o}`};return i<=100&&s<=100&&(this._hash[e]=c,this._hash[c.$col$row]=c),c},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,n){return t.n2l(n)+e},encode(...e){switch(e.length){case 2:return t.encodeAddress(e[0],e[1]);case 4:return`${t.encodeAddress(e[0],e[1])}:${t.encodeAddress(e[2],e[3])}`;default:throw Error(`Can only encode with 2 or 4 arguments`)}},inRange(e,t){let[n,r,,i,a]=e,[o,s]=t;return o>=n&&o<=i&&s>=r&&s<=a}};var n=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,n,r,i,a){if(typeof e==`string`&&typeof n==`string`){let i=t.decodeAddress(e),a=t.decodeAddress(n);this.model={top:Math.min(i.row,a.row),left:Math.min(i.col,a.col),bottom:Math.max(i.row,a.row),right:Math.max(i.col,a.col),sheetName:typeof r==`string`?r:void 0}}else typeof e==`number`&&typeof n==`number`&&typeof r==`number`&&typeof i==`number`&&(this.model={top:Math.min(e,r),left:Math.min(n,i),bottom:Math.max(e,r),right:Math.max(n,i),sheetName:a})}decode(n){switch(n.length){case 5:typeof n[0]==`number`&&typeof n[1]==`number`&&typeof n[2]==`number`&&typeof n[3]==`number`&&typeof n[4]==`string`&&this.setTLBR(n[0],n[1],n[2],n[3],n[4]);break;case 4:typeof n[0]==`number`&&typeof n[1]==`number`&&typeof n[2]==`number`&&typeof n[3]==`number`&&this.setTLBR(n[0],n[1],n[2],n[3]);break;case 3:typeof n[0]==`string`&&typeof n[1]==`string`&&typeof n[2]==`string`&&this.setTLBR(n[0],n[1],n[2]);break;case 2:typeof n[0]==`string`&&typeof n[1]==`string`&&this.setTLBR(n[0],n[1]);break;case 1:{let r=n[0];if(r instanceof e)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(Array.isArray(r))this.decode(r);else if(typeof r==`object`&&`top`in r&&`left`in r&&`bottom`in r&&`right`in r)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else if(typeof r==`string`){let e=t.decodeEx(r);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw Error(`Invalid number of arguments to _getDimensions() - ${n.length}`)}}get top(){return this.model.top||1}set top(e){this.model.top=e}get left(){return this.model.left||1}set left(e){this.model.left=e}get bottom(){return this.model.bottom||1}set bottom(e){this.model.bottom=e}get right(){return this.model.right||1}set right(e){this.model.right=e}get sheetName(){return this.model.sheetName}set sheetName(e){this.model.sheetName=e}get _serialisedSheetName(){let{sheetName:e}=this.model;return e?/^[a-zA-Z0-9]*$/.test(e)?`${e}!`:`'${e}'!`:``}expand(e,t,n,r){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||r>this.right)&&(this.right=r)}expandRow(e){if(e){let{dimensions:t,number:n}=e;t&&this.expand(n,t.min,n,t.max)}}expandToAddress(e){let n=t.decodeEx(e);`row`in n&&`col`in n&&this.expand(n.row,n.col,n.row,n.col)}get tl(){return t.n2l(this.left)+this.top}get $t$l(){return`$${t.n2l(this.left)}$${this.top}`}get br(){return t.n2l(this.right)+this.bottom}get $b$r(){return`$${t.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottom<this.top||e.top>this.bottom||e.right<this.left||e.left>this.right)}contains(e){let n=t.decodeEx(e);return`row`in n&&`col`in n?this.containsEx(n):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let n=this.left;n<=this.right;n++)for(let r=this.top;r<=this.bottom;r++)e(t.encodeAddress(r,n),r,n)}};let r=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e}({}),i=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),a=function(e){return e[e.None=0]=`None`,e[e.OfficeDocument=1]=`OfficeDocument`,e[e.Worksheet=2]=`Worksheet`,e[e.CalcChain=3]=`CalcChain`,e[e.SharedStrings=4]=`SharedStrings`,e[e.Styles=5]=`Styles`,e[e.Theme=6]=`Theme`,e[e.Hyperlink=7]=`Hyperlink`,e}({}),o=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),s=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({});const c={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},l={ValueType:r,FormulaType:i,RelationshipType:a,DocumentType:o,ReadingOrder:s,ErrorValue:c},{toString:u}=Object.prototype,d=/["&<>]/;function f(e,t){let n=typeof e,r=typeof t,i=Array.isArray(e),a=Array.isArray(t),o;if(n!==r)return!1;switch(typeof e){case`object`:if(i||a)return i&&a?e.length===t.length&&e.every((e,n)=>{let r=t[n];return f(e,r)}):!1;if(e===null||t===null)return e===t;if(o=Object.keys(e),Object.keys(t).length!==o.length)return!1;for(let e of o)if(!Object.prototype.hasOwnProperty.call(t,e))return!1;return o.every(n=>{let r=e[n],i=t[n];return f(r,i)});default:return e===t}}function p(e){let t=d.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){switch(e.charAt(a)){case`"`:r=`"`;break;case`&`:r=`&`;break;case`<`:r=`<`;break;case`>`:r=`>`;break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=r}return i===a?n:n+e.substring(i,a)}function m(e){return u.call(e)===`[object Undefined]`}function h(e){return u.call(e)===`[object Object]`}function g(...e){let t=e[0]||{},{length:n}=e,r,i,a;function o(e,n){r=t[n],a=Array.isArray(e),h(e)||a?(a?(a=!1,i=r&&Array.isArray(r)?r:[]):i=r&&h(r)?r:{},t[n]=g(i,e)):m(e)||(t[n]=e)}for(let t=0;t<n;t++){let n=e[t];n&&(Array.isArray(n)?n.forEach((e,t)=>o(e,t)):Object.entries(n).forEach(([e,t])=>{e===`__proto__`||e===`constructor`||e===`prototype`||o(t,e)}))}return t}var _=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t=null;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note};break}return g({},e.DEFAULT_CONFIGS,t)}set model(e){let{note:t}=e,{texts:n}=t;n&&n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=t}static fromModel(t){let n=new e;return n.model=t,n}};const v=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,y=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function ee(e,n,r){let i=t.decode(n),a=t.decode(r);return e.replace(v,(e,n,r,o,s)=>{if(s)return e;let c=y.exec(o);if(c){let r=c[1],o=c[2].toUpperCase(),s=c[3],l=c[4];if(o.length>3||o.length===3&&o>`XFD`)return e;let u=t.l2n(o),d=parseInt(l,10);return r||(u+=a.col-i.col),s||(d+=a.row-i.row),(n||``)+(r||``)+t.n2l(u)+(s||``)+d}return e})}var b=class e{static{this.Types=l.ValueType}constructor(n,r,i){if(!n||!r)throw Error(`A Cell needs a Row`);this._row=n,this._column=r,t.validateAddress(i),this._address=i,this._value=O.create(e.Types.Null,this),this.style=this._mergeStyle(n.style,r.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&e.font||t&&t.font;i&&(n.font=i);let a=e&&e.alignment||t&&t.alignment;a&&(n.alignment=a);let o=e&&e.border||t&&t.border;o&&(n.border=o);let s=e&&e.fill||t&&t.fill;s&&(n.fill=s);let c=e&&e.protection||t&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=O.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=O.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(t){return this._value.type===e.Types.Merge?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=O.create(O.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new _(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof _?this._comment=e:this._comment=new _(e)}get text(){return this._value.toString()}get html(){return p(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=O.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=O.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=_.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},x=class{constructor(e){this.model={address:e.address,type:b.Types.Null}}get value(){return null}set value(e){}get type(){return b.Types.Null}get effectiveType(){return b.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},S=class{constructor(e,t){this.model={address:e.address,type:b.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.Number}get effectiveType(){return b.Types.Number}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},te=class{constructor(e,t){this.model={address:e.address,type:b.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.String}get effectiveType(){return b.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.model.value.replace(/"/g,`""`)}"`}release(){}toString(){return this.model.value}},C=class{constructor(e,t){this.model={address:e.address,type:b.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}toString(){return this.model.value.richText.map(e=>e.text).join(``)}get type(){return b.Types.RichText}get effectiveType(){return b.Types.RichText}get address(){return this.model.address}set address(e){this.model.address=e}get text(){return this.toString()}toCsvString(){return`"${this.text.replace(/"/g,`""`)}"`}release(){}},w=class{constructor(e,t){this.model={address:e.address,type:b.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.Date}get effectiveType(){return b.Types.Date}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}},T=class{constructor(e,t){this.model={address:e.address,type:b.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text||``,hyperlink:this.model.hyperlink||``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return b.Types.Hyperlink}get effectiveType(){return b.Types.Hyperlink}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.hyperlink||``}release(){}toString(){return this.model.text||``}},ne=class{constructor(e,t){this.model={address:e.address,type:b.Types.Merge,master:t?t.address:void 0},this._master=t,t&&t.addMergeRef()}get value(){return this._master.value}set value(e){e instanceof b?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}isMergedTo(e){return e===this._master}get master(){return this._master}get type(){return b.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}},E=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:b.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(O.getType(e)){case b.Types.Null:case b.Types.String:case b.Types.Number:case b.Types.Date:break;case b.Types.Hyperlink:case b.Types.Formula:default:throw Error(`Cannot process that type of result value`)}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,``).match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()||``}set formula(e){this.model.formula=e}get formulaType(){return this.model.formula?l.FormulaType.Master:this.model.sharedFormula?l.FormulaType.Shared:l.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return b.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?l.ValueType.Null:e instanceof String||typeof e==`string`?l.ValueType.String:typeof e==`number`?l.ValueType.Number:e instanceof Date?l.ValueType.Date:typeof e==`object`&&`error`in e?l.ValueType.Error:l.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&ee(t.formula,t.address,this.model.address)}return this._translatedFormula}toCsvString(){return`${this.model.result||``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},re=class{constructor(e,t){this.model={address:e.address,type:b.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.SharedString}get effectiveType(){return b.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},ie=class{constructor(e,t){this.model={address:e.address,type:b.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.Boolean}get effectiveType(){return b.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},ae=class{constructor(e,t){this.model={address:e.address,type:b.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return b.Types.Error}get effectiveType(){return b.Types.Error}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}},D=class{constructor(e,t){this.model={address:e.address,type:b.Types.String,value:JSON.stringify(t),rawValue:t}}get value(){return this.model.rawValue}set value(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}get type(){return b.Types.String}get effectiveType(){return b.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}};const O={getType(e){if(e==null)return b.Types.Null;if(e instanceof String||typeof e==`string`)return b.Types.String;if(typeof e==`number`)return b.Types.Number;if(typeof e==`boolean`)return b.Types.Boolean;if(e instanceof Date)return b.Types.Date;if(typeof e==`object`){if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return b.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return b.Types.Formula;if(`richText`in e&&e.richText)return b.Types.RichText;if(`sharedString`in e&&e.sharedString)return b.Types.SharedString;if(`error`in e&&e.error)return b.Types.Error}return b.Types.JSON},types:[{t:b.Types.Null,f:x},{t:b.Types.Number,f:S},{t:b.Types.String,f:te},{t:b.Types.Date,f:w},{t:b.Types.Hyperlink,f:T},{t:b.Types.Formula,f:E},{t:b.Types.Merge,f:ne},{t:b.Types.JSON,f:D},{t:b.Types.SharedString,f:re},{t:b.Types.RichText,f:C},{t:b.Types.Boolean,f:ie},{t:b.Types.Error,f:ae}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw Error(`Could not create Value of type ${e}`);return new r(t,n)}};var k=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new b(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let n;if(typeof e==`string`){let r=this._worksheet.getColumnKey(e);n=r?r.number:t.l2n(e)}else n=e;return this._cells[n-1]||this.getCellEx({address:t.encodeAddress(this._number,n),row:this._number,col:n})}splice(e,t,...n){let r=e+t,i=n.length-t,a=this._cells.length,o,s,c;if(i<0)for(o=e+n.length;o<=a;o++)c=this._cells[o-1],s=this._cells[o-i-1],s?(c=this.getCell(o),c.value=s.value,c.style=s.style,c.comment=s.comment):c&&(c.value=null,c.style={},c.comment=void 0);else if(i>0)for(o=a;o>=r;o--)s=this._cells[o-1],s?(c=this.getCell(o+i),c.value=s.value,c.style=s.style,c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==l.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e||0)-1)||0,i=Math.max(0,(t||0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==l.ValueType.Null&&(e[t.col]=t.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{e!==void 0&&(this.getCellEx({address:t.encodeAddress(this._number,r+n),row:this._number,col:r+n}).value=e)})}else this._worksheet.eachColumnKey((n,r)=>{e[r]!==void 0&&(this.getCellEx({address:t.encodeAddress(this._number,n.number),row:this._number,col:n.number}).value=e[r])})}get hasValues(){return this._cells.some(e=>e&&e.type!==l.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,t=0;return this._cells.forEach(n=>{n&&n.type!==l.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(e){if(e.number!==this._number)throw Error(`Invalid row number in model`);this._cells=[];let n;e.cells.forEach(e=>{switch(e.type){case b.Types.Merge:break;default:{let r;if(e.address)r=t.decodeAddress(e.address);else if(n){let{row:e}=n,i=n.col+1;r={row:e,col:i,address:t.encodeAddress(e,i),$col$row:`$${t.n2l(i)}$${e}`}}n=r;let i=this.getCellEx(r);i.model=e;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},A=class e{constructor(e,t,n){this._worksheet=e,this._number=t,n!==!1&&(this.defn=n)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return t.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&f(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&f(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==l.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e||0)-1)||0,i=Math.max(0,(t||0)-1)||1048575,a={id:this._number,max:i,man:1};r&&(a.min=r),n.colBreaks.push(a)}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){n||=[];let r=[],i=1,a=0;for(n=n.sort(function(e,t){return e.min-t.min});a<n.length;){let o=n[a++];for(;i<o.min;)r.push(new e(t,i++));for(;i<=o.max;)r.push(new e(t,i++,o))}return r.length?r:null}};function oe(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function j(e){return typeof e==`object`&&`col`in e&&`row`in e}var se=class e{constructor(e,n,r=0){if(this.worksheet=e,!n)this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;else if(typeof n==`string`){let e=t.decodeAddress(n);this.nativeCol=e.col+r,this.nativeColOff=0,this.nativeRow=e.row+r,this.nativeRowOff=0}else oe(n)?(this.nativeCol=n.nativeCol||0,this.nativeColOff=n.nativeColOff||0,this.nativeRow=n.nativeRow||0,this.nativeRowOff=n.nativeRowOff||0):j(n)?(this.col=n.col+r,this.row=n.row+r):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(this.worksheet.getRow(this.nativeRow+1).height*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}},ce=class{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId};case`image`:return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw Error(`Invalid Image Type`)}}set model({type:e,imageId:n,range:r,hyperlinks:i}){if(this.type=e,this.imageId=n,e===`image`)if(typeof r==`string`){let e=t.decode(r);`top`in e&&(this.range={tl:new se(this.worksheet,{col:e.left,row:e.top},-1),br:new se(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else r&&(this.range={tl:new se(this.worksheet,r.tl,0),br:r.br?new se(this.worksheet,r.br,0):void 0,ext:r.ext,editAs:r.editAs,hyperlinks:i||(`hyperlinks`in r?r.hyperlinks:void 0)})}},le=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},ue=class{constructor(e,t){this.worksheet=e,t&&(this.table=t,this.validate(),this.store())}getFormula(e){switch(e.totalsRowFunction){case`none`:return null;case`average`:return`SUBTOTAL(101,${this.table.name}[${e.name}])`;case`countNums`:return`SUBTOTAL(102,${this.table.name}[${e.name}])`;case`count`:return`SUBTOTAL(103,${this.table.name}[${e.name}])`;case`max`:return`SUBTOTAL(104,${this.table.name}[${e.name}])`;case`min`:return`SUBTOTAL(105,${this.table.name}[${e.name}])`;case`stdDev`:return`SUBTOTAL(106,${this.table.name}[${e.name}])`;case`var`:return`SUBTOTAL(107,${this.table.name}[${e.name}])`;case`sum`:return`SUBTOTAL(109,${this.table.name}[${e.name}])`;case`custom`:return e.totalsRowFormula||null;default:throw Error(`Invalid Totals Row Function: ${e.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,n=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};n(e,`headerRow`,!0),n(e,`totalsRow`,!1),n(e,`style`,{}),n(e.style,`theme`,`TableStyleMedium2`),n(e.style,`showFirstColumn`,!1),n(e.style,`showLastColumn`,!1),n(e.style,`showRowStripes`,!1),n(e.style,`showColumnStripes`,!1);let r=(e,t)=>{if(!e)throw Error(t)};r(!!e.ref,`Table must have ref`),r(!!e.columns,`Table must have column definitions`),r(!!e.rows,`Table must have row definitions`),e.tl=t.decodeAddress(e.ref);let{row:i,col:a}=e.tl;r(i>0,`Table must be on valid row`),r(a>0,`Table must be on valid col`);let{width:o,filterHeight:s,tableHeight:c}=this;e.autoFilterRef=t.encode(i,a,i+s-1,a+o-1),e.tableRef=t.encode(i,a,i+c-1,a+o-1),e.columns.forEach((e,t)=>{r(!!e.name,`Column ${t} must have a name`),t===0?n(e,`totalsRowLabel`,`Total`):(n(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)||void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r);a.value=t,e(a,n.columns[r].style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);n===0?r.value=t.totalsRowLabel:this.getFormula(t)?r.value={formula:t.totalsRowFormula,result:t.totalsRowResult}:r.value=null,e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);t===0?n.value=e.totalsRowLabel:this.getFormula(e)&&(n.value={formula:e.totalsRowFormula,result:e.totalsRowResult})})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=t.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store()}addRow(e,t){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e)}removeRows(e,t=1){this.cacheState(),this.table.rows.splice(e,t)}getColumn(e){let t=this.table.columns[e];return new le(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.table.name=e}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.table.displayName=e}get headerRow(){return this.table.headerRow}set headerRow(e){this._assign(this.table,`headerRow`,e)}get totalsRow(){return this.table.totalsRow}set totalsRow(e){this._assign(this.table,`totalsRow`,e)}get theme(){return this.table.style.theme}set theme(e){this.table.style.theme=e}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(e){this.table.style.showFirstColumn=e}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(e){this.table.style.showLastColumn=e}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(e){this.table.style.showRowStripes=e}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(e){this.table.style.showColumnStripes=e}},de=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){let n=this.model[e];if(n!==void 0)return n;let r=Object.keys(this.model).filter(e=>e.startsWith(`range:`));if(r.length===0)return;let i=t.decodeAddress(e);for(let e of r){let n=e.slice(6),r=t.decodeEx(n);if(r.dimensions){let t=r.tl,n=r.br;if(i.row>=t.row&&i.row<=n.row&&i.col>=t.col&&i.col<=n.col)return this.model[e]}}}remove(e){this.model[e]=void 0}};function fe(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function pe(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var me=class e extends Uint8Array{toString(e){return e===`base64`?fe(this):new TextDecoder().decode(this)}static from(t){let n=new e(t.length);return n.set(t),n}};function he(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}function ge(...e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function _e(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}const ve=new BigUint64Array([4794697086780616226n,8158064640168781261n,13096744586834688815n,16840607885511220148n,4131703408338449720n,6480981068601479193n,10538285296894168987n,12329834152419229976n,15566598209576043074n,1334009975649890238n,2608012711638119052n,6128411473006802146n,8268148722764581231n,9286055187155687089n,11230858885718282805n,13951009754708518548n,16472876342353939154n,17275323862435702243n,1135362057144423861n,2597628984639134821n,3308224258029322869n,5365058923640841347n,6679025012923562964n,8573033837759648693n,10970295158949994411n,12119686244451234320n,12683024718118986047n,13788192230050041572n,14330467153632333762n,15395433587784984357n,489312712824947311n,1452737877330783856n,2861767655752347644n,3322285676063803686n,5560940570517711597n,5996557281743188959n,7280758554555802590n,8532644243296465576n,9350256976987008742n,10552545826968843579n,11727347734174303076n,12113106623233404929n,14000437183269869457n,14369950271660146224n,15101387698204529176n,15463397548674623760n,17586052441742319658n,1182934255886127544n,1847814050463011016n,2177327727835720531n,2830643537854262169n,3796741975233480872n,4115178125766777443n,5681478168544905931n,6601373596472566643n,7507060721942968483n,8399075790359081724n,8693463985226723168n,9568029438360202098n,10144078919501101548n,10430055236837252648n,11840083180663258601n,13761210420658862357n,14299343276471374635n,14566680578165727644n,15097957966210449927n,16922976911328602910n,17689382322260857208n,500013540394364858n,748580250866718886n,1242879168328830382n,1977374033974150939n,2944078676154940804n,3659926193048069267n,4368137639120453308n,4836135668995329356n,5532061633213252278n,6448918945643986474n,6902733635092675308n,7801388544844847127n]),ye=new BigUint64Array([7640891576956012808n,13503953896175478587n,4354685564936845355n,11912009170470909681n,5840696475078001361n,11170449401992604703n,2270897969802886507n,6620516959819538809n]);function M(e,t){return(e>>BigInt(t)|e<<BigInt(64-t))&18446744073709551615n}function be(e){let t=e.length,n=BigInt(t*8),r=(128-(t+17)%128)%128,i=t+1+r+16,a=new Uint8Array(i);a.set(e),a[t]=128;let o=new DataView(a.buffer);o.setBigUint64(i-16,0n,!1),o.setBigUint64(i-8,n,!1);let s=new BigUint64Array(ye),c=new BigUint64Array(80);for(let e=0;e<i;e+=128){let t=new DataView(a.buffer,e,128);for(let e=0;e<16;e++)c[e]=t.getBigUint64(e*8,!1);for(let e=16;e<80;e++){let t=M(c[e-15],1)^M(c[e-15],8)^c[e-15]>>7n,n=M(c[e-2],19)^M(c[e-2],61)^c[e-2]>>6n;c[e]=c[e-16]+t+c[e-7]+n&18446744073709551615n}let n=s[0],r=s[1],i=s[2],o=s[3],l=s[4],u=s[5],d=s[6],f=s[7];for(let e=0;e<80;e++){let t=M(l,14)^M(l,18)^M(l,41),a=l&u^~l&d,s=f+t+a+ve[e]+c[e]&18446744073709551615n,p=(M(n,28)^M(n,34)^M(n,39))+(n&r^n&i^r&i)&18446744073709551615n;f=d,d=u,u=l,l=o+s&18446744073709551615n,o=i,i=r,r=n,n=s+p&18446744073709551615n}s[0]=s[0]+n&18446744073709551615n,s[1]=s[1]+r&18446744073709551615n,s[2]=s[2]+i&18446744073709551615n,s[3]=s[3]+o&18446744073709551615n,s[4]=s[4]+l&18446744073709551615n,s[5]=s[5]+u&18446744073709551615n,s[6]=s[6]+d&18446744073709551615n,s[7]=s[7]+f&18446744073709551615n}let l=new Uint8Array(64),u=new DataView(l.buffer);for(let e=0;e<8;e++)u.setBigUint64(e*8,s[e],!1);return l}const xe={hash(e,...t){let n=ge(...t);if(e.toLowerCase().replace(`-`,``)===`sha512`)return be(n);throw Error(`Hash algorithm '${e}' not supported in browser sync mode!`)},convertPasswordToHash(e,t,n,r){if(t.toLowerCase().replace(`-`,``)!==`sha512`)throw Error(`Hash algorithm '${t}' not supported in browser!`);let i=he(e),a=pe(n),o=this.hash(t,a,i);for(let e=0;e<r;e++){let n=_e(e);o=this.hash(t,o,n)}return fe(o)},randomBytes(e){let t=new me(e);return crypto.getRandomValues(t),t}};function Se(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function Ce(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}const we={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function Te(e){return e.replace(/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,(e,t)=>{if(t[0]===`#`){let e=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1));return String.fromCodePoint(e)}return we[t]||e})}function Ee(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function De(e){if(!e||e.indexOf(`@`)>-1)return!1;let t=e.replace(/\[[^\]]*]/g,``);return t=t.replace(/"[^"]*"/g,``),t.match(/[ymdhMsb]+/)!==null}function N(e){return e===!0||e===`true`||e===1||e===`1`}function*Oe(e,t,n=1){let r=n>0?(e,t)=>e<t:(e,t)=>e>t;for(let i=e;r(i,t);i+=n)yield i}function ke(e){let t=Array.from(e);return t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.sort()}const Ae=new TextDecoder(`utf-8`);function je(e){return typeof e==`string`?e:Ae.decode(e)}const Me={"<":`<`,">":`>`,"&":`&`,'"':`"`,"'":`'`};function P(e){let t=e.replace(/[<>&"']/g,e=>Me[e]||e);return t=t.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F\uFFFE\uFFFF]/g,e=>`&#x${e.charCodeAt(0).toString(16).toUpperCase()};`),t=t.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,()=>`�`),t}function Ne(e){let n=e.model;if(n.headerRow===!1)throw Error(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!n.rows||n.rows.length===0)throw Error(`Cannot create pivot table from an empty table. Add data rows to the table.`);let r=n.columns.map(e=>e.name),i=new Set;for(let e of r){if(i.has(e))throw Error(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);i.add(e)}let a=[void 0,...r],o=n.rows.map(e=>[void 0,...e]),s=n.tl,c=s.row,l=s.col,u=c+n.rows.length,d=l+r.length-1,f=t.encode(c,l,u,d);return{name:n.name,getRow(e){if(e===1)return{values:a};let t=e-2;return t>=0&&t<o.length?{values:o[t]}:{values:[]}},getColumn(e){if(e<1||e>r.length)return{values:[]};let t=[];t[1]=r[e-1];for(let r=0;r<n.rows.length;r++)t[r+2]=n.rows[r][e-1];return{values:t}},getSheetValues(){let e=[];e[1]=a;for(let t=0;t<o.length;t++)e[t+2]=o[t];return e},dimensions:{shortRange:f}}}function Pe(e){return e.sourceTable?Ne(e.sourceTable):e.sourceSheet}function Fe(e,t){if(!t.sourceSheet&&!t.sourceTable)throw Error(`Either sourceSheet or sourceTable must be provided.`);if(t.sourceSheet&&t.sourceTable)throw Error(`Cannot specify both sourceSheet and sourceTable. Choose one.`);let n=Pe(t);Ie(e,t,n);let{rows:r,values:i}=t,a=t.columns??[],o=Le(n,[...r,...a]),s=o.reduce((e,t,n)=>(e[t.name]=n,e),{}),c=r.map(e=>s[e]),l=a.map(e=>s[e]),u=i.map(e=>s[e]),d=e.workbook.pivotTables.length+1;return{source:n,rows:c,columns:l,values:u,metric:t.metric??`sum`,cacheFields:o,cacheId:String(10+d-1),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:d}}function Ie(e,t,n){if(t.metric&&t.metric!==`sum`&&t.metric!==`count`)throw Error(`Only the "sum" and "count" metrics are supported at this time.`);let r=t.columns??[],i=n.getRow(1).values.slice(1),a=new Set(i);for(let e of[...t.rows,...r,...t.values])if(!a.has(e))throw Error(`The header name "${e}" was not found in ${n.name}.`);if(!t.rows.length)throw Error(`No pivot table rows specified.`);if(t.values.length<1)throw Error(`Must have at least one value.`);if(t.values.length>1&&r.length>0)throw Error(`It is currently not possible to have multiple values when columns are specified. Please either supply an empty array for columns or a single value.`)}function Le(e,t){let n=e.getRow(1).values,r=new Set(t),i=t=>{let n=e.getColumn(t).values,r=new Set;for(let e=2;e<n.length;e++){let t=n[e];t!=null&&r.add(t)}return ke(r)},a=[];for(let e of Oe(1,n.length)){let t=n[e],o=r.has(t)?i(e):null;a.push({name:t,sharedItems:o})}return a}const Re=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),F=(e,t,n,r=[])=>{e[n]&&(t[n]=Re(e[n],r))},ze=e=>Object.keys(e).length===0,Be=e=>{if(!e)return e;if(ze(e))return{};let t={...e};return F(e,t,`font`,[`color`]),F(e,t,`alignment`),F(e,t,`protection`),e.border&&(F(e,t,`border`),F(e.border,t.border,`top`,[`color`]),F(e.border,t.border,`left`,[`color`]),F(e.border,t.border,`bottom`,[`color`]),F(e.border,t.border,`right`,[`color`]),F(e.border,t.border,`diagonal`,[`color`])),e.fill&&(F(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>Re(e,[`color`])))),t};var Ve=class{constructor(e){e||={},this._workbook=e.workbook,this.id=e.id||0,this.orderNo=e.orderNo||0,this.name=e.name||`sheet${this.id}`,this.state=e.state||`visible`,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.colBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.dataValidations=new de,this.views=e.views||[],this.autoFilter=e.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name!==e){if(typeof e!=`string`)throw Error(`The name has to be a string.`);if(e===``)throw Error(`The name can't be empty.`);if(e===`History`)throw Error(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw Error(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw Error(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);if(e&&e.length>31&&(e=e.substring(0,31)),this._workbook.worksheets.find(t=>t&&t.name.toLowerCase()===e.toLowerCase()))throw Error(`Worksheet name already exists: ${e}`);this._name=e}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new n;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:t.header?1:0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new A(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){let n;if(typeof e==`string`){let r=this._keys[e];if(r)return r;n=t.l2n(e)}else n=e;if(this._columns||=[],n>this._columns.length){let e=this._columns.length+1;for(;e<=n;)this._columns.push(new A(this,e++))}return this._columns[n-1]}spliceColumns(e,t,...n){let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]||null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns?this._columns.length:0;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;this.workbook.definedNames.spliceColumns(this.name,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new k(this,e),t}getRows(e,t){if(t<1)return;let n=[];for(let r=e;r<e+t;r++)n.push(this.getRow(r));return n}addRow(e,t=`n`){let n=this._nextRow,r=this.getRow(n);return r.values=e,this._setStyleOption(n,t[0]===`i`?t:`n`),r}addRows(e,t=`n`){let n=[];return e.forEach(e=>{n.push(this.addRow(e,t))}),n}insertRow(e,t,n=`n`){return this.spliceRows(e,0,t),this._setStyleOption(e,n),this.getRow(e)}insertRows(e,t,n=`n`){if(this.spliceRows(e,0,...t),n!==`n`)for(let r=0;r<t.length;r++)n[0]===`o`&&this.findRow(t.length+e+r)!==void 0?this._copyStyle(t.length+e+r,e+r,n[1]===`+`):n[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e+r,n[1]===`+`);return this.getRows(e,t.length)}_setStyleOption(e,t=`n`){t[0]===`o`&&this.findRow(e+1)!==void 0?this._copyStyle(e+1,e,t[1]===`+`):t[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e,t[1]===`+`)}_copyStyle(e,t,n=!1){let r=this.getRow(e),i=this.getRow(t);i.style=Be(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=Be(e.style)}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this._rows[e-1],i=Array.from({length:t}).fill(r.values);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=r.style,t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=e.style})}}spliceRows(e,t,...n){let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=t.style}),this._rows[s-1]=void 0}else this._rows[s+a-1]=void 0;else if(a>0)for(s=o;s>=r;s--)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{if(e.getCell(n).style=t.style,t.type===l.ValueType.Merge){let e=this.getRow(t.row+i).getCell(n),r=t.master,a=this.getRow(r.row+i).getCell(r.col);e.merge(a)}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}this.workbook.definedNames.spliceRows(this.name,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,n){let r=t.getAddress(e,n),i=this._rows[r.row-1];return i?i.findCell(r.col):void 0}getCell(e,n){let r=t.getAddress(e,n);return this.getRow(r.row).getCellEx(r)}mergeCells(...e){let t=new n(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new n(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw Error(`Cannot merge already merged cells`)});let n=this.getCell(e.top,e.left);for(let r=e.top;r<=e.bottom;r++)for(let i=e.left;i<=e.right;i++)(r>e.top||i>e.left)&&this.getCell(r,i).merge(n,t);this._merges[n.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new n(e);for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++){let t=this.findCell(e,n);t&&(t.type===l.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,n,r,i=`shared`){let{top:a,left:o,bottom:s,right:c}=t.decode(e),l=c-o+1,u=t.encodeAddress(a,o),d=i===`shared`,f;f=typeof r==`function`?r:Array.isArray(r)?Array.isArray(r[0])?(e,t)=>r[e-a][t-o]:(e,t)=>r[(e-a)*l+(t-o)]:()=>void 0;let p=!0;for(let t=a;t<=s;t++)for(let r=o;r<=c;r++)if(p){let a=this.getCell(t,r);a.value={shareType:i,formula:n,ref:e,result:f(t,r)},p=!1}else this.getCell(t,r).value=d?{sharedFormula:u,result:f(t,r)}:f(t,r)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new ce(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new ce(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}protect(e,t){return new Promise(n=>{this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=xe.randomBytes(16).toString(`base64`),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=xe.convertPasswordToHash(e,`SHA512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount),n()})}unprotect(){this.sheetProtection=null}addTable(e){let t=new ue(this,e);return this.tables[e.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=Fe(this,e);return this.pivotTables.push(t),this.workbook.pivotTables.push(t),t}addConditionalFormatting(e){this.conditionalFormattings.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormattings.splice(e,1):e instanceof Function?this.conditionalFormattings=this.conditionalFormattings.filter(e):this.conditionalFormattings=[]}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,colBreaks:this.colBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings};e.cols=A.toModel(this.columns||[]);let t=e.rows=[],r=e.dimensions=new n;return this._rows.forEach(e=>{let n=e&&e.model;n&&(r.expand(n.number,n.min,n.number,n.max),t.push(n))}),e.merges=[],Object.values(this._merges).forEach(t=>{e.merges.push(t.range)}),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new k(this,e.number);this._rows[t.number-1]=t,t.model=e})}_parseMergeCells(e){e.mergeCells&&e.mergeCells.forEach(e=>{this.mergeCellsWithoutStyle(e)})}set model(e){this.name=e.name,this._columns=A.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new de(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.rowBreaks=e.rowBreaks||[],this.colBreaks=e.colBreaks||[],this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new ce(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new ue(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings}};function He(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function Ue(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>Ue(e));let t={};for(let n of Object.keys(e))He(n)&&(t[n]=Ue(e[n]));return t}var We=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(t.decodeEx(e))}getCell(e){return this.findCellEx(t.decodeEx(e),!0)}findCell(e){return this.findCellEx(t.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets[e],i=r&&r[t];return i&&i[n]}addCellEx(e){if(e.top!==void 0)for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++)this.getCellAt(e.sheetName,t,n);else this.findCellEx(e,!0)}getCellEx(e){return this.findCellEx(e,!0)}findCellEx(e,t){let n=this.findSheet(e,t),r=this.findSheetRow(n,e,t);return this.findRowCell(r,e,t)}getCellAt(e,n,r){if(!He(e))throw Error(`Invalid sheet name: ${e}`);let i=this.sheets[e]||(this.sheets[e]=[]),a=i[n]||(i[n]=[]);return a[r]||(a[r]={sheetName:e,address:t.n2l(r)+n,row:n,col:r})}removeCellEx(e){let t=this.findSheet(e,!1);if(!t)return;let n=this.findSheetRow(t,e,!1);n&&delete n[e.col]}forEachInSheet(e,t){let n=this.sheets[e];n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){Object.keys(this.sheets).forEach(t=>{this.forEachInSheet(t,e)})}map(e){let t=[];return this.forEach(n=>{t.push(e(n))}),t}findSheet(e,t){let n=e.sheetName;if(!He(n))throw Error(`Invalid sheet name: ${n}`);if(Object.prototype.hasOwnProperty.call(this.sheets,n))return this.sheets[n];if(t)return this.sheets[n]=[]}findSheetRow(e,t,n){let{row:r}=t;if(!He(r))throw Error(`Invalid row: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let{col:r}=t;if(!He(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...Ue(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push([]);i.splice(t,n,...e)}}spliceColumns(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push(null);Object.values(i).forEach(r=>{r.splice(t,n,...e)})}}};const Ge=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Ke=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new We)}add(e,n){let r=t.decodeEx(e);`error`in r||this.addEx(r,n)}addEx(e,n){let r=this.getMatrix(n);if(`top`in e)for(let n=e.left;n<=e.right;n++)for(let i=e.top;i<=e.bottom;i++){let a={sheetName:e.sheetName,address:t.n2l(n)+i,row:i,col:n};r.addCellEx(a)}else r.addCellEx(e)}remove(e,n){let r=t.decodeEx(e);`error`in r||this.removeEx(r,n)}removeEx(e,n){let r=this.getMatrix(n);if(`top`in e)for(let n=e.left;n<=e.right;n++)for(let i=e.top;i<=e.bottom;i++)r.removeCellEx({sheetName:e.sheetName,address:t.n2l(n)+i,row:i,col:n});else r.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(n=>{if(`top`in e)for(let r=e.left;r<=e.right;r++)for(let i=e.top;i<=e.bottom;i++)n.removeCellEx({sheetName:e.sheetName,address:t.n2l(r)+i,row:i,col:r});else n.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let n=t.decodeEx(e);return`error`in n||`top`in n?[]:this.getNamesEx(n)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let{sheetName:r}=t,i=new n(t.row,t.col,t.row,t.col,r),a,o,s=(t,n)=>e.findCellAt(r,t,n);function c(e,n){let r=s(e,t.col);return!r||!r.mark?!1:(i[n]=e,r.mark=!1,!0)}for(o=t.row-1;c(o,`top`);o--);for(o=t.row+1;c(o,`bottom`);o++);function l(e,t){let n=[];for(o=i.top;o<=i.bottom;o++){let t=s(o,e);if(t&&t.mark)n.push(t);else return!1}i[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(a=t.col-1;l(a,`left`);a--);for(a=t.col+1;l(a,`right`);a++);return i}getRanges(e,t){return t||=this.matrixMap[e],t?(t.forEach(e=>{e.mark=!0}),{name:e,ranges:t.map(e=>e.mark&&this._explore(t,e)).filter(Boolean).map(e=>e.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,n){e.forEachInSheet(n,(e,n,r)=>{e&&(e.row!==n||e.col!==r)&&(e.row=n,e.col=r,e.address=t.n2l(r)+n)})}spliceRows(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceRows(e,t,n,r),this.normaliseMatrix(i,e)})}spliceColumns(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceColumns(e,t,n,r),this.normaliseMatrix(i,e)})}get model(){return Object.entries(this.matrixMap).map(([e,t])=>this.getRanges(e,t)).filter(e=>e.ranges.length)}set model(e){let t=this.matrixMap={};e.forEach(e=>{let n=t[e.name]=new We;e.ranges.forEach(e=>{Ge.test(e.split(`!`).pop()||``)&&n.addCell(e)})})}},qe=class{constructor(){this.category=``,this.company=``,this.created=new Date,this.description=``,this.keywords=``,this.manager=``,this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject=``,this.title=``,this.views=[],this.media=[],this.pivotTables=[],this._definedNames=new Ke}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,t){let n=this.nextId,r=this._worksheets.reduce((e,t)=>(t&&t.orderNo)>e?t.orderNo:e,0),i=new Ve({...t,id:n,name:e,orderNo:r+1,workbook:this});return this._worksheets[n]=i,i}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){let t=this.getWorksheet(e);t&&t.destroy()}getWorksheet(e){if(e===void 0)return this._worksheets.find(Boolean);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t&&t.name===e)}get worksheets(){return this._worksheets.slice(1).sort((e,t)=>e.orderNo-t.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(t=>{e(t,t.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){let t=this.media.length;return this.media.push({...e,type:`image`}),t}getImage(e){return this.media[Number(e)]}get model(){return{creator:this.creator||`Unknown`,lastModifiedBy:this.lastModifiedBy||`Unknown`,lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,pivotTables:this.pivotTables,calcProperties:this.calcProperties}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(t=>{let{id:n,name:r,state:i}=t,a=e.sheets&&e.sheets.findIndex(e=>e.id===n),o=this._worksheets[n]=new Ve({id:n,name:r,orderNo:a===-1?void 0:a,state:i,workbook:this});o.model=t}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media||[],this.pivotTables=e.pivotTables||e.loadedPivotTables||[]}};async function Je(e){let t=new CompressionStream(`deflate-raw`),n=t.writable.getWriter(),r=t.readable.getReader();n.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),n.close();let i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}async function Ye(e){let t=new DecompressionStream(`deflate-raw`),n=t.writable.getWriter(),r=t.readable.getReader();n.write(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),n.close();let i=[],a=0;for(;;){let{done:e,value:t}=await r.read();if(e)break;i.push(t),a+=t.length}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return o}const Xe=new Uint8Array(288);for(let e=0;e<=143;e++)Xe[e]=8;for(let e=144;e<=255;e++)Xe[e]=9;for(let e=256;e<=279;e++)Xe[e]=7;for(let e=280;e<=287;e++)Xe[e]=8;const Ze=new Uint8Array(32).fill(5),Qe=[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],$e=[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],et=[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],tt=[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],nt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function rt(e,t){let n=new Uint16Array(16);for(let r=0;r<t;r++)e[r]>0&&n[e[r]]++;let r=new Uint16Array(16),i=0;for(let e=1;e<=15;e++)i=i+n[e-1]<<1,r[e]=i;let a={};for(let n=0;n<t;n++){let t=e[n];if(t===0)continue;i=r[t]++;let o=a;for(let e=t-1;e>=0;e--)i>>e&1?(o.right||={},o=o.right):(o.left||={},o=o.left);o.symbol=n}return a}var it=class{constructor(e){this.data=e,this.pos=0,this.bitBuf=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.pos>=this.data.length)throw Error(`Unexpected end of DEFLATE data`);this.bitBuf|=this.data[this.pos++]<<this.bitCount,this.bitCount+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>=e,this.bitCount-=e,t}decodeSymbol(e){let t=e;for(;t.symbol===void 0;)if(t=this.readBits(1)===0?t.left:t.right,!t)throw Error(`Invalid Huffman code`);return t.symbol}alignToByte(){this.bitBuf=0,this.bitCount=0}readByte(){if(this.pos>=this.data.length)throw Error(`Unexpected end of data`);return this.data[this.pos++]}readUint16(){return this.readByte()|this.readByte()<<8}};function at(e){let t=new it(e),n=[],r=!1;for(;!r;){r=t.readBits(1)===1;let e=t.readBits(2);if(e===0){t.alignToByte();let e=t.readUint16();if((e^t.readUint16())!==65535)throw Error(`Invalid stored block length`);for(let r=0;r<e;r++)n.push(t.readByte())}else if(e===1||e===2){let r,i;if(e===1)r=rt(Xe,288),i=rt(Ze,32);else{let e=t.readBits(5)+257,n=t.readBits(5)+1,a=t.readBits(4)+4,o=new Uint8Array(19);for(let e=0;e<a;e++)o[nt[e]]=t.readBits(3);let s=rt(o,19),c=new Uint8Array(e+n),l=0;for(;l<e+n;){let e=t.decodeSymbol(s);if(e<16)c[l++]=e;else if(e===16){let e=t.readBits(2)+3,n=c[l-1];for(let t=0;t<e;t++)c[l++]=n}else if(e===17){let e=t.readBits(3)+3;for(let t=0;t<e;t++)c[l++]=0}else if(e===18){let e=t.readBits(7)+11;for(let t=0;t<e;t++)c[l++]=0}}r=rt(c.subarray(0,e),e),i=rt(c.subarray(e),n)}for(;;){let e=t.decodeSymbol(r);if(e<256)n.push(e);else if(e===256)break;else{let r=e-257,a=Qe[r]+t.readBits($e[r]),o=t.decodeSymbol(i),s=et[o]+t.readBits(tt[o]),c=n.length-s;for(let e=0;e<a;e++)n.push(n[c+e])}}}else throw Error(`Invalid DEFLATE block type: `+e)}return new Uint8Array(n)}function ot(e){let t=65535,n=Math.ceil(e.length/t)||1,r=n*5+e.length,i=new Uint8Array(r),a=0,o=0;for(let r=0;r<n;r++){let s=r===n-1,c=Math.min(t,e.length-o);i[a++]=s?1:0,i[a++]=c&255,i[a++]=c>>8&255,i[a++]=~c&255,i[a++]=~c>>8&255,i.set(e.subarray(o,o+c),a),a+=c,o+=c}return i.subarray(0,a)}function st(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return ot(e);let t=new ct;t.writeBits(1,1),t.writeBits(1,2);let n=new Map,r=0;for(;r<e.length;){let i=0,a=0;if(r+2<e.length){let t=e[r]<<16|e[r+1]<<8|e[r+2],o=n.get(t);if(o!==void 0&&r-o<=32768){let t=r-o,n=0,s=Math.min(258,e.length-r);for(;n<s&&e[o+n]===e[r+n];)n++;n>=3&&(i=n,a=t)}n.set(t,r)}i>=3?(ft(t,i),pt(t,a),r+=i):(dt(t,e[r]),r++)}return dt(t,256),t.finish()}var ct=class{constructor(){this.chunks=[],this.buffer=[],this.bitBuf=0,this.bitCount=0}writeBits(e,t){for(this.bitBuf|=e<<this.bitCount,this.bitCount+=t;this.bitCount>=8;)this.buffer.push(this.bitBuf&255),this.bitBuf>>=8,this.bitCount-=8,this.buffer.length>=65536&&(this.chunks.push(new Uint8Array(this.buffer)),this.buffer=[])}writeBitsReverse(e,t){let n=0;for(let r=0;r<t;r++)n=n<<1|e>>r&1;this.writeBits(n,t)}finish(){if(this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0)return new Uint8Array(this.buffer);this.chunks.push(new Uint8Array(this.buffer));let e=this.chunks.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.chunks)t.set(e,n),n+=e.length;return t}};const lt=[],ut=[];for(let e=0;e<=287;e++){let t,n;e<=143?(t=48+e,n=8):e<=255?(t=400+(e-144),n=9):e<=279?(t=e-256,n=7):(t=192+(e-280),n=8),lt[e]=[t,n],ut[e]=n}function dt(e,t){let[n,r]=lt[t];e.writeBitsReverse(n,r)}function ft(e,t){let n,r,i;if(t<=10)n=257+t-3,r=0,i=0;else if(t<=18){let e=t-11;n=265+Math.floor(e/2),r=1,i=e%2}else if(t<=34){let e=t-19;n=269+Math.floor(e/4),r=2,i=e%4}else if(t<=66){let e=t-35;n=273+Math.floor(e/8),r=3,i=e%8}else if(t<=130){let e=t-67;n=277+Math.floor(e/16),r=4,i=e%16}else if(t<=257){let e=t-131;n=281+Math.floor(e/32),r=5,i=e%32}else n=285,r=0,i=0;dt(e,n),r>0&&e.writeBits(i,r)}function pt(e,t){let n=[[1,0,0],[2,1,0],[3,2,0],[4,3,0],[6,4,1],[8,5,1],[12,6,2],[16,7,2],[24,8,3],[32,9,3],[48,10,4],[64,11,4],[96,12,5],[128,13,5],[192,14,6],[256,15,6],[384,16,7],[512,17,7],[768,18,8],[1024,19,8],[1536,20,9],[2048,21,9],[3072,22,10],[4096,23,10],[6144,24,11],[8192,25,11],[12288,26,12],[16384,27,12],[24576,28,13],[32768,29,13]],r=0,i=0,a=1;for(let[e,o,s]of n){if(t<=e){r=o,i=s;break}a=e+1}let o=t-a;e.writeBitsReverse(r,5),i>0&&e.writeBits(o,i)}function mt(){if(typeof CompressionStream>`u`)return!1;try{return new CompressionStream(`deflate-raw`),!0}catch{return!1}}let ht=null;function gt(){return typeof CompressionStream>`u`?!1:(ht===null&&(ht=mt()),ht)}async function _t(e,t={}){return(t.level??6)===0?ot(e):gt()?Je(e):st(e)}function vt(e,t={}){return(t.level??6)===0?ot(e):st(e)}async function yt(e){return gt()?Ye(e):at(e)}function bt(e){return at(e)}const xt=67324752;function St(e,t){let n=e&31,r=e>>5&15,i=(e>>9&127)+1980,a=t?(t&31)*2:0,o=t?t>>5&63:0,s=t?t>>11:0;return new Date(Date.UTC(i,r-1,n,s,o,a))}function Ct(e,t,n,r){let i=new DataView(e.buffer,e.byteOffset,e.byteLength),a=0;for(;a+4<=e.length;){let e=i.getUint16(a,!0),o=i.getUint16(a+2,!0);if(e===1){let e=a+4;n===4294967295&&e+8<=a+4+o&&(n=Number(i.getBigUint64(e,!0)),e+=8),t===4294967295&&e+8<=a+4+o&&(t=Number(i.getBigUint64(e,!0)),e+=8),r===4294967295&&e+8<=a+4+o&&(r=Number(i.getBigUint64(e,!0)));break}a+=4+o}return{compressedSize:t,uncompressedSize:n,localHeaderOffset:r}}var wt=class{constructor(e,t=0){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.offset=t}get position(){return this.offset}set position(e){this.offset=e}get remaining(){return this.data.length-this.offset}readUint8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readUint16(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readBigUint64(){let e=this.view.getBigUint64(this.offset,!0);return this.offset+=8,e}readBytes(e){let t=this.data.subarray(this.offset,this.offset+e);return this.offset+=e,t}readString(e,t=!0){let n=this.readBytes(e);return t?new TextDecoder(`utf-8`).decode(n):String.fromCharCode(...n)}skip(e){this.offset+=e}slice(e,t){return this.data.subarray(e,t)}peekUint32(e){return this.view.getUint32(e,!0)}};function Tt(e){let t=Math.max(0,e.length-65557),n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(let r=e.length-22;r>=t;r--)if(n.getUint32(r,!0)===101010256)return r;return-1}function Et(e,t){let n=t-20;return n<0?-1:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(n,!0)===117853008?n:-1}function Dt(e,t={}){let{decodeStrings:n=!0}=t,r=[],i=Tt(e);if(i===-1)throw Error(`Invalid ZIP file: End of Central Directory not found`);let a=new wt(e,i);a.skip(4),a.skip(2),a.skip(2),a.skip(2);let o=a.readUint16();a.skip(4);let s=a.readUint32(),c=Et(e,i);if(c!==-1){let t=new wt(e,c);t.skip(4),t.skip(4);let n=new wt(e,Number(t.readBigUint64()));if(n.readUint32()===101075792){n.skip(8),n.skip(2),n.skip(2),n.skip(4),n.skip(4);let e=Number(n.readBigUint64());n.skip(8);let t=Number(n.readBigUint64());o===65535&&(o=e),s===4294967295&&(s=t)}}let l=new wt(e,s);for(let e=0;e<o;e++){if(l.readUint32()!==33639248)throw Error(`Invalid Central Directory header signature at entry ${e}`);l.skip(2),l.skip(2);let t=l.readUint16(),i=l.readUint16(),a=l.readUint16(),o=l.readUint16(),s=l.readUint32(),c=l.readUint32(),u=l.readUint32(),d=l.readUint16(),f=l.readUint16(),p=l.readUint16();l.skip(2),l.skip(2);let m=l.readUint32(),h=l.readUint32(),g=(t&2048)!=0,_=n&&g,v=l.readString(d,_),y=l.readBytes(f),ee=l.readString(p,_);if(f>0){let e=Ct(y,c,u,h);c=e.compressedSize,u=e.uncompressedSize,h=e.localHeaderOffset}let b=v.endsWith(`/`)||(m&16)!=0,x=(t&1)!=0;r.push({path:v,isDirectory:b,compressedSize:c,uncompressedSize:u,compressionMethod:i,crc32:s,lastModified:St(o,a),localHeaderOffset:h,comment:ee,externalAttributes:m,isEncrypted:x})}return r}async function Ot(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=new wt(e,t.localHeaderOffset);if(n.readUint32()!==xt)throw Error(`Invalid local file header signature for "${t.path}"`);n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(4),n.skip(4),n.skip(4);let r=n.readUint16(),i=n.readUint16();n.skip(r),n.skip(i);let a=n.readBytes(t.compressedSize);if(t.compressionMethod===0)return a;if(t.compressionMethod===8)return yt(a);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function kt(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=new wt(e,t.localHeaderOffset);if(n.readUint32()!==xt)throw Error(`Invalid local file header signature for "${t.path}"`);n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(4),n.skip(4),n.skip(4);let r=n.readUint16(),i=n.readUint16();n.skip(r),n.skip(i);let a=n.readBytes(t.compressedSize);if(t.compressionMethod===0)return a;if(t.compressionMethod===8)return bt(a);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}var At=class{constructor(e,t={}){this.data=e instanceof ArrayBuffer?new Uint8Array(e):e,this.entries=Dt(this.data,t),this.entryMap=new Map(this.entries.map(e=>[e.path,e]))}getEntries(){return this.entries}getEntry(e){return this.entryMap.get(e)}hasEntry(e){return this.entryMap.has(e)}listFiles(){return this.entries.map(e=>e.path)}async extract(e){let t=this.entryMap.get(e);return t?Ot(this.data,t):null}extractSync(e){let t=this.entryMap.get(e);return t?kt(this.data,t):null}async extractAll(){let e=new Map;for(let t of this.entries){let n=await Ot(this.data,t);e.set(t.path,n)}return e}extractAllSync(){let e={};for(let t of this.entries)e[t.path]=kt(this.data,t);return e}async forEach(e){for(let t of this.entries){let n=null;if(await e(t,()=>(n||=Ot(this.data,t),n))===!1)break}}};const jt=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e})();function Mt(e){let t=4294967295;for(let n=0;n<e.length;n++)t=jt[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function Nt(e){return[(e.getHours()&31)<<11|(e.getMinutes()&63)<<5|e.getSeconds()>>1&31,(e.getFullYear()-1980&127)<<9|(e.getMonth()+1&15)<<5|e.getDate()&31]}const Pt=new TextEncoder;function Ft(e){return Pt.encode(e)}function It(e){let t=new Uint8Array(30+e.name.length),n=new DataView(t.buffer);return n.setUint32(0,67324752,!0),n.setUint16(4,20,!0),n.setUint16(6,2048,!0),n.setUint16(8,e.compressionMethod,!0),n.setUint16(10,e.modTime,!0),n.setUint16(12,e.modDate,!0),n.setUint32(14,e.crc,!0),n.setUint32(18,e.compressedData.length,!0),n.setUint32(22,e.data.length,!0),n.setUint16(26,e.name.length,!0),n.setUint16(28,0,!0),t.set(e.name,30),t}function Lt(e){let t=new Uint8Array(46+e.name.length+e.comment.length),n=new DataView(t.buffer);return n.setUint32(0,33639248,!0),n.setUint16(4,20,!0),n.setUint16(6,20,!0),n.setUint16(8,2048,!0),n.setUint16(10,e.compressionMethod,!0),n.setUint16(12,e.modTime,!0),n.setUint16(14,e.modDate,!0),n.setUint32(16,e.crc,!0),n.setUint32(20,e.compressedData.length,!0),n.setUint32(24,e.data.length,!0),n.setUint16(28,e.name.length,!0),n.setUint16(30,0,!0),n.setUint16(32,e.comment.length,!0),n.setUint16(34,0,!0),n.setUint16(36,0,!0),n.setUint32(38,0,!0),n.setUint32(42,e.offset,!0),t.set(e.name,46),e.comment.length>0&&t.set(e.comment,46+e.name.length),t}function Rt(e,t,n,r){let i=new Uint8Array(22+r.length),a=new DataView(i.buffer);return a.setUint32(0,101010256,!0),a.setUint16(4,0,!0),a.setUint16(6,0,!0),a.setUint16(8,e,!0),a.setUint16(10,e,!0),a.setUint32(12,t,!0),a.setUint32(16,n,!0),a.setUint16(20,r.length,!0),r.length>0&&i.set(r,22),i}var zt=class{constructor(e={}){this.entries=[],this.currentOffset=0,this.finalized=!1,this.level=e.level??6,this.zipComment=Ft(e.comment??``)}async addFile(e){if(this.finalized)throw Error(`Cannot add files after finalizing`);let t=Ft(e.name),n=Ft(e.comment??``),[r,i]=Nt(e.modTime??new Date),a=this.level>0&&e.data.length>0,o=a?await _t(e.data,{level:this.level}):e.data,s={name:t,data:e.data,compressedData:o,crc:Mt(e.data),compressionMethod:a?8:0,modTime:r,modDate:i,comment:n,offset:this.currentOffset};return this.entries.push(s),this.currentOffset+=30+t.length+o.length,[It(s),o]}addFileSync(e){if(this.finalized)throw Error(`Cannot add files after finalizing`);let t=Ft(e.name),n=Ft(e.comment??``),[r,i]=Nt(e.modTime??new Date),a=this.level>0&&e.data.length>0,o=a?vt(e.data,{level:this.level}):e.data,s={name:t,data:e.data,compressedData:o,crc:Mt(e.data),compressionMethod:a?8:0,modTime:r,modDate:i,comment:n,offset:this.currentOffset};return this.entries.push(s),this.currentOffset+=30+t.length+o.length,[It(s),o]}finalize(){if(this.finalized)throw Error(`ZIP already finalized`);this.finalized=!0;let e=[];for(let t of this.entries)e.push(Lt(t));let t=e.reduce((e,t)=>e+t.length,0);return e.push(Rt(this.entries.length,t,this.currentOffset,this.zipComment)),e}get entryCount(){return this.entries.length}get dataSize(){return this.currentOffset}},Bt=class{constructor(e){this._buf=Buffer.alloc(e&&e.size||16384),this._encoding=e&&e.encoding||`utf8`,this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||(this._buffer=Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer}reset(e){e||=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=Buffer.alloc(t);this._buf.copy(n,0),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+this._buf.write(e,this._inPos,this._encoding);for(;t>=this._buf.length-4;)this._grow(this._inPos+e.length),t=this._inPos+this._buf.write(e,this._inPos,this._encoding);this._inPos=t}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),e._buf.copy(this._buf,this._inPos,0,e.length),this._inPos+=e.length)}},Vt=class{constructor(e,t){this._data=e,this._encoding=t}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=new TextEncoder().encode(this._data),this._buffer}},Ht=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Ut=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);e.set(this._data.subarray(n,n+i),t)}toBuffer(){return this._data}},Wt=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.slice(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.slice(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,t+r),this.iWrite+=r,r}},Gt=class{constructor(e){e||={},this.bufSize=e.bufSize||1024*1024,this.buffers=[],this.batch=e.batch||!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this.events=new Map}on(e,t){let n=this.events.get(e)||[];return n.push(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){let n=this.events.get(e)||[];return n.forEach(e=>e(...t)),n.length>0}removeListener(e,t){return this.off(e,t)}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new Wt(this.bufSize);return this.buffers.push(e),e}async _pipe(e){await Promise.all(this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>{n()})})))}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){t instanceof Function&&(n=t,t=`utf8`),n||=()=>{};let r;if(e instanceof Bt||e&&e.constructor?.name===`StringBuf`)r=new Ht(e);else if(e instanceof Uint8Array)r=new Ut(e);else if(ArrayBuffer.isView(e))r=new Ut(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Ut(new Uint8Array(e));else if(typeof e==`string`||e instanceof String)r=new Vt(String(e),t);else throw Error(`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;)await this._pipe(new Ut(this.buffers.shift().toBuffer()));else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipe(r),n());else this.paused||this.emit(`data`,r.toBuffer()),this._writeToBuffers(r),this.emit(`readable`);return!0}cork(){this.corked=!0}_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(new Ut(this.buffers.shift().toBuffer()))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{e?n?.(e):(this._flush(),this.pipes.forEach(e=>{e.end()}),this.emit(`finish`))};e?this.write(e,t,r):r()}read(e){let t;if(e){for(t=[];e&&this.buffers.length&&!this.buffers[0].eod;){let n=this.buffers[0],r=n.read(e);r&&(e-=r.length,t.push(r)),n.eod&&n.full&&this.buffers.shift()}return Kt(t)}return t=this.buffers.map(e=>e.toBuffer()).filter(Boolean),this.buffers=[],Kt(t)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw Error(`Not Implemented`)}wrap(){throw Error(`Not Implemented`)}push(e){return e!==null&&this.write(e),!0}};function Kt(e){if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function qt(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}var Jt=class{constructor(e){this.finalized=!1,this.pendingWrites=[],this.events=new Map;let t=e?.compression===`STORE`?0:Math.max(0,Math.min(9,e?.compressionOptions?.level??1));this.stream=new Gt,this.zipBuilder=new zt({level:t})}on(e,t){let n=this.events.get(e)||[];return n.push(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){let n=this.events.get(e)||[];return n.forEach(e=>e(...t)),n.length>0}removeListener(e,t){return this.off(e,t)}append(e,t){let n;n=Object.prototype.hasOwnProperty.call(t,`base64`)&&t.base64?qt(typeof e==`string`?e:String(e)):typeof e==`string`?new TextEncoder().encode(e):e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):e;let r=this.zipBuilder.addFile({name:t.name,data:n}).then(e=>{for(let t of e)this.stream.write(new Uint8Array(t))});this.pendingWrites.push(r)}push(e){return this.stream.push(e)}async finalize(){if(this.finalized)return;this.finalized=!0,await Promise.all(this.pendingWrites);let e=this.zipBuilder.finalize();for(let t of e)this.stream.write(new Uint8Array(t));this.stream.end(),this.emit(`finish`)}read(e){return this.stream.read(e)}setEncoding(e){return this.stream.setEncoding(e)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(e){return this.stream.pipe(e)}unpipe(e){return this.stream.unpipe(e)}unshift(){return this.stream.unshift()}wrap(){return this.stream.wrap()}};const Yt=1e4;function Xt(e,t,n){e.push(` ${t}="${P(n.toString())}"`)}function Zt(e,t){if(t){let n=[];Object.entries(t).forEach(([e,t])=>{t!==void 0&&Xt(n,e,t)}),e.push(n.join(``))}}var I=class{constructor(){this._xml=[],this._chunks=[],this._stack=[],this._rollbacks=[]}_consolidate(){this._xml.length>=Yt&&(this._chunks.push(this._xml.join(``)),this._xml=[])}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._chunks.length*Yt+this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),Zt(t,e),t.push(`?>
|
|
8
|
+
`)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),Zt(r,t),this.leaf=!0,this.open=!0}addAttribute(e,t){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);t!==void 0&&Xt(this._xml,e,t)}addAttributes(e){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);Zt(this._xml,e)}writeText(e){let t=this._xml;this.open&&=(t.push(`>`),!1),this.leaf=!1,t.push(P(e.toString()))}writeXml(e){this.open&&=(this._xml.push(`>`),!1),this.leaf=!1,this._xml.push(e)}closeNode(){let e=this._stack.pop(),t=this._xml;this.leaf?t.push(`/>`):(t.push(`</`),t.push(e),t.push(`>`)),this.open=!1,this.leaf=!1,this._consolidate()}leafNode(e,t,n){this.openNode(e,t),n!==void 0&&this.writeText(n),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open,chunksLength:this._chunks.length}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let e=this._rollbacks.pop();this._xml.length>e.xml&&this._xml.splice(e.xml,this._xml.length-e.xml),this._stack.length>e.stack&&this._stack.splice(e.stack,this._stack.length-e.stack),this._chunks.length>e.chunksLength&&this._chunks.splice(e.chunksLength,this._chunks.length-e.chunksLength),this.leaf=e.leaf,this.open=e.open}get xml(){return this.closeAll(),this._chunks.length===0?this._xml.join(``):(this._xml.length>0&&this._chunks.push(this._xml.join(``)),this._chunks.join(``))}static{this.StdDocAttributes={version:`1.0`,encoding:`UTF-8`,standalone:`yes`}}};const Qt=Array(128);for(let e=0;e<128;e++)Qt[e]=String.fromCharCode(e);function L(e){return e<128?Qt[e]:String.fromCodePoint(e)}const $t=new Uint8Array(128);for(let e=97;e<=122;e++)$t[e]=1;for(let e=65;e<=90;e++)$t[e]=1;$t[95]=1,$t[58]=1;const R=new Uint8Array(128);for(let e=97;e<=122;e++)R[e]=1;for(let e=65;e<=90;e++)R[e]=1;for(let e=48;e<=57;e++)R[e]=1;R[95]=1,R[58]=1,R[45]=1,R[46]=1;function en(e){return e===32||e===10||e===13||e===9}function tn(e){return e===34||e===39}function nn(e){return e<128?$t[e]===1:e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function rn(e){return e<128?R[e]===1:e===183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=768&&e<=879||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function an(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111}const on={amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`};var sn=class{constructor(e){this.state=0,this.chunk=``,this.i=0,this.prevI=0,this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.entityReturnState=0,this.openWakaBang=``,this.sawRoot=!1,this.closedRoot=!1,this._closed=!1,this.reportedTextBeforeRoot=!1,this.reportedTextAfterRoot=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.ENTITIES={...on},this.trackPosition=e?.position!==!1,this.fileName=e?.fileName,this.fragment=e?.fragment??!1,this._init()}get closed(){return this._closed}get position(){return this.chunkPosition+this.i}_init(){this.state=(this.fragment,0),this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.openWakaBang=``,this.sawRoot=this.fragment,this.closedRoot=this.fragment,this.reportedTextBeforeRoot=this.fragment,this.reportedTextAfterRoot=this.fragment,this.carriedFromPrevious=void 0,this._closed=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.chunk=``,this.i=0,this.prevI=0}on(e,t){switch(e){case`text`:this.textHandler=t;break;case`opentag`:this.openTagHandler=t;break;case`closetag`:this.closeTagHandler=t;break;case`error`:this.errorHandler=t;break}}off(e){switch(e){case`text`:this.textHandler=void 0;break;case`opentag`:this.openTagHandler=void 0;break;case`closetag`:this.closeTagHandler=void 0;break;case`error`:this.errorHandler=void 0;break}}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e);if(this.errorHandler)this.errorHandler(t);else throw t;return this}write(e){if(this._closed)return this.fail(`cannot write after close`);let t=!1;e===null&&(t=!0,e=``),this.carriedFromPrevious!==void 0&&(e=this.carriedFromPrevious+e,this.carriedFromPrevious=void 0);let n=e.length;if(!t&&n>0){let t=e.charCodeAt(n-1);(t===13||t>=55296&&t<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n))}for(this.chunk=e,this.i=0;this.i<n;)this.processState();return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(n<10||n>13&&n<55296)return this.trackPosition&&this.column++,n;if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343)return this.i=t+2,this.trackPosition&&this.column++,65536+((n-55296)*1024+(r-56320))}return n===13?(e.charCodeAt(t+1)===10&&(this.i=t+2),this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),10):(n===10&&this.trackPosition?(this.line++,this.column=0,this.positionAtNewLine=this.position):this.trackPosition&&this.column++,n)}unget(){this.i=this.prevI,this.trackPosition&&this.column--}processState(){switch(this.state){case 0:this.sText();break;case 1:this.sOpenWaka();break;case 2:this.sOpenWakaBang();break;case 3:this.sOpenTag();break;case 4:this.sOpenTagSlash();break;case 5:this.sAttrib();break;case 6:this.sAttribName();break;case 7:this.sAttribNameSawWhite();break;case 8:this.sAttribValue();break;case 9:this.sAttribValueQuoted();break;case 10:this.sAttribValueClosed();break;case 11:this.sCloseTag();break;case 12:this.sCloseTagSawWhite();break;case 13:this.sComment();break;case 14:this.sCommentEnding();break;case 15:this.sCommentEnded();break;case 16:this.sCData();break;case 17:this.sCDataEnding();break;case 18:this.sCDataEnding2();break;case 19:this.sPI();break;case 20:this.sPIEnding();break;case 21:this.sDoctype();break;case 22:this.sDoctypeQuote();break;case 23:this.sDoctypeDTD();break;case 24:this.sDoctypeDTDQuoted();break;case 25:this.sEntity();break}}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}handleTextInRoot(){let{chunk:e}=this,{i:t}=this,n=this.textHandler;for(;;){let r=this.getCode();if(r===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));return}if(r===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;return}if(r===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``;return}r===10&&(n&&(this.text+=e.slice(t,this.prevI)+`
|
|
9
|
+
`),t=this.i)}}handleTextOutsideRoot(){let{chunk:e}=this,{i:t}=this,n=this.textHandler,r=!1;for(;;){let i=this.getCode();if(i===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));break}if(i===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;break}if(i===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``,r=!0;break}i===10?(n&&(this.text+=e.slice(t,this.prevI)+`
|
|
10
|
+
`),t=this.i):en(i)||(r=!0)}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}sOpenWaka(){let e=this.getCode();if(nn(e)){this.state=3,this.name=L(e);return}switch(e){case 47:this.state=11,this.name=``;break;case 33:this.state=2,this.openWakaBang=``;break;case 63:this.state=19,this.text=``;break;default:this.fail(`unexpected character in tag`),this.state=0}}sOpenWakaBang(){let e=this.getCode();switch(this.openWakaBang+=L(e),this.openWakaBang){case`[CDATA[`:this.state=16,this.text=``,this.openWakaBang=``;break;case`--`:this.state=13,this.text=``,this.openWakaBang=``;break;case`DOCTYPE`:this.state=21,this.text=``,this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&(this.fail(`incorrect syntax`),this.state=0)}}sOpenTag(){let e=this.getCode();if(e!==-1){if(rn(e)){this.name+=L(e);return}this.tag={name:this.name,attributes:Object.create(null),isSelfClosing:!1},this.attribList=[],this.sawRoot=!0,e===62?this.openTag():e===47?this.state=4:(en(e)||this.fail(`unexpected character in tag`),this.state=5)}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`expected >`),this.state=5)}sAttrib(){let e=this.skipSpaces();e!==-1&&(nn(e)?(this.name=L(e),this.state=6):e===62?this.openTag():e===47?this.state=4:this.fail(`unexpected character in attribute`))}sAttribName(){let e=this.getCode();if(e!==-1){if(rn(e)){this.name+=L(e);return}e===61?this.state=8:en(e)?this.state=7:e===62?(this.fail(`attribute without value`),this.attribList.push({name:this.name,value:this.name}),this.name=``,this.openTag()):this.fail(`unexpected character in attribute name`)}}sAttribNameSawWhite(){let e=this.skipSpaces();e!==-1&&(e===61?this.state=8:(this.fail(`attribute without value`),this.name=``,this.text=``,e===62?this.openTag():nn(e)?(this.name=L(e),this.state=6):(this.fail(`unexpected character`),this.state=5)))}sAttribValue(){let e=this.skipSpaces();e!==-1&&(tn(e)?(this.q=e,this.text=``,this.state=9):(this.fail(`unquoted attribute value`),this.state=0))}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;){let r=this.getCode();if(r===-1){this.text+=t.slice(n,this.i);return}if(r===e){this.attribList.push({name:this.name,value:this.text+t.slice(n,this.prevI)}),this.name=``,this.text=``,this.q=null,this.state=10;return}if(r===38){this.text+=t.slice(n,this.prevI),this.state=25,this.entityReturnState=9,this.entity=``;return}if((r===10||r===9)&&(this.text+=t.slice(n,this.prevI)+` `,n=this.i),r===60){this.text+=t.slice(n,this.prevI),this.fail(`< not allowed in attribute value`);return}}}sAttribValueClosed(){let e=this.getCode();e!==-1&&(en(e)?this.state=5:e===62?this.openTag():e===47?this.state=4:nn(e)?(this.fail(`no whitespace between attributes`),this.name=L(e),this.state=6):this.fail(`unexpected character after attribute`))}sCloseTag(){let e=this.getCode();e!==-1&&(rn(e)?this.name+=L(e):e===62?this.closeTag():en(e)?this.state=12:this.fail(`unexpected character in close tag`))}sCloseTagSawWhite(){let e=this.skipSpaces();e!==-1&&(e===62?this.closeTag():this.fail(`unexpected character in close tag`))}sComment(){let e=this.getCode();e!==-1&&(e===45?this.state=14:this.text+=L(e))}sCommentEnding(){let e=this.getCode();e===45?this.state=15:(this.text+=`-`+L(e),this.state=13)}sCommentEnded(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===45?this.text+=`-`:(this.fail(`malformed comment`),this.text+=`--`+L(e),this.state=13)}sCData(){let e=this.getCode();e!==-1&&(e===93?this.state=17:this.text+=L(e))}sCDataEnding(){let e=this.getCode();e===93?this.state=18:(this.text+=`]`+L(e),this.state=16)}sCDataEnding2(){let e=this.getCode();e===62?(this.textHandler&&this.text.length>0&&this.textHandler(this.text),this.text=``,this.state=0):e===93?this.text+=`]`:(this.text+=`]]`+L(e),this.state=16)}sPI(){let e=this.getCode();e!==-1&&(e===63?this.state=20:this.text+=L(e))}sPIEnding(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===63?this.text+=`?`:(this.text+=`?`+L(e),this.state=19)}sDoctype(){let e=this.getCode();e!==-1&&(e===62?(this.text=``,this.state=0):tn(e)?(this.q=e,this.state=22):e===91?this.state=23:this.text+=L(e))}sDoctypeQuote(){let e=this.getCode();e!==-1&&(e===this.q?(this.q=null,this.state=21):this.text+=L(e))}sDoctypeDTD(){let e=this.getCode();e!==-1&&(e===93?this.state=21:tn(e)&&(this.q=e,this.state=24))}sDoctypeDTDQuoted(){let e=this.getCode();e!==-1&&e===this.q&&(this.q=null,this.state=23)}sEntity(){let e=this.getCode();if(e!==-1)if(e===59){let e=this.entity,t;e===``?(this.fail(`empty entity`),t=`&;`):t=this.parseEntity(e),this.text+=t,this.state=this.entityReturnState,this.entity=``}else rn(e)||e===35?this.entity+=L(e):(this.fail(`invalid entity character`),this.text+=`&`+this.entity+L(e),this.state=this.entityReturnState,this.entity=``)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(`undefined entity: `+e),`&`+e+`;`):t}let t;return t=e[1]===`x`||e[1]===`X`?parseInt(e.slice(2),16):parseInt(e.slice(1),10),isNaN(t)||!an(t)?(this.fail(`invalid character entity`),`&`+e+`;`):String.fromCodePoint(t)}skipSpaces(){for(;;){let e=this.getCode();if(e===-1||!en(e))return e}}openTag(){let e=this.tag;e.isSelfClosing=!1;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.tags.push(e),this.name=``,this.state=0}openSelfClosingTag(){let e=this.tag;e.isSelfClosing=!0;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.closeTagHandler?.(e),this.tags.length===0&&(this.closedRoot=!0),this.name=``,this.state=0}closeTag(){let{tags:e,name:t}=this;if(this.state=0,this.name=``,t===``){this.fail(`empty close tag`),this.text+=`</>`;return}let n=!1;for(let r=e.length-1;r>=0;r--)if(e[r].name===t){for(;e.length>r;){let t=e.pop();this.closeTagHandler?.(t),e.length>r&&this.fail(`unclosed tag: `+t.name)}n=!0;break}n||(this.fail(`unmatched close tag: `+t),this.text+=`</`+t+`>`),e.length===0&&(this.closedRoot=!0)}end(){for(this.sawRoot||this.fail(`document must contain a root element`);this.tags.length>0;){let e=this.tags.pop();this.fail(`unclosed tag: `+e.name)}return this.text.length>0&&this.textHandler&&(this.textHandler(this.text),this.text=``),this._closed=!0,this._init(),this}};async function*cn(e){let t=new sn({xmlns:!1,position:!0}),n;t.on(`error`,e=>{n=e});let r=[];t.on(`opentag`,e=>r.push({eventType:`opentag`,value:e})),t.on(`text`,e=>r.push({eventType:`text`,value:e})),t.on(`closetag`,e=>r.push({eventType:`closetag`,value:e}));for await(let i of e){if(t.write(je(i)),n)throw n;yield r,r=[]}if(t.close(),n)throw n;r.length>0&&(yield r)}var z=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=null,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){for await(let t of e)for(let{eventType:e,value:n}of t)if(e===`opentag`)this.parseOpen(n);else if(e===`text`)this.parseText(n);else if(e===`closetag`&&!this.parseClose(n.name))return this.model;return this.model}async parseStream(e){return this.parse(cn(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new I;return this.render(t,e),t.xml}static toAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e.toString()}static toStringAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toStringValue(e,t){return e===void 0?t:e}static toBoolAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e?`1`:`0`}static toBoolValue(e,t){return e===void 0?t:e===`1`}static toIntAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toIntValue(e,t){return e===void 0?t:parseInt(e,10)}static toFloatAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toFloatValue(e,t){return e===void 0?t:parseFloat(e)}};function ln(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{ln(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var B=class extends z{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new I;ln(e,this._model),this._xml=e.xml}e.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},V=class extends z{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count||`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t&&t.length||0);let{childXform:n}=this;(t||[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model=[],!0;default:return this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw Error(`Max ${this.childXform.tag} count (${this.maxItems}) exceeded`);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},H=class extends z{constructor(e){super(),this.name=e||`color`}get tag(){return this.name}render(e,t){return t?(e.openNode(this.name),t.argb?e.addAttribute(`rgb`,t.argb):t.theme===void 0?t.indexed===void 0?e.addAttribute(`auto`,`1`):e.addAttribute(`indexed`,t.indexed):(e.addAttribute(`theme`,t.theme),t.tint!==void 0&&e.addAttribute(`tint`,t.tint)),e.closeNode(),!0):!1}parseOpen(e){return e.name===this.name?(e.attributes.rgb?this.model={argb:e.attributes.rgb}:e.attributes.theme?(this.model={theme:parseInt(e.attributes.theme,10)},e.attributes.tint&&(this.model.tint=parseFloat(e.attributes.tint))):e.attributes.indexed?this.model={indexed:parseInt(e.attributes.indexed,10)}:this.model=void 0,!0):!1}parseText(){}parseClose(){return!1}},U=class extends z{constructor(e){super(),this.tag=e.tag,this.attr=e.attr}render(e,t){t&&(e.openNode(this.tag),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}},W=class extends z{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.zero=e.zero,this.text=[]}render(e,t){(t||this.zero)&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){return e.name===this.tag?(this.attr?this.model=parseInt(e.attributes[this.attr],10):this.text=[],!0):!1}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=parseInt(this.text.join(``)||`0`,10)),!1}},G=class extends z{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[]}render(e,t){t!==void 0&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=e.attributes[this.attr]:this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this.text.join(``)),!1}},un=class e extends z{static{this.Attributes={single:{},double:{val:`double`},singleAccounting:{val:`singleAccounting`},doubleAccounting:{val:`doubleAccounting`}}}constructor(e){super(),this.model=e}get tag(){return`u`}render(t,n){if(n||=this.model,n===!0)t.leafNode(`u`);else{let r=e.Attributes[n];r&&t.leafNode(`u`,r)}}parseOpen(e){e.name===`u`&&(this.model=e.attributes.val||!0)}parseText(){}parseClose(){return!1}},dn=class e extends z{constructor(t){super(),this.options=t||e.OPTIONS,this.map={b:{prop:`bold`,xform:new U({tag:`b`,attr:`val`})},i:{prop:`italic`,xform:new U({tag:`i`,attr:`val`})},u:{prop:`underline`,xform:new un},charset:{prop:`charset`,xform:new W({tag:`charset`,attr:`val`})},color:{prop:`color`,xform:new H},condense:{prop:`condense`,xform:new U({tag:`condense`,attr:`val`})},extend:{prop:`extend`,xform:new U({tag:`extend`,attr:`val`})},family:{prop:`family`,xform:new W({tag:`family`,attr:`val`})},outline:{prop:`outline`,xform:new U({tag:`outline`,attr:`val`})},vertAlign:{prop:`vertAlign`,xform:new G({tag:`vertAlign`,attr:`val`})},scheme:{prop:`scheme`,xform:new G({tag:`scheme`,attr:`val`})},shadow:{prop:`shadow`,xform:new U({tag:`shadow`,attr:`val`})},strike:{prop:`strike`,xform:new U({tag:`strike`,attr:`val`})},sz:{prop:`size`,xform:new W({tag:`sz`,attr:`val`})}},this.map[this.options.fontNameTag]={prop:`name`,xform:new G({tag:this.options.fontNameTag,attr:`val`})}}get tag(){return this.options.tagName}render(e,t){let{map:n}=this;e.openNode(this.options.tagName),Object.entries(this.map).forEach(([r,i])=>{n[r].xform.render(e,t[i.prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},fn=class extends z{constructor(){super(),this.map={color:new H}}get tag(){return`stop`}render(e,t){e.openNode(`stop`),e.addAttribute(`position`,t.position),this.map.color.render(e,t.color),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`stop`:return this.model={position:parseFloat(e.attributes.position)},!0;case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(){}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.color=this.parser.model,this.parser=void 0),!0):!1}},pn=class extends z{constructor(){super(),this.map={fgColor:new H(`fgColor`),bgColor:new H(`bgColor`)}}get name(){return`pattern`}get tag(){return`patternFill`}render(e,t){e.openNode(`patternFill`),e.addAttribute(`patternType`,t.pattern),t.fgColor&&this.map.fgColor.render(e,t.fgColor),t.bgColor&&this.map.bgColor.render(e,t.bgColor),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`patternFill`:return this.model={type:`pattern`,pattern:e.attributes.patternType},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser.model&&(this.model[e]=this.parser.model),this.parser=void 0),!0):!1}},mn=class extends z{constructor(){super(),this.map={stop:new fn}}get name(){return`gradient`}get tag(){return`gradientFill`}render(e,t){switch(e.openNode(`gradientFill`),t.gradient){case`angle`:e.addAttribute(`degree`,t.degree);break;case`path`:e.addAttribute(`type`,`path`),t.center.left&&(e.addAttribute(`left`,t.center.left),t.center.right===void 0&&e.addAttribute(`right`,t.center.left)),t.center.right&&e.addAttribute(`right`,t.center.right),t.center.top&&(e.addAttribute(`top`,t.center.top),t.center.bottom===void 0&&e.addAttribute(`bottom`,t.center.top)),t.center.bottom&&e.addAttribute(`bottom`,t.center.bottom);break;default:break}let n=this.map.stop;t.stops.forEach(t=>{n.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`gradientFill`:{let t=this.model={stops:[]};return e.attributes.degree?(t.gradient=`angle`,t.degree=parseInt(e.attributes.degree,10)):e.attributes.type===`path`&&(t.gradient=`path`,t.center={left:e.attributes.left?parseFloat(e.attributes.left):0,top:e.attributes.top?parseFloat(e.attributes.top):0},e.attributes.right!==e.attributes.left&&(t.center.right=e.attributes.right?parseFloat(e.attributes.right):0),e.attributes.bottom!==e.attributes.top&&(t.center.bottom=e.attributes.bottom?parseFloat(e.attributes.bottom):0)),!0}case`stop`:return this.parser=this.map.stop,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0):!1}},hn=class e extends z{constructor(){super(),this.map={patternFill:new pn,gradientFill:new mn}}get tag(){return`fill`}render(e,t){switch(e.addRollback(),e.openNode(`fill`),t.type){case`pattern`:this.map.patternFill.render(e,t);break;case`gradient`:this.map.gradientFill.render(e,t);break;default:e.rollback();return}e.closeNode(),e.commit()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`fill`:return this.model={},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0):!1}validStyle(t){return e.validPatternValues[t]}static{this.validPatternValues=[`none`,`solid`,`darkVertical`,`darkGray`,`mediumGray`,`lightGray`,`gray125`,`gray0625`,`darkHorizontal`,`darkVertical`,`darkDown`,`darkUp`,`darkGrid`,`darkTrellis`,`lightHorizontal`,`lightVertical`,`lightDown`,`lightUp`,`lightGrid`,`lightTrellis`,`lightGrid`].reduce((e,t)=>(e[t]=!0,e),{})}static{this.StopXform=fn}static{this.PatternFillXform=pn}static{this.GradientFillXform=mn}},gn=class e extends z{constructor(e){super(),this.name=e,this.map={color:new H}}get tag(){return this.name}render(e,t,n){let r=t&&t.color||n||this.defaultColor;e.openNode(this.name),t&&t.style&&(e.addAttribute(`style`,t.style),r&&this.map.color.render(e,r)),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.name:{let{style:t}=e.attributes;return t?this.model={style:t}:this.model=void 0,!0}case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(e===this.name&&this.map.color.model&&(this.model||={},this.model.color=this.map.color.model),!1)}validStyle(t){return e.validStyleValues[t]}static{this.validStyleValues=[`thin`,`dashed`,`dotted`,`dashDot`,`hair`,`dashDotDot`,`slantDashDot`,`mediumDashed`,`mediumDashDotDot`,`mediumDashDot`,`medium`,`double`,`thick`].reduce((e,t)=>(e[t]=!0,e),{})}},_n=class extends z{constructor(){super(),this.map={top:new gn(`top`),left:new gn(`left`),bottom:new gn(`bottom`),right:new gn(`right`),diagonal:new gn(`diagonal`)}}render(e,t){let{color:n}=t;e.openNode(`border`),t.diagonal&&t.diagonal.style&&(t.diagonal.up&&e.addAttribute(`diagonalUp`,`1`),t.diagonal.down&&e.addAttribute(`diagonalDown`,`1`));let r=(r,i)=>{let a=r;a&&!a.color&&t.color&&(a={...a,color:t.color}),i.render(e,a,n)};r(t.left,this.map.left),r(t.right,this.map.right),r(t.top,this.map.top),r(t.bottom,this.map.bottom),r(t.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`border`:return this.reset(),this.diagonalUp=N(e.attributes.diagonalUp),this.diagonalDown=N(e.attributes.diagonalDown),!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`border`){let e=this.model={},t=(t,n,r)=>{n&&(r&&Object.assign(n,r),e[t]=n)};t(`left`,this.map.left.model),t(`right`,this.map.right.model),t(`top`,this.map.top.model),t(`bottom`,this.map.bottom.model),t(`diagonal`,this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}};const vn={0:{f:`General`},1:{f:`0`},2:{f:`0.00`},3:{f:`#,##0`},4:{f:`#,##0.00`},9:{f:`0%`},10:{f:`0.00%`},11:{f:`0.00E+00`},12:{f:`# ?/?`},13:{f:`# ??/??`},14:{f:`mm-dd-yy`},15:{f:`d-mmm-yy`},16:{f:`d-mmm`},17:{f:`mmm-yy`},18:{f:`h:mm AM/PM`},19:{f:`h:mm:ss AM/PM`},20:{f:`h:mm`},21:{f:`h:mm:ss`},22:{f:`m/d/yy "h":mm`},27:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},28:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},29:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},30:{"zh-tw":`m/d/yy `,"zh-cn":`m-d-yy`,"ja-jp":`m/d/yy`,"ko-kr":`mm-dd-yy`},31:{"zh-tw":`yyyy"年"m"月"d"日"`,"zh-cn":`yyyy"年"m"月"d"日"`,"ja-jp":`yyyy"年"m"月"d"日"`,"ko-kr":`yyyy"년" mm"월" dd"일"`},32:{"zh-tw":`hh"時"mm"分"`,"zh-cn":`h"时"mm"分"`,"ja-jp":`h"時"mm"分"`,"ko-kr":`h"시" mm"분"`},33:{"zh-tw":`hh"時"mm"分"ss"秒"`,"zh-cn":`h"时"mm"分"ss"秒"`,"ja-jp":`h"時"mm"分"ss"秒"`,"ko-kr":`h"시" mm"분" ss"초"`},34:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},35:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},36:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},37:{f:`#,##0 ;(#,##0)`},38:{f:`#,##0 ;[Red](#,##0)`},39:{f:`#,##0.00 ;(#,##0.00)`},40:{f:`#,##0.00 ;[Red](#,##0.00)`},45:{f:`mm:ss`},46:{f:`[h]:mm:ss`},47:{f:`mmss.0`},48:{f:`##0.0E+0`},49:{f:`@`},50:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},51:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},52:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},53:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`m"月"d"日"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},54:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},55:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},56:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},57:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},58:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},59:{"th-th":`t0`},60:{"th-th":`t0.00`},61:{"th-th":`t#,##0`},62:{"th-th":`t#,##0.00`},67:{"th-th":`t0%`},68:{"th-th":`t0.00%`},69:{"th-th":`t# ?/?`},70:{"th-th":`t# ??/??`},81:{"th-th":`d/m/bb`}};function yn(){let e={};return Object.entries(vn).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}const bn=yn();var xn=class extends z{constructor(e,t){super(),this.id=e,this.formatCode=t}get tag(){return`numFmt`}render(e,t){e.leafNode(`numFmt`,{numFmtId:t.id,formatCode:t.formatCode})}parseOpen(e){switch(e.name){case`numFmt`:return this.model={id:parseInt(e.attributes.numFmtId,10),formatCode:e.attributes.formatCode.replace(/[\\](.)/g,`$1`)},!0;default:return!1}}parseText(){}parseClose(){return!1}static getDefaultFmtId(e){return bn[e]}static getDefaultFmtCode(e){return vn[e]&&vn[e].f}};const Sn={ReadingOrder:{LeftToRight:1,RightToLeft:2}},Cn={horizontalValues:[`left`,`center`,`right`,`fill`,`centerContinuous`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),horizontal(e){return this.horizontalValues[e]?e:void 0},verticalValues:[`top`,`middle`,`bottom`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),vertical(e){return e===`middle`?`center`:this.verticalValues[e]?e:void 0},wrapText(e){return e?!0:void 0},shrinkToFit(e){return e?!0:void 0},textRotation(e){switch(e){case`vertical`:return e;default:{let t=Ee(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=Ee(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Sn.ReadingOrder.LeftToRight;case`rtl`:return Sn.ReadingOrder.RightToLeft;default:return}}},wn={toXml(e){let t=Cn.textRotation(e);if(t){if(t===`vertical`)return 255;let e=Math.round(t);if(e>=0&&e<=90)return e;if(e<0&&e>=-90)return 90-e}},toModel(e){let t=Ee(e);if(t!==void 0){if(t===255)return`vertical`;if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}}};var Tn=class extends z{get tag(){return`alignment`}render(e,t){e.addRollback(),e.openNode(`alignment`);let n=!1;function r(t,r){r&&(e.addAttribute(t,r),n=!0)}r(`horizontal`,Cn.horizontal(t.horizontal)),r(`vertical`,Cn.vertical(t.vertical)),r(`wrapText`,Cn.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,Cn.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,Cn.indent(t.indent)),r(`textRotation`,wn.toXml(t.textRotation)),r(`readingOrder`,Cn.readingOrder(t.readingOrder)),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={},n=!1;function r(e,r,i){e&&(t[r]=i,n=!0)}r(e.attributes.horizontal,`horizontal`,e.attributes.horizontal),r(e.attributes.vertical,`vertical`,e.attributes.vertical===`center`?`middle`:e.attributes.vertical),r(e.attributes.wrapText,`wrapText`,N(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,N(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,wn.toModel(e.attributes.textRotation)),r(e.attributes.readingOrder,`readingOrder`,e.attributes.readingOrder===`2`?`rtl`:`ltr`),this.model=n?t:null}parseText(){}parseClose(){return!1}};const En={boolean(e,t){return e===void 0?t:e}};var Dn=class extends z{get tag(){return`protection`}render(e,t){e.addRollback(),e.openNode(`protection`);let n=!1;function r(t,r){r!==void 0&&(e.addAttribute(t,r),n=!0)}r(`locked`,En.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,En.boolean(t.hidden,!1)?`1`:void 0),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={locked:e.attributes.locked!==`0`,hidden:e.attributes.hidden===`1`};this.model=!t.locked||t.hidden?t:null}parseText(){}parseClose(){return!1}},On=class extends z{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new Tn,protection:new Dn}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId||0,fontId:t.fontId||0,fillId:t.fillId||0,borderId:t.borderId||0}),this.xfId&&e.addAttribute(`xfId`,t.xfId||0),t.numFmtId&&e.addAttribute(`applyNumberFormat`,`1`),t.fontId&&e.addAttribute(`applyFont`,`1`),t.fillId&&e.addAttribute(`applyFill`,`1`),t.borderId&&e.addAttribute(`applyBorder`,`1`),t.alignment&&e.addAttribute(`applyAlignment`,`1`),t.protection&&e.addAttribute(`applyProtection`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:return this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},kn=class extends z{constructor(){super(),this.map={alignment:new Tn,border:new _n,fill:new hn,font:new dn,numFmt:new xn,protection:new Dn}}get tag(){return`dxf`}render(e,t){if(e.openNode(this.tag),t.font&&this.map.font.render(e,t.font),t.numFmt&&t.numFmtId){let n={id:t.numFmtId,formatCode:t.numFmt};this.map.numFmt.render(e,n)}t.fill&&this.map.fill.render(e,t.fill),t.alignment&&this.map.alignment.render(e,t.alignment),t.border&&this.map.border.render(e,t.border),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.reset(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e===this.tag?(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1):!0}},An=class e extends z{constructor(t){super(),this.map={numFmts:new V({tag:`numFmts`,count:!0,childXform:new xn}),fonts:new V({tag:`fonts`,count:!0,childXform:new dn,$:{"x14ac:knownFonts":1}}),fills:new V({tag:`fills`,count:!0,childXform:new hn}),borders:new V({tag:`borders`,count:!0,childXform:new _n}),cellStyleXfs:new V({tag:`cellStyleXfs`,count:!0,childXform:new On}),cellXfs:new V({tag:`cellXfs`,count:!0,childXform:new On({xfId:!0})}),dxfs:new V({tag:`dxfs`,always:!0,count:!0,childXform:new kn}),numFmt:new xn,font:new dn,fill:new hn,border:new _n,style:new On({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap}render(t,n){let r=n||this.model;t.openXml(I.StdDocAttributes),t.openNode(`styleSheet`,e.STYLESHEET_ATTRIBUTES),this.index?(r.numFmts&&r.numFmts.length&&(t.openNode(`numFmts`,{count:r.numFmts.length}),r.numFmts.forEach(e=>{t.writeXml(e)}),t.closeNode()),r.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeXml(e)}),t.closeNode(),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),t.openNode(`cellXfs`,{count:r.styles.length}),r.styles.forEach(e=>{t.writeXml(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let n={},r=t||l.ValueType.Number;if(e.numFmt)n.numFmtId=this._addNumFmtStr(e.numFmt);else switch(r){case l.ValueType.Number:n.numFmtId=this._addNumFmtStr(`General`);break;case l.ValueType.Date:n.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(n.fontId=this._addFont(e.font)),e.border&&(n.borderId=this._addBorder(e.border)),e.fill&&(n.fillId=this._addFill(e.fill)),e.alignment&&(n.alignment=e.alignment),e.protection&&(n.protection=e.protection);let i=this._addStyle(n);return this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||xn.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}return r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection),n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=xn.getDefaultFmtId(e);if(t!==void 0||(t=this.index.numFmt[e],t!==void 0))return t;t=this.index.numFmt[e]=164+this.model.numFmts.length;let n=this.map.numFmt.toXml({id:t,formatCode:e});return this.model.numFmts.push(n),t}_addFont(e){let t=this.map.font.toXml(e),n=this.index.font[t];return n===void 0&&(n=this.index.font[t]=this.model.fonts.length,this.model.fonts.push(t)),n}_addBorder(e){let t=this.map.border.toXml(e),n=this.index.border[t];return n===void 0&&(n=this.index.border[t]=this.model.borders.length,this.model.borders.push(t)),n}_addFill(e){let t=this.map.fill.toXml(e),n=this.index.fill[t];return n===void 0&&(n=this.index.fill[t]=this.model.fills.length,this.model.fills.push(t)),n}static{this.STYLESHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac x16r2`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"xmlns:x16r2":`http://schemas.microsoft.com/office/spreadsheetml/2015/02/main`}}static{this.STATIC_XFORMS={cellStyles:new B({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new B({tag:`dxfs`,$:{count:0}}),tableStyles:new B({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new B({tag:`extLst`,c:[{tag:`ext`,$:{uri:`{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`},c:[{tag:`x14:slicerStyles`,$:{defaultSlicerStyle:`SlicerStyleLight1`}}]},{tag:`ext`,$:{uri:`{9260A510-F301-46a8-8635-F512D64BE5F5}`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`},c:[{tag:`x15:timelineStyles`,$:{defaultTimelineStyle:`TimeSlicerStyleLight1`}}]}]})}}};An.Mock=class extends An{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}],borders:[{}],fills:[{type:`pattern`,pattern:`none`},{type:`pattern`,pattern:`gray125`}]}}parseStream(e){return e.autodrain(),Promise.resolve()}addStyleModel(e,t){switch(t){case l.ValueType.Date:return this.dateStyleId;default:return 0}}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:xn.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var jn=class extends z{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}},Mn=class e extends z{constructor(){super(),this.map={"dc:creator":new G({tag:`dc:creator`}),"dc:title":new G({tag:`dc:title`}),"dc:subject":new G({tag:`dc:subject`}),"dc:description":new G({tag:`dc:description`}),"dc:identifier":new G({tag:`dc:identifier`}),"dc:language":new G({tag:`dc:language`}),"cp:keywords":new G({tag:`cp:keywords`}),"cp:category":new G({tag:`cp:category`}),"cp:lastModifiedBy":new G({tag:`cp:lastModifiedBy`}),"cp:lastPrinted":new jn({tag:`cp:lastPrinted`,format:e.DateFormat}),"cp:revision":new W({tag:`cp:revision`}),"cp:version":new G({tag:`cp:version`}),"cp:contentStatus":new G({tag:`cp:contentStatus`}),"cp:contentType":new G({tag:`cp:contentType`}),"dcterms:created":new jn({tag:`dcterms:created`,attrs:e.DateAttrs,format:e.DateFormat}),"dcterms:modified":new jn({tag:`dcterms:modified`,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(I.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES),this.map[`dc:creator`].render(t,n.creator),this.map[`dc:title`].render(t,n.title),this.map[`dc:subject`].render(t,n.subject),this.map[`dc:description`].render(t,n.description),this.map[`dc:identifier`].render(t,n.identifier),this.map[`dc:language`].render(t,n.language),this.map[`cp:keywords`].render(t,n.keywords),this.map[`cp:category`].render(t,n.category),this.map[`cp:lastModifiedBy`].render(t,n.lastModifiedBy),this.map[`cp:lastPrinted`].render(t,n.lastPrinted),this.map[`cp:revision`].render(t,n.revision),this.map[`cp:version`].render(t,n.version),this.map[`cp:contentStatus`].render(t,n.contentStatus),this.map[`cp:contentType`].render(t,n.contentType),this.map[`dcterms:created`].render(t,n.created),this.map[`dcterms:modified`].render(t,n.modified),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`cp:coreProperties`:case`coreProperties`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`cp:coreProperties`:case`coreProperties`:return this.model={creator:this.map[`dc:creator`].model,title:this.map[`dc:title`].model,subject:this.map[`dc:subject`].model,description:this.map[`dc:description`].model,identifier:this.map[`dc:identifier`].model,language:this.map[`dc:language`].model,keywords:this.map[`cp:keywords`].model,category:this.map[`cp:category`].model,lastModifiedBy:this.map[`cp:lastModifiedBy`].model,lastPrinted:this.map[`cp:lastPrinted`].model,revision:this.map[`cp:revision`].model,contentStatus:this.map[`cp:contentStatus`].model,contentType:this.map[`cp:contentType`].model,created:this.map[`dcterms:created`].model,modified:this.map[`dcterms:modified`].model},!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},Nn=class extends z{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(t),e.closeNode()}parseOpen(e){switch(e.name){case`t`:return this._text=[],this.model=``,!0;default:return!1}}parseText(e){this._text.push(e),this.model=this._text.join(``).replace(/_x([0-9A-F]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}parseClose(){return!1}},Pn=class e extends z{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new Nn}get fontXform(){return this._fontXform||=new dn(e.FONT_OPTIONS)}render(e,t){let n=t||this.model;e.openNode(`r`),n.font&&this.fontXform.render(e,n.font),this.textXform.render(e,n.text),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`r`:return this.model={},!0;case`t`:return this.parser=this.textXform,this.parser.parseOpen(e),!0;case`rPr`:return this.parser=this.fontXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`r`:return!1;case`t`:return this.model.text=this.parser.model,this.parser=void 0,!0;case`rPr`:return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.FONT_OPTIONS={tagName:`rPr`,fontNameTag:`rFont`}}},Fn=class extends z{constructor(){super(),this.map={r:new Pn,t:new Nn}}get tag(){return`rPh`}render(e,t){if(e.openNode(this.tag,{sb:t.sb||0,eb:t.eb||0}),t&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText){let{r:n}=this.map;t.richText.forEach(t=>{n.render(e,t)})}else t&&this.map.t.render(e,t.text);e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={sb:parseInt(e.attributes.sb,10),eb:parseInt(e.attributes.eb,10)},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model.text=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},In=class extends z{constructor(e){super(),this.model=e,this.map={r:new Pn,t:new Nn,rPh:new Fn}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Ln=class extends z{constructor(e){super(),this.model=e||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||=new In}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(e){return this.model.values[e]}add(e){return e.richText?this.addRichText(e):this.addText(e)}addText(e){let t=this.hash[e];return t===void 0&&(t=this.hash[e]=this.model.values.length,this.model.values.push(e)),this.model.count++,t}addRichText(e){let t=this.sharedStringXform.toXml(e),n=this.rich[t];return n===void 0&&(n=this.rich[t]=this.model.values.length,this.model.values.push(e)),this.model.count++,n}render(e,t){let n=t||this._values;e.openXml(I.StdDocAttributes),e.openNode(`sst`,{xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,count:n.count,uniqueCount:n.values.length});let r=this.sharedStringXform;n.values.forEach(t=>{r.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`sst`:return!0;case`si`:return this.parser=this.sharedStringXform,this.parser.parseOpen(e),!0;default:throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;switch(e){case`sst`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Rn=class extends z{render(e,t){e.leafNode(`Relationship`,t)}parseOpen(e){switch(e.name){case`Relationship`:return this.model=e.attributes,!0;default:return!1}}parseText(){}parseClose(){return!1}},K=class e extends z{constructor(){super(),this.map={Relationship:new Rn}}render(t,n){let r=n||this._values;t.openXml(I.StdDocAttributes),t.openNode(`Relationships`,e.RELATIONSHIPS_ATTRIBUTES),r.forEach(e=>{this.map.Relationship.render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Relationships`:return this.model=[],!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.push(this.parser.model),this.parser=void 0),!0;switch(e){case`Relationships`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}},zn=class e extends z{render(t,n){t.openXml(I.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};(n.media||[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:`/xl/workbook.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach((e,n)=>{let r=`/xl/worksheets/sheet${e.fileIndex||n+1}.xml`;t.leafNode(`Override`,{PartName:r,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables||[]).length&&(n.pivotTables||[]).forEach(e=>{let n=e.tableNumber;t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheDefinition${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheRecords${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotTables/pivotTable${n}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})}),t.leafNode(`Override`,{PartName:`/xl/theme/theme1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:`/xl/styles.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:`/xl/sharedStrings.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/tables/${e.target}`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/drawings/${e.name}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})}),n.commentRefs&&(t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:`/xl/${e}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})})),t.leafNode(`Override`,{PartName:`/docProps/core.xml`,ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:`/docProps/app.xml`,ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},Bn=class extends z{render(e,t){e.openNode(`HeadingPairs`),e.openNode(`vt:vector`,{size:2,baseType:`variant`}),e.openNode(`vt:variant`),e.leafNode(`vt:lpstr`,void 0,`Worksheets`),e.closeNode(),e.openNode(`vt:variant`),e.leafNode(`vt:i4`,void 0,t.length),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`HeadingPairs`}parseText(){}parseClose(e){return e!==`HeadingPairs`}},Vn=class extends z{render(e,t){e.openNode(`TitlesOfParts`),e.openNode(`vt:vector`,{size:t.length,baseType:`lpstr`}),t.forEach(t=>{e.leafNode(`vt:lpstr`,void 0,t.name)}),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`TitlesOfParts`}parseText(){}parseClose(e){return e!==`TitlesOfParts`}},Hn=class e extends z{constructor(){super(),this.map={Company:new G({tag:`Company`}),Manager:new G({tag:`Manager`}),HeadingPairs:new Bn,TitleOfParts:new Vn}}render(t,n){t.openXml(I.StdDocAttributes),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitleOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company||``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitleOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},Un=class extends z{constructor(){super(),this._parsedText=[]}render(e,t){e.openNode(`definedName`,{name:t.name,localSheetId:t.localSheetId}),e.writeText(t.ranges.join(`,`)),e.closeNode()}parseOpen(e){switch(e.name){case`definedName`:return this._parsedName=e.attributes.name,this._parsedLocalSheetId=e.attributes.localSheetId,this._parsedText=[],!0;default:return!1}}parseText(e){this._parsedText.push(e)}parseClose(){return this.model={name:this._parsedName,ranges:Jn(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};const Wn=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,Gn=/^[$]?\d+:[$]?\d+$/,Kn=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function qn(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let n=e.split(`!`).pop()||``;if(!Wn.test(n)&&!Gn.test(n)&&!Kn.test(n))return!1;try{let n=t.decodeEx(e);return`row`in n&&typeof n.row==`number`||`top`in n&&typeof n.top==`number`||`left`in n&&typeof n.left==`number`}catch{return!1}}function Jn(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)||[]).length;if(!t){r?i+=`${e},`:qn(e)&&n.push(e);return}let a=t%2==0;!r&&a&&qn(e)?n.push(e):r&&!a?(r=!1,qn(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}var Yn=class extends z{render(e,t){e.leafNode(`sheet`,{sheetId:t.id,name:t.name,state:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:Te(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},Xn=class extends z{render(e,t){let n={xWindow:t.x||0,yWindow:t.y||0,windowWidth:t.width||12e3,windowHeight:t.height||24e3,firstSheet:t.firstSheet,activeTab:t.activeTab};t.visibility&&t.visibility!==`visible`&&(n.visibility=t.visibility),e.leafNode(`workbookView`,n)}parseOpen(e){if(e.name===`workbookView`){let t=this.model={},n=function(e,n,r){t[e]=n===void 0?r:n},r=function(e,n,r){let i=n===void 0?r:parseInt(n,10);i!==void 0&&(t[e]=i)};return r(`x`,e.attributes.xWindow,0),r(`y`,e.attributes.yWindow,0),r(`width`,e.attributes.windowWidth,25e3),r(`height`,e.attributes.windowHeight,1e4),n(`visibility`,e.attributes.visibility,`visible`),r(`activeTab`,e.attributes.activeTab,void 0),r(`firstSheet`,e.attributes.firstSheet,void 0),!0}return!1}parseText(){}parseClose(){return!1}},Zn=class extends z{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,defaultThemeVersion:164011,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},Qn=class extends z{render(e,t){e.leafNode(`calcPr`,{calcId:171027,fullCalcOnLoad:t.fullCalcOnLoad?1:void 0})}parseOpen(e){return e.name===`calcPr`?(this.model={},!0):!1}parseText(){}parseClose(){return!1}},$n=class extends z{render(e,t){e.leafNode(`pivotCache`,{cacheId:t.cacheId,"r:id":t.rId})}parseOpen(e){return e.name===`pivotCache`?(this.model={cacheId:e.attributes.cacheId,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},er=class e extends z{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new Zn,bookViews:new V({tag:`bookViews`,count:!1,childXform:new Xn}),sheets:new V({tag:`sheets`,count:!1,childXform:new Yn}),definedNames:new V({tag:`definedNames`,count:!1,childXform:new Un}),calcPr:new Qn,pivotCaches:new V({tag:`pivotCaches`,count:!1,childXform:new $n})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${i[0]}:$${i[1]}`],localSheetId:n};t.push(a)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media||[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(I.StdDocAttributes),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties),this.map.pivotCaches.render(t,n.pivotTables),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let n=(e.workbookRels||[]).reduce((e,t)=>(e[t.Id]=t,e),{}),r=[],i,a=0;(e.sheets||[]).forEach(t=>{let o=n[t.rId];o&&(i=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],i&&(i.name=t.name,i.id=t.id,i.state=t.state,r[a++]=i))});let o=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(i=r[e.localSheetId],i){i.pageSetup||={};let n=t.decodeEx(e.ranges[0]);i.pageSetup.printArea=i.pageSetup.printArea?`${i.pageSetup.printArea}&&${n.dimensions}`:n.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(i=r[e.localSheetId],i){i.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,r=t.match(/\$\d+:\$\d+/);if(r&&r.length){let e=r[0];i.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];i.pageSetup.printTitlesColumn=e.replace(n,``)}}}else o.push(e)}),e.definedNames=o,e.media.forEach((e,t)=>{e.index=t})}static{this.WORKBOOK_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x15`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`}}static{this.STATIC_XFORMS={fileVersion:new B({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};const q={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`};var tr=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{let t=`${e.master}:${e.address}`;this.merges[e.master]=new n(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,n){e.forEach(e=>{let r=t.decode(e);for(let e=r.top;e<=r.bottom;e++){let i=n[e-1];for(let n=r.left;n<=r.right;n++){let a=i.cells[n-1];a?a.type===l.ValueType.Merge&&(a.master=r.tl):i.cells[n]={type:l.ValueType.Null,address:t.encodeAddress(e,n)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function nr(e){if(e==null)return l.ValueType.Null;if(e instanceof String||typeof e==`string`)return l.ValueType.String;if(typeof e==`number`)return l.ValueType.Number;if(typeof e==`boolean`)return l.ValueType.Boolean;if(e instanceof Date)return l.ValueType.Date;if(e.text&&e.hyperlink)return l.ValueType.Hyperlink;if(e.formula)return l.ValueType.Formula;if(e.error)return l.ValueType.Error;throw Error(`I could not understand type of value`)}function rr(e){switch(e.type){case l.ValueType.Formula:return nr(e.result);default:return e.type}}var ir=class extends z{constructor(){super(),this.richTextXform=new Pn}get tag(){return`c`}prepare(e,t){let r=t.styles.addStyleModel(e.style||{},rr(e));switch(r&&(e.styleId=r),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case l.ValueType.String:case l.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case l.ValueType.Date:t.date1904&&(e.date1904=!0);break;case l.ValueType.Hyperlink:t.sharedStrings&&e.text!==void 0&&e.text!==null&&(e.ssId=t.sharedStrings.add(e.text)),t.hyperlinks.push({address:e.address,target:e.hyperlink,tooltip:e.tooltip});break;case l.ValueType.Merge:t.merges.add(e);break;case l.ValueType.Formula:if(t.date1904&&(e.date1904=!0),e.shareType===`shared`&&(e.si=t.siFormulae++),e.formula)t.formulae[e.address]=e;else if(e.sharedFormula){let r=t.formulae[e.sharedFormula];if(!r)throw Error(`Shared Formula master must exist above and or left of clone for cell ${e.address}`);r.si===void 0?(r.shareType=`shared`,r.si=t.siFormulae++,r.range=new n(r.address,e.address)):r.range&&r.range.expandToAddress(e.address),e.si=r.si}break;default:break}}renderFormula(e,t){let n=null;switch(t.shareType){case`shared`:n={t:`shared`,ref:t.ref||t.range.range,si:t.si};break;case`array`:n={t:`array`,ref:t.ref};break;default:t.si!==void 0&&(n={t:`shared`,si:t.si});break}switch(nr(t.result)){case l.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case l.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case l.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case l.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case l.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case l.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,Se(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===l.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case l.ValueType.Null:break;case l.ValueType.Number:e.leafNode(`v`,null,t.value);break;case l.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case l.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case l.ValueType.String:case l.ValueType.RichText:t.ssId===void 0?t.value&&t.value.richText?(e.addAttribute(`t`,`inlineStr`),e.openNode(`is`),t.value.richText.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(`is`)):(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.value)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case l.ValueType.Date:e.leafNode(`v`,null,Se(t.value,t.date1904));break;case l.ValueType.Hyperlink:t.ssId===void 0?(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.text)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case l.ValueType.Formula:this.renderFormula(e,t);break;case l.ValueType.Merge:break;default:break}e.closeNode()}}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`c`:return this.model={address:e.attributes.r},this.t=e.attributes.t,e.attributes.s&&(this.model.styleId=parseInt(e.attributes.s,10)),!0;case`f`:return this.currentNode=`f`,this.model.si=e.attributes.si,this.model.shareType=e.attributes.t,this.model.ref=e.attributes.ref,!0;case`v`:return this.currentNode=`v`,!0;case`t`:return this.currentNode=`t`,!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){if(this.parser){this.parser.parseText(e);return}switch(this.currentNode){case`f`:this.model.formula=this.model.formula?this.model.formula+e:e;break;case`v`:case`t`:this.model.value&&this.model.value.richText?this.model.value.richText.text=this.model.value.richText.text?this.model.value.richText.text+e:e:this.model.value=this.model.value?this.model.value+e:e;break;default:break}}parseClose(e){switch(e){case`c`:{let{model:e}=this;if(e.formula||e.shareType)e.type=l.ValueType.Formula,e.value&&=(this.t===`str`?e.result=Te(e.value):this.t===`b`?e.result=parseInt(e.value,10)!==0:this.t===`e`?e.result={error:e.value}:e.result=parseFloat(e.value),void 0);else if(e.value!==void 0)switch(this.t){case`s`:e.type=l.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=l.ValueType.String,e.value=Te(e.value);break;case`inlineStr`:e.type=l.ValueType.String;break;case`b`:e.type=l.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=l.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=l.ValueType.Date,e.value=new Date(e.value);break;default:e.type=l.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=l.ValueType.Null:e.type=l.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText||[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case l.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=l.ValueType.RichText);break;case l.ValueType.Number:n&&De(n.numFmt)&&(e.type=l.ValueType.Date,e.value=Ce(e.value,t.date1904));break;case l.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&De(n.numFmt)&&(e.result=Ce(e.result,t.date1904)),e.shareType===`shared`&&(e.ref?t.formulae[e.si]=e.address:(e.sharedFormula=t.formulae[e.si],delete e.shareType),delete e.si);break;default:break}let r=t.hyperlinkMap[e.address];r&&(e.type===l.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=l.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},ar=class extends z{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new ir}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height&&(e.addAttribute(`ht`,t.height),e.addAttribute(`customHeight`,`1`)),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),e.addAttribute(`x14ac:dyDescent`,`0.25`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),N(e.attributes.hidden)&&(n.hidden=!0),N(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),N(e.attributes.collapsed)&&(n.collapsed=!0),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=t.decodeAddress(e.address).col:(this.lastCellCol+=1,e.address=t.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId?t.styles.getStyleModel(e.styleId):{},e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},or=class extends z{get tag(){return`col`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{});n&&(e.styleId=n)}render(e,t){e.openNode(`col`),e.addAttribute(`min`,t.min),e.addAttribute(`max`,t.max),t.width&&e.addAttribute(`width`,t.width),t.styleId&&e.addAttribute(`style`,t.styleId),t.hidden&&e.addAttribute(`hidden`,`1`),t.bestFit&&e.addAttribute(`bestFit`,`1`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`),e.addAttribute(`customWidth`,`1`),e.closeNode()}parseOpen(e){if(e.name===`col`){let t=this.model={min:parseInt(e.attributes.min||`0`,10),max:parseInt(e.attributes.max||`0`,10),width:e.attributes.width===void 0?void 0:parseFloat(e.attributes.width||`0`)};return e.attributes.style&&(t.styleId=parseInt(e.attributes.style,10)),N(e.attributes.hidden)&&(t.hidden=!0),N(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),N(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId&&(e.style=t.styles.getStyleModel(e.styleId))}},sr=class extends z{get tag(){return`dimension`}render(e,t){t&&e.leafNode(`dimension`,{ref:t})}parseOpen(e){return e.name===`dimension`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},cr=class extends z{get tag(){return`hyperlink`}render(e,t){this.isInternalLink(t)?e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip,location:t.target}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){return e.name===`hyperlink`?(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location&&(this.model.target=e.attributes.location),!0):!1}parseText(){}parseClose(){return!1}isInternalLink(e){return!!(e.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(e.target))}},lr=class extends z{get tag(){return`mergeCell`}render(e,t){e.leafNode(`mergeCell`,{ref:t})}parseOpen(e){return e.name===`mergeCell`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}};function ur(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function dr(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=N(i)}function fr(e){if(!e)return[];let n=[],r={};for(let[t,i]of Object.entries(e))if(i!=null)if(t.startsWith(`range:`)){let e=t.slice(6),{sqref:r,...a}=i;n.push({...a,sqref:e})}else r[t]=i;if(Object.keys(r).length===0)return n;let i=Object.entries(r).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),a=Object.fromEntries(i.map(e=>[e.address,e])),o=(e,n,i)=>{for(let a=0;a<n;a++){let n=t.encodeAddress(e.row+a,i);if(!r[n]||!f(r[e.address],r[n]))return!1}return!0},s=i.map(e=>{if(!e.marked){let n=t.decodeEx(e.address);if(n.dimensions)return a[n.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let i=1,s=t.encodeAddress(n.row+i,n.col);for(;r[s]&&f(e.dataValidation,r[s]);)i++,s=t.encodeAddress(n.row+i,n.col);let c=1;for(;o(n,i,n.col+c);)c++;for(let e=0;e<i;e++)for(let r=0;r<c;r++)s=t.encodeAddress(n.row+e,n.col+r),a[s].marked=!0;if(i>1||c>1){let r=n.row+(i-1),a=n.col+(c-1);return{...e.dataValidation,sqref:`${e.address}:${t.encodeAddress(r,a)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...n,...s]}var pr=class extends z{get tag(){return`dataValidations`}render(e,t){let n=fr(t);n.length&&(e.openNode(`dataValidations`,{count:n.length}),n.forEach(t=>{e.openNode(`dataValidation`),t.type!==`any`&&(e.addAttribute(`type`,t.type),t.operator&&t.type!==`list`&&t.operator!==`between`&&e.addAttribute(`operator`,t.operator),t.allowBlank&&e.addAttribute(`allowBlank`,`1`)),t.showInputMessage&&e.addAttribute(`showInputMessage`,`1`),t.promptTitle&&e.addAttribute(`promptTitle`,t.promptTitle),t.prompt&&e.addAttribute(`prompt`,t.prompt),t.showErrorMessage&&e.addAttribute(`showErrorMessage`,`1`),t.errorStyle&&e.addAttribute(`errorStyle`,t.errorStyle),t.errorTitle&&e.addAttribute(`errorTitle`,t.errorTitle),t.error&&e.addAttribute(`error`,t.error),e.addAttribute(`sqref`,t.sqref),(t.formulae||[]).forEach((n,r)=>{e.openNode(`formula${r+1}`),t.type===`date`?e.writeText(Se(new Date(n))):e.writeText(n),e.closeNode()}),e.closeNode()}),e.closeNode())}parseOpen(e){switch(e.name){case`dataValidations`:return this.model={},!0;case`dataValidation`:{this._address=e.attributes.sqref;let t={type:e.attributes.type||`any`,formulae:[]};switch(e.attributes.type&&dr(t,e.attributes,`allowBlank`),dr(t,e.attributes,`showInputMessage`),dr(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:ur(t,e.attributes,`operator`,`between`);break}return ur(t,e.attributes,`promptTitle`),ur(t,e.attributes,`prompt`),ur(t,e.attributes,`errorStyle`),ur(t,e.attributes,`errorTitle`),ur(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),(this._address.split(/\s+/g)||[]).forEach(e=>{if(e.includes(`:`)){let t=new n(e);(t.bottom-t.top+1)*(t.right-t.left+1)<=1e3?t.forEachAddress(e=>{this.model[e]=this._dataValidation}):this.model[`range:${e}`]=this._dataValidation}else this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=Ce(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},mr=class extends z{get tag(){return`pageSetUpPr`}render(e,t){return t&&t.fitToPage?(e.leafNode(this.tag,{fitToPage:t.fitToPage?`1`:void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={fitToPage:e.attributes.fitToPage===`1`},!0):!1}parseText(){}parseClose(){return!1}};const hr=e=>e!==void 0;var gr=class extends z{get tag(){return`outlinePr`}render(e,t){return t&&(hr(t.summaryBelow)||hr(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:hr(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:hr(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:hr(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:hr(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},_r=class extends z{constructor(){super(),this.map={tabColor:new H(`tabColor`),pageSetUpPr:new mr,outlinePr:new gr}}get tag(){return`sheetPr`}render(e,t){if(t){e.addRollback(),e.openNode(`sheetPr`);let n=!1;n=this.map.tabColor.render(e,t.tabColor)||n,n=this.map.pageSetUpPr.render(e,t.pageSetup)||n,n=this.map.outlinePr.render(e,t.outlineProperties)||n,n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):this.map[e.name]?(this.parser=this.map[e.name],this.parser.parseOpen(e),!0):!1}parseText(e){return this.parser?(this.parser.parseText(e),!0):!1}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}},vr=class extends z{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow,outlineLevelCol:t.outlineLevelCol,"x14ac:dyDescent":t.dyDescent};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),(!t.defaultRowHeight||t.defaultRowHeight!==15)&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight||`0`),dyDescent:parseFloat(e.attributes[`x14ac:dyDescent`]||`0`),outlineLevelRow:parseInt(e.attributes.outlineLevelRow||`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol||`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),!0):!1}parseText(){}parseClose(){return!1}};const yr={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var br=class extends z{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,n){e.openNode(`sheetView`,{workbookViewId:n.workbookViewId||0});let r=function(t,n,r){r&&e.addAttribute(t,n)};r(`rightToLeft`,`1`,n.rightToLeft===!0),r(`tabSelected`,`1`,n.tabSelected),r(`showRuler`,`0`,n.showRuler===!1),r(`showRowColHeaders`,`0`,n.showRowColHeaders===!1),r(`showGridLines`,`0`,n.showGridLines===!1),r(`zoomScale`,n.zoomScale,n.zoomScale),r(`zoomScaleNormal`,n.zoomScaleNormal,n.zoomScaleNormal),r(`view`,n.style,n.style);let i,a,o,s;switch(n.state){case`frozen`:a=n.xSplit||0,o=n.ySplit||0,i=n.topLeftCell||t.getAddress(o+1,a+1).address,s=n.xSplit&&n.ySplit&&`bottomRight`||n.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:n.xSplit||void 0,ySplit:n.ySplit||void 0,topLeftCell:i,activePane:s,state:`frozen`}),e.leafNode(`selection`,{pane:s,activeCell:n.activeCell,sqref:n.activeCell});break;case`split`:n.activePane===`topLeft`&&(n.activePane=void 0),e.leafNode(`pane`,{xSplit:n.xSplit||void 0,ySplit:n.ySplit||void 0,topLeftCell:n.topLeftCell,activePane:n.activePane}),e.leafNode(`selection`,{pane:n.activePane,activeCell:n.activeCell,sqref:n.activeCell});break;case`normal`:n.activeCell&&e.leafNode(`selection`,{activeCell:n.activeCell,sqref:n.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale||`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal||`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit||`0`,10),ySplit:parseInt(e.attributes.ySplit||`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane||`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane||`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:yr[this.pane.state]||`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function J(e,t){return e?t:void 0}function Y(e,t){return e===t?!0:void 0}var xr=class extends z{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:J(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:J(t.formatCells,`0`),formatColumns:J(t.formatColumns,`0`),formatRows:J(t.formatRows,`0`),insertColumns:J(t.insertColumns,`0`),insertRows:J(t.insertRows,`0`),insertHyperlinks:J(t.insertHyperlinks,`0`),deleteColumns:J(t.deleteColumns,`0`),deleteRows:J(t.deleteRows,`0`),sort:J(t.sort,`0`),autoFilter:J(t.autoFilter,`0`),pivotTables:J(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=J(t.objects===!1,`1`),n.scenarios=J(t.scenarios===!1,`1`)),Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={sheet:Y(e.attributes.sheet,`1`),objects:e.attributes.objects===`1`?!1:void 0,scenarios:e.attributes.scenarios===`1`?!1:void 0,selectLockedCells:e.attributes.selectLockedCells===`1`?!1:void 0,selectUnlockedCells:e.attributes.selectUnlockedCells===`1`?!1:void 0,formatCells:Y(e.attributes.formatCells,`0`),formatColumns:Y(e.attributes.formatColumns,`0`),formatRows:Y(e.attributes.formatRows,`0`),insertColumns:Y(e.attributes.insertColumns,`0`),insertRows:Y(e.attributes.insertRows,`0`),insertHyperlinks:Y(e.attributes.insertHyperlinks,`0`),deleteColumns:Y(e.attributes.deleteColumns,`0`),deleteRows:Y(e.attributes.deleteRows,`0`),sort:Y(e.attributes.sort,`0`),autoFilter:Y(e.attributes.autoFilter,`0`),pivotTables:Y(e.attributes.pivotTables,`0`)},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0;default:return!1}}parseText(){}parseClose(){return!1}},Sr=class extends z{get tag(){return`pageMargins`}render(e,t){if(t){let n={left:t.left,right:t.right,top:t.top,bottom:t.bottom,header:t.header,footer:t.footer};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={left:parseFloat(e.attributes.left||.7),right:parseFloat(e.attributes.right||.7),top:parseFloat(e.attributes.top||.75),bottom:parseFloat(e.attributes.bottom||.75),header:parseFloat(e.attributes.header||.3),footer:parseFloat(e.attributes.footer||.3)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Cr(e){return e?`1`:void 0}function wr(e){switch(e){case`overThenDown`:return e;default:return}}function Tr(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function Er(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Dr(e){return e===void 0?void 0:parseInt(e,10)}var Or=class extends z{get tag(){return`pageSetup`}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:t.horizontalDpi,verticalDpi:t.verticalDpi,pageOrder:wr(t.pageOrder),blackAndWhite:Cr(t.blackAndWhite),draft:Cr(t.draft),cellComments:Tr(t.cellComments),errors:Er(t.errors),scale:t.scale,fitToWidth:t.fitToWidth,fitToHeight:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Cr(!!t.firstPageNumber),usePrinterDefaults:Cr(t.usePrinterDefaults),copies:t.copies};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={paperSize:Dr(e.attributes.paperSize),orientation:e.attributes.orientation||`portrait`,horizontalDpi:parseInt(e.attributes.horizontalDpi||`4294967295`,10),verticalDpi:parseInt(e.attributes.verticalDpi||`4294967295`,10),pageOrder:e.attributes.pageOrder||`downThenOver`,blackAndWhite:e.attributes.blackAndWhite===`1`,draft:e.attributes.draft===`1`,cellComments:e.attributes.cellComments||`None`,errors:e.attributes.errors||`displayed`,scale:parseInt(e.attributes.scale||`100`,10),fitToWidth:parseInt(e.attributes.fitToWidth||`1`,10),fitToHeight:parseInt(e.attributes.fitToHeight||`1`,10),firstPageNumber:parseInt(e.attributes.firstPageNumber||`1`,10),useFirstPageNumber:e.attributes.useFirstPageNumber===`1`,usePrinterDefaults:e.attributes.usePrinterDefaults===`1`,copies:parseInt(e.attributes.copies||`1`,10)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function kr(e){return e?`1`:void 0}var Ar=class extends z{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:kr(t.showRowColHeaders),gridLines:kr(t.showGridLines),horizontalCentered:kr(t.horizontalCentered),verticalCentered:kr(t.verticalCentered)};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={showRowColHeaders:e.attributes.headings===`1`,showGridLines:e.attributes.gridLines===`1`,horizontalCentered:e.attributes.horizontalCentered===`1`,verticalCentered:e.attributes.verticalCentered===`1`},!0;default:return!1}}parseText(){}parseClose(){return!1}},jr=class extends z{get tag(){return`autoFilter`}render(e,n){if(n)if(typeof n==`string`)e.leafNode(`autoFilter`,{ref:n});else{let r=function(e){return typeof e==`string`?e:t.getAddress(e.row,e.column).address},i=r(n.from),a=r(n.to);i&&a&&e.leafNode(`autoFilter`,{ref:`${i}:${a}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},Mr=class extends z{get tag(){return`picture`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Nr=class extends z{get tag(){return`drawing`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Pr=class extends z{get tag(){return`tablePart`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Fr=class extends z{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){if(e.name===`brk`){let{id:t,max:n,man:r,min:i}=e.attributes;return this.model={id:+t,max:+n,man:+r},i!==void 0&&(this.model.min=+i),!0}return!1}parseText(){}parseClose(){return!1}},Ir=class extends V{constructor(){super({tag:`rowBreaks`,count:!0,childXform:new Fr})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Lr=class extends V{constructor(){super({tag:`colBreaks`,count:!0,childXform:new Fr})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Rr=class extends z{get tag(){return`headerFooter`}render(e,t){if(t){e.addRollback();let n=!1;e.openNode(`headerFooter`),t.differentFirst&&(e.addAttribute(`differentFirst`,`1`),n=!0),t.differentOddEven&&(e.addAttribute(`differentOddEven`,`1`),n=!0),t.oddHeader&&typeof t.oddHeader==`string`&&(e.leafNode(`oddHeader`,null,t.oddHeader),n=!0),t.oddFooter&&typeof t.oddFooter==`string`&&(e.leafNode(`oddFooter`,null,t.oddFooter),n=!0),t.evenHeader&&typeof t.evenHeader==`string`&&(e.leafNode(`evenHeader`,null,t.evenHeader),n=!0),t.evenFooter&&typeof t.evenFooter==`string`&&(e.leafNode(`evenFooter`,null,t.evenFooter),n=!0),t.firstHeader&&typeof t.firstHeader==`string`&&(e.leafNode(`firstHeader`,null,t.firstHeader),n=!0),t.firstFooter&&typeof t.firstFooter==`string`&&(e.leafNode(`firstFooter`,null,t.firstFooter),n=!0),n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){switch(e.name){case`headerFooter`:return this.model={},e.attributes.differentFirst&&(this.model.differentFirst=parseInt(e.attributes.differentFirst,0)===1),e.attributes.differentOddEven&&(this.model.differentOddEven=parseInt(e.attributes.differentOddEven,0)===1),!0;case`oddHeader`:return this.currentNode=`oddHeader`,!0;case`oddFooter`:return this.currentNode=`oddFooter`,!0;case`evenHeader`:return this.currentNode=`evenHeader`,!0;case`evenFooter`:return this.currentNode=`evenFooter`,!0;case`firstHeader`:return this.currentNode=`firstHeader`,!0;case`firstFooter`:return this.currentNode=`firstFooter`,!0;default:return!1}}parseText(e){switch(this.currentNode){case`oddHeader`:this.model.oddHeader=(this.model.oddHeader||``)+e;break;case`oddFooter`:this.model.oddFooter=(this.model.oddFooter||``)+e;break;case`evenHeader`:this.model.evenHeader=(this.model.evenHeader||``)+e;break;case`evenFooter`:this.model.evenFooter=(this.model.evenFooter||``)+e;break;case`firstHeader`:this.model.firstHeader=(this.model.firstHeader||``)+e;break;case`firstFooter`:this.model.firstFooter=(this.model.firstFooter||``)+e;break;default:break}}parseClose(){switch(this.currentNode){case`oddHeader`:case`oddFooter`:case`evenHeader`:case`evenFooter`:case`firstHeader`:case`firstFooter`:return this.currentNode=void 0,!0;default:return!1}}},X=class extends z{createNewModel(e){return{}}parseOpen(e){return this.parser=this.parser||this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=this.createNewModel(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}onParserClose(e,t){this.model[e]=t.model}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.onParserClose(e,this.parser),this.parser=void 0),!0):e!==this.tag}get tag(){return``}},zr=class extends z{get tag(){return`cfvo`}render(e,t){e.leafNode(this.tag,{type:t.type,val:t.value})}parseOpen(e){this.model={type:e.attributes.type,value:z.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},Br=class extends X{constructor(){super(),this.map={cfvo:this.cfvoXform=new zr,color:this.colorXform=new H}}get tag(){return`dataBar`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.colorXform.render(e,t.color),e.closeNode()}createNewModel(){return{cfvo:[]}}onParserClose(e,t){switch(e){case`cfvo`:this.model.cfvo.push(t.model);break;case`color`:this.model.color=t.model;break}}},Vr=class extends z{get tag(){return`x14:id`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Hr=class extends X{constructor(){super(),this.map={"x14:id":this.idXform=new Vr}}get tag(){return`ext`}render(e,t){e.openNode(this.tag,{uri:`{B025F937-C7B1-47D3-B67F-A62EFF666E3E}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.idXform.render(e,t.x14Id),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model.x14Id=t.model}},Ur=class extends X{constructor(){super(),this.map={ext:new Hr}}get tag(){return`extLst`}render(e,t){e.openNode(this.tag),this.map.ext.render(e,t),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){Object.assign(this.model,t.model)}},Wr=class extends z{get tag(){return`formula`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Gr=class extends X{constructor(){super(),this.map={cfvo:this.cfvoXform=new zr,color:this.colorXform=new H}}get tag(){return`colorScale`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.color.forEach(t=>{this.colorXform.render(e,t)}),e.closeNode()}createNewModel(e){return{cfvo:[],color:[]}}onParserClose(e,t){this.model[e].push(t.model)}},Kr=class extends X{constructor(){super(),this.map={cfvo:this.cfvoXform=new zr}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:z.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:z.toBoolAttribute(t.reverse,!1),showValue:z.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:z.toStringValue(e.iconSet,`3TrafficLights`),reverse:z.toBoolValue(e.reverse),showValue:z.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};const qr={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},Jr=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new n(e.ref);switch(e.operator){case`containsText`:return`NOT(ISERROR(SEARCH("${e.text}",${t})))`;case`containsBlanks`:return`LEN(TRIM(${t}))=0`;case`notContainsBlanks`:return`LEN(TRIM(${t}))>0`;case`containsErrors`:return`ISERROR(${t})`;case`notContainsErrors`:return`NOT(ISERROR(${t}))`;default:return}},Yr=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new n(e.ref);switch(e.timePeriod){case`thisWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(${t},0)-TODAY()<=7-WEEKDAY(TODAY()))`;case`lastWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(${t},0)<(WEEKDAY(TODAY())+7))`;case`nextWeek`:return`AND(ROUNDDOWN(${t},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(${t},0)-TODAY()<(15-WEEKDAY(TODAY())))`;case`yesterday`:return`FLOOR(${t},1)=TODAY()-1`;case`today`:return`FLOOR(${t},1)=TODAY()`;case`tomorrow`:return`FLOOR(${t},1)=TODAY()+1`;case`last7Days`:return`AND(TODAY()-FLOOR(${t},1)<=6,FLOOR(${t},1)<=TODAY())`;case`lastMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0-1)),YEAR(${t})=YEAR(EDATE(TODAY(),0-1)))`;case`thisMonth`:return`AND(MONTH(${t})=MONTH(TODAY()),YEAR(${t})=YEAR(TODAY()))`;case`nextMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0+1)),YEAR(${t})=YEAR(EDATE(TODAY(),0+1)))`;default:return}},Xr=e=>{let{type:t,operator:n}=e;switch(t){case`containsText`:case`containsBlanks`:case`notContainsBlanks`:case`containsErrors`:case`notContainsErrors`:return{type:`containsText`,operator:t};default:return{type:t,operator:n}}};var Zr=class e extends X{constructor(){super(),this.map={dataBar:this.databarXform=new Br,extLst:this.extLstRefXform=new Ur,formula:this.formulaXform=new Wr,colorScale:this.colorScaleXform=new Gr,iconSet:this.iconSetXform=new Kr}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||qr[e.iconSet]))}render(e,t){switch(t.type){case`expression`:this.renderExpression(e,t);break;case`cellIs`:this.renderCellIs(e,t);break;case`top10`:this.renderTop10(e,t);break;case`aboveAverage`:this.renderAboveAverage(e,t);break;case`dataBar`:this.renderDataBar(e,t);break;case`colorScale`:this.renderColorScale(e,t);break;case`iconSet`:this.renderIconSet(e,t);break;case`containsText`:this.renderText(e,t);break;case`timePeriod`:this.renderTimePeriod(e,t);break}}renderExpression(e,t){e.openNode(this.tag,{type:`expression`,dxfId:t.dxfId,priority:t.priority}),this.formulaXform.render(e,t.formulae[0]),e.closeNode()}renderCellIs(e,t){e.openNode(this.tag,{type:`cellIs`,dxfId:t.dxfId,priority:t.priority,operator:t.operator}),t.formulae.forEach(t=>{this.formulaXform.render(e,t)}),e.closeNode()}renderTop10(e,t){e.leafNode(this.tag,{type:`top10`,dxfId:t.dxfId,priority:t.priority,percent:z.toBoolAttribute(t.percent,!1),bottom:z.toBoolAttribute(t.bottom,!1),rank:z.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:z.toBoolAttribute(t.aboveAverage,!0)})}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,priority:t.priority}),this.databarXform.render(e,t),this.extLstRefXform.render(e,t),e.closeNode()}renderColorScale(e,t){e.openNode(this.tag,{type:`colorScale`,priority:t.priority}),this.colorScaleXform.render(e,t),e.closeNode()}renderIconSet(t,n){e.isPrimitive(n)&&(t.openNode(this.tag,{type:`iconSet`,priority:n.priority}),this.iconSetXform.render(t,n),t.closeNode())}renderText(e,t){e.openNode(this.tag,{type:t.operator,dxfId:t.dxfId,priority:t.priority,operator:z.toStringAttribute(t.operator,`containsText`)});let n=Jr(t);n&&this.formulaXform.render(e,n),e.closeNode()}renderTimePeriod(e,t){e.openNode(this.tag,{type:`timePeriod`,dxfId:t.dxfId,priority:t.priority,timePeriod:t.timePeriod});let n=Yr(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...Xr(e),dxfId:z.toIntValue(e.dxfId),priority:z.toIntValue(e.priority),timePeriod:e.timePeriod,percent:z.toBoolValue(e.percent),bottom:z.toBoolValue(e.bottom),rank:z.toIntValue(e.rank),aboveAverage:z.toBoolValue(e.aboveAverage)}}onParserClose(e,t){switch(e){case`dataBar`:case`extLst`:case`colorScale`:case`iconSet`:Object.assign(this.model,t.model);break;case`formula`:this.model.formulae=this.model.formulae||[],this.model.formulae.push(t.model);break}}},Qr=class extends X{constructor(){super(),this.map={cfRule:new Zr}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(Zr.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{Zr.isPrimitive(n)&&(n.ref=t.ref,this.map.cfRule.render(e,n))}),e.closeNode())}createNewModel({attributes:e}){return{ref:e.sqref,rules:[]}}onParserClose(e,t){this.model.rules.push(t.model)}},$r=class extends z{constructor(){super(),this.cfXform=new Qr}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority||0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style))})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},ei=class extends z{get tag(){return`xm:f`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},ti=class extends X{constructor(){super(),this.map={"xm:f":this.fExtXform=new ei}}get tag(){return`x14:cfvo`}render(e,t){e.openNode(this.tag,{type:t.type}),t.value!==void 0&&this.fExtXform.render(e,t.value),e.closeNode()}createNewModel(e){return{type:e.attributes.type}}onParserClose(e,t){switch(e){case`xm:f`:this.model.value=t.model?parseFloat(t.model):0;break}}},ni=class extends X{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ti,"x14:borderColor":this.borderColorXform=new H(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new H(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new H(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new H(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:z.toIntAttribute(t.minLength,0,!0),maxLength:z.toIntAttribute(t.maxLength,100,!0),border:z.toBoolAttribute(t.border,!1),gradient:z.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:z.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:z.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:z.toAttribute(t.axisPosition,`auto`),direction:z.toAttribute(t.direction,`leftToRight`)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.borderColorXform.render(e,t.borderColor),this.negativeBorderColorXform.render(e,t.negativeBorderColor),this.negativeFillColorXform.render(e,t.negativeFillColor),this.axisColorXform.render(e,t.axisColor),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],minLength:z.toIntValue(e.minLength,0),maxLength:z.toIntValue(e.maxLength,100),border:z.toBoolValue(e.border,!1),gradient:z.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:z.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:z.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:z.toStringValue(e.axisPosition,`auto`),direction:z.toStringValue(e.direction,`leftToRight`)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;default:this.model[n]=t.model;break}}},ri=class extends z{get tag(){return`x14:cfIcon`}render(e,t){e.leafNode(this.tag,{iconSet:t.iconSet,iconId:t.iconId})}parseOpen({attributes:e}){this.model={iconSet:e.iconSet,iconId:z.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},ii=class extends X{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ti,"x14:cfIcon":this.cfIconXform=new ri}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:z.toStringAttribute(t.iconSet),reverse:z.toBoolAttribute(t.reverse,!1),showValue:z.toBoolAttribute(t.showValue,!0),custom:z.toBoolAttribute(t.icons,!1)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.icons&&t.icons.forEach((t,n)=>{t.iconId=n,this.cfIconXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],iconSet:z.toStringValue(e.iconSet,`3TrafficLights`),reverse:z.toBoolValue(e.reverse,!1),showValue:z.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};const ai={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var oi=class e extends X{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new ni,"x14:iconSet":this.iconSetXform=new ii}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?ni.isExt(e):!!(e.type===`iconSet`&&(e.custom||ai[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${crypto.randomUUID()}}`.toUpperCase())}render(t,n){if(e.isExt(n))switch(n.type){case`dataBar`:this.renderDataBar(t,n);break;case`iconSet`:this.renderIconSet(t,n);break}}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,id:t.x14Id}),this.databarXform.render(e,t),e.closeNode()}renderIconSet(e,t){e.openNode(this.tag,{type:`iconSet`,priority:t.priority,id:t.x14Id||`{${crypto.randomUUID()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:z.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},si=class extends z{get tag(){return`xm:sqref`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},ci=class extends X{constructor(){super(),this.map={"xm:sqref":this.sqRef=new si,"x14:cfRule":this.cfRule=new oi}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(oi.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(oi.isExt).forEach(t=>this.cfRule.render(e,t)),this.sqRef.render(e,t.ref),e.closeNode())}createNewModel(){return{rules:[]}}onParserClose(e,t){switch(e){case`xm:sqref`:this.model.ref=t.model;break;case`x14:cfRule`:this.model.rules.push(t.model);break}}},li=class extends X{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new ci}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(oi.isExt))),e.hasExtContent}prepare(e){e.forEach(e=>{this.cfXform.prepare(e)})}render(e,t){this.hasContent(t)&&(e.openNode(this.tag),t.forEach(t=>this.cfXform.render(e,t)),e.closeNode())}createNewModel(){return[]}onParserClose(e,t){this.model.push(t.model)}},ui=class extends X{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new li}}get tag(){return`ext`}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e){this.conditionalFormattings.prepare(e.conditionalFormattings)}render(e,t){e.openNode(`ext`,{uri:`{78C0D931-6437-407d-A8EE-F0AAD7539E65}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.conditionalFormattings.render(e,t.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}},di=class extends X{constructor(){super(),this.map={ext:this.ext=new ui}}get tag(){return`extLst`}prepare(e,t){this.ext.prepare(e)}hasContent(e){return this.ext.hasContent(e)}render(e,t){this.hasContent(t)&&(e.openNode(`extLst`),this.ext.render(e,t),e.closeNode())}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}};const fi=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},pi=(e,t)=>{if(!t||!t.length)return e;if(!e||!e.length)return t;let n={},r={};return e.forEach(e=>{n[e.ref]=e,e.rules.forEach(e=>{let{x14Id:t}=e;t&&(r[t]=e)})}),t.forEach(t=>{t.rules.forEach(i=>{let a=r[i.x14Id];a?fi(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var mi=class e extends z{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r||[],this.map={sheetPr:new _r,dimension:new sr,sheetViews:new V({tag:`sheetViews`,count:!1,childXform:new br}),sheetFormatPr:new vr,cols:new V({tag:`cols`,count:!1,childXform:new or}),sheetData:new V({tag:`sheetData`,count:!1,empty:!0,childXform:new ar({maxItems:n}),maxItems:t}),autoFilter:new jr,mergeCells:new V({tag:`mergeCells`,count:!0,childXform:new lr}),rowBreaks:new Ir,colBreaks:new Lr,hyperlinks:new V({tag:`hyperlinks`,count:!1,childXform:new cr}),pageMargins:new Sr,dataValidations:new pr,pageSetup:new Or,headerFooter:new Rr,printOptions:new Ar,picture:new Mr,drawing:new Nr,sheetProtection:new xr,tableParts:new V({tag:`tableParts`,count:!0,childXform:new Pr}),conditionalFormatting:new $r,extLst:new di}}prepare(e,n){n.merges=new tr,e.hyperlinks=n.hyperlinks=[],e.comments=n.comments=[],n.formulae={},n.siFormulae=0,this.map.cols.prepare(e.cols,n),this.map.sheetData.prepare(e.rows,n),this.map.conditionalFormatting.prepare(e.conditionalFormattings,n),e.mergeCells=n.merges.mergeCells;let r=e.rels=[];function i(e){return`rId${e.length+1}`}if(e.hyperlinks.forEach(e=>{let t=i(r);e.rId=t,r.push({Id:t,Type:q.Hyperlink,Target:e.target,TargetMode:`External`})}),e.comments.length>0){let a={Id:i(r),Type:q.Comments,Target:`../comments${e.id}.xml`};r.push(a);let o={Id:i(r),Type:q.VmlDrawing,Target:`../drawings/vmlDrawing${e.id}.vml`};r.push(o),e.comments.forEach(e=>{e.refAddress=t.decodeAddress(e.ref)}),n.commentRefs.push({commentName:`comments${e.id}`,vmlDrawing:`vmlDrawing${e.id}`})}let a=[],o;e.media.forEach(t=>{if(t.type===`background`){let a=i(r);o=n.media[t.imageId],r.push({Id:a,Type:q.Image,Target:`../media/${o.name}.${o.extension}`}),e.background={rId:a},e.image=n.media[t.imageId]}else if(t.type===`image`){let{drawing:s}=e;o=n.media[t.imageId],s||(s=e.drawing={rId:i(r),name:`drawing${++n.drawingsCount}`,anchors:[],rels:[]},n.drawings.push(s),r.push({Id:s.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:`../drawings/${s.name}.xml`}));let c=this.preImageId===t.imageId?a[t.imageId]:a[s.rels.length];c||(c=i(s.rels),a[s.rels.length]=c,s.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:`../media/${o.name}.${o.extension}`}));let l={picture:{rId:c},range:t.range};if(t.hyperlinks&&t.hyperlinks.hyperlink){let e=i(s.rels);a[s.rels.length]=e,l.picture.hyperlinks={tooltip:t.hyperlinks.tooltip,rId:e},s.rels.push({Id:e,Type:q.Hyperlink,Target:t.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=t.imageId,s.anchors.push(l)}}),e.tables.forEach(e=>{let t=i(r);e.rId=t,r.push({Id:t,Type:q.Table,Target:`../tables/${e.target}`}),e.columns.forEach(e=>{let{style:t}=e;t&&(e.dxfId=n.styles.addDxfStyle(t))})}),(e.pivotTables||[]).forEach(e=>{r.push({Id:i(r),Type:q.PivotTable,Target:`../pivotTables/pivotTable${e.tableNumber}.xml`})}),this.map.extLst.prepare(e,n)}render(t,n){t.openXml(I.StdDocAttributes),t.openNode(`worksheet`,e.WORKSHEET_ATTRIBUTES);let r=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow}:void 0;n.properties&&n.properties.defaultColWidth&&(r.defaultColWidth=n.properties.defaultColWidth);let i={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},a=n.pageSetup&&n.pageSetup.margins,o={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},s=n.sheetProtection;this.map.sheetPr.render(t,i),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,r),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,s),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,o),this.map.pageMargins.render(t,a),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.colBreaks.render(t,n.colBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),n.rels&&n.rels.forEach(e=>{e.Type===q.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=pi(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r,rowBreaks:this.map.rowBreaks.model||[],colBreaks:this.map.colBreaks.model||[]},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships||[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===q.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===q.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings[r.Target].comments;e.comments.forEach((e,t)=>{e.note=Object.assign({},e.note,n[t])})}return n},{});if(t.commentsMap=(e.comments||[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks||[]).reduce((e,t)=>(t.rId&&(e[t.address]=n[t.rId].Target),e),{}),t.formulae={},e.rows=e.rows&&e.rows.filter(Boolean)||[],e.rows.forEach(e=>{e.cells=e.cells&&e.cells.filter(Boolean)||[]}),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){let r=n[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(r){let n=r[1];t.drawings[n].anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}})}}let r=e.background&&n[e.background.rId];if(r){let n=r.Target.split(`/media/`)[1],i=t.mediaIndex&&t.mediaIndex[n];i!==void 0&&e.media.push({type:`background`,imageId:i})}e.tables=(e.tables||[]).map(e=>{let r=n[e.rId];return t.tables[r.Target]}),e.pivotTables=[],(e.relationships||[]).forEach(n=>{if(n.Type===q.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},hi=class extends z{parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={range:{editAs:e.attributes.editAs||`oneCell`}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}reconcilePicture(e,t){if(e&&e.rId){let n=t.rels[e.rId].Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);if(n){let e=n[1],r=t.mediaIndex[e];return t.media[r]}}}},gi=class extends z{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new W({tag:`xdr:col`,zero:!0}),"xdr:colOff":new W({tag:`xdr:colOff`,zero:!0}),"xdr:row":new W({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new W({tag:`xdr:rowOff`,zero:!0})},this.model={nativeCol:0,nativeColOff:0,nativeRow:0,nativeRowOff:0}}render(e,t){e.openNode(this.tag),this.map[`xdr:col`].render(e,t.nativeCol),this.map[`xdr:colOff`].render(e,t.nativeColOff),this.map[`xdr:row`].render(e,t.nativeRow),this.map[`xdr:rowOff`].render(e,t.nativeRowOff),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model={nativeCol:this.map[`xdr:col`].model,nativeColOff:this.map[`xdr:colOff`].model,nativeRow:this.map[`xdr:row`].model,nativeRowOff:this.map[`xdr:rowOff`].model},!1;default:return!0}}},_i=class extends z{constructor(){super(),this.model={rId:``}}get tag(){return`a:blip`}render(e,t){e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:embed":t.rId,cstate:`print`})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:embed`]},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},vi=class extends z{constructor(){super(),this.map={"a:blip":new _i}}get tag(){return`xdr:blipFill`}render(e,t){e.openNode(this.tag),this.map[`a:blip`].render(e,t),e.openNode(`a:stretch`),e.leafNode(`a:fillRect`),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:blip`].model,!1;default:return!0}}},yi=class extends z{constructor(){super(),this.model={}}get tag(){return`a:hlinkClick`}render(e,t){t.hyperlinks&&t.hyperlinks.rId&&e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:id":t.hyperlinks.rId,tooltip:t.hyperlinks.tooltip})}parseOpen(e){switch(e.name){case this.tag:return this.model={hyperlinks:{rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip}},!0;default:return!0}}parseText(){}parseClose(){return!1}},bi=class extends z{get tag(){return`a:extLst`}render(e){e.openNode(this.tag),e.openNode(`a:ext`,{uri:`{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}`}),e.leafNode(`a16:creationId`,{"xmlns:a16":`http://schemas.microsoft.com/office/drawing/2014/main`,id:`{00000000-0008-0000-0000-000002000000}`}),e.closeNode(),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},xi=class extends z{constructor(){super(),this.map={"a:hlinkClick":new yi,"a:extLst":new bi}}get tag(){return`xdr:cNvPr`}render(e,t){e.openNode(this.tag,{id:t.index,name:`Picture ${t.index}`}),this.map[`a:hlinkClick`].render(e,t),this.map[`a:extLst`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:hlinkClick`].model,!1;default:return!0}}},Si=class extends z{get tag(){return`xdr:cNvPicPr`}render(e){e.openNode(this.tag),e.leafNode(`a:picLocks`,{noChangeAspect:`1`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Ci=class extends z{constructor(){super(),this.map={"xdr:cNvPr":new xi,"xdr:cNvPicPr":new Si}}get tag(){return`xdr:nvPicPr`}render(e,t){e.openNode(this.tag),this.map[`xdr:cNvPr`].render(e,t),this.map[`xdr:cNvPicPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`xdr:cNvPr`].model,!1;default:return!0}}};const wi={tag:`xdr:spPr`,c:[{tag:`a:xfrm`,c:[{tag:`a:off`,$:{x:`0`,y:`0`}},{tag:`a:ext`,$:{cx:`0`,cy:`0`}}]},{tag:`a:prstGeom`,$:{prst:`rect`},c:[{tag:`a:avLst`}]}]};var Ti=class extends z{constructor(){super(),this.map={"xdr:nvPicPr":new Ci,"xdr:blipFill":new vi,"xdr:spPr":new B(wi)}}get tag(){return`xdr:pic`}prepare(e,t){e.index=t.index+1}render(e,t){e.openNode(this.tag),this.map[`xdr:nvPicPr`].render(e,t),this.map[`xdr:blipFill`].render(e,t),this.map[`xdr:spPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.mergeModel(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}},Ei=class extends hi{constructor(){super(),this.map={"xdr:from":new gi({tag:`xdr:from`}),"xdr:to":new gi({tag:`xdr:to`}),"xdr:pic":new Ti,"xdr:clientData":new B({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs||`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};const Di=9525;var Oi=class extends z{constructor(e){super(),this.tag=e.tag,this.map={},this.model={width:0,height:0}}render(e,t){e.openNode(this.tag);let n=Math.floor(t.width*Di),r=Math.floor(t.height*Di);e.addAttribute(`cx`,n),e.addAttribute(`cy`,r),e.closeNode()}parseOpen(e){return e.name===this.tag?(this.model={width:parseInt(e.attributes.cx||`0`,10)/Di,height:parseInt(e.attributes.cy||`0`,10)/Di},!0):!1}parseText(e){}parseClose(e){return!1}},ki=class extends hi{constructor(){super(),this.map={"xdr:from":new gi({tag:`xdr:from`}),"xdr:ext":new Oi({tag:`xdr:ext`}),"xdr:pic":new Ti,"xdr:clientData":new B({tag:`xdr:clientData`})}}get tag(){return`xdr:oneCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs||`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:ext`].render(e,t.range.ext),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.ext=this.map[`xdr:ext`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};function Ai(e){return(typeof e.range==`string`?t.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var ji=class e extends z{constructor(){super(),this.map={"xdr:twoCellAnchor":new Ei,"xdr:oneCellAnchor":new ki},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Ai(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(I.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),r.anchors.forEach(e=>{this.map[e.anchorType].render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={anchors:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.anchors.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:xdr":`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,"xmlns:a":`http://schemas.openxmlformats.org/drawingml/2006/main`}}},Mi=class extends z{constructor(){super(),this.model={val:``}}get tag(){return`customFilter`}render(e,t){e.leafNode(this.tag,{val:t.val,operator:t.operator})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val,operator:e.attributes.operator},!0):!1}parseText(){}parseClose(){return!1}},Ni=class extends z{constructor(){super(),this.model={val:``}}get tag(){return`filter`}render(e,t){e.leafNode(this.tag,{val:t.val})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val},!0):!1}parseText(){}parseClose(){return!1}},Pi=class extends z{constructor(){super(),this.map={customFilters:new V({tag:`customFilters`,count:!1,empty:!0,childXform:new Mi}),filters:new V({tag:`filters`,count:!1,empty:!0,childXform:new Ni})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.customFilters=this.map.customFilters.model,!1;default:return!0}}},Fi=class extends z{constructor(){super(),this.map={filterColumn:new Pi},this.model={autoFilterRef:``,columns:[]}}get tag(){return`autoFilter`}prepare(e){e.columns.forEach((e,t)=>{this.map.filterColumn.prepare(e,{index:t})})}render(e,t){e.openNode(this.tag,{ref:t.autoFilterRef}),t.columns.forEach(t=>{this.map.filterColumn.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model={autoFilterRef:e.attributes.ref,columns:[]},!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Ii=class extends z{constructor(){super(),this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}render(e,t){e.leafNode(this.tag,{id:t.id.toString(),name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return!1}parseText(){}parseClose(){return!1}},Li=class extends z{constructor(){super(),this.model={theme:null,showFirstColumn:!1,showLastColumn:!1,showRowStripes:!1,showColumnStripes:!1}}get tag(){return`tableStyleInfo`}render(e,t){e.leafNode(this.tag,{name:t.theme?t.theme:void 0,showFirstColumn:t.showFirstColumn?`1`:`0`,showLastColumn:t.showLastColumn?`1`:`0`,showRowStripes:t.showRowStripes?`1`:`0`,showColumnStripes:t.showColumnStripes?`1`:`0`})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={theme:t.name?t.name:null,showFirstColumn:t.showFirstColumn===`1`,showLastColumn:t.showLastColumn===`1`,showRowStripes:t.showRowStripes===`1`,showColumnStripes:t.showColumnStripes===`1`},!0}return!1}parseText(){}parseClose(){return!1}},Ri=class e extends z{constructor(){super(),this.map={autoFilter:new Fi,tableColumns:new V({tag:`tableColumns`,count:!0,empty:!0,childXform:new Ii}),tableStyleInfo:new Li},this.model={id:0,name:``,tableRef:``,columns:[]}}prepare(e,t){this.map.autoFilter.prepare(e),this.map.tableColumns.prepare(e.columns,t)}get tag(){return`table`}render(t,n){t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,totalsRowShown:n.totalsRow?void 0:`1`,headerRowCount:n.headerRow?`1`:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount===`1`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr xr3`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,"xmlns:xr3":`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`}}},zi=class e extends z{constructor(){super(),this.map={},this.model=null,this.currentRecord=null}prepare(e){}get tag(){return`pivotCacheRecords`}reset(){this.model=null,this.currentRecord=null}render(e,t){t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2);t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(this.renderTableNew(a,i)),t.closeNode()}renderLoaded(t,n){t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:n.count});for(let e of n.records){t.writeXml(`
|
|
13
11
|
<r>`);for(let n of e)t.writeXml(`
|
|
14
12
|
`),t.writeXml(this.renderRecordValue(n));t.writeXml(`
|
|
15
|
-
</r>`)}t.closeNode()}renderRecordValue(e){switch(e.type){case`x`:return`<x v="${e.value}" />`;case`n`:return`<n v="${e.value}" />`;case`s`:return`<s v="${
|
|
13
|
+
</r>`)}t.closeNode()}renderRecordValue(e){switch(e.type){case`x`:return`<x v="${e.value}" />`;case`n`:return`<n v="${e.value}" />`;case`s`:return`<s v="${P(String(e.value))}" />`;case`b`:return`<b v="${e.value?`1`:`0`}" />`;case`m`:return`<m />`;case`d`:return`<d v="${e.value.toISOString()}" />`;case`e`:return`<e v="${e.value}" />`;default:return`<m />`}}renderTableNew(e,t){let n=[];for(let r of e){let e=r.slice(1);n.push(`
|
|
16
14
|
<r>`);for(let r=0;r<e.length;r++)n.push(`
|
|
17
15
|
`),n.push(this.renderCellNew(e[r],t[r].sharedItems));n.push(`
|
|
18
|
-
</r>`)}return n.join(``)}renderCellNew(e,t){if(e==null)return`<m />`;if(t===null)return Number.isFinite(e)?`<n v="${e}" />`:`<s v="${
|
|
16
|
+
</r>`)}return n.join(``)}renderCellNew(e,t){if(e==null)return`<m />`;if(t===null)return Number.isFinite(e)?`<n v="${e}" />`:`<s v="${P(String(e))}" />`;let n=t.indexOf(e);if(n<0)throw Error(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={records:[],count:parseInt(n.count||`0`,10),isLoaded:!0};break;case`r`:this.currentRecord=[];break;case`x`:this.currentRecord&&this.currentRecord.push({type:`x`,value:parseInt(n.v||`0`,10)});break;case`n`:this.currentRecord&&this.currentRecord.push({type:`n`,value:parseFloat(n.v||`0`)});break;case`s`:this.currentRecord&&this.currentRecord.push({type:`s`,value:Te(n.v||``)});break;case`b`:this.currentRecord&&this.currentRecord.push({type:`b`,value:n.v===`1`});break;case`m`:this.currentRecord&&this.currentRecord.push({type:`m`});break;case`d`:this.currentRecord&&this.currentRecord.push({type:`d`,value:new Date(n.v||``)});break;case`e`:this.currentRecord&&this.currentRecord.push({type:`e`,value:n.v||``});break}return!0}parseText(e){}parseClose(e){switch(e){case this.tag:return!1;case`r`:this.model&&this.currentRecord&&(this.model.records.push(this.currentRecord),this.currentRecord=null);break}return!0}reconcile(e,t){}static{this.PIVOT_CACHE_RECORDS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}},Bi=class{constructor({name:e,sharedItems:t}){this.name=e,this.sharedItems=t}render(){let e=P(this.name);return this.sharedItems===null?`<cacheField name="${e}" numFmtId="0">
|
|
19
17
|
<sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" containsInteger="1" />
|
|
20
18
|
</cacheField>`:`<cacheField name="${e}" numFmtId="0">
|
|
21
19
|
<sharedItems count="${this.sharedItems.length}">
|
|
22
|
-
${this.sharedItems.map(e=>`<s v="${
|
|
20
|
+
${this.sharedItems.map(e=>`<s v="${P(String(e))}" />`).join(``)}
|
|
23
21
|
</sharedItems>
|
|
24
|
-
</cacheField>`}},
|
|
25
|
-
`)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,recordCount:o}=n;t.openXml(
|
|
26
|
-
`)),t.closeNode(),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:this.reset(),this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,refreshedBy:n.refreshedBy,refreshedDate:n.refreshedDate,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,isLoaded:!0};break;case`cacheSource`:this.inCacheSource=!0;break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet);break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new
|
|
22
|
+
</cacheField>`}},Vi=class extends z{constructor(){super(),this.model=null,this.inSharedItems=!1}get tag(){return`cacheField`}reset(){this.model=null,this.inSharedItems=!1}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case`cacheField`:this.model={name:Te(n.name||``),sharedItems:null};break;case`sharedItems`:this.inSharedItems=!0,n.containsNumber===`1`||n.containsInteger===`1`?this.model&&(this.model.containsNumber=n.containsNumber===`1`,this.model.containsInteger=n.containsInteger===`1`,n.minValue!==void 0&&(this.model.minValue=parseFloat(n.minValue)),n.maxValue!==void 0&&(this.model.maxValue=parseFloat(n.maxValue)),this.model.sharedItems=null):this.model&&parseInt(n.count||`0`,10)>0&&(this.model.sharedItems=[]);break;case`s`:if(this.inSharedItems&&this.model?.sharedItems!==null){let e=Te(n.v||``);this.model.sharedItems.push(e)}break;case`n`:if(this.inSharedItems&&this.model?.sharedItems!==null){let e=parseFloat(n.v||`0`);this.model.sharedItems.push(e)}break;case`b`:if(this.inSharedItems&&this.model?.sharedItems!==null){let e=n.v===`1`;this.model.sharedItems.push(e)}break;case`e`:if(this.inSharedItems&&this.model?.sharedItems!==null){let e=`#${n.v||`ERROR!`}`;this.model.sharedItems.push(e)}break;case`m`:this.inSharedItems&&this.model?.sharedItems!==null&&this.model.sharedItems.push(null);break;case`d`:if(this.inSharedItems&&this.model?.sharedItems!==null){let e=new Date(n.v||``);this.model.sharedItems.push(e)}break}return!0}parseText(e){}parseClose(e){switch(e){case`cacheField`:return!1;case`sharedItems`:this.inSharedItems=!1;break}return!0}},Hi=class e extends z{constructor(){super(),this.map={},this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1}prepare(e){}get tag(){return`pivotCacheDefinition`}reset(){this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1}render(e,t){t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n;t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,refreshedBy:`Author`,refreshedDate:`45125.026046874998`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:i.length+1}),t.openNode(`cacheSource`,{type:`worksheet`}),t.leafNode(`worksheetSource`,{ref:r.dimensions.shortRange,sheet:r.name}),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(i.map(e=>new Bi(e).render()).join(`
|
|
23
|
+
`)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,recordCount:o}=n;t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":n.rId||`rId1`,refreshOnLoad:n.refreshOnLoad||`1`,refreshedBy:n.refreshedBy||`Author`,refreshedDate:n.refreshedDate||`45125.026046874998`,createdVersion:n.createdVersion||`8`,refreshedVersion:n.refreshedVersion||`8`,minRefreshableVersion:n.minRefreshableVersion||`3`,recordCount:o||r.length+1}),t.openNode(`cacheSource`,{type:`worksheet`}),t.leafNode(`worksheetSource`,{ref:i,sheet:a}),t.closeNode(),t.openNode(`cacheFields`,{count:r.length}),t.writeXml(r.map(e=>new Bi(e).render()).join(`
|
|
24
|
+
`)),t.closeNode(),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:this.reset(),this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,refreshedBy:n.refreshedBy,refreshedDate:n.refreshedDate,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,isLoaded:!0};break;case`cacheSource`:this.inCacheSource=!0;break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet);break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new Vi,this.currentCacheField.parseOpen(e));break}return!0}parseText(e){this.currentCacheField&&this.currentCacheField.parseText(e)}parseClose(e){if(this.currentCacheField)return this.currentCacheField.parseClose(e)||(this.model&&this.currentCacheField.model&&this.model.cacheFields.push(this.currentCacheField.model),this.currentCacheField=null),!0;switch(e){case this.tag:return!1;case`cacheSource`:this.inCacheSource=!1;break;case`cacheFields`:this.inCacheFields=!1;break}return!0}reconcile(e,t){}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}},Ui=class e extends z{constructor(){super(),this.map={},this.model=null,this.inPivotFields=!1,this.inRowFields=!1,this.inColFields=!1,this.inDataFields=!1,this.inRowItems=!1,this.inColItems=!1,this.inLocation=!1,this.currentPivotField=null,this.inItems=!1,this.inPivotTableStyleInfo=!1}prepare(e){}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.inPivotFields=!1,this.inRowFields=!1,this.inColFields=!1,this.inDataFields=!1,this.inRowItems=!1,this.inColItems=!1,this.inLocation=!1,this.currentPivotField=null,this.inItems=!1,this.inPivotTableStyleInfo=!1}render(e,t){t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{rows:r,columns:i,values:a,cacheFields:o,cacheId:s,applyWidthHeightFormats:c}=n,l=`{${crypto.randomUUID().toUpperCase()}}`;t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,"xr:uid":l,name:`PivotTable2`,cacheId:s,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:c,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`}),t.writeXml(`
|
|
27
25
|
<location ref="A3:E15" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" />
|
|
28
26
|
<pivotFields count="${o.length}">
|
|
29
|
-
${
|
|
27
|
+
${Gi(n)}
|
|
30
28
|
</pivotFields>
|
|
31
29
|
<rowFields count="${r.length}">
|
|
32
30
|
${r.map(e=>`<field x="${e}" />`).join(`
|
|
@@ -43,7 +41,7 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
|
|
|
43
41
|
<i t="grand"><x /></i>
|
|
44
42
|
</colItems>
|
|
45
43
|
<dataFields count="${a.length}">
|
|
46
|
-
${
|
|
44
|
+
${Wi(o,a,n.metric)}
|
|
47
45
|
</dataFields>
|
|
48
46
|
<pivotTableStyleInfo
|
|
49
47
|
name="PivotStyleLight16"
|
|
@@ -73,7 +71,7 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
|
|
|
73
71
|
/>
|
|
74
72
|
</ext>
|
|
75
73
|
</extLst>
|
|
76
|
-
`),t.closeNode()}renderLoaded(t,n){let r=n.uid||`{${crypto.randomUUID().toUpperCase()}}`;if(t.openXml(
|
|
74
|
+
`),t.closeNode()}renderLoaded(t,n){let r=n.uid||`{${crypto.randomUUID().toUpperCase()}}`;if(t.openXml(I.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,"xr:uid":r,name:n.name||`PivotTable1`,cacheId:n.cacheId,applyNumberFormats:n.applyNumberFormats||`0`,applyBorderFormats:n.applyBorderFormats||`0`,applyFontFormats:n.applyFontFormats||`0`,applyPatternFormats:n.applyPatternFormats||`0`,applyAlignmentFormats:n.applyAlignmentFormats||`0`,applyWidthHeightFormats:n.applyWidthHeightFormats||`0`,dataCaption:n.dataCaption||`Values`,updatedVersion:n.updatedVersion||`8`,minRefreshableVersion:n.minRefreshableVersion||`3`,useAutoFormatting:n.useAutoFormatting?`1`:`0`,itemPrintTitles:n.itemPrintTitles?`1`:`0`,createdVersion:n.createdVersion||`8`,indent:n.indent===void 0?`0`:String(n.indent),compact:n.compact?`1`:`0`,compactData:n.compactData?`1`:`0`,multipleFieldFilters:n.multipleFieldFilters?`1`:`0`}),n.location&&t.leafNode(`location`,{ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol}),n.pivotFields.length>0){t.openNode(`pivotFields`,{count:n.pivotFields.length});for(let e of n.pivotFields)this.renderPivotFieldLoaded(t,e);t.closeNode()}if(n.rowFields.length>0){t.openNode(`rowFields`,{count:n.rowFields.length});for(let e of n.rowFields)t.leafNode(`field`,{x:e});t.closeNode()}t.writeXml(`
|
|
77
75
|
<rowItems count="1">
|
|
78
76
|
<i t="grand"><x /></i>
|
|
79
77
|
</rowItems>`);let i=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:i}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});if(t.closeNode(),t.writeXml(`
|
|
@@ -100,12 +98,12 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
|
|
|
100
98
|
/>
|
|
101
99
|
</ext>
|
|
102
100
|
</extLst>
|
|
103
|
-
`),t.closeNode()}renderPivotFieldLoaded(e,t){let n={compact:t.compact?`1`:`0`,outline:t.outline?`1`:`0`,showAll:t.showAll?`1`:`0`,defaultSubtotal:t.defaultSubtotal?`1`:`0`};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.items&&t.items.length>0){e.openNode(`pivotField`,n),e.openNode(`items`,{count:t.items.length+1});for(let n of t.items)e.leafNode(`item`,{x:n});e.writeXml(`<item t="default" />`),e.closeNode(),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId||`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting===`1`,itemPrintTitles:n.itemPrintTitles===`1`,indent:n.indent?parseInt(n.indent,10):0,compact:n.compact===`1`,compactData:n.compactData===`1`,multipleFieldFilters:n.multipleFieldFilters===`1`,isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow?parseInt(n.firstHeaderRow,10):void 0,firstDataRow:n.firstDataRow?parseInt(n.firstDataRow,10):void 0,firstDataCol:n.firstDataCol?parseInt(n.firstDataCol,10):void 0});break;case`pivotFields`:this.inPivotFields=!0;break;case`pivotField`:this.inPivotFields&&(this.currentPivotField={axis:n.axis,dataField:n.dataField===`1`,items:[],compact:n.compact===`1`,outline:n.outline===`1`,showAll:n.showAll===`1`,defaultSubtotal:n.defaultSubtotal===`1`});break;case`items`:this.currentPivotField&&(this.inItems=!0);break;case`item`:this.inItems&&this.currentPivotField&&n.x!==void 0&&this.currentPivotField.items.push(parseInt(n.x,10));break;case`rowFields`:this.inRowFields=!0;break;case`colFields`:this.inColFields=!0;break;case`dataFields`:this.inDataFields=!0;break;case`rowItems`:this.inRowItems=!0;break;case`colItems`:this.inColItems=!0;break;case`field`:if(this.model){let e=parseInt(n.x||`0`,10);this.inRowFields?this.model.rowFields.push(e):this.inColFields&&this.model.colFields.push(e)}break;case`dataField`:this.inDataFields&&this.model&&this.model.dataFields.push({name:
|
|
104
|
-
name="${r} of ${
|
|
101
|
+
`),t.closeNode()}renderPivotFieldLoaded(e,t){let n={compact:t.compact?`1`:`0`,outline:t.outline?`1`:`0`,showAll:t.showAll?`1`:`0`,defaultSubtotal:t.defaultSubtotal?`1`:`0`};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.items&&t.items.length>0){e.openNode(`pivotField`,n),e.openNode(`items`,{count:t.items.length+1});for(let n of t.items)e.leafNode(`item`,{x:n});e.writeXml(`<item t="default" />`),e.closeNode(),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId||`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting===`1`,itemPrintTitles:n.itemPrintTitles===`1`,indent:n.indent?parseInt(n.indent,10):0,compact:n.compact===`1`,compactData:n.compactData===`1`,multipleFieldFilters:n.multipleFieldFilters===`1`,isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow?parseInt(n.firstHeaderRow,10):void 0,firstDataRow:n.firstDataRow?parseInt(n.firstDataRow,10):void 0,firstDataCol:n.firstDataCol?parseInt(n.firstDataCol,10):void 0});break;case`pivotFields`:this.inPivotFields=!0;break;case`pivotField`:this.inPivotFields&&(this.currentPivotField={axis:n.axis,dataField:n.dataField===`1`,items:[],compact:n.compact===`1`,outline:n.outline===`1`,showAll:n.showAll===`1`,defaultSubtotal:n.defaultSubtotal===`1`});break;case`items`:this.currentPivotField&&(this.inItems=!0);break;case`item`:this.inItems&&this.currentPivotField&&n.x!==void 0&&this.currentPivotField.items.push(parseInt(n.x,10));break;case`rowFields`:this.inRowFields=!0;break;case`colFields`:this.inColFields=!0;break;case`dataFields`:this.inDataFields=!0;break;case`rowItems`:this.inRowItems=!0;break;case`colItems`:this.inColItems=!0;break;case`field`:if(this.model){let e=parseInt(n.x||`0`,10);this.inRowFields?this.model.rowFields.push(e):this.inColFields&&this.model.colFields.push(e)}break;case`dataField`:this.inDataFields&&this.model&&this.model.dataFields.push({name:Te(n.name||``),fld:parseInt(n.fld||`0`,10),baseField:n.baseField?parseInt(n.baseField,10):0,baseItem:n.baseItem?parseInt(n.baseItem,10):0,subtotal:n.subtotal});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name);break}return!0}parseText(e){}parseClose(e){switch(e){case this.tag:return!1;case`pivotFields`:this.inPivotFields=!1;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:this.inItems=!1;break;case`rowFields`:this.inRowFields=!1;break;case`colFields`:this.inColFields=!1;break;case`dataFields`:this.inDataFields=!1;break;case`rowItems`:this.inRowItems=!1;break;case`colItems`:this.inColItems=!1;break}return!0}reconcile(e,t){}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function Wi(e,t,n){let r=n===`count`?`Count`:`Sum`,i=n===`count`?` subtotal="count"`:``;return t.map(t=>`<dataField
|
|
102
|
+
name="${r} of ${P(e[t].name)}"
|
|
105
103
|
fld="${t}"
|
|
106
104
|
baseField="0"
|
|
107
105
|
baseItem="0"${i}
|
|
108
|
-
/>`).join(``)}function
|
|
106
|
+
/>`).join(``)}function Gi(e){let t=new Set(e.rows),n=new Set(e.columns),r=new Set(e.values);return e.cacheFields.map((e,i)=>Ki(t.has(i)?`row`:n.has(i)?`column`:r.has(i)?`value`:null,e.sharedItems)).join(``)}function Ki(e,t){let n=`compact="0" outline="0" showAll="0" defaultSubtotal="0"`;return e===`row`||e===`column`?`
|
|
109
107
|
<pivotField axis="${e===`row`?`axisRow`:`axisCol`}" ${n}>
|
|
110
108
|
<items count="${t.length+1}">
|
|
111
109
|
${t.map((e,t)=>`<item x="${t}" />`).join(`
|
|
@@ -117,11 +115,11 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
|
|
|
117
115
|
${e===`value`?`dataField="1"`:``}
|
|
118
116
|
${n}
|
|
119
117
|
/>
|
|
120
|
-
`}var Zi=class extends W{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new zn,this._richTextXform}render(e,t){let n=t||this.model;e.openNode(`comment`,{ref:n.ref,authorId:0}),e.openNode(`text`),n&&n.note&&n.note.texts&&n.note.texts.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`comment`:return this.model={type:`note`,note:{texts:[]},...e.attributes},!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`comment`:return!1;case`r`:return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}},Qi=class e extends W{constructor(){super(),this.map={comment:new Zi},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(U.StdDocAttributes),t.openNode(`comments`,e.COMMENTS_ATTRIBUTES),t.openNode(`authors`),t.leafNode(`author`,null,`Author`),t.closeNode(),t.openNode(`commentList`),r.comments.forEach(e=>{this.map.comment.render(t,e)}),t.closeNode(),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`commentList`:return this.model={comments:[]},!0;case`comment`:return this.parser=this.map.comment,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`commentList`:return!1;case`comment`:return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.COMMENTS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}},$i=class extends W{constructor(){super(),this.model={}}get tag(){return`v:textbox`}conversionUnit(e,t,n){return`${(parseFloat(e.toString())*t).toFixed(2)}${n}`}reverseConversionUnit(e){return(e||``).split(`,`).map(e=>Number(parseFloat(this.conversionUnit(parseFloat(e),.1,``)).toFixed(2)))}render(e,t){let n={style:`mso-direction-alt:auto`};if(t&&t.note){let{inset:e}=t.note&&t.note.margins||{};Array.isArray(e)&&(e=e.map(e=>this.conversionUnit(e,10,`mm`)).join(`,`)),e&&(n.inset=e)}e.openNode(`v:textbox`,n),e.leafNode(`div`,{style:`text-align:left`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return this.model={inset:this.reverseConversionUnit(e.attributes.inset)},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},ea=class extends W{constructor(){super(),this.text=``}get tag(){return`x:Anchor`}getAnchorRect(e){let t=Math.floor(e.left),n=Math.floor((e.left-t)*68),r=Math.floor(e.top),i=Math.floor((e.top-r)*18),a=Math.floor(e.right),o=Math.floor((e.right-a)*68),s=Math.floor(e.bottom);return[t,n,r,i,a,o,s,Math.floor((e.bottom-s)*18)]}getDefaultRect(e){let t=e.col,n=Math.max(e.row-2,0);return[t,6,n,14,t+2,2,n+4,16]}render(e,t){let n=t.anchor?this.getAnchorRect(t.anchor):this.getDefaultRect(t.refAddress);e.leafNode(`x:Anchor`,null,n.join(`, `))}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},ta=class extends W{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model&&this._model.tag||``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},na=class extends W{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model&&this._model.tag||``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};const ra=[`twoCells`,`oneCells`,`absolute`];var ia=class extends W{constructor(){super(),this.map={"x:Anchor":new ea,"x:Locked":new ta({tag:`x:Locked`}),"x:LockText":new ta({tag:`x:LockText`}),"x:SizeWithCells":new na({tag:`x:SizeWithCells`}),"x:MoveWithCells":new na({tag:`x:MoveWithCells`})},this.model={anchor:[],protection:{},editAs:``}}get tag(){return`x:ClientData`}render(e,t){let{protection:n,editAs:r}=t.note;e.openNode(this.tag,{ObjectType:`Note`}),this.map[`x:MoveWithCells`].render(e,r,ra),this.map[`x:SizeWithCells`].render(e,r,ra),this.map[`x:Anchor`].render(e,t),this.map[`x:Locked`].render(e,n.locked),e.leafNode(`x:AutoFill`,null,`False`),this.map[`x:LockText`].render(e,n.lockText),e.leafNode(`x:Row`,null,t.refAddress.row-1),e.leafNode(`x:Column`,null,t.refAddress.col-1),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:this.reset(),this.model={anchor:[],protection:{},editAs:``};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.normalizeModel(),!1;default:return!0}}normalizeModel(){let e=Object.assign({},this.map[`x:MoveWithCells`].model,this.map[`x:SizeWithCells`].model),t=Object.keys(e).length;this.model.editAs=ra[t],this.model.anchor=this.map[`x:Anchor`].text,this.model.protection.locked=this.map[`x:Locked`].text,this.model.protection.lockText=this.map[`x:LockText`].text}},aa=class e extends W{constructor(){super(),this.map={"v:textbox":new $i,"x:ClientData":new ia}}get tag(){return`v:shape`}render(t,n,r){t.openNode(`v:shape`,e.V_SHAPE_ATTRIBUTES(n,r||0)),t.leafNode(`v:fill`,{color2:`infoBackground [80]`}),t.leafNode(`v:shadow`,{color:`none [81]`,obscured:`t`}),t.leafNode(`v:path`,{"o:connecttype":`none`}),this.map[`v:textbox`].render(t,n),this.map[`x:ClientData`].render(t,n),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={margins:{insetmode:e.attributes[`o:insetmode`]},anchor:``,editAs:``,protection:{}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.margins.inset=this.map[`v:textbox`].model&&this.map[`v:textbox`].model.inset,this.model.protection=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.protection,this.model.anchor=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.anchor,this.model.editAs=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.editAs,!1;default:return!0}}static{this.V_SHAPE_ATTRIBUTES=(e,t)=>({id:`_x0000_s${1025+t}`,type:`#_x0000_t202`,style:`position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden`,fillcolor:`infoBackground [80]`,strokecolor:`none [81]`,"o:insetmode":e.note.margins&&e.note.margins.insetmode})}},oa=class e extends W{constructor(){super(),this.map={"v:shape":new aa},this.model={comments:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model;t.openXml(U.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode(),r.comments.forEach((e,n)=>{this.map[`v:shape`].render(t,e,n)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},sa=class e{static{this.RelType=X}constructor(e){this.workbook=e}parseRels(e){return new Y().parseStream(e)}parseWorkbook(e){return new ar().parseStream(e)}parseSharedStrings(e){return new Hn().parseStream(e)}reconcile(e,t){let n=new ar,r=new vi(t),i=new Fi,a=new Hi;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};Object.keys(e.drawings).forEach(t=>{let n=e.drawings[t],r=e.drawingRels[t];r&&(o.rels=r.reduce((e,t)=>(e[t.Id]=t,e),{}),(n.anchors||[]).forEach(e=>{let t=e.picture&&e.picture.hyperlinks;t&&o.rels[t.rId]&&(t.hyperlink=o.rels[t.rId].Target,delete t.rId)}),i.reconcile(n,o))});let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)}),this._reconcilePivotTables(e);let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings,pivotTables:e.pivotTablesIndexed};e.worksheets.forEach(t=>{t.relationships=e.worksheetRels[t.sheetNo],r.reconcile(t,c)}),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels,delete e.pivotCacheDefinitionRels}_reconcilePivotTables(e){let t=e.pivotTables||{};if(typeof t!=`object`||Object.keys(t).length===0){e.pivotTables=[],e.pivotTablesIndexed={};return}let n=this._buildDefinitionToCacheIdMap(e),r=new Map;Object.entries(e.pivotCacheDefinitions||{}).forEach(([t,i])=>{let a=n.get(t);if(a!==void 0){let n=t.replace(`Definition`,`Records`);r.set(a,{definition:i,records:e.pivotCacheRecords?.[n],definitionName:t})}});let i=[],a={};Object.entries(t).forEach(([e,t])=>{let n=t,o=this._extractTableNumber(e),s=r.get(n.cacheId),c={...n,tableNumber:o,cacheDefinition:s?.definition,cacheRecords:s?.records,cacheFields:s?.definition?.cacheFields||[],rows:n.rowFields.filter(e=>e>=0),columns:n.colFields.filter(e=>e>=0&&e!==-2),values:n.dataFields.map(e=>e.fld),metric:this._determineMetric(n.dataFields),applyWidthHeightFormats:n.applyWidthHeightFormats||`0`};i.push(c),a[`../pivotTables/${e}.xml`]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a,e.loadedPivotTables=i}_extractTableNumber(e){let t=e.match(/pivotTable(\d+)/);return t?parseInt(t[1],10):1}_buildCacheIdMap(e){let t=new Map,n=e.pivotCaches||[];for(let e of n)e.cacheId&&e.rId&&t.set(e.rId,parseInt(e.cacheId,10));return t}_buildDefinitionToCacheIdMap(t){let n=new Map,r=this._buildCacheIdMap(t),i=t.workbookRels||[];for(let t of i)if(t.Type===e.RelType.PivotCacheDefinition&&t.Target){let e=t.Target.match(/pivotCacheDefinition(\d+)\.xml/);if(e){let i=`pivotCacheDefinition${e[1]}`,a=r.get(t.Id);a!==void 0&&n.set(i,a)}}return n}_determineMetric(e){return e.length>0&&e[0].subtotal===`count`?`count`:`sum`}async _processWorksheetEntry(e,t,n,r,i){let a=await new vi(r).parseStream(e);if(!a)throw Error(`Failed to parse worksheet ${i}`);a.sheetNo=n,t.worksheetHash[i]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,n){let r=await new Qi().parseStream(e);t.comments[`../${n}.xml`]=r}async _processTableEntry(e,t,n){let r=await new Hi().parseStream(e);t.tables[`../tables/${n}.xml`]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new Y().parseStream(e);t.worksheetRels[n]=r}async _processMediaEntry(e,t,n){let r=n.lastIndexOf(`.`);if(r>=1){let i=n.substr(r+1),a=n.substr(0,r);await new Promise((r,o)=>{let s=this.createStreamBuf(),c=()=>{e.removeListener(`error`,u),s.removeListener(`error`,u),s.removeListener(`finish`,l)},l=()=>{c(),t.mediaIndex[n]=t.media.length,t.mediaIndex[a]=t.media.length;let e={type:`image`,name:a,extension:i,buffer:s.toBuffer?s.toBuffer():s.read()};t.media.push(e),r()},u=e=>{c(),o(e)};s.once(`finish`,l),e.on(`error`,u),s.on(`error`,u),e.pipe(s)})}}async _processDrawingEntry(e,t,n){let r=await new Fi().parseStream(e);t.drawings[n]=r}async _processDrawingRelsEntry(e,t,n){let r=await new Y().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new oa().parseStream(e);t.vmlDrawings[`../drawings/${n}.vml`]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.removeListener(`error`,c),a.removeListener(`error`,c),a.removeListener(`finish`,s)},s=()=>{o();let e=a.read();t.themes[n]=e?typeof e==`string`?e:this.bufferToString(e):``,r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async _processPivotTableEntry(e,t,n){let r=await new qi().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new Y().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new Ki().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheDefinitionRelsEntry(e,t,n){let r=await new Y().parseStream(e);t.pivotCacheDefinitionRels[n]=r}async _processPivotCacheRecordsEntry(e,t,n){let r=await new Ui().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheDefinitionRels:{},pivotCacheRecords:{}},r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=e.name;r[0]===`/`&&(r=r.substr(1));let i=r.match(/xl\/media\//)||r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data)),a=r.match(/xl\/worksheets\/sheet(\d+)[.]xml/);if(a){let e=parseInt(a[1],10);await this._processWorksheetEntry(i,n,e,t,r)}else switch(r){case`_rels/.rels`:n.globalRels=await this.parseRels(i);break;case`xl/workbook.xml`:{let e=await this.parseWorkbook(i);n.sheets=e.sheets,n.definedNames=e.definedNames,n.views=e.views,n.properties=e.properties,n.calcProperties=e.calcProperties,n.pivotCaches=e.pivotCaches;break}case`xl/sharedStrings.xml`:n.sharedStrings=new Hn,await n.sharedStrings.parseStream(i);break;case`xl/_rels/workbook.xml.rels`:n.workbookRels=await this.parseRels(i);break;case`docProps/app.xml`:{let e=await new qn().parseStream(i);n.company=e.company,n.manager=e.manager;break}case`docProps/core.xml`:{let e=await new Ln().parseStream(i);Object.assign(n,e);break}case`xl/styles.xml`:n.styles=new Fn,await n.styles.parseStream(i);break;default:await this._processDefaultEntry(i,n,r)}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n){let r;if(r=n.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels/),r){let n=parseInt(r[1],10);await this._processWorksheetRelsEntry(e,t,n);return}if(r=n.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),r){await this._processMediaEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(drawing\d+)[.]xml/),r){await this._processDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels/),r){await this._processDrawingRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),r){await this._processVmlDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/comments(\d+)[.]xml/),r){await this._processCommentEntry(e,t,`comments${r[1]}`);return}if(r=n.match(/xl\/tables\/(table\d+)[.]xml/),r){await this._processTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),r){await this._processThemeEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/(pivotTable\d+)[.]xml/),r){await this._processPivotTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels/),r){await this._processPivotTableRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml/),r){await this._processPivotCacheDefinitionEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels/),r){await this._processPivotCacheDefinitionRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml/),r){await this._processPivotCacheRecordsEntry(e,t,r[1]);return}}async addContentTypes(e,t){let n=new Wn().toXml(t);e.append(n,{name:`[Content_Types].xml`})}async addApp(e,t){let n=new qn().toXml(t);e.append(n,{name:`docProps/app.xml`})}async addCore(e,t){let n=new Ln;e.append(n.toXml(t),{name:`docProps/core.xml`})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
121
|
-
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`};Object.keys(n).forEach(t=>{let r=n[t],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new Y().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition${t.tableNumber}.xml`})}),n.worksheets.forEach((t,n)=>{t.rId=`rId${r++}`,t.fileIndex=n+1,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.fileIndex}.xml`})});let a=new Y().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new ar;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new vi,r=new Y,i=new Qi,a=new oa;t.worksheets.forEach((t,o)=>{let s=t.fileIndex||o+1,c=new U;n.render(c,t),e.append(c.xml,{name:`xl/worksheets/sheet${s}.xml`}),t.rels&&t.rels.length&&(c=new U,r.render(c,t.rels),e.append(c.xml,{name:`xl/worksheets/_rels/sheet${s}.xml.rels`})),t.comments.length>0&&(c=new U,i.render(c,t),e.append(c.xml,{name:`xl/comments${s}.xml`}),c=new U,a.render(c,t),e.append(c.xml,{name:`xl/drawings/vmlDrawing${s}.vml`}))})}addDrawings(e,t){let n=new Fi,r=new Y;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new Hi;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new Ui,i=new Ki,a=new qi,o=new Y;n.pivotTables.forEach(n=>{let s=n.tableNumber;if(n.isLoaded){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`})}}else{let e=r.toXml(n);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`}),e=i.toXml(n),t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}let c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords${s}.xml`}]);t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition${s}.xml.rels`}),c=a.toXml(n),t.append(c,{name:`xl/pivotTables/pivotTable${s}.xml`}),c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition${s}.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable${s}.xml.rels`})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator||`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy||`ExcelTS`,e.created=e.created||new Date,e.modified=e.modified||new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Hn,e.styles=e.useStyles?new Fn(!0):new Fn.Mock;let n=new ar,r=new vi;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}},ca=class{constructor(e){this.listeners=new Map,this.ended=!1,this.data=e}async*[Symbol.asyncIterator](){yield this.data}on(e,t){let n=this.listeners.get(e)||[];return n.push(t),this.listeners.set(e,n),this.ended||(this.ended=!0,queueMicrotask(()=>{this.emit(`data`,this.data),this.emit(`end`)})),this}removeListener(e,t){let n=this.listeners.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){(this.listeners.get(e)||[]).forEach(e=>e(...t))}pipe(e){return e.write(this.data instanceof Uint8Array?this.data:new TextEncoder().encode(this.data)),e.end(),e}},la=class extends sa{createStreamBuf(){return new $t}createBinaryStream(e){return new ca(e)}createTextStream(e){return new ca(e)}bufferToString(e){return Le(e)}async load(e,t){let n;if(!e||typeof e==`object`&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);n=t&&t.base64?ye(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e);let r={};return await new Promise((e,t)=>{let i=0,a=!1,o=0,s=()=>{a&&i===o&&e()},c=new Ft(e=>{o++;let n=[],a=0;e.ondata=(o,c,l)=>{if(o){t(o);return}if(c&&(n.push(c),a+=c.length),l){if(n.length===1)r[e.name]=n[0];else if(n.length>1){let t=new Uint8Array(a),i=0;for(let e of n)t.set(e,i),i+=e.length;r[e.name]=t}else r[e.name]=new Uint8Array;i++,n.length=0,s()}},e.start()});c.register(Pt),c.push(n,!0),a=!0,s()}),this.loadFromFiles(r,t)}async writeBuffer(e){e||={};let{model:t}=this.workbook,n=new nn(e.zip),r=new $t;return n.pipe(r),this.prepareModel(t,e),await this.addContentTypes(n,t),await this.addOfficeRels(n,t),await this.addWorkbookRels(n,t),await this.addWorksheets(n,t),await this.addSharedStrings(n,t),this.addDrawings(n,t),this.addTables(n,t),this.addPivotTables(n,t),await Promise.all([this.addThemes(n,t),this.addStyles(n,t)]),await this.addMedia(n,t),await Promise.all([this.addApp(n,t),this.addCore(n,t)]),await this.addWorkbook(n,t),await this._finalize(n),be.from(r.read())}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}throw Error(`Loading images from filename is not supported in browser`)}throw Error(`Unsupported media`)}))}},ua=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))})),da=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_customParseFormat=r()})(e,(function(){var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return(e=+e)+(e>68?1900:2e3)},c=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||={}).offset=function(e){if(!e||e===`Z`)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return n===0?0:t[0]===`+`?-n:n}(e)}],u=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?`pm`:`PM`);return n},f={A:[a,function(e){this.afternoon=d(e,!1)}],a:[a,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*e}],SS:[r,function(e){this.milliseconds=10*e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[i,c(`seconds`)],ss:[i,c(`seconds`)],m:[i,c(`minutes`)],mm:[i,c(`minutes`)],H:[i,c(`hours`)],h:[i,c(`hours`)],HH:[i,c(`hours`)],hh:[i,c(`hours`)],D:[i,c(`day`)],DD:[r,c(`day`)],Do:[a,function(e){var t=o.ordinal;if(this.day=e.match(/\d+/)[0],t)for(var n=1;n<=31;n+=1)t(n).replace(/\[|\]/g,``)===e&&(this.day=n)}],w:[i,c(`week`)],ww:[r,c(`week`)],M:[i,c(`month`)],MM:[r,c(`month`)],MMM:[a,function(e){var t=u(`months`),n=(u(`monthsShort`)||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw Error();this.month=n%12||n}],MMMM:[a,function(e){var t=u(`months`).indexOf(e)+1;if(t<1)throw Error();this.month=t%12||t}],Y:[/[+-]?\d+/,c(`year`)],YY:[r,function(e){this.year=s(e)}],YYYY:[/\d{4}/,c(`year`)],Z:l,ZZ:l};function p(n){for(var r=n,i=o&&o.formats,a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),s=a.length,c=0;c<s;c+=1){var l=a[c],u=f[l],d=u&&u[0],p=u&&u[1];a[c]=p?{regex:d,parser:p}:l.replace(/^\[|\]$/g,``)}return function(e){for(var t={},n=0,r=0;n<s;n+=1){var i=a[n];if(typeof i==`string`)r+=i.length;else{var o=i.regex,c=i.parser,l=e.slice(r),u=o.exec(l)[0];c.call(t,u),e=e.replace(u,``)}}return function(e){var t=e.afternoon;if(t!==void 0){var n=e.hours;t?n<12&&(e.hours+=12):n===12&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,a=e.args;this.$u=r;var s=a[1];if(typeof s==`string`){var c=!0===a[2],l=!0===a[3],u=c||l,d=a[2];l&&(d=a[2]),o=this.$locale(),!c&&d&&(o=n.Ls[d]),this.$d=function(e,t,n,r){try{if([`x`,`X`].indexOf(t)>-1)return new Date((t===`X`?1e3:1)*e);var i=p(t)(e),a=i.year,o=i.month,s=i.day,c=i.hours,l=i.minutes,u=i.seconds,d=i.milliseconds,f=i.zone,m=i.week,h=new Date,g=s||(a||o?1:h.getDate()),_=a||h.getFullYear(),v=0;a&&!o||(v=o>0?o-1:h.getMonth());var y,b=c||0,x=l||0,S=u||0,C=d||0;return f?new Date(Date.UTC(_,v,g,b,x,S,C+60*f.offset*1e3)):n?new Date(Date.UTC(_,v,g,b,x,S,C)):(y=new Date(_,v,g,b,x,S,C),m&&(y=r(y).week(m).toDate()),y)}catch{return new Date(``)}}(t,s,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(s)&&(this.$d=new Date(``)),o={}}else if(s instanceof Array)for(var f=s.length,m=1;m<=f;m+=1){a[1]=s[m-1];var h=n.apply(this,a);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}m===f&&(this.$d=new Date(``))}else i.call(this,e)}}}))})),fa=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_utc=r()})(e,(function(){var e=`minute`,t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,a){var o=i.prototype;a.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var n=a(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},o.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var s=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var c=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var l=o.utcOffset;o.utcOffset=function(r,i){var a=this.$utils().u;if(a(r))return this.$u?0:a(this.$offset)?l.call(this):this.$offset;if(typeof r==`string`&&(r=function(e){e===void 0&&(e=``);var r=e.match(t);if(!r)return null;var i=(``+r[0]).match(n)||[`-`,0,0],a=i[0],o=60*i[1]+ +i[2];return o===0?0:a===`+`?o:-o}(r),r===null))return this;var o=Math.abs(r)<=16?60*r:r;if(o===0)return this.utc(i);var s=this.clone();if(i)return s.$offset=o,s.$u=!1,s;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(o+c,e)).$offset=o,s.$x.$localOffset=c,s};var u=o.format;o.format=function(e){var t=e||(this.$u?`YYYY-MM-DDTHH:mm:ss[Z]`:``);return u.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var d=o.toDate;o.toDate=function(e){return e===`s`&&this.$offset?a(this.format(`YYYY-MM-DD HH:mm:ss:SSS`)).toDate():d.call(this)};var f=o.diff;o.diff=function(e,t,n){if(e&&this.$u===e.$u)return f.call(this,e,t,n);var r=this.local(),i=a(e).local();return f.call(r,i,t,n)}}}))}))(),1),pa=c(da(),1),ma=c(ua(),1);function ha(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ga(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function _a(e,t,n,r){if(t)return e.trim();let i=e;return n&&(i=i.trimStart()),r&&(i=i.trimEnd()),i}function va(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,b=a||o,x=r!==null&&r!==!1,S=x?String(r):``,C=i!==null&&i!==!1?String(i):``,w=[],T=[],E=[],D=``,ee=!1,O=0,k=0,A=0,te=0,j=null,ne=0,M=!1,re=!1;u===!0?M=!0:Array.isArray(u)?(j=u,ne=u.filter(e=>e!=null).length,ga(u),M=!0,d||(re=!0)):typeof u==`function`&&(M=!0),e=e.replace(/\r\n/g,`
|
|
118
|
+
`}var qi=class extends z{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Pn,this._richTextXform}render(e,t){let n=t||this.model;e.openNode(`comment`,{ref:n.ref,authorId:0}),e.openNode(`text`),n&&n.note&&n.note.texts&&n.note.texts.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`comment`:return this.model={type:`note`,note:{texts:[]},...e.attributes},!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`comment`:return!1;case`r`:return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}},Ji=class e extends z{constructor(){super(),this.map={comment:new qi},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(I.StdDocAttributes),t.openNode(`comments`,e.COMMENTS_ATTRIBUTES),t.openNode(`authors`),t.leafNode(`author`,null,`Author`),t.closeNode(),t.openNode(`commentList`),r.comments.forEach(e=>{this.map.comment.render(t,e)}),t.closeNode(),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`commentList`:return this.model={comments:[]},!0;case`comment`:return this.parser=this.map.comment,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`commentList`:return!1;case`comment`:return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.COMMENTS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}},Yi=class extends z{constructor(){super(),this.model={}}get tag(){return`v:textbox`}conversionUnit(e,t,n){return`${(parseFloat(e.toString())*t).toFixed(2)}${n}`}reverseConversionUnit(e){return(e||``).split(`,`).map(e=>Number(parseFloat(this.conversionUnit(parseFloat(e),.1,``)).toFixed(2)))}render(e,t){let n={style:`mso-direction-alt:auto`};if(t&&t.note){let{inset:e}=t.note&&t.note.margins||{};Array.isArray(e)&&(e=e.map(e=>this.conversionUnit(e,10,`mm`)).join(`,`)),e&&(n.inset=e)}e.openNode(`v:textbox`,n),e.leafNode(`div`,{style:`text-align:left`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return this.model={inset:this.reverseConversionUnit(e.attributes.inset)},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Xi=class extends z{constructor(){super(),this.text=``}get tag(){return`x:Anchor`}getAnchorRect(e){let t=Math.floor(e.left),n=Math.floor((e.left-t)*68),r=Math.floor(e.top),i=Math.floor((e.top-r)*18),a=Math.floor(e.right),o=Math.floor((e.right-a)*68),s=Math.floor(e.bottom);return[t,n,r,i,a,o,s,Math.floor((e.bottom-s)*18)]}getDefaultRect(e){let t=e.col,n=Math.max(e.row-2,0);return[t,6,n,14,t+2,2,n+4,16]}render(e,t){let n=t.anchor?this.getAnchorRect(t.anchor):this.getDefaultRect(t.refAddress);e.leafNode(`x:Anchor`,null,n.join(`, `))}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},Zi=class extends z{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model&&this._model.tag||``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},Qi=class extends z{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model&&this._model.tag||``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};const $i=[`twoCells`,`oneCells`,`absolute`];var ea=class extends z{constructor(){super(),this.map={"x:Anchor":new Xi,"x:Locked":new Zi({tag:`x:Locked`}),"x:LockText":new Zi({tag:`x:LockText`}),"x:SizeWithCells":new Qi({tag:`x:SizeWithCells`}),"x:MoveWithCells":new Qi({tag:`x:MoveWithCells`})},this.model={anchor:[],protection:{},editAs:``}}get tag(){return`x:ClientData`}render(e,t){let{protection:n,editAs:r}=t.note;e.openNode(this.tag,{ObjectType:`Note`}),this.map[`x:MoveWithCells`].render(e,r,$i),this.map[`x:SizeWithCells`].render(e,r,$i),this.map[`x:Anchor`].render(e,t),this.map[`x:Locked`].render(e,n.locked),e.leafNode(`x:AutoFill`,null,`False`),this.map[`x:LockText`].render(e,n.lockText),e.leafNode(`x:Row`,null,t.refAddress.row-1),e.leafNode(`x:Column`,null,t.refAddress.col-1),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:this.reset(),this.model={anchor:[],protection:{},editAs:``};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.normalizeModel(),!1;default:return!0}}normalizeModel(){let e=Object.assign({},this.map[`x:MoveWithCells`].model,this.map[`x:SizeWithCells`].model),t=Object.keys(e).length;this.model.editAs=$i[t],this.model.anchor=this.map[`x:Anchor`].text,this.model.protection.locked=this.map[`x:Locked`].text,this.model.protection.lockText=this.map[`x:LockText`].text}},ta=class e extends z{constructor(){super(),this.map={"v:textbox":new Yi,"x:ClientData":new ea}}get tag(){return`v:shape`}render(t,n,r){t.openNode(`v:shape`,e.V_SHAPE_ATTRIBUTES(n,r||0)),t.leafNode(`v:fill`,{color2:`infoBackground [80]`}),t.leafNode(`v:shadow`,{color:`none [81]`,obscured:`t`}),t.leafNode(`v:path`,{"o:connecttype":`none`}),this.map[`v:textbox`].render(t,n),this.map[`x:ClientData`].render(t,n),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={margins:{insetmode:e.attributes[`o:insetmode`]},anchor:``,editAs:``,protection:{}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.margins.inset=this.map[`v:textbox`].model&&this.map[`v:textbox`].model.inset,this.model.protection=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.protection,this.model.anchor=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.anchor,this.model.editAs=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.editAs,!1;default:return!0}}static{this.V_SHAPE_ATTRIBUTES=(e,t)=>({id:`_x0000_s${1025+t}`,type:`#_x0000_t202`,style:`position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden`,fillcolor:`infoBackground [80]`,strokecolor:`none [81]`,"o:insetmode":e.note.margins&&e.note.margins.insetmode})}},na=class e extends z{constructor(){super(),this.map={"v:shape":new ta},this.model={comments:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model;t.openXml(I.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode(),r.comments.forEach((e,n)=>{this.map[`v:shape`].render(t,e,n)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},ra=class e{static{this.RelType=q}constructor(e){this.workbook=e}parseRels(e){return new K().parseStream(e)}parseWorkbook(e){return new er().parseStream(e)}parseSharedStrings(e){return new Ln().parseStream(e)}reconcile(e,t){let n=new er,r=new mi(t),i=new ji,a=new Ri;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};Object.keys(e.drawings).forEach(t=>{let n=e.drawings[t],r=e.drawingRels[t];r&&(o.rels=r.reduce((e,t)=>(e[t.Id]=t,e),{}),(n.anchors||[]).forEach(e=>{let t=e.picture&&e.picture.hyperlinks;t&&o.rels[t.rId]&&(t.hyperlink=o.rels[t.rId].Target,delete t.rId)}),i.reconcile(n,o))});let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)}),this._reconcilePivotTables(e);let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings,pivotTables:e.pivotTablesIndexed};e.worksheets.forEach(t=>{t.relationships=e.worksheetRels[t.sheetNo],r.reconcile(t,c)}),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels,delete e.pivotCacheDefinitionRels}_reconcilePivotTables(e){let t=e.pivotTables||{};if(typeof t!=`object`||Object.keys(t).length===0){e.pivotTables=[],e.pivotTablesIndexed={};return}let n=this._buildDefinitionToCacheIdMap(e),r=new Map;Object.entries(e.pivotCacheDefinitions||{}).forEach(([t,i])=>{let a=n.get(t);if(a!==void 0){let n=t.replace(`Definition`,`Records`);r.set(a,{definition:i,records:e.pivotCacheRecords?.[n],definitionName:t})}});let i=[],a={};Object.entries(t).forEach(([e,t])=>{let n=t,o=this._extractTableNumber(e),s=r.get(n.cacheId),c={...n,tableNumber:o,cacheDefinition:s?.definition,cacheRecords:s?.records,cacheFields:s?.definition?.cacheFields||[],rows:n.rowFields.filter(e=>e>=0),columns:n.colFields.filter(e=>e>=0&&e!==-2),values:n.dataFields.map(e=>e.fld),metric:this._determineMetric(n.dataFields),applyWidthHeightFormats:n.applyWidthHeightFormats||`0`};i.push(c),a[`../pivotTables/${e}.xml`]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a,e.loadedPivotTables=i}_extractTableNumber(e){let t=e.match(/pivotTable(\d+)/);return t?parseInt(t[1],10):1}_buildCacheIdMap(e){let t=new Map,n=e.pivotCaches||[];for(let e of n)e.cacheId&&e.rId&&t.set(e.rId,parseInt(e.cacheId,10));return t}_buildDefinitionToCacheIdMap(t){let n=new Map,r=this._buildCacheIdMap(t),i=t.workbookRels||[];for(let t of i)if(t.Type===e.RelType.PivotCacheDefinition&&t.Target){let e=t.Target.match(/pivotCacheDefinition(\d+)\.xml/);if(e){let i=`pivotCacheDefinition${e[1]}`,a=r.get(t.Id);a!==void 0&&n.set(i,a)}}return n}_determineMetric(e){return e.length>0&&e[0].subtotal===`count`?`count`:`sum`}async _processWorksheetEntry(e,t,n,r,i){let a=await new mi(r).parseStream(e);if(!a)throw Error(`Failed to parse worksheet ${i}`);a.sheetNo=n,t.worksheetHash[i]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,n){let r=await new Ji().parseStream(e);t.comments[`../${n}.xml`]=r}async _processTableEntry(e,t,n){let r=await new Ri().parseStream(e);t.tables[`../tables/${n}.xml`]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new K().parseStream(e);t.worksheetRels[n]=r}async _processMediaEntry(e,t,n){let r=n.lastIndexOf(`.`);if(r>=1){let i=n.substr(r+1),a=n.substr(0,r);await new Promise((r,o)=>{let s=this.createStreamBuf(),c=()=>{e.removeListener(`error`,u),s.removeListener(`error`,u),s.removeListener(`finish`,l)},l=()=>{c(),t.mediaIndex[n]=t.media.length,t.mediaIndex[a]=t.media.length;let e={type:`image`,name:a,extension:i,buffer:s.toBuffer?s.toBuffer():s.read()};t.media.push(e),r()},u=e=>{c(),o(e)};s.once(`finish`,l),e.on(`error`,u),s.on(`error`,u),e.pipe(s)})}}async _processDrawingEntry(e,t,n){let r=await new ji().parseStream(e);t.drawings[n]=r}async _processDrawingRelsEntry(e,t,n){let r=await new K().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new na().parseStream(e);t.vmlDrawings[`../drawings/${n}.vml`]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.removeListener(`error`,c),a.removeListener(`error`,c),a.removeListener(`finish`,s)},s=()=>{o();let e=a.read();t.themes[n]=e?typeof e==`string`?e:this.bufferToString(e):``,r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async _processPivotTableEntry(e,t,n){let r=await new Ui().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new K().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new Hi().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheDefinitionRelsEntry(e,t,n){let r=await new K().parseStream(e);t.pivotCacheDefinitionRels[n]=r}async _processPivotCacheRecordsEntry(e,t,n){let r=await new zi().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheDefinitionRels:{},pivotCacheRecords:{}},r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=e.name;r[0]===`/`&&(r=r.substr(1));let i=r.match(/xl\/media\//)||r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data)),a=r.match(/xl\/worksheets\/sheet(\d+)[.]xml/);if(a){let e=parseInt(a[1],10);await this._processWorksheetEntry(i,n,e,t,r)}else switch(r){case`_rels/.rels`:n.globalRels=await this.parseRels(i);break;case`xl/workbook.xml`:{let e=await this.parseWorkbook(i);n.sheets=e.sheets,n.definedNames=e.definedNames,n.views=e.views,n.properties=e.properties,n.calcProperties=e.calcProperties,n.pivotCaches=e.pivotCaches;break}case`xl/sharedStrings.xml`:n.sharedStrings=new Ln,await n.sharedStrings.parseStream(i);break;case`xl/_rels/workbook.xml.rels`:n.workbookRels=await this.parseRels(i);break;case`docProps/app.xml`:{let e=await new Hn().parseStream(i);n.company=e.company,n.manager=e.manager;break}case`docProps/core.xml`:{let e=await new Mn().parseStream(i);Object.assign(n,e);break}case`xl/styles.xml`:n.styles=new An,await n.styles.parseStream(i);break;default:await this._processDefaultEntry(i,n,r)}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n){let r;if(r=n.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels/),r){let n=parseInt(r[1],10);await this._processWorksheetRelsEntry(e,t,n);return}if(r=n.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),r){await this._processMediaEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(drawing\d+)[.]xml/),r){await this._processDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels/),r){await this._processDrawingRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),r){await this._processVmlDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/comments(\d+)[.]xml/),r){await this._processCommentEntry(e,t,`comments${r[1]}`);return}if(r=n.match(/xl\/tables\/(table\d+)[.]xml/),r){await this._processTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),r){await this._processThemeEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/(pivotTable\d+)[.]xml/),r){await this._processPivotTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels/),r){await this._processPivotTableRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml/),r){await this._processPivotCacheDefinitionEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels/),r){await this._processPivotCacheDefinitionRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml/),r){await this._processPivotCacheRecordsEntry(e,t,r[1]);return}}async addContentTypes(e,t){let n=new zn().toXml(t);e.append(n,{name:`[Content_Types].xml`})}async addApp(e,t){let n=new Hn().toXml(t);e.append(n,{name:`docProps/app.xml`})}async addCore(e,t){let n=new Mn;e.append(n.toXml(t),{name:`docProps/core.xml`})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
119
|
+
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`};Object.keys(n).forEach(t=>{let r=n[t],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new K().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition${t.tableNumber}.xml`})}),n.worksheets.forEach((t,n)=>{t.rId=`rId${r++}`,t.fileIndex=n+1,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.fileIndex}.xml`})});let a=new K().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new er;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new mi,r=new K,i=new Ji,a=new na;t.worksheets.forEach((t,o)=>{let s=t.fileIndex||o+1,c=new I;n.render(c,t),e.append(c.xml,{name:`xl/worksheets/sheet${s}.xml`}),t.rels&&t.rels.length&&(c=new I,r.render(c,t.rels),e.append(c.xml,{name:`xl/worksheets/_rels/sheet${s}.xml.rels`})),t.comments.length>0&&(c=new I,i.render(c,t),e.append(c.xml,{name:`xl/comments${s}.xml`}),c=new I,a.render(c,t),e.append(c.xml,{name:`xl/drawings/vmlDrawing${s}.vml`}))})}addDrawings(e,t){let n=new ji,r=new K;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new Ri;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new zi,i=new Hi,a=new Ui,o=new K;n.pivotTables.forEach(n=>{let s=n.tableNumber;if(n.isLoaded){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`})}}else{let e=r.toXml(n);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`}),e=i.toXml(n),t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}let c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords${s}.xml`}]);t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition${s}.xml.rels`}),c=a.toXml(n),t.append(c,{name:`xl/pivotTables/pivotTable${s}.xml`}),c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition${s}.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable${s}.xml.rels`})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator||`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy||`ExcelTS`,e.created=e.created||new Date,e.modified=e.modified||new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Ln,e.styles=e.useStyles?new An(!0):new An.Mock;let n=new er,r=new mi;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}},ia=class{constructor(e){this.listeners=new Map,this.ended=!1,this.data=e}async*[Symbol.asyncIterator](){yield this.data}on(e,t){let n=this.listeners.get(e)||[];return n.push(t),this.listeners.set(e,n),this.ended||(this.ended=!0,queueMicrotask(()=>{this.emit(`data`,this.data),this.emit(`end`)})),this}removeListener(e,t){let n=this.listeners.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){(this.listeners.get(e)||[]).forEach(e=>e(...t))}pipe(e){return e.write(this.data instanceof Uint8Array?this.data:new TextEncoder().encode(this.data)),e.end(),e}},aa=class extends ra{createStreamBuf(){return new Gt}createBinaryStream(e){return new ia(e)}createTextStream(e){return new ia(e)}bufferToString(e){return je(e)}async load(e,t){let n;if(!e||typeof e==`object`&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);n=t&&t.base64?pe(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e);let r=await new At(n).extractAll(),i={};for(let[e,t]of r)i[e]=t;return this.loadFromFiles(i,t)}async writeBuffer(e){e||={};let{model:t}=this.workbook,n=new Jt(e.zip),r=new Gt;return n.pipe(r),this.prepareModel(t,e),await this.addContentTypes(n,t),await this.addOfficeRels(n,t),await this.addWorkbookRels(n,t),await this.addWorksheets(n,t),await this.addSharedStrings(n,t),this.addDrawings(n,t),this.addTables(n,t),this.addPivotTables(n,t),await Promise.all([this.addThemes(n,t),this.addStyles(n,t)]),await this.addMedia(n,t),await Promise.all([this.addApp(n,t),this.addCore(n,t)]),await this.addWorkbook(n,t),await this._finalize(n),me.from(r.read())}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}throw Error(`Loading images from filename is not supported in browser`)}throw Error(`Unsupported media`)}))}};const Z=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Q=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,oa=(e,t)=>(e.charCodeAt(t)-48)*1e3+(e.charCodeAt(t+1)-48)*100+(e.charCodeAt(t+2)-48)*10+e.charCodeAt(t+3)-48|0,sa=[0,31,29,31,30,31,30,31,31,30,31,30,31];function ca(e,t,n){if(t<1||t>12||n<1||n>sa[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function la(e,t,n,r,i,a){return t<1||t>12||n<1||n>sa[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function ua(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:ca(oa(e,0),Q(e,5),Q(e,8))}function da(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:la(oa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function fa(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:la(oa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function pa(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ma(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ha(e){let t=e.charCodeAt(19);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function ga(e){if(e.charCodeAt(19)!==46)return null;let t=e.charCodeAt(23);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function _a(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:ca(oa(e,6),Q(e,0),Q(e,3))}function va(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:ca(oa(e,6),Q(e,3),Q(e,0))}function ya(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:la(oa(e,6),Q(e,0),Q(e,3),Q(e,11),Q(e,14),Q(e,17))}function ba(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:la(oa(e,6),Q(e,3),Q(e,0),Q(e,11),Q(e,14),Q(e,17))}const xa={"YYYY-MM-DD":ua,"YYYY-MM-DD[T]HH:mm:ss":da,"YYYY-MM-DD HH:mm:ss":fa,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?pa(e):e.length===25?ha(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?ma(e):e.length===29?ga(e):null,"MM-DD-YYYY":_a,"MM-DD-YYYY HH:mm:ss":ya,"MM/DD/YYYY HH:mm:ss":ya,"DD-MM-YYYY":va,"DD-MM-YYYY HH:mm:ss":ba,"DD/MM/YYYY HH:mm:ss":ba},Sa=[[10,[ua]],[19,[da,fa]],[20,[pa]],[24,[ma]],[25,[ha]],[29,[ga]]];function Ca(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${Z[r]}:${Z[i]}`}var wa=class e{constructor(e){this.parse=e=>{if(!e)return null;let t=e.trim();if(!t)return null;if(this.single)return this.fn0(t);for(let e=0,n=this.fns.length;e<n;e++){let n=this.fns[e](t);if(n)return n}return null},this.fns=e,this.single=e.length===1,this.fn0=e[0]}static create(t){return new e(t.map(e=>xa[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of Sa)t.push(...e);return new e(t)}parseAll(e){let t=e.length,n=Array(t),r=this.parse;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}parseValid(e){let t=[],n=this.parse;for(let r=0,i=e.length;r<i;r++){let i=n(e[r]);i&&t.push(i)}return t}},Ta=class e{constructor(e){this.format=e=>this.fn(e),this.fn=e}static iso(t=!1){return t?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),a=e.getUTCHours(),o=e.getUTCMinutes(),s=e.getUTCSeconds(),c=e.getUTCMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}Z`}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=e.getHours(),o=e.getMinutes(),s=e.getSeconds(),c=e.getMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}${Ca(e)}`})}static create(t,n){let r=n?.utc??!1;if(t===`YYYY-MM-DD`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]}`:``});if(t===`YYYY-MM-DD HH:mm:ss`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]} ${Z[e.getUTCHours()]}:${Z[e.getUTCMinutes()]}:${Z[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]} ${Z[e.getHours()]}:${Z[e.getMinutes()]}:${Z[e.getSeconds()]}`:``});if(t===`MM-DD-YYYY`||t===`MM/DD/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCMonth()+1]}${n}${Z[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getMonth()+1]}${n}${Z[e.getDate()]}${n}${e.getFullYear()}`:``})}if(t===`DD-MM-YYYY`||t===`DD/MM/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCDate()]}${n}${Z[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getDate()]}${n}${Z[e.getMonth()+1]}${n}${e.getFullYear()}`:``})}return e.createGeneric(t,r)}static createGeneric(t,n){let r=[],i=t.replace(/\[([^\]]*)\]/g,(e,t)=>(r.push(t),`\x00${r.length-1}\x00`)),a=i.includes(`YYYY`),o=i.includes(`SSS`),s=i.includes(`MM`),c=i.includes(`DD`),l=i.includes(`HH`),u=i.includes(`mm`),d=i.includes(`ss`),f=i.includes(`Z`);return new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let p=i;if(a&&(p=p.replace(/YYYY/g,String(n?e.getUTCFullYear():e.getFullYear()))),o){let t=n?e.getUTCMilliseconds():e.getMilliseconds();p=p.replace(/SSS/g,t<10?`00${t}`:t<100?`0${t}`:String(t))}return s&&(p=p.replace(/MM/g,Z[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,Z[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,Z[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,Z[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,Z[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:Ca(e))),r.length&&(p=p.replace(/\x00(\d+)\x00/g,(e,t)=>r[+t])),p})}formatAll(e){let t=e.length,n=Array(t),r=this.fn;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}};function Ea(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Da(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function Oa(e,t,n,r){if(t)return e.trim();let i=e;return n&&(i=i.trimStart()),r&&(i=i.trimEnd()),i}function ka(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,ee=a||o,b=r!==null&&r!==!1,x=b?String(r):``,S=i!==null&&i!==!1?String(i):``,te=[],C=[],w=[],T=``,ne=!1,E=0,re=0,ie=0,ae=0,D=null,O=0,k=!1,A=!1;u===!0?k=!0:Array.isArray(u)?(D=u,O=u.filter(e=>e!=null).length,Da(u),k=!0,d||(A=!0)):typeof u==`function`&&(k=!0),e=e.replace(/\r\n/g,`
|
|
122
120
|
`).replace(/\r/g,`
|
|
123
|
-
`);let
|
|
124
|
-
`){if(
|
|
125
|
-
`,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m}=t,h=u??!0,g=r!==!1&&r!==null,_=g?String(r):``,v=i!==void 0&&i!==!1&&i!==null?String(i):_,y=[],b=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},x=(e,t,r,i=!1)=>{if(e==null)return``;let a=String(e);if(!g)return a;let s=o||b(t,r,i),c=RegExp(`[${ha(n)}${ha(_)}\r\n]`);return s||c.test(a)?_+a.replace(new RegExp(ha(_),`g`),v+_)+_:a},S=(e,t,r=!1)=>e.map((e,n)=>x(e,n,t?.[n],r)).join(n),C=null,w=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;C=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,C&&h&&y.push(S(C,C,!0));for(let e of t){let t=w(e);if(t==null)continue;let n=C?C.map(e=>t[e]):Object.values(t);y.push(S(n,C??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(C=l,h&&y.push(S(l,l,!0)));for(let e of t){let t=w(e);t!=null&&y.push(S(t,C??void 0))}}else p&&Array.isArray(l)&&h&&y.push(S(l,l,!0));let T=y.join(a);return T.length>0&&f&&(T+=a),d&&(T=``+T),T}ma.default.extend(pa.default),ma.default.extend(fa.default);const ba={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function xa(e){return function(t){if(t===``)return null;let n=Number(t);if(!Number.isNaN(n)&&n!==1/0)return n;let r=e.reduce((e,n)=>{if(e)return e;let r=(0,ma.default)(t,n,!0);return r.isValid()?r:null},null);if(r)return new Date(r.valueOf());let i=ba[t];return i===void 0?t:i}}function Sa(e,t){return function(n){if(n){if(n.text||n.hyperlink)return n.hyperlink||n.text||``;if(n.formula||n.result)return n.result||``;if(n instanceof Date)return e?t?ma.default.utc(n).format(e):(0,ma.default)(n).format(e):t?ma.default.utc(n).format():(0,ma.default)(n).format();if(n.error)return n.error;if(typeof n==`object`)return JSON.stringify(n)}return n}}function Ca(e,t,n={}){let r=t.addWorksheet(n.sheetName),i=n.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],a=n.map||xa(i),o=va(e,n.parserOptions);for(let e of o)r.addRow(e.map(a));return r}function wa(e,t={}){if(!e)return``;let{dateFormat:n,dateUTC:r}=t,i=t.map||Sa(n,r),a=t.includeEmptyRows!==!1,o=[],s=1;return e.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),ya(o,t.formatterOptions)}var Ta=class{constructor(e){this.workbook=e}load(e,t){let n;if(typeof e==`string`)n=e;else if(e instanceof ArrayBuffer)n=new TextDecoder(`utf-8`).decode(e);else if(e instanceof Uint8Array)n=new TextDecoder(`utf-8`).decode(e);else throw Error(`Invalid data type. Expected string, ArrayBuffer, or Uint8Array.`);return Ca(n,this.workbook,t)}writeString(e){return wa(this.workbook.getWorksheet(e?.sheetName||e?.sheetId),e)}writeBuffer(e){let t=this.writeString(e);return new TextEncoder().encode(t)}async readFile(e,t){throw Error(`CSV.readFile() is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async read(e,t){throw Error(`CSV.read() stream is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async writeFile(e,t){throw Error(`CSV.writeFile() is not available in browser. Use CSV.writeString() or CSV.writeBuffer() and handle download manually.`)}write(e,t){throw Error(`CSV.write() stream is not available in browser. Use CSV.writeString() or CSV.writeBuffer() instead.`)}},Ea=class extends et{get xlsx(){return this._xlsx||=new la(this),this._xlsx}get csv(){return this._csv||=new Ta(this),this._csv}static createStreamWriter(e){throw Error("Streaming workbook writer is not available in browser. Use `new Workbook()` with `xlsx.writeBuffer()` instead, or import from 'excelts' (Node.js) for streaming support.")}static createStreamReader(e,t){throw Error("Streaming workbook reader is not available in browser. Use `new Workbook()` with `xlsx.load()` instead, or import from 'excelts' (Node.js) for streaming support.")}};let Da=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function Oa(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function ka(e){if(e.length<=3)return e;let t=e.length%3,n=e.substring(0,t);for(let r=t;r<e.length;r+=3)n+=(n.length>0?`,`:``)+e.substring(r,r+3);return n}function Aa(e,t){let n=10**t;return Math.round(e*n)/n}function ja(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function Ma(e){return/^General$/i.test(e.trim())}function Na(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}const Pa=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Fa=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ia=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],La=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ra=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function za(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=ke(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=ja(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,Ia[c]).replace(/\x00MN4\x00/g,Fa[c]).replace(/\x00MN3\x00/g,Pa[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,Ra[u]).replace(/\x00DN3\x00/g,La[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function Ba(e){return typeof e==`boolean`?e?`TRUE`:`FALSE`:typeof e==`string`?e:Number.isInteger(e)?e.toString():e.toPrecision(11).replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)}function Va(e,t){let n=(t.match(/%/g)||[]).length;return Ka(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function Ha(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(r===0){let e=t.match(/\.([0#]+)E/i),n=e?e[1].length:2;return`0.`+`0`.repeat(n)+`E+00`}let i=t.match(/\.([0#]+)E/i),a=i?i[1].length:2,o=t.includes(`E+`),s=Math.floor(Math.log10(r)),c=Aa(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=Oa(Math.abs(s),2);return n+c+`E`+l+u}function Ua(e,t){let n=e<0?-1:1,r=Math.abs(e),i=Math.floor(r);if(r-=i,r<1e-10)return[n*i,0,1];let a=0,o=1,s=1,c=0,l=Math.floor(r),u=l,d=1;for(;c<t&&(l=Math.floor(r),u=l*o+a,d=l*c+s,!(r-l<1e-10));)r=1/(r-l),a=o,o=u,s=c,c=d;return d>t&&(d=c,u=o),[n*i,n*u,d]}function Wa(e,t){let n=e<0?`-`:``,r=Math.abs(e),i=t.match(/\?+\s*\/\s*(\d+)/);if(i){let e=parseInt(i[1],10),a=Math.floor(r),o=r-a,s=Math.round(o*e);return t.includes(`#`)||t.includes(`0`)?s===0?n+a.toString():n+(a>0?a+` `:``)+s+`/`+e:n+(a*e+s)+`/`+e}let a=t.match(/\/\s*(\?+)/),[o,s,c]=Ua(r,10**(a?a[1].length:2)-1);return t.includes(`#`)&&o!==0?s===0?n+Math.abs(o).toString():n+Math.abs(o)+` `+Math.abs(s)+`/`+c:s===0?o===0?`0`:n+Math.abs(o).toString():n+(Math.abs(o)*c+Math.abs(s))+`/`+c}function Ga(e,t){let n=Math.round(e*86400),r=Math.floor(n/60),i=Math.floor(r/60),a=n%60,o=r%60,s=i,c=t;return/\[h+\]/i.test(c)&&(c=c.replace(/\[h+\]/gi,s.toString())),/\[m+\]/i.test(c)&&(c=c.replace(/\[m+\]/gi,r.toString())),/\[s+\]/i.test(c)&&(c=c.replace(/\[s+\]/gi,n.toString())),c=c.replace(/mm/gi,o.toString().padStart(2,`0`)),c=c.replace(/ss/gi,a.toString().padStart(2,`0`)),c}function Ka(e,t){let n=Math.abs(e),r=e<0?`-`:``,i=0,a=t;for(;a.endsWith(`,`);)i++,a=a.slice(0,-1);let o=n/1e3**i,s=a.indexOf(`.`),c=a,l=``;s!==-1&&(c=a.substring(0,s),l=a.substring(s+1));let u=l.replace(/[^0#?]/g,``).length,[d,f=``]=Aa(o,u).toString().split(`.`),p=/[0#?][^0#?,.\s][0#?]/.test(c),m;if(p){let e=c.replace(/[^0#?]/g,``).length,t=d;t.length<e&&(t=`0`.repeat(e-t.length)+t),m=``;let n=t.length-e;for(let e=0;e<c.length;e++){let r=c[e];r===`0`||r===`#`||r===`?`?n<t.length&&(m+=t[n],n++):r!==`,`&&(m+=r)}}else{m=d,c.includes(`,`)&&(m=ka(d));let e=(c.match(/0/g)||[]).length;m.length<e&&(m=`0`.repeat(e-m.length)+m)}let h=``;return u>0&&(h=`.`+(f+`0`.repeat(u)).substring(0,u)),r+m+h}function qa(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)t+=e[n],n++;n++}else e[n]===`\\`&&n+1<e.length?(n++,t+=e[n],n++):(t+=e[n],n++);return t}function Ja(e,t){let n=t.match(/\[(=|>|<|>=|<=|<>)(-?\d+(?:\.\d*)?)\]/);if(!n)return!1;let r=n[1],i=parseFloat(n[2]);switch(r){case`=`:return e===i;case`>`:return e>i;case`<`:return e<i;case`>=`:return e>=i;case`<=`:return e<=i;case`<>`:return e!==i;default:return!1}}function Ya(e,t){if(typeof t==`string`){let n=Za(e);return n.length>=4&&n[3]?qa(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=Za(e),r=/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/;if((n[0]&&r.test(n[0])||n[1]&&r.test(n[1]))&&n.length>=2){for(let e=0;e<Math.min(n.length,2);e++){let r=n[e].match(/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/);if(r&&Ja(t,r[0]))return n[e]}return n[n.length>2?2:1]}return n.length===1?n[0]:n.length===2?t>=0?n[0]:n[1]:t>0?n[0]:t<0?n[1]:n[2]||n[0]}function Xa(e,t){let n=Za(e);return n.length>=2&&n[1]===t}function Za(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}function Qa(e,t){if(t==null)return``;if(Ma(e))return Ba(t);if(typeof t==`string`)return Ya(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=Ya(e,n);n<0&&Xa(e,r)&&(n=Math.abs(n));let i=r.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);if(i=i.replace(/\[(>|<|>=|<=|=|<>)-?\d+(\.\d+)?\]/g,``),i=i.replace(/\[\$[^\]]*\]/g,``),i=ja(i),i=qa(i),/\[[hms]+\]/i.test(i))return Ga(n,i);if(Na(i))return za(n,i);if(i.includes(`%`))return Va(n,i);if(/E[+-]?/i.test(i))return Ha(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return Wa(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+Ka(-n,e)+`)`}if(i===`@`)return n.toString();let a=``,o=``,s=i.match(/^([^#0?.,]+)/);s&&(a=s[1],i=i.substring(s[0].length));let c=i.match(/([^#0?.,]+)$/);c&&!c[1].includes(`%`)&&(o=c[1],i=i.substring(0,i.length-c[0].length));let l=Ka(n,i);return a+l+o}function $a(e){return e.getTime()/(24*3600*1e3)+25569}function eo(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function to(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function no(e,t,n){if(e instanceof Date){let r=$a(e);return eo(t)?(r%=1,r<0&&(r+=1),Qa(t,r)):Qa(n&&to(t)?n:t,r)}return Qa(t,e)}function ro(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return no(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return no(e,i,t)}return e.text}function io(e){return u.l2n(e.toUpperCase())-1}function ao(e){return u.n2l(e+1)}function oo(e){return parseInt(e,10)-1}function so(e){return String(e+1)}function co(e){let t=u.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function lo(e){return u.encodeAddress(e.r+1,e.c+1)}function uo(e){let t=e.indexOf(`:`);if(t===-1){let t=co(e);return{s:t,e:{...t}}}return{s:co(e.slice(0,t)),e:co(e.slice(t+1))}}function fo(e,t){if(t===void 0){let t=e;return fo(t.s,t.e)}let n=lo(e),r=lo(t);return n===r?n:`${n}:${r}`}function po(e,t){let n=t||{},r=new Ea().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function mo(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=co(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function ho(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=uo(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?ro(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?ro(a,n.dateFormat).trim():a.value,s=ao(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?ro(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?ro(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function go(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
|
|
121
|
+
`);let oe=e=>{if(k&&!A){if(typeof u==`function`){let t=u(e);Da(t),D=t}else Array.isArray(u)||(Da(e),D=e);return O=D.filter(e=>e!=null).length,A=!0,!1}if(ae<h)return ae++,!1;if(D&&D.length>0){let t=O,n=e.length;if(n>t){if(g&&!_)return C.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=D.length}else if(n<t){if(g)return C.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<D.length;)e.push(``)}}return!0};for(;E<e.length;){let t=e[E],r=e[E+1];if(ne&&b)S&&t===S&&r===x?(T+=x,E+=2):t===x?(ne=!1,E++):(T+=t,E++);else if(b&&t===x&&T===``)ne=!0,E++;else if(t===n)w.push(Oa(T,s,c,l)),T=``,E++;else if(t===`
|
|
122
|
+
`){if(w.push(Oa(T,s,c,l)),T=``,re++,re<=m){w=[],E++;continue}if(f&&w[0]?.startsWith(f)){w=[],E++;continue}let e=w.length===1&&w[0]===``;if(ee&&e){w=[],E++;continue}if(oe(w)&&(te.push(w),ie++),w=[],E++,p!==void 0&&ie>=p)break}else T+=t,E++}if((T!==``||w.length>0)&&(w.push(Oa(T,s,c,l)),re>=m&&!(f&&w[0]?.startsWith(f)))){let e=w.length===1&&w[0]===``;ee&&e||p!==void 0&&ie>=p||oe(w)&&te.push(w)}if(k&&D){let e=te.map(e=>{let t={};return D.forEach((n,r)=>{n!=null&&(t[n]=e[r]??``)}),t});if(v&&(e=e.map(e=>v(e)).filter(e=>e!=null)),y){let t=[];for(let n of e){let e=y(n);typeof e==`boolean`?e?t.push(n):C.push({row:Object.values(n),reason:`Validation failed`}):e.isValid?t.push(n):C.push({row:Object.values(n),reason:e.reason||`Validation failed`})}e=t}return(g||y)&&C.length>0?{headers:D.filter(e=>e!=null),rows:e,invalidRows:C}:{headers:D.filter(e=>e!=null),rows:e}}let j=te;if(v&&(j=j.map(e=>v(e)).filter(e=>e!=null)),y){let e=[],t=[];for(let n of j){let r=y(n);typeof r==`boolean`?r?e.push(n):t.push({row:n,reason:`Validation failed`}):r.isValid?e.push(n):t.push({row:n,reason:r.reason||`Validation failed`})}if(j=e,t.length>0)return{rows:j,invalidRows:t}}return j}function Aa(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i,rowDelimiter:a=`
|
|
123
|
+
`,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m}=t,h=u??!0,g=r!==!1&&r!==null,_=g?String(r):``,v=i!==void 0&&i!==!1&&i!==null?String(i):_,y=[],ee=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},b=(e,t,r,i=!1)=>{if(e==null)return``;let a=String(e);if(!g)return a;let s=o||ee(t,r,i),c=RegExp(`[${Ea(n)}${Ea(_)}\r\n]`);return s||c.test(a)?_+a.replace(new RegExp(Ea(_),`g`),v+_)+_:a},x=(e,t,r=!1)=>e.map((e,n)=>b(e,n,t?.[n],r)).join(n),S=null,te=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;S=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,S&&h&&y.push(x(S,S,!0));for(let e of t){let t=te(e);if(t==null)continue;let n=S?S.map(e=>t[e]):Object.values(t);y.push(x(n,S??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(S=l,h&&y.push(x(l,l,!0)));for(let e of t){let t=te(e);t!=null&&y.push(x(t,S??void 0))}}else p&&Array.isArray(l)&&h&&y.push(x(l,l,!0));let C=y.join(a);return C.length>0&&f&&(C+=a),d&&(C=``+C),C}const ja={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function Ma(e){let t=wa.create(e);return function(e){if(e===``)return null;let n=Number(e);if(!Number.isNaN(n)&&n!==1/0)return n;let r=t.parse(e);if(r)return r;let i=ja[e];return i===void 0?e:i}}function Na(e,t){let n=e?Ta.create(e,{utc:t}):Ta.iso(t);return function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink||e.text||``;if(e.formula||e.result)return e.result||``;if(e instanceof Date)return n.format(e);if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}}function Pa(e,t,n={}){let r=t.addWorksheet(n.sheetName),i=n.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`YYYY-MM-DD`],a=n.map||Ma(i),o=ka(e,n.parserOptions);for(let e of o)r.addRow(e.map(a));return r}function Fa(e,t={}){if(!e)return``;let{dateFormat:n,dateUTC:r}=t,i=t.map||Na(n,r),a=t.includeEmptyRows!==!1,o=[],s=1;return e.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),Aa(o,t.formatterOptions)}var Ia=class{constructor(e){this.workbook=e}load(e,t){let n;if(typeof e==`string`)n=e;else if(e instanceof ArrayBuffer)n=new TextDecoder(`utf-8`).decode(e);else if(e instanceof Uint8Array)n=new TextDecoder(`utf-8`).decode(e);else throw Error(`Invalid data type. Expected string, ArrayBuffer, or Uint8Array.`);return Pa(n,this.workbook,t)}writeString(e){return Fa(this.workbook.getWorksheet(e?.sheetName||e?.sheetId),e)}writeBuffer(e){let t=this.writeString(e);return new TextEncoder().encode(t)}async readFile(e,t){throw Error(`CSV.readFile() is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async read(e,t){throw Error(`CSV.read() stream is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async writeFile(e,t){throw Error(`CSV.writeFile() is not available in browser. Use CSV.writeString() or CSV.writeBuffer() and handle download manually.`)}write(e,t){throw Error(`CSV.write() stream is not available in browser. Use CSV.writeString() or CSV.writeBuffer() instead.`)}},La=class extends qe{get xlsx(){return this._xlsx||=new aa(this),this._xlsx}get csv(){return this._csv||=new Ia(this),this._csv}static createStreamWriter(e){throw Error("Streaming workbook writer is not available in browser. Use `new Workbook()` with `xlsx.writeBuffer()` instead, or import from 'excelts' (Node.js) for streaming support.")}static createStreamReader(e,t){throw Error("Streaming workbook reader is not available in browser. Use `new Workbook()` with `xlsx.load()` instead, or import from 'excelts' (Node.js) for streaming support.")}};let Ra=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function za(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function Ba(e){if(e.length<=3)return e;let t=e.length%3,n=e.substring(0,t);for(let r=t;r<e.length;r+=3)n+=(n.length>0?`,`:``)+e.substring(r,r+3);return n}function Va(e,t){let n=10**t;return Math.round(e*n)/n}function Ha(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function Ua(e){return/^General$/i.test(e.trim())}function Wa(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}const Ga=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Ka=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],qa=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],Ja=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ya=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Xa(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=Ce(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=Ha(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,qa[c]).replace(/\x00MN4\x00/g,Ka[c]).replace(/\x00MN3\x00/g,Ga[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,Ya[u]).replace(/\x00DN3\x00/g,Ja[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function Za(e){return typeof e==`boolean`?e?`TRUE`:`FALSE`:typeof e==`string`?e:Number.isInteger(e)?e.toString():e.toPrecision(11).replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)}function Qa(e,t){let n=(t.match(/%/g)||[]).length;return ro(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function $a(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(r===0){let e=t.match(/\.([0#]+)E/i),n=e?e[1].length:2;return`0.`+`0`.repeat(n)+`E+00`}let i=t.match(/\.([0#]+)E/i),a=i?i[1].length:2,o=t.includes(`E+`),s=Math.floor(Math.log10(r)),c=Va(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=za(Math.abs(s),2);return n+c+`E`+l+u}function eo(e,t){let n=e<0?-1:1,r=Math.abs(e),i=Math.floor(r);if(r-=i,r<1e-10)return[n*i,0,1];let a=0,o=1,s=1,c=0,l=Math.floor(r),u=l,d=1;for(;c<t&&(l=Math.floor(r),u=l*o+a,d=l*c+s,!(r-l<1e-10));)r=1/(r-l),a=o,o=u,s=c,c=d;return d>t&&(d=c,u=o),[n*i,n*u,d]}function to(e,t){let n=e<0?`-`:``,r=Math.abs(e),i=t.match(/\?+\s*\/\s*(\d+)/);if(i){let e=parseInt(i[1],10),a=Math.floor(r),o=r-a,s=Math.round(o*e);return t.includes(`#`)||t.includes(`0`)?s===0?n+a.toString():n+(a>0?a+` `:``)+s+`/`+e:n+(a*e+s)+`/`+e}let a=t.match(/\/\s*(\?+)/),[o,s,c]=eo(r,10**(a?a[1].length:2)-1);return t.includes(`#`)&&o!==0?s===0?n+Math.abs(o).toString():n+Math.abs(o)+` `+Math.abs(s)+`/`+c:s===0?o===0?`0`:n+Math.abs(o).toString():n+(Math.abs(o)*c+Math.abs(s))+`/`+c}function no(e,t){let n=Math.round(e*86400),r=Math.floor(n/60),i=Math.floor(r/60),a=n%60,o=r%60,s=i,c=t;return/\[h+\]/i.test(c)&&(c=c.replace(/\[h+\]/gi,s.toString())),/\[m+\]/i.test(c)&&(c=c.replace(/\[m+\]/gi,r.toString())),/\[s+\]/i.test(c)&&(c=c.replace(/\[s+\]/gi,n.toString())),c=c.replace(/mm/gi,o.toString().padStart(2,`0`)),c=c.replace(/ss/gi,a.toString().padStart(2,`0`)),c}function ro(e,t){let n=Math.abs(e),r=e<0?`-`:``,i=0,a=t;for(;a.endsWith(`,`);)i++,a=a.slice(0,-1);let o=n/1e3**i,s=a.indexOf(`.`),c=a,l=``;s!==-1&&(c=a.substring(0,s),l=a.substring(s+1));let u=l.replace(/[^0#?]/g,``).length,[d,f=``]=Va(o,u).toString().split(`.`),p=/[0#?][^0#?,.\s][0#?]/.test(c),m;if(p){let e=c.replace(/[^0#?]/g,``).length,t=d;t.length<e&&(t=`0`.repeat(e-t.length)+t),m=``;let n=t.length-e;for(let e=0;e<c.length;e++){let r=c[e];r===`0`||r===`#`||r===`?`?n<t.length&&(m+=t[n],n++):r!==`,`&&(m+=r)}}else{m=d,c.includes(`,`)&&(m=Ba(d));let e=(c.match(/0/g)||[]).length;m.length<e&&(m=`0`.repeat(e-m.length)+m)}let h=``;return u>0&&(h=`.`+(f+`0`.repeat(u)).substring(0,u)),r+m+h}function io(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)t+=e[n],n++;n++}else e[n]===`\\`&&n+1<e.length?(n++,t+=e[n],n++):(t+=e[n],n++);return t}function ao(e,t){let n=t.match(/\[(=|>|<|>=|<=|<>)(-?\d+(?:\.\d*)?)\]/);if(!n)return!1;let r=n[1],i=parseFloat(n[2]);switch(r){case`=`:return e===i;case`>`:return e>i;case`<`:return e<i;case`>=`:return e>=i;case`<=`:return e<=i;case`<>`:return e!==i;default:return!1}}function oo(e,t){if(typeof t==`string`){let n=co(e);return n.length>=4&&n[3]?io(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=co(e),r=/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/;if((n[0]&&r.test(n[0])||n[1]&&r.test(n[1]))&&n.length>=2){for(let e=0;e<Math.min(n.length,2);e++){let r=n[e].match(/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/);if(r&&ao(t,r[0]))return n[e]}return n[n.length>2?2:1]}return n.length===1?n[0]:n.length===2?t>=0?n[0]:n[1]:t>0?n[0]:t<0?n[1]:n[2]||n[0]}function so(e,t){let n=co(e);return n.length>=2&&n[1]===t}function co(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}function lo(e,t){if(t==null)return``;if(Ua(e))return Za(t);if(typeof t==`string`)return oo(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=oo(e,n);n<0&&so(e,r)&&(n=Math.abs(n));let i=r.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);if(i=i.replace(/\[(>|<|>=|<=|=|<>)-?\d+(\.\d+)?\]/g,``),i=i.replace(/\[\$[^\]]*\]/g,``),i=Ha(i),i=io(i),/\[[hms]+\]/i.test(i))return no(n,i);if(Wa(i))return Xa(n,i);if(i.includes(`%`))return Qa(n,i);if(/E[+-]?/i.test(i))return $a(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return to(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+ro(-n,e)+`)`}if(i===`@`)return n.toString();let a=``,o=``,s=i.match(/^([^#0?.,]+)/);s&&(a=s[1],i=i.substring(s[0].length));let c=i.match(/([^#0?.,]+)$/);c&&!c[1].includes(`%`)&&(o=c[1],i=i.substring(0,i.length-c[0].length));let l=ro(n,i);return a+l+o}function uo(e){return e.getTime()/(24*3600*1e3)+25569}function fo(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function po(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function mo(e,t,n){if(e instanceof Date){let r=uo(e);return fo(t)?(r%=1,r<0&&(r+=1),lo(t,r)):lo(n&&po(t)?n:t,r)}return lo(t,e)}function ho(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return mo(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return mo(e,i,t)}return e.text}function go(e){return t.l2n(e.toUpperCase())-1}function _o(e){return t.n2l(e+1)}function vo(e){return parseInt(e,10)-1}function yo(e){return String(e+1)}function $(e){let n=t.decodeAddress(e.toUpperCase());return{c:n.col-1,r:n.row-1}}function bo(e){return t.encodeAddress(e.r+1,e.c+1)}function xo(e){let t=e.indexOf(`:`);if(t===-1){let t=$(e);return{s:t,e:{...t}}}return{s:$(e.slice(0,t)),e:$(e.slice(t+1))}}function So(e,t){if(t===void 0){let t=e;return So(t.s,t.e)}let n=bo(e),r=bo(t);return n===r?n:`${n}:${r}`}function Co(e,t){let n=t||{},r=new La().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function wo(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=$(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function To(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=xo(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?ho(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?ho(a,n.dateFormat).trim():a.value,s=_o(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?ho(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?ho(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function Eo(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
|
|
126
124
|
`,a=[];return e.eachRow({includeEmpty:n.blankrows!==!1},(t,i)=>{let o=[],s=!0;for(t.eachCell({includeEmpty:!0},(e,t)=>{let i=``;e.value!=null&&(i=e.value instanceof Date?e.value.toISOString():typeof e.value==`object`?`result`in e.value?String(e.value.result??``):`text`in e.value?String(e.value.text??``):`richText`in e.value?e.value.richText.map(e=>e.text).join(``):String(e.value):String(e.value),s=!1),(n.forceQuotes||i.includes(r)||i.includes(`"`)||i.includes(`
|
|
127
|
-
`)||i.includes(`\r`))&&(i=`"${i.replace(/"/g,`""`)}"`),o.push(i)});o.length<e.columnCount;)o.push(``);(!s||n.blankrows!==!1)&&a.push(o.join(r))}),a.join(i)}function
|
|
125
|
+
`)||i.includes(`\r`))&&(i=`"${i.replace(/"/g,`""`)}"`),o.push(i)});o.length<e.columnCount;)o.push(``);(!s||n.blankrows!==!1)&&a.push(o.join(r))}),a.join(i)}function Do(){return new La}function Oo(e,t,n){let r=e.addWorksheet(n);t.eachRow({includeEmpty:!0},(e,t)=>{e.eachCell({includeEmpty:!0},(e,n)=>{let i=r.getCell(t,n);i.value=e.value,e.style&&(i.style=e.style)})}),t.columns?.forEach((e,t)=>{e&&r.columns[t]&&e.width&&(r.getColumn(t+1).width=e.width)})}function ko(e,t){let n=new La().addWorksheet(`Sheet1`);if(e.length===0)return n;let r=1,i=1;if(t?.origin!==void 0)if(typeof t.origin==`string`){let e=$(t.origin);r=e.r+1,i=e.c+1}else typeof t.origin==`number`?r=t.origin+1:(r=t.origin.r+1,i=t.origin.c+1);return e.forEach((e,t)=>{e&&e.forEach((e,a)=>{e!=null&&(n.getCell(r+t,i+a).value=e)})}),n}function Ao(e,t,n){if(t.length===0)return e;let r=1,i=1;if(n?.origin!==void 0)if(typeof n.origin==`string`){let e=$(n.origin);r=e.r+1,i=e.c+1}else typeof n.origin==`number`?r=n.origin===-1?e.rowCount+1:n.origin+1:(r=n.origin.r+1,i=n.origin.c+1);return t.forEach((t,n)=>{t&&t.forEach((t,a)=>{t!=null&&(e.getCell(r+n,i+a).value=t)})}),e}function jo(e){let t=[];return e.eachRow({includeEmpty:!0},(e,n)=>{let r=[];e.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),t[n-1]=r}),t}const Mo={decodeCol:go,encodeCol:_o,decodeRow:vo,encodeRow:yo,decodeCell:$,encodeCell:bo,decodeRange:xo,encodeRange:So,jsonToSheet:Co,sheetAddJson:wo,sheetToJson:To,sheetToCsv:Eo,aoaToSheet:ko,sheetAddAoa:Ao,sheetToAoa:jo,bookNew:Do,bookAppendSheet:Oo};export{se as Anchor,b as Cell,A as Column,de as DataValidations,o as DocumentType,l as Enums,c as ErrorValue,i as FormulaType,ce as Image,Ra as PaperSize,n as Range,s as ReadingOrder,a as RelationshipType,k as Row,ue as Table,r as ValueType,La as Workbook,Ve as Worksheet,ko as aoaToSheet,Oo as bookAppendSheet,Do as bookNew,$ as decodeCell,go as decodeCol,xo as decodeRange,vo as decodeRow,bo as encodeCell,_o as encodeCol,So as encodeRange,yo as encodeRow,Co as jsonToSheet,Ao as sheetAddAoa,wo as sheetAddJson,jo as sheetToAoa,Eo as sheetToCsv,To as sheetToJson,Mo as utils};
|