UNPKG

@grapecity/activereports

Version:

ActiveReportsJS

8 lines 1.58 MB
/*! * @grapecity/activereports 5.2.5 * Description: ActiveReportsJS * https://www.npmjs.com/package/@grapecity/activereports * Copyright ©️ Respective Holders. All rights reserved. * Licensed under the Commercial license */ (function(wr,ci){typeof exports=="object"&&typeof module<"u"?ci(exports):typeof define=="function"&&define.amd?define(["exports"],ci):(wr=typeof globalThis<"u"?globalThis:wr||self,ci((wr.GC=wr.GC||{},wr.GC.ActiveReports=wr.GC.ActiveReports||{},wr.GC.ActiveReports.XlsxExport={})))})(this,(function(wr){"use strict";function ci(R,w){for(var f=0;f<w.length;f++){const c=w[f];if(typeof c!="string"&&!Array.isArray(c)){for(const v in c)if(v!=="default"&&!(v in R)){const s=Object.getOwnPropertyDescriptor(c,v);s&&Object.defineProperty(R,v,s.get?s:{enumerable:!0,get:()=>c[v]})}}}return Object.freeze(Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}))}function Qr(R){return R&&R.__esModule&&Object.prototype.hasOwnProperty.call(R,"default")?R.default:R}function zf(R){if(Object.prototype.hasOwnProperty.call(R,"__esModule"))return R;var w=R.default;if(typeof w=="function"){var f=function c(){return this instanceof c?Reflect.construct(w,arguments,this.constructor):w.apply(this,arguments)};f.prototype=w.prototype}else f={};return Object.defineProperty(f,"__esModule",{value:!0}),Object.keys(R).forEach(function(c){var v=Object.getOwnPropertyDescriptor(R,c);Object.defineProperty(f,c,v.get?v:{enumerable:!0,get:function(){return R[c]}})}),f}var xn={exports:{}},Vf;function ep(){return Vf||(Vf=1,(function(R){var w=(function(f){var c=Object.prototype,v=c.hasOwnProperty,s=Object.defineProperty||function(S,E,C){S[E]=C.value},h,a=typeof Symbol=="function"?Symbol:{},r=a.iterator||"@@iterator",t=a.asyncIterator||"@@asyncIterator",e=a.toStringTag||"@@toStringTag";function o(S,E,C){return Object.defineProperty(S,E,{value:C,enumerable:!0,configurable:!0,writable:!0}),S[E]}try{o({},"")}catch{o=function(E,C,k){return E[C]=k}}function i(S,E,C,k){var P=E&&E.prototype instanceof A?E:A,H=Object.create(P.prototype),J=new g(k||[]);return s(H,"_invoke",{value:B(S,C,J)}),H}f.wrap=i;function n(S,E,C){try{return{type:"normal",arg:S.call(E,C)}}catch(k){return{type:"throw",arg:k}}}var u="suspendedStart",l="suspendedYield",d="executing",m="completed",_={};function A(){}function T(){}function N(){}var L={};o(L,r,function(){return this});var q=Object.getPrototypeOf,F=q&&q(q(y([])));F&&F!==c&&v.call(F,r)&&(L=F);var j=N.prototype=A.prototype=Object.create(L);T.prototype=N,s(j,"constructor",{value:N,configurable:!0}),s(N,"constructor",{value:T,configurable:!0}),T.displayName=o(N,e,"GeneratorFunction");function $(S){["next","throw","return"].forEach(function(E){o(S,E,function(C){return this._invoke(E,C)})})}f.isGeneratorFunction=function(S){var E=typeof S=="function"&&S.constructor;return E?E===T||(E.displayName||E.name)==="GeneratorFunction":!1},f.mark=function(S){return Object.setPrototypeOf?Object.setPrototypeOf(S,N):(S.__proto__=N,o(S,e,"GeneratorFunction")),S.prototype=Object.create(j),S},f.awrap=function(S){return{__await:S}};function z(S,E){function C(H,J,D,U){var I=n(S[H],S,J);if(I.type==="throw")U(I.arg);else{var O=I.arg,V=O.value;return V&&typeof V=="object"&&v.call(V,"__await")?E.resolve(V.__await).then(function(W){C("next",W,D,U)},function(W){C("throw",W,D,U)}):E.resolve(V).then(function(W){O.value=W,D(O)},function(W){return C("throw",W,D,U)})}}var k;function P(H,J){function D(){return new E(function(U,I){C(H,J,U,I)})}return k=k?k.then(D,D):D()}s(this,"_invoke",{value:P})}$(z.prototype),o(z.prototype,t,function(){return this}),f.AsyncIterator=z,f.async=function(S,E,C,k,P){P===void 0&&(P=Promise);var H=new z(i(S,E,C,k),P);return f.isGeneratorFunction(E)?H:H.next().then(function(J){return J.done?J.value:H.next()})};function B(S,E,C){var k=u;return function(H,J){if(k===d)throw new Error("Generator is already running");if(k===m){if(H==="throw")throw J;return x()}for(C.method=H,C.arg=J;;){var D=C.delegate;if(D){var U=M(D,C);if(U){if(U===_)continue;return U}}if(C.method==="next")C.sent=C._sent=C.arg;else if(C.method==="throw"){if(k===u)throw k=m,C.arg;C.dispatchException(C.arg)}else C.method==="return"&&C.abrupt("return",C.arg);k=d;var I=n(S,E,C);if(I.type==="normal"){if(k=C.done?m:l,I.arg===_)continue;return{value:I.arg,done:C.done}}else I.type==="throw"&&(k=m,C.method="throw",C.arg=I.arg)}}}function M(S,E){var C=E.method,k=S.iterator[C];if(k===h)return E.delegate=null,C==="throw"&&S.iterator.return&&(E.method="return",E.arg=h,M(S,E),E.method==="throw")||C!=="return"&&(E.method="throw",E.arg=new TypeError("The iterator does not provide a '"+C+"' method")),_;var P=n(k,S.iterator,E.arg);if(P.type==="throw")return E.method="throw",E.arg=P.arg,E.delegate=null,_;var H=P.arg;if(!H)return E.method="throw",E.arg=new TypeError("iterator result is not an object"),E.delegate=null,_;if(H.done)E[S.resultName]=H.value,E.next=S.nextLoc,E.method!=="return"&&(E.method="next",E.arg=h);else return H;return E.delegate=null,_}$(j),o(j,e,"Generator"),o(j,r,function(){return this}),o(j,"toString",function(){return"[object Generator]"});function p(S){var E={tryLoc:S[0]};1 in S&&(E.catchLoc=S[1]),2 in S&&(E.finallyLoc=S[2],E.afterLoc=S[3]),this.tryEntries.push(E)}function b(S){var E=S.completion||{};E.type="normal",delete E.arg,S.completion=E}function g(S){this.tryEntries=[{tryLoc:"root"}],S.forEach(p,this),this.reset(!0)}f.keys=function(S){var E=Object(S),C=[];for(var k in E)C.push(k);return C.reverse(),function P(){for(;C.length;){var H=C.pop();if(H in E)return P.value=H,P.done=!1,P}return P.done=!0,P}};function y(S){if(S){var E=S[r];if(E)return E.call(S);if(typeof S.next=="function")return S;if(!isNaN(S.length)){var C=-1,k=function P(){for(;++C<S.length;)if(v.call(S,C))return P.value=S[C],P.done=!1,P;return P.value=h,P.done=!0,P};return k.next=k}}return{next:x}}f.values=y;function x(){return{value:h,done:!0}}return g.prototype={constructor:g,reset:function(S){if(this.prev=0,this.next=0,this.sent=this._sent=h,this.done=!1,this.delegate=null,this.method="next",this.arg=h,this.tryEntries.forEach(b),!S)for(var E in this)E.charAt(0)==="t"&&v.call(this,E)&&!isNaN(+E.slice(1))&&(this[E]=h)},stop:function(){this.done=!0;var S=this.tryEntries[0],E=S.completion;if(E.type==="throw")throw E.arg;return this.rval},dispatchException:function(S){if(this.done)throw S;var E=this;function C(U,I){return H.type="throw",H.arg=S,E.next=U,I&&(E.method="next",E.arg=h),!!I}for(var k=this.tryEntries.length-1;k>=0;--k){var P=this.tryEntries[k],H=P.completion;if(P.tryLoc==="root")return C("end");if(P.tryLoc<=this.prev){var J=v.call(P,"catchLoc"),D=v.call(P,"finallyLoc");if(J&&D){if(this.prev<P.catchLoc)return C(P.catchLoc,!0);if(this.prev<P.finallyLoc)return C(P.finallyLoc)}else if(J){if(this.prev<P.catchLoc)return C(P.catchLoc,!0)}else if(D){if(this.prev<P.finallyLoc)return C(P.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(S,E){for(var C=this.tryEntries.length-1;C>=0;--C){var k=this.tryEntries[C];if(k.tryLoc<=this.prev&&v.call(k,"finallyLoc")&&this.prev<k.finallyLoc){var P=k;break}}P&&(S==="break"||S==="continue")&&P.tryLoc<=E&&E<=P.finallyLoc&&(P=null);var H=P?P.completion:{};return H.type=S,H.arg=E,P?(this.method="next",this.next=P.finallyLoc,_):this.complete(H)},complete:function(S,E){if(S.type==="throw")throw S.arg;return S.type==="break"||S.type==="continue"?this.next=S.arg:S.type==="return"?(this.rval=this.arg=S.arg,this.method="return",this.next="end"):S.type==="normal"&&E&&(this.next=E),_},finish:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var C=this.tryEntries[E];if(C.finallyLoc===S)return this.complete(C.completion,C.afterLoc),b(C),_}},catch:function(S){for(var E=this.tryEntries.length-1;E>=0;--E){var C=this.tryEntries[E];if(C.tryLoc===S){var k=C.completion;if(k.type==="throw"){var P=k.arg;b(C)}return P}}throw new Error("illegal catch attempt")},delegateYield:function(S,E,C){return this.delegate={iterator:y(S),resultName:E,nextLoc:C},this.method==="next"&&(this.arg=h),_}},f})(R.exports);try{regeneratorRuntime=w}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=w:Function("r","regeneratorRuntime = r")(w)}})(xn)),xn.exports}var rp=ep();const ip=Qr(rp);function di(R){throw new Error('Could not dynamically require "'+R+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Sn={exports:{}};var $f;function np(){return $f||($f=1,(function(R,w){(function(f){R.exports=f()})((function(){return(function f(c,v,s){function h(t,e){if(!v[t]){if(!c[t]){var o=typeof di=="function"&&di;if(!e&&o)return o(t,!0);if(a)return a(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var n=v[t]={exports:{}};c[t][0].call(n.exports,(function(u){return h(c[t][1][u]||u)}),n,n.exports,f,c,v,s)}return v[t].exports}for(var a=typeof di=="function"&&di,r=0;r<s.length;r++)h(s[r]);return h})({1:[function(f,c,v){const s=f("fs"),h=f("fast-csv"),a=f("dayjs/plugin/customParseFormat"),r=f("dayjs/plugin/utc"),t=f("dayjs").extend(a).extend(r),e=f("../utils/stream-buf"),{fs:{exists:o}}=f("../utils/utils"),i={true:!0,false:!1,"#N/A":{error:"#N/A"},"#REF!":{error:"#REF!"},"#NAME?":{error:"#NAME?"},"#DIV/0!":{error:"#DIV/0!"},"#NULL!":{error:"#NULL!"},"#VALUE!":{error:"#VALUE!"},"#NUM!":{error:"#NUM!"}};c.exports=class{constructor(n){this.workbook=n,this.worksheet=null}async readFile(n,u){if(u=u||{},!await o(n))throw new Error("File not found: "+n);const l=s.createReadStream(n),d=await this.read(l,u);return l.close(),d}read(n,u){return u=u||{},new Promise((l,d)=>{const m=this.workbook.addWorksheet(u.sheetName),_=u.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],A=u.map||function(N){if(N==="")return null;const L=Number(N);if(!Number.isNaN(L)&&L!==1/0)return L;const q=_.reduce((j,$)=>{if(j)return j;const z=t(N,$,!0);return z.isValid()?z:null},null);if(q)return new Date(q.valueOf());const F=i[N];return F!==void 0?F:N},T=h.parse(u.parserOptions).on("data",N=>{m.addRow(N.map(A))}).on("end",()=>{T.emit("worksheet",m)});T.on("worksheet",l).on("error",d),n.pipe(T)})}createInputStream(){throw new Error("`CSV#createInputStream` is deprecated. You should use `CSV#read` instead. This method will be removed in version 5.0. Please follow upgrade instruction: https://github.com/exceljs/exceljs/blob/master/UPGRADE-4.0.md")}write(n,u){return new Promise((l,d)=>{u=u||{};const m=this.workbook.getWorksheet(u.sheetName||u.sheetId),_=h.format(u.formatterOptions);n.on("finish",()=>{l()}),_.on("error",d),_.pipe(n);const{dateFormat:A,dateUTC:T}=u,N=u.map||(F=>{if(F){if(F.text||F.hyperlink)return F.hyperlink||F.text||"";if(F.formula||F.result)return F.result||"";if(F instanceof Date)return A?T?t.utc(F).format(A):t(F).format(A):T?t.utc(F).format():t(F).format();if(F.error)return F.error;if(typeof F=="object")return JSON.stringify(F)}return F}),L=u.includeEmptyRows===void 0||u.includeEmptyRows;let q=1;m&&m.eachRow((F,j)=>{if(L)for(;q++<j-1;)_.write([]);const{values:$}=F;$.shift(),_.write($.map(N)),q=j}),_.end()})}writeFile(n,u){const l={encoding:(u=u||{}).encoding||"utf8"},d=s.createWriteStream(n,l);return this.write(d,u)}async writeBuffer(n){const u=new e;return await this.write(u,n),u.read()}}},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:230,"dayjs/plugin/customParseFormat":231,"dayjs/plugin/utc":232,"fast-csv":263,fs:216}],2:[function(f,c,v){const s=f("../utils/col-cache");class h{constructor(r,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.worksheet=r,t)if(typeof t=="string"){const o=s.decodeAddress(t);this.nativeCol=o.col+e,this.nativeColOff=0,this.nativeRow=o.row+e,this.nativeRowOff=0}else t.nativeCol!==void 0?(this.nativeCol=t.nativeCol||0,this.nativeColOff=t.nativeColOff||0,this.nativeRow=t.nativeRow||0,this.nativeRowOff=t.nativeRowOff||0):t.col!==void 0?(this.col=t.col+e,this.row=t.row+e):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(r){return r instanceof h||r==null?r:new h(r)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(r){this.nativeCol=Math.floor(r),this.nativeColOff=Math.floor((r-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(r){this.nativeRow=Math.floor(r),this.nativeRowOff=Math.floor((r-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(1e4*this.worksheet.getColumn(this.nativeCol+1).width):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(1e4*this.worksheet.getRow(this.nativeRow+1).height):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(r){this.nativeCol=r.nativeCol,this.nativeColOff=r.nativeColOff,this.nativeRow=r.nativeRow,this.nativeRowOff=r.nativeRowOff}}c.exports=h},{"../utils/col-cache":19}],3:[function(f,c,v){const s=f("../utils/col-cache"),h=f("../utils/under-dash"),a=f("./enums"),{slideFormula:r}=f("../utils/shared-formula"),t=f("./note");class e{constructor(n,u,l){if(!n||!u)throw new Error("A Cell needs a Row");this._row=n,this._column=u,s.validateAddress(l),this._address=l,this._value=o.create(e.Types.Null,this),this.style=this._mergeStyle(n.style,u.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(n){this.style.numFmt=n}get font(){return this.style.font}set font(n){this.style.font=n}get alignment(){return this.style.alignment}set alignment(n){this.style.alignment=n}get border(){return this.style.border}set border(n){this.style.border=n}get fill(){return this.style.fill}set fill(n){this.style.fill=n}get protection(){return this.style.protection}set protection(n){this.style.protection=n}_mergeStyle(n,u,l){const d=n&&n.numFmt||u&&u.numFmt;d&&(l.numFmt=d);const m=n&&n.font||u&&u.font;m&&(l.font=m);const _=n&&n.alignment||u&&u.alignment;_&&(l.alignment=_);const A=n&&n.border||u&&u.border;A&&(l.border=A);const T=n&&n.fill||u&&u.fill;T&&(l.fill=T);const N=n&&n.protection||u&&u.protection;return N&&(l.protection=N),l}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(n,u){this._value.release(),this._value=o.create(e.Types.Merge,this,n),u||(this.style=n.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=o.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(n){return this._value.type===e.Types.Merge&&this._value.isMergedTo(n)}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(n){this.type!==e.Types.Merge?(this._value.release(),this._value=o.create(o.getType(n),this,n)):this._value.master.value=n}get note(){return this._comment&&this._comment.note}set note(n){this._comment=new t(n)}get text(){return this._value.toString()}get html(){return h.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(n){this.type===e.Types.String&&(this._value=o.create(e.Types.Hyperlink,this,{text:this._value.value,hyperlink:n}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){const{worksheet:n}=this._row;return{sheetName:n.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(n){this.names=[n]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(n){const{definedNames:u}=this.workbook;u.removeAllNames(this.fullAddress),n.forEach(l=>{u.addEx(this.fullAddress,l)})}addName(n){this.workbook.definedNames.addEx(this.fullAddress,n)}removeName(n){this.workbook.definedNames.removeEx(this.fullAddress,n)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(n){this._dataValidations.add(this.address,n)}get model(){const{model:n}=this._value;return n.style=this.style,this._comment&&(n.comment=this._comment.model),n}set model(n){if(this._value.release(),this._value=o.create(n.type,this),this._value.model=n,n.comment)switch(n.comment.type){case"note":this._comment=t.fromModel(n.comment)}n.style?this.style=n.style:this.style={}}}e.Types=a.ValueType;const o={getType:i=>i==null?e.Types.Null:i instanceof String||typeof i=="string"?e.Types.String:typeof i=="number"?e.Types.Number:typeof i=="boolean"?e.Types.Boolean:i instanceof Date?e.Types.Date:i.text&&i.hyperlink?e.Types.Hyperlink:i.formula||i.sharedFormula?e.Types.Formula:i.richText?e.Types.RichText:i.sharedString?e.Types.SharedString:i.error?e.Types.Error:e.Types.JSON,types:[{t:e.Types.Null,f:class{constructor(i){this.model={address:i.address,type:e.Types.Null}}get value(){return null}set value(i){}get type(){return e.Types.Null}get effectiveType(){return e.Types.Null}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return""}release(){}toString(){return""}}},{t:e.Types.Number,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Number,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.Number}get effectiveType(){return e.Types.Number}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.String,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.String,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.String}get effectiveType(){return e.Types.String}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return`"${this.model.value.replace(/"/g,'""')}"`}release(){}toString(){return this.model.value}}},{t:e.Types.Date,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Date,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.Date}get effectiveType(){return e.Types.Date}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.Hyperlink,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Hyperlink,text:n?n.text:void 0,hyperlink:n?n.hyperlink:void 0},n&&n.tooltip&&(this.model.tooltip=n.tooltip)}get value(){const i={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(i.tooltip=this.model.tooltip),i}set value(i){this.model={text:i.text,hyperlink:i.hyperlink},i.tooltip&&(this.model.tooltip=i.tooltip)}get text(){return this.model.text}set text(i){this.model.text=i}get hyperlink(){return this.model.hyperlink}set hyperlink(i){this.model.hyperlink=i}get type(){return e.Types.Hyperlink}get effectiveType(){return e.Types.Hyperlink}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:e.Types.Formula,f:class{constructor(i,n){this.cell=i,this.model={address:i.address,type:e.Types.Formula,shareType:n?n.shareType:void 0,ref:n?n.ref:void 0,formula:n?n.formula:void 0,sharedFormula:n?n.sharedFormula:void 0,result:n?n.result:void 0}}_copyModel(i){const n={},u=l=>{const d=i[l];d&&(n[l]=d)};return u("formula"),u("result"),u("ref"),u("shareType"),u("sharedFormula"),n}get value(){return this._copyModel(this.model)}set value(i){this.model=this._copyModel(i)}validate(i){switch(o.getType(i)){case e.Types.Null:case e.Types.String:case e.Types.Number:case e.Types.Date:break;case e.Types.Hyperlink:case e.Types.Formula:default:throw new Error("Cannot process that type of result value")}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,"").match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(i){this.model.formula=i}get formulaType(){return this.model.formula?a.FormulaType.Master:this.model.sharedFormula?a.FormulaType.Shared:a.FormulaType.None}get result(){return this.model.result}set result(i){this.model.result=i}get type(){return e.Types.Formula}get effectiveType(){const i=this.model.result;return i==null?a.ValueType.Null:i instanceof String||typeof i=="string"?a.ValueType.String:typeof i=="number"?a.ValueType.Number:i instanceof Date?a.ValueType.Date:i.text&&i.hyperlink?a.ValueType.Hyperlink:i.formula?a.ValueType.Formula:a.ValueType.Null}get address(){return this.model.address}set address(i){this.model.address=i}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){const{worksheet:i}=this.cell,n=i.findCell(this.model.sharedFormula);this._translatedFormula=n&&r(n.formula,n.address,this.model.address)}return this._translatedFormula}toCsvString(){return""+(this.model.result||"")}release(){}toString(){return this.model.result?this.model.result.toString():""}}},{t:e.Types.Merge,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Merge,master:n?n.address:void 0},this._master=n,n&&n.addMergeRef()}get value(){return this._master.value}set value(i){i instanceof e?(this._master&&this._master.releaseMergeRef(),i.addMergeRef(),this._master=i):this._master.value=i}isMergedTo(i){return i===this._master}get master(){return this._master}get type(){return e.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return""}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:e.Types.JSON,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.String,value:JSON.stringify(n),rawValue:n}}get value(){return this.model.rawValue}set value(i){this.model.rawValue=i,this.model.value=JSON.stringify(i)}get type(){return e.Types.String}get effectiveType(){return e.Types.String}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:e.Types.SharedString,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.SharedString,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.SharedString}get effectiveType(){return e.Types.SharedString}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.RichText,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.String,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}toString(){return this.model.value.richText.map(i=>i.text).join("")}get type(){return e.Types.RichText}get effectiveType(){return e.Types.RichText}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return`"${this.text.replace(/"/g,'""')}"`}release(){}}},{t:e.Types.Boolean,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Boolean,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.Boolean}get effectiveType(){return e.Types.Boolean}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:e.Types.Error,f:class{constructor(i,n){this.model={address:i.address,type:e.Types.Error,value:n}}get value(){return this.model.value}set value(i){this.model.value=i}get type(){return e.Types.Error}get effectiveType(){return e.Types.Error}get address(){return this.model.address}set address(i){this.model.address=i}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce((i,n)=>(i[n.t]=n.f,i),[]),create(i,n,u){const l=this.types[i];if(!l)throw new Error("Could not create Value of type "+i);return new l(n,u)}};c.exports=e},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[function(f,c,v){const s=f("../utils/under-dash"),h=f("./enums"),a=f("../utils/col-cache");class r{constructor(e,o,i){this._worksheet=e,this._number=o,i!==!1&&(this.defn=i)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return a.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(e){e?(this.key=e.key,this.width=e.width!==void 0?e.width:9,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(e){e!==void 0?(this._header=e,this.headers.forEach((o,i)=>{this._worksheet.getCell(i+1,this.number).value=o})):this._header=void 0}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&s.isEqual(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;const e=this.style;return!e||!(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection)}get headerCount(){return this.headers.length}eachCell(e,o){const i=this.number;o||(o=e,e=null),this._worksheet.eachRow(e,(n,u)=>{o(n.getCell(i),u)})}get values(){const e=[];return this.eachCell((o,i)=>{o&&o.type!==h.ValueType.Null&&(e[i]=o.value)}),e}set values(e){if(!e)return;const o=this.number;let i=0;e.hasOwnProperty("0")&&(i=1),e.forEach((n,u)=>{this._worksheet.getCell(u+i,o).value=n})}_applyStyle(e,o){return this.style[e]=o,this.eachCell(i=>{i[e]=o}),o}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle("numFmt",e)}get font(){return this.style.font}set font(e){this._applyStyle("font",e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle("alignment",e)}get protection(){return this.style.protection}set protection(e){this._applyStyle("protection",e)}get border(){return this.style.border}set border(e){this._applyStyle("border",e)}get fill(){return this.style.fill}set fill(e){this._applyStyle("fill",e)}static toModel(e){const o=[];let i=null;return e&&e.forEach((n,u)=>{n.isDefault?i&&(i=null):i&&n.equivalentTo(i)?i.max=u+1:(i={min:u+1,max:u+1,width:n.width!==void 0?n.width:9,style:n.style,isCustomWidth:n.isCustomWidth,hidden:n.hidden,outlineLevel:n.outlineLevel,collapsed:n.collapsed},o.push(i))}),o.length?o:void 0}static fromModel(e,o){const i=[];let n=1,u=0;for(o=(o=o||[]).sort((function(l,d){return l.min-d.min}));u<o.length;){const l=o[u++];for(;n<l.min;)i.push(new r(e,n++));for(;n<=l.max;)i.push(new r(e,n++,l))}return i.length?i:null}}c.exports=r},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[function(f,c,v){c.exports=class{constructor(s){this.model=s||{}}add(s,h){return this.model[s]=h}find(s){return this.model[s]}remove(s){this.model[s]=void 0}}},{}],6:[function(f,c,v){const s=f("../utils/under-dash"),h=f("../utils/col-cache"),a=f("../utils/cell-matrix"),r=f("./range"),t=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;c.exports=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new a)}add(e,o){const i=h.decodeEx(e);this.addEx(i,o)}addEx(e,o){const i=this.getMatrix(o);if(e.top)for(let n=e.left;n<=e.right;n++)for(let u=e.top;u<=e.bottom;u++){const l={sheetName:e.sheetName,address:h.n2l(n)+u,row:u,col:n};i.addCellEx(l)}else i.addCellEx(e)}remove(e,o){const i=h.decodeEx(e);this.removeEx(i,o)}removeEx(e,o){this.getMatrix(o).removeCellEx(e)}removeAllNames(e){s.each(this.matrixMap,o=>{o.removeCellEx(e)})}forEach(e){s.each(this.matrixMap,(o,i)=>{o.forEach(n=>{e(i,n)})})}getNames(e){return this.getNamesEx(h.decodeEx(e))}getNamesEx(e){return s.map(this.matrixMap,(o,i)=>o.findCellEx(e)&&i).filter(Boolean)}_explore(e,o){o.mark=!1;const{sheetName:i}=o,n=new r(o.row,o.col,o.row,o.col,i);let u,l;function d(_,A){const T=e.findCellAt(i,_,o.col);return!(!T||!T.mark)&&(n[A]=_,T.mark=!1,!0)}for(l=o.row-1;d(l,"top");l--);for(l=o.row+1;d(l,"bottom");l++);function m(_,A){const T=[];for(l=n.top;l<=n.bottom;l++){const N=e.findCellAt(i,l,_);if(!N||!N.mark)return!1;T.push(N)}n[A]=_;for(let N=0;N<T.length;N++)T[N].mark=!1;return!0}for(u=o.col-1;m(u,"left");u--);for(u=o.col+1;m(u,"right");u++);return n}getRanges(e,o){return(o=o||this.matrixMap[e])?(o.forEach(i=>{i.mark=!0}),{name:e,ranges:o.map(i=>i.mark&&this._explore(o,i)).filter(Boolean).map(i=>i.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,o){e.forEachInSheet(o,(i,n,u)=>{i&&(i.row===n&&i.col===u||(i.row=n,i.col=u,i.address=h.n2l(u)+n))})}spliceRows(e,o,i,n){s.each(this.matrixMap,u=>{u.spliceRows(e,o,i,n),this.normaliseMatrix(u,e)})}spliceColumns(e,o,i,n){s.each(this.matrixMap,u=>{u.spliceColumns(e,o,i,n),this.normaliseMatrix(u,e)})}get model(){return s.map(this.matrixMap,(e,o)=>this.getRanges(o,e)).filter(e=>e.ranges.length)}set model(e){const o=this.matrixMap={};e.forEach(i=>{const n=o[i.name]=new a;i.ranges.forEach(u=>{t.test(u.split("!").pop()||"")&&n.addCell(u)})})}}},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./range":10}],7:[function(f,c,v){c.exports={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:"#N/A",Ref:"#REF!",Name:"#NAME?",DivZero:"#DIV/0!",Null:"#NULL!",Value:"#VALUE!",Num:"#NUM!"}}},{}],8:[function(f,c,v){const s=f("../utils/col-cache"),h=f("./anchor");c.exports=class{constructor(a,r){this.worksheet=a,this.model=r}get model(){switch(this.type){case"background":return{type:this.type,imageId:this.imageId};case"image":return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw new Error("Invalid Image Type")}}set model(a){let{type:r,imageId:t,range:e,hyperlinks:o}=a;if(this.type=r,this.imageId=t,r==="image")if(typeof e=="string"){const i=s.decode(e);this.range={tl:new h(this.worksheet,{col:i.left,row:i.top},-1),br:new h(this.worksheet,{col:i.right,row:i.bottom},0),editAs:"oneCell"}}else this.range={tl:new h(this.worksheet,e.tl,0),br:e.br&&new h(this.worksheet,e.br,0),ext:e.ext,editAs:e.editAs,hyperlinks:o||e.hyperlinks}}}},{"../utils/col-cache":19,"./anchor":2}],9:[function(f,c,v){const s=f("../utils/under-dash");class h{constructor(r){this.note=r}get model(){let r=null;switch(typeof this.note){case"string":r={type:"note",note:{texts:[{text:this.note}]}};break;default:r={type:"note",note:this.note}}return s.deepMerge({},h.DEFAULT_CONFIGS,r)}set model(r){const{note:t}=r,{texts:e}=t;e.length===1&&Object.keys(e[0]).length===1?this.note=e[0].text:this.note=t}static fromModel(r){const t=new h;return t.model=r,t}}h.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},c.exports=h},{"../utils/under-dash":26}],10:[function(f,c,v){const s=f("../utils/col-cache");class h{constructor(){this.decode(arguments)}setTLBR(r,t,e,o,i){if(arguments.length<4){const n=s.decodeAddress(r),u=s.decodeAddress(t);this.model={top:Math.min(n.row,u.row),left:Math.min(n.col,u.col),bottom:Math.max(n.row,u.row),right:Math.max(n.col,u.col),sheetName:e},this.setTLBR(n.row,n.col,u.row,u.col,i)}else this.model={top:Math.min(r,e),left:Math.min(t,o),bottom:Math.max(r,e),right:Math.max(t,o),sheetName:i}}decode(r){switch(r.length){case 5:this.setTLBR(r[0],r[1],r[2],r[3],r[4]);break;case 4:this.setTLBR(r[0],r[1],r[2],r[3]);break;case 3:this.setTLBR(r[0],r[1],r[2]);break;case 2:this.setTLBR(r[0],r[1]);break;case 1:{const t=r[0];if(t instanceof h)this.model={top:t.model.top,left:t.model.left,bottom:t.model.bottom,right:t.model.right,sheetName:t.sheetName};else if(t instanceof Array)this.decode(t);else if(t.top&&t.left&&t.bottom&&t.right)this.model={top:t.top,left:t.left,bottom:t.bottom,right:t.right,sheetName:t.sheetName};else{const e=s.decodeEx(t);e.top?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new Error("Invalid number of arguments to _getDimensions() - "+r.length)}}get top(){return this.model.top||1}set top(r){this.model.top=r}get left(){return this.model.left||1}set left(r){this.model.left=r}get bottom(){return this.model.bottom||1}set bottom(r){this.model.bottom=r}get right(){return this.model.right||1}set right(r){this.model.right=r}get sheetName(){return this.model.sheetName}set sheetName(r){this.model.sheetName=r}get _serialisedSheetName(){const{sheetName:r}=this.model;return r?/^[a-zA-Z0-9]*$/.test(r)?r+"!":`'${r}'!`:""}expand(r,t,e,o){(!this.model.top||r<this.top)&&(this.top=r),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||e>this.bottom)&&(this.bottom=e),(!this.model.right||o>this.right)&&(this.right=o)}expandRow(r){if(r){const{dimensions:t,number:e}=r;t&&this.expand(e,t.min,e,t.max)}}expandToAddress(r){const t=s.decodeEx(r);this.expand(t.row,t.col,t.row,t.col)}get tl(){return s.n2l(this.left)+this.top}get $t$l(){return`$${s.n2l(this.left)}$${this.top}`}get br(){return s.n2l(this.right)+this.bottom}get $b$r(){return`$${s.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&!(r.bottom<this.top)&&!(r.top>this.bottom)&&!(r.right<this.left)&&!(r.left>this.right)}contains(r){const t=s.decodeEx(r);return this.containsEx(t)}containsEx(r){return(!r.sheetName||!this.sheetName||r.sheetName===this.sheetName)&&r.row>=this.top&&r.row<=this.bottom&&r.col>=this.left&&r.col<=this.right}forEachAddress(r){for(let t=this.left;t<=this.right;t++)for(let e=this.top;e<=this.bottom;e++)r(s.encodeAddress(e,t),e,t)}}c.exports=h},{"../utils/col-cache":19}],11:[function(f,c,v){const s=f("../utils/under-dash"),h=f("./enums"),a=f("../utils/col-cache"),r=f("./cell");c.exports=class{constructor(t,e){this._worksheet=t,this._number=e,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(t){return this._cells[t-1]}getCellEx(t){let e=this._cells[t.col-1];if(!e){const o=this._worksheet.getColumn(t.col);e=new r(this,o,t.address),this._cells[t.col-1]=e}return e}getCell(t){if(typeof t=="string"){const e=this._worksheet.getColumnKey(t);t=e?e.number:a.l2n(t)}return this._cells[t-1]||this.getCellEx({address:a.encodeAddress(this._number,t),row:this._number,col:t})}splice(t,e){const o=t+e;for(var i=arguments.length,n=new Array(i>2?i-2:0),u=2;u<i;u++)n[u-2]=arguments[u];const l=n.length-e,d=this._cells.length;let m,_,A;if(l<0)for(m=t+n.length;m<=d;m++)A=this._cells[m-1],_=this._cells[m-l-1],_?(A=this.getCell(m),A.value=_.value,A.style=_.style,A._comment=_._comment):A&&(A.value=null,A.style={},A._comment=void 0);else if(l>0)for(m=d;m>=o;m--)_=this._cells[m-1],_?(A=this.getCell(m+l),A.value=_.value,A.style=_.style,A._comment=_._comment):this._cells[m+l-1]=void 0;for(m=0;m<n.length;m++)A=this.getCell(t+m),A.value=n[m],A.style={},A._comment=void 0}eachCell(t,e){if(e||(e=t,t=null),t&&t.includeEmpty){const o=this._cells.length;for(let i=1;i<=o;i++)e(this.getCell(i),i)}else this._cells.forEach((o,i)=>{o&&o.type!==h.ValueType.Null&&e(o,i+1)})}addPageBreak(t,e){const o=this._worksheet,i=Math.max(0,t-1)||0,n=Math.max(0,e-1)||16838,u={id:this._number,max:n,man:1};i&&(u.min=i),o.rowBreaks.push(u)}get values(){const t=[];return this._cells.forEach(e=>{e&&e.type!==h.ValueType.Null&&(t[e.col]=e.value)}),t}set values(t){if(this._cells=[],t)if(t instanceof Array){let e=0;t.hasOwnProperty("0")&&(e=1),t.forEach((o,i)=>{o!==void 0&&(this.getCellEx({address:a.encodeAddress(this._number,i+e),row:this._number,col:i+e}).value=o)})}else this._worksheet.eachColumnKey((e,o)=>{t[o]!==void 0&&(this.getCellEx({address:a.encodeAddress(this._number,e.number),row:this._number,col:e.number}).value=t[o])})}get hasValues(){return s.some(this._cells,t=>t&&t.type!==h.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let t=0;return this.eachCell(()=>{t++}),t}get dimensions(){let t=0,e=0;return this._cells.forEach(o=>{o&&o.type!==h.ValueType.Null&&((!t||t>o.col)&&(t=o.col),e<o.col&&(e=o.col))}),t>0?{min:t,max:e}:null}_applyStyle(t,e){return this.style[t]=e,this._cells.forEach(o=>{o&&(o[t]=e)}),e}get numFmt(){return this.style.numFmt}set numFmt(t){this._applyStyle("numFmt",t)}get font(){return this.style.font}set font(t){this._applyStyle("font",t)}get alignment(){return this.style.alignment}set alignment(t){this._applyStyle("alignment",t)}get protection(){return this.style.protection}set protection(t){this._applyStyle("protection",t)}get border(){return this.style.border}set border(t){this._applyStyle("border",t)}get fill(){return this.style.fill}set fill(t){this._applyStyle("fill",t)}get hidden(){return!!this._hidden}set hidden(t){this._hidden=t}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(t){this._outlineLevel=t}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){const t=[];let e=0,o=0;return this._cells.forEach(i=>{if(i){const n=i.model;n&&((!e||e>i.col)&&(e=i.col),o<i.col&&(o=i.col),t.push(n))}}),this.height||t.length?{cells:t,number:this.number,min:e,max:o,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(t){if(t.number!==this._number)throw new Error("Invalid row number in model");let e;this._cells=[],t.cells.forEach(o=>{switch(o.type){case r.Types.Merge:break;default:{let i;if(o.address)i=a.decodeAddress(o.address);else if(e){const{row:n}=e,u=e.col+1;i={row:n,col:u,address:a.encodeAddress(n,u),$col$row:`$${a.n2l(u)}$${n}`}}e=i,this.getCellEx(i).model=o;break}}}),t.height?this.height=t.height:delete this.height,this.hidden=t.hidden,this.outlineLevel=t.outlineLevel||0,this.style=t.style&&JSON.parse(JSON.stringify(t.style))||{}}}},{"../utils/col-cache":19,"../utils/under-dash":26,"./cell":3,"./enums":7}],12:[function(f,c,v){const s=f("../utils/col-cache");class h{constructor(r,t,e){this.table=r,this.column=t,this.index=e}_set(r,t){this.table.cacheState(),this.column[r]=t}get name(){return this.column.name}set name(r){this._set("name",r)}get filterButton(){return this.column.filterButton}set filterButton(r){this.column.filterButton=r}get style(){return this.column.style}set style(r){this.column.style=r}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(r){this._set("totalsRowLabel",r)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(r){this._set("totalsRowFunction",r)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(r){this._set("totalsRowResult",r)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(r){this._set("totalsRowFormula",r)}}c.exports=class{constructor(a,r){this.worksheet=a,r&&(this.table=r,this.validate(),this.store())}getFormula(a){switch(a.totalsRowFunction){case"none":return null;case"average":return`SUBTOTAL(101,${this.table.name}[${a.name}])`;case"countNums":return`SUBTOTAL(102,${this.table.name}[${a.name}])`;case"count":return`SUBTOTAL(103,${this.table.name}[${a.name}])`;case"max":return`SUBTOTAL(104,${this.table.name}[${a.name}])`;case"min":return`SUBTOTAL(105,${this.table.name}[${a.name}])`;case"stdDev":return`SUBTOTAL(106,${this.table.name}[${a.name}])`;case"var":return`SUBTOTAL(107,${this.table.name}[${a.name}])`;case"sum":return`SUBTOTAL(109,${this.table.name}[${a.name}])`;case"custom":return a.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: "+a.totalsRowFunction)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){const{table:a}=this,r=(l,d,m)=>{l[d]===void 0&&(l[d]=m)};r(a,"headerRow",!0),r(a,"totalsRow",!1),r(a,"style",{}),r(a.style,"theme","TableStyleMedium2"),r(a.style,"showFirstColumn",!1),r(a.style,"showLastColumn",!1),r(a.style,"showRowStripes",!1),r(a.style,"showColumnStripes",!1);const t=(l,d)=>{if(!l)throw new Error(d)};t(a.ref,"Table must have ref"),t(a.columns,"Table must have column definitions"),t(a.rows,"Table must have row definitions"),a.tl=s.decodeAddress(a.ref);const{row:e,col:o}=a.tl;t(e>0,"Table must be on valid row"),t(o>0,"Table must be on valid col");const{width:i,filterHeight:n,tableHeight:u}=this;a.autoFilterRef=s.encode(e,o,e+n-1,o+i-1),a.tableRef=s.encode(e,o,e+u-1,o+i-1),a.columns.forEach((l,d)=>{t(l.name,`Column ${d} must have a name`),d===0?r(l,"totalsRowLabel","Total"):(r(l,"totalsRowFunction","none"),l.totalsRowFormula=this.getFormula(l))})}store(){const a=(n,u)=>{u&&Object.keys(u).forEach(l=>{n[l]=u[l]})},{worksheet:r,table:t}=this,{row:e,col:o}=t.tl;let i=0;if(t.headerRow){const n=r.getRow(e+i++);t.columns.forEach((u,l)=>{const{style:d,name:m}=u,_=n.getCell(o+l);_.value=m,a(_,d)})}if(t.rows.forEach(n=>{const u=r.getRow(e+i++);n.forEach((l,d)=>{const m=u.getCell(o+d);m.value=l,a(m,t.columns[d].style)})}),t.totalsRow){const n=r.getRow(e+i++);t.columns.forEach((u,l)=>{const d=n.getCell(o+l);if(l===0)d.value=u.totalsRowLabel;else{const m=this.getFormula(u);d.value=m?{formula:u.totalsRowFormula,result:u.totalsRowResult}:null}a(d,u.style)})}}load(a){const{table:r}=this,{row:t,col:e}=r.tl;let o=0;if(r.headerRow){const i=a.getRow(t+o++);r.columns.forEach((n,u)=>{i.getCell(e+u).value=n.name})}if(r.rows.forEach(i=>{const n=a.getRow(t+o++);i.forEach((u,l)=>{n.getCell(e+l).value=u})}),r.totalsRow){const i=a.getRow(t+o++);r.columns.forEach((n,u)=>{const l=i.getCell(e+u);u===0?l.value=n.totalsRowLabel:this.getFormula(n)&&(l.value={formula:n.totalsRowFormula,result:n.totalsRowResult})})}}get model(){return this.table}set model(a){this.table=a}cacheState(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}commit(){if(!this._cache)return;this.validate();const a=s.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let r=0;r<this._cache.tableHeight;r++){const t=this.worksheet.getRow(a.row+r);for(let e=0;e<this._cache.width;e++)t.getCell(a.col+e).value=null}else{for(let r=this.tableHeight;r<this._cache.tableHeight;r++){const t=this.worksheet.getRow(a.row+r);for(let e=0;e<this._cache.width;e++)t.getCell(a.col+e).value=null}for(let r=0;r<this.tableHeight;r++){const t=this.worksheet.getRow(a.row+r);for(let e=this.width;e<this._cache.width;e++)t.getCell(a.col+e).value=null}}this.store()}addRow(a,r){this.cacheState(),r===void 0?this.table.rows.push(a):this.table.rows.splice(r,0,a)}removeRows(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(a,r)}getColumn(a){const r=this.table.columns[a];return new h(this,r,a)}addColumn(a,r,t){this.cacheState(),t===void 0?(this.table.columns.push(a),this.table.rows.forEach((e,o)=>{e.push(r[o])})):(this.table.columns.splice(t,0,a),this.table.rows.forEach((e,o)=>{e.splice(t,0,r[o])}))}removeColumns(a){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(a,r),this.table.rows.forEach(t=>{t.splice(a,r)})}_assign(a,r,t){this.cacheState(),a[r]=t}get ref(){return this.table.ref}set ref(a){this._assign(this.table,"ref",a)}get name(){return this.table.name}set name(a){this.table.name=a}get displayName(){return this.table.displyName||this.table.name}set displayNamename(a){this.table.displayName=a}get headerRow(){return this.table.headerRow}set headerRow(a){this._assign(this.table,"headerRow",a)}get totalsRow(){return this.table.totalsRow}set totalsRow(a){this._assign(this.table,"totalsRow",a)}get theme(){return this.table.style.name}set theme(a){this.table.style.name=a}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(a){this.table.style.showFirstColumn=a}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(a){this.table.style.showLastColumn=a}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(a){this.table.style.showRowStripes=a}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(a){this.table.style.showColumnStripes=a}}},{"../utils/col-cache":19}],13:[function(f,c,v){const s=f("./worksheet"),h=f("./defined-names"),a=f("../xlsx/xlsx"),r=f("../csv/csv");c.exports=class{constructor(){this.category="",this.company="",this.created=new Date,this.description="",this.keywords="",this.manager="",this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject="",this.title="",this.views=[],this.media=[],this._definedNames=new h}get xlsx(){return this._xlsx||(this._xlsx=new a(this)),this._xlsx}get csv(){return this._csv||(this._csv=new r(this)),this._csv}get nextId(){for(let t=1;t<this._worksheets.length;t++)if(!this._worksheets[t])return t;return this._worksheets.length||1}addWorksheet(t,e){const o=this.nextId;e&&(typeof e=="string"?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),e={properties:{tabColor:{argb:e}}}):(e.argb||e.theme||e.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),e={properties:{tabColor:e}}));const i=this._worksheets.reduce((l,d)=>(d&&d.orderNo)>l?d.orderNo:l,0),n=Object.assign({},e,{id:o,name:t,orderNo:i+1,workbook:this}),u=new s(n);return this._worksheets[o]=u,u}removeWorksheetEx(t){delete this._worksheets[t.id]}removeWorksheet(t){const e=this.getWorksheet(t);e&&e.destroy()}getWorksheet(t){return t===void 0?this._worksheets.find(Boolean):typeof t=="number"?this._worksheets[t]:typeof t=="string"?this._worksheets.find(e=>e&&e.name===t):void 0}get worksheets(){return this._worksheets.slice(1).sort((t,e)=>t.orderNo-e.orderNo).filter(Boolean)}eachSheet(t){this.worksheets.forEach(e=>{t(e,e.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(t){const e=this.media.length;return this.media.push(Object.assign({},t,{type:"image"})),e}getImage(t){return this.media[t]}get model(){return{creator:this.creator||"Unknown",lastModifiedBy:this.lastModifiedBy||"Unknown",lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(t=>t.model),sheets:this.worksheets.map(t=>t.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,calcProperties:this.calcProperties}}set model(t){this.creator=t.creator,th