eva-frontend-utils
Version:
This is a simple utility package
1 lines • 1.16 MB
JavaScript
(function(gt,We){typeof exports=="object"&&typeof module<"u"?We(exports):typeof define=="function"&&define.amd?define(["exports"],We):(gt=typeof globalThis<"u"?globalThis:gt||self,We(gt["eva-frontend-utils"]={}))})(this,function(gt){"use strict";var Zt=Object.defineProperty;var Yt=(gt,We,_t)=>We in gt?Zt(gt,We,{enumerable:!0,configurable:!0,writable:!0,value:_t}):gt[We]=_t;var At=(gt,We,_t)=>(Yt(gt,typeof We!="symbol"?We+"":We,_t),_t);var We=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _t(Rt){throw new Error('Could not dynamically require "'+Rt+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Vt={exports:{}};/*! ExcelJS 21-08-2021 */(function(Rt,tt){(function(h){Rt.exports=h()})(function(){return function h(I,R,b){function m(p,c){if(!R[p]){if(!I[p]){var l=typeof _t=="function"&&_t;if(!c&&l)return l(p,!0);if(v)return v(p,!0);var s=new Error("Cannot find module '"+p+"'");throw s.code="MODULE_NOT_FOUND",s}var i=R[p]={exports:{}};I[p][0].call(i.exports,function(e){return m(I[p][1][e]||e)},i,i.exports,h,I,R,b)}return R[p].exports}for(var v=typeof _t=="function"&&_t,d=0;d<b.length;d++)m(b[d]);return m}({1:[function(h,I,R){function b(n){return(b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(n)}function m(n,a,u,f,y,w,T){try{var E=n[w](T),M=E.value}catch(O){return void u(O)}E.done?a(M):Promise.resolve(M).then(f,y)}function v(n){return function(){var a=this,u=arguments;return new Promise(function(f,y){var w=n.apply(a,u);function T(M){m(w,f,y,T,E,"next",M)}function E(M){m(w,f,y,T,E,"throw",M)}T(void 0)})}}function d(n,a){for(var u=0;u<a.length;u++){var f=a[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(n,f.key,f)}}var p=h("fs"),c=h("fast-csv"),l=h("dayjs/plugin/customParseFormat"),s=h("dayjs/plugin/utc"),i=h("dayjs").extend(l).extend(s),e=h("../utils/stream-buf"),t=h("../utils/utils").fs.exists,r={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!"}},o=function(){function n(w){(function(T,E){if(!(T instanceof E))throw new TypeError("Cannot call a class as a function")})(this,n),this.workbook=w,this.worksheet=null}var a,u,f,y;return a=n,(u=[{key:"readFile",value:(y=v(regeneratorRuntime.mark(function w(T,E){var M,O;return regeneratorRuntime.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return E=E||{},P.next=3,t(T);case 3:if(P.sent){P.next=5;break}throw new Error("File not found: ".concat(T));case 5:return M=p.createReadStream(T),P.next=8,this.read(M,E);case 8:return O=P.sent,M.close(),P.abrupt("return",O);case 11:case"end":return P.stop()}},w,this)})),function(w,T){return y.apply(this,arguments)})},{key:"read",value:function(w,T){var E=this;return T=T||{},new Promise(function(M,O){var P=E.workbook.addWorksheet(T.sheetName),_=T.dateFormats||["YYYY-MM-DD[T]HH:mm:ssZ","YYYY-MM-DD[T]HH:mm:ss","MM-DD-YYYY","YYYY-MM-DD"],S=T.map||function(j){if(j==="")return null;var k=Number(j);if(!Number.isNaN(k)&&k!==1/0)return k;var x=_.reduce(function(D,F){if(D)return D;var B=i(j,F,!0);return B.isValid()?B:null},null);if(x)return new Date(x.valueOf());var C=r[j];return C!==void 0?C:j},g=c.parse(T.parserOptions).on("data",function(j){P.addRow(j.map(S))}).on("end",function(){g.emit("worksheet",P)});g.on("worksheet",M).on("error",O),w.pipe(g)})}},{key:"createInputStream",value:function(){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")}},{key:"write",value:function(w,T){var E=this;return new Promise(function(M,O){T=T||{};var P=E.workbook.getWorksheet(T.sheetName||T.sheetId),_=c.format(T.formatterOptions);w.on("finish",function(){M()}),_.on("error",O),_.pipe(w);var S=T,g=S.dateFormat,j=S.dateUTC,k=T.map||function(D){if(D){if(D.text||D.hyperlink)return D.hyperlink||D.text||"";if(D.formula||D.result)return D.result||"";if(D instanceof Date)return g?j?i.utc(D).format(g):i(D).format(g):j?i.utc(D).format():i(D).format();if(D.error)return D.error;if(b(D)==="object")return JSON.stringify(D)}return D},x=T.includeEmptyRows===void 0||T.includeEmptyRows,C=1;P&&P.eachRow(function(D,F){if(x)for(;C++<F-1;)_.write([]);var B=D.values;B.shift(),_.write(B.map(k)),C=F}),_.end()})}},{key:"writeFile",value:function(w,T){var E={encoding:(T=T||{}).encoding||"utf8"},M=p.createWriteStream(w,E);return this.write(M,T)}},{key:"writeBuffer",value:(f=v(regeneratorRuntime.mark(function w(T){var E;return regeneratorRuntime.wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return E=new e,M.next=3,this.write(E,T);case 3:return M.abrupt("return",E.read());case 4:case"end":return M.stop()}},w,this)})),function(w){return f.apply(this,arguments)})}])&&d(a.prototype,u),n}();I.exports=o},{"../utils/stream-buf":23,"../utils/utils":26,dayjs:336,"dayjs/plugin/customParseFormat":337,"dayjs/plugin/utc":338,"fast-csv":369,fs:215}],2:[function(h,I,R){function b(p,c){if(!(p instanceof c))throw new TypeError("Cannot call a class as a function")}function m(p,c){for(var l=0;l<c.length;l++){var s=c[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}var v=h("../utils/col-cache"),d=function(){function p(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(b(this,p),e)if(typeof e=="string"){var r=v.decodeAddress(e);this.nativeCol=r.col+t,this.nativeColOff=0,this.nativeRow=r.row+t,this.nativeRowOff=0}else e.nativeCol!==void 0?(this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0):e.col!==void 0?(this.col=e.col+t,this.row=e.row+t):(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;this.worksheet=i}var c,l,s;return c=p,s=[{key:"asInstance",value:function(i){return i instanceof p||i==null?i:new p(i)}}],(l=[{key:"col",get:function(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth},set:function(i){this.nativeCol=Math.floor(i),this.nativeColOff=Math.floor((i-this.nativeCol)*this.colWidth)}},{key:"row",get:function(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight},set:function(i){this.nativeRow=Math.floor(i),this.nativeRowOff=Math.floor((i-this.nativeRow)*this.rowHeight)}},{key:"colWidth",get:function(){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}},{key:"rowHeight",get:function(){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}},{key:"model",get:function(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}},set:function(i){this.nativeCol=i.nativeCol,this.nativeColOff=i.nativeColOff,this.nativeRow=i.nativeRow,this.nativeRowOff=i.nativeRowOff}}])&&m(c.prototype,l),s&&m(c,s),p}();I.exports=d},{"../utils/col-cache":19}],3:[function(h,I,R){function b(O,P){if(!(O instanceof P))throw new TypeError("Cannot call a class as a function")}function m(O,P){for(var _=0;_<P.length;_++){var S=P[_];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(O,S.key,S)}}function v(O,P,_){return P&&m(O.prototype,P),_&&m(O,_),O}var d=h("../utils/col-cache"),p=h("../utils/under-dash"),c=h("./enums"),l=h("../utils/shared-formula").slideFormula,s=h("./note"),i=function(){function O(P,_,S){if(b(this,O),!P||!_)throw new Error("A Cell needs a Row");this._row=P,this._column=_,d.validateAddress(S),this._address=S,this._value=M.create(O.Types.Null,this),this.style=this._mergeStyle(P.style,_.style,{}),this._mergeCount=0}return v(O,[{key:"destroy",value:function(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}},{key:"_mergeStyle",value:function(P,_,S){var g=P&&P.numFmt||_&&_.numFmt;g&&(S.numFmt=g);var j=P&&P.font||_&&_.font;j&&(S.font=j);var k=P&&P.alignment||_&&_.alignment;k&&(S.alignment=k);var x=P&&P.border||_&&_.border;x&&(S.border=x);var C=P&&P.fill||_&&_.fill;C&&(S.fill=C);var D=P&&P.protection||_&&_.protection;return D&&(S.protection=D),S}},{key:"toCsvString",value:function(){return this._value.toCsvString()}},{key:"addMergeRef",value:function(){this._mergeCount++}},{key:"releaseMergeRef",value:function(){this._mergeCount--}},{key:"merge",value:function(P,_){this._value.release(),this._value=M.create(O.Types.Merge,this,P),_||(this.style=P.style)}},{key:"unmerge",value:function(){this.type===O.Types.Merge&&(this._value.release(),this._value=M.create(O.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}},{key:"isMergedTo",value:function(P){return this._value.type===O.Types.Merge&&this._value.isMergedTo(P)}},{key:"toString",value:function(){return this.text}},{key:"_upgradeToHyperlink",value:function(P){this.type===O.Types.String&&(this._value=M.create(O.Types.Hyperlink,this,{text:this._value.value,hyperlink:P}))}},{key:"addName",value:function(P){this.workbook.definedNames.addEx(this.fullAddress,P)}},{key:"removeName",value:function(P){this.workbook.definedNames.removeEx(this.fullAddress,P)}},{key:"removeAllNames",value:function(){this.workbook.definedNames.removeAllNames(this.fullAddress)}},{key:"worksheet",get:function(){return this._row.worksheet}},{key:"workbook",get:function(){return this._row.worksheet.workbook}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(P){this.style.numFmt=P}},{key:"font",get:function(){return this.style.font},set:function(P){this.style.font=P}},{key:"alignment",get:function(){return this.style.alignment},set:function(P){this.style.alignment=P}},{key:"border",get:function(){return this.style.border},set:function(P){this.style.border=P}},{key:"fill",get:function(){return this.style.fill},set:function(P){this.style.fill=P}},{key:"protection",get:function(){return this.style.protection},set:function(P){this.style.protection=P}},{key:"address",get:function(){return this._address}},{key:"row",get:function(){return this._row.number}},{key:"col",get:function(){return this._column.number}},{key:"$col$row",get:function(){return"$".concat(this._column.letter,"$").concat(this.row)}},{key:"type",get:function(){return this._value.type}},{key:"effectiveType",get:function(){return this._value.effectiveType}},{key:"isMerged",get:function(){return this._mergeCount>0||this.type===O.Types.Merge}},{key:"master",get:function(){return this.type===O.Types.Merge?this._value.master:this}},{key:"isHyperlink",get:function(){return this._value.type===O.Types.Hyperlink}},{key:"hyperlink",get:function(){return this._value.hyperlink}},{key:"value",get:function(){return this._value.value},set:function(P){this.type!==O.Types.Merge?(this._value.release(),this._value=M.create(M.getType(P),this,P)):this._value.master.value=P}},{key:"note",get:function(){return this._comment&&this._comment.note},set:function(P){this._comment=new s(P)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return p.escapeHtml(this.text)}},{key:"formula",get:function(){return this._value.formula}},{key:"result",get:function(){return this._value.result}},{key:"formulaType",get:function(){return this._value.formulaType}},{key:"fullAddress",get:function(){return{sheetName:this._row.worksheet.name,address:this.address,row:this.row,col:this.col}}},{key:"name",get:function(){return this.names[0]},set:function(P){this.names=[P]}},{key:"names",get:function(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set:function(P){var _=this,S=this.workbook.definedNames;S.removeAllNames(this.fullAddress),P.forEach(function(g){S.addEx(_.fullAddress,g)})}},{key:"_dataValidations",get:function(){return this.worksheet.dataValidations}},{key:"dataValidation",get:function(){return this._dataValidations.find(this.address)},set:function(P){this._dataValidations.add(this.address,P)}},{key:"model",get:function(){var P=this._value.model;return P.style=this.style,this._comment&&(P.comment=this._comment.model),P},set:function(P){if(this._value.release(),this._value=M.create(P.type,this),this._value.model=P,P.comment)switch(P.comment.type){case"note":this._comment=s.fromModel(P.comment)}P.style?this.style=P.style:this.style={}}}]),O}();i.Types=c.ValueType;var e=function(){function O(P){b(this,O),this.model={address:P.address,type:i.Types.Null}}return v(O,[{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}},{key:"value",get:function(){return null},set:function(P){}},{key:"type",get:function(){return i.Types.Null}},{key:"effectiveType",get:function(){return i.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),t=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Number,value:_}}return v(O,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.Number}},{key:"effectiveType",get:function(){return i.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),r=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.String,value:_}}return v(O,[{key:"toCsvString",value:function(){return'"'.concat(this.model.value.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.String}},{key:"effectiveType",get:function(){return i.Types.String}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),o=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.String,value:_}}return v(O,[{key:"toString",value:function(){return this.model.value.richText.map(function(P){return P.text}).join("")}},{key:"toCsvString",value:function(){return'"'.concat(this.text.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.RichText}},{key:"effectiveType",get:function(){return i.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),n=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Date,value:_}}return v(O,[{key:"toCsvString",value:function(){return this.model.value.toISOString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.Date}},{key:"effectiveType",get:function(){return i.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),a=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Hyperlink,text:_?_.text:void 0,hyperlink:_?_.hyperlink:void 0},_&&_.tooltip&&(this.model.tooltip=_.tooltip)}return v(O,[{key:"toCsvString",value:function(){return this.model.hyperlink}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.text}},{key:"value",get:function(){var P={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(P.tooltip=this.model.tooltip),P},set:function(P){this.model={text:P.text,hyperlink:P.hyperlink},P.tooltip&&(this.model.tooltip=P.tooltip)}},{key:"text",get:function(){return this.model.text},set:function(P){this.model.text=P}},{key:"hyperlink",get:function(){return this.model.hyperlink},set:function(P){this.model.hyperlink=P}},{key:"type",get:function(){return i.Types.Hyperlink}},{key:"effectiveType",get:function(){return i.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),u=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Merge,master:_?_.address:void 0},this._master=_,_&&_.addMergeRef()}return v(O,[{key:"isMergedTo",value:function(P){return P===this._master}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){this._master.releaseMergeRef()}},{key:"toString",value:function(){return this.value.toString()}},{key:"value",get:function(){return this._master.value},set:function(P){P instanceof i?(this._master&&this._master.releaseMergeRef(),P.addMergeRef(),this._master=P):this._master.value=P}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return i.Types.Merge}},{key:"effectiveType",get:function(){return this._master.effectiveType}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),f=function(){function O(P,_){b(this,O),this.cell=P,this.model={address:P.address,type:i.Types.Formula,shareType:_?_.shareType:void 0,ref:_?_.ref:void 0,formula:_?_.formula:void 0,sharedFormula:_?_.sharedFormula:void 0,result:_?_.result:void 0}}return v(O,[{key:"_copyModel",value:function(P){var _={},S=function(g){var j=P[g];j&&(_[g]=j)};return S("formula"),S("result"),S("ref"),S("shareType"),S("sharedFormula"),_}},{key:"validate",value:function(P){switch(M.getType(P)){case i.Types.Null:case i.Types.String:case i.Types.Number:case i.Types.Date:break;case i.Types.Hyperlink:case i.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var P=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=P&&l(P.formula,P.address,this.model.address)}return this._translatedFormula}},{key:"toCsvString",value:function(){return"".concat(this.model.result||"")}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.result?this.model.result.toString():""}},{key:"value",get:function(){return this._copyModel(this.model)},set:function(P){this.model=this._copyModel(P)}},{key:"dependencies",get:function(){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)}}},{key:"formula",get:function(){return this.model.formula||this._getTranslatedFormula()},set:function(P){this.model.formula=P}},{key:"formulaType",get:function(){return this.model.formula?c.FormulaType.Master:this.model.sharedFormula?c.FormulaType.Shared:c.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(P){this.model.result=P}},{key:"type",get:function(){return i.Types.Formula}},{key:"effectiveType",get:function(){var P=this.model.result;return P==null?c.ValueType.Null:P instanceof String||typeof P=="string"?c.ValueType.String:typeof P=="number"?c.ValueType.Number:P instanceof Date?c.ValueType.Date:P.text&&P.hyperlink?c.ValueType.Hyperlink:P.formula?c.ValueType.Formula:c.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),y=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.SharedString,value:_}}return v(O,[{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.SharedString}},{key:"effectiveType",get:function(){return i.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),w=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Boolean,value:_}}return v(O,[{key:"toCsvString",value:function(){return this.model.value?1:0}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.Boolean}},{key:"effectiveType",get:function(){return i.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),T=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.Error,value:_}}return v(O,[{key:"toCsvString",value:function(){return this.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.error.toString()}},{key:"value",get:function(){return this.model.value},set:function(P){this.model.value=P}},{key:"type",get:function(){return i.Types.Error}},{key:"effectiveType",get:function(){return i.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),E=function(){function O(P,_){b(this,O),this.model={address:P.address,type:i.Types.String,value:JSON.stringify(_),rawValue:_}}return v(O,[{key:"toCsvString",value:function(){return this.model.value}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}},{key:"value",get:function(){return this.model.rawValue},set:function(P){this.model.rawValue=P,this.model.value=JSON.stringify(P)}},{key:"type",get:function(){return i.Types.String}},{key:"effectiveType",get:function(){return i.Types.String}},{key:"address",get:function(){return this.model.address},set:function(P){this.model.address=P}}]),O}(),M={getType:function(O){return O==null?i.Types.Null:O instanceof String||typeof O=="string"?i.Types.String:typeof O=="number"?i.Types.Number:typeof O=="boolean"?i.Types.Boolean:O instanceof Date?i.Types.Date:O.text&&O.hyperlink?i.Types.Hyperlink:O.formula||O.sharedFormula?i.Types.Formula:O.richText?i.Types.RichText:O.sharedString?i.Types.SharedString:O.error?i.Types.Error:i.Types.JSON},types:[{t:i.Types.Null,f:e},{t:i.Types.Number,f:t},{t:i.Types.String,f:r},{t:i.Types.Date,f:n},{t:i.Types.Hyperlink,f:a},{t:i.Types.Formula,f},{t:i.Types.Merge,f:u},{t:i.Types.JSON,f:E},{t:i.Types.SharedString,f:y},{t:i.Types.RichText,f:o},{t:i.Types.Boolean,f:w},{t:i.Types.Error,f:T}].reduce(function(O,P){return O[P.t]=P.f,O},[]),create:function(O,P,_){var S=this.types[O];if(!S)throw new Error("Could not create Value of type ".concat(O));return new S(P,_)}};I.exports=i},{"../utils/col-cache":19,"../utils/shared-formula":22,"../utils/under-dash":25,"./enums":7,"./note":9}],4:[function(h,I,R){function b(c,l){for(var s=0;s<l.length;s++){var i=l[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(c,i.key,i)}}var m=h("../utils/under-dash"),v=h("./enums"),d=h("../utils/col-cache"),p=function(){function c(e,t,r){(function(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")})(this,c),this._worksheet=e,this._number=t,r!==!1&&(this.defn=r)}var l,s,i;return l=c,i=[{key:"toModel",value:function(e){var t=[],r=null;return e&&e.forEach(function(o,n){o.isDefault?r&&(r=null):r&&o.equivalentTo(r)?r.max=n+1:(r={min:n+1,max:n+1,width:o.width!==void 0?o.width:9,style:o.style,isCustomWidth:o.isCustomWidth,hidden:o.hidden,outlineLevel:o.outlineLevel,collapsed:o.collapsed},t.push(r))}),t.length?t:void 0}},{key:"fromModel",value:function(e,t){t=t||[];for(var r=[],o=1,n=0;n<t.length;){for(var a=t[n++];o<a.min;)r.push(new c(e,o++));for(;o<=a.max;)r.push(new c(e,o++,a))}return r.length?r:null}}],(s=[{key:"toString",value:function(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}},{key:"equivalentTo",value:function(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&m.isEqual(this.style,e.style)}},{key:"eachCell",value:function(e,t){var r=this.number;t||(t=e,e=null),this._worksheet.eachRow(e,function(o,n){t(o.getCell(r),n)})}},{key:"_applyStyle",value:function(e,t){return this.style[e]=t,this.eachCell(function(r){r[e]=t}),t}},{key:"number",get:function(){return this._number}},{key:"worksheet",get:function(){return this._worksheet}},{key:"letter",get:function(){return d.n2l(this._number)}},{key:"isCustomWidth",get:function(){return this.width!==void 0&&this.width!==9}},{key:"defn",get:function(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}},set:function(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)}},{key:"headers",get:function(){return this._header&&this._header instanceof Array?this._header:[this._header]}},{key:"header",get:function(){return this._header},set:function(e){var t=this;e!==void 0?(this._header=e,this.headers.forEach(function(r,o){t._worksheet.getCell(o+1,t.number).value=r})):this._header=void 0}},{key:"key",get:function(){return this._key},set:function(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}},{key:"hidden",get:function(){return!!this._hidden},set:function(e){this._hidden=e}},{key:"outlineLevel",get:function(){return this._outlineLevel||0},set:function(e){this._outlineLevel=e}},{key:"collapsed",get:function(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}},{key:"isDefault",get:function(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;var e=this.style;return!e||!(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection)}},{key:"headerCount",get:function(){return this.headers.length}},{key:"values",get:function(){var e=[];return this.eachCell(function(t,r){t&&t.type!==v.ValueType.Null&&(e[r]=t.value)}),e},set:function(e){var t=this;if(e){var r=this.number,o=0;e.hasOwnProperty("0")&&(o=1),e.forEach(function(n,a){t._worksheet.getCell(a+o,r).value=n})}}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(e){this._applyStyle("numFmt",e)}},{key:"font",get:function(){return this.style.font},set:function(e){this._applyStyle("font",e)}},{key:"alignment",get:function(){return this.style.alignment},set:function(e){this._applyStyle("alignment",e)}},{key:"protection",get:function(){return this.style.protection},set:function(e){this._applyStyle("protection",e)}},{key:"border",get:function(){return this.style.border},set:function(e){this._applyStyle("border",e)}},{key:"fill",get:function(){return this.style.fill},set:function(e){this._applyStyle("fill",e)}}])&&b(l.prototype,s),i&&b(l,i),c}();I.exports=p},{"../utils/col-cache":19,"../utils/under-dash":25,"./enums":7}],5:[function(h,I,R){function b(v,d){for(var p=0;p<d.length;p++){var c=d[p];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(v,c.key,c)}}var m=function(){function v(c){(function(l,s){if(!(l instanceof s))throw new TypeError("Cannot call a class as a function")})(this,v),this.model=c||{}}var d,p;return d=v,(p=[{key:"add",value:function(c,l){return this.model[c]=l}},{key:"find",value:function(c){return this.model[c]}},{key:"remove",value:function(c){this.model[c]=void 0}}])&&b(d.prototype,p),v}();I.exports=m},{}],6:[function(h,I,R){function b(s,i){for(var e=0;e<i.length;e++){var t=i[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(s,t.key,t)}}var m=h("../utils/under-dash"),v=h("../utils/col-cache"),d=h("../utils/cell-matrix"),p=h("./range"),c=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/,l=function(){function s(){(function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")})(this,s),this.matrixMap={}}var i,e;return i=s,(e=[{key:"getMatrix",value:function(t){return this.matrixMap[t]||(this.matrixMap[t]=new d)}},{key:"add",value:function(t,r){var o=v.decodeEx(t);this.addEx(o,r)}},{key:"addEx",value:function(t,r){var o=this.getMatrix(r);if(t.top)for(var n=t.left;n<=t.right;n++)for(var a=t.top;a<=t.bottom;a++){var u={sheetName:t.sheetName,address:v.n2l(n)+a,row:a,col:n};o.addCellEx(u)}else o.addCellEx(t)}},{key:"remove",value:function(t,r){var o=v.decodeEx(t);this.removeEx(o,r)}},{key:"removeEx",value:function(t,r){this.getMatrix(r).removeCellEx(t)}},{key:"removeAllNames",value:function(t){m.each(this.matrixMap,function(r){r.removeCellEx(t)})}},{key:"forEach",value:function(t){m.each(this.matrixMap,function(r,o){r.forEach(function(n){t(o,n)})})}},{key:"getNames",value:function(t){return this.getNamesEx(v.decodeEx(t))}},{key:"getNamesEx",value:function(t){return m.map(this.matrixMap,function(r,o){return r.findCellEx(t)&&o}).filter(Boolean)}},{key:"_explore",value:function(t,r){r.mark=!1;var o,n,a=r.sheetName,u=new p(r.row,r.col,r.row,r.col,a);function f(w,T){var E=t.findCellAt(a,w,r.col);return!(!E||!E.mark||(u[T]=w,E.mark=!1,0))}for(n=r.row-1;f(n,"top");n--);for(n=r.row+1;f(n,"bottom");n++);function y(w,T){var E=[];for(n=u.top;n<=u.bottom;n++){var M=t.findCellAt(a,n,w);if(!M||!M.mark)return!1;E.push(M)}u[T]=w;for(var O=0;O<E.length;O++)E[O].mark=!1;return!0}for(o=r.col-1;y(o,"left");o--);for(o=r.col+1;y(o,"right");o++);return u}},{key:"getRanges",value:function(t,r){var o=this;return(r=r||this.matrixMap[t])?(r.forEach(function(n){n.mark=!0}),{name:t,ranges:r.map(function(n){return n.mark&&o._explore(r,n)}).filter(Boolean).map(function(n){return n.$shortRange})}):{name:t,ranges:[]}}},{key:"normaliseMatrix",value:function(t,r){t.forEachInSheet(r,function(o,n,a){o&&(o.row===n&&o.col===a||(o.row=n,o.col=a,o.address=v.n2l(a)+n))})}},{key:"spliceRows",value:function(t,r,o,n){var a=this;m.each(this.matrixMap,function(u){u.spliceRows(t,r,o,n),a.normaliseMatrix(u,t)})}},{key:"spliceColumns",value:function(t,r,o,n){var a=this;m.each(this.matrixMap,function(u){u.spliceColumns(t,r,o,n),a.normaliseMatrix(u,t)})}},{key:"model",get:function(){var t=this;return m.map(this.matrixMap,function(r,o){return t.getRanges(o,r)}).filter(function(r){return r.ranges.length})},set:function(t){var r=this.matrixMap={};t.forEach(function(o){var n=r[o.name]=new d;o.ranges.forEach(function(a){c.test(a.split("!").pop()||"")&&n.addCell(a)})})}}])&&b(i.prototype,e),s}();I.exports=l},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":25,"./range":10}],7:[function(h,I,R){I.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(h,I,R){function b(p,c){for(var l=0;l<c.length;l++){var s=c[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}var m=h("../utils/col-cache"),v=h("./anchor"),d=function(){function p(s,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,p),this.worksheet=s,this.model=i}var c,l;return c=p,(l=[{key:"model",get:function(){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:function(s){var i=s.type,e=s.imageId,t=s.range,r=s.hyperlinks;if(this.type=i,this.imageId=e,i==="image")if(typeof t=="string"){var o=m.decode(t);this.range={tl:new v(this.worksheet,{col:o.left,row:o.top},-1),br:new v(this.worksheet,{col:o.right,row:o.bottom},0),editAs:"oneCell"}}else this.range={tl:new v(this.worksheet,t.tl,0),br:t.br&&new v(this.worksheet,t.br,0),ext:t.ext,editAs:t.editAs,hyperlinks:r||t.hyperlinks}}}])&&b(c.prototype,l),p}();I.exports=d},{"../utils/col-cache":19,"./anchor":2}],9:[function(h,I,R){function b(p){return(b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c})(p)}function m(p,c){for(var l=0;l<c.length;l++){var s=c[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}var v=h("../utils/under-dash"),d=function(){function p(i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,p),this.note=i}var c,l,s;return c=p,s=[{key:"fromModel",value:function(i){var e=new p;return e.model=i,e}}],(l=[{key:"model",get:function(){var i=null;switch(b(this.note)){case"string":i={type:"note",note:{texts:[{text:this.note}]}};break;default:i={type:"note",note:this.note}}return v.deepMerge({},p.DEFAULT_CONFIGS,i)},set:function(i){var e=i.note,t=e.texts;t.length===1&&Object.keys(t[0]).length===1?this.note=t[0].text:this.note=e}}])&&m(c.prototype,l),s&&m(c,s),p}();d.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},I.exports=d},{"../utils/under-dash":25}],10:[function(h,I,R){function b(p,c){if(!(p instanceof c))throw new TypeError("Cannot call a class as a function")}function m(p,c){for(var l=0;l<c.length;l++){var s=c[l];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(p,s.key,s)}}var v=h("../utils/col-cache"),d=function(){function p(){b(this,p),this.decode(arguments)}var c,l;return c=p,(l=[{key:"setTLBR",value:function(s,i,e,t,r){if(arguments.length<4){var o=v.decodeAddress(s),n=v.decodeAddress(i);this.model={top:Math.min(o.row,n.row),left:Math.min(o.col,n.col),bottom:Math.max(o.row,n.row),right:Math.max(o.col,n.col),sheetName:e},this.setTLBR(o.row,o.col,n.row,n.col,r)}else this.model={top:Math.min(s,e),left:Math.min(i,t),bottom:Math.max(s,e),right:Math.max(i,t),sheetName:r}}},{key:"decode",value:function(s){switch(s.length){case 5:this.setTLBR(s[0],s[1],s[2],s[3],s[4]);break;case 4:this.setTLBR(s[0],s[1],s[2],s[3]);break;case 3:this.setTLBR(s[0],s[1],s[2]);break;case 2:this.setTLBR(s[0],s[1]);break;case 1:var i=s[0];if(i instanceof p)this.model={top:i.model.top,left:i.model.left,bottom:i.model.bottom,right:i.model.right,sheetName:i.sheetName};else if(i instanceof Array)this.decode(i);else if(i.top&&i.left&&i.bottom&&i.right)this.model={top:i.top,left:i.left,bottom:i.bottom,right:i.right,sheetName:i.sheetName};else{var e=v.decodeEx(i);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() - ".concat(s.length))}}},{key:"expand",value:function(s,i,e,t){(!this.model.top||s<this.top)&&(this.top=s),(!this.model.left||i<this.left)&&(this.left=i),(!this.model.bottom||e>this.bottom)&&(this.bottom=e),(!this.model.right||t>this.right)&&(this.right=t)}},{key:"expandRow",value:function(s){if(s){var i=s.dimensions,e=s.number;i&&this.expand(e,i.min,e,i.max)}}},{key:"expandToAddress",value:function(s){var i=v.decodeEx(s);this.expand(i.row,i.col,i.row,i.col)}},{key:"toString",value:function(){return this.range}},{key:"intersects",value:function(s){return!(s.sheetName&&this.sheetName&&s.sheetName!==this.sheetName||s.bottom<this.top||s.top>this.bottom||s.right<this.left||s.left>this.right)}},{key:"contains",value:function(s){var i=v.decodeEx(s);return this.containsEx(i)}},{key:"containsEx",value:function(s){return(!s.sheetName||!this.sheetName||s.sheetName===this.sheetName)&&s.row>=this.top&&s.row<=this.bottom&&s.col>=this.left&&s.col<=this.right}},{key:"forEachAddress",value:function(s){for(var i=this.left;i<=this.right;i++)for(var e=this.top;e<=this.bottom;e++)s(v.encodeAddress(e,i),e,i)}},{key:"top",get:function(){return this.model.top||1},set:function(s){this.model.top=s}},{key:"left",get:function(){return this.model.left||1},set:function(s){this.model.left=s}},{key:"bottom",get:function(){return this.model.bottom||1},set:function(s){this.model.bottom=s}},{key:"right",get:function(){return this.model.right||1},set:function(s){this.model.right=s}},{key:"sheetName",get:function(){return this.model.sheetName},set:function(s){this.model.sheetName=s}},{key:"_serialisedSheetName",get:function(){var s=this.model.sheetName;return s?/^[a-zA-Z0-9]*$/.test(s)?"".concat(s,"!"):"'".concat(s,"'!"):""}},{key:"tl",get:function(){return v.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(v.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return v.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(v.n2l(this.right),"$").concat(this.bottom)}},{key:"range",get:function(){return"".concat(this._serialisedSheetName+this.tl,":").concat(this.br)}},{key:"$range",get:function(){return"".concat(this._serialisedSheetName+this.$t$l,":").concat(this.$b$r)}},{key:"shortRange",get:function(){return this.count>1?this.range:this._serialisedSheetName+this.tl}},{key:"$shortRange",get:function(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}},{key:"count",get:function(){return(1+this.bottom-this.top)*(1+this.right-this.left)}}])&&m(c.prototype,l),p}();I.exports=d},{"../utils/col-cache":19}],11:[function(h,I,R){function b(l,s){for(var i=0;i<s.length;i++){var e=s[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(l,e.key,e)}}var m=h("../utils/under-dash"),v=h("./enums"),d=h("../utils/col-cache"),p=h("./cell"),c=function(){function l(e,t){(function(r,o){if(!(r instanceof o))throw new TypeError("Cannot call a class as a function")})(this,l),this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}var s,i;return s=l,(i=[{key:"commit",value:function(){this._worksheet._commitRow(this)}},{key:"destroy",value:function(){delete this._worksheet,delete this._cells,delete this.style}},{key:"findCell",value:function(e){return this._cells[e-1]}},{key:"getCellEx",value:function(e){var t=this._cells[e.col-1];if(!t){var r=this._worksheet.getColumn(e.col);t=new p(this,r,e.address),this._cells[e.col-1]=t}return t}},{key:"getCell",value:function(e){if(typeof e=="string"){var t=this._worksheet.getColumnKey(e);e=t?t.number:d.l2n(e)}return this._cells[e-1]||this.getCellEx({address:d.encodeAddress(this._number,e),row:this._number,col:e})}},{key:"splice",value:function(e,t){for(var r=e+t,o=arguments.length,n=new Array(o>2?o-2:0),a=2;a<o;a++)n[a-2]=arguments[a];var u,f,y,w=n.length-t,T=this._cells.length;if(w<0)for(u=e+n.length;u<=T;u++)y=this._cells[u-1],(f=this._cells[u-w-1])?((y=this.getCell(u)).value=f.value,y.style=f.style,y._comment=f._comment):y&&(y.value=null,y.style={},y._comment=void 0);else if(w>0)for(u=T;u>=r;u--)(f=this._cells[u-1])?((y=this.getCell(u+w)).value=f.value,y.style=f.style,y._comment=f._comment):this._cells[u+w-1]=void 0;for(u=0;u<n.length;u++)(y=this.getCell(e+u)).value=n[u],y.style={},y._comment=void 0}},{key:"eachCell",value:function(e,t){if(t||(t=e,e=null),e&&e.includeEmpty)for(var r=this._cells.length,o=1;o<=r;o++)t(this.getCell(o),o);else this._cells.forEach(function(n,a){n&&n.type!==v.ValueType.Null&&t(n,a+1)})}},{key:"addPageBreak",value:function(e,t){var r=this._worksheet,o=Math.max(0,e-1)||0,n=Math.max(0,t-1)||16838,a={id:this._number,max:n,man:1};o&&(a.min=o),r.rowBreaks.push(a)}},{key:"_applyStyle",value:function(e,t){return this.style[e]=t,this._cells.forEach(function(r){r&&(r[e]=t)}),t}},{key:"number",get:function(){return this._number}},{key:"worksheet",get:function(){return this._worksheet}},{key:"values",get:function(){var e=[];return this._cells.forEach(function(t){t&&t.type!==v.ValueType.Null&&(e[t.col]=t.value)}),e},set:function(e){var t=this;if(this._cells=[],e)if(e instanceof Array){var r=0;e.hasOwnProperty("0")&&(r=1),e.forEach(function(o,n){o!==void 0&&(t.getCellEx({address:d.encodeAddress(t._number,n+r),row:t._number,col:n+r}).value=o)})}else this._worksheet.eachColumnKey(function(o,n){e[n]!==void 0&&(t.getCellEx({address:d.encodeAddress(t._number,o.number),row:t._number,col:o.number}).value=e[n])})}},{key:"hasValues",get:function(){return m.some(this._cells,function(e){return e&&e.type!==v.ValueType.Null})}},{key:"cellCount",get:function(){return this._cells.length}},{key:"actualCellCount",get:function(){var e=0;return this.eachCell(function(){e++}),e}},{key:"dimensions",get:function(){var e=0,t=0;return this._cells.forEach(function(r){r&&r.type!==v.ValueType.Null&&((!e||e>r.col)&&(e=r.col),t<r.col&&(t=r.col))}),e>0?{min:e,max:t}:null}},{key:"numFmt",get:function(){return this.style.numFmt},set:function(e){this._applyStyle("numFmt",e)}},{key:"font",get:function(){return this.style.font},set:function(e){this._applyStyle("font",e)}},{key:"alignment",get:function(){return this.style.alignment},set:function(e){this._applyStyle("alignment",e)}},{key:"protection",get:function(){return this.style.protection},set:function(e){this._applyStyle("protection",e)}},{key:"border",get:function(){return this.style.border},set:function(e){this._applyStyle("border",e)}},{key:"fill",get:function(){return this.style.fill},set:function(e){this._applyStyle("fill",e)}},{key:"hidden",get:function(){return!!this._hidden},set:function(e){this._hidden=e}},{key:"outlineLevel",get:function(){return this._outlineLevel||0},set:function(e){this._outlineLevel=e}},{key:"collapsed",get:function(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}},{key:"model",get:function(){var e=[],t=0,r=0;return this._cells.forEach(function(o){if(o){var n=o.model;n&&((!t||t>o.col)&&(t=o.col),r<o.col&&(r=o.col),e.push(n))}}),this.height||e.length?{cells:e,number:this.number,min:t,max:r,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null},set:function(e){var t,r=this;if(e.number!==this._number)throw new Error("Invalid row number in model");this._cells=[],e.cells.forEach(function(o){switch(o.type){case p.Types.Merge:break;default:var n;if(o.address)n=d.decodeAddress(o.address);else if(t){var a=t.row,u=t.col+1;n={row:a,col:u,address:d.encodeAddress(a,u),$col$row:"$".concat(d.n2l(u),"$").concat(a)}}t=n,r.getCellEx(n).model=o}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}}])&&b(s.prototype,i),l}();I.exports=c},{"../utils/col-cache":19,"../utils/under-dash":25,"./cell":3,"./enums":7}],12:[function(h,I,R){function b(l,s){if(!(l instanceof s))throw new TypeError("Cannot call a class as a function")}function m(l,s){for(var i=0;i<s.length;i++){var e=s[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(l,e.key,e)}}function v(l,s,i){return s&&m(l.prototype,s),i&&m(l,i),l}var d=h("../utils/col-cache"),p=function(){function l(s,i,e){b(this,l),this.table=s,this.column=i,this.index=e}return v(l,[{key:"_set",value:function(s,i){this.table.cacheState(),this.column[s]=i}},{key:"name",get:function(){return this.column.name},set:function(s){this._set("name",s)}},{key:"filterButton",get:function(){return this.column.filterButton},set:function(s){this.column.filterButton=s}},{key:"style",get:function(){return this.column.style},set:function(s){this.column.style=s}},{key:"totalsRowLabel",get:function(){return this.column.totalsRowLabel},set:function(s){this._set("totalsRowLabel",s)}},{key:"totalsRowFunction",get:function(){return this.column.totalsRowFunction},set:function(s){this._set("totalsRowFunction",s)}},{key:"totalsRowResult",get:function(){return this.column.totalsRowResult},set:function(s){this._set("totalsRowResult",s)}},{key:"totalsRowFormula",get:function(){return this.column.totalsRowFormula},set:function(s){this._set("totalsRowFormula",s)}}]),l}(),c=function(){function l(s,i){b(this,l),this.worksheet=s,i&&(this.table=i,this.validate(),this.store())}return v(l,[{key:"getFormula",value:function(s){switch(s.totalsRowFunction){case"none":return null;case"average":return"SUBTOTAL(101,".concat(this.table.name,"[").concat(s.name,"])");case"countNums":return"SUBTOTAL(102,".concat(this.table.name,"[").concat(s.name,"])");case"count":return"SUBTOTAL(103,".concat(this.table.name,"[").concat(s.name,"])");case"max":return"SUBTOTAL(104,".concat(this.table.name,"[").concat(s.name,"])");case"min":return"SUBTOTAL(105,".concat(this.table.name,"[").concat(s.name,"])");case"stdDev":return"SUBTOTAL(106,".concat(this.table.name,"[").concat(s.name,"])");case"var":return"SUBTOTAL(107,".concat(this.table.name,"[").concat(s.name,"])");case"sum":return"SUBTOTAL(109,".concat(this.table.name,"[").concat(s.name,"])");case"custom":return s.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: ".concat(s.totalsRowFunction))}}},{key:"validate",value:function(){var s=this,i=this.table,e=function(y,w,T){y[w]===void 0&&(y[w]=T)};e(i,"headerRow",!0),e(i,"totalsRow",!1),e(i,"style",{}),e(i.style,"theme","TableStyleMedium2"),e(i.style,"showFirstColumn",!1),e(i.style,"showLastColumn",!1),e(i.style,"showRowStripes",!1),e(i.style,"showColumnStripes",!1);var t=function(y,w){if(!y)throw new Error(w)};t(i.ref,"Table must have ref"),t(i.columns,"Table must have column definitions"),t(i.rows,"Table must have row definitions"),i.tl=d.decodeAddress(i.ref);var r=i.tl,o=r.row,n=r.col;t(o>0,"Table must be on valid row"),t(n>0,"Table must be on valid col");var a=this.width,u=this.filterHeight,f=this.tableHeight;i.autoFilterRef=d.encode(o,n,o+u-1,n+a-1),i.tableRef=d.encode(o,n,o+f-1,n+a-1),i.columns.forEach(function(y,w){t(y.name,"Column ".concat(w," must have a name")),w===0?e(y,"totalsRowLabel","Total"):(e(y,"totalsRowFunction","none"),y.totalsRowFormula=s.getFormula(y))})}},{key:"store",value:function(){var s=this,i=function(y,w){w&&Object.keys(w).forEach(function(T){y[T]=w[T]})},e=this.worksheet,t=this.table,r=t.tl,o=r.row,n=r.col,a=0;if(t.headerRow){var u=e.getRow(o+a++);t.columns.forEach(function(y,w){var T=y.style,E=y.name,M=u.getCell(n+w);M.value=E,i(M,T)})}if(t.rows.forEach(function(y){var w=e.getRow(o+a++);y.forEach(function(T,E){var M=w.getCell(n+E);M.value=T,i(M,t.columns[E].style)})}),t.totalsRow){var f=e.getRow(o+a++);t.columns.forEach(function(y,w){var T=f.getCell(n+w);if(w===0)T.value=y.totalsRowLabel;else{var E=s.getFormula(y);T.value=E?{formula:y.totalsRowFormula,result:y.totalsRowResult}:null}i(T,y.style)})}}},{key:"load",value:function(s){var i=this,e=this.table,t=e.tl,r=t.row,o=t.col,n=0;if(e.headerRow){var a=s.getRow(r+n++);e.columns.forEach(function(f,y){a.getCell(o+y).value=f.name})}if(e.rows.forEach(function(f){var y=s.getRow(r+n++);f.forEach(function(w,T){y.getCell(o+T).value=w})}),e.totalsRow){var u=s.getRow(r+n++);e.columns.forEach(function(f,y){var w=u.getCell(o+y);y===0?w.value=f.totalsRowLabel:i.getFormula(f)&&(w.value={formula:f.totalsRowFormula,result:f.totalsRowResult})})}}},{key:"cacheState",value:function(){this._cache||(this._cache={ref:this.ref,width:this.width,tableHeight:this.tableHeight})}},{key:"commit",value:function(){if(this._cache){this.validate();var s=d.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(var i=0;i<this._cache.tableHeight;i++)for(var e=this.worksheet.getRow(s.row+i),t=0;t<this._cache.width;t++)e.getCell(s.col+t).value=null;else{for(var r=this.tableHeight;r<this._cache.tableHeight;r++)for(var o=this.worksheet.getRow(s.row+r),n=0;n<this._cache.width;n++)o.getCell(s.col+n).value=null;for(var a=0;a<this.tableHeight;a++)for(var u=this.worksheet.getRow(s.row+a),f=this.width;f<this._cache.width;f++)u.getCell(s.col+f).value=null}this.store()}}},{key:"addRow",value:function(s,i){this.cacheState(),i===void 0?this.table.rows.push(s):this.table.rows.splice(i,0,s)}},{key:"removeRows",value:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(s,i)}},{key:"getColumn",value:function(s){var i=this.table.columns[s];return new p(this,i,s)}},{key:"addColumn",value:function(s,i,e){this.cacheState(),e===void 0?(this.table.columns.push(s),this.table.rows.forEach(function(t,r){t.push(i[r])})):(this.table.columns.splice(e,0,s),this.table.rows.forEach(function(t,r){t.splice(e,0,i[r])}))}},{key:"removeColumns",value:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(s,i),this.table.rows.forEach(function(e){e.splice(s,i)})}},{key:"_assign",value:function(s,i,e){this.cacheSt