@cj-tech-master/excelts 10.1.0 → 10.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v10.1.0
2
+ * @cj-tech-master/excelts v10.2.0
3
3
  * Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -457,7 +457,7 @@ endstream
457
457
  `)}\n>>`,u=[];u.push(`1`);for(let e of i)u.push(wI(e));let d=e.allocObject(),f=new kI().set(`Type`,`/Encoding`).set(`Differences`,`[${u.join(` `)}]`);e.addObject(d,f);let p=xz(e,t),m=e.allocObject(),h=`[0 0 ${gz} ${gz}]`,g=new kI().set(`Type`,`/Font`).set(`Subtype`,`/Type3`).set(`Name`,wI(n)).set(`FontBBox`,h).set(`FontMatrix`,`[0.001 0 0 0.001 0 0]`).set(`FirstChar`,B(0)).set(`LastChar`,B(a.length-1)).set(`Widths`,TI(a.map(e=>B(e)))).set(`CharProcs`,l).set(`Encoding`,V(d)).set(`ToUnicode`,V(p));return e.addObject(m,g),{objNum:m,fontWidths:o}}function yz(e,t){let n=new qI;n.raw(`${t.width} 0 0 0 ${gz} ${gz} d1`);let r=bz(n);t.draw(r);let i=e.allocObject();return e.addStreamObject(i,new kI,n),i}function bz(e){return{M:(t,n)=>{e.moveTo(t,n)},L:(t,n)=>{e.lineTo(t,n)},C:(t,n,r,i,a,o)=>{e.curveTo(t,n,r,i,a,o)},Z:()=>{e.closePath()},rect:(t,n,r,i)=>{e.rect(t,n,r,i)},circle:(t,n,r)=>{e.circle(t,n,r)},ellipse:(t,n,r,i)=>{e.ellipse(t,n,r,i)},stroke:()=>{e.stroke()},fill:()=>{e.fill()},fillStroke:()=>{e.fillAndStroke()},lineWidth:t=>{e.setLineWidth(t)}}}function xz(e,t){let n=[];n.push(`/CIDInit /ProcSet findresource begin`),n.push(`12 dict begin`),n.push(`begincmap`),n.push(`/CIDSystemInfo`),n.push(`<< /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def`),n.push(`/CMapName /Adobe-Identity-UCS def`),n.push(`/CMapType 2 def`),n.push(`1 begincodespacerange`),n.push(`<00> <FF>`),n.push(`endcodespacerange`);for(let e=0;e<t.length;e+=100){let r=t.slice(e,e+100);n.push(`${r.length} beginbfchar`);for(let t=0;t<r.length;t++){let i=1+e+t,a=r[t],o=i.toString(16).toUpperCase().padStart(2,`0`);if(a>65535){let e=Math.floor((a-65536)/1024)+55296,t=(a-65536)%1024+56320,r=e.toString(16).toUpperCase().padStart(4,`0`),i=t.toString(16).toUpperCase().padStart(4,`0`);n.push(`<${o}> <${r}${i}>`)}else{let e=a.toString(16).toUpperCase().padStart(4,`0`);n.push(`<${o}> <${e}>`)}}n.push(`endbfchar`)}n.push(`endcmap`),n.push(`CMapName currentdict /CMap defineresource pop`),n.push(`end`),n.push(`end`);let r=n.join(`
458
458
  `),i=new TextEncoder().encode(r),a=e.allocObject();return e.addStreamObject(a,new kI,i),a}let Sz={helvetica:`Helvetica`,arial:`Helvetica`,calibri:`Helvetica`,"segoe ui":`Helvetica`,"trebuchet ms":`Helvetica`,verdana:`Helvetica`,tahoma:`Helvetica`,"gill sans":`Helvetica`,"franklin gothic":`Helvetica`,"lucida sans":`Helvetica`,aptos:`Helvetica`,"times new roman":`Times`,times:`Times`,georgia:`Times`,garamond:`Times`,"book antiqua":`Times`,palatino:`Times`,"palatino linotype":`Times`,cambria:`Times`,"century schoolbook":`Times`,"courier new":`Courier`,courier:`Courier`,consolas:`Courier`,"lucida console":`Courier`,monaco:`Courier`,"andale mono":`Courier`,"cascadia code":`Courier`,"cascadia mono":`Courier`,menlo:`Courier`};function Cz(e){return Sz[e.toLowerCase().trim()]??`Helvetica`}function wz(e,t,n){let r=Cz(e);return r===`Helvetica`?t&&n?`Helvetica-BoldOblique`:t?`Helvetica-Bold`:n?`Helvetica-Oblique`:`Helvetica`:r===`Times`?t&&n?`Times-BoldItalic`:t?`Times-Bold`:n?`Times-Italic`:`Times-Roman`:r===`Courier`?t&&n?`Courier-BoldOblique`:t?`Courier-Bold`:n?`Courier-Oblique`:`Courier`:`Helvetica`}var Tz=class{constructor(){this.type1Map=new Map,this.resourceToType1=new Map,this.nextType1Id=1,this.embeddedFont=null,this.embeddedResourceName=``,this.usedCodePoints=new Set,this.nextEmbeddedId=1,this.type3CodePoints=new Set,this._type3Result=null,this._unknownFontFamilies=new Set,this._embeddedResult=null}registerEmbeddedFont(e){return this.embeddedFont=e,this.embeddedResourceName=`EF${this.nextEmbeddedId++}`,this.embeddedResourceName}hasEmbeddedFont(){return this.embeddedFont!==null}getType3CodePoints(){return new Set(this.type3CodePoints)}getUnknownFontFamilies(){return new Set(this._unknownFontFamilies)}getEmbeddedResourceName(){return this.embeddedResourceName}resolveRenderResourceName(e){return this.embeddedFont?this.embeddedResourceName:e}trackText(e){for(let t=0;t<e.length;t++){let n=e.codePointAt(t);n>65535&&t++,this.usedCodePoints.add(n),QI(n)||this.type3CodePoints.add(n)}}ensureFont(e){let t=this.type1Map.get(e);return t||(t=`F${this.nextType1Id++}`,this.type1Map.set(e,t),this.resourceToType1.set(t,e)),t}resolveFont(e,t,n){if(this.embeddedFont)return this.embeddedResourceName;let r=e.toLowerCase().trim();r&&Sz[r]===void 0&&this._unknownFontFamilies.add(e);let i=wz(e,t,n);return this.ensureFont(i)}getPdfFontName(e){return this.resourceToType1.get(e)??`Helvetica`}hasType3Fonts(){return this._type3Result!==null&&this._type3Result.fontObjects.size>0}resolveType3(e){return this._type3Result?this._type3Result.encoding.get(e)??null:null}needsType3(e){return!this.embeddedFont&&!QI(e)}measureText(e,t,n){if(this.embeddedFont&&t===this.embeddedResourceName)return Dz(e,this.embeddedFont,n);if(!this._type3Result||!$I(e))return wL(e,this.getPdfFontName(t),n);let r=0,i=this.getPdfFontName(t);for(let t=0;t<e.length;t++){let a=e.codePointAt(t);if(a>65535&&t++,QI(a))r+=wL(String.fromCodePoint(a),i,n);else{let e=this._type3Result.encoding.get(a);if(e){let t=this._type3Result.widths.get(e.resourceName)?.get(e.charCode)??600;r+=t/1e3*n}else r+=600/1e3*n}}return r}getFontAscent(e,t){return this.embeddedFont&&e===this.embeddedResourceName?this.embeddedFont.ascent/this.embeddedFont.unitsPerEm*t:TL(this.isType3Resource(e)?`Helvetica`:this.getPdfFontName(e),t)}getFontDescent(e,t){return this.embeddedFont&&e===this.embeddedResourceName?this.embeddedFont.descent/this.embeddedFont.unitsPerEm*t:EL(this.isType3Resource(e)?`Helvetica`:this.getPdfFontName(e),t)}getLineHeight(e,t){if(this.embeddedFont&&e===this.embeddedResourceName){let e=this.embeddedFont;return(e.ascent-e.descent)/e.unitsPerEm*t}return DL(this.isType3Resource(e)?`Helvetica`:this.getPdfFontName(e),t)}isEmbeddedFont(e){return this.embeddedFont!==null&&e===this.embeddedResourceName}isType3Resource(e){return this._type3Result?.fontObjects.has(e)??!1}encodeText(e,t){if(!this.embeddedFont||t!==this.embeddedResourceName)return null;if(this._embeddedResult)return Ez(e,this._embeddedResult.unicodeToCid);throw new nL(`encodeText called before writeFontResources — subset mapping not available`)}encodeType3Char(e){if(!this._type3Result)return null;let t=this._type3Result.encoding.get(e);return t?`<${t.charCode.toString(16).toUpperCase().padStart(2,`0`)}>`:null}writeFontResources(e){let t=new Map;for(let[n,r]of this.type1Map){let i=e.allocObject(),a=new kI().set(`Type`,`/Font`).set(`Subtype`,`/Type1`).set(`BaseFont`,wI(n)).set(`Encoding`,`/WinAnsiEncoding`);e.addObject(i,a),t.set(r,i)}if(this.embeddedFont&&this.embeddedResourceName){let n=cL(e,this.embeddedFont,this.usedCodePoints,this.embeddedResourceName);t.set(this.embeddedResourceName,n.fontObjNum),this._embeddedResult=n}if(!this.embeddedFont&&this.type3CodePoints.size>0){this._type3Result=_z(e,this.type3CodePoints);for(let[e,n]of this._type3Result.fontObjects)t.set(e,n)}return t}getEmbeddedResult(){return this._embeddedResult}buildFontDictString(e){let t=[`<<`];for(let[n,r]of e)t.push(`${wI(n)} ${V(r)}`);return t.push(`>>`),t.join(`
459
459
  `)}getRegisteredFonts(){let e=[];for(let[t,n]of this.type1Map)e.push({resourceName:n,pdfFontName:t});return e}};function Ez(e,t){let n=`<`;for(let r=0;r<e.length;r++){let i=e.codePointAt(r);i>65535&&r++;let a=t.get(i)??0;n+=a.toString(16).toUpperCase().padStart(4,`0`)}return n+=`>`,n}function Dz(e,t,n){let r=0;for(let n=0;n<e.length;n++){let i=e.codePointAt(n);i>65535&&n++;let a=t.cmap.get(i)??0;r+=t.advanceWidths[a]??0}return r/t.unitsPerEm*n}Bf();function Oz(){let e=typeof process<`u`?process.platform:``,t=typeof process<`u`?process.env.HOME??process.env.USERPROFILE??``:``,n=[];switch(e){case`darwin`:n.push(`/System/Library/Fonts`,`/System/Library/Fonts/Supplemental`,`/Library/Fonts`,`${t}/Library/Fonts`);break;case`win32`:{let e=process.env.WINDIR??process.env.SystemRoot??`C:\\Windows`;n.push(`${e}\\Fonts`,`${process.env.LOCALAPPDATA??``}\\Microsoft\\Windows\\Fonts`);break}default:n.push(`/usr/share/fonts`,`/usr/local/share/fonts`,`/usr/share/fonts/truetype`,`/usr/share/fonts/opentype`,`/usr/share/fonts/TTF`,`/usr/share/fonts/noto`,`/usr/share/fonts/noto-cjk`,`/usr/share/fonts/google-noto`,`/usr/share/fonts/google-noto-cjk`,`/usr/share/fonts/truetype/noto`,`/usr/share/fonts/truetype/dejavu`,`/usr/share/fonts/truetype/liberation`,`/usr/share/fonts/truetype/droid`,`/usr/share/fonts/wqy`,`${t}/.local/share/fonts`,`${t}/.fonts`);break}return n}let kz=`NotoSansCJKsc-Regular.ttf,NotoSansCJK-Regular.ttc,NotoSansCJKSC-Regular.otf,NotoSansSC-Regular.ttf,NotoSansTC-Regular.ttf,NotoSansJP-Regular.ttf,NotoSansKR-Regular.ttf,NotoSans-Regular.ttf,Arial Unicode.ttf,Arial Unicode MS.ttf,ArialUnicode.ttf,arialuni.ttf,PingFang.ttc,Hiragino Sans GB.ttc,STHeiti Light.ttc,STHeiti Medium.ttc,Songti.ttc,AppleSDGothicNeo.ttc,msyh.ttc,msyhbd.ttc,msjh.ttc,simsun.ttc,simhei.ttf,malgun.ttf,meiryo.ttc,yugothic.ttf,segoeui.ttf,arial.ttf,DejaVuSans.ttf,LiberationSans-Regular.ttf,FreeSans.ttf,DroidSansFallbackFull.ttf,DroidSansFallback.ttf,wqy-microhei.ttc,wqy-zenhei.ttc,uming.ttc,NanumGothic.ttf,IPAexGothic.ttf`.split(`,`);function*Az(){if(typeof process>`u`||!process.platform)return;let e=new Set,t=Oz();for(let n of kz)for(let r of t){let t=`${r}/${n}`;if(!e.has(t)&&(e.add(t),Lf(t))){let e=jz(t);e&&(yield e)}}let n=/noto|unicode|cjk|yahei|heiti|gothic|sans|serif|ming|song|dejavu|liberation|droid|wqy/i;for(let r of t){let t;try{t=If(r,{recursive:!0,filter:e=>!e.isDirectory})}catch{continue}let i=t.filter(t=>/\.tt[cf]$/i.test(t.absolutePath)&&!e.has(t.absolutePath)),a=i.filter(e=>n.test(e.absolutePath)),o=i.filter(e=>!n.test(e.absolutePath)&&e.size>5e4);for(let t of[...a,...o]){if(e.has(t.absolutePath))continue;e.add(t.absolutePath);let n=jz(t.absolutePath);n&&(yield n)}}}function jz(e){try{return Rf(e)}catch{return null}}let Mz=65536,Nz=2e6;var Pz=class e{constructor(e,t=0){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.offset=t}u8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}u16(){let e=this.view.getUint16(this.offset,!1);return this.offset+=2,e}i16(){let e=this.view.getInt16(this.offset,!1);return this.offset+=2,e}u32(){let e=this.view.getUint32(this.offset,!1);return this.offset+=4,e}i32(){let e=this.view.getInt32(this.offset,!1);return this.offset+=4,e}fixed(){return this.i32()/65536}bytes(e){let t=this.data.subarray(this.offset,this.offset+e);return this.offset+=e,t}tag(){return String.fromCharCode(this.u8(),this.u8(),this.u8(),this.u8())}skip(e){this.offset+=e}at(t){return new e(this.data,t)}u16At(e){return this.view.getUint16(e,!1)}u32At(e){return this.view.getUint32(e,!1)}i16At(e){return this.view.getInt16(e,!1)}};function Fz(e){let t=new Pz(e),n=t.u32();if(n===1953784678){if(t.skip(4),t.u32()===0)throw new nL(`TrueType Collection is empty (0 fonts)`);return Iz(e,t.u32())}return Lz(e,t,n)}function Iz(e,t){let n=new Pz(e,t);return Lz(e,n,n.u32())}function Lz(e,t,n){if(n!==65536&&n!==1953658213)throw n===1330926671?new nL(`CFF-flavored OpenType (.otf) is not supported. Use a TrueType (.ttf) font.`):new nL(`Invalid TrueType font: bad sfVersion 0x${n.toString(16)}`);let r=t.u16();t.skip(6);let i=new Map;for(let e=0;e<r;e++){let e=t.tag();t.skip(4);let n=t.u32(),r=t.u32();i.set(e,{offset:n,length:r})}for(let e of[`head`,`hhea`,`maxp`,`cmap`,`hmtx`])if(!i.has(e))throw new nL(`Missing required table '${e}' in TrueType font`);let a=Rz(t,i.get(`head`)),o=zz(t,i.get(`hhea`)),s=Bz(t,i.get(`maxp`)),c=i.has(`OS/2`)?Vz(t,i.get(`OS/2`)):null,l=i.has(`post`)?Hz(t,i.get(`post`)):null,u=i.has(`name`)?Uz(t,i.get(`name`)):null,d=Wz(t,i.get(`cmap`)),f=qz(t,i.get(`hmtx`),o.numHMetrics,s.numGlyphs),p=i.has(`loca`)&&i.has(`glyf`)?Jz(t,i.get(`loca`),s.numGlyphs,a.indexToLocFormat):new Uint32Array(s.numGlyphs+1),m=c?.sTypoAscender??o.ascent,h=c?.sTypoDescender??o.descent,g=c?.sCapHeight??Math.round(m*.7),_=0;l?.isFixedPitch&&(_|=1),a.macStyle&2&&(_|=64),_|=32;let v=c?.usWeightClass??400,y=Math.round(50+(v/65)**2),b=u?.familyName??`Unknown`;return{data:e,familyName:b,postScriptName:u?.postScriptName??b.replace(/\s+/g,``),unitsPerEm:a.unitsPerEm,ascent:m,descent:h,capHeight:g,italicAngle:l?.italicAngle??0,flags:_,bbox:[a.xMin,a.yMin,a.xMax,a.yMax],stemV:y,numGlyphs:s.numGlyphs,indexToLocFormat:a.indexToLocFormat,numHMetrics:o.numHMetrics,tables:i,cmap:d,advanceWidths:f,glyphOffsets:p}}function Rz(e,t){let n=e.at(t.offset);n.skip(4),n.skip(4),n.skip(4),n.skip(4),n.skip(2);let r=n.u16();n.skip(16);let i=n.i16(),a=n.i16(),o=n.i16(),s=n.i16(),c=n.u16();return n.skip(2),n.skip(2),{unitsPerEm:r,xMin:i,yMin:a,xMax:o,yMax:s,macStyle:c,indexToLocFormat:n.i16()}}function zz(e,t){let n=e.at(t.offset);n.skip(4);let r=n.i16(),i=n.i16(),a=n.i16();return n.skip(2),n.skip(22),{ascent:r,descent:i,lineGap:a,numHMetrics:n.u16()}}function Bz(e,t){let n=e.at(t.offset);return n.skip(4),{numGlyphs:n.u16()}}function Vz(e,t){let n=e.at(t.offset),r=n.u16();n.skip(2);let i=n.u16();n.skip(2),n.skip(2),n.skip(22),n.skip(10),n.skip(16),n.skip(4),n.skip(2),n.skip(2),n.skip(2);let a=n.i16(),o=n.i16();n.skip(2),n.skip(2),n.skip(2);let s;return r>=2?(n.skip(8),n.skip(2),s=n.i16()):s=Math.round(a*.7),{usWeightClass:i,sTypoAscender:a,sTypoDescender:o,sCapHeight:s}}function Hz(e,t){let n=e.at(t.offset);n.skip(4);let r=n.fixed();return n.skip(2),n.skip(2),{italicAngle:r,isFixedPitch:n.u32()!==0}}function Uz(e,t){let n=t.offset,r=e.at(n);r.skip(2);let i=r.u16(),a=n+r.u16(),o=``,s=``;for(let t=0;t<i;t++){let t=r.u16(),n=r.u16();r.skip(2);let i=r.u16(),c=r.u16(),l=r.u16();if(i!==1&&i!==6)continue;let u=e.at(a+l).bytes(c),d;if(t===3||t===0)d=Yz(u);else if(t===1&&n===0)d=Xz(u);else continue;i===1&&!o&&(o=d),i===6&&!s&&(s=d)}return{familyName:o||`Unknown`,postScriptName:s||o||`Unknown`}}function Wz(e,t){let n=t.offset,r=e.at(n);r.skip(2);let i=r.u16(),a=-1,o=-1;for(let t=0;t<i;t++){let t=r.u16(),i=r.u16(),s=r.u32();if(!(t===0||t===3&&(i===1||i===10)))continue;let c=e.u16At(n+s);c===12&&o<0&&(o=n+s),c===4&&a<0&&(a=n+s)}if(o>=0)return Kz(e,o);if(a>=0)return Gz(e,a);throw new nL(`No usable Unicode cmap subtable found in font`)}function Gz(e,t){let n=e.at(t);n.skip(2),n.skip(2),n.skip(2);let r=n.u16()/2;n.skip(6);let i=[];for(let e=0;e<r;e++)i.push(n.u16());n.skip(2);let a=[];for(let e=0;e<r;e++)a.push(n.u16());let o=[];for(let e=0;e<r;e++)o.push(n.i16());let s=n.offset,c=[];for(let e=0;e<r;e++)c.push(n.u16());let l=new Map;for(let t=0;t<r;t++){let n=a[t],r=i[t],u=o[t],d=c[t];if(n===65535)break;for(let i=n;i<=r;i++){let r;if(d===0)r=i+u&65535;else{let a=s+t*2+d+(i-n)*2;r=e.u16At(a),r!==0&&(r=r+u&65535)}r!==0&&l.set(i,r)}}return l}function Kz(e,t){let n=e.at(t);n.skip(2),n.skip(2),n.skip(4),n.skip(4);let r=n.u32();if(r>Mz)throw new nL(`cmap format 12 has ${r} groups, exceeding limit of ${Mz}. The font file may be malicious or corrupted.`);let i=new Map,a=0;for(let e=0;e<r;e++){let e=n.u32(),t=n.u32(),r=n.u32(),o=t>=e?t-e+1:0;if(a+=o,a>Nz)throw new nL(`cmap format 12 maps too many codepoints (>${Nz}). The font file may be malicious or corrupted.`);for(let n=e;n<=t;n++)i.set(n,r+(n-e))}return i}function qz(e,t,n,r){let i=e.at(t.offset),a=new Uint16Array(r),o=0;for(let e=0;e<n;e++)o=i.u16(),i.skip(2),a[e]=o;for(let e=n;e<r;e++)a[e]=o;return a}function Jz(e,t,n,r){let i=e.at(t.offset),a=new Uint32Array(n+1);if(r===0)for(let e=0;e<=n;e++)a[e]=i.u16()*2;else for(let e=0;e<=n;e++)a[e]=i.u32();return a}function Yz(e){let t=[];for(let n=0;n+1<e.length;n+=2){let r=e[n]<<8|e[n+1];if(r>=55296&&r<=56319&&n+3<e.length){let i=e[n+2]<<8|e[n+3];if(i>=56320&&i<=57343){t.push(String.fromCodePoint((r-55296<<10)+(i-56320)+65536)),n+=2;continue}}t.push(String.fromCharCode(r))}return t.join(``)}function Xz(e){let t=[];for(let n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join(``)}let Zz={Empty:0,String:1,Number:2,Boolean:3,Date:4,RichText:5,Error:6,Formula:7,Hyperlink:8,Merge:9};function Qz(e){return e.kind===`chartsheet`}let $z={A3:{width:841.89,height:1190.55},A4:{width:595.28,height:841.89},A5:{width:419.53,height:595.28},LETTER:{width:612,height:792},LEGAL:{width:612,height:1008},TABLOID:{width:792,height:1224}},eB=1.2,tB=72/96;function nB(e,t=1){return{left:(3+e.borderInsets.left)*t,right:(3+e.borderInsets.right)*t,top:(2+e.borderInsets.top)*t,bottom:(2+e.borderInsets.bottom)*t}}function rB(e,t,n,r){let i=new qI,a=new Set;t.showGridLines&&iB(i,e,t);for(let t of e.cells)t.fillColor&&aB(i,t,a);for(let t of e.cells){if(!t.textOverflowWidth||t.textOverflowWidth<=0)continue;let n=t.rect.x+t.rect.width,r=n+t.textOverflowWidth,a=t.rect.y,o=t.rect.height,s=[];for(let i of e.cells){if(i===t||!i.fillColor||Math.abs(i.rect.y-a)>.01||Math.abs(i.rect.height-o)>.01)continue;let e=i.rect.x,c=e+i.rect.width;c>n&&e<r&&s.push({left:Math.max(e,n),right:Math.min(c,r)})}if(s.length===0)i.fillRect(n,a,t.textOverflowWidth,o,{r:1,g:1,b:1});else{s.sort((e,t)=>e.left-t.left);let e=n;for(let t of s)t.left>e&&i.fillRect(e,a,t.left-e,o,{r:1,g:1,b:1}),e=Math.max(e,t.right);e<r&&i.fillRect(e,a,r-e,o,{r:1,g:1,b:1})}}for(let t of e.cells)cB(i,t);let o=e.scaleFactor;for(let t of e.cells)(t.text||t.richText)&&uB(i,t,n,a,o);return t.showSheetNames&&OB(i,e,t,n),t.showPageNumbers&&kB(i,e,t,n,r),{stream:i,alphaValues:a}}function iB(e,t,n){if(t.columnWidths.length===0||t.rowHeights.length===0)return;let r=n.gridLineColor;e.save(),e.setStrokeColor(r),e.setLineWidth(.25);let i=t.rowYPositions[0],a=t.rowYPositions.length-1,o=t.rowYPositions[a]-t.rowHeights[a];for(let n=0;n<=t.columnWidths.length;n++){let r=n<t.columnWidths.length?t.columnOffsets[n]:t.columnOffsets[n-1]+t.columnWidths[n-1];e.moveTo(r,i),e.lineTo(r,o)}let s=t.columnOffsets[0],c=t.columnOffsets.length-1,l=t.columnOffsets[c]+t.columnWidths[c];for(let n=0;n<=t.rowYPositions.length;n++){let r=n<t.rowYPositions.length?t.rowYPositions[n]:t.rowYPositions[n-1]-t.rowHeights[n-1];e.moveTo(s,r),e.lineTo(l,r)}e.stroke(),e.restore()}function aB(e,t,n){if(!t.fillColor)return;let r=t.fillColor.a;if(r!==void 0&&r<1){let i=SB(r);n.add(r),e.save(),e.setGraphicsState(i),e.fillRect(t.rect.x,t.rect.y,t.rect.width,t.rect.height,t.fillColor),e.restore()}else e.fillRect(t.rect.x,t.rect.y,t.rect.width,t.rect.height,t.fillColor)}function oB(e){return typeof e==`number`?e<=90?e:-(e-90):0}function sB(e,t){let n=oB(e);if(n===0)return 0;let r=Math.abs(n);if(r<.01||r>89.99)return 0;let i=r*Math.PI/180,a=t*Math.cos(i)/Math.sin(i);return n<0?-a:a}function cB(e,t){let{rect:n,borders:r,textRotation:i}=t,{x:a,y:o,width:s,height:c}=n,l=sB(i,c);r.top&&lB(e,r.top,a+l,o+c,a+s+l,o+c,!0),r.bottom&&lB(e,r.bottom,a,o,a+s,o,!0),r.left&&lB(e,r.left,a,o,a+l,o+c,!1),r.right&&lB(e,r.right,a+s,o,a+s+l,o+c,!1)}function lB(e,t,n,r,i,a,o){if(t.isDouble){let s=.4,c=Math.min(t.width,.25);o?(e.drawLine(n,r+s,i,a+s,t.color,c,t.dashPattern),e.drawLine(n,r-s,i,a-s,t.color,c,t.dashPattern)):(e.drawLine(n+s,r,i+s,a,t.color,c,t.dashPattern),e.drawLine(n-s,r,i-s,a,t.color,c,t.dashPattern))}else e.drawLine(n,r,i,a,t.color,t.width,t.dashPattern)}function uB(e,t,n,r,i=1){let{rect:a,text:o,fontSize:s,horizontalAlign:c,verticalAlign:l,wrapText:u}=t;if(!o&&!t.richText)return;let d=nB(t,i),f=a.width-d.left-d.right,p=a.height-d.top-d.bottom;if(f<=0||p<=0)return;let m=t.indent*10*i,h=a.width+(t.textOverflowWidth||0);e.save();let g=sB(t.textRotation,a.height);g===0?e.rect(a.x,a.y,h,a.height):(e.moveTo(a.x,a.y),e.lineTo(a.x+h,a.y),e.lineTo(a.x+h+g,a.y+a.height),e.lineTo(a.x+g,a.y+a.height),e.closePath()),e.clip(),e.endPath();let _=t.textColor.a;if(_!==void 0&&_<1&&(r.add(_),e.setGraphicsState(SB(_))),t.textRotation===`vertical`){xB(e,t,n,m,i),e.restore();return}if(typeof t.textRotation==`number`&&t.textRotation!==0){fB(e,t,n,m,i),e.restore();return}if(t.richText&&t.richText.length>0){dB(e,t,n,m,i),e.restore();return}let v=n.hasEmbeddedFont(),y=v?n.getEmbeddedResourceName():n.ensureFont(wz(t.fontFamily,t.bold,t.italic)),b=e=>n.measureText(e,y,s),x=f-m,S=u?EB(o,b,x):o.split(/\r?\n/),ee=s*eB,te=n.getFontAscent(y,s),ne=CB(l,a,S.length*ee,te,d.top,d.bottom);e.setFillColor(t.textColor);let re=n.hasType3Fonts()&&!v;for(let t=0;t<S.length;t++){let r=S[t],i=ne-t*ee;bB(e,r,wB(c,a,b(r),m,d.left,d.right),i,y,s,n,re)}TB(e,t,S,ee,ne,b,y,n,m,d),e.restore()}function dB(e,t,n,r,i=1){let{rect:a,horizontalAlign:o,verticalAlign:s,wrapText:c}=t,l=t.richText,u=nB(t,i),d=t.fontSize;for(let e of l)e.fontSize>d&&(d=e.fontSize);let f=d,p=f*eB,m=n.hasEmbeddedFont(),h=e=>m?n.getEmbeddedResourceName():n.ensureFont(wz(e.fontFamily,e.bold,e.italic));if(c){let i=a.width-u.left-u.right-r;if(i<=0)return;let c=l.map(e=>e.text).join(``),d=[];for(let e=0;e<l.length;e++)for(let t=0;t<l[e].text.length;t++)d.push(e);let p=l.map(e=>h(e)),g=DB(c,d,l,p,n,i),_=[];for(let e of g){let n=t.fontSize;for(let t=e.start;t<e.end;t++){let e=d[t]??0;l[e].fontSize>n&&(n=l[e].fontSize)}_.push(n*eB)}let v=p[0],y=n.getFontAscent(v,f),b=CB(s,a,_.reduce((e,t)=>e+t,0),y,u.top,u.bottom),x=0;for(let t=0;t<g.length;t++){let i=b-x;x+=_[t];let{start:s,end:f}=g[t],h=[];for(let e=s;e<f;e++){let t=d[e]??d.length-1,n=h[h.length-1];n&&n.run===l[t]?n.text+=c[e]:h.push({run:l[t],text:c[e],resourceName:p[t]})}let v=0;for(let e of h)v+=n.measureText(e.text,e.resourceName,e.run.fontSize);let y=wB(o,a,v,r,u.left,u.right),S=n.hasType3Fonts()&&!m;for(let t of h){let{run:r,text:a,resourceName:o}=t;e.setFillColor(r.textColor);let s=bB(e,a,y,i,o,r.fontSize,n,S);if(r.strike){let t=i+n.getFontDescent(o,r.fontSize)+r.fontSize*.3;e.drawLine(y,t,y+s,t,r.textColor,.5)}if(r.underline){let t=i+n.getFontDescent(o,r.fontSize)*.5;e.drawLine(y,t,y+s,t,r.textColor,.5)}y+=s}}return}let g=0,_=[];for(let e of l){let t=h(e),r=n.measureText(e.text,t,e.fontSize);_.push({resourceName:t,width:r}),g+=r}let v=_[0]?.resourceName??`F1`,y=CB(s,a,p,n.getFontAscent(v,f),u.top,u.bottom),b=wB(o,a,g,r,u.left,u.right),x=n.hasType3Fonts()&&!m;for(let t=0;t<l.length;t++){let r=l[t],{resourceName:i}=_[t];e.setFillColor(r.textColor);let a=bB(e,r.text,b,y,i,r.fontSize,n,x);if(r.strike){let t=y+n.getFontDescent(i,r.fontSize)+r.fontSize*.3;e.drawLine(b,t,b+a,t,r.textColor,.5)}if(r.underline){let t=y+n.getFontDescent(i,r.fontSize)*.5;e.drawLine(b,t,b+a,t,r.textColor,.5)}b+=a}}function fB(e,t,n,r,i=1){let{rect:a,wrapText:o}=t,{fontSize:s}=t,c=nB(t,i),l=n.hasEmbeddedFont()?n.getEmbeddedResourceName():n.ensureFont(wz(t.fontFamily,t.bold,t.italic)),u=oB(t.textRotation),d=u*Math.PI/180,f=Math.cos(d),p=Math.sin(d),m=Math.abs(p),h=Math.abs(f),g=a.width-c.left-c.right,_=a.height-c.top-c.bottom,v;v=m>.01&&h>.01?Math.min(_/m,g/h):m>.01?_/m:g;let y=e=>n.measureText(e,l,s),b;b=o?EB(t.text,y,Math.max(v-1,1)):t.text.split(/\r?\n/);let x=s*eB,S=b.length*x;if(!o){let e=0;for(let t of b){let n=y(t);n>e&&(e=n)}let t=e*h+S*m,n=e*m+S*h;if(g>0&&_>0&&(t>g||n>_)){let e=Math.min(g/t,_/n);e<1&&(s*=e)}}let ee=s*eB,te=n.getFontAscent(l,s),ne=Math.abs(u-90)<.01,re=Math.abs(u+90)<.01;e.setFillColor(t.textColor),ne?pB(e,t,b,n,l,s,ee,te,c):re?mB(e,t,b,n,l,s,ee,te,c):hB(e,t,b,n,l,s,ee,te,f,p,r)}function pB(e,t,n,r,i,a,o,s,c){let{rect:l,horizontalAlign:u,verticalAlign:d}=t,f=n.length*o,p;p=u===`center`?l.x+l.width/2-f/2+s:u===`right`?l.x+l.width-c.right-f+s:l.x+c.left+s;let m=r.hasType3Fonts()&&!r.hasEmbeddedFont();for(let t=0;t<n.length;t++){let s=n[t],u=r.measureText(s,i,a),f=p+t*o,h;h=d===`top`?l.y+l.height-c.top-u:d===`middle`?l.y+(l.height-u)/2:l.y+c.bottom,h=Math.max(h,l.y+c.bottom),_B(e,s,0,1,-1,0,f,h,i,a,r,m)}}function mB(e,t,n,r,i,a,o,s,c){let{rect:l,horizontalAlign:u,verticalAlign:d}=t,f=n.length*o,p;p=u===`center`?l.x+l.width/2+f/2-o+s:u===`right`?l.x+l.width-c.right-o+s:l.x+c.left+f-o+s;let m=r.hasType3Fonts()&&!r.hasEmbeddedFont();for(let t=0;t<n.length;t++){let s=n[t],u=r.measureText(s,i,a),f=p-t*o,h;h=d===`top`?l.y+l.height-c.top:d===`middle`?l.y+(l.height+u)/2:l.y+c.bottom+u,h=Math.min(h,l.y+l.height-c.top),_B(e,s,0,-1,1,0,f,h,i,a,r,m)}}function hB(e,t,n,r,i,a,o,s,c,l,u){let{rect:d,horizontalAlign:f,verticalAlign:p}=t,m=nB(t),h=0;for(let e of n){let t=r.measureText(e,i,a);t>h&&(h=t)}let g=n.length*o,_=Math.abs(l),v=Math.abs(c),y=h*v+g*_,b=h*_+g*v,x=sB(t.textRotation,d.height)/2,S=f===`left`?u/2:f===`right`?-u/2:0,ee;ee=p===`top`?d.y+d.height-m.top-b/2:p===`bottom`?d.y+m.bottom+b/2:d.y+d.height/2;let te=d.height>0?(ee-d.y)/d.height:.5,ne=x*2*te,re;re=f===`right`?d.x+d.width-m.right-y/2+S+ne:f===`left`?d.x+m.left+y/2+S+ne:d.x+d.width/2+S+ne;let ie=r.hasType3Fonts()&&!r.hasEmbeddedFont();for(let t=0;t<n.length;t++){let u=n[t],d=r.measureText(u,i,a),f=(t-(n.length-1)/2)*o,p=-d/2,m=-s/2-f,h=re+p*c-m*l,g=ee+p*l+m*c;_B(e,u,c,l,-l,c,h,g,i,a,r,ie)}}function gB(e,t,n,r){let i=t.encodeText(n,r);i?e.showTextHex(i):e.showText(n)}function _B(e,t,n,r,i,a,o,s,c,l,u,d){e.deferred(()=>vB(t,n,r,i,a,o,s,c,l,u))}function vB(e,t,n,r,i,a,o,s,c,l){let u=new qI;if(!(l.hasType3Fonts()&&!l.hasEmbeddedFont())){let d=l.resolveRenderResourceName(s);return u.beginText(),u.setFont(d,c),u.setTextMatrix(t,n,r,i,a,o),gB(u,l,e,d),u.endText(),u.toString()}let d=yB(e,l),f=a,p=o;for(let e of d){u.beginText(),e.type3?(u.setFont(e.type3.resourceName,c),u.setTextMatrix(t,n,r,i,f,p),u.showTextHex(e.type3.hex)):(u.setFont(s,c),u.setTextMatrix(t,n,r,i,f,p),gB(u,l,e.text,s)),u.endText();let a=l.measureText(e.text,e.type3?.resourceName??s,c);f+=t*a,p+=n*a}return u.toString()}function yB(e,t){let n=[],r=``,i=()=>{r&&=(n.push({text:r,type3:null}),``)};for(let a=0;a<e.length;a++){let o=e.codePointAt(a),s=String.fromCodePoint(o);if(o>65535&&a++,t.needsType3(o)){i();let e=t.resolveType3(o);if(e){let r=t.encodeType3Char(o);n.push({text:s,type3:{resourceName:e.resourceName,hex:r??`<00>`}})}else n.push({text:s,type3:null})}else r+=s}return i(),n}function bB(e,t,n,r,i,a,o,s){return _B(e,t,1,0,0,1,n,r,i,a,o,s),o.measureText(t,i,a)}function xB(e,t,n,r,i=1){let{rect:a,text:o,fontSize:s,horizontalAlign:c,verticalAlign:l}=t,u=nB(t,i),d=n.hasEmbeddedFont(),f=d?n.getEmbeddedResourceName():n.ensureFont(wz(t.fontFamily,t.bold,t.italic)),p=s*1.3,m=n.getFontAscent(f,s),h=o.split(/\r?\n/),g=s*1.4,_=h.length*g,v;v=c===`center`?a.x+a.width/2-_/2+g/2:c===`right`?a.x+a.width-u.right-_+g/2:a.x+u.left+g/2,e.setFillColor(t.textColor);let y=n.hasType3Fonts()&&!d;for(let t=0;t<h.length;t++){let r=h[t],i=v+t*g,o=r.length*p,c;c=l===`middle`?a.y+a.height/2+o/2-m:l===`bottom`?a.y+u.bottom+o-m:a.y+a.height-u.top-m;for(let t of r){if(c<a.y+u.bottom)break;_B(e,t,1,0,0,1,i-n.measureText(t,f,s)/2,c,f,s,n,y),c-=p}}}function SB(e){return`GS${Math.round(e*1e4)}`}function CB(e,t,n,r,i=2,a=i){let o;switch(e){case`top`:o=t.y+t.height-i-r;break;case`middle`:o=t.y+t.height/2+n/2-r;break;default:o=t.y+a+(n-r);break}let s=t.y+t.height-i-r;o>s&&(o=s);let c=t.y+a;return o<c&&(o=c),o}function wB(e,t,n,r=0,i=3,a=i){let o;switch(e){case`center`:o=t.x+(t.width-n)/2;break;case`right`:o=t.x+t.width-a-n;break;default:o=t.x+i+r;break}let s=t.x+i;return o<s&&(o=s),o}function TB(e,t,n,r,i,a,o,s,c,l){if(t.strike){let u=i+s.getFontDescent(o,t.fontSize)+t.fontSize*.3;for(let i=0;i<n.length;i++){let o=u-i*r,s=a(n[i]),d=wB(t.horizontalAlign,t.rect,s,c,l?.left,l?.right);e.drawLine(d,o,d+s,o,t.textColor,.5)}}if(t.underline){let u=s.getFontDescent(o,t.fontSize)*.5;for(let o=0;o<n.length;o++){let s=i-o*r+u,d=a(n[o]),f=wB(t.horizontalAlign,t.rect,d,c,l?.left,l?.right);e.drawLine(f,s,f+d,s,t.textColor,.5)}}}function EB(e,t,n){if(!e)return[``];let r=e.split(/\r?\n/),i=[];for(let e of r){if(!e){i.push(``);continue}let r=e.split(/\s+/),a=``;for(let e of r){if(!a){a=e;continue}let r=a+` `+e;t(r)<=n?a=r:(i.push(a),a=e)}a&&i.push(a)}return i.length>0?i:[``]}function DB(e,t,n,r,i,a){if(!e)return[{start:0,end:0}];let o=(a,o)=>{if(a>=o)return 0;let s=0,c=a,l=t[a]??0;for(let u=a+1;u<=o;u++){let a=u<o?t[u]??l:-1;if(a!==l){let t=n[l],o=e.slice(c,u);s+=i.measureText(o,r[l],t.fontSize),c=u,l=a}}return s},s=[],c=0,l=e.length;for(;c<=l;){let t=e.indexOf(`
460
- `,c);if(t===-1&&(t=l),t===c){s.push({start:c,end:c}),c=t+1;continue}let n=t>c&&e[t-1]===`\r`?t-1:t;if(n===c){s.push({start:c,end:c}),c=t+1;continue}let r=e.slice(c,n),i=[],u=[],d=!1;for(let e=0;e<r.length;e++){let t=r[e]===` `||r[e]===` `;!t&&!d?(i.push(e),d=!0):t&&d&&(u.push(e),d=!1)}d&&u.push(r.length);let f=c,p=c;for(let e=0;e<i.length;e++){let t=c+u[e];if(p===f){p=t;continue}o(f,t)<=a?p=t:(s.push({start:f,end:p}),f=c+i[e],p=t)}if((p>f||i.length===0)&&s.push({start:f,end:Math.max(p,f)}),c=t+1,t===l)break}return s.length>0?s:[{start:0,end:0}]}function OB(e,t,n,r){let i=t.sheetName,a=r.hasEmbeddedFont()?r.getEmbeddedResourceName():r.ensureFont(wz(n.defaultFontFamily,!0,!1)),o=r.measureText(i,a,10),s=(t.width-o)/2,c=t.height-n.margins.top+5;e.save(),e.setFillColor({r:.3,g:.3,b:.3}),_B(e,i,1,0,0,1,s,c,a,10,r,r.hasType3Fonts()&&!r.hasEmbeddedFont()),e.restore()}function kB(e,t,n,r,i){let a=`Page ${t.pageNumber} of ${i}`,o=r.ensureFont(wz(n.defaultFontFamily,!1,!1)),s=r.measureText(a,o,9),c=(t.width-s)/2,l=Math.max(5,n.margins.bottom-15);e.save(),e.setFillColor({r:.5,g:.5,b:.5}),e.beginText(),e.setFont(o,9),e.setTextMatrix(1,0,0,1,c,l),e.showText(a),e.endText(),e.restore()}let AB={fontSize:54,color:{r:.75,g:.75,b:.75},opacity:.15,rotation:-45,fontFamily:`Helvetica`,bold:!1,italic:!1,repeatSpacingX:200,repeatSpacingY:200},jB={opacity:.15,rotation:0,scale:.5,repeatSpacingX:200,repeatSpacingY:200};function MB(e,t,n,r){return n.type===`text`?IB(e,t,NB(n),r):LB(e,t,PB(n))}function NB(e){return{...e,opacity:FB(e.opacity??AB.opacity),fontSize:Math.max(1,e.fontSize??AB.fontSize),repeatSpacingX:Math.max(10,e.repeatSpacingX??AB.repeatSpacingX),repeatSpacingY:Math.max(10,e.repeatSpacingY??AB.repeatSpacingY)}}function PB(e){return{...e,opacity:FB(e.opacity??jB.opacity),scale:Math.max(.01,e.scale??jB.scale),width:e.width===void 0?void 0:Math.max(1,e.width),height:e.height===void 0?void 0:Math.max(1,e.height),repeatSpacingX:Math.max(10,e.repeatSpacingX??jB.repeatSpacingX),repeatSpacingY:Math.max(10,e.repeatSpacingY??jB.repeatSpacingY)}}function FB(e){return Math.max(0,Math.min(1,e))}function IB(e,t,n,r){let i=n.fontSize??AB.fontSize,a=n.color??AB.color,o=n.opacity??AB.opacity,s=n.rotation??AB.rotation,c=n.fontFamily??AB.fontFamily,l=n.bold??AB.bold,u=n.italic??AB.italic,d=r.hasEmbeddedFont(),f=d?r.getEmbeddedResourceName():r.ensureFont(wz(c,l,u)),p=r.measureText(n.text,f,i),m=i*.7,h=s*Math.PI/180,g=Math.cos(h),_=Math.sin(h),v=o<1,y=v?SB(o):``,b=r.hasType3Fonts()&&!d,x=(t,o)=>{let s=p/2,c=m/2,l=t-s*g+c*_,u=o-s*_-c*g;e.save(),v&&e.setGraphicsState(y),e.setFillColor(a),_B(e,n.text,g,_,-_,g,l,u,f,i,r,b),e.restore()};if(n.repeat){let e=n.repeatSpacingX??AB.repeatSpacingX,r=n.repeatSpacingY??AB.repeatSpacingY;zB(t.width,t.height,e,r,x)}else{let{cx:e,cy:r}=RB(t,n.position);x(e,r)}return{alphaValues:v?[o]:[],imageXObjects:[]}}function LB(e,t,n){let r=n.opacity??jB.opacity,i=n.rotation??jB.rotation,a=n.scale??jB.scale,o=r<1,s,c;if(n.width!==void 0&&n.height!==void 0)s=n.width,c=n.height;else{let e=II(n.data,n.format),r=Math.min(t.width,t.height)*a,i=Math.max(e.width,e.height),o=i>0?r/i:1;s=e.width*o,c=e.height*o}let l=i*Math.PI/180,u=Math.cos(l),d=Math.sin(l),f=o?SB(r):``,p=`WmImg`,m=(t,n)=>{e.save(),o&&e.setGraphicsState(f);let r=s/2,i=c/2,a=t-r*u+i*d,l=n-r*d-i*u;e.concat(s*u,s*d,-c*d,c*u,a,l),e.doXObject(p),e.restore()};if(n.repeat){let e=n.repeatSpacingX??jB.repeatSpacingX,r=n.repeatSpacingY??jB.repeatSpacingY;zB(t.width,t.height,e,r,m)}else{let{cx:e,cy:r}=RB(t,n.position);m(e,r)}return{alphaValues:o?[r]:[],imageXObjects:[{name:p,data:n.data,format:n.format}]}}function RB(e,t){return!t||t===`center`?{cx:e.width/2,cy:e.height/2}:{cx:t.x,cy:t.y}}function zB(e,t,n,r,i){let a=Math.max(e,t)*.5,o=0;for(let s=-a;s<t+a;s+=r){let t=o%2==1?n/2:0;for(let r=-a;r<e+a;r+=n)i(r+t,s);o++}}function BB(e,t,n){let r=t=>{t?.a!==void 0&&t.a<1&&(n.add(t.a),e.setGraphicsState(SB(t.a)))},i=t=>{let{fill:i,stroke:a,lineWidth:o}=t;if(i&&(e.setFillColor(i),r(i)),a){e.setStrokeColor(a);let t=a.a!==void 0&&a.a<1,s=i?.a!==void 0&&i.a<1;t?r(a):s&&(n.add(1),e.setGraphicsState(SB(1))),o!==void 0&&e.setLineWidth(o)}i&&a?e.fillAndStroke():i?e.fill():a?e.stroke():e.endPath()};return{drawRect(t){let{x:n,y:r,width:a,height:o,fill:s,stroke:c,lineWidth:l}=t;return e.save(),e.rect(n,r,a,o),i({fill:s,stroke:c,lineWidth:l}),e.restore(),this},drawLine(t){let{x1:n,y1:i,x2:a,y2:o,color:s,lineWidth:c,dashPattern:l}=t;return e.save(),s&&(e.setStrokeColor(s),r(s)),c!==void 0&&e.setLineWidth(c),l&&l.length>0&&e.setDashPattern(l),e.moveTo(n,i).lineTo(a,o).stroke(),e.restore(),this},drawText(n,i){if(!n)return this;let a=i.fontSize??10,o=i.color??{r:0,g:0,b:0},s=i.bold??!1,c=i.italic??!1,l=i.fontFamily??`Helvetica`,u=i.anchor??`start`,d=i.rotation??0,f=VB(t,l,s,c),p=t.hasType3Fonts()&&!t.hasEmbeddedFont(),m=t.measureText(n,f,a),h=0;if(u===`middle`?h=-m/2:u===`end`&&(h=-m),e.save(),e.setFillColor(o),r(o),d===0)_B(e,n,1,0,0,1,i.x+h,i.y,f,a,t,p);else{let r=-d*Math.PI/180,o=Math.cos(r),s=Math.sin(r);_B(e,n,o,s,-s,o,i.x+o*h,i.y+s*h,f,a,t,p)}return e.restore(),this},drawCircle(t){let{cx:n,cy:r,r:a,fill:o,stroke:s,lineWidth:c}=t;return e.save(),e.circle(n,r,a),i({fill:o,stroke:s,lineWidth:c}),e.restore(),this},drawPath(t,n){e.save();for(let n of t)switch(n.op){case`move`:e.moveTo(n.x,n.y);break;case`line`:e.lineTo(n.x,n.y);break;case`curve`:e.curveTo(n.x1,n.y1,n.x2,n.y2,n.x3,n.y3);break;case`close`:e.closePath();break}return n?.closePath&&e.closePath(),n?.dashPattern&&n.dashPattern.length>0&&e.setDashPattern(n.dashPattern),i({fill:n?.fill,stroke:n?.stroke,lineWidth:n?.lineWidth}),e.restore(),this}}}function VB(e,t,n,r){return e.hasEmbeddedFont()?e.getEmbeddedResourceName():e.ensureFont(wz(t,n,r))}function HB(e){if(!e||e.length<6)return null;let t,n,r,i;if(e.length>=8?(t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),i=parseInt(e.substring(6,8),16)):(t=255,n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16)),isNaN(n)||isNaN(r)||isNaN(i))return null;let a=t/255;return{r:n/255,g:r/255,b:i/255,...a<1?{a}:{}}}function UB(e){if(!e)return null;if(e.argb)return HB(e.argb);if(e.theme!==void 0){let t=WB(e.theme);if(!t)return null;let n=e.tint;return n!==void 0&&n!==0?qB(t,n):t}return e.indexed===void 0?null:KB(e.indexed)}function WB(e){let t=[{r:1,g:1,b:1},{r:0,g:0,b:0},{r:.906,g:.902,b:.902},{r:.267,g:.329,b:.416},{r:.267,g:.447,b:.769},{r:.929,g:.49,b:.192},{r:.647,g:.647,b:.647},{r:1,g:.753,b:0},{r:.357,g:.608,b:.835},{r:.439,g:.678,b:.278}];return e>=0&&e<t.length?t[e]:null}let GB=`000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.800000.008000.000080.808000.800080.008080.C0C0C0.808080.9999FF.993366.FFFFCC.CCFFFF.660066.FF8080.0066CC.CCCCFF.000080.FF00FF.FFFF00.00FFFF.800080.800000.008080.0000FF.00CCFF.CCFFFF.CCFFCC.FFFF99.99CCFF.FF99CC.CC99FF.FFCC99.3366FF.33CCCC.99CC00.FFCC00.FF9900.FF6600.666699.969696.003366.339966.003300.333300.993300.993366.333399.333333`.split(`.`);function KB(e){return e===64?{r:0,g:0,b:0}:e===65?{r:1,g:1,b:1}:e>=0&&e<GB.length?HB(GB[e])??null:null}function qB(e,t){let n=e=>t<0?e*(1+t):e+(1-e)*t;return{r:Math.max(0,Math.min(1,n(e.r))),g:Math.max(0,Math.min(1,n(e.g))),b:Math.max(0,Math.min(1,n(e.b)))}}let JB={black:{r:0,g:0,b:0},white:{r:1,g:1,b:1},gridLine:{r:.816,g:.816,b:.816}};function YB(e,t,n){return{fontFamily:e?.name??t,fontSize:e?.size??n,bold:e?.bold??!1,italic:e?.italic??!1,strike:e?.strike??!1,underline:!!(e?.underline&&e.underline!==`none`),textColor:UB(e?.color)??JB.black}}function XB(e){if(!e)return null;if(e.type===`pattern`){if(e.pattern===`solid`&&e.fgColor)return UB(e.fgColor);if(e.pattern===`none`)return null;if(e.fgColor)return UB(e.fgColor)}return e.type===`gradient`&&e.stops&&e.stops.length>0?UB(e.stops[0].color):null}function ZB(e){switch(e){case`hair`:return .1;case`thin`:return .25;case`medium`:return .5;case`thick`:return 1;case`double`:return .25;case`dotted`:return .25;case`dashed`:return .25;case`dashDot`:return .25;case`dashDotDot`:return .25;case`slantDashDot`:return .25;case`mediumDashed`:return .5;case`mediumDashDot`:return .5;case`mediumDashDotDot`:return .5;default:return .25}}function QB(e){switch(e){case`dotted`:return[1,1];case`dashed`:case`mediumDashed`:return[3,2];case`dashDot`:case`mediumDashDot`:return[3,1,1,1];case`dashDotDot`:case`mediumDashDotDot`:return[3,1,1,1,1,1];case`slantDashDot`:return[4,2,1,2];case`hair`:return[.5,.5];default:return[]}}function $B(e){return!e||!e.style?null:{width:ZB(e.style),color:UB(e.color)??JB.black,dashPattern:QB(e.style),isDouble:e.style===`double`}}function eV(e){return e?{top:$B(e.top),right:$B(e.right),bottom:$B(e.bottom),left:$B(e.left)}:{top:null,right:null,bottom:null,left:null}}function tV(e){if(!e?.horizontal)return`left`;switch(e.horizontal){case`center`:case`centerContinuous`:return`center`;case`right`:return`right`;default:return`left`}}function nV(e){if(!e?.vertical)return`bottom`;switch(e.vertical){case`top`:return`top`;case`middle`:return`middle`;default:return`bottom`}}Ff();let rV=8.43;function iV(e,t,n){if(e?.horizontal&&e.horizontal!==`general`)return tV(e);if(t!==void 0)switch(t){case Zz.Number:case Zz.Date:return`right`;case Zz.Boolean:case Zz.Error:return`center`;case Zz.Formula:return typeof n==`number`||n instanceof Date?`right`:typeof n==`boolean`?`center`:`left`;default:return`left`}return`left`}async function aV(e,t,n){let r=sV(e,t,n);if(!r)return[lV(e,t)];let i=[],a=r.rowPages.length*r.colGroups.length;for(let o of r.rowPages)for(let s of r.colGroups)i.push(cV(r,o,s,i.length,e,t,n)),i.length<a&&await Tf();return i.length>0&&e.images&&DV(e.images,i,r.scaleFactor),i.length>0&&e.charts&&OV(e.charts,i,r.scaleFactor),i}function oV(e,t){let n=e.orientation??t.orientation,r={...t,orientation:n},i=r.pageSize.width,a=r.pageSize.height;r.orientation===`landscape`&&([i,a]=[a,i]);let o=r.margins,s=r.showSheetNames?20:0,c=o.left,l=o.bottom,u=i-o.left-o.right,d=a-o.top-o.bottom-s,f={rect:{x:c,y:l,width:Math.max(0,u),height:Math.max(0,d)},drawVector:e.chart.drawVector,raster:e.chart.raster};return[{pageNumber:1,options:r,cells:[],width:i,height:a,sheetName:e.name,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[],charts:[f],scaleFactor:1}]}function sV(e,t,n){let{margins:r}=t,i=t.pageSize.width,a=t.pageSize.height;t.orientation===`landscape`&&([i,a]=[a,i]);let o=i-r.left-r.right,s=a-r.top-r.bottom,c=t.showSheetNames?20:0,l=t.showPageNumbers?20:0,u=s-c-l,d=fV(e),{columnWidths:f,visibleCols:p}=pV(e,d);if(p.length===0)return null;let m=f.reduce((e,t)=>e+t,0),h=t.scale;if(t.fitToPage&&m>0){let e=o/m;e<1&&(h*=e)}let g=f.map(e=>e*h),{rowHeights:_,visibleRows:v}=mV(e,h,d,n,t),y=bV(e),b=xV(_,u,typeof t.repeatRows==`number`?t.repeatRows:0,yV(e,v)),x=SV(g,o,e,p);return{pageWidth:i,pageHeight:a,contentWidth:o,headerHeight:c,scaleFactor:h,scaledColumnWidths:g,rowHeights:_,visibleRows:v,visibleCols:p,mergeMap:y,rowPages:b,colGroups:x,margins:r}}function cV(e,t,n,r,i,a,o){let{scaledColumnWidths:s,rowHeights:c,visibleRows:l,visibleCols:u,mergeMap:d,pageWidth:f,pageHeight:p,contentWidth:m,headerHeight:h,scaleFactor:g,margins:_}=e,v=[],y=n.map(e=>s[e]),b=y.reduce((e,t)=>e+t,0),x=[],S=_.left;b<m&&(S=_.left+(m-b)/2);for(let e of y)x.push(S),S+=e;let ee=[],te=[],ne=p-_.top-h;for(let e of t){let t=c[e]??15*g;ee.push(ne),te.push(t),ne-=t}let re=new Map;for(let e=0;e<t.length;e++){let r=t[e],s=l[r];for(let t=0;t<n.length;t++){let c=u[n[t]],f=`${s}:${c}`,p=d.get(f);if(p&&!p.isMaster)continue;let m=i.rows.get(s)?.cells.get(c),h=1,_=1;if(p&&p.isMaster){let e=c+p.colSpan-1;h=0;for(let r=t;r<n.length&&u[n[r]]<=e;r++)h++;let i=s+p.rowSpan-1;_=0;for(let e=r;e<l.length&&l[e]<=i;e++)_++;h=Math.max(h,1),_=Math.max(_,1)}let b=x[t],S=ee[e],ne=0;for(let e=0;e<h&&t+e<y.length;e++)ne+=y[t+e];let ie=0;for(let t=0;t<_&&e+t<te.length;t++)ie+=te[e+t];let ae=S-ie;v.push(CV(m,b,ae,ne,ie,h,_,a,o,g));let oe=v[v.length-1];p?.isMaster&&kV(oe,p,s,c,i),re.set(`${e}:${t}`,oe)}}return TV(re,t.length,n.length),AV(re,t,n,l,u,y,d,o),{pageNumber:r+1,options:a,cells:v,width:f,height:p,sheetName:i.name,sheetCols:n.map(e=>u[e]),columnOffsets:x,columnWidths:y,sheetRows:t.map(e=>l[e]),rowYPositions:ee,rowHeights:te,images:[],charts:[],scaleFactor:g}}function lV(e,t){let n=t.pageSize.width,r=t.pageSize.height;return t.orientation===`landscape`&&([n,r]=[r,n]),{pageNumber:1,options:t,cells:[],width:n,height:r,sheetName:e.name,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[],charts:[],scaleFactor:1}}function uV(e){let t=e.replace(/\$/g,``).toUpperCase(),n=0,r=0;for(;r<t.length&&t.charCodeAt(r)>=65&&t.charCodeAt(r)<=90;)n=n*26+(t.charCodeAt(r)-64),r++;let i=parseInt(t.substring(r),10);return{c:n-1,r:i-1}}function dV(e){let t=e.indexOf(`:`);if(t===-1){let t=uV(e);return{s:t,e:{...t}}}return{s:uV(e.slice(0,t)),e:uV(e.slice(t+1))}}function fV(e){let t=e.pageSetup?.printArea;if(!t||typeof t!=`string`)return null;let n=t.split(`&&`)[0].trim();if(!n)return null;try{let e=dV(n);return{startRow:e.s.r+1,endRow:e.e.r+1,startCol:e.s.c+1,endCol:e.e.c+1}}catch{return null}}function pV(e,t){let n=e.bounds;if(!(n.top>0&&n.left>0))return{columnWidths:[],visibleCols:[]};let r=t?.startCol??n.left,i=t?.endCol??n.right,a=[],o=[];for(let t=r;t<=i;t++){let n=e.columns.get(t);if(n?.hidden)continue;let r=(n?.width??rV)*7+5,i=Math.max(r*tB,3);a.push(i),o.push(t)}return{columnWidths:a,visibleCols:o}}function mV(e,t,n,r,i){let a=e.bounds;if(a.top<=0)return{rowHeights:[],visibleRows:[]};let o=n?.startRow??a.top,s=n?.endRow??a.bottom,c=[],l=[];for(let n=o;n<=s;n++){let a=e.rows.get(n);if(a?.hidden)continue;let o;o=a?.height&&a.customHeight?a.height:a?.height?Math.max(a.height,hV(a,t,e,r,i)):hV(a,t,e,r,i),c.push(o*t),l.push(n)}return{rowHeights:c,visibleRows:l}}function hV(e,t,n,r,i){let a=15;if(e)for(let o of e.cells.values()){let e=gV(o),s=_V(o,e,t,n,r,i),c=e*eB,l=o.style?.border?.top?.style?ZB(o.style.border.top.style)/2:0,u=o.style?.border?.bottom?.style?ZB(o.style.border.bottom.style)/2:0,d=e+(s-1)*c+(2+l+u)*2;d>a&&(a=d)}return a}function gV(e){let t=e.style?.font?.size??11;if(e.type===Zz.RichText){let n=e.value;if(n&&typeof n==`object`&&`richText`in n){let e=n.richText;for(let n of e){let e=n.font?.size??t;e>t&&(t=e)}}}return t}function _V(e,t,n,r,i,a){let o=typeof e.text==`string`?e.text:String(e.text??``),s=Math.max(1,(o.match(/\n/g)??[]).length+1);if(!e.style?.alignment?.wrapText||o.length===0)return s;let c=((r.columns.get(e.col)?.width??rV)*7+5)*tB*n,l=e.style.alignment.indent??0,u=e.style?.border?.left?.style?ZB(e.style.border.left.style)/2:0,d=e.style?.border?.right?.style?ZB(e.style.border.right.style)/2:0,f=3+u+(3+d)+l*10,p=Math.max(c-f,1);if(e.type===Zz.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t){let r=t.richText;if(r.length>0){let t=vV(o,r,n,p,i,a,e.style?.font);return Math.max(s,t)}}}let m=t*n,h=YB(e.style.font,a.defaultFontFamily,a.defaultFontSize),g=wz(h.fontFamily,h.bold,h.italic),_=i.hasEmbeddedFont()?i.getEmbeddedResourceName():i.ensureFont(g),v=EB(o,e=>i.measureText(e,_,m),p);return Math.max(s,v.length)}function vV(e,t,n,r,i,a,o){let s=o?.name??a.defaultFontFamily,c=o?.size??a.defaultFontSize,l=[];for(let e=0;e<t.length;e++)for(let n=0;n<t[e].text.length;n++)l.push(e);let u=t.map(e=>{let t=YB(e.font?{name:e.font.name??o?.name,size:e.font.size??o?.size,bold:e.font.bold??!1,italic:e.font.italic??!1,strike:e.font.strike??!1,underline:e.font.underline??void 0,color:e.font.color??o?.color}:o,s,c),n=wz(t.fontFamily,t.bold,t.italic);return i.hasEmbeddedFont()?i.getEmbeddedResourceName():i.ensureFont(n)}),d=t.map(e=>YB(e.font?{name:e.font.name??o?.name,size:e.font.size??o?.size,bold:e.font.bold??!1,italic:e.font.italic??!1}:o,s,c).fontSize*n),f=(t,n)=>{let r=0,a=t,o=l[t]??0;for(let s=t+1;s<=n;s++){let t=s<n?l[s]??o:-1;if(t!==o){let n=e.slice(a,s);r+=i.measureText(n,u[o],d[o]),a=s,o=t}}return r},p=0,m=0,h=e.length;for(;m<=h;){let t=e.indexOf(`
460
+ `,c);if(t===-1&&(t=l),t===c){s.push({start:c,end:c}),c=t+1;continue}let n=t>c&&e[t-1]===`\r`?t-1:t;if(n===c){s.push({start:c,end:c}),c=t+1;continue}let r=e.slice(c,n),i=[],u=[],d=!1;for(let e=0;e<r.length;e++){let t=r[e]===` `||r[e]===` `;!t&&!d?(i.push(e),d=!0):t&&d&&(u.push(e),d=!1)}d&&u.push(r.length);let f=c,p=c;for(let e=0;e<i.length;e++){let t=c+u[e];if(p===f){p=t;continue}o(f,t)<=a?p=t:(s.push({start:f,end:p}),f=c+i[e],p=t)}if((p>f||i.length===0)&&s.push({start:f,end:Math.max(p,f)}),c=t+1,t===l)break}return s.length>0?s:[{start:0,end:0}]}function OB(e,t,n,r){let i=t.sheetName,a=r.hasEmbeddedFont()?r.getEmbeddedResourceName():r.ensureFont(wz(n.defaultFontFamily,!0,!1)),o=r.measureText(i,a,10),s=(t.width-o)/2,c=t.height-n.margins.top+5;e.save(),e.setFillColor({r:.3,g:.3,b:.3}),_B(e,i,1,0,0,1,s,c,a,10,r,r.hasType3Fonts()&&!r.hasEmbeddedFont()),e.restore()}function kB(e,t,n,r,i){let a=`Page ${t.pageNumber} of ${i}`,o=r.ensureFont(wz(n.defaultFontFamily,!1,!1)),s=r.measureText(a,o,9),c=(t.width-s)/2,l=Math.max(5,n.margins.bottom-15);e.save(),e.setFillColor({r:.5,g:.5,b:.5}),e.beginText(),e.setFont(o,9),e.setTextMatrix(1,0,0,1,c,l),e.showText(a),e.endText(),e.restore()}let AB={fontSize:54,color:{r:.75,g:.75,b:.75},opacity:.15,rotation:-45,fontFamily:`Helvetica`,bold:!1,italic:!1,repeatSpacingX:200,repeatSpacingY:200},jB={opacity:.15,rotation:0,scale:.5,repeatSpacingX:200,repeatSpacingY:200};function MB(e,t,n,r){return n.type===`text`?IB(e,t,NB(n),r):LB(e,t,PB(n))}function NB(e){return{...e,opacity:FB(e.opacity??AB.opacity),fontSize:Math.max(1,e.fontSize??AB.fontSize),repeatSpacingX:Math.max(10,e.repeatSpacingX??AB.repeatSpacingX),repeatSpacingY:Math.max(10,e.repeatSpacingY??AB.repeatSpacingY)}}function PB(e){return{...e,opacity:FB(e.opacity??jB.opacity),scale:Math.max(.01,e.scale??jB.scale),width:e.width===void 0?void 0:Math.max(1,e.width),height:e.height===void 0?void 0:Math.max(1,e.height),repeatSpacingX:Math.max(10,e.repeatSpacingX??jB.repeatSpacingX),repeatSpacingY:Math.max(10,e.repeatSpacingY??jB.repeatSpacingY)}}function FB(e){return Math.max(0,Math.min(1,e))}function IB(e,t,n,r){let i=n.fontSize??AB.fontSize,a=n.color??AB.color,o=n.opacity??AB.opacity,s=n.rotation??AB.rotation,c=n.fontFamily??AB.fontFamily,l=n.bold??AB.bold,u=n.italic??AB.italic,d=r.hasEmbeddedFont(),f=d?r.getEmbeddedResourceName():r.ensureFont(wz(c,l,u)),p=r.measureText(n.text,f,i),m=i*.7,h=s*Math.PI/180,g=Math.cos(h),_=Math.sin(h),v=o<1,y=v?SB(o):``,b=r.hasType3Fonts()&&!d,x=(t,o)=>{let s=p/2,c=m/2,l=t-s*g+c*_,u=o-s*_-c*g;e.save(),v&&e.setGraphicsState(y),e.setFillColor(a),_B(e,n.text,g,_,-_,g,l,u,f,i,r,b),e.restore()};if(n.repeat){let e=n.repeatSpacingX??AB.repeatSpacingX,r=n.repeatSpacingY??AB.repeatSpacingY;zB(t.width,t.height,e,r,x)}else{let{cx:e,cy:r}=RB(t,n.position);x(e,r)}return{alphaValues:v?[o]:[],imageXObjects:[]}}function LB(e,t,n){let r=n.opacity??jB.opacity,i=n.rotation??jB.rotation,a=n.scale??jB.scale,o=r<1,s,c;if(n.width!==void 0&&n.height!==void 0)s=n.width,c=n.height;else{let e=II(n.data,n.format),r=Math.min(t.width,t.height)*a,i=Math.max(e.width,e.height),o=i>0?r/i:1;s=e.width*o,c=e.height*o}let l=i*Math.PI/180,u=Math.cos(l),d=Math.sin(l),f=o?SB(r):``,p=`WmImg`,m=(t,n)=>{e.save(),o&&e.setGraphicsState(f);let r=s/2,i=c/2,a=t-r*u+i*d,l=n-r*d-i*u;e.concat(s*u,s*d,-c*d,c*u,a,l),e.doXObject(p),e.restore()};if(n.repeat){let e=n.repeatSpacingX??jB.repeatSpacingX,r=n.repeatSpacingY??jB.repeatSpacingY;zB(t.width,t.height,e,r,m)}else{let{cx:e,cy:r}=RB(t,n.position);m(e,r)}return{alphaValues:o?[r]:[],imageXObjects:[{name:p,data:n.data,format:n.format}]}}function RB(e,t){return!t||t===`center`?{cx:e.width/2,cy:e.height/2}:{cx:t.x,cy:t.y}}function zB(e,t,n,r,i){let a=Math.max(e,t)*.5,o=0;for(let s=-a;s<t+a;s+=r){let t=o%2==1?n/2:0;for(let r=-a;r<e+a;r+=n)i(r+t,s);o++}}function BB(e,t,n){let r=t=>{t?.a!==void 0&&t.a<1&&(n.add(t.a),e.setGraphicsState(SB(t.a)))},i=t=>{let{fill:i,stroke:a,lineWidth:o}=t;if(i&&(e.setFillColor(i),r(i)),a){e.setStrokeColor(a);let t=a.a!==void 0&&a.a<1,s=i?.a!==void 0&&i.a<1;t?r(a):s&&(n.add(1),e.setGraphicsState(SB(1))),o!==void 0&&e.setLineWidth(o)}i&&a?e.fillAndStroke():i?e.fill():a?e.stroke():e.endPath()};return{drawRect(t){let{x:n,y:r,width:a,height:o,fill:s,stroke:c,lineWidth:l}=t;return e.save(),e.rect(n,r,a,o),i({fill:s,stroke:c,lineWidth:l}),e.restore(),this},drawLine(t){let{x1:n,y1:i,x2:a,y2:o,color:s,lineWidth:c,dashPattern:l}=t;return e.save(),s&&(e.setStrokeColor(s),r(s)),c!==void 0&&e.setLineWidth(c),l&&l.length>0&&e.setDashPattern(l),e.moveTo(n,i).lineTo(a,o).stroke(),e.restore(),this},drawText(n,i){if(!n)return this;let a=i.fontSize??10,o=i.color??{r:0,g:0,b:0},s=i.bold??!1,c=i.italic??!1,l=i.fontFamily??`Helvetica`,u=i.anchor??`start`,d=i.rotation??0,f=VB(t,l,s,c),p=t.hasType3Fonts()&&!t.hasEmbeddedFont(),m=t.measureText(n,f,a),h=0;if(u===`middle`?h=-m/2:u===`end`&&(h=-m),e.save(),e.setFillColor(o),r(o),d===0)_B(e,n,1,0,0,1,i.x+h,i.y,f,a,t,p);else{let r=-d*Math.PI/180,o=Math.cos(r),s=Math.sin(r);_B(e,n,o,s,-s,o,i.x+o*h,i.y+s*h,f,a,t,p)}return e.restore(),this},drawCircle(t){let{cx:n,cy:r,r:a,fill:o,stroke:s,lineWidth:c}=t;return e.save(),e.circle(n,r,a),i({fill:o,stroke:s,lineWidth:c}),e.restore(),this},drawPath(t,n){e.save();for(let n of t)switch(n.op){case`move`:e.moveTo(n.x,n.y);break;case`line`:e.lineTo(n.x,n.y);break;case`curve`:e.curveTo(n.x1,n.y1,n.x2,n.y2,n.x3,n.y3);break;case`close`:e.closePath();break}return n?.closePath&&e.closePath(),n?.dashPattern&&n.dashPattern.length>0&&e.setDashPattern(n.dashPattern),i({fill:n?.fill,stroke:n?.stroke,lineWidth:n?.lineWidth}),e.restore(),this}}}function VB(e,t,n,r){return e.hasEmbeddedFont()?e.getEmbeddedResourceName():e.ensureFont(wz(t,n,r))}function HB(e){if(!e||e.length<6)return null;let t,n,r,i;if(e.length>=8?(t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),i=parseInt(e.substring(6,8),16)):(t=255,n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16)),isNaN(n)||isNaN(r)||isNaN(i))return null;let a=t/255;return{r:n/255,g:r/255,b:i/255,...a<1?{a}:{}}}function UB(e){if(!e)return null;if(e.argb)return HB(e.argb);if(e.theme!==void 0){let t=WB(e.theme);if(!t)return null;let n=e.tint;return n!==void 0&&n!==0?qB(t,n):t}return e.indexed===void 0?null:KB(e.indexed)}function WB(e){let t=[{r:1,g:1,b:1},{r:0,g:0,b:0},{r:.906,g:.902,b:.902},{r:.267,g:.329,b:.416},{r:.267,g:.447,b:.769},{r:.929,g:.49,b:.192},{r:.647,g:.647,b:.647},{r:1,g:.753,b:0},{r:.357,g:.608,b:.835},{r:.439,g:.678,b:.278}];return e>=0&&e<t.length?t[e]:null}let GB=`000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.000000.FFFFFF.FF0000.00FF00.0000FF.FFFF00.FF00FF.00FFFF.800000.008000.000080.808000.800080.008080.C0C0C0.808080.9999FF.993366.FFFFCC.CCFFFF.660066.FF8080.0066CC.CCCCFF.000080.FF00FF.FFFF00.00FFFF.800080.800000.008080.0000FF.00CCFF.CCFFFF.CCFFCC.FFFF99.99CCFF.FF99CC.CC99FF.FFCC99.3366FF.33CCCC.99CC00.FFCC00.FF9900.FF6600.666699.969696.003366.339966.003300.333300.993300.993366.333399.333333`.split(`.`);function KB(e){return e===64?{r:0,g:0,b:0}:e===65?{r:1,g:1,b:1}:e>=0&&e<GB.length?HB(GB[e])??null:null}function qB(e,t){let n=e=>t<0?e*(1+t):e+(1-e)*t;return{r:Math.max(0,Math.min(1,n(e.r))),g:Math.max(0,Math.min(1,n(e.g))),b:Math.max(0,Math.min(1,n(e.b)))}}let JB={black:{r:0,g:0,b:0},white:{r:1,g:1,b:1},gridLine:{r:.816,g:.816,b:.816}};function YB(e,t,n){return{fontFamily:e?.name??t,fontSize:e?.size??n,bold:e?.bold??!1,italic:e?.italic??!1,strike:e?.strike??!1,underline:!!(e?.underline&&e.underline!==`none`),textColor:UB(e?.color)??JB.black}}function XB(e){if(!e)return null;if(e.type===`pattern`){if(e.pattern===`solid`&&e.fgColor)return UB(e.fgColor);if(e.pattern===`none`)return null;if(e.fgColor)return UB(e.fgColor)}return e.type===`gradient`&&e.stops&&e.stops.length>0?UB(e.stops[0].color):null}function ZB(e){switch(e){case`hair`:return .1;case`thin`:return .25;case`medium`:return .5;case`thick`:return 1;case`double`:return .25;case`dotted`:return .25;case`dashed`:return .25;case`dashDot`:return .25;case`dashDotDot`:return .25;case`slantDashDot`:return .25;case`mediumDashed`:return .5;case`mediumDashDot`:return .5;case`mediumDashDotDot`:return .5;default:return .25}}function QB(e){switch(e){case`dotted`:return[1,1];case`dashed`:case`mediumDashed`:return[3,2];case`dashDot`:case`mediumDashDot`:return[3,1,1,1];case`dashDotDot`:case`mediumDashDotDot`:return[3,1,1,1,1,1];case`slantDashDot`:return[4,2,1,2];case`hair`:return[.5,.5];default:return[]}}function $B(e){return!e||!e.style?null:{width:ZB(e.style),color:UB(e.color)??JB.black,dashPattern:QB(e.style),isDouble:e.style===`double`}}function eV(e){return e?{top:$B(e.top),right:$B(e.right),bottom:$B(e.bottom),left:$B(e.left)}:{top:null,right:null,bottom:null,left:null}}function tV(e){if(!e?.horizontal)return`left`;switch(e.horizontal){case`center`:case`centerContinuous`:return`center`;case`right`:return`right`;default:return`left`}}function nV(e){if(!e?.vertical)return`bottom`;switch(e.vertical){case`top`:return`top`;case`middle`:return`middle`;default:return`bottom`}}Ff();let rV=8.43;function iV(e,t,n){if(e?.horizontal&&e.horizontal!==`general`)return tV(e);if(t!==void 0)switch(t){case Zz.Number:case Zz.Date:return`right`;case Zz.Boolean:case Zz.Error:return`center`;case Zz.Formula:return typeof n==`number`||n instanceof Date?`right`:typeof n==`boolean`?`center`:`left`;default:return`left`}return`left`}async function aV(e,t,n){let r=sV(e,t,n);if(!r)return[lV(e,t)];let i=[],a=r.rowPages.length*r.colGroups.length;for(let o of r.rowPages)for(let s of r.colGroups)i.push(cV(r,o,s,i.length,e,t,n)),i.length<a&&await Tf();return i.length>0&&e.images&&DV(e.images,i,r.scaleFactor),i.length>0&&e.charts&&OV(e.charts,i,r.scaleFactor),i}function oV(e,t){let n=e.orientation??t.orientation,r={...t,orientation:n},i=r.pageSize.width,a=r.pageSize.height;r.orientation===`landscape`&&([i,a]=[a,i]);let o=r.margins,s=r.showSheetNames?20:0,c=o.left,l=o.bottom,u=i-o.left-o.right,d=a-o.top-o.bottom-s,f={rect:{x:c,y:l,width:Math.max(0,u),height:Math.max(0,d)},drawVector:e.chart.drawVector,raster:e.chart.raster};return[{pageNumber:1,options:r,cells:[],width:i,height:a,sheetName:e.name,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[],charts:[f],scaleFactor:1}]}function sV(e,t,n){let{margins:r}=t,i=t.pageSize.width,a=t.pageSize.height;t.orientation===`landscape`&&([i,a]=[a,i]);let o=i-r.left-r.right,s=a-r.top-r.bottom,c=t.showSheetNames?20:0,l=t.showPageNumbers?20:0,u=s-c-l,d=fV(e,t),{columnWidths:f,visibleCols:p}=pV(e,d);if(p.length===0)return null;let m=f.reduce((e,t)=>e+t,0),h=t.scale;if(t.fitToPage&&m>0){let e=o/m;e<1&&(h*=e)}let g=f.map(e=>e*h),{rowHeights:_,visibleRows:v}=mV(e,h,d,n,t),y=bV(e),b=xV(_,u,typeof t.repeatRows==`number`?t.repeatRows:0,yV(e,v)),x=SV(g,o,e,p);return{pageWidth:i,pageHeight:a,contentWidth:o,headerHeight:c,scaleFactor:h,scaledColumnWidths:g,rowHeights:_,visibleRows:v,visibleCols:p,mergeMap:y,rowPages:b,colGroups:x,margins:r}}function cV(e,t,n,r,i,a,o){let{scaledColumnWidths:s,rowHeights:c,visibleRows:l,visibleCols:u,mergeMap:d,pageWidth:f,pageHeight:p,contentWidth:m,headerHeight:h,scaleFactor:g,margins:_}=e,v=[],y=n.map(e=>s[e]),b=y.reduce((e,t)=>e+t,0),x=[],S=_.left;b<m&&(S=_.left+(m-b)/2);for(let e of y)x.push(S),S+=e;let ee=[],te=[],ne=p-_.top-h;for(let e of t){let t=c[e]??15*g;ee.push(ne),te.push(t),ne-=t}let re=new Map;for(let e=0;e<t.length;e++){let r=t[e],s=l[r];for(let t=0;t<n.length;t++){let c=u[n[t]],f=`${s}:${c}`,p=d.get(f);if(p&&!p.isMaster)continue;let m=i.rows.get(s)?.cells.get(c),h=1,_=1;if(p&&p.isMaster){let e=c+p.colSpan-1;h=0;for(let r=t;r<n.length&&u[n[r]]<=e;r++)h++;let i=s+p.rowSpan-1;_=0;for(let e=r;e<l.length&&l[e]<=i;e++)_++;h=Math.max(h,1),_=Math.max(_,1)}let b=x[t],S=ee[e],ne=0;for(let e=0;e<h&&t+e<y.length;e++)ne+=y[t+e];let ie=0;for(let t=0;t<_&&e+t<te.length;t++)ie+=te[e+t];let ae=S-ie;v.push(CV(m,b,ae,ne,ie,h,_,a,o,g));let oe=v[v.length-1];p?.isMaster&&kV(oe,p,s,c,i),re.set(`${e}:${t}`,oe)}}return TV(re,t.length,n.length),AV(re,t,n,l,u,y,d,o),{pageNumber:r+1,options:a,cells:v,width:f,height:p,sheetName:i.name,sheetCols:n.map(e=>u[e]),columnOffsets:x,columnWidths:y,sheetRows:t.map(e=>l[e]),rowYPositions:ee,rowHeights:te,images:[],charts:[],scaleFactor:g}}function lV(e,t){let n=t.pageSize.width,r=t.pageSize.height;return t.orientation===`landscape`&&([n,r]=[r,n]),{pageNumber:1,options:t,cells:[],width:n,height:r,sheetName:e.name,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[],charts:[],scaleFactor:1}}function uV(e){let t=e.replace(/\$/g,``).toUpperCase(),n=0,r=0;for(;r<t.length&&t.charCodeAt(r)>=65&&t.charCodeAt(r)<=90;)n=n*26+(t.charCodeAt(r)-64),r++;let i=parseInt(t.substring(r),10);return{c:n-1,r:i-1}}function dV(e){let t=e.indexOf(`:`);if(t===-1){let t=uV(e);return{s:t,e:{...t}}}return{s:uV(e.slice(0,t)),e:uV(e.slice(t+1))}}function fV(e,t){if(t.ignorePrintArea)return null;let n=e.pageSetup?.printArea;if(!n||typeof n!=`string`)return null;let r=n.split(`&&`)[0].trim();if(!r)return null;try{let e=dV(r);return{startRow:e.s.r+1,endRow:e.e.r+1,startCol:e.s.c+1,endCol:e.e.c+1}}catch{return null}}function pV(e,t){let n=e.bounds;if(!(n.top>0&&n.left>0))return{columnWidths:[],visibleCols:[]};let r=t?.startCol??n.left,i=t?.endCol??n.right,a=[],o=[];for(let t=r;t<=i;t++){let n=e.columns.get(t);if(n?.hidden)continue;let r=(n?.width??rV)*7+5,i=Math.max(r*tB,3);a.push(i),o.push(t)}return{columnWidths:a,visibleCols:o}}function mV(e,t,n,r,i){let a=e.bounds;if(a.top<=0)return{rowHeights:[],visibleRows:[]};let o=n?.startRow??a.top,s=n?.endRow??a.bottom,c=[],l=[];for(let n=o;n<=s;n++){let a=e.rows.get(n);if(a?.hidden)continue;let o;o=a?.height&&a.customHeight?a.height:a?.height?Math.max(a.height,hV(a,t,e,r,i)):hV(a,t,e,r,i),c.push(o*t),l.push(n)}return{rowHeights:c,visibleRows:l}}function hV(e,t,n,r,i){let a=15;if(e)for(let o of e.cells.values()){let e=gV(o),s=_V(o,e,t,n,r,i),c=e*eB,l=o.style?.border?.top?.style?ZB(o.style.border.top.style)/2:0,u=o.style?.border?.bottom?.style?ZB(o.style.border.bottom.style)/2:0,d=e+(s-1)*c+(2+l+u)*2;d>a&&(a=d)}return a}function gV(e){let t=e.style?.font?.size??11;if(e.type===Zz.RichText){let n=e.value;if(n&&typeof n==`object`&&`richText`in n){let e=n.richText;for(let n of e){let e=n.font?.size??t;e>t&&(t=e)}}}return t}function _V(e,t,n,r,i,a){let o=typeof e.text==`string`?e.text:String(e.text??``),s=Math.max(1,(o.match(/\n/g)??[]).length+1);if(!e.style?.alignment?.wrapText||o.length===0)return s;let c=((r.columns.get(e.col)?.width??rV)*7+5)*tB*n,l=e.style.alignment.indent??0,u=e.style?.border?.left?.style?ZB(e.style.border.left.style)/2:0,d=e.style?.border?.right?.style?ZB(e.style.border.right.style)/2:0,f=3+u+(3+d)+l*10,p=Math.max(c-f,1);if(e.type===Zz.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t){let r=t.richText;if(r.length>0){let t=vV(o,r,n,p,i,a,e.style?.font);return Math.max(s,t)}}}let m=t*n,h=YB(e.style.font,a.defaultFontFamily,a.defaultFontSize),g=wz(h.fontFamily,h.bold,h.italic),_=i.hasEmbeddedFont()?i.getEmbeddedResourceName():i.ensureFont(g),v=EB(o,e=>i.measureText(e,_,m),p);return Math.max(s,v.length)}function vV(e,t,n,r,i,a,o){let s=o?.name??a.defaultFontFamily,c=o?.size??a.defaultFontSize,l=[];for(let e=0;e<t.length;e++)for(let n=0;n<t[e].text.length;n++)l.push(e);let u=t.map(e=>{let t=YB(e.font?{name:e.font.name??o?.name,size:e.font.size??o?.size,bold:e.font.bold??!1,italic:e.font.italic??!1,strike:e.font.strike??!1,underline:e.font.underline??void 0,color:e.font.color??o?.color}:o,s,c),n=wz(t.fontFamily,t.bold,t.italic);return i.hasEmbeddedFont()?i.getEmbeddedResourceName():i.ensureFont(n)}),d=t.map(e=>YB(e.font?{name:e.font.name??o?.name,size:e.font.size??o?.size,bold:e.font.bold??!1,italic:e.font.italic??!1}:o,s,c).fontSize*n),f=(t,n)=>{let r=0,a=t,o=l[t]??0;for(let s=t+1;s<=n;s++){let t=s<n?l[s]??o:-1;if(t!==o){let n=e.slice(a,s);r+=i.measureText(n,u[o],d[o]),a=s,o=t}}return r},p=0,m=0,h=e.length;for(;m<=h;){let t=e.indexOf(`
461
461
  `,m);t===-1&&(t=h);let n=t>m&&e[t-1]===`\r`?t-1:t;if(n===m){if(p++,m=t+1,t===h)break;continue}let i=e.slice(m,n),a=[],o=[],s=!1;for(let e=0;e<i.length;e++){let t=i[e]===` `||i[e]===` `;!t&&!s?(a.push(e),s=!0):t&&s&&(o.push(e),s=!1)}s&&o.push(i.length);let c=m,l=m,u=0;for(let e=0;e<a.length;e++){let t=m+o[e];if(l===c){l=t;continue}f(c,t)<=r?l=t:(u++,c=m+a[e],l=t)}if((l>c||a.length===0)&&u++,p+=u,m=t+1,t===h)break}return Math.max(1,p)}function yV(e,t){let n=new Set,r=e.rowBreaks??[];if(r.length===0)return n;let i=new Map;for(let e=0;e<t.length;e++)i.set(t[e],e);for(let e of r){let t=i.get(e);t!==void 0&&n.add(t+1)}return n}function bV(e){let t=new Map,n=e.merges;if(!n||n.length===0)return t;for(let e of n){let n=dV(e),r=n.s.r+1,i=n.s.c+1,a=n.e.r+1,o=n.e.c+1,s=a-r+1,c=o-i+1;for(let e=r;e<=a;e++)for(let n=i;n<=o;n++)t.set(`${e}:${n}`,{isMaster:e===r&&n===i,rowSpan:s,colSpan:c})}return t}function xV(e,t,n,r){if(e.length===0)return[[]];let i=[],a=[],o=0,s=!0,c=0,l=()=>{c=0;for(let r=0;r<n&&r<e.length&&!(o+e[r]>t&&a.length>0);r++)a.push(r),o+=e[r],c++};for(let u=0;u<e.length;u++){let d=e[u],f=t;for(;;){let e=r.has(u)&&a.length>0;if((e||o+d>f)&&a.length>0){if(!e&&!s&&a.length>0&&a.length===c){a=[],o=0,c=0;continue}i.push(a),a=[],o=0,c=0,s=!1,l();continue}if(!s&&u<n&&a.includes(u))break;a.push(u),o+=d;break}}return a.length>0&&i.push(a),i.length>0?i:[[]]}function SV(e,t,n,r){if(e.length===0)return[[]];let i=new Set,a=n.colBreaks??[];if(a.length>0){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],t);for(let t of a){let n=e.get(t);n!==void 0&&i.add(n+1)}}let o=[],s=[],c=0;for(let n=0;n<e.length;n++){let r=e[n];(i.has(n)&&s.length>0||c+r>t+.01)&&s.length>0&&(o.push(s),s=[],c=0),s.push(n),c+=r}return s.length>0&&o.push(s),o.length>0?o:[Array.from({length:e.length},(e,t)=>t)]}function CV(e,t,n,r,i,a,o,s,c,l){let u=e?.text??``,d=e?.style??{},f=YB(d.font,s.defaultFontFamily,s.defaultFontSize),p=f.fontSize*l;if(c.hasEmbeddedFont())c.trackText(u);else{let e=wz(f.fontFamily,f.bold,f.italic);c.ensureFont(e),c.trackText(u)}let m=jV(e,s,c,l,d.font),h=eV(d.border);return{text:u,rect:{x:t,y:n,width:r,height:i},fontFamily:f.fontFamily,fontSize:p,bold:f.bold,italic:f.italic,strike:f.strike,underline:f.underline,textColor:f.textColor,fillColor:XB(d.fill),horizontalAlign:iV(d.alignment,e?.type,e?.result),verticalAlign:nV(d.alignment),wrapText:d.alignment?.wrapText??!1,borders:h,borderInsets:{top:(h.top?.width??0)/2,right:(h.right?.width??0)/2,bottom:(h.bottom?.width??0)/2,left:(h.left?.width??0)/2},colSpan:a,rowSpan:o,hyperlink:e?.hyperlink??null,richText:m,indent:d.alignment?.indent??0,textRotation:d.alignment?.textRotation===255?`vertical`:d.alignment?.textRotation??0,textOverflowWidth:0}}function wV(e){let t=e.width*1e3;e.dashPattern.length===0&&(t+=100),e.isDouble&&(t+=50);let n=e.color.r+e.color.g+e.color.b;return t+=(3-n)*10,t}function TV(e,t,n){for(let r=0;r<t;r++)for(let t=0;t<n;t++){let n=e.get(`${r}:${t}`);if(n){if(n.borders.right){let i=e.get(`${r}:${t+1}`);if(i?.borders.left){let e=wV(n.borders.right);wV(i.borders.left)>e?(n.borderInsets.right=i.borders.left.width/2,n.borders.right=null):(i.borderInsets.left=n.borders.right.width/2,i.borders.left=null)}}if(n.borders.bottom){let i=e.get(`${r+1}:${t}`);if(i?.borders.top){let e=wV(n.borders.bottom);wV(i.borders.top)>e?(n.borderInsets.bottom=i.borders.top.width/2,n.borders.bottom=null):(i.borderInsets.top=n.borders.bottom.width/2,i.borders.top=null)}}}}}function EV(e,t,n){let r=e.tl,i=(r.nativeCol??r.col??0)+1,a=(r.nativeRow??r.row??0)+1,o=t.find(e=>e.sheetCols.includes(i)&&e.sheetRows.includes(a));if(!o)return null;let s=o.sheetCols.indexOf(i),c=o.sheetRows.indexOf(a),l=o.columnOffsets[s]??o.options.margins.left,u=o.rowYPositions[c]??o.height-o.options.margins.top-(o.options.showSheetNames?20:0),d=((r.nativeColOff??0)/12700||0)*n,f=((r.nativeRowOff??0)/12700||0)*n,p=l+d,m=u-f,h=100,g=100,_=e.extUnit??`px`;if(e.ext)_===`emu`?(h=e.ext.width/9525*n,g=e.ext.height/9525*n):(h=e.ext.width*.75*n,g=e.ext.height*.75*n);else if(e.br){let t=e.br,r=(t.nativeCol??t.col??0)+1,s=(t.nativeRow??t.row??0)+1,d=o.sheetCols.indexOf(r),f=o.sheetRows.indexOf(s),_,v;if(d>=0)_=o.columnOffsets[d];else{let e=o.sheetCols.length-1,t=o.sheetCols[e]??i,n=e>=0?o.columnOffsets[e]+(o.columnWidths[e]??0):l;if(r<=t)_=n;else{let e=o.columnWidths.length>0?o.columnWidths.reduce((e,t)=>e+t,0)/o.columnWidths.length:48;_=n+(r-t)*e}}if(f>=0)v=o.rowYPositions[f];else{let e=o.sheetRows.length-1,t=o.sheetRows[e]??a;if(s<=t){let t=0;for(let n=c;n<=e&&!(o.sheetRows[n]>=s);n++)t+=o.rowHeights[n]??0;v=u-t}else{let r=0;for(let t=c;t<=e;t++)r+=o.rowHeights[t]??0;let i=s-t-1;r+=15*n*i,v=u-r}}let y=((t.nativeColOff??0)/12700||0)*n,b=((t.nativeRowOff??0)/12700||0)*n,x=_+y,S=v-b;h=x-p,g=m-S}let v=o.width-o.options.margins.right,y=o.options.margins.bottom,b=Math.min(Math.abs(h),Math.max(0,v-p)),x=Math.abs(g),S=Math.max(0,m-y);return x>0&&S<x*.5?null:{page:o,x:p,y:m-x,width:b,height:x}}function DV(e,t,n){for(let r of e){let e=EV(r.range,t,n);e&&e.page.images.push({data:r.data,format:r.format,rect:{x:e.x,y:e.y,width:e.width,height:e.height}})}}function OV(e,t,n){for(let r of e){let e=EV(r.range,t,n);if(e){e.page.charts.push({rect:{x:e.x,y:e.y,width:e.width,height:e.height},drawVector:r.drawVector,raster:r.raster});continue}let i=r.range.tl,a=(i.nativeRow??i.row??0)+1,o;for(let e=0;e<t.length;e++){let n=t[e],r=n.sheetRows[n.sheetRows.length-1]??0;if(r>=a-1&&e+1<t.length){o=t[e+1];break}if(r>=a){o=n;break}}if(o||=t[t.length-1],o){let e=o.options.margins,t=o.options.showSheetNames?20:0,n=e.left,i=e.bottom,a=o.width-e.left-e.right,s=o.height-e.top-e.bottom-t;o.charts.push({rect:{x:n,y:i,width:a,height:s},drawVector:r.drawVector,raster:r.raster})}}}function kV(e,t,n,r,i){if(t.colSpan>1){let a=r+t.colSpan-1,o=i.rows.get(n)?.cells.get(a);if(o?.style?.border?.right){let t=eV({right:o.style.border.right});t.right&&(e.borders.right=t.right,e.borderInsets.right=t.right.width/2)}}if(t.rowSpan>1){let a=n+t.rowSpan-1,o=i.rows.get(a)?.cells.get(r);if(o?.style?.border?.bottom){let t=eV({bottom:o.style.border.bottom});t.bottom&&(e.borders.bottom=t.bottom,e.borderInsets.bottom=t.bottom.width/2)}}}function AV(e,t,n,r,i,a,o,s){for(let c=0;c<t.length;c++)for(let l=0;l<n.length;l++){let u=e.get(`${c}:${l}`);if(!u||u.wrapText||u.colSpan>1||!u.text&&!u.richText||typeof u.textRotation==`number`&&u.textRotation!==0||u.textRotation===`vertical`)continue;let d;if(u.richText){d=0;let e=s.hasEmbeddedFont();for(let t of u.richText){let n=e?s.getEmbeddedResourceName():s.ensureFont(wz(t.fontFamily,t.bold,t.italic));d+=s.measureText(t.text,n,t.fontSize)}}else{let e=s.hasEmbeddedFont()?s.getEmbeddedResourceName():s.ensureFont(wz(u.fontFamily,u.bold,u.italic));d=s.measureText(u.text,e,u.fontSize)}let f=u.rect.width-(3+u.borderInsets.left)-(3+u.borderInsets.right);if(d<=f)continue;let p=d-f,m=0;for(let s=l+1;s<n.length;s++){let l=r[t[c]],u=i[n[s]];if(o.has(`${l}:${u}`))break;let d=e.get(`${c}:${s}`);if(d?.text||d?.richText||(m+=a[s],m>=p))break}if(m>0){u.textOverflowWidth=Math.min(p,m);let t=0,r=u.textOverflowWidth;u.borders.right=null;for(let i=l+1;i<n.length;i++){let n=e.get(`${c}:${i}`);if(!n||(n.borders.left=null,t+=a[i],t>=r))break;n.borders.right=null}}}}function jV(e,t,n,r,i){if(!e||e.type!==Zz.RichText)return null;let a=e.value;if(!a||typeof a!=`object`||!(`richText`in a))return null;let o=a.richText;if(o.length===0)return null;let s=i?.name??t.defaultFontFamily,c=i?.size??t.defaultFontSize;return o.map(e=>{let t=YB(e.font?{name:e.font.name??i?.name,size:e.font.size??i?.size,bold:e.font.bold??!1,italic:e.font.italic??!1,strike:e.font.strike??!1,underline:e.font.underline??void 0,color:e.font.color??i?.color}:i,s,c);if(n.hasEmbeddedFont())n.trackText(e.text);else{let e=wz(t.fontFamily,t.bold,t.italic);n.ensureFont(e)}return{text:e.text,fontFamily:t.fontFamily,fontSize:t.fontSize*r,bold:t.bold,italic:t.italic,strike:t.strike,underline:t.underline,textColor:t.textColor}})}Ff();async function MV(e,t){let n=NV(e,t);for(let e of n.sheets)await PV(n,e,t);return FV(n,e,t)}function NV(e,t){let n=HV(e,t?.sheets);if(n.length===0)throw new eL(`No sheets to export. The workbook is empty or no sheets matched.`);let r=new Tz,i=new aL,a=t?.font??null;if(!a){let e=YV(n);if(e.size>0)for(let t of Az())try{let n=Fz(t);if([...e].every(e=>n.cmap.has(e))){a=t;break}}catch{}}if(a)try{let e=Fz(a);r.registerEmbeddedFont(e)}catch(e){if(t?.font)throw new tL(`Failed to parse TrueType font`,{cause:e})}return{sheets:n,fontManager:r,writer:i,allPages:[]}}async function PV(e,t,n){try{let r=UV(n,t),i=Qz(t)?oV(t,r):await aV(t,r,e.fontManager);e.allPages.push(...i)}catch(e){throw new tL(`Failed to layout sheet "${t.name}"`,{cause:e})}}async function FV(e,t,n){let{allPages:r,fontManager:i,writer:a,sheets:o}=e,s=UV(n,o[0]);IV(r,s,o),LV(r),RV(r,i);let c=s.watermark;if(c&&c.type===`text`){let e=c.fontFamily??`Helvetica`,t=c.bold??!1,n=c.italic??!1;i.hasEmbeddedFont()?i.trackText(c.text):i.ensureFont(wz(e,t,n))}let{pageObjNums:l,sheetFirstPage:u,pagesTreeObjNum:d}=await zV(r,i,a,i.writeFontResources(a),c);return VV(a,l,d,u,s,t,n)}function IV(e,t,n){e.length===0&&e.push({pageNumber:1,options:t,cells:[],width:t.pageSize.width,height:t.pageSize.height,sheetName:n[0]?.name??`Sheet1`,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[],charts:[],scaleFactor:1})}function LV(e){for(let t=0;t<e.length;t++)e[t].pageNumber=t+1}function RV(e,t){if(t.hasEmbeddedFont())for(let n of e)n.options.showSheetNames&&t.trackText(n.sheetName);for(let n of e)n.options.showPageNumbers&&t.ensureFont(wz(n.options.defaultFontFamily,!1,!1));if(!t.hasEmbeddedFont())for(let n of e)n.options.showSheetNames&&t.ensureFont(wz(n.options.defaultFontFamily,!0,!1))}async function zV(e,t,n,r,i){let a=[],o=n.allocObject(),s=new Map,c=e.length;for(let l=0;l<e.length;l++)BV(e[l],t,n,r,c,a,o,s,i),l<e.length-1&&await Tf();return{pageObjNums:a,sheetFirstPage:s,pagesTreeObjNum:o}}function BV(e,t,n,r,i,a,o,s,c){try{let{stream:l,alphaValues:u}=rB(e,e.options,t,i),d=new Map;if(e.images.length>0)for(let t=0;t<e.images.length;t++){let r=e.images[t],i=`Im${t+1}`,a=zI(n,r.data,r.format);d.set(i,a),l.drawImage(i,r.rect.x,r.rect.y,r.rect.width,r.rect.height)}if(e.charts.length>0){let r=e.images.length;for(let i of e.charts){if(i.drawVector){let e=BB(l,t,u),n=ZV(i.rect);i.drawVector(e,n);continue}if(i.raster){let e=`Im${++r}`,t=zI(n,i.raster.data,i.raster.format);d.set(e,t),l.drawImage(e,i.rect.x,i.rect.y,i.rect.width,i.rect.height)}}}let f;if(c&&JV(c,e)){let r=new qI,i=MB(r,e,c,t);for(let e of i.alphaValues)u.add(e);for(let e of i.imageXObjects){let t=zI(n,e.data,e.format);d.set(e.name,t)}f=n.allocObject(),n.addStreamObject(f,new kI,r)}let p=n.allocObject();n.addStreamObject(p,new kI,l);let m;m=f?(c?.placement??`under`)===`over`?`[${V(p)} ${V(f)}]`:`[${V(f)} ${V(p)}]`:V(p);let h=n.allocObject(),g=t.buildFontDictString(r),_=new kI().set(`Font`,g);if(d.size>0){let e=[`<<`];for(let[t,n]of d)e.push(`/${t} ${V(n)}`);e.push(`>>`),_.set(`XObject`,e.join(`
462
462
  `))}if(u.size>0){let e=[`<<`];for(let t of u){let r=n.allocObject(),i=new kI().set(`Type`,`/ExtGState`).set(`ca`,B(t)).set(`CA`,B(t));n.addObject(r,i),e.push(`/${SB(t)} ${V(r)}`)}e.push(`>>`),_.set(`ExtGState`,e.join(`
463
- `))}n.addObject(h,_);let v=[];for(let t of e.cells)if(t.hyperlink){let e=n.allocObject(),r=`[${B(t.rect.x)} ${B(t.rect.y)} ${B(t.rect.x+t.rect.width)} ${B(t.rect.y+t.rect.height)}]`,i=new kI().set(`Type`,`/Annot`).set(`Subtype`,`/Link`).set(`Rect`,r).set(`Border`,`[0 0 0]`).set(`A`,`<< /Type /Action /S /URI /URI (${t.hyperlink.replace(/[()\\]/g,`\\$&`)}) >>`);n.addObject(e,i),v.push(e)}let y=n.addPage({parentRef:o,width:e.width,height:e.height,contentsRef:m,resourcesRef:h,annotRefs:v.length>0?v:void 0});a.push(y),s.has(e.sheetName)||s.set(e.sheetName,a.length-1)}catch(t){throw new tL(`Failed to render page ${e.pageNumber} of "${e.sheetName}"`,{cause:t})}}function VV(e,t,n,r,i,a,o){let s=`[`+t.map(e=>V(e)).join(` `)+`]`,c=new kI().set(`Type`,`/Pages`).set(`Kids`,s).set(`Count`,String(t.length));e.addObject(n,c);let l;if(r.size>1&&(l=qV(e,r,t)),e.addCatalog(n,l),e.addInfoDict({title:i.title||a.title||void 0,author:i.author||a.creator||void 0,subject:i.subject||a.subject||void 0,creator:i.creator}),o?.encryption){let t=UI(o.encryption);e.setEncryption(t)}return e.build()}function HV(e,t){let n=e.sheets;if(!t||t.length===0)return n.filter(e=>e.state!==`hidden`&&e.state!==`veryHidden`);let r=[];for(let e of t)if(typeof e==`string`){let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());t&&r.push(t)}else if(typeof e==`number`){let t=n[e-1];t&&r.push(t)}return r}function UV(e,t){let n=t?.pageSetup,r=GV(e?.pageSize,n?.paperSize),i=t&&Qz(t)?t.orientation:void 0,a=e?.orientation??i??(n?.orientation===`landscape`?`landscape`:`portrait`),o=KV(e?.margins,n?.margins),s=HB(e?.gridLineColor??`FFD0D0D0`)??{r:.816,g:.816,b:.816},c=e?.repeatRows??!1;if(c===!1&&t&&!Qz(t)&&n?.printTitlesRow){let e=n.printTitlesRow.match(/^(\d+)(?::(\d+))?$/);e&&(c=parseInt(e[2]??e[1],10))}return{pageSize:r,orientation:a,margins:o,fitToPage:e?.fitToPage===void 0?!0:e.fitToPage,scale:Math.max(.1,Math.min(3,e?.scale??(e?.fitToPage===void 0||e.fitToPage?1:n?.scale?n.scale/100:1))),showGridLines:e?.showGridLines??n?.showGridLines??!1,gridLineColor:s,repeatRows:c,defaultFontFamily:e?.defaultFontFamily??`Helvetica`,defaultFontSize:e?.defaultFontSize??11,showSheetNames:e?.showSheetNames??!1,showPageNumbers:e?.showPageNumbers??!1,title:e?.title??``,author:e?.author??``,subject:e?.subject??``,creator:e?.creator??`excelts`,watermark:e?.watermark}}let WV={1:$z.LETTER,5:$z.LEGAL,9:$z.A4,8:$z.A3,11:$z.A5,17:$z.TABLOID};function GV(e,t){return e?typeof e==`string`?$z[e]??$z.A4:e:t===void 0?$z.A4:WV[t]??$z.A4}function KV(e,t){let n=t?{top:t.top*72,right:t.right*72,bottom:t.bottom*72,left:t.left*72}:{top:72,right:72,bottom:72,left:72};return e?{top:e.top??n.top,right:e.right??n.right,bottom:e.bottom??n.bottom,left:e.left??n.left}:n}function qV(e,t,n){let r=e.allocObject(),i=Array.from(t.entries()),a=[];for(let t=0;t<i.length;t++)a.push(e.allocObject());for(let t=0;t<i.length;t++){let[o,s]=i[t],c=n[s],l=new kI().set(`Title`,SI(o)).set(`Parent`,V(r)).set(`Dest`,`[${V(c)} /Fit]`);t>0&&l.set(`Prev`,V(a[t-1])),t<i.length-1&&l.set(`Next`,V(a[t+1])),e.addObject(a[t],l)}let o=new kI().set(`Type`,`/Outlines`).set(`First`,V(a[0])).set(`Last`,V(a[a.length-1])).set(`Count`,String(i.length));return e.addObject(r,o),r}function JV(e,t){if(e.pages&&e.pages.length>0&&!e.pages.includes(t.pageNumber))return!1;if(e.sheets&&e.sheets.length>0){let n=t.sheetName.toLowerCase();if(!e.sheets.some(e=>e.toLowerCase()===n))return!1}return!0}function YV(e){let t=new Set;for(let n of e)if(!Qz(n)){for(let e of n.rows.values())for(let n of e.cells.values())if(XV(n.text,t),n.type===Zz.RichText&&n.value&&typeof n.value==`object`&&`richText`in n.value){let e=n.value.richText;for(let n of e)XV(n.text,t)}}return t}function XV(e,t){if(e)for(let n=0;n<e.length;n++){let r=e.codePointAt(n);r>65535&&n++,QI(r)||t.add(r)}}function ZV(e){let{x:t,y:n,width:r,height:i}=e;if(r<=0||i<=0)return e;let a=r/i,o=2.5,s=16/9;if(a>=1&&a<=o)return e;let c=r,l=i;a>o?c=i*s:l=r/s;let u=(r-c)/2,d=(i-l)/2;return{x:t+u,y:n+d,width:c,height:l}}async function QV(e,t){return MV($V(e),t)}function $V(e){return Array.isArray(e)?{sheets:[eH({data:e})]}:`sheets`in e?{title:e.title,creator:e.author,sheets:e.sheets.map((e,t)=>eH(e,t))}:{sheets:[eH(e)]}}function eH(e,t){let n=e.data,r=e.name??`Sheet${(t??0)+1}`,i=e.columns?.map(e=>typeof e==`number`?void 0:e.header),a=i?.some(e=>e!==void 0)??!1,o=0;for(let e of n)e.length>o&&(o=e.length);let s=Math.max(o,e.columns?.length??0),c=n.length+ +!!a;if(e.images)for(let t of e.images){let e=t.col+1,n=t.row+1;e>s&&(s=e),n>c&&(c=n)}if(s===0)return{name:r,bounds:{top:0,left:0,bottom:0,right:0},columns:new Map,rows:new Map};let l=new Map;if(e.columns)for(let t=0;t<e.columns.length;t++){let n=e.columns[t],r=typeof n==`number`?n:n.width;l.set(t+1,{width:r??12})}for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});let u=new Map,d=1;if(a&&i){let e=new Map;for(let t=0;t<i.length;t++){let n=i[t];n!==void 0&&e.set(t+1,{type:Zz.String,value:n,text:n,col:t+1,style:{font:{bold:!0}}})}u.set(1,{cells:e}),d=2}for(let e=0;e<n.length;e++){let t=e+d,r=n[e],i=new Map;for(let e=0;e<r.length;e++){let t=tH(r[e],e+1);t&&i.set(e+1,t)}u.set(t,{cells:i})}let f;if(e.images&&e.images.length>0){f=e.images.map(e=>({data:e.data,format:e.format,range:{tl:{col:e.col,row:e.row},ext:{width:e.width,height:e.height}}}));for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});for(let e=1;e<=c;e++)u.has(e)||u.set(e,{cells:new Map})}return{name:r,bounds:{top:1,left:1,bottom:c,right:s},columns:l,rows:u,images:f}}function tH(e,t){if(e==null)return null;if(typeof e==`object`&&!(e instanceof Date)&&`value`in e){let n=e,r=tH(n.value,t);if(!r)return null;let i={};return(n.bold||n.italic||n.fontSize||n.fontColor)&&(i.font={bold:n.bold,italic:n.italic,size:n.fontSize,color:n.fontColor?{argb:n.fontColor}:void 0}),n.fillColor&&(i.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:n.fillColor}}),n.align&&(i.alignment={horizontal:n.align}),r.style=i,r}return typeof e==`string`?{type:Zz.String,value:e,text:e,col:t}:typeof e==`number`?{type:Zz.Number,value:e,text:String(e),col:t}:typeof e==`boolean`?{type:Zz.Boolean,value:e,text:e?`TRUE`:`FALSE`,col:t}:e instanceof Date?{type:Zz.Date,value:e,text:e.toLocaleDateString(),col:t}:null}zi(),yp(),rF(),Ff();async function nH(e,t){return tF(e),MV(await rH(e),t)}async function rH(e){let t=await Promise.all(e.worksheets.map(t=>iH(t,e))),n=await Promise.all(e.chartsheets.map(e=>OH(e))),r=[...t,...n];return r.sort((e,t)=>(e.orderNo??1/0)-(t.orderNo??1/0)),{title:e.title||void 0,creator:e.creator||void 0,subject:e.subject||void 0,sheets:r}}async function iH(e,t){let n=e.dimensions,r=n&&n.model.top>0&&n.model.left>0,i=r?{top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right}:{top:0,left:0,bottom:0,right:0};if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);n&&n.eachCell({includeEmpty:!0},e=>{e.col>i.right&&(e.style&&(e.style.border&&(e.style.border.top||e.style.border.right||e.style.border.bottom||e.style.border.left)||e.style.fill||e.style.font)||e.type!==0&&e.type!==1)&&(i.right=e.col)})}let a=new Map;if(r)for(let t=i.left;t<=i.right;t++){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}let o=new Map;if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);if(!n)continue;let r=new Map;n.eachCell({includeEmpty:!0},e=>{let t=e.type!==0&&e.type!==1,n=e.style&&(e.style.border&&(e.style.border.top||e.style.border.right||e.style.border.bottom||e.style.border.left)||e.style.fill||e.style.font);(t||n)&&r.set(e.col,aH(e))}),o.set(t,{hidden:n.hidden||void 0,height:n.height??void 0,customHeight:n.customHeight||void 0,cells:r})}let s=e.hasMerges&&e.model.mergeCells?[...e.model.mergeCells]:void 0,c=e.pageSetup,l=c?{orientation:c.orientation,paperSize:c.paperSize,margins:c.margins?{left:c.margins.left,right:c.margins.right,top:c.margins.top,bottom:c.margins.bottom}:void 0,scale:c.scale,printTitlesRow:c.printTitlesRow,showGridLines:c.showGridLines,printArea:c.printArea}:void 0,u=e.rowBreaks?.map(e=>e.id),d=e.colBreaks?.map(e=>e.id),f=_H(e,t),p=await vH(e),m=yH(e),h=p?m?[...p,...m]:p:m||void 0,g=[];if(f)for(let e of f)g.push(e.range);if(h)for(let e of h)g.push(e.range);if(g.length>0){for(let e of g){let t=e.tl,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;if(i.top===0&&i.left===0&&(i.top=1,i.left=1),n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r),e.br){let t=e.br,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r)}}for(let t=i.left;t<=i.right;t++)if(!a.has(t)){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}for(let e=i.top;e<=i.bottom;e++)o.has(e)||o.set(e,{cells:new Map})}return{kind:`worksheet`,name:e.name,state:e.state??`visible`,orderNo:e.orderNo,bounds:i,columns:a,rows:o,merges:s,pageSetup:l,rowBreaks:u,colBreaks:d,images:f,charts:h}}function aH(e){let t=oH(e.type),n=sH(e),r=uH(e.style);return{type:t,value:lH(e),text:n,style:r,hyperlink:e.hyperlink||void 0,result:e.result??void 0,col:e.col}}function oH(e){switch(e){case 0:return Zz.Empty;case 1:return Zz.Merge;case 2:return Zz.Number;case 3:case 7:return Zz.String;case 4:return Zz.Date;case 5:return Zz.Hyperlink;case 6:return Zz.Formula;case 8:return Zz.RichText;case 9:return Zz.Boolean;case 10:return Zz.Error;default:return Zz.String}}function sH(e){if(!e)return``;switch(e.type){case 0:case 1:return``;case 8:case 5:return e.text??``;case 10:return e.value?.error??e.text??``;case 6:{let t=e.result;return t==null?e.text??``:typeof t==`object`&&`error`in t?t.error:cH(t,e.style?.numFmt)}default:{let t=e.value;return t==null?``:cH(t,e.style?.numFmt)}}}function cH(e,t){let n=typeof t==`string`?t:t?.formatCode;if(n&&(typeof e==`number`||e instanceof Date||typeof e==`boolean`))try{return up(e,n)}catch{}return e instanceof Date?e.toLocaleDateString():String(e)}function lH(e){if(e.type===8){let t=e.value;if(t?.richText)return{richText:t.richText.map(e=>({text:e.text,font:e.font?dH(e.font):void 0}))}}return e.value}function uH(e){if(e)return{font:e.font?dH(e.font):void 0,numFmt:e.numFmt,fill:e.fill?pH(e.fill):void 0,border:e.border?hH(e.border):void 0,alignment:e.alignment?gH(e.alignment):void 0}}function dH(e){return{name:e.name,size:e.size,bold:e.bold,italic:e.italic,strike:e.strike,underline:e.underline,color:e.color?fH(e.color):void 0}}function fH(e){return{argb:e.argb,theme:e.theme,tint:e.tint,indexed:e.indexed}}function pH(e){let t={type:e.type??`pattern`,pattern:e.pattern,fgColor:e.fgColor?fH(e.fgColor):void 0};return e.stops&&(t.stops=e.stops.map(e=>({color:fH(e.color)}))),t}function mH(e){return{style:e.style,color:e.color?fH(e.color):void 0}}function hH(e){return{top:e.top?mH(e.top):void 0,right:e.right?mH(e.right):void 0,bottom:e.bottom?mH(e.bottom):void 0,left:e.left?mH(e.left):void 0}}function gH(e){return{horizontal:e.horizontal,vertical:e.vertical,wrapText:e.wrapText,indent:e.indent,textRotation:e.textRotation}}function _H(e,t){let n=e.getImages?.();if(!n||!Array.isArray(n)||n.length===0)return;let r=[];for(let e of n){if(!e.range?.tl)continue;let n=e.imageId,i=t.getImage?.(Number(n));if(!i)continue;let a;if(i.buffer instanceof Uint8Array?a=i.buffer:i.base64&&(a=sf(i.base64)),!a||a.length===0)continue;let o=i.extension;o!==`jpeg`&&o!==`png`||r.push({data:a,format:o,range:{tl:{col:e.range.tl.col??0,row:e.range.tl.row??0,nativeCol:e.range.tl.nativeCol,nativeRow:e.range.tl.nativeRow,nativeColOff:e.range.tl.nativeColOff,nativeRowOff:e.range.tl.nativeRowOff},br:e.range.br?{col:e.range.br.col??0,row:e.range.br.row??0,nativeCol:e.range.br.nativeCol,nativeRow:e.range.br.nativeRow,nativeColOff:e.range.br.nativeColOff,nativeRowOff:e.range.br.nativeRowOff}:void 0,ext:e.range.ext?{width:e.range.ext.width,height:e.range.ext.height}:void 0,extUnit:e.range.ext?`px`:void 0}})}return r.length>0?r:void 0}async function vH(e){let t=e.getCharts?.();if(!t||!Array.isArray(t)||t.length===0)return;let n=[];for(let r of t){let t=wH(r);if(!t)continue;let i=r.chartModel,a=r.chartExModel;if(i){n.push({range:t,drawVector:(e,t)=>{E().drawChartPdf(e,i,{x:t.x,y:t.y,width:t.width,height:t.height})}});continue}if(a){if(TH(a,e),E().canRenderChartExAsVectorPdf(a))n.push({range:t,drawVector:(e,t)=>{E().drawChartExPdf(e,a,{x:t.x,y:t.y,width:t.width,height:t.height})}});else{let{widthPx:e,heightPx:r}=EH(t),i=await E().renderChartExPng(a,{width:e,height:r,scale:2});n.push({range:t,raster:{data:i,format:`png`}})}continue}}return n.length>0?n:void 0}function yH(e){let t=e.getSparklineGroups?.();if(!t||t.length===0)return;let n=[];for(let r of t)for(let t of r.sparklines){let{dataRef:i,cellRef:a}=t;if(!a)continue;let o=a.match(/^([A-Z]+)(\d+)$/i);if(!o)continue;let s=bH(o[1]),c=parseInt(o[2],10),l=xH(e,i);if(l.length===0)continue;let u={tl:{col:s-1,row:c-1,nativeCol:s-1,nativeRow:c-1},br:{col:s,row:c,nativeCol:s,nativeRow:c}};n.push({range:u,drawVector:(e,t)=>{SH(e,r,l,t)}})}return n.length>0?n:void 0}function bH(e){let t=0;for(let n=0;n<e.length;n++)t=t*26+(e.charCodeAt(n)&31);return t}function xH(e,t){if(!t)return[];let n=t.lastIndexOf(`!`),r=n>=0?t.slice(n+1):t,i=e;if(n>=0){let r=t.slice(0,n);r.startsWith(`'`)&&r.endsWith(`'`)&&(r=r.slice(1,-1).replace(/''/g,`'`));let a=e.workbook?.getWorksheet?.(r);a&&(i=a)}let a=r.replace(/\$/g,``).split(`:`);if(a.length!==2)return[];let o=a[0].match(/^([A-Z]+)(\d+)$/i),s=a[1].match(/^([A-Z]+)(\d+)$/i);if(!o||!s)return[];let c=bH(o[1]),l=parseInt(o[2],10),u=bH(s[1]),d=parseInt(s[2],10),f=[];if(l===d)for(let e=c;e<=u;e++){let t=i.getCell(l,e),n=typeof t.value==`number`?t.value:t.result??NaN;f.push(typeof n==`number`?n:NaN)}else for(let e=l;e<=d;e++){let t=i.getCell(e,c),n=typeof t.value==`number`?t.value:t.result??NaN;f.push(typeof n==`number`?n:NaN)}return f}function SH(e,t,n,r){let{x:i,y:a,width:o,height:s}=r;if(o<=0||s<=0||n.length===0)return;let c=i+2,l=a+2,u=o-4,d=s-4;if(u<=0||d<=0)return;let f=n.filter(e=>Number.isFinite(e));if(f.length===0)return;let p=Math.min(...f),m=Math.max(...f);t.minAxisType===`custom`&&t.manualMin!==void 0&&(p=t.manualMin),t.maxAxisType===`custom`&&t.manualMax!==void 0&&(m=t.manualMax),p===m&&(--p,m+=1);let h=m-p,g=t.rightToLeft===!0,_=n.length,v=e=>{let t=_<=1?.5:e/(_-1);return c+(g?1-t:t)*u},y=e=>Number.isFinite(e)?l+(e-p)/h*d:l,b=CH(t.colorSeries)??{r:.22,g:.38,b:.57},x=CH(t.colorNegative)??{r:.82,g:0,b:0};if(t.type===`column`||t.type===`stacked`){let r=Math.max(1,u/Math.max(_,1)*.8);for(let i=0;i<_;i++){let a=n[i];if(!Number.isFinite(a)||a===0)continue;let o=v(i)-r/2,s=a<0&&t.negative===!0?x:b,c,u;if(t.type===`stacked`){let e=d/2;a>=0?(c=l+e,u=e):(c=l,u=e)}else{let e=p<=0&&m>=0?y(0):l,t=y(a);c=Math.min(e,t),u=Math.abs(t-e)}e.drawRect({x:o,y:c,width:r,height:Math.max(u,.5),fill:s})}}else{let r=[];for(let e=0;e<_;e++)Number.isFinite(n[e])&&r.push({px:v(e),py:y(n[e])});if(r.length>=2)for(let n=1;n<r.length;n++)e.drawLine({x1:r[n-1].px,y1:r[n-1].py,x2:r[n].px,y2:r[n].py,color:b,lineWidth:t.lineWeight?t.lineWeight*.75:.75});if(t.markers&&e.drawCircle){let n=CH(t.colorMarkers)??b;for(let t of r)e.drawCircle({cx:t.px,cy:t.py,r:1.2,fill:n})}}}function CH(e){if(e&&e.rgb){let t=e.rgb.replace(/^#/,``).replace(/^FF/i,``),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255;if(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i))return{r:n,g:r,b:i}}}function wH(e){let t=e.range;if(!t?.tl)return;let n=t.tl,r=t.br;return{tl:{col:n.col??0,row:n.row??0,nativeCol:n.nativeCol,nativeRow:n.nativeRow,nativeColOff:n.nativeColOff,nativeRowOff:n.nativeRowOff},br:r?{col:r.col??0,row:r.row??0,nativeCol:r.nativeCol,nativeRow:r.nativeRow,nativeColOff:r.nativeColOff,nativeRowOff:r.nativeRowOff}:void 0,ext:t.ext?{width:t.ext.cx,height:t.ext.cy}:void 0,extUnit:t.ext?`emu`:void 0}}function TH(e,t){let n=e.chartSpace?.chartData?.data;if(!n||!n.some(e=>{let t=e.strDim&&(!e.strDim.levels||e.strDim.levels.length===0),n=e.numDim&&(!e.numDim.levels||e.numDim.levels.length===0);return t||n}))return;let r=[];for(let e of n){let t=e.strDim;t?._skipCache&&(r.push(t),delete t._skipCache);let n=e.numDim;n?._skipCache&&(r.push(n),delete n._skipCache)}try{E().fillChartExCaches(e,t.workbook,t)}catch{}for(let e of r)e._skipCache=!0}function EH(e){if(e.ext&&e.extUnit===`emu`){let t=e.ext.width/9525,n=e.ext.height/9525;return{widthPx:Math.max(120,Math.round(96/72*t)),heightPx:Math.max(80,Math.round(96/72*n))}}return{widthPx:640,heightPx:420}}let DH={width:1280,height:720};async function OH(e){let t=e.chartModel,n=e.chartExModel,r={};if(t){let e=t;r={drawVector:(t,n)=>{E().drawChartPdf(t,e,{x:n.x,y:n.y,width:n.width,height:n.height})}}}else if(n)if(E().canRenderChartExAsVectorPdf(n)){let e=n;r={drawVector:(t,n)=>{E().drawChartExPdf(t,e,{x:n.x,y:n.y,width:n.width,height:n.height})}}}else r={raster:{data:await E().renderChartExPng(n,{width:DH.width,height:DH.height,scale:2}),format:`png`}};let i=e.pageSetup?.orientation,a=i===`portrait`||i===`landscape`?i:`landscape`,o=e.pageSetup,s=o?{orientation:o.orientation,paperSize:o.paperSize,showGridLines:!1}:void 0;return{kind:`chartsheet`,name:e.name,state:e.state,orderNo:e.model.orderNo,orientation:a,chart:r,pageSetup:s}}return xE(),Wp(),zd(),Vp(),fa(),Gw(),Py(),_T(),Vd(),Iy(),Uw(),fu(),Nw(),W_(),JS(),Kp(),Ii(),ka(),Ui(),yp(),za(),Ff(),of(),Tt(),u(),mr(),ca(),xF(),e.Anchor=Ny,e.BaseError=c,e.Cell=k,e.Chartsheet=Hi,e.Column=Rd,e.ColumnOutOfBoundsError=Ji,e.CsvFormatterStream=Pi,e.CsvParserStream=ji,e.DataValidations=Fy,e.DateFormatter=wt,e.DateParser=Ct,e.DefinedNames=Oa,e.DocumentType=cu,e.Enums=du,e.ErrorValue=uu,e.ExcelDownloadError=na,e.ExcelError=Gi,e.ExcelFileError=ea,e.ExcelNotSupportedError=$i,e.ExcelStreamStateError=ta,e.FormCheckbox=Hw,e.FormulaType=ou,e.Image=Ww,e.ImageError=oa,e.InvalidAddressError=qi,e.InvalidValueTypeError=Zi,e.MarkdownError=yF,e.MarkdownParseError=bF,e.MaxItemsExceededError=sa,e.MergeConflictError=Xi,e.Note=Bd,e.PageSizes=$z,e.PaperSize=lI,e.PdfError=eL,e.PdfFontError=nL,e.PdfRenderError=tL,e.PdfStructureError=rL,e.PivotTableError=ra,e.Range=da,e.ReadingOrder=lu,e.RelationshipType=su,e.Row=Up,e.RowOutOfBoundsError=Yi,e.Table=gT,e.TableError=aa,e.ValueType=au,e.Workbook=cI,e.WorkbookReader=U_,e.WorkbookWriter=Mw,e.Worksheet=bE,e.WorksheetNameError=Ki,e.WorksheetReader=Gp,e.WorksheetWriter=qS,e.XmlParseError=Qi,e.base64ToUint8Array=sf,e.concatUint8Arrays=nr,e.createCsvFormatterStream=Ni,e.createCsvParserStream=Ai,e.createTextWatermarkImage=uI,e.dateToExcel=cf,e.decodeCell=Pa,e.decodeCol=Aa,e.decodeRange=Ia,e.decodeRow=Ma,e.encodeCell=Fa,e.encodeCol=ja,e.encodeRange=La,e.encodeRow=Na,e.errorToJSON=a,e.excelToDate=lf,e.excelToPdf=nH,e.formatCellValue=up,e.getCellDisplayText=dp,e.getErrorChain=o,e.getRootCause=s,e.getSupportedFormats=ct,e.isDateDisplayFormat=lp,e.isExcelError=Wi,e.isPdfError=iL,e.pdf=QV,e.stringToUint8Array=er,e.toError=i,e.toUint8Array=rr,e.uint8ArrayToBase64=Cf,e.uint8ArrayToString=tr,e.validateXmlName=Jd,e.xmlDecode=Gd,e.xmlEncode=Kd,e.xmlEncodeAttr=qd,e})({});
463
+ `))}n.addObject(h,_);let v=[];for(let t of e.cells)if(t.hyperlink){let e=n.allocObject(),r=`[${B(t.rect.x)} ${B(t.rect.y)} ${B(t.rect.x+t.rect.width)} ${B(t.rect.y+t.rect.height)}]`,i=new kI().set(`Type`,`/Annot`).set(`Subtype`,`/Link`).set(`Rect`,r).set(`Border`,`[0 0 0]`).set(`A`,`<< /Type /Action /S /URI /URI (${t.hyperlink.replace(/[()\\]/g,`\\$&`)}) >>`);n.addObject(e,i),v.push(e)}let y=n.addPage({parentRef:o,width:e.width,height:e.height,contentsRef:m,resourcesRef:h,annotRefs:v.length>0?v:void 0});a.push(y),s.has(e.sheetName)||s.set(e.sheetName,a.length-1)}catch(t){throw new tL(`Failed to render page ${e.pageNumber} of "${e.sheetName}"`,{cause:t})}}function VV(e,t,n,r,i,a,o){let s=`[`+t.map(e=>V(e)).join(` `)+`]`,c=new kI().set(`Type`,`/Pages`).set(`Kids`,s).set(`Count`,String(t.length));e.addObject(n,c);let l;if(r.size>1&&(l=qV(e,r,t)),e.addCatalog(n,l),e.addInfoDict({title:i.title||a.title||void 0,author:i.author||a.creator||void 0,subject:i.subject||a.subject||void 0,creator:i.creator}),o?.encryption){let t=UI(o.encryption);e.setEncryption(t)}return e.build()}function HV(e,t){let n=e.sheets;if(!t||t.length===0)return n.filter(e=>e.state!==`hidden`&&e.state!==`veryHidden`);let r=[];for(let e of t)if(typeof e==`string`){let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());t&&r.push(t)}else if(typeof e==`number`){let t=n[e-1];t&&r.push(t)}return r}function UV(e,t){let n=t?.pageSetup,r=GV(e?.pageSize,n?.paperSize),i=t&&Qz(t)?t.orientation:void 0,a=e?.orientation??i??(n?.orientation===`landscape`?`landscape`:`portrait`),o=KV(e?.margins,n?.margins),s=HB(e?.gridLineColor??`FFD0D0D0`)??{r:.816,g:.816,b:.816},c=e?.repeatRows??!1;if(c===!1&&t&&!Qz(t)&&n?.printTitlesRow){let e=n.printTitlesRow.match(/^(\d+)(?::(\d+))?$/);e&&(c=parseInt(e[2]??e[1],10))}return{pageSize:r,orientation:a,margins:o,ignorePrintArea:e?.ignorePrintArea??!1,fitToPage:e?.fitToPage===void 0?!0:e.fitToPage,scale:Math.max(.1,Math.min(3,e?.scale??(e?.fitToPage===void 0||e.fitToPage?1:n?.scale?n.scale/100:1))),showGridLines:e?.showGridLines??n?.showGridLines??!1,gridLineColor:s,repeatRows:c,defaultFontFamily:e?.defaultFontFamily??`Helvetica`,defaultFontSize:e?.defaultFontSize??11,showSheetNames:e?.showSheetNames??!1,showPageNumbers:e?.showPageNumbers??!1,title:e?.title??``,author:e?.author??``,subject:e?.subject??``,creator:e?.creator??`excelts`,watermark:e?.watermark}}let WV={1:$z.LETTER,5:$z.LEGAL,9:$z.A4,8:$z.A3,11:$z.A5,17:$z.TABLOID};function GV(e,t){return e?typeof e==`string`?$z[e]??$z.A4:e:t===void 0?$z.A4:WV[t]??$z.A4}function KV(e,t){let n=t?{top:t.top*72,right:t.right*72,bottom:t.bottom*72,left:t.left*72}:{top:72,right:72,bottom:72,left:72};return e?{top:e.top??n.top,right:e.right??n.right,bottom:e.bottom??n.bottom,left:e.left??n.left}:n}function qV(e,t,n){let r=e.allocObject(),i=Array.from(t.entries()),a=[];for(let t=0;t<i.length;t++)a.push(e.allocObject());for(let t=0;t<i.length;t++){let[o,s]=i[t],c=n[s],l=new kI().set(`Title`,SI(o)).set(`Parent`,V(r)).set(`Dest`,`[${V(c)} /Fit]`);t>0&&l.set(`Prev`,V(a[t-1])),t<i.length-1&&l.set(`Next`,V(a[t+1])),e.addObject(a[t],l)}let o=new kI().set(`Type`,`/Outlines`).set(`First`,V(a[0])).set(`Last`,V(a[a.length-1])).set(`Count`,String(i.length));return e.addObject(r,o),r}function JV(e,t){if(e.pages&&e.pages.length>0&&!e.pages.includes(t.pageNumber))return!1;if(e.sheets&&e.sheets.length>0){let n=t.sheetName.toLowerCase();if(!e.sheets.some(e=>e.toLowerCase()===n))return!1}return!0}function YV(e){let t=new Set;for(let n of e)if(!Qz(n)){for(let e of n.rows.values())for(let n of e.cells.values())if(XV(n.text,t),n.type===Zz.RichText&&n.value&&typeof n.value==`object`&&`richText`in n.value){let e=n.value.richText;for(let n of e)XV(n.text,t)}}return t}function XV(e,t){if(e)for(let n=0;n<e.length;n++){let r=e.codePointAt(n);r>65535&&n++,QI(r)||t.add(r)}}function ZV(e){let{x:t,y:n,width:r,height:i}=e;if(r<=0||i<=0)return e;let a=r/i,o=2.5,s=16/9;if(a>=1&&a<=o)return e;let c=r,l=i;a>o?c=i*s:l=r/s;let u=(r-c)/2,d=(i-l)/2;return{x:t+u,y:n+d,width:c,height:l}}async function QV(e,t){return MV($V(e),t)}function $V(e){return Array.isArray(e)?{sheets:[eH({data:e})]}:`sheets`in e?{title:e.title,creator:e.author,sheets:e.sheets.map((e,t)=>eH(e,t))}:{sheets:[eH(e)]}}function eH(e,t){let n=e.data,r=e.name??`Sheet${(t??0)+1}`,i=e.columns?.map(e=>typeof e==`number`?void 0:e.header),a=i?.some(e=>e!==void 0)??!1,o=0;for(let e of n)e.length>o&&(o=e.length);let s=Math.max(o,e.columns?.length??0),c=n.length+ +!!a;if(e.images)for(let t of e.images){let e=t.col+1,n=t.row+1;e>s&&(s=e),n>c&&(c=n)}if(s===0)return{name:r,bounds:{top:0,left:0,bottom:0,right:0},columns:new Map,rows:new Map};let l=new Map;if(e.columns)for(let t=0;t<e.columns.length;t++){let n=e.columns[t],r=typeof n==`number`?n:n.width;l.set(t+1,{width:r??12})}for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});let u=new Map,d=1;if(a&&i){let e=new Map;for(let t=0;t<i.length;t++){let n=i[t];n!==void 0&&e.set(t+1,{type:Zz.String,value:n,text:n,col:t+1,style:{font:{bold:!0}}})}u.set(1,{cells:e}),d=2}for(let e=0;e<n.length;e++){let t=e+d,r=n[e],i=new Map;for(let e=0;e<r.length;e++){let t=tH(r[e],e+1);t&&i.set(e+1,t)}u.set(t,{cells:i})}let f;if(e.images&&e.images.length>0){f=e.images.map(e=>({data:e.data,format:e.format,range:{tl:{col:e.col,row:e.row},ext:{width:e.width,height:e.height}}}));for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});for(let e=1;e<=c;e++)u.has(e)||u.set(e,{cells:new Map})}return{name:r,bounds:{top:1,left:1,bottom:c,right:s},columns:l,rows:u,images:f}}function tH(e,t){if(e==null)return null;if(typeof e==`object`&&!(e instanceof Date)&&`value`in e){let n=e,r=tH(n.value,t);if(!r)return null;let i={};return(n.bold||n.italic||n.fontSize||n.fontColor)&&(i.font={bold:n.bold,italic:n.italic,size:n.fontSize,color:n.fontColor?{argb:n.fontColor}:void 0}),n.fillColor&&(i.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:n.fillColor}}),n.align&&(i.alignment={horizontal:n.align}),r.style=i,r}return typeof e==`string`?{type:Zz.String,value:e,text:e,col:t}:typeof e==`number`?{type:Zz.Number,value:e,text:String(e),col:t}:typeof e==`boolean`?{type:Zz.Boolean,value:e,text:e?`TRUE`:`FALSE`,col:t}:e instanceof Date?{type:Zz.Date,value:e,text:e.toLocaleDateString(),col:t}:null}zi(),yp(),rF(),Ff();async function nH(e,t){return tF(e),MV(await rH(e),t)}async function rH(e){let t=await Promise.all(e.worksheets.map(t=>iH(t,e))),n=await Promise.all(e.chartsheets.map(e=>OH(e))),r=[...t,...n];return r.sort((e,t)=>(e.orderNo??1/0)-(t.orderNo??1/0)),{title:e.title||void 0,creator:e.creator||void 0,subject:e.subject||void 0,sheets:r}}async function iH(e,t){let n=e.dimensions,r=n&&n.model.top>0&&n.model.left>0,i=r?{top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right}:{top:0,left:0,bottom:0,right:0};if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);n&&n.eachCell({includeEmpty:!0},e=>{e.col>i.right&&(e.style&&(e.style.border&&(e.style.border.top||e.style.border.right||e.style.border.bottom||e.style.border.left)||e.style.fill||e.style.font)||e.type!==0&&e.type!==1)&&(i.right=e.col)})}let a=new Map;if(r)for(let t=i.left;t<=i.right;t++){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}let o=new Map;if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);if(!n)continue;let r=new Map;n.eachCell({includeEmpty:!0},e=>{let t=e.type!==0&&e.type!==1,n=e.style&&(e.style.border&&(e.style.border.top||e.style.border.right||e.style.border.bottom||e.style.border.left)||e.style.fill||e.style.font);(t||n)&&r.set(e.col,aH(e))}),o.set(t,{hidden:n.hidden||void 0,height:n.height??void 0,customHeight:n.customHeight||void 0,cells:r})}let s=e.hasMerges&&e.model.mergeCells?[...e.model.mergeCells]:void 0,c=e.pageSetup,l=c?{orientation:c.orientation,paperSize:c.paperSize,margins:c.margins?{left:c.margins.left,right:c.margins.right,top:c.margins.top,bottom:c.margins.bottom}:void 0,scale:c.scale,printTitlesRow:c.printTitlesRow,showGridLines:c.showGridLines,printArea:c.printArea}:void 0,u=e.rowBreaks?.map(e=>e.id),d=e.colBreaks?.map(e=>e.id),f=_H(e,t),p=await vH(e),m=yH(e),h=p?m?[...p,...m]:p:m||void 0,g=[];if(f)for(let e of f)g.push(e.range);if(h)for(let e of h)g.push(e.range);if(g.length>0){for(let e of g){let t=e.tl,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;if(i.top===0&&i.left===0&&(i.top=1,i.left=1),n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r),e.br){let t=e.br,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r)}}for(let t=i.left;t<=i.right;t++)if(!a.has(t)){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}for(let e=i.top;e<=i.bottom;e++)o.has(e)||o.set(e,{cells:new Map})}return{kind:`worksheet`,name:e.name,state:e.state??`visible`,orderNo:e.orderNo,bounds:i,columns:a,rows:o,merges:s,pageSetup:l,rowBreaks:u,colBreaks:d,images:f,charts:h}}function aH(e){let t=oH(e.type),n=sH(e),r=uH(e.style);return{type:t,value:lH(e),text:n,style:r,hyperlink:e.hyperlink||void 0,result:e.result??void 0,col:e.col}}function oH(e){switch(e){case 0:return Zz.Empty;case 1:return Zz.Merge;case 2:return Zz.Number;case 3:case 7:return Zz.String;case 4:return Zz.Date;case 5:return Zz.Hyperlink;case 6:return Zz.Formula;case 8:return Zz.RichText;case 9:return Zz.Boolean;case 10:return Zz.Error;default:return Zz.String}}function sH(e){if(!e)return``;switch(e.type){case 0:case 1:return``;case 8:case 5:return e.text??``;case 10:return e.value?.error??e.text??``;case 6:{let t=e.result;return t==null?e.text??``:typeof t==`object`&&`error`in t?t.error:cH(t,e.style?.numFmt)}default:{let t=e.value;return t==null?``:cH(t,e.style?.numFmt)}}}function cH(e,t){let n=typeof t==`string`?t:t?.formatCode;if(n&&(typeof e==`number`||e instanceof Date||typeof e==`boolean`))try{return up(e,n)}catch{}return e instanceof Date?e.toLocaleDateString():String(e)}function lH(e){if(e.type===8){let t=e.value;if(t?.richText)return{richText:t.richText.map(e=>({text:e.text,font:e.font?dH(e.font):void 0}))}}return e.value}function uH(e){if(e)return{font:e.font?dH(e.font):void 0,numFmt:e.numFmt,fill:e.fill?pH(e.fill):void 0,border:e.border?hH(e.border):void 0,alignment:e.alignment?gH(e.alignment):void 0}}function dH(e){return{name:e.name,size:e.size,bold:e.bold,italic:e.italic,strike:e.strike,underline:e.underline,color:e.color?fH(e.color):void 0}}function fH(e){return{argb:e.argb,theme:e.theme,tint:e.tint,indexed:e.indexed}}function pH(e){let t={type:e.type??`pattern`,pattern:e.pattern,fgColor:e.fgColor?fH(e.fgColor):void 0};return e.stops&&(t.stops=e.stops.map(e=>({color:fH(e.color)}))),t}function mH(e){return{style:e.style,color:e.color?fH(e.color):void 0}}function hH(e){return{top:e.top?mH(e.top):void 0,right:e.right?mH(e.right):void 0,bottom:e.bottom?mH(e.bottom):void 0,left:e.left?mH(e.left):void 0}}function gH(e){return{horizontal:e.horizontal,vertical:e.vertical,wrapText:e.wrapText,indent:e.indent,textRotation:e.textRotation}}function _H(e,t){let n=e.getImages?.();if(!n||!Array.isArray(n)||n.length===0)return;let r=[];for(let e of n){if(!e.range?.tl)continue;let n=e.imageId,i=t.getImage?.(Number(n));if(!i)continue;let a;if(i.buffer instanceof Uint8Array?a=i.buffer:i.base64&&(a=sf(i.base64)),!a||a.length===0)continue;let o=i.extension;o!==`jpeg`&&o!==`png`||r.push({data:a,format:o,range:{tl:{col:e.range.tl.col??0,row:e.range.tl.row??0,nativeCol:e.range.tl.nativeCol,nativeRow:e.range.tl.nativeRow,nativeColOff:e.range.tl.nativeColOff,nativeRowOff:e.range.tl.nativeRowOff},br:e.range.br?{col:e.range.br.col??0,row:e.range.br.row??0,nativeCol:e.range.br.nativeCol,nativeRow:e.range.br.nativeRow,nativeColOff:e.range.br.nativeColOff,nativeRowOff:e.range.br.nativeRowOff}:void 0,ext:e.range.ext?{width:e.range.ext.width,height:e.range.ext.height}:void 0,extUnit:e.range.ext?`px`:void 0}})}return r.length>0?r:void 0}async function vH(e){let t=e.getCharts?.();if(!t||!Array.isArray(t)||t.length===0)return;let n=[];for(let r of t){let t=wH(r);if(!t)continue;let i=r.chartModel,a=r.chartExModel;if(i){n.push({range:t,drawVector:(e,t)=>{E().drawChartPdf(e,i,{x:t.x,y:t.y,width:t.width,height:t.height})}});continue}if(a){if(TH(a,e),E().canRenderChartExAsVectorPdf(a))n.push({range:t,drawVector:(e,t)=>{E().drawChartExPdf(e,a,{x:t.x,y:t.y,width:t.width,height:t.height})}});else{let{widthPx:e,heightPx:r}=EH(t),i=await E().renderChartExPng(a,{width:e,height:r,scale:2});n.push({range:t,raster:{data:i,format:`png`}})}continue}}return n.length>0?n:void 0}function yH(e){let t=e.getSparklineGroups?.();if(!t||t.length===0)return;let n=[];for(let r of t)for(let t of r.sparklines){let{dataRef:i,cellRef:a}=t;if(!a)continue;let o=a.match(/^([A-Z]+)(\d+)$/i);if(!o)continue;let s=bH(o[1]),c=parseInt(o[2],10),l=xH(e,i);if(l.length===0)continue;let u={tl:{col:s-1,row:c-1,nativeCol:s-1,nativeRow:c-1},br:{col:s,row:c,nativeCol:s,nativeRow:c}};n.push({range:u,drawVector:(e,t)=>{SH(e,r,l,t)}})}return n.length>0?n:void 0}function bH(e){let t=0;for(let n=0;n<e.length;n++)t=t*26+(e.charCodeAt(n)&31);return t}function xH(e,t){if(!t)return[];let n=t.lastIndexOf(`!`),r=n>=0?t.slice(n+1):t,i=e;if(n>=0){let r=t.slice(0,n);r.startsWith(`'`)&&r.endsWith(`'`)&&(r=r.slice(1,-1).replace(/''/g,`'`));let a=e.workbook?.getWorksheet?.(r);a&&(i=a)}let a=r.replace(/\$/g,``).split(`:`);if(a.length!==2)return[];let o=a[0].match(/^([A-Z]+)(\d+)$/i),s=a[1].match(/^([A-Z]+)(\d+)$/i);if(!o||!s)return[];let c=bH(o[1]),l=parseInt(o[2],10),u=bH(s[1]),d=parseInt(s[2],10),f=[];if(l===d)for(let e=c;e<=u;e++){let t=i.getCell(l,e),n=typeof t.value==`number`?t.value:t.result??NaN;f.push(typeof n==`number`?n:NaN)}else for(let e=l;e<=d;e++){let t=i.getCell(e,c),n=typeof t.value==`number`?t.value:t.result??NaN;f.push(typeof n==`number`?n:NaN)}return f}function SH(e,t,n,r){let{x:i,y:a,width:o,height:s}=r;if(o<=0||s<=0||n.length===0)return;let c=i+2,l=a+2,u=o-4,d=s-4;if(u<=0||d<=0)return;let f=n.filter(e=>Number.isFinite(e));if(f.length===0)return;let p=Math.min(...f),m=Math.max(...f);t.minAxisType===`custom`&&t.manualMin!==void 0&&(p=t.manualMin),t.maxAxisType===`custom`&&t.manualMax!==void 0&&(m=t.manualMax),p===m&&(--p,m+=1);let h=m-p,g=t.rightToLeft===!0,_=n.length,v=e=>{let t=_<=1?.5:e/(_-1);return c+(g?1-t:t)*u},y=e=>Number.isFinite(e)?l+(e-p)/h*d:l,b=CH(t.colorSeries)??{r:.22,g:.38,b:.57},x=CH(t.colorNegative)??{r:.82,g:0,b:0};if(t.type===`column`||t.type===`stacked`){let r=Math.max(1,u/Math.max(_,1)*.8);for(let i=0;i<_;i++){let a=n[i];if(!Number.isFinite(a)||a===0)continue;let o=v(i)-r/2,s=a<0&&t.negative===!0?x:b,c,u;if(t.type===`stacked`){let e=d/2;a>=0?(c=l+e,u=e):(c=l,u=e)}else{let e=p<=0&&m>=0?y(0):l,t=y(a);c=Math.min(e,t),u=Math.abs(t-e)}e.drawRect({x:o,y:c,width:r,height:Math.max(u,.5),fill:s})}}else{let r=[];for(let e=0;e<_;e++)Number.isFinite(n[e])&&r.push({px:v(e),py:y(n[e])});if(r.length>=2)for(let n=1;n<r.length;n++)e.drawLine({x1:r[n-1].px,y1:r[n-1].py,x2:r[n].px,y2:r[n].py,color:b,lineWidth:t.lineWeight?t.lineWeight*.75:.75});if(t.markers&&e.drawCircle){let n=CH(t.colorMarkers)??b;for(let t of r)e.drawCircle({cx:t.px,cy:t.py,r:1.2,fill:n})}}}function CH(e){if(e&&e.rgb){let t=e.rgb.replace(/^#/,``).replace(/^FF/i,``),n=parseInt(t.slice(0,2),16)/255,r=parseInt(t.slice(2,4),16)/255,i=parseInt(t.slice(4,6),16)/255;if(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i))return{r:n,g:r,b:i}}}function wH(e){let t=e.range;if(!t?.tl)return;let n=t.tl,r=t.br;return{tl:{col:n.col??0,row:n.row??0,nativeCol:n.nativeCol,nativeRow:n.nativeRow,nativeColOff:n.nativeColOff,nativeRowOff:n.nativeRowOff},br:r?{col:r.col??0,row:r.row??0,nativeCol:r.nativeCol,nativeRow:r.nativeRow,nativeColOff:r.nativeColOff,nativeRowOff:r.nativeRowOff}:void 0,ext:t.ext?{width:t.ext.cx,height:t.ext.cy}:void 0,extUnit:t.ext?`emu`:void 0}}function TH(e,t){let n=e.chartSpace?.chartData?.data;if(!n||!n.some(e=>{let t=e.strDim&&(!e.strDim.levels||e.strDim.levels.length===0),n=e.numDim&&(!e.numDim.levels||e.numDim.levels.length===0);return t||n}))return;let r=[];for(let e of n){let t=e.strDim;t?._skipCache&&(r.push(t),delete t._skipCache);let n=e.numDim;n?._skipCache&&(r.push(n),delete n._skipCache)}try{E().fillChartExCaches(e,t.workbook,t)}catch{}for(let e of r)e._skipCache=!0}function EH(e){if(e.ext&&e.extUnit===`emu`){let t=e.ext.width/9525,n=e.ext.height/9525;return{widthPx:Math.max(120,Math.round(96/72*t)),heightPx:Math.max(80,Math.round(96/72*n))}}return{widthPx:640,heightPx:420}}let DH={width:1280,height:720};async function OH(e){let t=e.chartModel,n=e.chartExModel,r={};if(t){let e=t;r={drawVector:(t,n)=>{E().drawChartPdf(t,e,{x:n.x,y:n.y,width:n.width,height:n.height})}}}else if(n)if(E().canRenderChartExAsVectorPdf(n)){let e=n;r={drawVector:(t,n)=>{E().drawChartExPdf(t,e,{x:n.x,y:n.y,width:n.width,height:n.height})}}}else r={raster:{data:await E().renderChartExPng(n,{width:DH.width,height:DH.height,scale:2}),format:`png`}};let i=e.pageSetup?.orientation,a=i===`portrait`||i===`landscape`?i:`landscape`,o=e.pageSetup,s=o?{orientation:o.orientation,paperSize:o.paperSize,showGridLines:!1}:void 0;return{kind:`chartsheet`,name:e.name,state:e.state,orderNo:e.model.orderNo,orientation:a,chart:r,pageSetup:s}}return xE(),Wp(),zd(),Vp(),fa(),Gw(),Py(),_T(),Vd(),Iy(),Uw(),fu(),Nw(),W_(),JS(),Kp(),Ii(),ka(),Ui(),yp(),za(),Ff(),of(),Tt(),u(),mr(),ca(),xF(),e.Anchor=Ny,e.BaseError=c,e.Cell=k,e.Chartsheet=Hi,e.Column=Rd,e.ColumnOutOfBoundsError=Ji,e.CsvFormatterStream=Pi,e.CsvParserStream=ji,e.DataValidations=Fy,e.DateFormatter=wt,e.DateParser=Ct,e.DefinedNames=Oa,e.DocumentType=cu,e.Enums=du,e.ErrorValue=uu,e.ExcelDownloadError=na,e.ExcelError=Gi,e.ExcelFileError=ea,e.ExcelNotSupportedError=$i,e.ExcelStreamStateError=ta,e.FormCheckbox=Hw,e.FormulaType=ou,e.Image=Ww,e.ImageError=oa,e.InvalidAddressError=qi,e.InvalidValueTypeError=Zi,e.MarkdownError=yF,e.MarkdownParseError=bF,e.MaxItemsExceededError=sa,e.MergeConflictError=Xi,e.Note=Bd,e.PageSizes=$z,e.PaperSize=lI,e.PdfError=eL,e.PdfFontError=nL,e.PdfRenderError=tL,e.PdfStructureError=rL,e.PivotTableError=ra,e.Range=da,e.ReadingOrder=lu,e.RelationshipType=su,e.Row=Up,e.RowOutOfBoundsError=Yi,e.Table=gT,e.TableError=aa,e.ValueType=au,e.Workbook=cI,e.WorkbookReader=U_,e.WorkbookWriter=Mw,e.Worksheet=bE,e.WorksheetNameError=Ki,e.WorksheetReader=Gp,e.WorksheetWriter=qS,e.XmlParseError=Qi,e.base64ToUint8Array=sf,e.concatUint8Arrays=nr,e.createCsvFormatterStream=Ni,e.createCsvParserStream=Ai,e.createTextWatermarkImage=uI,e.dateToExcel=cf,e.decodeCell=Pa,e.decodeCol=Aa,e.decodeRange=Ia,e.decodeRow=Ma,e.encodeCell=Fa,e.encodeCol=ja,e.encodeRange=La,e.encodeRow=Na,e.errorToJSON=a,e.excelToDate=lf,e.excelToPdf=nH,e.formatCellValue=up,e.getCellDisplayText=dp,e.getErrorChain=o,e.getRootCause=s,e.getSupportedFormats=ct,e.isDateDisplayFormat=lp,e.isExcelError=Wi,e.isPdfError=iL,e.pdf=QV,e.stringToUint8Array=er,e.toError=i,e.toUint8Array=rr,e.uint8ArrayToBase64=Cf,e.uint8ArrayToString=tr,e.validateXmlName=Jd,e.xmlDecode=Gd,e.xmlEncode=Kd,e.xmlEncodeAttr=qd,e})({});
@@ -411,6 +411,14 @@ export interface PdfExportOptions {
411
411
  * If omitted, all visible sheets are included.
412
412
  */
413
413
  sheets?: (string | number)[];
414
+ /**
415
+ * Whether to ignore each worksheet's print area when exporting.
416
+ * When true, the entire used range of every sheet is exported, regardless
417
+ * of any `pageSetup.printArea` defined on the worksheet. The workbook itself
418
+ * is left unmodified.
419
+ * @default false
420
+ */
421
+ ignorePrintArea?: boolean;
414
422
  /**
415
423
  * Whether to auto-fit column widths to page width.
416
424
  * When true, columns are scaled proportionally to fit the page.
@@ -770,6 +778,7 @@ export interface ResolvedPdfOptions {
770
778
  pageSize: PdfPageSize;
771
779
  orientation: PdfOrientation;
772
780
  margins: PdfMargins;
781
+ ignorePrintArea: boolean;
773
782
  fitToPage: boolean;
774
783
  scale: number;
775
784
  showGridLines: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cj-tech-master/excelts",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.",
5
5
  "keywords": [
6
6
  "archive",