@cj-tech-master/excelts 5.1.5 → 5.1.6
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/dist/browser/modules/excel/xlsx/xlsx.browser.js +2 -2
- package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +2 -2
- package/dist/esm/modules/excel/xlsx/xlsx.browser.js +2 -2
- package/dist/iife/excelts.iife.js +3 -3
- package/dist/iife/excelts.iife.js.map +1 -1
- package/dist/iife/excelts.iife.min.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v5.1.
|
|
2
|
+
* @cj-tech-master/excelts v5.1.6
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2026 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
@@ -29,7 +29,7 @@ var ExcelTS=(function(e){let t=/^[A-Z]+\d+$/,n={_dictionary:`ABCDEFGHIJKLMNOPQRS
|
|
|
29
29
|
</r>`)}return n.join(``)}renderCellNew(e,t){if(e==null||typeof e==`number`&&!Number.isFinite(e)){if(t===null)return`<m />`;let e=t.indexOf(null);return e>=0?`<x v="${e}" />`:`<m />`}if(t===null)return e instanceof pt?`<e v="${A(e.code)}" />`:typeof e==`boolean`?`<b v="${e?`1`:`0`}" />`:e instanceof Date?`<d v="${Wa(e)}" />`:Number.isFinite(e)?`<n v="${e}" />`:`<s v="${A(String(e))}" />`;let n=Za(t,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();let e={};for(let[t,r]of Object.entries(n))Ya.has(t)||(e[t]=String(r));this.model={records:[],count:parseInt(n.count??`0`,10),isLoaded:!0,extraRootAttrs:Object.keys(e).length>0?e:void 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&&(n.v===void 0||n.v===``?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`n`,value:parseFloat(n.v)}));break;case`s`:this.currentRecord&&this.currentRecord.push({type:`s`,value: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`:if(this.currentRecord)if(!n.v)this.currentRecord.push({type:`m`});else{let e=Ee(n.v);isNaN(e.getTime())?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`d`,value:e})}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}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`}}};function Za(e,t){if(t instanceof Date){let n=t.getTime();for(let t=0;t<e.length;t++){let r=e[t];if(r instanceof Date&&r.getTime()===n)return t}return-1}if(t instanceof pt){for(let n=0;n<e.length;n++){let r=e[n];if(r instanceof pt&&r.code===t.code)return n}return-1}return e.indexOf(t)}var Qa=class{constructor(e){this.active=!1,this.depth=0,this.buffer=[],this.lastOpenIndex=-1,this.rootTag=e}start(e){this.active=!0,this.depth=0;let t=$a(e);this.buffer=[`<${this.rootTag}${t?` `+t:``}>`]}startAs(e,t){this.rootTag=e,this.start(t)}reset(){this.active=!1,this.depth=0,this.buffer.length=0,this.lastOpenIndex=-1}feedOpen(e,t){let n=$a(t);this.buffer.push(`<${e}${n?` `+n:``}>`),this.depth++,this.lastOpenIndex=this.buffer.length-1}feedText(e){this.buffer.push(A(e)),this.lastOpenIndex=-1}feedClose(e){if(e===this.rootTag&&this.depth===0)return this.buffer.push(`</${e}>`),this.active=!1,this.lastOpenIndex=-1,!0;if(this.depth>0&&this.depth--,this.lastOpenIndex>=0&&this.lastOpenIndex===this.buffer.length-1){let e=this.buffer[this.lastOpenIndex];return this.buffer[this.lastOpenIndex]=e.slice(0,-1)+` />`,this.lastOpenIndex=-1,!1}return this.lastOpenIndex=-1,this.buffer.push(`</${e}>`),!1}get result(){return this.buffer.join(``)}};function $a(e){if(!e)return``;let t=Object.entries(e);return t.length===0?``:t.filter(([,e])=>e!=null).map(([e,t])=>`${e}="${A(String(t))}"`).join(` `)}let eo=new Set([`name`,`numFmtId`]);var to=class extends L{constructor(){super(),this.inSharedItems=!1,this.fieldGroupCollector=new Qa(`fieldGroup`),this.model=null}get tag(){return`cacheField`}reset(){this.model=null,this.inSharedItems=!1,this.fieldGroupCollector.reset()}parseOpen(e){let{name:t,attributes:n}=e;if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedOpen(t,n),!0;switch(t){case`cacheField`:{let e={};for(let[t,r]of Object.entries(n))eo.has(t)||(e[t]=String(r));this.model={name:n.name??``,sharedItems:null,numFmtId:n.numFmtId,isLoaded:!0,extraAttrs:Object.keys(e).length>0?e:void 0};break}case`fieldGroup`:this.model&&this.fieldGroupCollector.start(n);break;case`sharedItems`:if(this.inSharedItems=!0,this.model){if(n.containsNumber!==void 0&&(this.model.containsNumber=n.containsNumber),n.containsInteger!==void 0&&(this.model.containsInteger=n.containsInteger),n.minValue!==void 0){let e=parseFloat(n.minValue);Number.isFinite(e)&&(this.model.minValue=e)}if(n.maxValue!==void 0){let e=parseFloat(n.maxValue);Number.isFinite(e)&&(this.model.maxValue=e)}n.containsSemiMixedTypes!==void 0&&(this.model.containsSemiMixedTypes=n.containsSemiMixedTypes),n.containsNonDate!==void 0&&(this.model.containsNonDate=n.containsNonDate),n.containsString!==void 0&&(this.model.containsString=n.containsString),n.containsBlank!==void 0&&(this.model.containsBlank=n.containsBlank),n.containsDate!==void 0&&(this.model.containsDate=n.containsDate),n.containsMixedTypes!==void 0&&(this.model.containsMixedTypes=n.containsMixedTypes),this.model.sharedItems=[]}break;case`s`:case`n`:case`b`:case`e`:case`m`:case`d`:this.inSharedItems&&this.model&&this.model.sharedItems!==null&&this.model.sharedItems.push(no(t,n));break}return!0}parseText(e){this.fieldGroupCollector.active&&this.fieldGroupCollector.feedText(e)}parseClose(e){if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedClose(e)&&(this.model&&(this.model.fieldGroupXml=this.fieldGroupCollector.result),this.fieldGroupCollector.reset()),!0;switch(e){case`cacheField`:return!1;case`sharedItems`:this.inSharedItems=!1;break}return!0}};function no(e,t){switch(e){case`s`:return t.v??``;case`n`:return t.v===void 0||t.v===``?null:parseFloat(t.v);case`b`:return t.v===`1`;case`e`:return new pt(t.v??``);case`m`:return null;case`d`:{if(!t.v)return null;let e=Ee(t.v);return isNaN(e.getTime())?null:e}default:return null}}let ro=new Set([`xmlns`,`xmlns:r`,`r:id`,`refreshOnLoad`,`createdVersion`,`refreshedVersion`,`minRefreshableVersion`,`recordCount`,`backgroundQuery`,`supportSubquery`,`supportAdvancedDrill`]);var io=class e extends L{constructor(){super(),this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector=new Qa(`extLst`),this.unknownCollector=new Qa(``),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector=new Qa(``),this.cacheSourceXmlParts=[],this.model=null}get tag(){return`pivotCacheDefinition`}reset(){this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector.reset(),this.cacheSourceXmlParts=[]}render(e,t){`isLoaded`in 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).filter(Array.isArray).length;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:a}),t.openNode(`cacheSource`,{type:`worksheet`});let o=r.tableName?{name:r.tableName}:{ref:r.dimensions.shortRange,sheet:r.name};t.leafNode(`worksheetSource`,o),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(e.renderCacheFieldsXml(i)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,sourceTableName:o,recordCount:s}=n;t.openXml(F.StdDocAttributes);let c={...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":n.rId??`rId1`};if(n.refreshOnLoad&&(c.refreshOnLoad=n.refreshOnLoad),c.createdVersion=n.createdVersion??`8`,c.refreshedVersion=n.refreshedVersion??`8`,c.minRefreshableVersion=n.minRefreshableVersion??`3`,s!==void 0&&(c.recordCount=s),n.backgroundQuery&&(c.backgroundQuery=n.backgroundQuery),n.supportSubquery&&(c.supportSubquery=n.supportSubquery),n.supportAdvancedDrill&&(c.supportAdvancedDrill=n.supportAdvancedDrill),n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))c[e]=t;if(t.openNode(this.tag,c),t.openNode(`cacheSource`,{type:n.cacheSourceType??`worksheet`}),!n.cacheSourceType||n.cacheSourceType===`worksheet`){let e=o?{name:o}:{ref:i,sheet:a};n.worksheetSourceRId&&(e[`r:id`]=n.worksheetSourceRId),Object.values(e).some(e=>e!==void 0)&&t.leafNode(`worksheetSource`,e)}n.cacheSourceXml&&t.writeXml(n.cacheSourceXml),t.closeNode(),t.openNode(`cacheFields`,{count:r.length}),t.writeXml(e.renderCacheFieldsXml(r)),t.closeNode(),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml),n.extLstXml&&t.writeXml(n.extLstXml),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedOpen(t,n),!0;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))ro.has(t)||(e[t]=String(r));this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,backgroundQuery:n.backgroundQuery,supportSubquery:n.supportSubquery,supportAdvancedDrill:n.supportAdvancedDrill,extraRootAttrs:Object.keys(e).length>0?e:void 0,isLoaded:!0};break}case`cacheSource`:this.inCacheSource=!0,this.model&&(this.model.cacheSourceType=n.type);break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet,this.model.sourceTableName=n.name,n[`r:id`]&&(this.model.worksheetSourceRId=n[`r:id`]));break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new to,this.currentCacheField.parseOpen(e));break;case`extLst`:this.model&&this.extLstCollector.start(n);break;default:if(this.inCacheSource&&this.model){this.cacheSourceChildCollector.startAs(t,n);break}this.model&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){if(this.extLstCollector.active){this.extLstCollector.feedText(e);return}if(this.unknownCollector.active){this.unknownCollector.feedText(e);return}if(this.cacheSourceChildCollector.active){this.cacheSourceChildCollector.feedText(e);return}this.currentCacheField&&this.currentCacheField.parseText(e)}parseClose(e){if(this.extLstCollector.active)return this.extLstCollector.feedClose(e)&&(this.model&&(this.model.extLstXml=this.extLstCollector.result),this.extLstCollector.reset()),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedClose(e)&&(this.cacheSourceXmlParts.push(this.cacheSourceChildCollector.result),this.cacheSourceChildCollector.reset()),!0;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 this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`cacheSource`:this.inCacheSource=!1,this.model&&this.cacheSourceXmlParts.length>0&&(this.model.cacheSourceXml=this.cacheSourceXmlParts.join(``));break;case`cacheFields`:this.inCacheFields=!1;break}return!0}static renderCacheFieldsXml(e){return`
|
|
30
30
|
`+e.map(e=>Ga(e)).join(`
|
|
31
31
|
`)}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`}}};let ao=`PivotStyleLight16`,oo=new Set([`axisRow`,`axisCol`,`axisPage`,`axisValues`]),so=[`x`,`t`,`h`,`sd`,`f`,`m`,`c`,`d`];function co(){return{currentSection:null,inPivotArea:!1,inAutoSortScope:!1}}let lo=new Set([`axis`,`dataField`,`compact`,`outline`,`showAll`,`defaultSubtotal`,`numFmtId`,`sortType`,`subtotalTop`,`insertBlankRow`,`multipleItemSelectionAllowed`]);var uo=class e extends L{constructor(){super(),this.state=co(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector=new Qa(`extLst`),this.formatsCollector=new Qa(`formats`),this.conditionalFormatsCollector=new Qa(`conditionalFormats`),this.filtersCollector=new Qa(`filters`),this.unknownCollector=new Qa(``),this.unknownElementsXmlParts=[],this.model=null}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.state=co(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector.reset(),this.formatsCollector.reset(),this.conditionalFormatsCollector.reset(),this.filtersCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,r){let{rows:i,columns:a,values:o,pages:s=[],cacheFields:c,cacheId:l,tableNumber:u,applyWidthHeightFormats:d}=r,f=a.length===0&&o.length>1,p=s.length,m=p>0?p+1:0,h=i.length,g=3+m,_=g+1,v=h+(f?o.length:1),y=`A${g}:${n.n2l(v)}${_}`;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,name:`PivotTable${u}`,cacheId:l,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:d,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`});let b={ref:y,firstHeaderRow:1,firstDataRow:1,firstDataCol:h};p>0&&(b.rowPageCount=p,b.colPageCount=1),t.leafNode(`location`,b),mo(t,r),t.openNode(`rowFields`,{count:i.length});for(let e of i)t.leafNode(`field`,{x:e});if(t.closeNode(),t.openNode(`rowItems`,{count:1}),t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode(),a.length>0){let e=o.length>1?a.length+1:a.length;t.openNode(`colFields`,{count:e});for(let e of a)t.leafNode(`field`,{x:e});o.length>1&&t.leafNode(`field`,{x:-2}),t.closeNode()}else f&&(t.openNode(`colFields`,{count:1}),t.leafNode(`field`,{x:-2}),t.closeNode());if(f){t.openNode(`colItems`,{count:o.length+1});for(let e=0;e<o.length;e++)t.openNode(`i`),t.leafNode(`x`,e===0?void 0:{v:e}),t.closeNode();t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode()}else t.openNode(`colItems`,{count:1}),t.leafNode(`i`),t.closeNode();if(p>0){t.openNode(`pageFields`,{count:p});for(let e of s)t.leafNode(`pageField`,{fld:e,hier:-1});t.closeNode()}po(t,c,o,r.valueMetrics),t.leafNode(`pivotTableStyleInfo`,{name:ao,showRowHeaders:`1`,showColHeaders:`1`,showRowStripes:`0`,showColStripes:`0`,showLastColumn:`1`}),t.writeXml(e.EXTLST_XML),t.closeNode()}renderLoaded(t,n){let r=this.buildLoadedRootAttributes(n);if(t.openXml(F.StdDocAttributes),t.openNode(this.tag,r),n.location){let e={ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol};n.location.rowPageCount!==void 0&&(e.rowPageCount=n.location.rowPageCount),n.location.colPageCount!==void 0&&(e.colPageCount=n.location.colPageCount),t.leafNode(`location`,e)}if(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()}if(n.rowItems&&n.rowItems.length>0){t.openNode(`rowItems`,{count:n.rowItems.length});for(let e of n.rowItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasRowItems&&t.writeXml(`<rowItems count="1"><i t="grand"><x/></i></rowItems>`);if(n.hasColFields||n.colFields.length>0)if(n.colFields.length===0&&n.dataFields.length<=1)t.leafNode(`colFields`,{count:0});else{let e=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:e}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.colItems&&n.colItems.length>0){t.openNode(`colItems`,{count:n.colItems.length});for(let e of n.colItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasColItems&&t.writeXml(`<colItems count="1"><i t="grand"><x/></i></colItems>`);if(n.pageFields&&n.pageFields.length>0){t.openNode(`pageFields`,{count:n.pageFields.length});for(let e of n.pageFields){let n={fld:e.fld};e.item!==void 0&&(n.item=e.item),e.hier!==void 0&&(n.hier=e.hier),e.name!==void 0&&(n.name=e.name),t.leafNode(`pageField`,n)}t.closeNode()}if(n.dataFields.length>0){t.openNode(`dataFields`,{count:n.dataFields.length});for(let e of n.dataFields){let n={name:e.name,fld:e.fld};e.baseField!==void 0&&(n.baseField=e.baseField),e.baseItem!==void 0&&(n.baseItem=e.baseItem),e.subtotal!==void 0&&e.subtotal!==`sum`&&(n.subtotal=e.subtotal),e.numFmtId!==void 0&&(n.numFmtId=e.numFmtId),t.leafNode(`dataField`,n)}t.closeNode()}n.formatsXml&&t.writeXml(n.formatsXml),n.conditionalFormatsXml&&t.writeXml(n.conditionalFormatsXml),n.chartFormats&&n.chartFormats.length>0&&this.renderChartFormats(t,n.chartFormats);let i=n.styleInfo;t.leafNode(`pivotTableStyleInfo`,{name:i?.name??n.styleName??ao,showRowHeaders:i?.showRowHeaders??`1`,showColHeaders:i?.showColHeaders??`1`,showRowStripes:i?.showRowStripes??`0`,showColStripes:i?.showColStripes??`0`,showLastColumn:i?.showLastColumn??`1`}),n.filtersXml&&t.writeXml(n.filtersXml),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml);let a=n.extLstXml??(n.isLoaded?``:e.EXTLST_XML);a&&t.writeXml(a),t.closeNode()}buildLoadedRootAttributes(t){let n={...e.PIVOT_TABLE_ATTRIBUTES,name:t.name??`PivotTable1`,cacheId:String(t.cacheId),applyNumberFormats:t.applyNumberFormats??`0`,applyBorderFormats:t.applyBorderFormats??`0`,applyFontFormats:t.applyFontFormats??`0`,applyPatternFormats:t.applyPatternFormats??`0`,applyAlignmentFormats:t.applyAlignmentFormats??`0`,applyWidthHeightFormats:t.applyWidthHeightFormats??`0`,dataCaption:t.dataCaption??`Values`,updatedVersion:t.updatedVersion??`8`,minRefreshableVersion:t.minRefreshableVersion??`3`};return t.useAutoFormatting!==void 0&&(n.useAutoFormatting=t.useAutoFormatting),t.itemPrintTitles!==void 0&&(n.itemPrintTitles=t.itemPrintTitles),t.multipleFieldFilters!==void 0&&(n.multipleFieldFilters=t.multipleFieldFilters),n.createdVersion=t.createdVersion??`8`,t.indent!==void 0&&(n.indent=String(t.indent)),t.uid&&(n[`xmlns:xr`]=`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,n[`xr:uid`]=t.uid),t.outline&&(n.outline=`1`),t.outlineData&&(n.outlineData=`1`),t.chartFormat!==void 0&&(n.chartFormat=String(t.chartFormat)),t.colGrandTotals!==void 0&&(n.colGrandTotals=t.colGrandTotals),t.rowGrandTotals!==void 0&&(n.rowGrandTotals=t.rowGrandTotals),t.showError!==void 0&&(n.showError=t.showError),t.errorCaption!==void 0&&(n.errorCaption=t.errorCaption),t.showMissing!==void 0&&(n.showMissing=t.showMissing),t.missingCaption!==void 0&&(n.missingCaption=t.missingCaption),t.grandTotalCaption!==void 0&&(n.grandTotalCaption=t.grandTotalCaption),t.compact===!1&&(n.compact=`0`),t.compactData===!1&&(n.compactData=`0`),n}renderChartFormats(e,t){e.openNode(`chartFormats`,{count:t.length});for(let n of t)e.openNode(`chartFormat`,{chart:n.chart,format:n.format,series:n.series===!0?`1`:n.series===!1?`0`:void 0}),n.pivotAreaXml?e.writeXml(n.pivotAreaXml):e.writeXml(`<pivotArea type="data" outline="0" fieldPosition="0"><references count="1"><reference field="4294967294" count="1" selected="0"><x v="0"/></reference></references></pivotArea>`),e.closeNode();e.closeNode()}renderRowColItem(e,t){let n={};if(t.t!==void 0&&(n.t=t.t),t.r!==void 0&&(n.r=t.r),t.i!==void 0&&(n.i=t.i),t.x.length>0){e.openNode(`i`,n);for(let n of t.x)n.v===0?e.leafNode(`x`):e.leafNode(`x`,{v:n.v});e.closeNode()}else e.leafNode(`i`,n)}renderPivotFieldLoaded(e,t){let n={};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.numFmtId!==void 0&&(n.numFmtId=String(t.numFmtId)),t.sortType&&(n.sortType=t.sortType),t.compact===!1&&(n.compact=`0`),t.outline===!1&&(n.outline=`0`),n.showAll=t.showAll?`1`:`0`,t.defaultSubtotal===!1&&(n.defaultSubtotal=`0`),t.subtotalTop===!1&&(n.subtotalTop=`0`),t.insertBlankRow===!0&&(n.insertBlankRow=`1`),t.multipleItemSelectionAllowed===!0&&(n.multipleItemSelectionAllowed=`1`),t.extraAttrs)for(let[e,r]of Object.entries(t.extraAttrs))n[e]=r;if(t.items!==void 0&&t.items.length>0||t.autoSortScopeXml!==void 0){if(e.openNode(`pivotField`,n),t.items!==void 0&&t.items.length>0){e.openNode(`items`,{count:t.items.length});for(let n of t.items){let t={};for(let e of so)n[e]!==void 0&&(t[e]=n[e]);e.leafNode(`item`,t)}e.closeNode()}t.autoSortScopeXml&&e.writeXml(t.autoSortScopeXml),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.formatsCollector.active)return this.formatsCollector.feedOpen(t,n),!0;if(this.conditionalFormatsCollector.active)return this.conditionalFormatsCollector.feedOpen(t,n),!0;if(this.filtersCollector.active)return this.filtersCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;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:[],pageFields:[],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,itemPrintTitles:n.itemPrintTitles,indent:n.indent===void 0?void 0:parseInt(n.indent,10),compact:n.compact!==`0`,compactData:n.compactData!==`0`,multipleFieldFilters:n.multipleFieldFilters,outline:n.outline===`1`,outlineData:n.outlineData===`1`,chartFormat:n.chartFormat===void 0?void 0:parseInt(n.chartFormat,10),colGrandTotals:n.colGrandTotals,rowGrandTotals:n.rowGrandTotals,showError:n.showError,errorCaption:n.errorCaption,showMissing:n.showMissing,missingCaption:n.missingCaption,grandTotalCaption:n.grandTotalCaption,rowItems:[],colItems:[],chartFormats:[],isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow===void 0?void 0:parseInt(n.firstHeaderRow,10),firstDataRow:n.firstDataRow===void 0?void 0:parseInt(n.firstDataRow,10),firstDataCol:n.firstDataCol===void 0?void 0:parseInt(n.firstDataCol,10),rowPageCount:n.rowPageCount===void 0?void 0:parseInt(n.rowPageCount,10),colPageCount:n.colPageCount===void 0?void 0:parseInt(n.colPageCount,10)});break;case`pivotFields`:this.state.currentSection=`pivotFields`;break;case`pivotField`:if(this.state.currentSection===`pivotFields`){let e={};for(let[t,r]of Object.entries(n))lo.has(t)||(e[t]=String(r));this.currentPivotField={axis:oo.has(n.axis)?n.axis:void 0,dataField:n.dataField===`1`,items:[],compact:n.compact!==`0`,outline:n.outline!==`0`,showAll:n.showAll!==`0`,defaultSubtotal:n.defaultSubtotal!==`0`,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10),sortType:n.sortType,subtotalTop:n.subtotalTop===void 0?void 0:n.subtotalTop===`1`,insertBlankRow:n.insertBlankRow===`1`?!0:void 0,multipleItemSelectionAllowed:n.multipleItemSelectionAllowed===`1`?!0:void 0,extraAttrs:Object.keys(e).length>0?e:void 0}}break;case`items`:break;case`item`:if(this.currentPivotField){let e={};n.x!==void 0&&(e.x=parseInt(n.x,10));for(let t of so)t!==`x`&&n[t]!==void 0&&(e[t]=n[t]);this.currentPivotField.items.push(e)}break;case`autoSortScope`:this.currentPivotField&&(this.state.inAutoSortScope=!0,this.autoSortScopeXmlBuffer=[`<autoSortScope>`]);break;case`rowFields`:this.state.currentSection=`rowFields`;break;case`colFields`:this.state.currentSection=`colFields`,this.model&&(this.model.hasColFields=!0);break;case`dataFields`:this.state.currentSection=`dataFields`;break;case`pageFields`:this.state.currentSection=`pageFields`;break;case`pageField`:this.state.currentSection===`pageFields`&&this.model&&this.model.pageFields.push({fld:parseInt(n.fld??`0`,10),item:n.item===void 0?void 0:parseInt(n.item,10),hier:n.hier===void 0?void 0:parseInt(n.hier,10),name:n.name});break;case`rowItems`:this.state.currentSection=`rowItems`,this.model&&(this.model.hasRowItems=!0);break;case`colItems`:this.state.currentSection=`colItems`,this.model&&(this.model.hasColItems=!0);break;case`i`:if(this.model){let e=this.state.currentSection===`rowItems`||this.state.currentSection===`colItems`?fo(n):null;this.state.currentSection===`rowItems`?this.currentRowItem=e:this.state.currentSection===`colItems`&&(this.currentColItem=e)}break;case`x`:if(this.state.inPivotArea){let e=$a(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(e?`<x ${e}/>`:`<x/>`):this.pivotAreaXmlBuffer.push(e?`<x ${e}/>`:`<x/>`)}else this.currentRowItem?this.currentRowItem.x.push({v:parseInt(n.v??`0`,10)}):this.currentColItem&&this.currentColItem.x.push({v:parseInt(n.v??`0`,10)});break;case`chartFormats`:this.state.currentSection=`chartFormats`;break;case`chartFormat`:this.state.currentSection===`chartFormats`&&this.model&&(this.currentChartFormat={chart:parseInt(n.chart??`0`,10),format:parseInt(n.format??`0`,10),series:n.series===void 0?void 0:n.series===`1`});break;case`pivotArea`:if(this.currentChartFormat){this.state.inPivotArea=!0;let e=$a(n);this.pivotAreaXmlBuffer=[e?`<pivotArea ${e}>`:`<pivotArea>`]}else if(this.state.inAutoSortScope){this.state.inPivotArea=!0;let e=$a(n);this.autoSortScopeXmlBuffer.push(e?`<pivotArea ${e}>`:`<pivotArea>`)}break;case`references`:case`reference`:if(this.state.inPivotArea){let e=$a(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`<${t}${e?` `+e:``}>`):this.pivotAreaXmlBuffer.push(`<${t}${e?` `+e:``}>`)}break;case`field`:if(this.model){let e=parseInt(n.x??`0`,10);this.state.currentSection===`rowFields`?this.model.rowFields.push(e):this.state.currentSection===`colFields`&&this.model.colFields.push(e)}break;case`dataField`:this.state.currentSection===`dataFields`&&this.model&&this.model.dataFields.push({name:n.name??``,fld:parseInt(n.fld??`0`,10),baseField:n.baseField===void 0?void 0:parseInt(n.baseField,10),baseItem:n.baseItem===void 0?void 0:parseInt(n.baseItem,10),subtotal:ht.has(n.subtotal)?n.subtotal:void 0,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10)});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name,this.model.styleInfo={name:n.name,showRowHeaders:n.showRowHeaders,showColHeaders:n.showColHeaders,showRowStripes:n.showRowStripes,showColStripes:n.showColStripes,showLastColumn:n.showLastColumn});break;case`extLst`:this.model&&this.extLstCollector.start(n);break;case`formats`:this.model&&this.formatsCollector.start(n);break;case`conditionalFormats`:this.model&&this.conditionalFormatsCollector.start(n);break;case`filters`:this.model&&this.filtersCollector.start(n);break;default:this.model&&this.state.currentSection===null&&!this.state.inPivotArea&&!this.state.inAutoSortScope&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){this.extLstCollector.active?this.extLstCollector.feedText(e):this.formatsCollector.active?this.formatsCollector.feedText(e):this.conditionalFormatsCollector.active?this.conditionalFormatsCollector.feedText(e):this.filtersCollector.active?this.filtersCollector.feedText(e):this.unknownCollector.active&&this.unknownCollector.feedText(e)}tryCloseCollector(e,t,n){e.feedClose(t)&&(this.model&&(this.model[n]=e.result),e.reset())}parseClose(e){if(this.extLstCollector.active)return this.tryCloseCollector(this.extLstCollector,e,`extLstXml`),!0;if(this.formatsCollector.active)return this.tryCloseCollector(this.formatsCollector,e,`formatsXml`),!0;if(this.conditionalFormatsCollector.active)return this.tryCloseCollector(this.conditionalFormatsCollector,e,`conditionalFormatsXml`),!0;if(this.filtersCollector.active)return this.tryCloseCollector(this.filtersCollector,e,`filtersXml`),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.state.inPivotArea)return e===`pivotArea`?(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</pivotArea>`):(this.pivotAreaXmlBuffer.push(`</pivotArea>`),this.currentChartFormat&&(this.currentChartFormat.pivotAreaXml=this.pivotAreaXmlBuffer.join(``)),this.pivotAreaXmlBuffer=[]),this.state.inPivotArea=!1,!0):((e===`references`||e===`reference`)&&(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</${e}>`):this.pivotAreaXmlBuffer.push(`</${e}>`)),!0);switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`pivotFields`:case`rowFields`:case`colFields`:case`dataFields`:case`pageFields`:case`rowItems`:case`colItems`:case`chartFormats`:this.state.currentSection=null;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:break;case`autoSortScope`:this.state.inAutoSortScope&&this.currentPivotField&&(this.autoSortScopeXmlBuffer.push(`</autoSortScope>`),this.currentPivotField.autoSortScopeXml=this.autoSortScopeXmlBuffer.join(``),this.autoSortScopeXmlBuffer=[],this.state.inAutoSortScope=!1);break;case`i`:this.currentRowItem&&this.model?(this.model.rowItems?.push(this.currentRowItem),this.currentRowItem=null):this.currentColItem&&this.model&&(this.model.colItems?.push(this.currentColItem),this.currentColItem=null);break;case`chartFormat`:this.currentChartFormat&&this.model&&(this.model.chartFormats?.push(this.currentChartFormat),this.currentChartFormat=null);break}return!0}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}static{this.EXTLST_XML=`<extLst><ext uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:pivotTableDefinition hideValuesRow="1" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"/></ext><ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}" xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout"><xpdl:pivotTableDefinition16 EnabledSubtotalsDefault="0" SubtotalsOnTopDefault="0"/></ext></extLst>`}};function fo(e){return{t:e.t,r:e.r===void 0?void 0:parseInt(e.r,10),i:e.i===void 0?void 0:parseInt(e.i,10),x:[]}}function po(e,t,n,r){e.openNode(`dataFields`,{count:n.length});for(let i=0;i<n.length;i++){let a=n[i],o=r[i]??`sum`,s=mt[o],c=t[a];if(!c)throw Error(`Value field index ${a} is out of bounds (cacheFields has ${t.length} entries)`);let l={name:`${s} of ${c.name}`,fld:a,baseField:0,baseItem:0};o!==`sum`&&(l.subtotal=o),e.leafNode(`dataField`,l)}e.closeNode()}function mo(e,t){let n=new Set(t.rows),r=new Set(t.columns),i=new Set(t.values),a=new Set(t.pages??[]);e.openNode(`pivotFields`,{count:t.cacheFields.length});for(let o=0;o<t.cacheFields.length;o++){let s=t.cacheFields[o];ho(e,n.has(o),r.has(o),i.has(o),a.has(o),s.sharedItems)}e.closeNode()}function ho(e,t,n,r,i,a){if(t||n||i){if(!a)throw Error(`sharedItems is required for axis field (row/column/page)`);let i={axis:t?`axisRow`:n?`axisCol`:`axisPage`};r&&(i.dataField=`1`),i.compact=`0`,i.outline=`0`,i.showAll=`0`,e.openNode(`pivotField`,i),e.openNode(`items`,{count:a.length+1});for(let t=0;t<a.length;t++)e.leafNode(`item`,{x:t});e.leafNode(`item`,{t:`default`}),e.closeNode(),e.closeNode();return}let o={};r&&(o.dataField=`1`),o.compact=`0`,o.outline=`0`,o.showAll=`0`,o.defaultSubtotal=`0`,e.leafNode(`pivotField`,o)}var go=class extends L{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Tn,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}}},_o=class e extends L{constructor(){super(),this.map={comment:new go},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(F.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`}}},vo=class extends L{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}}},yo=class extends L{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}},bo=class extends L{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return 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}},xo=class extends L{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return 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}};let So=[`twoCells`,`oneCells`,`absolute`];var Co=class extends L{constructor(){super(),this.map={"x:Anchor":new yo,"x:Locked":new bo({tag:`x:Locked`}),"x:LockText":new bo({tag:`x:LockText`}),"x:SizeWithCells":new xo({tag:`x:SizeWithCells`}),"x:MoveWithCells":new xo({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,So),this.map[`x:SizeWithCells`].render(e,r,So),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=So[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}},wo=class e extends L{constructor(){super(),this.map={"v:textbox":new vo,"x:ClientData":new Co}}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})}},To=class e extends L{constructor(){super(),this.map={"v:shape":new wo},this.model={comments:[],formControls:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model,i=r.comments&&r.comments.length>0,a=r.formControls&&r.formControls.length>0;if(t.openXml(F.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(),i&&(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()),a&&(t.openNode(`v:shapetype`,{id:`_x0000_t201`,coordsize:`21600,21600`,"o:spt":`201`,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{shadowok:`f`,"o:extrusionok":`f`,strokeok:`f`,fillok:`f`,"o:connecttype":`rect`}),t.leafNode(`o:lock`,{"v:ext":`edit`,shapetype:`t`}),t.closeNode()),i){let e=r.comments;for(let n=0;n<e.length;n++)this.map[`v:shape`].render(t,e[n],n)}if(a)for(let e of r.formControls)this._renderCheckboxShape(t,e);t.closeNode()}_renderCheckboxShape(e,t){let n={id:`_x0000_s${t.shapeId}`,type:`#_x0000_t201`,style:xe.getVmlStyle(t),"o:insetmode":`auto`,fillcolor:`buttonFace [67]`,strokecolor:`windowText [64]`,"o:preferrelative":`t`,filled:`f`,stroked:`f`};e.openNode(`v:shape`,n),e.leafNode(`v:fill`,{"o:detectmouseclick":`t`}),e.leafNode(`o:lock`,{"v:ext":`edit`,text:`t`}),t.text&&(e.openNode(`v:textbox`,{style:`mso-direction-alt:auto`,"o:singleclick":`t`}),e.openNode(`div`,{style:`text-align:left`}),e.openNode(`font`,{face:`Tahoma`,size:`160`,color:`auto`}),e.writeText(t.text),e.closeNode(),e.closeNode(),e.closeNode()),e.openNode(`x:ClientData`,{ObjectType:`Checkbox`}),e.leafNode(`x:MoveWithCells`),e.leafNode(`x:SizeWithCells`),e.openNode(`x:Anchor`),e.writeText(xe.getVmlAnchor(t)),e.closeNode(),e.leafNode(`x:Locked`,void 0,`False`),e.leafNode(`x:LockText`,void 0,`True`),e.leafNode(`x:PrintObject`,void 0,t.print?`True`:`False`),e.leafNode(`x:AutoFill`,void 0,`False`),e.leafNode(`x:AutoLine`,void 0,`False`),e.leafNode(`x:TextHAlign`,void 0,`Left`),e.leafNode(`x:TextVAlign`,void 0,`Center`),t.link&&e.leafNode(`x:FmlaLink`,void 0,t.link),t.noThreeD&&e.leafNode(`x:NoThreeD`),e.leafNode(`x:Checked`,void 0,String(xe.getVmlCheckedValue(t))),e.leafNode(`x:Row`,void 0,String(t.tl.row)),e.leafNode(`x:Column`,void 0,String(t.tl.col)),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[],formControls:[]};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}}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`}}},Eo=class extends L{_checkedToXmlValue(e){switch(e){case`Checked`:return`1`;case`Mixed`:return`2`;default:return`0`}}get tag(){return`formControlPr`}render(e,t){let n=t||this.model,r={xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,objectType:`CheckBox`,checked:this._checkedToXmlValue(n.checked),lockText:`1`};n.link&&(r.fmlaLink=n.link),n.noThreeD&&(r.noThreeD=`1`),e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.leafNode(this.tag,r)}toXml(e){let t=new F;return this.render(t,e),t.xml}parseOpen(){return!0}parseText(){}parseClose(){return!1}};let Do=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
32
|
-
<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>`,Oo=new TextEncoder;var ko=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),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._buf.slice(0,this._inPos),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=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=Oo.encode(e),n=this._inPos+t.length;n>this._buf.length-4&&this._grow(n),this._buf.set(t,this._inPos),this._inPos+=t.length}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}},Ao=class{constructor(e){this._data=e}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}},jo=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()}},Mo=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);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},No=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}},Po=class extends M{constructor(e){super(),this._writableStream=null,this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),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._ended=!1}get writable(){return!this._ended}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 No(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_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){typeof t==`function`&&(n=t),n||=()=>{};let r;if(e instanceof ko||e&&e.constructor?.name===`StringBuf`)r=new jo(e);else if(e instanceof Uint8Array)r=new Mo(e);else if(ArrayBuffer.isView(e))r=new Mo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Mo(new Uint8Array(e));else if(typeof e==`string`)r=new Ao(e);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;){let e=this.buffers.shift();await this._pipeChunk(new Mo(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer();this.paused||this.emit(`data`,e),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e))),this._writeToBuffers(r),this.emit(`readable`)}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Mo(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`)}).catch(e=>{this.emit(`error`,e)}):this.emit(`finish`)};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return Fo(t)}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],Fo(t)}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return typeof Buffer<`u`&&n instanceof Buffer?n.toString(t):new TextDecoder(t).decode(n)}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}pipeTo(e){this._writableStream=e,this._writableStreamWriter=e.getWriter()}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 Fo(e){if(typeof Buffer<`u`&&typeof Buffer.concat==`function`)return Buffer.concat(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}let Io=null;function Lo(){if(Io)return Io;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 Io=e,e}function Ro(e,t){let n=Lo();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function zo(e){return(e^4294967295)>>>0}function Bo(e){return zo(Ro(4294967295,e))}function Vo(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}function Ho(e){let t=e.length;if(t===0)return new Uint8Array;if(t===1)return e[0];let n=Vo(e),r=new Uint8Array(n),i=0;for(let n=0;n<t;n++){let t=e[n];r.set(t,i),i+=t.length}return r}function Uo(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}let Wo=new Uint8Array(288);for(let e=0;e<=143;e++)Wo[e]=8;for(let e=144;e<=255;e++)Wo[e]=9;for(let e=256;e<=279;e++)Wo[e]=7;for(let e=280;e<=287;e++)Wo[e]=8;let Go=new Uint8Array(32).fill(5),Ko=[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],qo=[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],Jo=[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],Yo=[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],Xo=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Zo(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 Qo=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 $o(e){let t=new Qo(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=Zo(Wo,288),i=Zo(Go,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[Xo[e]]=t.readBits(3);let s=Zo(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=Zo(c.subarray(0,e),e),i=Zo(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=Ko[r]+t.readBits(qo[r]),o=t.decodeSymbol(i),s=Jo[o]+t.readBits(Yo[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 es(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 ts(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return es(e);let t=new ns;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?(os(t,i),ss(t,a),r+=i):(as(t,e[r]),r++)}return as(t,256),t.finish()}var ns=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(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),Ho(this.chunks))}};let rs=[],is=[];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),rs[e]=[t,n],is[e]=n}function as(e,t){let[n,r]=rs[t];e.writeBitsReverse(n,r)}function os(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;as(e,n),r>0&&e.writeBits(i,r)}function ss(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)}var cs=class e{static{this.EMPTY=new Uint8Array}constructor(e){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return e.EMPTY;if(this._chunks.length===1)return this._chunks[0].subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let t=new Uint8Array(this._length),n=0;for(let e=0;e<this._chunks.length;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=e===this._chunks.length-1?i+(this._length-n):r.length;if(t.set(r.subarray(i,a),n),n+=a-i,n>=t.length)break}return this._cachedView=t,this._cachedLength=this._length,t}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return new Uint8Array;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._chunks.length===1){let t=this._chunks[0],n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._headOffset=0):this._headOffset>=t.length&&(this._chunks.shift(),this._headOffset=0),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._chunks[0],i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}return this._length===0&&(this._chunks=[],this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._chunks.length===1){let t=this._chunks[0],n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=0;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._chunks[0],n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}this._length===0&&(this._chunks=[],this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._chunks.length===1){let t=this._chunks[0],a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):Uo(o,e,i)}if(n>4)return Uo(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},d=0;for(let e=0;e<l.length;e++){let t=l[e],f=e===0?this._headOffset:0,p=t.length-f;if(p<=0)continue;let m=d,h=m+p,g=i<=m?f:i>=h?t.length:f+(i-m);if(g>t.length-1){d+=p;continue}let _=t.length-1,v=t.indexOf(a,g);for(;v!==-1&&v<=_;){let i=m+(v-f);if(i>r-n)return-1;if(n===1)return i;if(v+n<=t.length){if(t[v+1]!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;if(t[v+2]!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;if(t[v+3]!==c){v=t.indexOf(a,v+1);continue}return i}let l=u(e,v+1);if(l===null||l!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;let d=u(e,v+2);if(d===null||d!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;let p=u(e,v+3);if(p===null||p!==c){v=t.indexOf(a,v+1);continue}return i}d+=p}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=0;e<n.length;e++){let t=n[e],i=e===0?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=0;e<this._chunks.length;e++){let t=this._chunks[e],r=e===0?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function ls(){return typeof CompressionStream<`u`}function us(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function ds(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let fs=null,ps=null;function ms(){return typeof CompressionStream>`u`?!1:(fs===null&&(fs=us()),fs)}function hs(){return typeof DecompressionStream>`u`?!1:(ps===null&&(ps=ds()),ps)}function gs(){return ms()&&hs()}async function _s(e){let t=new cs;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function vs(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=_s(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function ys(e){return vs(e,new CompressionStream(`deflate-raw`))}async function bs(e){return vs(e,new DecompressionStream(`deflate-raw`))}function xs(e){return e instanceof Error?e:Error(String(e))}function Ss(){return!0}function Cs(){return gs()}var ws=class extends M{constructor(e,t){super(),this.ended=!1,this.writer=e,this.reader=t,this.readPromise=this._startReading()}async _startReading(){try{for(;;){let{value:e,done:t}=await this.reader.read();if(t)break;e&&this.emit(`data`,e)}this.emit(`end`)}catch(e){this.emit(`error`,xs(e))}}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.writer.write(e).then(()=>{t&&t()}).catch(e=>{let n=xs(e);t?t(n):this.emit(`error`,n)}),!0}end(e){if(this.ended){e&&e();return}this.ended=!0,this.writer.close().then(()=>this.readPromise).then(()=>{e&&e()}).catch(t=>{let n=xs(t);e?e(n):this.emit(`error`,n)})}destroy(e){this.ended=!0,e&&this.emit(`error`,e);try{this.reader.cancel(e)}catch{}try{this.writer.abort(e)}catch{}}},Ts=class extends M{constructor(e){super();let t=new CompressionStream(`deflate-raw`);this.codec=new ws(t.writable.getWriter(),t.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Es=class extends M{constructor(e){super(),this.codec=new Ds(ts),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Ds=class extends M{constructor(e){super(),this.process=e,this.chunks=[],this.ended=!1}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.chunks.push(e),t&&queueMicrotask(()=>t()),!0}end(e){if(this.ended){e&&e();return}this.ended=!0;try{let t=Ho(this.chunks),n=this.process(t);this.emit(`data`,n),this.emit(`end`),e&&e()}catch(t){let n=xs(t);this.emit(`error`,n),e&&e(n)}}destroy(e){this.ended=!0,e&&this.emit(`error`,e)}};function Os(e={}){let t=e.level??6;return Cs()?new Ts(t):new Es(t)}var ks=class extends M{constructor(){super();let e=new DecompressionStream(`deflate-raw`);this.codec=new ws(e.writable.getWriter(),e.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},As=class extends M{constructor(){super(),this.codec=new Ds($o),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}};function js(){return Cs()?new ks:new As}let Ms=new TextEncoder,Ns=new TextDecoder(`utf-8`);function Ps(e){return Ms.encode(e)}function Fs(e){return Ns.decode(e)}function Is(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n){let i=e.subarray(r,r+n);t+=String.fromCharCode(...i)}return t}function Ls(e){return!Number.isFinite(e)||e<=0?0:e>=4294967295?4294967295:e>>>0}function Rs(e){return Ls(Math.floor(e.getTime()/1e3))}function zs(e){let t=Ls(e),n=new Uint8Array(9),r=new DataView(n.buffer);return r.setUint16(0,21589,!0),r.setUint16(2,5,!0),n[4]=1,r.setUint32(5,t,!0),n}function Bs(e){return zs(Rs(e))}function Vs(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]}function Hs(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 Us(e,t,n){return n===void 0?Hs(e,t):new Date(n*1e3)}function Ws(e,t){return t===`dos+utc`?Bs(e):new Uint8Array}function Gs(e){let[t,n]=Vs(e);return{dosTime:t,dosDate:n}}let Ks=67324752,qs=33639248,Js=101010256,Ys=134695760,Xs=101075792,Zs=2048;function Qs(e,t,n,r){let i=r.versionNeeded??20;return t.setUint32(n+0,Ks,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,r.flags,!0),t.setUint16(n+8,r.compressionMethod,!0),t.setUint16(n+10,r.dosTime,!0),t.setUint16(n+12,r.dosDate,!0),t.setUint32(n+14,r.crc32,!0),t.setUint32(n+18,r.compressedSize,!0),t.setUint32(n+22,r.uncompressedSize,!0),t.setUint16(n+26,r.fileName.length,!0),t.setUint16(n+28,r.extraField.length,!0),e.set(r.fileName,n+30),r.extraField.length>0&&e.set(r.extraField,n+30+r.fileName.length),30+r.fileName.length+r.extraField.length}function $s(e){let t=new Uint8Array(30+e.fileName.length+e.extraField.length);return Qs(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function ec(e,t,n,r){let i=r.versionMadeBy??20,a=r.versionNeeded??20,o=r.externalAttributes??0;return t.setUint32(n+0,qs,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,a,!0),t.setUint16(n+8,r.flags,!0),t.setUint16(n+10,r.compressionMethod,!0),t.setUint16(n+12,r.dosTime,!0),t.setUint16(n+14,r.dosDate,!0),t.setUint32(n+16,r.crc32,!0),t.setUint32(n+20,r.compressedSize,!0),t.setUint32(n+24,r.uncompressedSize,!0),t.setUint16(n+28,r.fileName.length,!0),t.setUint16(n+30,r.extraField.length,!0),t.setUint16(n+32,r.comment.length,!0),t.setUint16(n+34,0,!0),t.setUint16(n+36,0,!0),t.setUint32(n+38,o,!0),t.setUint32(n+42,r.localHeaderOffset,!0),e.set(r.fileName,n+46),r.extraField.length>0&&e.set(r.extraField,n+46+r.fileName.length),r.comment.length>0&&e.set(r.comment,n+46+r.fileName.length+r.extraField.length),46+r.fileName.length+r.extraField.length+r.comment.length}function tc(e){let t=new Uint8Array(46+e.fileName.length+e.extraField.length+e.comment.length);return ec(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function nc(e,t,n,r){return t.setUint32(n+0,Js,!0),t.setUint16(n+4,0,!0),t.setUint16(n+6,0,!0),t.setUint16(n+8,r.entryCount,!0),t.setUint16(n+10,r.entryCount,!0),t.setUint32(n+12,r.centralDirSize,!0),t.setUint32(n+16,r.centralDirOffset,!0),t.setUint16(n+20,r.comment.length,!0),r.comment.length>0&&e.set(r.comment,n+22),22+r.comment.length}function rc(e){let t=new Uint8Array(22+e.comment.length);return nc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function ic(e,t,n){let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setUint32(0,Ys,!0),i.setUint32(4,e,!0),i.setUint32(8,t,!0),i.setUint32(12,n,!0),r}function ac(e){return e?8:0}function oc(e){return e?Zs|8:Zs}function sc(e){let t=Ps(e.name),n=Ps(e.comment??``),{dosTime:r,dosDate:i}=Gs(e.modTime);return{nameBytes:t,commentBytes:n,dosTime:r,dosDate:i,extraField:Ws(e.modTime,e.timestamps),compressionMethod:ac(e.deflate),flags:oc(e.useDataDescriptor)}}function cc(e){return Math.log(e)/Math.LN2}function lc(e){let t=new Uint32Array(256);for(let n=0;n<e.length;n++)t[e[n]]+=1;let n=0,r=e.length;for(let e=0;e<256;e++){let i=t[e];if(i===0)continue;let a=i/r;n-=a*cc(a)}return n}function uc(e,t={}){let n=t.sampleBytes??65536,r=t.minDecisionBytes??16384,i=Math.min(e.length,n);if(i<r)return!1;let a=e.subarray(0,i),o=new Uint8Array(256),s=0;for(let e=0;e<a.length;e++){let t=a[e];if(o[t]===0&&(o[t]=1,s+=1,s>=200))break}return s<200?!1:lc(a)>=7.95}var dc=class{constructor(e,t){this._deflate=null,this._crc=4294967295,this._uncompressedSize=0,this._compressedSize=0,this._finalized=!1,this._headerEmitted=!1,this._ondata=null,this._onerror=null,this._centralDirEntryInfo=null,this._pendingEnd=!1,this._emittedDataDescriptor=!1,this._localHeader=null,this._deflateWanted=null,this._pendingChunks=[],this._sampleLen=0,this._completeResolve=null,this._completeReject=null,this._completePromise=null,this._completeError=null,this._dataQueue=[],this._finalQueued=!1,this._pushChain=Promise.resolve(),this.name=e;let n=t?.modTime??new Date;this._modTime=n,this.level=t?.level??6,this._smartStore=t?.smartStore??!0,this._sampleBuffer=this._smartStore?new Uint8Array(64*1024):new Uint8Array;let r=sc({name:e,comment:t?.comment??``,modTime:n,timestamps:t?.timestamps??`dos`,useDataDescriptor:!0,deflate:!1});if(this.nameBytes=r.nameBytes,this.commentBytes=r.commentBytes,this.dosTime=r.dosTime,this.dosDate=r.dosDate,this.extraField=r.extraField,this._flags=r.flags,this._compressionMethod=r.compressionMethod,!this._smartStore){let e=this.level>0;this._deflateWanted=e,this._compressionMethod=this._buildCompressionMethod(e),e&&this._initDeflateStream();return}this.level===0&&(this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1))}_buildCompressionMethod(e){return ac(e)}_initDeflateStream(){this._deflate||(this._deflate=Os({level:this.level}),this._deflate.on(`error`,e=>{this._rejectComplete(e)}),this._deflate.on(`data`,e=>{this._compressedSize+=e.length,this._enqueueData(e,!1)}),this._deflate.on(`end`,()=>{this._pendingEnd&&!this._emittedDataDescriptor&&(this._emittedDataDescriptor=!0,this._emitDataDescriptor())}))}_buildLocalHeader(){return $s({fileName:this.nameBytes,extraField:this.extraField,flags:this._flags,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,crc32:0,compressedSize:0,uncompressedSize:0,versionNeeded:20})}_accumulateSample(e){if(this._deflateWanted!==null||this._sampleLen>=this._sampleBuffer.length)return;let t=Math.min(this._sampleBuffer.length-this._sampleLen,e.length);t<=0||(this._sampleBuffer.set(e.subarray(0,t),this._sampleLen),this._sampleLen+=t)}_shouldDecide(e){return this._deflateWanted===null?e||this._sampleLen>=16*1024:!1}_decideCompressionIfNeeded(e){if(this._deflateWanted===null){if(e&&this._sampleLen===0){this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1),this._localHeader=null;return}this._deflateWanted=!uc(this._sampleBuffer.subarray(0,this._sampleLen)),this._compressionMethod=this._buildCompressionMethod(this._deflateWanted),this._localHeader=null,this._deflateWanted&&this._initDeflateStream()}}_emitHeaderIfNeeded(){this._headerEmitted||=(this._emitHeader(),!0)}async _flushPendingChunks(){if(this._pendingChunks.length!==0){for(let e of this._pendingChunks)await this._writeData(e);this._pendingChunks=[]}}_enqueueData(e,t){this._ondata?this._ondata(e,t):(this._dataQueue.push(e),t&&(this._finalQueued=!0))}_flushQueue(){if(!this._ondata)return;let e=this._dataQueue.length,t=this._finalQueued?e-1:-1;for(let n=0;n<e;n++)this._ondata(this._dataQueue[n],n===t);this._dataQueue=[],this._finalQueued=!1}get ondata(){return this._ondata??void 0}set ondata(e){this._ondata=e,this._flushQueue()}get onerror(){return this._onerror??void 0}set onerror(e){this._onerror=e,this._completeError&&e(this._completeError)}_resolveComplete(){this._completeResolve&&this._completeResolve()}_rejectComplete(e){this._completeError||(this._completeError=e,this._onerror&&this._onerror(e),this._completeReject&&this._completeReject(e))}_ensureCompletePromise(){return this._completeError?Promise.reject(this._completeError):this._emittedDataDescriptor?Promise.resolve():(this._completePromise||=new Promise((e,t)=>{this._completeResolve=e,this._completeReject=t}),this._completePromise)}_tapCallback(e,t){t&&e.then(()=>t()).catch(e=>t(e))}_writeData(e){return e.length===0?Promise.resolve():(this._crc=Ro(this._crc,e),this._uncompressedSize+=e.length,this._deflate?new Promise((t,n)=>{this._deflate.write(e,e=>{e?n(e):t()})}):(this._compressedSize+=e.length,this._enqueueData(e,!1),Promise.resolve()))}_endDeflateAndWait(){return new Promise((e,t)=>{let n=this._deflate,r=e=>{a(),t(e)},i=()=>{a(),e()},a=()=>{n.off(`error`,r),n.off(`end`,i)};n.once(`error`,r),n.once(`end`,i),n.end()})}_finalizeAfterWrite(e){this._finalized=!0,this._pendingEnd=!0;let t=this._ensureCompletePromise();return this._deflate?e.then(()=>this._endDeflateAndWait()).then(()=>t):(this._emittedDataDescriptor=!0,this._emitDataDescriptor(),t)}_pushUnchained(e,t,n){if(this._finalized){let e=Promise.reject(Error(`Cannot push to finalized ZipDeflateFile`));return this._tapCallback(e,n),e}if(this._deflateWanted===null){if(this._accumulateSample(e),!this._shouldDecide(t)){e.length>0&&this._pendingChunks.push(e);let t=Promise.resolve();return this._tapCallback(t,n),t}this._decideCompressionIfNeeded(t),this._emitHeaderIfNeeded();let r=this._pendingChunks.length>0,i=this._flushPendingChunks(),a=i;e.length>0&&(a=r?i.then(()=>this._writeData(e)):this._writeData(e));let o=t?this._finalizeAfterWrite(a):a;return this._tapCallback(o,n),o}this._emitHeaderIfNeeded();let r=this._writeData(e),i=t?this._finalizeAfterWrite(r):r;return this._tapCallback(i,n),i}push(e,t=!1,n){let r=this._pushChain=this._pushChain.then(()=>this._pushUnchained(e,t,n));return r.catch(()=>{}),r}_emitHeader(){this._localHeader||=this._buildLocalHeader(),this._enqueueData(this._localHeader,!1)}_emitDataDescriptor(){let e=zo(this._crc),t=ic(e,this._compressedSize,this._uncompressedSize);this._centralDirEntryInfo={name:this.nameBytes,extraField:this.extraField,comment:this.commentBytes,flags:this._flags,crc:e,compressedSize:this._compressedSize,uncompressedSize:this._uncompressedSize,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,offset:-1},this._enqueueData(t,!0),this._resolveComplete()}complete(){return this._ensureCompletePromise()}getEntryInfo(){if(!this._centralDirEntryInfo)return null;let e=this.name;return{path:e,isDirectory:e.endsWith(`/`)||e.endsWith(`\\`),compressedSize:this._centralDirEntryInfo.compressedSize,uncompressedSize:this._centralDirEntryInfo.uncompressedSize,compressionMethod:this._centralDirEntryInfo.compressionMethod,crc32:this._centralDirEntryInfo.crc,lastModified:this._modTime,localHeaderOffset:this._centralDirEntryInfo.offset,comment:Fs(this._centralDirEntryInfo.comment),externalAttributes:0,isEncrypted:!1}}getCentralDirectoryEntryInfo(){return this._centralDirEntryInfo}isComplete(){return this._emittedDataDescriptor&&this._centralDirEntryInfo!==null}},fc=class{constructor(e,t){this.entries=[],this.currentOffset=0,this.ended=!1,this.endPending=!1,this.fileQueue=[],this.fileQueueIndex=0,this.activeFile=null,this.callback=e,this.zipComment=t?.comment?Ps(t.comment):new Uint8Array}add(e){if(this.ended)throw Error(`Cannot add files after calling end() `);this.fileQueue.push(e),this.activeFile||this._processNextFile()}_processNextFile(){if(this.fileQueueIndex>=this.fileQueue.length){this.activeFile=null,this.fileQueue=[],this.fileQueueIndex=0,this.endPending&&this._finalize();return}let e=this.fileQueue[this.fileQueueIndex++];this.activeFile=e;let t=this.currentOffset,n=new Uint8Array;e.onerror=e=>{this.ended||(this.ended=!0,this.callback(e,n,!0))},e.ondata=(n,r)=>{if(!this.ended&&(this.currentOffset+=n.length,this.callback(null,n,!1),r)){let n=e.getCentralDirectoryEntryInfo();n&&(n.offset=t,this.entries.push(n)),this._processNextFile()}}}_finalize(){if(this.ended)return;this.ended=!0;let e=this.currentOffset,t=0,n=new Uint8Array;for(let e of this.entries){let r=tc({fileName:e.name,extraField:e.extraField,comment:e.comment??n,flags:e.flags,compressionMethod:e.compressionMethod,dosTime:e.dosTime,dosDate:e.dosDate,crc32:e.crc,compressedSize:e.compressedSize,uncompressedSize:e.uncompressedSize,localHeaderOffset:e.offset,versionMadeBy:20,versionNeeded:20});t+=r.length,this.callback(null,r,!1)}let r=rc({entryCount:this.entries.length,centralDirSize:t,centralDirOffset:e,comment:this.zipComment});this.callback(null,r,!0)}end(){this.endPending||this.ended||(this.endPending=!0,this.activeFile||this._finalize())}};async function pc(e,t={}){return(t.level??6)===0?e:ms()?ys(e):ts(e)}function mc(e,t={}){return(t.level??6)===0?e:ts(e)}async function hc(e,t={}){return hs()?bs(e):$o(e)}function gc(e){return $o(e)}function _c(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}function vc(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!0)}var yc=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?Fs(n):Is(n)}skip(e){this.offset+=e}slice(e,t){return this.data.subarray(e,t)}peekUint32(e){return this.view.getUint32(e,!0)}};function bc(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0;for(;n+4<=e.length;){let r=t.getUint16(n,!0),i=t.getUint16(n+2,!0),a=n+4,o=a+i;if(o>e.length)break;if(r===21589&&i>=1&&e[a]&1&&i>=5)return t.getUint32(a+1,!0)>>>0;n=o}}function xc(e,t){let n=e.getUint32(t,!0);return e.getUint32(t+4,!0)*4294967296+n}function Sc(e,t){let n={};if(e.length<4)return n;let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(;i+4<=e.length;){let a=r.getUint16(i,!0),o=r.getUint16(i+2,!0),s=i+4,c=s+o;if(c>e.length)break;if(a===1){let e=s;t.uncompressedSize===4294967295&&e+8<=c&&(n.uncompressedSize=xc(r,e),e+=8),t.compressedSize===4294967295&&e+8<=c&&(n.compressedSize=xc(r,e),e+=8),t.offsetToLocalFileHeader===4294967295&&e+8<=c&&(n.offsetToLocalFileHeader=xc(r,e))}else if(a===21589){let t=bc(e.subarray(i,c));t!==void 0&&(n.mtimeUnixSeconds=t)}i=c}return t.compressedSize===4294967295&&(t.compressedSize=n.compressedSize),t.uncompressedSize===4294967295&&(t.uncompressedSize=n.uncompressedSize),t.offsetToLocalFileHeader===4294967295&&(t.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}function Cc(e){let t=Math.max(0,e.length-65557);for(let n=e.length-22;n>=t;n--)if(e[n]===80&&e[n+1]===75&&e[n+2]===5&&e[n+3]===6)return n;return-1}function wc(e,t){let n=t-20;return n<0?-1:e[n]===80&&e[n+1]===75&&e[n+2]===6&&e[n+3]===7?n:-1}function Tc(e,t={}){let{decodeStrings:n=!0}=t,r=[],i=Cc(e);if(i===-1)throw Error(`Invalid ZIP file: End of Central Directory not found`);let a=new yc(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=wc(e,i);if(c!==-1){let t=new yc(e,c);t.skip(4),t.skip(4);let n=new yc(e,Number(t.readBigUint64()));if(n.readUint32()===Xs){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)}}o>0&&(r=Array(o));let l=new yc(e,s);for(let e=0;e<o;e++){if(l.readUint32()!==qs)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=d>0?l.readString(d,_):``,y={};if(f>0){let e=l.readBytes(f),t={compressedSize:c,uncompressedSize:u,offsetToLocalFileHeader:h};y=Sc(e,t),c=t.compressedSize,u=t.uncompressedSize,h=t.offsetToLocalFileHeader??h}let b=p>0?l.readString(p,_):``,x=v.endsWith(`/`)||(m&16)!=0,ee=(t&1)!=0,S=y.mtimeUnixSeconds,te=Us(o,a,S);r[e]={path:v,isDirectory:x,compressedSize:c,uncompressedSize:u,compressionMethod:i,crc32:s,lastModified:te,localHeaderOffset:h,comment:b,externalAttributes:m,isEncrypted:ee}}return r}async function Ec(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Oc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return hc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Dc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Oc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return gc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Oc(e,t){let n=new yc(e,t.localHeaderOffset);if(n.readUint32()!==Ks)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();return n.skip(r),n.skip(i),n.readBytes(t.compressedSize)}var kc=class{constructor(e,t={}){this.data=e instanceof ArrayBuffer?new Uint8Array(e):e,this.entries=Tc(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?Ec(this.data,t):null}extractSync(e){let t=this.entryMap.get(e);return t?Dc(this.data,t):null}async extractAll(){let e=new Map;for(let t of this.entries){let n=await Ec(this.data,t);e.set(t.path,n)}return e}extractAllSync(){let e={};for(let t of this.entries)e[t.path]=Dc(this.data,t);return e}async forEach(e){for(let t of this.entries){let n=null;if(await e(t,()=>(n||=Ec(this.data,t),n))===!1)break}}};let Ac=new Map([[/^xl\/charts\/chart\d+\.xml$/,`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`],[/^xl\/charts\/style\d+\.xml$/,`application/vnd.ms-office.chartstyle+xml`],[/^xl\/charts\/colors\d+\.xml$/,`application/vnd.ms-office.chartcolorstyle+xml`]]),jc=[`xl/charts/`];var Mc=class e{constructor(){this.files=new Map}static isPassthroughPath(e){return jc.some(t=>e.startsWith(t))}static getContentType(e){if(!e.startsWith(`xl/charts/_rels/`)){for(let[t,n]of Ac)if(t.test(e))return n}}add(e,t){this.files.set(e,t)}get(e){return this.files.get(e)}has(e){return this.files.has(e)}getPaths(){return[...this.files.keys()]}toRecord(){let e={};for(let[t,n]of this.files)e[t]=n;return e}fromRecord(e){this.files.clear();for(let[t,n]of Object.entries(e))this.files.set(t,n)}getContentTypes(){let t=[];for(let n of this.files.keys()){let r=e.getContentType(n);r&&t.push({partName:n,contentType:r})}return t}writeToZip(e){for(let[t,n]of this.files)e.append(n,{name:t})}clear(){this.files.clear()}get size(){return this.files.size}},Nc=class e{static{this.textEncoder=new TextEncoder}constructor(e){this.events=new Map,this.pipedStream=null,this.finalized=!1,this.level=e?.level??6,this.modTime=e?.modTime,this.timestamps=e?.timestamps,this.zip=new fc((e,t,n)=>{if(e){this._emit(`error`,e);return}t&&t.length>0&&(this._emit(`data`,t),this.pipedStream&&this.pipedStream.write(t)),n&&(this.pipedStream&&this.pipedStream.end(),this._emit(`finish`))})}_emit(e,...t){let n=this.events.get(e);if(n)for(let e of n)e(...t)}on(e,t){let n=this.events.get(e)||new Set;return n.add(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);return n?(n.delete(t),n.size===0&&this.events.delete(e),this):this}pipe(e){this.pipedStream=e}append(t,n){if(this.finalized)throw Error(`Cannot append after finalize`);let r;r=n.base64?Ce(typeof t==`string`?t:String(t)):typeof t==`string`?e.textEncoder.encode(t):t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):t;let i=new dc(n.name,{level:this.level,modTime:this.modTime,timestamps:this.timestamps});this.zip.add(i),i.push(r,!0)}finalize(){this.finalized||(this.finalized=!0,this.zip.end())}},Pc=class e{static{this.RelType=G}constructor(e){this.workbook=e}createBinaryStream(e){let t=new ot;return t.end(e),t}createTextStream(e){let t=new ot;return t.end(e),t}createStreamBuf(){return new Po}bufferToString(e){return Le(e)}createZipWriter(e){return new Nc(e)}async writeToZip(e,t){let{model:n}=this.workbook;this.prepareModel(n,t),await this.addContentTypes(e,n),await this.addOfficeRels(e,n),await this.addWorkbookRels(e,n),await this.addWorksheets(e,n),await this.addSharedStrings(e,n),this.addDrawings(e,n),this.addTables(e,n),this.addPivotTables(e,n),this.addPassthrough(e,n),await Promise.all([this.addThemes(e,n),this.addStyles(e,n)]),await this.addFeaturePropertyBag(e,n),await this.addMedia(e,n),await Promise.all([this.addApp(e,n),this.addCore(e,n)]),await this.addWorkbook(e,n)}async read(e,t){let n=[];return await new Promise((t,r)=>{let i=e=>{n.push(e)},a=()=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),t()},o=t=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),r(t)};e.on(`data`,i),e.on(`end`,a),e.on(`error`,o)}),this.loadBuffer(Ke(n),t)}async write(e,t){t||={},t.zip=t.zip||{},t.zip.modTime??=this.workbook.modified??this.workbook.created;let n=this.createZipWriter(t.zip);return n.pipe(e),await this.writeToZip(n,t),this._finalize(n)}async load(e,t){let n,r=typeof Buffer<`u`?Buffer.isBuffer(e):!1;if(!e||typeof e==`object`&&!r&&!(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) ?`);return n=t&&t.base64?Ce(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e),this.loadBuffer(n,t)}async loadBuffer(e,t){let n=await new kc(e).extractAll(),r={};for(let[e,t]of n)r[e]=t;return this.loadFromFiles(r,t)}createEmptyModel(){return{worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},rawDrawings:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheRecords:{},passthrough:{}}}async collectStreamData(e){let t=[];return await new Promise((n,r)=>{e.on(`data`,e=>{typeof e==`string`?t.push(new TextEncoder().encode(e)):e instanceof Uint8Array?t.push(e):t.push(new Uint8Array(e))}),e.on(`end`,()=>n()),e.on(`error`,r)}),Ke(t)}drawingHasChartReference(e){return e.rels&&e.rels.some(e=>e.Target&&e.Target.includes(`/charts/`))}drawingRelsHasChartReference(e){return Array.isArray(e)&&e.some(e=>typeof e?.Target==`string`&&e.Target.includes(`/charts/`))}async _processKnownEntry(e,t,n,r){let i=Gn(n);if(i!==void 0)return await this._processWorksheetEntry(e,t,i,r,n),!0;switch(n){case U.rootRels:return t.globalRels=await this.parseRels(e),!0;case U.xlWorkbook:{let n=await this.parseWorkbook(e);return t.sheets=n.sheets,t.definedNames=n.definedNames,t.views=n.views,t.properties=n.properties,t.calcProperties=n.calcProperties,t.pivotCaches=n.pivotCaches,!0}case U.xlSharedStrings:return t.sharedStrings=new On,await t.sharedStrings.parseStream(e),!0;case U.xlWorkbookRels:return t.workbookRels=await this.parseRels(e),!0;case U.docPropsApp:{let n=await new Ur().parseStream(e);return n&&(t.company=n.company,t.manager=n.manager),!0}case U.docPropsCore:{let n=await new Cn().parseStream(e);return Object.assign(t,n),!0}case U.xlStyles:return t.styles=new xn,await t.styles.parseStream(e),!0;default:return!1}}async loadFromZipEntries(e,t){let n=this.createEmptyModel();for await(let r of e){let e=!1,i=async()=>{e||(e=!0,await r.drain())};if(r.type===`Directory`){await i();continue}let a=Wn(r.name),o=r.stream;try{await this._processKnownEntry(o,n,a,t)||await this._processDefaultEntry(o,n,a)||await i()}finally{try{await i()}catch{}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async writeBuffer(e){e||={},e.zip=e.zip||{},e.zip.modTime??=this.workbook.modified??this.workbook.created;let t=this.createZipWriter(e.zip),n=this.createStreamBuf();return t.pipe(n),await this.writeToZip(t,e),await this._finalize(t),n.read()||new Uint8Array}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type!==`image`)throw Error(`Unsupported media`);let n=lr(`${t.name??`undefined`}.${t.extension}`);if(t.filename){if(this.readFileAsync){let r=await this.readFileAsync(t.filename);return e.append(r,{name:n})}throw Error(`Loading images from filename is not supported in this environment`)}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64.substring(t.base64.indexOf(`,`)+1);return e.append(r,{name:n,base64:!0})}throw Error(`Unsupported media`)}))}parseRels(e){return new H().parseStream(e)}parseWorkbook(e){return new ti().parseStream(e)}parseSharedStrings(e){return new On().parseStream(e)}reconcile(e,t){let n=new ti,r=new _a(t),i=new Ia,a=new Ua;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};if(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))}),e.rawDrawings&&e.drawingRels)for(let t of Object.keys(e.rawDrawings)){let n=e.drawingRels[t];n&&!this.drawingRelsHasChartReference(n)&&delete e.rawDrawings[t]}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?.date1904,drawings:e.drawings,drawingRels:e.drawingRels,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,e.defaultFont=e.styles?.defaultFont,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels}_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=this._extractTableNumber(e),o=r.get(t.cacheId),s=this._determineMetric(t.dataFields),c={...t,tableNumber:n,cacheId:String(t.cacheId),cacheDefinition:o?.definition,cacheRecords:o?.records,cacheFields:o?.definition?.cacheFields??[],rows:t.rowFields.filter(e=>e>=0),columns:t.colFields.filter(e=>e>=0&&e!==-2),values:t.dataFields.map(e=>e.fld),pages:t.pageFields.map(e=>e.fld),metric:s,valueMetrics:this._determineValueMetrics(t.dataFields,s),applyWidthHeightFormats:t.applyWidthHeightFormats===`1`?`1`:`0`};i.push(c),a[Pr(e)]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a}_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?e[0].subtotal:`sum`}_determineValueMetrics(e,t){return e.map(e=>e.subtotal||t)}async _processWorksheetEntry(e,t,n,r,i){let a=await new _a(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 _o().parseStream(e);t.comments[Mr(n)]=r}async _processTableEntry(e,t,n){let r=await new Ua().parseStream(e);t.tables[Ir(n)]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new H().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.off(`error`,u),s.off(`error`,u),s.off(`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.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,r){let i=r??await this.collectStreamData(e),a=new Ia,o=this.bufferToString(i),s=await a.parseStream(this.createTextStream(o));t.drawings[n]=s,t.rawDrawings[n]=i}async _processDrawingRelsEntry(e,t,n){let r=await new H().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new To().parseStream(e);t.vmlDrawings[jr(n)]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.off(`error`,c),a.off(`error`,c),a.off(`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 uo().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new H().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new io().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheRecordsEntry(e,t,n){let r=await new Xa().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n=this.createEmptyModel(),r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=Wn(e.name),i=Zn(r)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data));await this._processKnownEntry(i,n,r,t)||await this._processDefaultEntry(i,n,r,e.data)}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n,r){let i=Kn(n);if(i!==void 0)return await this._processWorksheetRelsEntry(e,t,i),!0;let a=Jn(n);if(a)return await this._processMediaEntry(e,t,a),!0;let o=Qn(n);if(o)return await this._processDrawingEntry(e,t,o,r),!0;let s=$n(n);if(s)return await this._processDrawingRelsEntry(e,t,s),!0;let c=er(n);if(c)return await this._processVmlDrawingEntry(e,t,c),!0;let l=tr(n);if(l)return await this._processCommentEntry(e,t,`comments${l}`),!0;let u=nr(n);if(u)return await this._processTableEntry(e,t,u),!0;let d=Xn(n);if(d)return await this._processThemeEntry(e,t,d),!0;let f=rr(n);if(f)return await this._processPivotTableEntry(e,t,f),!0;let p=ir(n);if(p)return await this._processPivotTableRelsEntry(e,t,p),!0;let m=ar(n);if(m)return await this._processPivotCacheDefinitionEntry(e,t,m),!0;if(or(n))return!0;let h=sr(n);return h?(await this._processPivotCacheRecordsEntry(e,t,h),!0):Mc.isPassthroughPath(n)?(r?t.passthrough[n]=r:await this._processPassthroughEntry(e,t,n),!0):!1}async _processPassthroughEntry(e,t,n){let r=await this.collectStreamData(e);t.passthrough[n]=r}async addContentTypes(e,t){let n=new Br().toXml(t);e.append(n,{name:U.contentTypes})}async addApp(e,t){let n=new Ur().toXml(t);e.append(n,{name:U.docPropsApp})}async addCore(e,t){let n=new Cn;e.append(n.toXml(t),{name:U.docPropsCore})}async addThemes(e,t){let n=t.themes||{theme1:Do};Object.keys(n).forEach(t=>{let r=n[t];e.append(r,{name:cr(t)})})}async addOfficeRels(t,n){let r=new H().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:U.docPropsApp}]);t.append(r,{name:U.rootRels})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:Er.workbookStyles},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:Er.workbookTheme1}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:Er.workbookSharedStrings}),n.hasCheckboxes&&i.push({Id:`rId${r++}`,Type:e.RelType.FeaturePropertyBag,Target:Er.workbookFeaturePropertyBag});let a=new Map;(n.pivotTables??[]).forEach(t=>{let n=a.get(t.cacheId);n?t.rId=n:(t.rId=`rId${r++}`,a.set(t.cacheId,t.rId),i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:Dr(t.tableNumber)}))}),n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:fr(t.fileIndex)})});let o=new H().toXml(i);t.append(o,{name:U.xlWorkbookRels})}async addFeaturePropertyBag(e,t){if(!t.hasCheckboxes)return;let n=new va;e.append(n.toXml({}),{name:U.xlFeaturePropertyBag})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:U.xlSharedStrings})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:U.xlStyles})}async addWorkbook(e,t){let n=new ti;e.append(n.toXml(t),{name:U.xlWorkbook})}async addWorksheets(e,t){let n=new _a,r=new H,i=new _o,a=new To,o=new Eo;t.worksheets.forEach(t=>{let{fileIndex:s}=t,c=new F;n.render(c,t),e.append(c.xml,{name:ur(s)}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:dr(s)})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:pr(s)}));let l=t.comments.length>0,u=t.formControls&&t.formControls.length>0;(l||u)&&(c=new F,a.render(c,{comments:l?t.comments:[],formControls:u?t.formControls:[]}),e.append(c.xml,{name:hr(s)})),u&&t.formControls.forEach(t=>{let n=o.toXml(t);e.append(n,{name:Rr(t.ctrlPropId)})})})}addDrawings(e,t){let n=new Ia,r=new H,i=t.rawDrawings||{};t.worksheets.forEach(t=>{let{drawing:a}=t;if(a){if(this.drawingHasChartReference(a)&&i[a.name])e.append(i[a.name],{name:_r(a.name)});else{let t=(a.anchors??[]).filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.br&&!e.picture||e.br&&!e.picture&&!e.shape)),r=a.anchors?{...a,anchors:t}:a;n.prepare(r);let i=n.toXml(r);e.append(i,{name:_r(a.name)})}let t=r.toXml(a.rels);e.append(t,{name:vr(a.name)})}})}addTables(e,t){let n=new Ua;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:gr(t.target)})})})}addPassthrough(e,t){let n=new Mc;n.fromRecord(t.passthrough||{}),n.writeToZip(e)}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new Xa,i=new io,a=new uo,o=new H,s=new Map;n.pivotTables.forEach(n=>{let c=n.tableNumber,l=n.isLoaded,u=n.cacheId;if(!s.has(u)){if(s.set(u,c),l){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:yr(c)})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:xr(c)})}}else{let e=r.toXml(n);t.append(e,{name:xr(c)}),e=i.toXml(n),t.append(e,{name:yr(c)})}if(!l||n.cacheRecords){let r=(l?n.cacheDefinition?.rId:void 0)??`rId1`,i=o.toXml([{Id:r,Type:e.RelType.PivotCacheRecords,Target:Sr(c)}]);t.append(i,{name:br(c)})}}let d=a.toXml(n);t.append(d,{name:Cr(c)});let f=s.get(u);d=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:Tr(f)}]),t.append(d,{name:wr(c)})})}_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 On;let n=e.defaultFont;e.styles=e.useStyles?new xn(!0):new xn.Mock,n&&e.styles.setDefaultFont&&e.styles.setDefaultFont(n);let r=new ti,i=new _a;r.prepare(e);let a={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties?.date1904,drawingsCount:0,media:e.media};a.drawings=e.drawings=[],a.commentRefs=e.commentRefs=[],a.formControlRefs=e.formControlRefs=[];let o=0;e.tables=[],e.worksheets.forEach((t,n)=>{t.fileIndex=n+1,t.tables.forEach(t=>{o++,t.target=`table${o}.xml`,t.id=o,e.tables.push(t)}),i.prepare(t,a)}),e.hasCheckboxes=e.styles.hasCheckboxes;let s=e.passthrough||{},c=new Mc;c.fromRecord(s),e.passthroughContentTypes=c.getContentTypes()}};let X=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Z=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,Fc=(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,Ic=[0,31,29,31,30,31,30,31,31,30,31,30,31];function Lc(e,t,n){if(t<1||t>12||n<1||n>Ic[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function Rc(e,t,n,r,i,a){return t<1||t>12||n<1||n>Ic[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function zc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:Lc(Fc(e,0),Z(e,5),Z(e,8))}function Bc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Rc(Fc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Vc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Rc(Fc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Hc(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Uc(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Wc(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 Gc(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 Kc(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Lc(Fc(e,6),Z(e,0),Z(e,3))}function qc(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Lc(Fc(e,6),Z(e,3),Z(e,0))}function Jc(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:Rc(Fc(e,6),Z(e,0),Z(e,3),Z(e,11),Z(e,14),Z(e,17))}function Yc(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:Rc(Fc(e,6),Z(e,3),Z(e,0),Z(e,11),Z(e,14),Z(e,17))}let Xc={"YYYY-MM-DD":zc,"YYYY-MM-DD[T]HH:mm:ss":Bc,"YYYY-MM-DD HH:mm:ss":Vc,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?Hc(e):e.length===25?Wc(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?Uc(e):e.length===29?Gc(e):null,"MM-DD-YYYY":Kc,"MM-DD-YYYY HH:mm:ss":Jc,"MM/DD/YYYY HH:mm:ss":Jc,"DD-MM-YYYY":qc,"DD-MM-YYYY HH:mm:ss":Yc,"DD/MM/YYYY HH:mm:ss":Yc},Zc=[[10,[zc]],[19,[Bc,Vc]],[20,[Hc]],[24,[Uc]],[25,[Wc]],[29,[Gc]]];var Qc=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=>Xc[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of Zc)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}};function $c(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${X[r]}:${X[i]}`}var el=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}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[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}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}${$c(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()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[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()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]} ${X[e.getUTCHours()]}:${X[e.getUTCMinutes()]}:${X[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]} ${X[e.getHours()]}:${X[e.getMinutes()]}:${X[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?`${X[e.getUTCMonth()+1]}${n}${X[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getMonth()+1]}${n}${X[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?`${X[e.getUTCDate()]}${n}${X[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getDate()]}${n}${X[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,X[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,X[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,X[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,X[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,X[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:$c(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 tl(e,t){return t===`,`?String(e).split(`.`).join(`,`):String(e)}function nl(e,t){if(t!==`,`)return Number(e);let n=e.trim();return/^-?\d+(,\d+)?([eE][+-]?\d+)?$/.test(n)?Number(n.replace(`,`,`.`)):Number(e)}function rl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function il(e){return e.length===1}function al(e){return e.length===1}function ol(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 sl(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,ee=x?String(r):``,S=i!==null&&i!==!1?String(i):``,te=[],ne=[],C=[],w=``,re=!1,T=0,ie=0,ae=0,oe=0,E=null,se=0,D=!1,ce=!1;u===!0?D=!0:Array.isArray(u)?(E=u,se=u.filter(e=>e!=null).length,ol(u),D=!0,d||(ce=!0)):typeof u==`function`&&(D=!0);let O=s||c&&l?e=>e.trim():c?e=>e.trimStart():l?e=>e.trimEnd():e=>e,le=e=>{if(D&&!ce){if(typeof u==`function`){let t=u(e);ol(t),E=t}else Array.isArray(u)||(ol(e),E=e);return se=E.filter(e=>e!=null).length,ce=!0,!1}if(oe<h)return oe++,!1;if(E&&E.length>0){let t=se,n=e.length;if(n>t){if(g&&!_)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=E.length}else if(n<t){if(g)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<E.length;)e.push(``)}}return!0},ue=e.length;for(;T<ue;){let t=e[T];if(re&&x)S&&t===S&&e[T+1]===ee?(w+=ee,T+=2):t===ee?(re=!1,T++):t===`\r`?(e[T+1]===`
|
|
32
|
+
<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>`,Oo=new TextEncoder;var ko=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),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._buf.slice(0,this._inPos),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=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=Oo.encode(e),n=this._inPos+t.length;n>this._buf.length-4&&this._grow(n),this._buf.set(t,this._inPos),this._inPos+=t.length}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}},Ao=class{constructor(e){this._data=e}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}},jo=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()}},Mo=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);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},No=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}},Po=class extends M{constructor(e){super(),this._writableStream=null,this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),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._ended=!1}get writable(){return!this._ended}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 No(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_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){typeof t==`function`&&(n=t),n||=()=>{};let r;if(e instanceof ko||e&&e.constructor?.name===`StringBuf`)r=new jo(e);else if(e instanceof Uint8Array)r=new Mo(e);else if(ArrayBuffer.isView(e))r=new Mo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Mo(new Uint8Array(e));else if(typeof e==`string`)r=new Ao(e);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;){let e=this.buffers.shift();await this._pipeChunk(new Mo(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer();this.paused||this.emit(`data`,e),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e))),this._writeToBuffers(r),this.emit(`readable`)}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Mo(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`)}).catch(e=>{this.emit(`error`,e)}):this.emit(`finish`)};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return Fo(t)}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],Fo(t)}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return typeof Buffer<`u`&&n instanceof Buffer?n.toString(t):new TextDecoder(t).decode(n)}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}pipeTo(e){this._writableStream=e,this._writableStreamWriter=e.getWriter()}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 Fo(e){if(typeof Buffer<`u`&&typeof Buffer.concat==`function`)return Buffer.concat(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}let Io=null;function Lo(){if(Io)return Io;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 Io=e,e}function Ro(e,t){let n=Lo();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function zo(e){return(e^4294967295)>>>0}function Bo(e){return zo(Ro(4294967295,e))}function Vo(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}function Ho(e){let t=e.length;if(t===0)return new Uint8Array;if(t===1)return e[0];let n=Vo(e),r=new Uint8Array(n),i=0;for(let n=0;n<t;n++){let t=e[n];r.set(t,i),i+=t.length}return r}function Uo(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}let Wo=new Uint8Array(288);for(let e=0;e<=143;e++)Wo[e]=8;for(let e=144;e<=255;e++)Wo[e]=9;for(let e=256;e<=279;e++)Wo[e]=7;for(let e=280;e<=287;e++)Wo[e]=8;let Go=new Uint8Array(32).fill(5),Ko=[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],qo=[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],Jo=[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],Yo=[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],Xo=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Zo(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 Qo=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 $o(e){let t=new Qo(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=Zo(Wo,288),i=Zo(Go,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[Xo[e]]=t.readBits(3);let s=Zo(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=Zo(c.subarray(0,e),e),i=Zo(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=Ko[r]+t.readBits(qo[r]),o=t.decodeSymbol(i),s=Jo[o]+t.readBits(Yo[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 es(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 ts(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return es(e);let t=new ns;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?(os(t,i),ss(t,a),r+=i):(as(t,e[r]),r++)}return as(t,256),t.finish()}var ns=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(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),Ho(this.chunks))}};let rs=[],is=[];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),rs[e]=[t,n],is[e]=n}function as(e,t){let[n,r]=rs[t];e.writeBitsReverse(n,r)}function os(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;as(e,n),r>0&&e.writeBits(i,r)}function ss(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)}var cs=class e{static{this.EMPTY=new Uint8Array}constructor(e){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return e.EMPTY;if(this._chunks.length===1)return this._chunks[0].subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let t=new Uint8Array(this._length),n=0;for(let e=0;e<this._chunks.length;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=e===this._chunks.length-1?i+(this._length-n):r.length;if(t.set(r.subarray(i,a),n),n+=a-i,n>=t.length)break}return this._cachedView=t,this._cachedLength=this._length,t}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return new Uint8Array;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._chunks.length===1){let t=this._chunks[0],n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._headOffset=0):this._headOffset>=t.length&&(this._chunks.shift(),this._headOffset=0),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._chunks[0],i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}return this._length===0&&(this._chunks=[],this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._chunks.length===1){let t=this._chunks[0],n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=0;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._chunks[0],n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}this._length===0&&(this._chunks=[],this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._chunks.length===1){let t=this._chunks[0],a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):Uo(o,e,i)}if(n>4)return Uo(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},d=0;for(let e=0;e<l.length;e++){let t=l[e],f=e===0?this._headOffset:0,p=t.length-f;if(p<=0)continue;let m=d,h=m+p,g=i<=m?f:i>=h?t.length:f+(i-m);if(g>t.length-1){d+=p;continue}let _=t.length-1,v=t.indexOf(a,g);for(;v!==-1&&v<=_;){let i=m+(v-f);if(i>r-n)return-1;if(n===1)return i;if(v+n<=t.length){if(t[v+1]!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;if(t[v+2]!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;if(t[v+3]!==c){v=t.indexOf(a,v+1);continue}return i}let l=u(e,v+1);if(l===null||l!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;let d=u(e,v+2);if(d===null||d!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;let p=u(e,v+3);if(p===null||p!==c){v=t.indexOf(a,v+1);continue}return i}d+=p}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=0;e<n.length;e++){let t=n[e],i=e===0?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=0;e<this._chunks.length;e++){let t=this._chunks[e],r=e===0?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function ls(){return typeof CompressionStream<`u`}function us(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function ds(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let fs=null,ps=null;function ms(){return typeof CompressionStream>`u`?!1:(fs===null&&(fs=us()),fs)}function hs(){return typeof DecompressionStream>`u`?!1:(ps===null&&(ps=ds()),ps)}function gs(){return ms()&&hs()}async function _s(e){let t=new cs;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function vs(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=_s(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function ys(e){return vs(e,new CompressionStream(`deflate-raw`))}async function bs(e){return vs(e,new DecompressionStream(`deflate-raw`))}function xs(e){return e instanceof Error?e:Error(String(e))}function Ss(){return!0}function Cs(){return gs()}var ws=class extends M{constructor(e,t){super(),this.ended=!1,this.writer=e,this.reader=t,this.readPromise=this._startReading()}async _startReading(){try{for(;;){let{value:e,done:t}=await this.reader.read();if(t)break;e&&this.emit(`data`,e)}this.emit(`end`)}catch(e){this.emit(`error`,xs(e))}}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.writer.write(e).then(()=>{t&&t()}).catch(e=>{let n=xs(e);t?t(n):this.emit(`error`,n)}),!0}end(e){if(this.ended){e&&e();return}this.ended=!0,this.writer.close().then(()=>this.readPromise).then(()=>{e&&e()}).catch(t=>{let n=xs(t);e?e(n):this.emit(`error`,n)})}destroy(e){this.ended=!0,e&&this.emit(`error`,e);try{this.reader.cancel(e)}catch{}try{this.writer.abort(e)}catch{}}},Ts=class extends M{constructor(e){super();let t=new CompressionStream(`deflate-raw`);this.codec=new ws(t.writable.getWriter(),t.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Es=class extends M{constructor(e){super(),this.codec=new Ds(ts),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Ds=class extends M{constructor(e){super(),this.process=e,this.chunks=[],this.ended=!1}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.chunks.push(e),t&&queueMicrotask(()=>t()),!0}end(e){if(this.ended){e&&e();return}this.ended=!0;try{let t=Ho(this.chunks),n=this.process(t);this.emit(`data`,n),this.emit(`end`),e&&e()}catch(t){let n=xs(t);this.emit(`error`,n),e&&e(n)}}destroy(e){this.ended=!0,e&&this.emit(`error`,e)}};function Os(e={}){let t=e.level??6;return Cs()?new Ts(t):new Es(t)}var ks=class extends M{constructor(){super();let e=new DecompressionStream(`deflate-raw`);this.codec=new ws(e.writable.getWriter(),e.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},As=class extends M{constructor(){super(),this.codec=new Ds($o),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}};function js(){return Cs()?new ks:new As}let Ms=new TextEncoder,Ns=new TextDecoder(`utf-8`);function Ps(e){return Ms.encode(e)}function Fs(e){return Ns.decode(e)}function Is(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n){let i=e.subarray(r,r+n);t+=String.fromCharCode(...i)}return t}function Ls(e){return!Number.isFinite(e)||e<=0?0:e>=4294967295?4294967295:e>>>0}function Rs(e){return Ls(Math.floor(e.getTime()/1e3))}function zs(e){let t=Ls(e),n=new Uint8Array(9),r=new DataView(n.buffer);return r.setUint16(0,21589,!0),r.setUint16(2,5,!0),n[4]=1,r.setUint32(5,t,!0),n}function Bs(e){return zs(Rs(e))}function Vs(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]}function Hs(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 Us(e,t,n){return n===void 0?Hs(e,t):new Date(n*1e3)}function Ws(e,t){return t===`dos+utc`?Bs(e):new Uint8Array}function Gs(e){let[t,n]=Vs(e);return{dosTime:t,dosDate:n}}let Ks=67324752,qs=33639248,Js=101010256,Ys=134695760,Xs=101075792,Zs=2048;function Qs(e,t,n,r){let i=r.versionNeeded??20;return t.setUint32(n+0,Ks,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,r.flags,!0),t.setUint16(n+8,r.compressionMethod,!0),t.setUint16(n+10,r.dosTime,!0),t.setUint16(n+12,r.dosDate,!0),t.setUint32(n+14,r.crc32,!0),t.setUint32(n+18,r.compressedSize,!0),t.setUint32(n+22,r.uncompressedSize,!0),t.setUint16(n+26,r.fileName.length,!0),t.setUint16(n+28,r.extraField.length,!0),e.set(r.fileName,n+30),r.extraField.length>0&&e.set(r.extraField,n+30+r.fileName.length),30+r.fileName.length+r.extraField.length}function $s(e){let t=new Uint8Array(30+e.fileName.length+e.extraField.length);return Qs(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function ec(e,t,n,r){let i=r.versionMadeBy??20,a=r.versionNeeded??20,o=r.externalAttributes??0;return t.setUint32(n+0,qs,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,a,!0),t.setUint16(n+8,r.flags,!0),t.setUint16(n+10,r.compressionMethod,!0),t.setUint16(n+12,r.dosTime,!0),t.setUint16(n+14,r.dosDate,!0),t.setUint32(n+16,r.crc32,!0),t.setUint32(n+20,r.compressedSize,!0),t.setUint32(n+24,r.uncompressedSize,!0),t.setUint16(n+28,r.fileName.length,!0),t.setUint16(n+30,r.extraField.length,!0),t.setUint16(n+32,r.comment.length,!0),t.setUint16(n+34,0,!0),t.setUint16(n+36,0,!0),t.setUint32(n+38,o,!0),t.setUint32(n+42,r.localHeaderOffset,!0),e.set(r.fileName,n+46),r.extraField.length>0&&e.set(r.extraField,n+46+r.fileName.length),r.comment.length>0&&e.set(r.comment,n+46+r.fileName.length+r.extraField.length),46+r.fileName.length+r.extraField.length+r.comment.length}function tc(e){let t=new Uint8Array(46+e.fileName.length+e.extraField.length+e.comment.length);return ec(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function nc(e,t,n,r){return t.setUint32(n+0,Js,!0),t.setUint16(n+4,0,!0),t.setUint16(n+6,0,!0),t.setUint16(n+8,r.entryCount,!0),t.setUint16(n+10,r.entryCount,!0),t.setUint32(n+12,r.centralDirSize,!0),t.setUint32(n+16,r.centralDirOffset,!0),t.setUint16(n+20,r.comment.length,!0),r.comment.length>0&&e.set(r.comment,n+22),22+r.comment.length}function rc(e){let t=new Uint8Array(22+e.comment.length);return nc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function ic(e,t,n){let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setUint32(0,Ys,!0),i.setUint32(4,e,!0),i.setUint32(8,t,!0),i.setUint32(12,n,!0),r}function ac(e){return e?8:0}function oc(e){return e?Zs|8:Zs}function sc(e){let t=Ps(e.name),n=Ps(e.comment??``),{dosTime:r,dosDate:i}=Gs(e.modTime);return{nameBytes:t,commentBytes:n,dosTime:r,dosDate:i,extraField:Ws(e.modTime,e.timestamps),compressionMethod:ac(e.deflate),flags:oc(e.useDataDescriptor)}}function cc(e){return Math.log(e)/Math.LN2}function lc(e){let t=new Uint32Array(256);for(let n=0;n<e.length;n++)t[e[n]]+=1;let n=0,r=e.length;for(let e=0;e<256;e++){let i=t[e];if(i===0)continue;let a=i/r;n-=a*cc(a)}return n}function uc(e,t={}){let n=t.sampleBytes??65536,r=t.minDecisionBytes??16384,i=Math.min(e.length,n);if(i<r)return!1;let a=e.subarray(0,i),o=new Uint8Array(256),s=0;for(let e=0;e<a.length;e++){let t=a[e];if(o[t]===0&&(o[t]=1,s+=1,s>=200))break}return s<200?!1:lc(a)>=7.95}var dc=class{constructor(e,t){this._deflate=null,this._crc=4294967295,this._uncompressedSize=0,this._compressedSize=0,this._finalized=!1,this._headerEmitted=!1,this._ondata=null,this._onerror=null,this._centralDirEntryInfo=null,this._pendingEnd=!1,this._emittedDataDescriptor=!1,this._localHeader=null,this._deflateWanted=null,this._pendingChunks=[],this._sampleLen=0,this._completeResolve=null,this._completeReject=null,this._completePromise=null,this._completeError=null,this._dataQueue=[],this._finalQueued=!1,this._pushChain=Promise.resolve(),this.name=e;let n=t?.modTime??new Date;this._modTime=n,this.level=t?.level??6,this._smartStore=t?.smartStore??!0,this._sampleBuffer=this._smartStore?new Uint8Array(64*1024):new Uint8Array;let r=sc({name:e,comment:t?.comment??``,modTime:n,timestamps:t?.timestamps??`dos`,useDataDescriptor:!0,deflate:!1});if(this.nameBytes=r.nameBytes,this.commentBytes=r.commentBytes,this.dosTime=r.dosTime,this.dosDate=r.dosDate,this.extraField=r.extraField,this._flags=r.flags,this._compressionMethod=r.compressionMethod,!this._smartStore){let e=this.level>0;this._deflateWanted=e,this._compressionMethod=this._buildCompressionMethod(e),e&&this._initDeflateStream();return}this.level===0&&(this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1))}_buildCompressionMethod(e){return ac(e)}_initDeflateStream(){this._deflate||(this._deflate=Os({level:this.level}),this._deflate.on(`error`,e=>{this._rejectComplete(e)}),this._deflate.on(`data`,e=>{this._compressedSize+=e.length,this._enqueueData(e,!1)}),this._deflate.on(`end`,()=>{this._pendingEnd&&!this._emittedDataDescriptor&&(this._emittedDataDescriptor=!0,this._emitDataDescriptor())}))}_buildLocalHeader(){return $s({fileName:this.nameBytes,extraField:this.extraField,flags:this._flags,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,crc32:0,compressedSize:0,uncompressedSize:0,versionNeeded:20})}_accumulateSample(e){if(this._deflateWanted!==null||this._sampleLen>=this._sampleBuffer.length)return;let t=Math.min(this._sampleBuffer.length-this._sampleLen,e.length);t<=0||(this._sampleBuffer.set(e.subarray(0,t),this._sampleLen),this._sampleLen+=t)}_shouldDecide(e){return this._deflateWanted===null?e||this._sampleLen>=16*1024:!1}_decideCompressionIfNeeded(e){if(this._deflateWanted===null){if(e&&this._sampleLen===0){this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1),this._localHeader=null;return}this._deflateWanted=!uc(this._sampleBuffer.subarray(0,this._sampleLen)),this._compressionMethod=this._buildCompressionMethod(this._deflateWanted),this._localHeader=null,this._deflateWanted&&this._initDeflateStream()}}_emitHeaderIfNeeded(){this._headerEmitted||=(this._emitHeader(),!0)}async _flushPendingChunks(){if(this._pendingChunks.length!==0){for(let e of this._pendingChunks)await this._writeData(e);this._pendingChunks=[]}}_enqueueData(e,t){this._ondata?this._ondata(e,t):(this._dataQueue.push(e),t&&(this._finalQueued=!0))}_flushQueue(){if(!this._ondata)return;let e=this._dataQueue.length,t=this._finalQueued?e-1:-1;for(let n=0;n<e;n++)this._ondata(this._dataQueue[n],n===t);this._dataQueue=[],this._finalQueued=!1}get ondata(){return this._ondata??void 0}set ondata(e){this._ondata=e,this._flushQueue()}get onerror(){return this._onerror??void 0}set onerror(e){this._onerror=e,this._completeError&&e(this._completeError)}_resolveComplete(){this._completeResolve&&this._completeResolve()}_rejectComplete(e){this._completeError||(this._completeError=e,this._onerror&&this._onerror(e),this._completeReject&&this._completeReject(e))}_ensureCompletePromise(){return this._completeError?Promise.reject(this._completeError):this._emittedDataDescriptor?Promise.resolve():(this._completePromise||=new Promise((e,t)=>{this._completeResolve=e,this._completeReject=t}),this._completePromise)}_tapCallback(e,t){t&&e.then(()=>t()).catch(e=>t(e))}_writeData(e){return e.length===0?Promise.resolve():(this._crc=Ro(this._crc,e),this._uncompressedSize+=e.length,this._deflate?new Promise((t,n)=>{this._deflate.write(e,e=>{e?n(e):t()})}):(this._compressedSize+=e.length,this._enqueueData(e,!1),Promise.resolve()))}_endDeflateAndWait(){return new Promise((e,t)=>{let n=this._deflate,r=e=>{a(),t(e)},i=()=>{a(),e()},a=()=>{n.off(`error`,r),n.off(`end`,i)};n.once(`error`,r),n.once(`end`,i),n.end()})}_finalizeAfterWrite(e){this._finalized=!0,this._pendingEnd=!0;let t=this._ensureCompletePromise();return this._deflate?e.then(()=>this._endDeflateAndWait()).then(()=>t):(this._emittedDataDescriptor=!0,this._emitDataDescriptor(),t)}_pushUnchained(e,t,n){if(this._finalized){let e=Promise.reject(Error(`Cannot push to finalized ZipDeflateFile`));return this._tapCallback(e,n),e}if(this._deflateWanted===null){if(this._accumulateSample(e),!this._shouldDecide(t)){e.length>0&&this._pendingChunks.push(e);let t=Promise.resolve();return this._tapCallback(t,n),t}this._decideCompressionIfNeeded(t),this._emitHeaderIfNeeded();let r=this._pendingChunks.length>0,i=this._flushPendingChunks(),a=i;e.length>0&&(a=r?i.then(()=>this._writeData(e)):this._writeData(e));let o=t?this._finalizeAfterWrite(a):a;return this._tapCallback(o,n),o}this._emitHeaderIfNeeded();let r=this._writeData(e),i=t?this._finalizeAfterWrite(r):r;return this._tapCallback(i,n),i}push(e,t=!1,n){let r=this._pushChain=this._pushChain.then(()=>this._pushUnchained(e,t,n));return r.catch(()=>{}),r}_emitHeader(){this._localHeader||=this._buildLocalHeader(),this._enqueueData(this._localHeader,!1)}_emitDataDescriptor(){let e=zo(this._crc),t=ic(e,this._compressedSize,this._uncompressedSize);this._centralDirEntryInfo={name:this.nameBytes,extraField:this.extraField,comment:this.commentBytes,flags:this._flags,crc:e,compressedSize:this._compressedSize,uncompressedSize:this._uncompressedSize,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,offset:-1},this._enqueueData(t,!0),this._resolveComplete()}complete(){return this._ensureCompletePromise()}getEntryInfo(){if(!this._centralDirEntryInfo)return null;let e=this.name;return{path:e,isDirectory:e.endsWith(`/`)||e.endsWith(`\\`),compressedSize:this._centralDirEntryInfo.compressedSize,uncompressedSize:this._centralDirEntryInfo.uncompressedSize,compressionMethod:this._centralDirEntryInfo.compressionMethod,crc32:this._centralDirEntryInfo.crc,lastModified:this._modTime,localHeaderOffset:this._centralDirEntryInfo.offset,comment:Fs(this._centralDirEntryInfo.comment),externalAttributes:0,isEncrypted:!1}}getCentralDirectoryEntryInfo(){return this._centralDirEntryInfo}isComplete(){return this._emittedDataDescriptor&&this._centralDirEntryInfo!==null}},fc=class{constructor(e,t){this.entries=[],this.currentOffset=0,this.ended=!1,this.endPending=!1,this.fileQueue=[],this.fileQueueIndex=0,this.activeFile=null,this.callback=e,this.zipComment=t?.comment?Ps(t.comment):new Uint8Array}add(e){if(this.ended)throw Error(`Cannot add files after calling end() `);this.fileQueue.push(e),this.activeFile||this._processNextFile()}_processNextFile(){if(this.fileQueueIndex>=this.fileQueue.length){this.activeFile=null,this.fileQueue=[],this.fileQueueIndex=0,this.endPending&&this._finalize();return}let e=this.fileQueue[this.fileQueueIndex++];this.activeFile=e;let t=this.currentOffset,n=new Uint8Array;e.onerror=e=>{this.ended||(this.ended=!0,this.callback(e,n,!0))},e.ondata=(n,r)=>{if(!this.ended&&(this.currentOffset+=n.length,this.callback(null,n,!1),r)){let n=e.getCentralDirectoryEntryInfo();n&&(n.offset=t,this.entries.push(n)),this._processNextFile()}}}_finalize(){if(this.ended)return;this.ended=!0;let e=this.currentOffset,t=0,n=new Uint8Array;for(let e of this.entries){let r=tc({fileName:e.name,extraField:e.extraField,comment:e.comment??n,flags:e.flags,compressionMethod:e.compressionMethod,dosTime:e.dosTime,dosDate:e.dosDate,crc32:e.crc,compressedSize:e.compressedSize,uncompressedSize:e.uncompressedSize,localHeaderOffset:e.offset,versionMadeBy:20,versionNeeded:20});t+=r.length,this.callback(null,r,!1)}let r=rc({entryCount:this.entries.length,centralDirSize:t,centralDirOffset:e,comment:this.zipComment});this.callback(null,r,!0)}end(){this.endPending||this.ended||(this.endPending=!0,this.activeFile||this._finalize())}};async function pc(e,t={}){return(t.level??6)===0?e:ms()?ys(e):ts(e)}function mc(e,t={}){return(t.level??6)===0?e:ts(e)}async function hc(e,t={}){return hs()?bs(e):$o(e)}function gc(e){return $o(e)}function _c(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}function vc(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!0)}var yc=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?Fs(n):Is(n)}skip(e){this.offset+=e}slice(e,t){return this.data.subarray(e,t)}peekUint32(e){return this.view.getUint32(e,!0)}};function bc(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0;for(;n+4<=e.length;){let r=t.getUint16(n,!0),i=t.getUint16(n+2,!0),a=n+4,o=a+i;if(o>e.length)break;if(r===21589&&i>=1&&e[a]&1&&i>=5)return t.getUint32(a+1,!0)>>>0;n=o}}function xc(e,t){let n=e.getUint32(t,!0);return e.getUint32(t+4,!0)*4294967296+n}function Sc(e,t){let n={};if(e.length<4)return n;let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(;i+4<=e.length;){let a=r.getUint16(i,!0),o=r.getUint16(i+2,!0),s=i+4,c=s+o;if(c>e.length)break;if(a===1){let e=s;t.uncompressedSize===4294967295&&e+8<=c&&(n.uncompressedSize=xc(r,e),e+=8),t.compressedSize===4294967295&&e+8<=c&&(n.compressedSize=xc(r,e),e+=8),t.offsetToLocalFileHeader===4294967295&&e+8<=c&&(n.offsetToLocalFileHeader=xc(r,e))}else if(a===21589){let t=bc(e.subarray(i,c));t!==void 0&&(n.mtimeUnixSeconds=t)}i=c}return t.compressedSize===4294967295&&(t.compressedSize=n.compressedSize),t.uncompressedSize===4294967295&&(t.uncompressedSize=n.uncompressedSize),t.offsetToLocalFileHeader===4294967295&&(t.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}function Cc(e){let t=Math.max(0,e.length-65557);for(let n=e.length-22;n>=t;n--)if(e[n]===80&&e[n+1]===75&&e[n+2]===5&&e[n+3]===6)return n;return-1}function wc(e,t){let n=t-20;return n<0?-1:e[n]===80&&e[n+1]===75&&e[n+2]===6&&e[n+3]===7?n:-1}function Tc(e,t={}){let{decodeStrings:n=!0}=t,r=[],i=Cc(e);if(i===-1)throw Error(`Invalid ZIP file: End of Central Directory not found`);let a=new yc(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=wc(e,i);if(c!==-1){let t=new yc(e,c);t.skip(4),t.skip(4);let n=new yc(e,Number(t.readBigUint64()));if(n.readUint32()===Xs){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)}}o>0&&(r=Array(o));let l=new yc(e,s);for(let e=0;e<o;e++){if(l.readUint32()!==qs)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=d>0?l.readString(d,_):``,y={};if(f>0){let e=l.readBytes(f),t={compressedSize:c,uncompressedSize:u,offsetToLocalFileHeader:h};y=Sc(e,t),c=t.compressedSize,u=t.uncompressedSize,h=t.offsetToLocalFileHeader??h}let b=p>0?l.readString(p,_):``,x=v.endsWith(`/`)||(m&16)!=0,ee=(t&1)!=0,S=y.mtimeUnixSeconds,te=Us(o,a,S);r[e]={path:v,isDirectory:x,compressedSize:c,uncompressedSize:u,compressionMethod:i,crc32:s,lastModified:te,localHeaderOffset:h,comment:b,externalAttributes:m,isEncrypted:ee}}return r}async function Ec(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Oc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return hc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Dc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Oc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return gc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Oc(e,t){let n=new yc(e,t.localHeaderOffset);if(n.readUint32()!==Ks)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();return n.skip(r),n.skip(i),n.readBytes(t.compressedSize)}var kc=class{constructor(e,t={}){this.data=e instanceof ArrayBuffer?new Uint8Array(e):e,this.entries=Tc(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?Ec(this.data,t):null}extractSync(e){let t=this.entryMap.get(e);return t?Dc(this.data,t):null}async extractAll(){let e=new Map;for(let t of this.entries){let n=await Ec(this.data,t);e.set(t.path,n)}return e}extractAllSync(){let e={};for(let t of this.entries)e[t.path]=Dc(this.data,t);return e}async forEach(e){for(let t of this.entries){let n=null;if(await e(t,()=>(n||=Ec(this.data,t),n))===!1)break}}};let Ac=new Map([[/^xl\/charts\/chart\d+\.xml$/,`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`],[/^xl\/charts\/style\d+\.xml$/,`application/vnd.ms-office.chartstyle+xml`],[/^xl\/charts\/colors\d+\.xml$/,`application/vnd.ms-office.chartcolorstyle+xml`]]),jc=[`xl/charts/`];var Mc=class e{constructor(){this.files=new Map}static isPassthroughPath(e){return jc.some(t=>e.startsWith(t))}static getContentType(e){if(!e.startsWith(`xl/charts/_rels/`)){for(let[t,n]of Ac)if(t.test(e))return n}}add(e,t){this.files.set(e,t)}get(e){return this.files.get(e)}has(e){return this.files.has(e)}getPaths(){return[...this.files.keys()]}toRecord(){let e={};for(let[t,n]of this.files)e[t]=n;return e}fromRecord(e){this.files.clear();for(let[t,n]of Object.entries(e))this.files.set(t,n)}getContentTypes(){let t=[];for(let n of this.files.keys()){let r=e.getContentType(n);r&&t.push({partName:n,contentType:r})}return t}writeToZip(e){for(let[t,n]of this.files)e.append(n,{name:t})}clear(){this.files.clear()}get size(){return this.files.size}},Nc=class e{static{this.textEncoder=new TextEncoder}constructor(e){this.events=new Map,this.pipedStream=null,this.finalized=!1,this.level=e?.level??6,this.modTime=e?.modTime,this.timestamps=e?.timestamps,this.zip=new fc((e,t,n)=>{if(e){this._emit(`error`,e);return}t&&t.length>0&&(this._emit(`data`,t),this.pipedStream&&this.pipedStream.write(t)),n&&(this.pipedStream&&this.pipedStream.end(),this._emit(`finish`))})}_emit(e,...t){let n=this.events.get(e);if(n)for(let e of n)e(...t)}on(e,t){let n=this.events.get(e)||new Set;return n.add(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);return n?(n.delete(t),n.size===0&&this.events.delete(e),this):this}pipe(e){this.pipedStream=e}append(t,n){if(this.finalized)throw Error(`Cannot append after finalize`);let r;r=n.base64?Ce(typeof t==`string`?t:String(t)):typeof t==`string`?e.textEncoder.encode(t):t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):t;let i=new dc(n.name,{level:this.level,modTime:this.modTime,timestamps:this.timestamps});this.zip.add(i),i.push(r,!0)}finalize(){this.finalized||(this.finalized=!0,this.zip.end())}},Pc=class e{static{this.RelType=G}constructor(e){this.workbook=e}createBinaryStream(e){let t=new ot;return t.end(e),t}createTextStream(e){let t=new ot;return t.end(e),t}createStreamBuf(){return new Po}bufferToString(e){return Le(e)}createZipWriter(e){return new Nc(e)}async writeToZip(e,t){let{model:n}=this.workbook;this.prepareModel(n,t),await this.addContentTypes(e,n),await this.addOfficeRels(e,n),await this.addWorkbookRels(e,n),await this.addWorksheets(e,n),await this.addSharedStrings(e,n),this.addDrawings(e,n),this.addTables(e,n),this.addPivotTables(e,n),this.addPassthrough(e,n),await Promise.all([this.addThemes(e,n),this.addStyles(e,n)]),await this.addFeaturePropertyBag(e,n),await this.addMedia(e,n),await Promise.all([this.addApp(e,n),this.addCore(e,n)]),await this.addWorkbook(e,n)}async read(e,t){let n=[];return await new Promise((t,r)=>{let i=e=>{n.push(e)},a=()=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),t()},o=t=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),r(t)};e.on(`data`,i),e.on(`end`,a),e.on(`error`,o)}),this.loadBuffer(Ke(n),t)}async write(e,t){t||={},t.zip=t.zip||{},t.zip.modTime??=this.workbook.modified??this.workbook.created;let n=this.createZipWriter(t.zip);return n.pipe(e),await this.writeToZip(n,t),this._finalize(n)}async load(e,t){let n,r=typeof Buffer<`u`?Buffer.isBuffer(e):!1;if(!e||typeof e==`object`&&!r&&!(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) ?`);return n=t&&t.base64?Ce(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e),this.loadBuffer(n,t)}async loadBuffer(e,t){let n=await new kc(e).extractAll(),r={};for(let[e,t]of n)r[e]=t;return this.loadFromFiles(r,t)}createEmptyModel(){return{worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},rawDrawings:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheRecords:{},passthrough:{}}}async collectStreamData(e){let t=[];return await new Promise((n,r)=>{e.on(`data`,e=>{typeof e==`string`?t.push(new TextEncoder().encode(e)):e instanceof Uint8Array?t.push(e):t.push(new Uint8Array(e))}),e.on(`end`,()=>n()),e.on(`error`,r)}),Ke(t)}drawingHasChartReference(e){return e.rels&&e.rels.some(e=>e.Target&&e.Target.includes(`/charts/`))}drawingRelsHasChartReference(e){return Array.isArray(e)&&e.some(e=>typeof e?.Target==`string`&&e.Target.includes(`/charts/`))}async _processKnownEntry(e,t,n,r){let i=Gn(n);if(i!==void 0)return await this._processWorksheetEntry(e,t,i,r,n),!0;switch(n){case U.rootRels:return t.globalRels=await this.parseRels(e),!0;case U.xlWorkbook:{let n=await this.parseWorkbook(e);return t.sheets=n.sheets,t.definedNames=n.definedNames,t.views=n.views,t.properties=n.properties,t.calcProperties=n.calcProperties,t.pivotCaches=n.pivotCaches,!0}case U.xlSharedStrings:return t.sharedStrings=new On,await t.sharedStrings.parseStream(e),!0;case U.xlWorkbookRels:return t.workbookRels=await this.parseRels(e),!0;case U.docPropsApp:{let n=await new Ur().parseStream(e);return n&&(t.company=n.company,t.manager=n.manager),!0}case U.docPropsCore:{let n=await new Cn().parseStream(e);return Object.assign(t,n),!0}case U.xlStyles:return t.styles=new xn,await t.styles.parseStream(e),!0;default:return!1}}async loadFromZipEntries(e,t){let n=this.createEmptyModel();for await(let r of e){let e=!1,i=async()=>{e||(e=!0,await r.drain())};if(r.type===`Directory`){await i();continue}let a=Wn(r.name),o=r.stream;try{await this._processKnownEntry(o,n,a,t)||await this._processDefaultEntry(o,n,a)||await i()}finally{try{await i()}catch{}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async writeBuffer(e){e||={},e.zip=e.zip||{},e.zip.modTime??=this.workbook.modified??this.workbook.created;let t=this.createZipWriter(e.zip),n=this.createStreamBuf();return t.pipe(n),await this.writeToZip(t,e),await this._finalize(t),n.read()||new Uint8Array}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type!==`image`)throw Error(`Unsupported media`);let n=lr(`${t.name??`undefined`}.${t.extension}`);if(t.filename){if(this.readFileAsync){let r=await this.readFileAsync(t.filename);return e.append(r,{name:n})}throw Error(`Loading images from filename is not supported in this environment`)}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64.substring(t.base64.indexOf(`,`)+1);return e.append(r,{name:n,base64:!0})}throw Error(`Unsupported media`)}))}parseRels(e){return new H().parseStream(e)}parseWorkbook(e){return new ti().parseStream(e)}parseSharedStrings(e){return new On().parseStream(e)}reconcile(e,t){let n=new ti,r=new _a(t),i=new Ia,a=new Ua;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};if(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))}),e.rawDrawings&&e.drawingRels)for(let t of Object.keys(e.rawDrawings)){let n=e.drawingRels[t];n&&!this.drawingRelsHasChartReference(n)&&delete e.rawDrawings[t]}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,drawingRels:e.drawingRels,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,e.defaultFont=e.styles?.defaultFont,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels}_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=this._extractTableNumber(e),o=r.get(t.cacheId),s=this._determineMetric(t.dataFields),c={...t,tableNumber:n,cacheId:String(t.cacheId),cacheDefinition:o?.definition,cacheRecords:o?.records,cacheFields:o?.definition?.cacheFields??[],rows:t.rowFields.filter(e=>e>=0),columns:t.colFields.filter(e=>e>=0&&e!==-2),values:t.dataFields.map(e=>e.fld),pages:t.pageFields.map(e=>e.fld),metric:s,valueMetrics:this._determineValueMetrics(t.dataFields,s),applyWidthHeightFormats:t.applyWidthHeightFormats===`1`?`1`:`0`};i.push(c),a[Pr(e)]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a}_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?e[0].subtotal:`sum`}_determineValueMetrics(e,t){return e.map(e=>e.subtotal||t)}async _processWorksheetEntry(e,t,n,r,i){let a=await new _a(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 _o().parseStream(e);t.comments[Mr(n)]=r}async _processTableEntry(e,t,n){let r=await new Ua().parseStream(e);t.tables[Ir(n)]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new H().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.off(`error`,u),s.off(`error`,u),s.off(`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.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,r){let i=r??await this.collectStreamData(e),a=new Ia,o=this.bufferToString(i),s=await a.parseStream(this.createTextStream(o));t.drawings[n]=s,t.rawDrawings[n]=i}async _processDrawingRelsEntry(e,t,n){let r=await new H().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new To().parseStream(e);t.vmlDrawings[jr(n)]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.off(`error`,c),a.off(`error`,c),a.off(`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 uo().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new H().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new io().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheRecordsEntry(e,t,n){let r=await new Xa().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n=this.createEmptyModel(),r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=Wn(e.name),i=Zn(r)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data));await this._processKnownEntry(i,n,r,t)||await this._processDefaultEntry(i,n,r,e.data)}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n,r){let i=Kn(n);if(i!==void 0)return await this._processWorksheetRelsEntry(e,t,i),!0;let a=Jn(n);if(a)return await this._processMediaEntry(e,t,a),!0;let o=Qn(n);if(o)return await this._processDrawingEntry(e,t,o,r),!0;let s=$n(n);if(s)return await this._processDrawingRelsEntry(e,t,s),!0;let c=er(n);if(c)return await this._processVmlDrawingEntry(e,t,c),!0;let l=tr(n);if(l)return await this._processCommentEntry(e,t,`comments${l}`),!0;let u=nr(n);if(u)return await this._processTableEntry(e,t,u),!0;let d=Xn(n);if(d)return await this._processThemeEntry(e,t,d),!0;let f=rr(n);if(f)return await this._processPivotTableEntry(e,t,f),!0;let p=ir(n);if(p)return await this._processPivotTableRelsEntry(e,t,p),!0;let m=ar(n);if(m)return await this._processPivotCacheDefinitionEntry(e,t,m),!0;if(or(n))return!0;let h=sr(n);return h?(await this._processPivotCacheRecordsEntry(e,t,h),!0):Mc.isPassthroughPath(n)?(r?t.passthrough[n]=r:await this._processPassthroughEntry(e,t,n),!0):!1}async _processPassthroughEntry(e,t,n){let r=await this.collectStreamData(e);t.passthrough[n]=r}async addContentTypes(e,t){let n=new Br().toXml(t);e.append(n,{name:U.contentTypes})}async addApp(e,t){let n=new Ur().toXml(t);e.append(n,{name:U.docPropsApp})}async addCore(e,t){let n=new Cn;e.append(n.toXml(t),{name:U.docPropsCore})}async addThemes(e,t){let n=t.themes||{theme1:Do};Object.keys(n).forEach(t=>{let r=n[t];e.append(r,{name:cr(t)})})}async addOfficeRels(t,n){let r=new H().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:U.docPropsApp}]);t.append(r,{name:U.rootRels})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:Er.workbookStyles},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:Er.workbookTheme1}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:Er.workbookSharedStrings}),n.hasCheckboxes&&i.push({Id:`rId${r++}`,Type:e.RelType.FeaturePropertyBag,Target:Er.workbookFeaturePropertyBag});let a=new Map;(n.pivotTables??[]).forEach(t=>{let n=a.get(t.cacheId);n?t.rId=n:(t.rId=`rId${r++}`,a.set(t.cacheId,t.rId),i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:Dr(t.tableNumber)}))}),n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:fr(t.fileIndex)})});let o=new H().toXml(i);t.append(o,{name:U.xlWorkbookRels})}async addFeaturePropertyBag(e,t){if(!t.hasCheckboxes)return;let n=new va;e.append(n.toXml({}),{name:U.xlFeaturePropertyBag})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:U.xlSharedStrings})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:U.xlStyles})}async addWorkbook(e,t){let n=new ti;e.append(n.toXml(t),{name:U.xlWorkbook})}async addWorksheets(e,t){let n=new _a,r=new H,i=new _o,a=new To,o=new Eo;t.worksheets.forEach(t=>{let{fileIndex:s}=t,c=new F;n.render(c,t),e.append(c.xml,{name:ur(s)}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:dr(s)})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:pr(s)}));let l=t.comments.length>0,u=t.formControls&&t.formControls.length>0;(l||u)&&(c=new F,a.render(c,{comments:l?t.comments:[],formControls:u?t.formControls:[]}),e.append(c.xml,{name:hr(s)})),u&&t.formControls.forEach(t=>{let n=o.toXml(t);e.append(n,{name:Rr(t.ctrlPropId)})})})}addDrawings(e,t){let n=new Ia,r=new H,i=t.rawDrawings||{};t.worksheets.forEach(t=>{let{drawing:a}=t;if(a){if(this.drawingHasChartReference(a)&&i[a.name])e.append(i[a.name],{name:_r(a.name)});else{let t=(a.anchors??[]).filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.br&&!e.picture||e.br&&!e.picture&&!e.shape)),r=a.anchors?{...a,anchors:t}:a;n.prepare(r);let i=n.toXml(r);e.append(i,{name:_r(a.name)})}let t=r.toXml(a.rels);e.append(t,{name:vr(a.name)})}})}addTables(e,t){let n=new Ua;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:gr(t.target)})})})}addPassthrough(e,t){let n=new Mc;n.fromRecord(t.passthrough||{}),n.writeToZip(e)}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new Xa,i=new io,a=new uo,o=new H,s=new Map;n.pivotTables.forEach(n=>{let c=n.tableNumber,l=n.isLoaded,u=n.cacheId;if(!s.has(u)){if(s.set(u,c),l){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:yr(c)})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:xr(c)})}}else{let e=r.toXml(n);t.append(e,{name:xr(c)}),e=i.toXml(n),t.append(e,{name:yr(c)})}if(!l||n.cacheRecords){let r=(l?n.cacheDefinition?.rId:void 0)??`rId1`,i=o.toXml([{Id:r,Type:e.RelType.PivotCacheRecords,Target:Sr(c)}]);t.append(i,{name:br(c)})}}let d=a.toXml(n);t.append(d,{name:Cr(c)});let f=s.get(u);d=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:Tr(f)}]),t.append(d,{name:wr(c)})})}_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 On;let n=e.defaultFont;e.styles=e.useStyles?new xn(!0):new xn.Mock,n&&e.styles.setDefaultFont&&e.styles.setDefaultFont(n);let r=new ti,i=new _a;r.prepare(e);let a={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};a.drawings=e.drawings=[],a.commentRefs=e.commentRefs=[],a.formControlRefs=e.formControlRefs=[];let o=0;e.tables=[],e.worksheets.forEach((t,n)=>{t.fileIndex=n+1,t.tables.forEach(t=>{o++,t.target=`table${o}.xml`,t.id=o,e.tables.push(t)}),i.prepare(t,a)}),e.hasCheckboxes=e.styles.hasCheckboxes;let s=e.passthrough||{},c=new Mc;c.fromRecord(s),e.passthroughContentTypes=c.getContentTypes()}};let X=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Z=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,Fc=(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,Ic=[0,31,29,31,30,31,30,31,31,30,31,30,31];function Lc(e,t,n){if(t<1||t>12||n<1||n>Ic[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function Rc(e,t,n,r,i,a){return t<1||t>12||n<1||n>Ic[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function zc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:Lc(Fc(e,0),Z(e,5),Z(e,8))}function Bc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Rc(Fc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Vc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Rc(Fc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Hc(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Uc(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Wc(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 Gc(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 Kc(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Lc(Fc(e,6),Z(e,0),Z(e,3))}function qc(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Lc(Fc(e,6),Z(e,3),Z(e,0))}function Jc(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:Rc(Fc(e,6),Z(e,0),Z(e,3),Z(e,11),Z(e,14),Z(e,17))}function Yc(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:Rc(Fc(e,6),Z(e,3),Z(e,0),Z(e,11),Z(e,14),Z(e,17))}let Xc={"YYYY-MM-DD":zc,"YYYY-MM-DD[T]HH:mm:ss":Bc,"YYYY-MM-DD HH:mm:ss":Vc,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?Hc(e):e.length===25?Wc(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?Uc(e):e.length===29?Gc(e):null,"MM-DD-YYYY":Kc,"MM-DD-YYYY HH:mm:ss":Jc,"MM/DD/YYYY HH:mm:ss":Jc,"DD-MM-YYYY":qc,"DD-MM-YYYY HH:mm:ss":Yc,"DD/MM/YYYY HH:mm:ss":Yc},Zc=[[10,[zc]],[19,[Bc,Vc]],[20,[Hc]],[24,[Uc]],[25,[Wc]],[29,[Gc]]];var Qc=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=>Xc[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of Zc)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}};function $c(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${X[r]}:${X[i]}`}var el=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}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[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}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}${$c(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()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[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()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]} ${X[e.getUTCHours()]}:${X[e.getUTCMinutes()]}:${X[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]} ${X[e.getHours()]}:${X[e.getMinutes()]}:${X[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?`${X[e.getUTCMonth()+1]}${n}${X[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getMonth()+1]}${n}${X[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?`${X[e.getUTCDate()]}${n}${X[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getDate()]}${n}${X[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,X[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,X[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,X[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,X[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,X[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:$c(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 tl(e,t){return t===`,`?String(e).split(`.`).join(`,`):String(e)}function nl(e,t){if(t!==`,`)return Number(e);let n=e.trim();return/^-?\d+(,\d+)?([eE][+-]?\d+)?$/.test(n)?Number(n.replace(`,`,`.`)):Number(e)}function rl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function il(e){return e.length===1}function al(e){return e.length===1}function ol(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 sl(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,ee=x?String(r):``,S=i!==null&&i!==!1?String(i):``,te=[],ne=[],C=[],w=``,re=!1,T=0,ie=0,ae=0,oe=0,E=null,se=0,D=!1,ce=!1;u===!0?D=!0:Array.isArray(u)?(E=u,se=u.filter(e=>e!=null).length,ol(u),D=!0,d||(ce=!0)):typeof u==`function`&&(D=!0);let O=s||c&&l?e=>e.trim():c?e=>e.trimStart():l?e=>e.trimEnd():e=>e,le=e=>{if(D&&!ce){if(typeof u==`function`){let t=u(e);ol(t),E=t}else Array.isArray(u)||(ol(e),E=e);return se=E.filter(e=>e!=null).length,ce=!0,!1}if(oe<h)return oe++,!1;if(E&&E.length>0){let t=se,n=e.length;if(n>t){if(g&&!_)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=E.length}else if(n<t){if(g)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<E.length;)e.push(``)}}return!0},ue=e.length;for(;T<ue;){let t=e[T];if(re&&x)S&&t===S&&e[T+1]===ee?(w+=ee,T+=2):t===ee?(re=!1,T++):t===`\r`?(e[T+1]===`
|
|
33
33
|
`||(w+=`
|
|
34
34
|
`),T++):(w+=t,T++);else if(x&&t===ee&&w===``)re=!0,T++;else if(t===n)C.push(O(w)),w=``,T++;else if(t===`
|
|
35
35
|
`||t===`\r`){if(t===`\r`&&e[T+1]===`
|