@sheetxl/io-xlsx 0.8.0-beta.7 → 0.8.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/B0Ugu_crqQYpdfQz.cjs +1 -0
- package/browser/cjs/{CDs8etXnw0kbBKKv.cjs → BHM3_D9PsNURVAVy.cjs} +1 -1
- package/browser/cjs/BHWdwAQ322YA8JAZ.cjs +6 -0
- package/browser/cjs/CeuX8p1aBuKTuagi.cjs +2 -0
- package/browser/cjs/DSM4q1dhVVXvsgby.cjs +30 -0
- package/browser/cjs/DiAHwNv2I8RHE9GY.cjs +1 -0
- package/browser/cjs/index.cjs +1 -1
- package/browser/cjs/wrpXlaSBGEicQf6_.cjs +6 -0
- package/browser/esm/{BsNoW41d6hdpxTTS.mjs → Bu64BYvRAlVftMr1.mjs} +4 -4
- package/browser/esm/{CX3yVwe-BnhCk4FY.mjs → C-2KaUyV4gs-sDTZ.mjs} +2 -2
- package/browser/esm/{DUi-V-E_AJwTIqlO.mjs → CRrTMRdN_IcSA_pm.mjs} +2 -2
- package/browser/esm/{CjKioy-GzeSf08f8.mjs → CWt4fDYEbj2hvsl_.mjs} +820 -800
- package/browser/esm/{dsVZVtt5w_yLb967.mjs → Ccnxz-y2WBEgfvvh.mjs} +2606 -1408
- package/browser/esm/{B4eKxNwxJjHLN126.mjs → CxtFawTfwRTCC4Xr.mjs} +1 -1
- package/browser/esm/{CGXxwkCRWLc0gcRQ.mjs → D-epcZSoKLbsAIaC.mjs} +2 -2
- package/browser/esm/DsSIg46AR7IFBN5N.mjs +2298 -0
- package/browser/esm/{cJxidonaVNZHAXiZ.mjs → Dx64JMAGwNNDBkC1.mjs} +1555 -1159
- package/browser/esm/Sv4twwEJDb9dZ91h.mjs +149 -0
- package/browser/esm/index.mjs +2 -2
- package/node/esm/{CMq7eF1vxibUumqT.mjs → BCr4lCI6qQXXN0K1.mjs} +2 -2
- package/node/esm/BPn5XBizKkwaUqXB.mjs +4285 -0
- package/node/esm/{BRQYaMYO4UfhjJHw.mjs → BVV11IlqF6Lmlv8D.mjs} +53 -69
- package/node/esm/{s_yVG0m9KB14YKeN.mjs → BiJEEgltJzx94zIR.mjs} +930 -909
- package/node/esm/{C51yFT2l-6il_xXO.mjs → BsTMtvwpQoPNv95M.mjs} +1 -1
- package/node/esm/{DLBm8l0jyL2fVlxg.mjs → CBtj0-a4l2qux2hA.mjs} +2 -2
- package/node/esm/CkmZuMvRTpva7eQu.mjs +5074 -0
- package/node/esm/index.mjs +4 -4
- package/node/esm/j0RE2usgdljRw_gr.mjs +2345 -0
- package/package.json +3 -3
- package/types/src/AutoFilterRules.d.ts +83 -10
- package/types/src/OOXMLExtensions.d.ts +6 -0
- package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
- package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +13 -0
- package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +7 -1
- package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
- package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +23 -1
- package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +9 -0
- package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +20 -1
- package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
- package/types/src/reader/domVisitors/DrawingVisitor.d.ts +8 -0
- package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
- package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
- package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
- package/types/src/reader/domVisitors/index.d.ts +4 -2
- package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +1 -1
- package/types/src/utils/DrawingMLText.d.ts +39 -0
- package/types/src/utils/FormControls.d.ts +97 -0
- package/types/src/writer/builder/Emitter.d.ts +5 -0
- package/types/src/writer/builder/PackageBuilder.d.ts +2 -0
- package/types/src/writer/builder/Types.d.ts +10 -0
- package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
- package/types/src/writer/utils/DrawMLUtils.d.ts +39 -2
- package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
- package/types/src/writer/utils/TextUtils.d.ts +21 -2
- package/browser/cjs/17tMBnuyu4YIxixh.cjs +0 -1
- package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
- package/browser/cjs/BxU-OlZIQViQl7gX.cjs +0 -1
- package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
- package/browser/cjs/CycnxkfuKrDdwoJN.cjs +0 -5
- package/browser/cjs/DHKWtqZ0vQfXrbq1.cjs +0 -2
- package/browser/cjs/MqKQ_B5qRARrRbO4.cjs +0 -24
- package/browser/esm/9n64lXAgZUe3aThr.mjs +0 -159
- package/browser/esm/BvAptAMpZVyBCx6-.mjs +0 -2402
- package/browser/esm/DwcLXqv8-6Tl1zLO.mjs +0 -24
- package/node/esm/BlbtH3EvAf3K4foF.mjs +0 -2450
- package/node/esm/DhSPOg9wN0kD87Tb.mjs +0 -3051
- package/node/esm/KeV-N47eTyh5YE70.mjs +0 -4642
- package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./DSM4q1dhVVXvsgby.cjs"),t=require("./DiAHwNv2I8RHE9GY.cjs");let n=require("@sheetxl/utils"),r=require("@sheetxl/sdk");var i=new Uint8Array,a=class t{constructor(e,t,n){this.buffers=new Map,this.zip=e,this.entries=t,this.rawBuffer=n}static normalize(e){return e.startsWith(`/`)?e.slice(1):e}static async create(n){let r=n instanceof Blob?i:n instanceof Uint8Array?n:new Uint8Array(n),a=new e.Pt(n instanceof Blob?new e.Ft(n):new e.Rt(r)),o=new Map;for(let e of await a.getEntries())e.directory||o.set(e.filename,e);return new t(a,o,r)}getNames(){return[...this.entries.keys()]}has(e){return this.entries.has(t.normalize(e))}uncompressedSize(e){return this.entries.get(t.normalize(e))?.uncompressedSize??0}async getBuffer(n){let r=t.normalize(n),i=this.buffers.get(r);if(i)return i;let a=this.entries.get(r);if(!a)return null;let o=await a.getData(new e.zt);return this.buffers.set(r,o),o}async prefetch(t){let n=[];for(let[r,i]of this.entries)!this.buffers.has(r)&&t(r,i)&&n.push(i.getData(new e.zt).then(e=>{this.buffers.set(r,e)}));await Promise.all(n)}getEntry(e){return this.buffers.get(t.normalize(e))??null}async getTextStream(e,n){let r=this.entries.get(t.normalize(e));if(!r)return null;let i=new TransformStream;r.getData(i.writable).catch(()=>{});let a=i.readable.getReader(),o=new TextDecoder(`utf-8`);return new ReadableStream({async pull(e){let{value:t,done:r}=await a.read();if(r){let t=o.decode();t&&e.enqueue(t),e.close();return}n?.(t.byteLength);let i=o.decode(t,{stream:!0});i&&e.enqueue(i)}}).getReader()}getRawEntry(e){let n=this.entries.get(t.normalize(e));if(!n||n.encrypted)return null;let r=n.offset;if(r+30>this.rawBuffer.byteLength)return null;let i=new DataView(this.rawBuffer.buffer,this.rawBuffer.byteOffset+r,30);if(i.getUint32(0,!0)!==67324752)return null;let a=r+30+i.getUint16(26,!0)+i.getUint16(28,!0),o=a+n.compressedSize;return o>this.rawBuffer.byteLength?null:{data:this.rawBuffer.subarray(a,o),compressionMethod:n.compressionMethod,signature:n.signature}}async close(){await this.zip.close()}},o=class{constructor(e){this._sink=e,this._samples=[],this._t0=s(),this._tPrev=this._t0,this._heapPrev=c()}mark(e){let t=s(),n=c(),r={label:e,tMs:t-this._t0,dtMs:t-this._tPrev,heapBytes:n,dHeapBytes:n!==void 0&&this._heapPrev!==void 0?n-this._heapPrev:void 0,rssBytes:l()};this._tPrev=t,this._heapPrev=n,this._samples.push(r),this._sink?.(r)}samples(){return this._samples}toTable(){return this._samples.map(e=>({phase:e.label,tMs:Math.round(e.tMs),dtMs:Math.round(e.dtMs),heapMB:e.heapBytes===void 0?`—`:u(e.heapBytes/1048576),dHeapMB:e.dHeapBytes===void 0?`—`:u(e.dHeapBytes/1048576),rssMB:e.rssBytes===void 0?`—`:u(e.rssBytes/1048576)}))}},s=typeof performance==`object`&&typeof performance.now==`function`?()=>performance.now():()=>Date.now();function c(){let e=typeof performance==`object`?performance.memory:void 0;if(e&&typeof e.usedJSHeapSize==`number`)return e.usedJSHeapSize;let t=globalThis.process;return typeof t==`object`&&typeof t.memoryUsage==`function`?t.memoryUsage().heapUsed:void 0}function l(){let e=globalThis.process;if(typeof e==`object`&&typeof e.memoryUsage==`function`)return e.memoryUsage().rss}function u(e){return Math.round(10*e)/10}var d=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,f=`-${d}.0-9·̀-ͯ‿-⁀`,p=(RegExp(`^[${d}]$`,`u`),RegExp(`^[${f}]$`,`u`),RegExp(`^[${d}][${f}]*$`,`u`)),m=(RegExp(`^[${f}]+$`,`u`),[32,10,13,9]);function h(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}var g=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,_=`-${g}.0-9·̀-ͯ‿-⁀`;RegExp(`^[${g}]$`,`u`),RegExp(`^[${_}]$`,`u`),RegExp(`^[${g}][${_}]*$`,`u`),RegExp(`^[${_}]+$`,`u`);var v=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,y=`-${v}.0-9·̀-ͯ‿-⁀`,b=(RegExp(`^[${v}]$`,`u`),RegExp(`^[${y}]$`,`u`),RegExp(`^[${v}][${y}]*$`,`u`));function x(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}var S=function(e){return e===32||e===10||e===13||e===9},ee=function(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111},C=h,w=function(e){return h(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256},T=m,te=p,E=function(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},D=x,O=function(e){return x(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256},k=b,A=`http://www.w3.org/XML/1998/namespace`,j=`http://www.w3.org/2000/xmlns/`,ne={__proto__:null,xml:A,xmlns:j},re={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},M=-1,N=-2,P=13,F=33,I=10,L=60,R=61,z=62,B=63,V=93,ie=e=>e===34||e===39,H=[34,39],U=[...H,91,z],ae=[...H,L,V],oe=[R,B,...T],se=[...T,z,38,L];function ce(e,t,n){switch(t){case`xml`:n!==A&&e.fail(`xml prefix must be bound to ${A}.`);break;case`xmlns`:n!==j&&e.fail(`xmlns prefix must be bound to ${j}.`)}switch(n){case j:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI ${j}.`);break;case A:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}}}var W,le=e=>k.test(e),ue=e=>te.test(e),de={xmldecl:`xmlDeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`},fe=class{get closed(){return this._closed}constructor(e){this.i=0,this.prevI=0,this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,t){this.nameStartCheck=D,this.nameCheck=O,this.isName=le,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns={__proto__:null,...ne};let e=this.opt.additionalNamespaces;e!=null&&(function(e,t){for(let n of Object.keys(t))ce(e,n,t[n])}(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=C,this.nameCheck=w,this.isName=ue,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];let{fragmentOpt:e}=this;this.state=e?P:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:t}=this.opt;if(t===void 0){if(!0===this.opt.forceXMLVersion)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);t=`1.0`}this.setXMLVersion(t),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(re),this.readyHandler?.()}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[de[e]]=t}off(e){this[de[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===13||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let e=this.chunk,t=this.i;if(this.prevI=t,this.i++,t>=e.length)return M;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=32||n===9)return n;switch(n){case I:return this.line++,this.column=0,this.positionAtNewLine=this.position,I;case 13:return e.charCodeAt(t+1)===I&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,N;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+1024*(n-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return M;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==8232||n===9)return n;switch(n){case I:return this.line++,this.column=0,this.positionAtNewLine=this.position,I;case 13:{let n=e.charCodeAt(t+1);n!==I&&n!==133||(this.i=t+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,N;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+1024*(n-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===N?I:e}unGet(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===N,a=i?I:r;if(a===M||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case N:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=I;break;case M:return this.text+=n.slice(t),!1}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===M)return this.name+=e.slice(t),M;if(!w(n))return this.name+=e.slice(t,this.prevI),n===N?I:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===M||!S(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=ee,this.getCode=this.getCode10):(this.isChar=E,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case L:if(this.state=15,this.text.length!==0)throw Error(`no-empty text at start`);break;case M:break;default:this.unGet(),this.state=P,this.xmlDeclPossible=!1}}sDoctype(){let e=this.captureTo(U);switch(e){case z:this.doctypeHandler?.(this.text),this.text=``,this.state=P,this.doctype=!0;break;case M:break;default:this.text+=String.fromCodePoint(e),e===91?this.state=4:ie(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){let e=this.captureTo(ae);e!==M&&(this.text+=String.fromCodePoint(e),e===V?this.state=2:e===L?this.state=6:ie(e)&&(this.state=5,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang=``;break;case B:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?8:4,this.openWakaBang=``)}sDTDComment(){this.captureToChar(45)&&(this.text+=`-`,this.state=9)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===45?10:8}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===z?this.state=4:(this.fail(`malformed comment.`),this.state=8)}sDTDPI(){this.captureToChar(B)&&(this.text+=`?`,this.state=12)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===z&&(this.state=4)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;t:for(;;)switch(this.getCode()){case N:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI),i;this.state=n,r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),n===P&&this.textHandler===void 0||(this.text+=i);break t}case M:this.entity+=t.slice(e);break t}}sOpenWaka(){let e=this.getCode();if(C(e))this.state=34,this.unGet(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case B:this.state=23;break;default:this.fail(`disallowed character in tag name`),this.state=P,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:this.sawRoot||this.reportedTextBeforeRoot||(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang=``;break;case`--`:this.state=17,this.openWakaBang=``;break;case`DOCTYPE`:this.state=2,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){let e=this.getCodeNorm();e===45?(this.state=19,this.commentHandler?.(this.text),this.text=``):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){let e=this.getCodeNorm();e===z?this.state=P:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=17)}sCData(){this.captureToChar(V)&&(this.state=21)}sCDataEnding(){let e=this.getCodeNorm();e===V?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){let e=this.getCodeNorm();switch(e){case z:this.cdataHandler?.(this.text),this.text=``,this.state=P;break;case V:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===B||S(e)?(this.fail(`processing instruction without a target.`),this.state=e===B?26:25):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===M)return void(this.piTarget+=e.slice(t));if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===B;r||S(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?F:27):this.state=r?26:25:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===B?this.state=26:S(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(B)&&(this.state=26)}sPIEnding(){let e=this.getCodeNorm();if(e===z){let{piTarget:e}=this;e.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),this.piHandler?.({target:e,body:this.text}),this.piTarget=this.text=``,this.state=P}else e===B?this.text+=`?`:(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();e===B?this.state=F:e!==M&&(this.state=28,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(oe);if(e===B)return this.state=F,this.name+=this.text,this.text=``,void this.fail(`XML declaration is incomplete.`);if(S(e)||e===R){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===R?30:29}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===B)return this.state=F,void this.fail(`XML declaration is incomplete.`);S(e)||(e!==R&&this.fail(`value required.`),this.state=30)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===B)return this.state=F,void this.fail(`XML declaration is incomplete.`);S(e)||(ie(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=32),this.state=31)}sXMLDeclValue(){let e=this.captureTo([this.q,B]);if(e===B)return this.state=F,this.text=``,void this.fail(`XML declaration is incomplete.`);if(e===M)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t}this.name=``,this.state=32}sXMLDeclSeparator(){let e=this.getCodeNorm();e===B?this.state=F:(S(e)||(this.fail(`whitespace required.`),this.unGet()),this.state=27)}sXMLDeclEnding(){this.getCodeNorm()===z?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),this.xmlDeclHandler?.(this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=P):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){let e=this.captureNameChars();if(e===M)return;let t=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=t.ns=Object.create(null)),this.openTagStartHandler?.(t),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),e){case z:this.openTag();break;case 47:this.state=35;break;default:S(e)||this.fail(`disallowed character in tag name.`),this.state=36}}sOpenTagSlash(){this.getCode()===z?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=36)}sAttrib(){let e=this.skipSpaces();e!==M&&(C(e)?(this.unGet(),this.state=37):e===z?this.openTag():e===47?this.state=35:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===R?this.state=39:S(e)?this.state=38:e===z?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==M&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case M:return;case R:this.state=39;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===z?this.openTag():C(e)?(this.unGet(),this.state=37):(this.fail(`disallowed character in attribute name.`),this.state=36)}}sAttribValue(){let e=this.getCodeNorm();ie(e)?(this.q=e,this.state=40):S(e)||(this.fail(`unquoted attribute value.`),this.state=42,this.unGet())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=41;return;case 38:this.text+=t.slice(n,this.prevI),this.state=14,this.entityReturnState=40;return;case I:case N:case 9:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case L:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case M:this.text+=t.slice(n);return}}sAttribValueClosed(){let e=this.getCodeNorm();S(e)?this.state=36:e===z?this.openTag():e===47?this.state=35:C(e)?(this.fail(`no whitespace between attributes.`),this.unGet(),this.state=37):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(se);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case L:this.fail(`disallowed character.`);break;case M:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===z?this.openTag():this.state=36}}sCloseTag(){let e=this.captureNameChars();e===z?this.closeTag():S(e)?this.state=44:e!==M&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case z:this.closeTag();break;case M:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;t:for(;;)switch(this.getCode()){case L:if(this.state=15,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=0;break t;case 38:this.state=14,this.entityReturnState=P,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=0;break t;case V:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw Error(`impossible state`)}break;case z:t===2&&this.fail(`the string "]]>" is disallowed in char data.`),t=0;break;case N:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case M:r!==void 0&&(this.text+=n.slice(e));break t;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;t:for(;;){let i=this.getCode();switch(i){case L:if(this.state=15,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break t;case 38:this.state=14,this.entityReturnState=P,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break t;case N:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case M:n!==void 0&&(this.text+=t.slice(e));break t;default:S(i)||(r=!0)}}r&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){let{prefix:n,local:r}=this.qName(e),i={name:e,prefix:n,local:r,value:t};if(this.attribList.push(i),this.attributeHandler?.(i),n===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[r]=e,ce(this,r,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,ce(this,``,e)}}pushAttribPlain(e,t){let n={name:e,value:t};this.attribList.push(n),this.attributeHandler?.(n)}end(){this.sawRoot||this.fail(`document must contain a root element.`);let{tags:e}=this;for(;e.length>0;){let t=e.pop();this.fail(`unclosed tag: ${t.name}`)}this.state!==0&&this.state!==P&&this.fail(`unexpected end.`);let{text:t}=this;return t.length!==0&&(this.textHandler?.(t),this.text=``),this._closed=!0,this.endHandler?.(),this._init(),this}resolve(e){let t=this.topNS[e];if(t!==void 0)return t;let{tags:n}=this;for(let r=n.length-1;r>=0;r--)if(t=n[r].ns[e],t!==void 0)return t;return t=this.ns[e],t===void 0?this.opt.resolvePrefix?.(e):t}qName(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qName(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?j:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){this.processAttribs();let{tags:e}=this,t=this.tag;t.isSelfClosing=!1,this.openTagHandler?.(t),e.push(t),this.state=P,this.name=``}openSelfClosingTag(){this.processAttribs();let{tags:e}=this,t=this.tag;t.isSelfClosing=!0,this.openTagHandler?.(t),this.closeTagHandler?.(t),(this.tag=e[e.length-1]??null)===null&&(this.closedRoot=!0),this.state=P,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=P,this.name=``,t===``)return this.fail(`weird empty close tag.`),void(this.text+=`</>`);let n=this.closeTagHandler,r=e.length;for(;r-->0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag: ${t}.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}},pe=/&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g,me={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},he=(e,t)=>{let n=me[t];if(n!==void 0)return n;let r=t.charCodeAt(1)===120?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return r>0&&r<=1114111?String.fromCodePoint(r):e},ge=e=>{let t=e;return t.indexOf(`\r`)!==-1&&(t=t.replace(/\r\n?/g,`
|
|
2
|
+
`)),t.indexOf(`&`)!==-1&&(t=t.replace(pe,he)),t},_e=e=>{let t=e,n=t.length;for(let e=0;e<n;e++){let n=t.charCodeAt(e);if(n===9||n===10||n===13){t=t.replace(/\r\n|[\t\n\r]/g,` `);break}}return t.indexOf(`&`)!==-1&&(t=t.replace(pe,he)),t},G=e=>e===32||e===9||e===10||e===13,K=class e{constructor(){this._openTagHandler=void 0,this._closeTagHandler=void 0,this._textHandler=void 0,this._cdataHandler=void 0,this._errorHandler=void 0,this._endHandler=void 0,this._scanners=null,this._carry=``,this._text=``,this._tags=[],this._sawRoot=!1,this._closed=!1}static{this.NEED_MORE=-1}static{this.NOT_HANDLED=-2}static decodeText(e){return ge(e)}on(e,t){switch(e){case`opentag`:this._openTagHandler=t;break;case`closetag`:this._closeTagHandler=t;break;case`text`:this._textHandler=t;break;case`cdata`:this._cdataHandler=t;break;case`error`:this._errorHandler=t;break;case`end`:this._endHandler=t}}setElementScanners(e){if(!e||e.length===0)return void(this._scanners=null);let t=Array(128);for(let n of e){let e=n.name.charCodeAt(0);if(!(e<128)||t[e]!==void 0)throw Error(`Element scanner '${n.name}' needs an ASCII first character no other scanner uses.`);t[e]=n}this._scanners=t}fail(e){let t=Error(e),n=this._errorHandler;if(n===void 0)throw t;n(t)}write(e){if(this._closed)return this.fail(`cannot write after close.`),this;let t=e;this._carry.length!==0&&(t=this._carry+e,this._carry=``);let n=t.length,r=0;for(;r<n;){let e=t.indexOf(`<`,r);if(e===-1)return this._text+=t.slice(r),this;e>r&&(this._text+=t.slice(r,e));let i=this._markup(t,e,n);if(i===-1)return this._carry=t.slice(e),this;r=i}return this}close(){this._carry.length!==0&&(this.fail(`unexpected end.`),this._carry=``),this._sawRoot||this.fail(`document must contain a root element.`);let e=this._tags;for(;e.length>0;){let t=e.pop();this.fail(`unclosed tag: ${t.name}`)}return this._flushText(),this._closed=!0,this._endHandler?.(),this}_flushText(){let e=this._text;if(e.length===0)return;this._text=``;let t=this._textHandler;t!==void 0&&this._tags.length!==0&&t(ge(e))}_markup(t,n,r){if(n+1>=r)return-1;let i=t.charCodeAt(n+1);if(i===47){let e=t.indexOf(`>`,n+2);return e===-1?-1:(this._flushText(),this._closeTag(t.slice(n+2,e).trimEnd()),e+1)}if(i===63){let e=t.indexOf(`?>`,n+2);return e===-1?-1:e+2}if(i===33){if(n+4>r)return-1;if(t.charCodeAt(n+2)===45&&t.charCodeAt(n+3)===45){let e=t.indexOf(`-->`,n+4);return e===-1?-1:e+3}if(n+9>r)return-1;if(t.startsWith(`[CDATA[`,n+2)){let e=t.indexOf(`]]>`,n+9);return e===-1?-1:(this._flushText(),this._cdataHandler?.(t.slice(n+9,e)),e+3)}let e=t.indexOf(`[`,n+2),i=t.indexOf(`>`,n+2);if(i===-1)return-1;if(e!==-1&&e<i){let n=t.indexOf(`]>`,e);return n===-1?-1:n+2}return i+1}let a=this._scanners;if(a!==null){let o=i<128?a[i]:void 0;if(o!==void 0&&t.startsWith(o.name,n+1)){let i=n+1+o.name.length;if(i>=r)return-1;let a=t.charCodeAt(i);if(a===62||a===47||G(a)){this._flushText();let i=o.scan(t,n,r);if(i!==e.NOT_HANDLED){if(i!==e.NEED_MORE){this._sawRoot=!0;let e=o.openTag;e!==void 0&&this._tags.push(e)}return i}}}}return this._openTag(t,n,r)}_openTag(e,t,n){let r=t+1,i=0;for(;r<n&&(i=e.charCodeAt(r),i!==62&&i!==47&&!G(i));)r++;if(r>=n)return-1;let a=e.slice(t+1,r),o={},s=!1;for(;;){for(;r<n&&G(i=e.charCodeAt(r));)r++;if(r>=n)return-1;if(i===62){r++;break}if(i===47){if(r+1>=n)return-1;if(e.charCodeAt(r+1)!==62){this.fail(`forward-slash in opening tag not followed by >.`),r++;continue}s=!0,r+=2;break}let t=r;for(;r<n&&(i=e.charCodeAt(r),i!==61&&i!==62&&i!==47&&!G(i));)r++;if(r>=n)return-1;let a=e.slice(t,r);for(;r<n&&G(i=e.charCodeAt(r));)r++;if(r>=n)return-1;if(i!==61){this.fail(`attribute without value.`);continue}for(r++;r<n&&G(i=e.charCodeAt(r));)r++;if(r>=n)return-1;if(i!==34&&i!==39){this.fail(`unquoted attribute value.`);continue}let c=e.indexOf(i===34?`"`:`'`,r+1);if(c===-1)return-1;a!==`__proto__`&&(o[a]=_e(e.slice(r+1,c))),r=c+1}this._flushText(),this._sawRoot=!0;let c={name:a,attributes:o,isSelfClosing:s};return this._openTagHandler?.(c),s?this._closeTagHandler?.(c):this._tags.push(c),r}_closeTag(e){if(e===``)return void this.fail(`weird empty close tag.`);let t=this._tags,n=this._closeTagHandler,r=t.length;for(;r-->0;){let r=t.pop();if(n?.(r),r.name===e)return;this.fail(`unexpected close tag: ${e}.`)}this.fail(`unmatched closing tag: ${e}.`)}};(function(e){e.Events={XmlDecl:`xmldecl`,Text:`text`,ProcessingInstruction:`processinginstruction`,Doctype:`doctype`,Comment:`comment`,OpenTagStart:`opentagstart`,Attribute:`attribute`,OpenTag:`opentag`,CloseTag:`closetag`,CDdata:`cdata`,Error:`error`,End:`end`,Ready:`ready`},e.parseStream=async(e,t,n)=>{if(n?.lean)return(async(e,t)=>{let n=new K,r;t.elementScanners&&n.setElementScanners(t.elementScanners),t.onOpenTag&&n.on(`opentag`,t.onOpenTag),t.onCloseTag&&n.on(`closetag`,t.onCloseTag),t.onText&&n.on(`text`,t.onText),t.onError&&n.on(`error`,t.onError);let i=t.onEnd;for(i&&n.on(`end`,()=>{r=i()});;){let{value:t,done:r}=await e.read();if(r)break;n.write(t)}return n.close(),r})(e,t);let r=new fe({position:!1,...n}),i;t.onOpenTagStart&&r.on(W.Events.OpenTagStart,t.onOpenTagStart),t.onOpenTag&&r.on(W.Events.OpenTag,t.onOpenTag),t.onCloseTag&&r.on(W.Events.CloseTag,t.onCloseTag),t.onAttribute&&r.on(W.Events.Attribute,t.onAttribute),t.onText&&r.on(W.Events.Text,t.onText),t.onError&&r.on(W.Events.Error,t.onError);let a=t.onEnd;for(a&&r.on(W.Events.End,()=>{i=a()});;){let{value:t,done:n}=await e.read();if(n)break;r.write(t)}return r.close(),i}})(W||={});var q=e=>!0===e||e===`1`||e===`on`||e===`true`||!1!==e&&e!==`0`&&e!==`off`&&e!==`false`&&null,J=e=>{let t=parseInt(e);return isNaN(t)?null:t},Y=e=>{let t=parseFloat(e);return isNaN(t)?null:t},X=null,Z=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),ve=e=>Z(e).replace(/"/g,`"`),Q=class{constructor(){this._registeredVisitors=new Map}registerVisitor(e){this._registeredVisitors.set(e.from,e)}createEventHandler(e,t,n){let r=this._registeredVisitors,i=[],a=[],o=null,s=null,c=null,l=null,u=[],d={key:null,source:e,parent:null},f=null,p=!1,m=null,h=null,g=null,_=(e,t)=>{let n=c.attributes[e];if(t){if(Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(n==null||(n=t[r](n),n==null))return}else if(n==null||(n=t(n),n==null))return}return n},v={getSource:()=>f?.source??null,setSource:e=>{f.source=e},setKey:e=>{f.key=e},getFrom:()=>c,getAttribute:(e,t)=>_(e,t)??null,hasAttribute:e=>v.getAttribute(e)!==null,getParent:()=>{let e=u[u.length-2];return e.parent??e.source},getPath:()=>{let e=[],t=a.length;for(let n=0;n<t;n++)e.push(a[n].local);return e.join(`\\`)},parseAttribute:_,getRawXml:()=>g,copyToObject:(e,t,n,r)=>{let i=_(r??t,n);i!==void 0&&(e[t]=i)},copyTo:(e,t,n)=>{let r=_(n??e,t);r!==void 0&&(f.source[e]=r)},warn:(e,t)=>{n?n(e,void 0,t?.onceKey):console.warn(e)}};return{onOpenTag:e=>{let t=e.name,n=t.indexOf(`:`);if(n!==-1&&(t=t.slice(n+1)),m)return m.push((e=>{let t=e.attributes??{},n=`<${e.name}`;for(let e in t){let r=t[e];n+=` ${e}="${ve(typeof r==`string`?r:r?.value??``)}"`}return n+`>`})(e)),o={local:t,tag:e,destination:null},a.push(o),s=t,void(c=e);let g=(i.length>0?i[i.length-1]:r).get(t);if(o={local:t,visitor:g,tag:e,destination:null},p)return a.push(o),s=t,void(c=e);l=o?.visitor??null,s=t,c=e;let _=!!g&&g.to===null;if(g&&!_&&g.scope){let e=g.scope(v);e===null?_=!0:e&&(i.push(e),o.pushedScope=!0)}g&&(a.length===0?(f=d,o.destination=f,o.pushedDestination=!0,u.push(f)):_?(f=null,o.destination=null):g.transparent?o.destination=f:(f={key:null,source:{},parent:null},o.destination=f,o.pushedDestination=!0,u.push(f))),a.push(o),p=_;let y=l?.openTag?.(v);y!==void 0&&(f.parent=y),g?.raw&&!_&&(m=[],h=o)},onCloseTag:e=>{let t=e.name,r=t.indexOf(`:`);if(r!==-1&&(t=t.slice(r+1)),t!==s)throw Error(`mismatch open/close tag: '${t}'/'${s}'`);let _=!1;if(m){if(a[a.length-1]!==h)return m.push(`</${e.name}>`),a.pop(),o=a[a.length-1]??null,s=o?.local??null,void(c=o?.tag??null);g=m.join(``),m=null,h=null,_=!0}p||l?.closeTag?.(v),_&&(g=null);let y=a.pop()??null;o=a[a.length-1]??null,y?.pushedScope&&i.pop();let b=y?.destination;if(b&&y.pushedDestination){u.pop(),f=u[u.length-1]??d;let e=y.visitor;e&&e.to&&b.source!==void 0&&(Array.isArray(e.to)?f.source.push?f.source.push(b.source):n?.(`Unable to parse array for ${e.from} at ${v.getPath()}`):b.key?f.source[b.key]=b.source:typeof e.to==`string`&&(f.source[e.to]=b.source))}else b||(f=u[u.length-1]??d);s=o?.local??null,c=o?.tag??null,l=o?.visitor??null,p=!o?.destination},onText:e=>{m?m.push(Z(e)):l?.text?.(e,v)},onEnd:t}}},ye=`IFERROR(${e.pt}(`,be=ye.toUpperCase(),xe=e.ft.toUpperCase(),Se={kind:`none`},Ce={kind:`spilled`},we=(e,t)=>{if(e.charCodeAt(t)!==34)return null;let n=``,r=t+1;for(;r<e.length;)if(e.charCodeAt(r)===34){if(e.charCodeAt(r+1)!==34)return{value:n,end:r+1};n+=`"`,r+=2}else n+=e[r],r++;return null},$=e=>{let t=[],n=0;for(;n<e.length;){let r=e.charCodeAt(n);if(r===34){let t=we(e,n);if(t===null)break;n=t.end;continue}if(!(r>=65&&r<=90||r>=97&&r<=122||r===95)){n++;continue}let i=n+1;for(;i<e.length;){let t=e.charCodeAt(i);if(!(t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===95||t===46))break;i++}e.charCodeAt(i)===40&&t.push(e.slice(n,i).toUpperCase().replace(/^_XLFN\./,``).replace(/^_XLWS\./,``)),n=i}return t},Te=t=>{let n=e=>{if(t)return RegExp(`<(?:[\\w.-]+:)?${e}\\b[^>]*>([^<]*)<`).exec(t)?.[1]},r=e=>{let t=parseInt(e??``,10);return isNaN(t)?0:t};return{c:r(n(`col`)),r:r(n(`row`)),x:e.yt(n(`colOff`)??`0`)??0,y:e.yt(n(`rowOff`)??`0`)??0}},Ee=`formulaDialect`,De=(n,i,a,o,s,c,l,u)=>{let d=new Q,f=u?.get(`parseInlineDxf`),p=u?.get(Ee),m=e=>p&&e?p.readDetached(e):e,h=new r.Tuple.TransposedBuilder,g=null;d.registerVisitor({from:`autoFilter`,to:`autoTable`,openTag:e=>{let t=e.getAttribute(`ref`),n=r.AddressUtils.fastStringToRange(t);e.getSource().r=n,e.getSource().v={}},closeTag:e=>{let t=e.getSource(),n=t.v,r=n.hiddenButtons;if(Array.isArray(r)){let e=r.length,i=t.r,a=i.colEnd-i.colStart+1;e===0?n.hiddenButtons=!1:e===a&&(n.hiddenButtons=!0)}}}),d.registerVisitor({from:`conditionalFormatting`,to:{},openTag:e=>{let t=e.getParent();t.conditionals||=[];let n=e.getAttribute(`sqref`);n&&=n.trim().split(/\s+/).join(`,`);let r={r:n,conditionals:t.conditionals},i=e.getAttribute(`pivot`,q);i!==null&&(r.pivot=i),e.setSource(r)}}),d.registerVisitor({from:`cfRule`,to:{},openTag:e=>{let t=e.getParent();if(!t?.r)return;let n=e.getSource()??{};t.pivot!==void 0&&(n.pivot=t.pivot),t.conditionals.push({r:t.r,v:null,rule:n}),e.copyToObject(n,`type`,X),e.copyToObject(n,`priority`,J),e.copyToObject(n,`stopIfTrue`,q);let r=e.getAttribute(`dxfId`,J);if(r!==null){let t=o?.get(r);t||=(c?.(`Unable to load conditional color. Invalid dxfI: '${r}' at '${e.getPath()}'.`),{}),n.style=t}e.copyToObject(n,`aboveAverage`,q),e.copyToObject(n,`equalAverage`,q),e.copyToObject(n,`stdDev`,J),e.copyToObject(n,`bottom`,q),e.copyToObject(n,`percent`,q),e.copyToObject(n,`rank`,J),e.copyToObject(n,`operator`,X),e.copyToObject(n,`text`,X),e.copyToObject(n,`timePeriod`,X)},closeTag:t=>{let n=t.getParent();if(!n?.r)return;let r=n.conditionals[n.conditionals.length-1],i=r?.rule;if(!i)return;let a={},o=e.rt(i,c);o&&(a.condition=o),i.style&&(a.style=i.style),i.scale&&(a.scale=i.scale),i.stopIfTrue&&(a.stopIfTrue=!0),i.pivot&&(a.pivot=!0),r.v=a,r.priority=i.priority,i.x14Id&&(r.x14Id=i.x14Id),delete r.rule}});let _=e=>{let t=e.conditions??[],n=[];for(let e=0;e<t.length;e++){let r=t[e],i={};r.type&&(i.type=r.type),r.value!==void 0&&(i.value=r.value),r.exclusive&&(i.exclusive=!0),n.push(i)}return n};d.registerVisitor({from:`colorScale`,to:{},openTag:e=>{},closeTag:e=>{let t=e.getSource(),n=t.colors??[],i=_(t);for(let e=0;e<i.length;e++)i[e].color=n[e];e.getParent().scale={type:r.IConditionalFormat.ScaleType.ColorScale,stops:i}}}),d.registerVisitor({from:`dataBar`,to:{},openTag:e=>{e.copyTo(`maxLength`,J),e.copyTo(`minLength`,J),e.copyTo(`showValue`,q)},closeTag:e=>{let t=e.getSource(),n={type:r.IConditionalFormat.ScaleType.DataBar,stops:_(t)},i=t.colors?.[0];i&&(n.color=i),t.minLength!==void 0&&(n.minLength=t.minLength),t.maxLength!==void 0&&(n.maxLength=t.maxLength),t.showValue!==void 0&&(n.showValue=t.showValue),e.getParent().scale=n}}),d.registerVisitor({from:`iconSet`,to:{},openTag:e=>{e.copyTo(`iconSet`,X),e.copyTo(`reverse`,q),e.copyTo(`showValue`,q)},closeTag:e=>{let t=e.getSource(),n={type:r.IConditionalFormat.ScaleType.IconSet,stops:_(t)};t.iconSet!==void 0&&(n.iconSet=t.iconSet),t.reverse!==void 0&&(n.reverse=t.reverse),t.showValue!==void 0&&(n.showValue=t.showValue),e.getParent().scale=n}}),d.registerVisitor({from:`formula`,to:{},text:(e,t)=>{let n=t.getParent(),r=n.formulas;r||(r=[],n.formulas=r),r.push(m(e))}}),d.registerVisitor({from:`cfvo`,to:{},openTag:e=>{let t=e.getParent();t.conditions||=[];let n=e.getSource();if(t.conditions.push(n),e.copyTo(`type`,X),n.type===r.IConditionalFormat.ColorStopType.Formula){let t=e.getAttribute(`val`);t!=null&&(n.value=m(String(t)))}else e.copyTo(`value`,Y,`val`);!1===e.getAttribute(`gte`,q)&&(n.exclusive=!0)}}),d.registerVisitor({from:`color`,to:{},openTag:e=>{let n=e.getParent();n.colors||=[];let r=t.s(t=>e.getAttribute(t));n.colors.push(r)}}),d.registerVisitor({from:`filterColumn`,to:{},openTag:e=>{let t=e.getParent().v,n=parseInt(e.getAttribute(`colId`)),r=e.getSource();r.index=n;let i=t.filter;i||(i={conditions:[]},t.filter=i);let a=i.conditions;if(a||(a=[],i.conditions=a),a.push(r),e.getAttribute(`hiddenButton`,q)&&t){let e=t.hiddenButtons;e||(e=[],t.hiddenButtons=e),e.push(n)}if(e.getAttribute(`showButton`,q)&&t){let e=t.showButtons;e||(e=[],t.showButtons=e),e.push(n)}return r}}),d.registerVisitor({from:`colorFilter`,openTag:e=>{let t=e.getParent(),n={};t.operator=r.ICondition.BuiltInOperatorNames.Color,t.param=n,e.copyToObject(n,`cellColor`,q),e.copyToObject(n,`styleId`,J,`dxfId`)}}),d.registerVisitor({from:`iconFilter`,openTag:e=>{let t=e.getParent(),n={};t.operator=r.ICondition.BuiltInOperatorNames.Icon,t.param=n,e.copyToObject(n,`iconId`,J),e.copyToObject(n,`iconSet`,X)}}),d.registerVisitor({from:`top10`,openTag:e=>{let t=e.getParent(),n={};t.operator=r.ICondition.BuiltInOperatorNames.TopN,t.param=n,e.copyToObject(n,`filterVal`,Y),e.copyToObject(n,`percent`,q),e.copyToObject(n,`top`,q),e.copyToObject(n,`limit`,Y,`val`)}}),d.registerVisitor({from:`dynamicFilter`,openTag:t=>{let n=t.getParent(),r=e.J(t.getAttribute(`type`));n.operator=r.operator,n.param=r.param}});let v={from:`filters`,to:{},openTag:e=>{let t=e.getParent(),n={byDisplay:!0};return t.operator=r.ICondition.BuiltInOperatorNames.InSet,t.param=n,e.copyToObject(n,`blank`,q),n.blank&&(t.includeBlanks=!0),e.copyToObject(n,`calendarType`,X),n}};d.registerVisitor(v);let y={from:`filter`,openTag:e=>{let t=e.getParent(),n=t.items;n||(n=[],t.items=n),n.push(e.getAttribute(`val`,X))}};d.registerVisitor(y);let b={from:`dateGroupItem`,to:{},openTag:e=>{let t=e.getParent(),n=t.dateGroups;n||(n=[],t.dateGroups=n),n.push(e.getSource()),e.copyTo(`group`,X,`dateTimeGrouping`),e.copyTo(`day`,J),e.copyTo(`hour`,J),e.copyTo(`minute`,J),e.copyTo(`month`,J),e.copyTo(`second`,J),e.copyTo(`year`,J)}};d.registerVisitor(b);let x=new Map;x.set(`filterColumn`,{from:`filterColumn`,transparent:!0}),x.set(`filters`,v),x.set(`filter`,y),x.set(`dateGroupItem`,b),d.registerVisitor({from:`customFilters`,openTag:e=>{let t=e.getParent(),n=e.getAttribute(`and`),i=n===`and`||n===`1`,a=[];return t.operator=i?r.ICondition.BuiltInOperatorNames.And:r.ICondition.BuiltInOperatorNames.Or,t.param=a,e.setSource(t),a},closeTag:t=>{let n=t.getSource(),r=n?.param;if(!n||!r)return;let i=r.length===1?r[0]:e.Y(n);i!==n&&(n.operator=i.operator,n.param=i.param,i.includeBlanks&&(n.includeBlanks=!0))}}),d.registerVisitor({from:`customFilter`,openTag:t=>{let n=t.getParent(),r;Array.isArray(n)?(r={},n.push(r)):r=n;let i=e.et({operator:t.getAttribute(`operator`),val:t.getAttribute(`val`)},e=>t.warn(e));i&&(r.operator=i.operator,r.param=i.param,i.includeBlanks&&(r.includeBlanks=!0))}}),d.registerVisitor({from:`sortState`,to:{},openTag:e=>{let t=e.getParent(),n=t.v;n&&(n.sort={},e.setSource(t))}}),d.registerVisitor({from:`sortCondition`,to:{},openTag:e=>{let t=e.getParent(),n=t.v;if(!n)return;let i=n.sort;if(!i)return;let a=i.sorts;a||(a=[],i.sorts=a);let o=e.getAttribute(`ref`),s=0;if(o){let e=r.AddressUtils.fastStringToRange(o,Ae).colStart,n=t.r,i=n.colStart;s=n?e-i:e}let c={};e.copyToObject(c,`sortOn`,X,`sortBy`),e.copyToObject(c,`dxfId`,X,`sortBy`),e.copyToObject(c,`iconSet`,X),e.copyToObject(c,`customList`,X),c.reverse=e.getAttribute(`descending`,q)??!1;let l={index:s,criteria:c};a.push(l)}});let S=t=>{g=t.getSource(),t.copyTo(`topLeft`,X,`topLeftCell`);let n=e.vt(t.getAttribute(`defaultGridColor`)),r=t.getAttribute(`colorId`);r===null||n||(t.getSource().gridLineColor=`index`+parseFloat(r)),t.copyTo(`showZeros`,q),t.copyTo(`showFormulas`,q),t.copyTo(`zoomScale`,J),t.copyTo(`showRowHeaders`,q,`showRowColHeaders`),t.copyTo(`showColumnHeaders`,q,`showRowColHeaders`),t.copyTo(`showRowGridlines`,q,`showGridLines`),t.copyTo(`showColumnGridlines`,q,`showGridLines`),t.copyTo(`rightToLeft`,q),t.copyTo(`showOutlineSymbols`,q)};d.registerVisitor({from:`sheetView`,to:`view`,openTag:e=>{S(e)},closeTag:()=>{g=null}}),d.registerVisitor({from:`customSheetViews`,to:`customSheetViews`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`customSheetView`,to:[],openTag:e=>{S(e)},closeTag:()=>{g=null}}),d.registerVisitor({from:`selection`,to:`selection`,openTag:e=>{if(!g)return;e.copyTo(`cell`,X,`activeCell`),e.copyTo(`rangeIndex`,J,`activeCellId`);let t=e.getAttribute(`activeCell`),n=e.getAttribute(`sqref`);n&&n!==t&&(e.getSource().ranges=n.trim().split(/\s+/))}}),d.registerVisitor({from:`pane`,to:null,openTag:e=>{if(g&&e.getAttribute(`state`)===`frozen`){let t={};g.freezePanes=t,e.copyToObject(t,`topLeft`,X,`topLeftCell`);let n=(g.topLeft?r.AddressUtils.fastStringToCell(g.topLeft):void 0)??{colIndex:0,rowIndex:0},i={colIndex:0,rowIndex:0};e.copyToObject(i,`colIndex`,J,`xSplit`),e.copyToObject(i,`rowIndex`,J,`ySplit`);let a={colIndex:n.colIndex+i.colIndex,rowIndex:n.rowIndex+i.rowIndex};t.coords=r.AddressUtils.cellToString(a)}}}),d.registerVisitor({from:`sheetPr`,transparent:!0,openTag:e=>{let t=e.getAttribute(`codeName`);t&&(n.codeName=t),!1===e.getAttribute(`enableFormatConditionsCalculation`,q)&&(n.conditionalFormatCalculation=!1)}}),d.registerVisitor({from:`tabColor`,to:null,openTag:e=>{let r=t.s(t=>e.getAttribute(t));r&&(n.tabColor=r)}}),d.registerVisitor({from:`pageSetUpPr`,to:`pageSetUpPr`,openTag:e=>{}}),d.registerVisitor({from:`outlinePr`,to:null,openTag:e=>{let t=t=>{let n=e.getAttribute(t);return n===`0`||n===`false`},r={};t(`summaryBelow`)&&(r.summaryRow=`up`),t(`summaryRight`)&&(r.summaryColumn=`left`),(t=>{let n=e.getAttribute(t);return n===`1`||n===`true`})(`applyStyles`)&&(r.automaticStyles=!0),Object.keys(r).length>0&&(n.outline=r)}}),d.registerVisitor({from:`pageMargins`,to:`pageMargins`,openTag:e=>{e.copyTo(`bottom`,Y),e.copyTo(`footer`,Y),e.copyTo(`header`,Y),e.copyTo(`left`,Y),e.copyTo(`right`,Y),e.copyTo(`top`,Y),e.copyTo(`bottom`,Y)}}),d.registerVisitor({from:`pageSetup`,to:`pageSetup`,openTag:e=>{e.copyTo(`blackAndWhite`,q),e.copyTo(`cellComments`),e.copyTo(`copies`,J),e.copyTo(`draft`,q),e.copyTo(`errors`),e.copyTo(`firstPageNumber`,J),e.copyTo(`fitToHeight`,J),e.copyTo(`fitToWidth`,J),e.copyTo(`horizontalDpi`,J),e.copyTo(`orientation`),e.copyTo(`pageOrder`),e.copyTo(`paperSize`,J),e.copyTo(`scale`,J),e.copyTo(`useFirstPageNumber`,q),e.copyTo(`usePrinterDefaults`,q),e.copyTo(`verticalDpi`,J)}}),d.registerVisitor({from:`printOptions`,to:`printOptions`,openTag:e=>{e.copyTo(`gridLines`,q),e.copyTo(`gridLinesSet`,q),e.copyTo(`headings`,q),e.copyTo(`horizontalCentered`,q),e.copyTo(`verticalCentered`,q)}}),d.registerVisitor({from:`headerFoot`,to:`headerFoot`,openTag:e=>{}}),d.registerVisitor({from:`mergeCells`,to:`merges`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`dataValidations`,to:`validations`,openTag:e=>{e.setSource([])}});let ee={from:`dataValidation`,to:[],openTag:e=>{let t=e.getAttribute(`sqref`);t&&=t.trim().split(/\s+/).join(`,`);let n={},r={r:t,v:n,rule:{type:e.getAttribute(`type`)??void 0,operator:e.getAttribute(`operator`)??void 0}};!0===e.getAttribute(`showDropDown`,q)&&(n.hideDropdown=!0),e.copyToObject(n,`alert`,X,`error`),e.copyToObject(n,`alertTitle`,X,`errorTitle`),e.copyToObject(n,`showAlertMessage`,q,`showErrorMessage`),n.alertStyle=e.getAttribute(`errorStyle`)??`stop`,e.copyToObject(n,`imeMode`),e.copyToObject(n,`prompt`),e.copyToObject(n,`promptTitle`),e.copyToObject(n,`showPromptMessage`,q,`showInputMessage`),e.setSource(r)},closeTag:t=>{let n=t.getSource();if(!n?.rule)return;let r=e.K(n.rule,c);r&&(t.getAttribute(`allowBlank`,q)&&(r.includeBlanks=!0),n.v.condition=r),delete n.rule}};d.registerVisitor(ee),d.registerVisitor({from:`formula1`,to:{},text:(t,n)=>{let r=n.getParent().rule;r?.type&&(r.formula1=e.W(m(t),r.type))}}),d.registerVisitor({from:`formula2`,to:{},text:(t,n)=>{let r=n.getParent().rule;r?.type&&(r.formula2=e.W(m(t),r.type))}}),d.registerVisitor({from:`picture`,to:`picture`,openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return void e.warn(`A picture names no image; it was not imported.`,{onceKey:`xlsx.sheet.picture.noRel`});let n=i(t,`resource`);e.getSource().resId=n}});let C={from:`slicer`,to:{},openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return void e.warn(`A slicer names no cache; it was not imported.`,{onceKey:`xlsx.sheet.slicer.noRel`});let n=i(t)?.slicers,r=e.getParent();r.slicers||={};let a=Object.keys(n);for(let e of a)r.slicers[e]=n[e]}};d.registerVisitor(C);let w=(e,t)=>({from:e,to:{},openTag:e=>{e.setSource(``)},text:(e,t)=>{t.setSource((t.getSource()??``)+e)},closeTag:e=>{t(String(e.getSource()??``),e)}}),T=new Map;T.set(`dataValidations`,{from:`dataValidations`,to:`validations`,openTag:e=>{let t=e.getParent();e.setSource(t.validations??[])},closeTag:e=>{(e.getSource()?.length??0)===0&&e.setSource(void 0)}}),T.set(`dataValidation`,{...ee,closeTag:e=>{ee.closeTag(e);let t=e.getSource();t&&!t.r&&(e.warn(`x14 dataValidation with no xm:sqref was dropped.`),e.setSource(void 0))}});let te=e=>({from:e,to:{},openTag:t=>{t.setSource({rule:t.getParent()?.rule,key:e})}});T.set(`formula1`,te(`formula1`)),T.set(`formula2`,te(`formula2`)),T.set(`f`,w(`f`,(t,n)=>{let r=n.getParent(),i=r?.rule;i&&(i[r.key]=e.W(m(t),i.type))})),T.set(`sqref`,w(`sqref`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.r=r.split(/\s+/).join(`,`))}));let E=new Map,D=[],O=new Map;O.set(`conditionalFormattings`,{from:`conditionalFormattings`,transparent:!0}),O.set(`conditionalFormatting`,{from:`conditionalFormatting`,to:{},openTag:e=>{e.setSource({rules:[]})},closeTag:e=>{let t=e.getSource(),n=t?.rules??[];for(let e=0;e<n.length;e++){let r=n[e];r.sqref=t.sqref,r.id?E.set(r.id,r):D.push(r)}}}),O.set(`cfRule`,{from:`cfRule`,to:{},openTag:e=>{e.copyTo(`id`,X),e.copyTo(`type`,X),e.copyTo(`priority`,J),e.copyTo(`stopIfTrue`,q),e.copyTo(`operator`,X),e.copyTo(`text`,X),e.copyTo(`timePeriod`,X),e.copyTo(`aboveAverage`,q),e.copyTo(`equalAverage`,q),e.copyTo(`stdDev`,J),e.copyTo(`bottom`,q),e.copyTo(`percent`,q),e.copyTo(`rank`,J)},closeTag:e=>{let t=e.getSource();t&&e.getParent()?.rules?.push(t)}}),O.set(`sqref`,w(`sqref`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.sqref=r)})),O.set(`dataBar`,{from:`dataBar`,to:{},openTag:e=>{e.copyTo(`minLength`,J),e.copyTo(`maxLength`,J),e.copyTo(`gradient`,q),e.copyTo(`border`,q),e.copyTo(`direction`,X),e.copyTo(`axisPosition`,X),e.copyTo(`negativeBarColorSameAsPositive`,q),e.copyTo(`negativeBarBorderColorSameAsPositive`,q)},closeTag:e=>{e.getParent().dataBar=e.getSource()}}),O.set(`iconSet`,{from:`iconSet`,to:{},openTag:e=>{e.copyTo(`iconSet`,X),e.copyTo(`custom`,q),e.copyTo(`reverse`,q),e.copyTo(`showValue`,q)},closeTag:e=>{e.getParent().iconSet=e.getSource()}});let k=new Map;k.set(`f`,w(`f`,(e,t)=>{let n=t.getParent();if(!n)return;let r=e.trim(),i=Number(r);n.value=r.length>0&&Number.isFinite(i)?i:m(e)})),O.set(`cfvo`,{from:`cfvo`,to:{},scope:()=>k,openTag:e=>{let t=e.getParent();t.conditions||=[];let n=e.getSource();t.conditions.push(n),e.copyTo(`type`,X),!1===e.getAttribute(`gte`,q)&&(n.exclusive=!0)}}),O.set(`f`,w(`f`,(e,t)=>{let n=t.getParent();n&&(n.formulas??=[]).push(m(e))})),O.set(`dxf`,{from:`dxf`,to:{},raw:!0,closeTag:e=>{if(!f)return;let t=e.getParent();if(!t)return;let n=f(e.getRawXml()??``);n&&(t.style=n)}});let A=e=>({from:e,to:{},openTag:n=>{let r=t.s(e=>n.getAttribute(e));r&&(n.getParent()[e]=r)}});O.set(`borderColor`,A(`borderColor`)),O.set(`negativeFillColor`,A(`negativeFillColor`)),O.set(`negativeBorderColor`,A(`negativeBorderColor`)),O.set(`axisColor`,A(`axisColor`)),O.set(`cfIcon`,{from:`cfIcon`,to:{},openTag:e=>{let t=e.getAttribute(`iconSet`),n=e.getAttribute(`iconId`,J);if(t===null||n===null)return;let r=e.getParent();r.icons||=[],r.icons.push({set:t,id:n})}});let j=new Map;j.set(`id`,w(`id`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.x14Id=r)}));let ne=new Map;ne.set(`slicerList`,{from:`slicerList`,transparent:!0}),ne.set(`slicer`,C);let re=new Map([[e.Qt(e.Ut),T],[e.Qt(e.Vt),O],[e.Qt(e.Ht),O],[e.Qt(e.Bt),j],[e.Qt(e.Gt),ne],[e.Qt(e.Kt),ne],[e.Qt(e.Wt),x]]),M=new Set;d.registerVisitor({from:`extLst`,transparent:!0}),d.registerVisitor({from:`ext`,transparent:!0,scope:t=>{let n=t.getAttribute(`uri`),r=e.Qt(n),i=re.get(r);if(i)return i;if(!e.Yt.has(r)&&!M.has(r)){M.add(r);let i=e.Xt[r];t.warn(i?`Extension content '${i}' (${n}) is not read; it will be lost on resave.`:`Unknown extension content (uri ${n}) is not read; it will be lost on resave.`)}return null}}),d.registerVisitor({from:`mergeCell`,to:[],openTag:e=>{let t=e.getAttribute(`ref`);e.setSource(t)}}),d.registerVisitor({from:`hyperlinks`,to:`hyperlinks`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`hyperlink`,to:[],openTag:e=>{let t=e.getAttribute(`r:id`),n=e.getAttribute(`ref`);if(!n)return void e.warn(`A hyperlink has no ref; it was dropped.`,{onceKey:`xlsx.sheet.hyperlink.noRef`});e.setKey(n);let r=t?i(t):``;if(typeof r!=`string`)return void e.warn(`A hyperlink has an invalid address; it was dropped.`,{onceKey:`xlsx.sheet.hyperlink.address`});r.endsWith(`\\`)&&(r=r.substring(0,r.length-1));let a=e.getAttribute(`location`);if(a&&(r+=`#`+a),!r)return void e.warn(`A hyperlink has no address; it was dropped.`,{onceKey:`xlsx.sheet.hyperlink.address`});let o,s=e.getAttribute(`tooltip`);o=s?{address:r,screenTip:s}:r,e.setSource({r:n,v:o})}}),d.registerVisitor({from:`drawing`,to:`movables`,openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return;let n=i(t);n?e.setSource(n.movables):e.warn(`A drawing part is missing; its shapes were not imported.`,{onceKey:`xlsx.sheet.drawing.missing`})}}),d.registerVisitor({from:`legacyDrawing`,to:`legacyDrawing`,openTag:e=>{e.setSource(i(e.getAttribute(`r:id`),`legacyDrawing`)??void 0)}}),d.registerVisitor({from:`legacyDrawingHF`,to:`legacyDrawingHF`,openTag:e=>{e.setSource(i(e.getAttribute(`r:id`),`legacyDrawing`)??void 0)}});let N=null,P=!1,F=new Map,I={from:`Fallback`,to:null},L={from:`Choice`,transparent:!0};F.set(`Fallback`,I),F.set(`Choice`,L),F.set(`control`,{from:`control`,transparent:!0,openTag:e=>{let t=e.getAttribute(`name`),n=e.getAttribute(`r:id`),r=n?i(n,`formControl`):null;if(!r)return e.warn(`The form control '${t??``}' has no properties and was not read.`,{onceKey:`xlsx.sheet.control.noProperties`}),void(N=null);let a=r.json,o=parseInt(e.getAttribute(`shapeId`)??``,10);isNaN(o)||(a.shapeId=o);let s={anchor:{tl:{c:0,r:0,x:0,y:0},br:{c:0,r:0,x:0,y:0}},content:{type:r.type,json:a}};t&&(s.content.name=t),N={movable:s,control:a}},closeTag:()=>{N&&=(n.movables||=[],n.movables.push(N.movable),null)}}),F.set(`controlPr`,{from:`controlPr`,transparent:!0,raw:!0,openTag:t=>{if(!N)return;let n=t.getFrom().attributes??{},r={};for(let e in n){let t=n[e];r[e]=typeof t==`string`?t:t?.value??``}e._(r,N.control)},closeTag:e=>{if(!N)return;let t=(e=>{let t=/<(?:[\w.-]+:)?anchor\b([^>]*)>([\s\S]*?)<\/(?:[\w.-]+:)?anchor>/.exec(e);if(!t)return null;let n=t[2],r=e=>RegExp(`<(?:[\\w.-]+:)?${e}\\b[^>]*>([\\s\\S]*?)<\\/(?:[\\w.-]+:)?${e}>`).exec(n)?.[1],i=t[1],a=/\bmoveWithCells="(?:1|true)"/.test(i),o=/\bsizeWithCells="(?:1|true)"/.test(i);return{anchor:{tl:Te(r(`from`)),br:Te(r(`to`))},anchorType:a?o?`twoCell`:`oneCell`:`absolute`,rest:(e.slice(0,t.index)+e.slice(t.index+t[0].length)).trim()}})(e.getRawXml()??``);t?(N.movable.anchor=t.anchor,t.anchorType!==`twoCell`&&(N.movable.anchorType=t.anchorType),t.rest&&(N.control.xml=t.rest)):P||(P=!0,e.warn(`A form control has no anchor; it is placed at the top left of the sheet.`))}});let R={from:`controls`,transparent:!0,scope:()=>F};d.registerVisitor(R);let z=new Map([[`Choice`,L],[`Fallback`,I],[`controls`,R]]);d.registerVisitor({from:`AlternateContent`,transparent:!0,scope:()=>z}),d.registerVisitor({from:`tableParts`,to:`tables`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`tablePart`,to:[],openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return;let n=i(t);n?e.setSource(n):e.warn(`A table part is missing; the table was not imported.`,{onceKey:`xlsx.sheet.table.missing`})}});let B=(e,t)=>{t.conditions?.length&&(e.stops=_(t)),t.minLength!==void 0&&(e.minLength=t.minLength),t.maxLength!==void 0&&(e.maxLength=t.maxLength),(t.gradient??1)&&(e.gradient=!0),t.border&&t.borderColor&&(e.borderColor=t.borderColor),!t.negativeBarColorSameAsPositive&&t.negativeFillColor&&(e.negativeFillColor=t.negativeFillColor),!(t.negativeBarBorderColorSameAsPositive??1)&&t.negativeBorderColor&&(e.negativeBorderColor=t.negativeBorderColor),t.axisColor&&(e.axisColor=t.axisColor),t.axisPosition!==`middle`&&t.axisPosition!==`none`||(e.axisPosition=t.axisPosition),t.direction!==`leftToRight`&&t.direction!==`rightToLeft`||(e.direction=t.direction)},V=(e,t)=>{t.conditions?.length&&(e.stops=_(t)),t.iconSet&&t.iconSet!==e.iconSet&&(e.iconSet=t.iconSet),t.icons?.length&&(e.icon=t.icons),t.reverse!==void 0&&(e.reverse=t.reverse),t.showValue!==void 0&&(e.showValue=t.showValue)},ie=t=>{if(!t.sqref)return null;let n=t.sqref.split(/\s+/).join(`,`);if(t.type===`iconSet`){if(!t.iconSet)return null;let e={type:r.IConditionalFormat.ScaleType.IconSet,stops:[]};return V(e,t.iconSet),{r:n,v:{scale:e},priority:t.priority}}let i=e.rt(t,c);if(!i)return null;let a={condition:i};return t.style&&(a.style=t.style),t.stopIfTrue&&(a.stopIfTrue=!0),{r:n,v:a,priority:t.priority}};d.registerVisitor({from:`worksheet`,to:{},openTag:e=>{},closeTag:e=>{let t=e.getSource(),n=t?.conditionals;if(n)for(let e=0;e<n.length;e++){let t=n[e],i=t.x14Id;if(!i)continue;delete t.x14Id;let a=E.get(i);if(!a)continue;E.delete(i);let o=t.v?.scale;a.dataBar&&o?.type===r.IConditionalFormat.ScaleType.DataBar?B(o,a.dataBar):a.iconSet&&o?.type===r.IConditionalFormat.ScaleType.IconSet&&V(o,a.iconSet)}let i=[...E.values(),...D],a=new Set,o=0;for(let e=0;e<i.length;e++){let r=ie(i[e]);r?(n||(n=[],t.conditionals=n),n.push(r)):(a.add(i[e].type??`unknown`),o++)}if(o>0){let e=[...a].map(e=>`'${e}'`).join(`, `);c?.(o===1?`An x14-only conditional formatting rule (type ${e}) is not read and will be lost on resave.`:`${o} x14-only conditional formatting rules (types ${e}) are not read and will be lost on resave.`)}if(n){n.length>1&&n.sort((e,t)=>(e.priority??1/0)-(t.priority??1/0));for(let e=0;e<n.length;e++)delete n[e].priority}}}),d.registerVisitor({from:`customProperties`,to:`customProperties`,openTag:e=>{e.setSource([])},closeTag:e=>{let t=e.getSource();t.length>0&&(e.getParent().customProperties=t)}}),d.registerVisitor({from:`customPr`,to:{},openTag:e=>{let t=e.getParent();e.copyTo(`name`);let n=e.getAttribute(`r:id`);if(!n)return void e.warn(`A custom property names no part; it was not imported.`,{onceKey:`xlsx.sheet.customProperty.noRel`});let r=i(n,`resource`),a=e.getSource();a.resId=r,t.push(a)}}),d.registerVisitor({from:`sheetProtection`,to:`protection`,openTag:t=>{let n=t.getSource();for(let r of e.it){let i=t.hasAttribute(r.attribute)?t.getAttribute(r.attribute):null;n[r.key]=e.ot(r,i)}if(n.sheet)return;let r={};t.copyToObject(r,`hash`,X,`hashValue`),t.copyToObject(r,`algorithm`,X,`algorithmName`),t.copyToObject(r,`salt`,X,`saltValue`),t.copyToObject(r,`spinCount`,J),Object.keys(r).length>0&&(t.getSource().password=r)}}),d.registerVisitor({from:`protectedRanges`,to:`protectedRanges`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`protectedRange`,to:[],openTag:e=>{let t=e.getAttribute(`sqref`);t&&=t.trim().split(/\s+/).join(`,`);let n={},r={r:t,v:n};e.copyToObject(n,`name`),e.copyToObject(n,`securityDescriptor`);let i={};e.copyToObject(i,`hash`,X,`hashValue`),e.copyToObject(i,`algorithm`,X,`algorithmName`),e.copyToObject(i,`salt`,X,`saltValue`),e.copyToObject(i,`spinCount`,J),Object.keys(i).length>0&&(n.password=i),e.setSource(r)},closeTag:e=>{let t=e.getSource();t?.r&&t.v.name||e.setSource(void 0)}}),d.registerVisitor({from:`sheetFormatPr`,to:`sheetFormatPr`,openTag:e=>{e.copyToObject(n,`defaultColSize`,Y,`defaultColWidth`);let t=e.getAttribute(`customHeight`);t!==`1`&&t!==`true`||e.copyToObject(n,`defaultRowSize`,Y,`defaultRowHeight`)}}),d.registerVisitor({from:`cols`,to:`cols`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`col`,to:[],openTag:e=>{let t=e.getSource(),n=e.getAttribute(`min`),i=e.getAttribute(`max`),a=n===void 0?0:parseInt(n)-1,o=i===void 0?a:parseInt(i)-1;t.r=r.AddressUtils.runToString(a,o,!0);let s={};t.v=s,e.copyToObject(s,`sz`,Y,`width`),e.copyToObject(s,`csz`,q,`customWidth`),e.copyToObject(s,`h`,q,`hidden`),e.copyToObject(s,`l`,J,`outlineLevel`),e.copyToObject(s,`cl`,q,`collapsed`),e.copyToObject(s,`s`,J,`style`)}}),d.registerVisitor({from:`oleObjects`,to:null,openTag:e=>{e.warn(`'OLE Objects' are not supported.`)}});let H=!1,U=!1,ae=0,oe=``,se=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)};return je(h,n,d.createEventHandler(n,s,c),c,l,{onOpenTag:e=>{H=!0;let t=se(e.name);t===`t`||t===`v`?ae===0&&(U=!0):t!==`rPh`&&t!==`phoneticPr`||ae++},onText:e=>{U&&(oe+=e)},onCloseTag:e=>{let t=se(e.name);t===`t`||t===`v`?U=!1:t!==`rPh`&&t!==`phoneticPr`||ae>0&&ae--},onEnd:()=>{if(!H)return;let t=a(e.ut(oe));return H=!1,U=!1,ae=0,oe=``,t},onError:e=>{}},u)},Oe=class{static{this.Collapsed=1}static{this.CustomFormat=2}static{this.CustomHeight=4}static{this.Hidden=8}static{this.Ht=16}static{this.OutlineLevel=32}static{this.Ph=64}static{this.R=128}static{this.S=256}static{this.Spans=512}static{this.ThickBot=1024}static{this.ThickTop=2048}},ke=(e,t,n)=>{if(e[0].value[0]===e[1].value[0])return t},Ae={colStart:0,colEnd:0,rowStart:0,rowEnd:0},je=(e,t,n,i,a,o,s)=>{let c=!1,l=!1,u=[],d=!1,f=null,p=null,m=null,h=null,g=null,_=null,v=s?.get(`richData`)??r.CommonUtils.EmptyArray,y=s?.get(`dummyWrapped`)??null,b=r.AddressUtils.normalizeA1ToR1C1,x=r.CoordUtils.createConflatingRanges(),S=new Map,ee=[],C=!1,w=!1,T=null,te=!1,E=r.CoordUtils.createConflatingRanges(),D=!1,O=-1,k=-1,A=null,j=null,ne=null,re=[],M=null,N=-2,P=0,F=``,I=``,L=``,R=``,z=``,B=``,V=``,ie=``,H=``,U=``,ae=``,oe=``,se=``,ce=``,W=!0,le=null,ue=!1,de=!1,fe=!1,pe=null,me=0,he=e=>{let i=e.name,m=i.indexOf(`:`);if(m!==-1&&(i=i.slice(m+1)),me++,me%196608==0&&a?.(me),j){let t=e.attributes;switch(i){case`v`:l=!0;break;case`f`:switch(d=!0,t.t??null){case null:case`normal`:break;case`shared`:let e=t.si;p=t.ref,f=e;break;case`array`:p=t.ref,T=p;break;case`datatable`:p=t.ref,d=!0}let e=t.ca;e!==void 0&&(te=e===`1`);break;case`is`:D=!0;return}D&&!d&&o?.onOpenTag?.(e);return}if(c){if(i===`c`){j=e;let t=e.attributes,n=t.r;k=r.AddressUtils.fastStringToCol(n);let i=t.t;i===void 0?ne=null:(ne=i,ne===`str`&&(D=!0));let a=t.s;a===void 0&&(pe!==null||fe)&&(a=`0`),a!==void 0&&(a=parseInt(a),le&&le.value===a&&le.colEnd+1===k?le.colEnd=k:(le={colStart:k,rowStart:O,colEnd:k,rowEnd:O,value:a},u.push(le))),T=null,w=!1;let o=t.cm;C=o!==void 0&&(e=>{let t=s?.get(`metadata`)?.cells;if(!t)return!1;let n=parseInt(e,10);return!(!Number.isFinite(n)||n<1)&&!0===t[n-1]?.get(`XLDAPR`)?.fDynamic})(o);let c=t.vm;if(c!==void 0){let e=v[parseInt(c)-1];if(r.FormulaError.isError(e)){let t=e.getCode();A={t:`e`,v:t},C&&t===r.FormulaError.Code.Spill&&(w=!0)}}}}else{if(de&&i===`row`){c=!0;let t=e.attributes.r;if(O=parseInt(t)-1,P=0,I=e.attributes.customHeight,I!==void 0&&(P|=Oe.CustomHeight),I!==H&&(W=!0,H=I),F=e.attributes.ht,F!==void 0&&(P|=Oe.Ht),F!==ie&&(W=!0,ie=F),L=e.attributes.hidden,L!==void 0&&(P|=Oe.Hidden),L!==U&&(W=!0,U=L),z=e.attributes.s,z!==void 0&&(P|=Oe.S),z!==oe&&(W=!0,oe=z),R=e.attributes.customFormat,R!==void 0&&(P|=Oe.CustomFormat),R!==ae&&(W=!0,ae=R),B=e.attributes.outlineLevel,B!==void 0&&(P|=Oe.OutlineLevel),B!==se&&(W=!0,se=B),V=e.attributes.collapsed,V!==void 0&&(P|=Oe.Collapsed),V!==ce&&(W=!0,ce=V),P!==0)if(N+1!==O||W){let e=I!==void 0&&(I===`1`||I===`true`),t=R!==void 0&&(R===`1`||R===`true`);pe=t&&z!==void 0?z:null,t&&pe===null&&(pe=`0`),M={min:O,max:O,value:{sz:F===void 0?-1:parseFloat(F),csz:e,h:L!==void 0&&(L===`1`||L===`true`),s:pe===null?void 0:pe===`0`?0:parseInt(pe),l:B===void 0||B===`0`?0:parseInt(B),cl:V!==void 0&&(V===`1`||V===`true`)}},re.push(M)}else M.max=O;N=O,W=!1;return}if(i===`sheetData`&&(de=!0),!ue&&i===`sheetData`){ue=!0;let e=t.cols,n=e?e.length:0;for(let t=0;!fe&&t<n;t++)e[t].v.s&&(fe=!0)}n?.onOpenTag?.(e)}},ge=t=>{let r=t.name;if(r===`sheetData`&&(de=!1),!d||r!==`c`&&r!==`f`||(f&&(h=S.get(f)??null),h&&(x.append(O,k,h),te&&E.append(O,k)),T!==null&&ee.push([T,C?w?`error`:`dynamic`:`fixed`]),d=!1,h=null,f=null,p=null,l=!1,te=!1,T=null,C=!1,w=!1),j){let n=r.indexOf(`:`);if(n!==-1&&(r=r.slice(n+1)),D)if(r===`is`||r===`v`){let t=o?.onEnd?.();t!=null&&e.pushAt(O,k,``+t)}else r!==`f`&&o?.onCloseTag?.(t);l&&=!1,r===`c`&&(j=null,D=!1);return}if(c)return c=!1,void(le=null);n?.onCloseTag?.(t)},_e=a=>{let s=a.trim();if(l){switch(A=null,ne){case null:case`n`:A=parseFloat(s);break;case`b`:A=s===`1`||s===`true`;break;case`s`:A=s;break;case`e`:if(s===`#VALUE!`){let e=j.attributes.vm;if(e!==void 0){let t=v[parseInt(e)-1];if(r.FormulaError.isError(t)){A={t:`e`,v:t.getCode()};break}}}let e=r.FormulaError.getBuiltInByLabel(s);e?A={t:`e`,v:e.getCode()}:(A=s,i?.(`Unknown formula error '${s}' in cell ${r.AddressUtils.cellToString({colIndex:k,rowIndex:O})}`));break;case`str`:case`inlineStr`:D=!0}A!==null&&e.pushAt(O,k,A)}if(f){if(g===f)h=_;else{if(h=S.get(f)??null,!h){let e=[];m=b(s,O,k,e),h=[m,e,s],S.set(f,h)}g=f,_=h}f=null}if(d){if(y!==null){let e=(e=>{if(e.length<ye.length||e.slice(0,ye.length).toUpperCase()!==be)return Se;let t=we(e,ye.length);if(t===null||e.charCodeAt(t.end)!==41||e.charCodeAt(t.end+1)!==44||e.charCodeAt(e.length-1)!==41)return Se;let n=t.value;return n.toUpperCase()===xe?Ce:n.length===0?Se:{kind:`formula`,formula:n}})(s);e.kind!==`none`&&y.push({sheet:t,rowIndex:O,colIndex:k,formula:e.kind===`formula`?e.formula:null})}let e=[];m=b(s,O,k,e),h=[m,e,s]}D?o?.onText?.(a):c||n?.onText?.(s)},G={r:void 0,t:void 0,s:void 0,cm:void 0,vm:void 0},q={name:`c`,attributes:G,isSelfClosing:!1},J={t:void 0,si:void 0,ref:void 0,ca:void 0},Y={name:`f`,attributes:J,isSelfClosing:!1},X={name:`v`,attributes:{},isSelfClosing:!1},Z={r:void 0,s:void 0,ht:void 0,hidden:void 0,collapsed:void 0,customHeight:void 0,customFormat:void 0,outlineLevel:void 0},ve={name:`row`,attributes:Z,isSelfClosing:!1},Q=K.NEED_MORE,$=K.NOT_HANDLED,Te=K.decodeText,Ee=!1,De=(e,t,n,r)=>{for(;;){let i=0;for(;t<n&&((i=e.charCodeAt(t))===32||i===9||i===10||i===13);)t++;if(t>=n)return Q;if(i===62)return Ee=!1,t+1;if(i===47)return t+1>=n?Q:e.charCodeAt(t+1)===62?(Ee=!0,t+2):$;let a=t;for(;t<n&&(i=e.charCodeAt(t))!==61;){if(i===62||i===47||i===32||i===9||i===10||i===13)return $;t++}if(t+1>=n)return Q;let o=t-a,s=e.charCodeAt(t+1);if(s!==34&&s!==39)return $;let c=t+2,l=c;for(;l<n&&(i=e.charCodeAt(l))!==s;){if(i===38||i<32)return $;l++}if(l>=n)return Q;t=l+1;let u=e.charCodeAt(a);if(r===2)switch(o){case 1:u===114?Z.r=e.slice(c,l):u===115&&(Z.s=e.slice(c,l));break;case 2:e.startsWith(`ht`,a)&&(Z.ht=e.slice(c,l));break;case 6:e.startsWith(`hidden`,a)&&(Z.hidden=e.slice(c,l));break;case 9:e.startsWith(`collapsed`,a)&&(Z.collapsed=e.slice(c,l));break;case 12:e.startsWith(`customHeight`,a)?Z.customHeight=e.slice(c,l):e.startsWith(`customFormat`,a)?Z.customFormat=e.slice(c,l):e.startsWith(`outlineLevel`,a)&&(Z.outlineLevel=e.slice(c,l))}else if(r===0)o===1?u===114?G.r=e.slice(c,l):u===116?G.t=e.slice(c,l):u===115&&(G.s=e.slice(c,l)):o===2&&e.charCodeAt(a+1)===109&&(u===99?G.cm=e.slice(c,l):u===118&&(G.vm=e.slice(c,l)));else if(o===1)u===116&&(J.t=e.slice(c,l));else if(o===2){let t=e.charCodeAt(a+1);u===115&&t===105?J.si=e.slice(c,l):u===99&&t===97&&(J.ca=e.slice(c,l))}else o===3&&e.startsWith(`ref`,a)&&(J.ref=e.slice(c,l))}},Ae=(e,t,n)=>e.charCodeAt(t+1)===47&&e.charCodeAt(t+2)===n&&e.charCodeAt(t+3)===62;return{...n,onEnd:()=>{re.length>0&&(t.rows=r.AddressUtils.runsToRefs(re,!1));let i=x.done(ke),a=i.length;if(a>0){let e=Array(a);for(let t=0;t<a;t++){let n=i[t],a=r.AddressUtils.rangeToString(n),o=n.value[1];e[t]=[a,r.AddressUtils.resolveRelativeToA1(o,n.rowStart,n.colStart)]}t.formulas=e}let o=E.done(!0),s=o.length;if(s>0){let e=Array(s);for(let t=0;t<s;t++){let n=o[t];e[t]=r.AddressUtils.rangeToString(n)}t.volatile=e}ee.length>0&&(t.formulaArray=[...ee]);let c=u.length;if(c>0){u.sort(r.CoordUtils.createRangeComparator(r.IRange.Axis.Column));let e=u[0],n=e.colStart,i=e.colEnd,a=e.rowEnd,o=e.value,s=[];s.push(e);let l=null;for(let t=1;t<c;t++)l=u[t],o!==l.value||n!==l.colStart||i!==l.colEnd||a+1!==l.rowEnd?(s.push(l),e=l,n=e.colStart,i=e.colEnd,a=e.rowEnd,o=e.value):(a=l.rowEnd,e.rowEnd=a);let d=s.length,f=Array(d);for(let e=0;e<d;e++){let t=s[e];f[e]=[r.AddressUtils.rangeToString(t),t.value]}t.directStyles=f}let l=e.build();l&&(t.data=l.tuples),n?.onEnd?.()},onOpenTag:he,onCloseTag:ge,onText:_e,elementScanners:[{name:`c`,scan:(e,t,n)=>{if(!c||j!==null)return $;G.r=G.t=G.s=G.cm=G.vm=void 0;let r=De(e,t+2,n,0);if(r<0)return r;let i=G.t;if(G.r===void 0||i===`str`||i===`inlineStr`)return $;let a=!1,o=-1,s=-1,l=-1,u=-1,d=r;if(!Ee)for(J.t=J.si=J.ref=J.ca=void 0;;){let t=e.indexOf(`<`,r);if(t===-1||t+3>=n)return Q;for(let n=r;n<t;n++){let t=e.charCodeAt(n);if(t!==32&&t!==9&&t!==10&&t!==13)return $}let i=e.charCodeAt(t+1),c=e.charCodeAt(t+2);if(i===47){if(!Ae(e,t,99))return $;d=t+4;break}if(i===102&&!a&&l===-1&&(c===32||c===62||c===47)){if(a=!0,r=De(e,t+2,n,1),r<0)return r;if(Ee)continue;let i=e.indexOf(`<`,r);if(i===-1||i+3>=n)return Q;if(!Ae(e,i,102))return $;o=r,s=i,r=i+4;continue}if(i===118&&c===62&&l===-1){let i=e.indexOf(`<`,t+3);if(i===-1||i+3>=n)return Q;if(!Ae(e,i,118))return $;l=t+3,u=i,r=i+4;continue}return $}return he(q),a&&(he(Y),s>o&&_e(Te(e.slice(o,s))),ge(Y)),l!==-1&&(he(X),u>l&&_e(Te(e.slice(l,u))),ge(X)),ge(q),d}},{name:`row`,openTag:ve,scan:(e,t,n)=>{if(!de||c||j!==null)return $;Z.r=Z.s=Z.ht=Z.hidden=Z.collapsed=Z.customHeight=Z.customFormat=Z.outlineLevel=void 0;let r=De(e,t+4,n,2);return r<0?r:Ee||Z.r===void 0?$:(he(ve),r)}}]}},Me=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)},Ne={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":`workbooks`,"application/vnd.ms-excel.sheet.macroEnabled.main+xml":`workbooks`,"application/vnd.ms-excel.sheet.binary.macroEnabled.main":`workbooks`,"application/vnd.ms-excel.addin.macroEnabled.main+xml":`workbooks`,"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":`workbooks`,"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":`sheets`,"application/vnd.ms-excel.worksheet":`sheets`,"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":`charts`,"application/vnd.ms-excel.chartsheet":`charts`,"application/vnd.ms-excel.macrosheet+xml":`macros`,"application/vnd.ms-excel.macrosheet":`macros`,"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":`dialogs`,"application/vnd.ms-excel.dialogsheet":`dialogs`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":`strs`,"application/vnd.ms-excel.sharedStrings":`strs`,"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":`styles`,"application/vnd.ms-excel.styles":`styles`,"application/vnd.openxmlformats-package.core-properties+xml":`coreprops`,"application/vnd.openxmlformats-officedocument.custom-properties+xml":`custprops`,"application/vnd.openxmlformats-officedocument.extended-properties+xml":`extprops`,"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":`comments`,"application/vnd.ms-excel.comments":`comments`,"application/vnd.ms-excel.threadedcomments+xml":`threadedcomments`,"application/vnd.ms-excel.person+xml":`people`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":`metadata`,"application/vnd.ms-excel.sheetMetadata":`metadata`,"application/vnd.ms-excel.externalLink":`links`,"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":`links`,"application/vnd.openxmlformats-officedocument.theme+xml":`themes`},Pe=e=>e.startsWith(`/`)?e.slice(1):e,Fe=/^xl\/(worksheets|chartsheets)\/[^/]+\.xml$/i,Ie=e=>typeof e==`string`?e:(e?.runs??[]).map(e=>e.text??``).join(``);exports.readXLSX=async(i,s)=>{let{password:c,onVBA:l,profile:u,calcOnLoad:d=`auto`,createWorkbookOptions:f={},...p}=s??{},m=!!f.origin&&typeof f.origin!=`string`,h=u?new o(typeof u==`function`?u:void 0):null,g=[],_=(e,t,n)=>{g.push([e,t??``,n])},v={onWarning:_},y=s?.progress,b=y?.onProgress?y.onProgress.bind(y):void 0,x=i.byteLength,S=0,ee=0,C=b?e=>{if(S<=0)return;ee+=e;let t=Math.min(x,Math.round(ee/S*x));b(t,x)}:void 0,w=Promise.resolve().then(()=>require("./B0Ugu_crqQYpdfQz.cjs")),T=null;try{T=new DOMParser}catch{}let te=null;try{te=new XMLSerializer}catch{}let E,D,O,k=null;T||(k=Promise.resolve().then(()=>e.en(require("./BHWdwAQ322YA8JAZ.cjs").default,1)));try{let[e,t]=await Promise.all([k,w]);E=new t.DOMTransformer,D=T??new e.DOMParser,O=te??new e.XMLSerializer}catch(e){throw Error(`Unable to load XLSX parser.`,{cause:e})}let A=e=>O.serializeToString(e),j;try{j=await a.create(i)}catch(e){throw new n.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`,{cause:e})}h?.mark(`zip-open`);try{if(!j.has(`[Content_Types].xml`))throw new n.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`);let i=e=>{let t=j.getEntry(e);return t?{content:t}:void 0},a={workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],metadata:[],people:[],overrides:{},sst:``,style:``,defaults:{}};{let e=((e,t)=>({onOpenTag:t=>{let n=(e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)})(t.name),r=t.attributes;if(n===`Override`){let t=r.ContentType,n=r.PartName;if(!t||!n)return;e.overrides[n.startsWith(`/`)?n.slice(1):n]=t;let i=Ne[t],a=i?e[i]:void 0;Array.isArray(a)&&a.push(n)}else if(n===`Default`){let t=r.Extension,n=r.ContentType;t&&(e.defaults[t.toLowerCase()]=n)}},onEnd:()=>{e.sst=e.strs.length>0?e.strs[0]:``,e.style=e.styles.length>0?e.styles[0]:``},onError:e=>{t?.(`Error parsing content types: ${e?.message??e}`)}}))(a,e=>{g.push([e,`[Content_Types].xml`])}),t=await j.getTextStream(`[Content_Types].xml`);if(!t)throw Error(`Error parsing content types: '[Content_Types].xml'`);try{await W.parseStream(t,e,{xmlns:!1})}catch(e){throw Error(`Error parsing content types: '[Content_Types].xml'`,{cause:e})}m&&await j.getBuffer(`[Content_Types].xml`)}h?.mark(`content-types`);let o=a.sst,s=new Set;for(let e of a.sheets)s.add(Pe(e));o&&s.add(Pe(o));for(let e of s)S+=j.uncompressedSize(e);if(await j.prefetch(e=>!s.has(e)&&!Fe.test(e)),h?.mark(`prefetch-side-parts`),a.workbooks.length===0){let e=t.r(`_rels/.rels`,i,D,E,v);if(e){for(let t of e.values())if(t.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`&&t.target){a.workbooks.push(t.target);break}}}if(a.workbooks.length===0)throw new n.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`);a.richstructure=[`/xl/richData/rdrichvaluestructure.xml`],a.richdata=[`/xl/richData/rdrichvalue.xml`];let c=f?.resources??new r.ResourceCollection,p=c.beginPersist(),ee={},w=new Set,T=new Map;T.set(`richTypes`,[]),T.set(`parseInlineDxf`,t=>{if(!t)return;let n=D.parseFromString(`<dxf xmlns:x14="${e.qt}" xmlns:xm="${e.Jt}">${t}</dxf>`,`text/xml`)?.documentElement;if(!n)return;let r=E.parseDxf(n,``,v);return Object.keys(r).length>0?r:void 0});let te=[];T.set(`dummyWrapped`,te);let O=t.o(`metadata`,a,i,D,E,v).entries().next()?.value?.[1]?.metadata;O&&T.set(`metadata`,O),T.set(Ee,e.Et());let k=new Map,ne=[],re=new Set,M=e=>{re.add(Pe(e))},N=(e,n=k)=>{let r=e.lastIndexOf(`/`),a=e.substring(0,r+1)+`_rels/`+e.substring(r+1,e.length)+`.rels`,o=n.get(a);return o||(o=t.r(a,i,D,E,H),n.set(a,o)),o},P=(n,r,a,o=k)=>{let s=N(r,o).get(n),l=s?.target;if(!l)return null;if(s.targetMode===`External`){if(!a)return s.target;let e=c.add({source:{external:s.target}});return e.addReference(ee),w.add(e),p.toResourceId(e)}let u=r.lastIndexOf(`/`),d=r.substring(0,u+1);l.startsWith(`/`)||(l=d+l),l=t.l(l);let f=E?.getVisitorParamsState().get(`dxfs`),m=o.get(l);if(!m)if(s.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`){let t={};m=t,ne.push((async()=>{let n=De(t,(e,t)=>t===`legacyDrawing`?L(e,l):t===`formControl`?R(e,l):t===`part`?z(e,l):P(e,l,t===`resource`)??null,ce,f,()=>{},(e,t,n)=>{_(e,t?`${t} (${l})`:l,n)},void 0,T),r=await j.getTextStream(l,C);if(r)try{await W.parseStream(r,n,{xmlns:!1,lean:!0})}catch(e){throw Error(`Error parsing sheet: '${l}'`,{cause:e})}let i=N(l,o);if(i){I(t,l,i,o),e.p(t);let n=[];i.forEach((t,r)=>{if(t.type!==`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`)return;let i=z(r,l,t.type,e=>e!==`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`);if(!i?.xml)return;let a=/<pivotTableDefinition\b[^>]*>/.exec(i.xml)?.[0]??``,o=parseInt(/\scacheId="(\d+)"/.exec(a)?.[1]??``,10);if(isNaN(o))return void g.push([`Pivot table '${i.name}' names no cache and was dropped.`,l]);let s=/\sname="([^"]*)"/.exec(a)?.[1];n.push({...s?{name:e.At(s)}:{},cacheId:o,part:i})}),n.length>0&&(t.pivotTables=n)}})())}else if(s.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink`){let e=t.a(l,i,D,E,H);if(e&&Object.keys(e).length!==0){let t=e,n=t.__bookRelId,r=t.__absoluteUrlRelId;delete t.__bookRelId,delete t.__absoluteUrlRelId;let i=[];N(l,o)?.forEach((e,t)=>{if(e.targetMode===`External`&&e.type&&e.target){let a={type:e.type,target:e.target};t===n?a.role=`book`:t===r&&(a.role=`absoluteUrl`),i.push(a)}}),i.sort((e,t)=>(e.role===`book`?0:1)-(t.role===`book`?0:1)),t.sources=i,M(l),m=t}else m=null}else m=a?t.i(l,i,(e,t)=>{let n=c.add({source:{buffer:e}});return n.addReference(ee),w.add(n),p.toResourceId(n)},H):t.a(l,i,D,E,H);return m},F=(e,n)=>{if(!e)return null;let r=N(n,k)?.get(e);if(!r?.target||r.targetMode===`External`)return null;let i=r.target;return i.startsWith(`/`)||(i=n.substring(0,n.lastIndexOf(`/`)+1)+i),t.l(i)},I=(i,a,o,s)=>{let c=[],l=new Map,u=[];o.forEach((e,t)=>{if(e.type!==`http://schemas.microsoft.com/office/2017/10/relationships/threadedComment`)return;let n=P(t,a,!1,s)?.comments;if(!n)return;for(let e=0;e<n.length;e++){let t=n[e];if(!t?.v?.id)continue;let{parentId:r,done:i,content:a,...o}=t.v,s={...o,content:Ie(a)};r?u.push({parentId:r,json:s}):(i&&(s.done=!0),l.set(s.id,s),c.push({r:t.r,v:s}))}let r=F(t,a);r&&M(r)});for(let e=0;e<u.length;e++){let{parentId:t,json:n}=u[e],r=l.get(t);r&&(r.replies??=[]).push(n)}let d=[];if(o.forEach((e,r)=>{if(e.type!==`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`)return;let i=P(r,a,!1,s),o=i?.comments;if(!o)return;let c=i?.authors;for(let e=0;e<o.length;e++){let r=o[e];if(!r?.r)continue;let i=c&&r.v.authorId!==void 0?c[r.v.authorId]:void 0;if(i&&i.startsWith(`tc=`)){if(l.has(t.c(i.substring(3))))continue;i=void 0}let a={id:n.CommonUtils.uuidV4().toUpperCase(),asNote:!0,content:r.v.content??``},s=i?ie({displayName:i}):void 0;s&&(a.personId=s.id),d.push({r:r.r,v:a})}let u=F(r,a);u&&M(u)}),c.length===0&&d.length===0)return;let f=[...c,...d],p=i.legacyDrawing;if(p?.xml){let{rest:t,notes:n}=e.s(p.xml);if(n.length>0){let a=new Map;for(let e=0;e<n.length;e++){let t=n[e];a.set(r.AddressUtils.cellToString({rowIndex:t.row,colIndex:t.col}),t)}for(let t=0;t<f.length;t++){let n=f[t],r=a.get(String(n.r).toUpperCase());if(!r||(a.delete(String(n.r).toUpperCase()),!n.v.asNote))continue;let i=e.o(r.xml),o={};if(i.anchor){let[e,t,n,a,s,c,l,u]=i.anchor;o.anchor={tl:{c:e-r.col,x:t,r:n-r.row,y:a},br:{c:s-r.col,x:c,r:l-r.row,y:u}}}i.xml&&(o.xml=i.xml),(o.anchor||o.xml)&&(n.v.box=o),i.visible&&(n.v.shown=!0),i.alt&&(n.v.description=i.alt)}let o=[];a.forEach(e=>{o.push(e.xml)});let s=e.i(t,o);s?p.xml=s:delete i.legacyDrawing}}i.comments=f},L=(e,t)=>{let n=F(e,t);if(!n)return null;let r=i(Pe(n));if(!r)return null;let a={xml:new TextDecoder(`utf-8`).decode(r.content)},o=[];return N(n,k)?.forEach((e,t)=>{if(e.type!==`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`)return;let r=P(t,n,!0);typeof r==`number`&&o.push({id:t,resId:r})}),o.length>0&&(a.images=o),M(n),a},R=(e,n)=>{let r=F(e,n);if(!r)return null;let a=t.a(r,i,D,E,H)?.formControl??null;return a&&M(r),a},z=(e,t,n,r,o=new Set)=>{let s=F(e,t);if(!s||o.has(s))return null;let c=n??N(t,k)?.get(e)?.type;if(!c)return null;let l=i(Pe(s));if(!l)return null;o.add(s);let u=s.substring(s.lastIndexOf(`/`)+1),d=a.overrides[Pe(s)]??a.defaults[u.substring(u.lastIndexOf(`.`)+1).toLowerCase()],f={id:e,type:c,name:u};if(d&&(f.contentType=d),((e,t)=>e?e.endsWith(`+xml`)||e===`application/xml`:/\.(xml|rels|vml)$/i.test(t))(d,u))f.xml=new TextDecoder(`utf-8`).decode(l.content);else{let n=P(e,t,!0);if(typeof n!=`number`)return null;f.resId=n}let p=[];return N(s,k)?.forEach((e,t)=>{if(!e?.type||r&&!r(e.type))return;if(e.targetMode===`External`){let n=P(t,s,!0);typeof n==`number`&&p.push({id:t,type:e.type,resId:n});return}let n=z(t,s,e.type,r,o);n&&p.push(n)}),p.length>0&&(f.parts=p),M(s),f};t.o(`coreprops`,a,i,D,E,v),t.o(`extprops`,a,i,D,E,v);let B=new r.PersonCollection,V=t.o(`people`,a,i,D,E,v);if(V.size>0){let[e,t]=V.entries().next().value;B.fromJSON(t?.persons),M(e)}let ie=e=>{if(e)return B.add(e).toJSON()},H={paramMap:T,getRefs:N,getRef:P,parsedRefs:k,readEmbeddedPart:(e,t)=>z(e,t),addPerson:ie,serializeElement:A,onWarning:_},U=[];if(o){let t=await j.getTextStream(o,C);if(t){let n=((t,n)=>{let r=!1,i=!1,a=0,o=``;return{onOpenTag:e=>{let t=Me(e.name);t===`t`?r&&a===0&&(i=!0):t===`si`?(r=!0,o=``,a=0):t!==`rPh`&&t!==`phoneticPr`||a++},onText:e=>{i&&(o+=e)},onCloseTag:n=>{let s=Me(n.name);s===`t`?i=!1:s===`si`?(t(e.ut(o)),r=!1,o=``):s!==`rPh`&&s!==`phoneticPr`||a>0&&a--},onError:e=>{n?.(`Error parsing shared strings: ${e?.message??e}`)}}})(e=>{U.push(e)},e=>{_(e,o)});try{await W.parseStream(t,n,{xmlns:!1})}catch(e){throw Error(`Error parsing shared strings: '${o}'`,{cause:e})}}}h?.mark(`shared-strings`);let ae=U.length,oe=new Map,se=ae,ce=e=>{let t=oe.get(e);if(t!==void 0)return t;let n=se;return oe.set(e,se++),U.push(e),n},le=[];a.slicersCache=le;let ue=j.getNames(),de=ue.length;for(let e=0;e<de;e++){let t=ue[e];t&&t.startsWith(`xl/slicerCache`)&&le.push(`/${t}`)}let fe=t.o(`slicersCache`,a,i,D,E,H),pe=new Map;fe.forEach(e=>{let t=e.name;delete e.name,pe.set(t,e)}),T.set(`slicerCaches`,pe),t.o(`richstructure`,a,i,D,E,H),t.o(`richdata`,a,i,D,E,H);let me=t.o(`themes`,a,i,D,E,H),he=null;if(me&&me.entries){let e=me.entries().next();e?.value?.[1]&&(he=e.value[1])}let ge=new r.Theme(he),_e=t.o(`styles`,a,i,D,E,H).entries().next()?.value?.[1];_e&&=JSON.parse(n.BufferUtils.JSONStableStringify(_e));let G=t.o(`workbooks`,a,i,D,E,H);h?.mark(`side-parts-json`),await Promise.all(ne);{let t=G.entries().next().value?.[1],n=e.Et(t?.names),r=t?.sheets??[];for(let t=0;t<r.length;t++){let i=r[t]?.sheet;i&&e.Dt(i,n)}let i=t?.names;if(i)for(let e=0;e<i.length;e++){let t=i[e]?.ref;typeof t==`string`&&(i[e].ref=n.readDetached(t))}}b&&S>0&&(b(x,x),await new Promise(e=>setTimeout(e,0))),h?.mark(`sheets`);let K={...G.entries().next().value?.[1],styles:_e,theme:ge.toJSON()};t.n(K,T.get(t.t)),K.calc={...K.calc??{},legacyIntersect:!0},U.length>0&&(K.strings=U);let q=B.toJSON();q&&q.length>0&&(K.people=q);let J=j.getEntry(`xl/vbaProject.bin`);if(J)try{let{VBAProject:e}=await Promise.resolve().then(()=>require("./D3EWCPfCu-qMOIGd.cjs")),t=e.extract(J);if(t){let n=new Map;for(let e of K.sheets??[]){let t=e?.sheet?.codeName;t&&n.set(t,e.sheet)}for(let r of t.modules){let t={language:`vba`},{header:i,body:a}=e.splitAttributes(r.code);a&&(t.source=a),i&&(t.sourceHeader=i);let o=r.type===`document`?n.get(r.name):void 0;o||r.type!==`document`||(t.scope=`workbook`);let s=o?o.modules??={}:K.modules??={};s[r.name]||(s[r.name]=t)}l?.(t)}else g.push([`Unable to parse VBA project.`,`xl/vbaProject.bin`])}catch(e){g.push([`Error extracting VBA: ${e?.message??e}`,`xl/vbaProject.bin`])}let Y=T.get(`calcId`),X=Y===void 0||!(Number(Y)>=191029),Z=f.calcOnLoad??(d===`auto`&&X?`full`:d),ve={...f,calcOnLoad:Z,resources:c,json:K};ve.disableLoadAutoFit===void 0&&(ve.disableLoadAutoFit=!1),h?.mark(`json-assembled`);let Q=new r.Workbook(ve);if(h?.mark(`workbook-constructed`),te.length>0&&Z!==`none`){await Q.whenCalculationReady();let e=new Map,t=K.sheets??[],n=Q.getSheets().getItems();for(let r=0;r<t.length;r++){let i=t[r]?.sheet,a=n[r];i&&a&&e.set(i,a)}((e,t,n)=>{if(t.length===0)return;let r=e.getCalculation().getFunctions(),i=new Map,a=e=>{let t=i.get(e);return t===void 0&&(t=r.getByName(e)!==null,i.set(e,t)),t},o=new Map;for(let e of t){let t=o.get(e.sheet);t||(t=[],o.set(e.sheet,t)),t.push(e)}for(let[e,t]of o){let r=n.get(e);if(!r)continue;let i=(e,t)=>`${e},${t}`,o=new Set;for(let e of t)e.formula===null&&o.add(i(e.rowIndex,e.colIndex));for(let e of t){if(e.formula===null)continue;let t=$(e.formula),n=!0;for(let e of t)if(!a(e)){n=!1;break}if(!n)continue;let s=[],c=[[e.rowIndex,e.colIndex]],l=new Set([i(e.rowIndex,e.colIndex)]);for(;c.length>0;){let[e,t]=c.pop(),n=[[e+1,t],[e-1,t],[e,t+1],[e,t-1]];for(let[e,t]of n){let n=i(e,t);!l.has(n)&&o.has(n)&&(l.add(n),s.push([e,t]),c.push([e,t]))}}for(let[e,t]of s)o.delete(i(e,t)),r.getRange({rowStart:e,colStart:t,rowEnd:e,colEnd:t}).clear();r.getRange({rowStart:e.rowIndex,colStart:e.colIndex,rowEnd:e.rowIndex,colEnd:e.colIndex}).setValue(`=`+e.formula)}}})(Q,te,e)}if(w.forEach(e=>{e.deleteReference(ee)}),p.endPersist(),m){e.Ct(Q);let t=new Map,n=0;for(let e of j.getNames()){let r=j.getEntry(e);if(!r)continue;let i=j.getRawEntry(e),a=i?{data:r,uncompressedSize:j.uncompressedSize(e),raw:{compressedData:i.data,compressionMethod:i.compressionMethod,signature:i.signature}}:{data:r,uncompressedSize:j.uncompressedSize(e)};t.set(e,a),n+=r.byteLength}if(n>67108864)g.push([`Source package too large to retain (${n} bytes, limit ${e.bt}); unmodeled parts will be dropped on save.`,`SourcePackage`]);else if(t.size>0){let n=new e.xt(t,re);e.wt(Q,n);let r=Q.getSheets().getItems(),i=Q.getTransactions().addListener({onCommitEnd:e=>{let t=e.getOperation()?.name;t!==`insertCells`&&t!==`deleteCells`||n.markStructuralChange()}}),a=Q.addListeners({onSheetsChange:()=>{let e=Q.getSheets().getItems();(e.length!==r.length||e.some((e,t)=>e!==r[t]))&&n.markStructuralChange(),r=e}});Q.addListeners({onClose:()=>{i(),a(),e.Ct(Q)}})}}if(g.length&&y?.onWarning){let e=new Set;for(let t of g){let[n,r,i]=t,a=i??n;e.has(a)||(e.add(a),y.onWarning(n,r))}}return h&&!0===u&&console.table(h.toTable()),Q}catch(e){let t=`Unable to parse XLSX.`;throw e instanceof r.OutOfBoundsError&&(t=`Unable to open XLSX. There are too many rows or columns.`),Error(t,{cause:e})}finally{await j.close().catch(()=>{})}};
|