exceljs
Version:
Excel Workbook Manager - Read and Write xlsx and csv Files.
4 lines (3 loc) • 475 kB
JavaScript
/*! ExcelJS 16-12-2017 */
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.ExcelJS=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";function d(a,b,c){switch(void 0===c&&(c=!0),a.toLowerCase()){case"promise":if(!c&&e.Promish)return;e.Promish=b}}var e=a("../utils/promish");b.exports=d},{"../utils/promish":15}],2:[function(a,b,c){"use strict";var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e=a("fs"),f=a("fast-csv"),g=a("moment"),h=a("../utils/promish"),i=a("../utils/utils"),j={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!"}};(b.exports=function(a){this.workbook=a,this.worksheet=null}).prototype={readFile:function(a,b){var c=this;b=b||{};var d;return i.fs.exists(a).then(function(f){if(!f)throw new Error("File not found: "+a);return d=e.createReadStream(a),c.read(d,b)}).then(function(a){return d.close(),a})},read:function(a,b){var c=this;return b=b||{},new h.Promish(function(d,e){var f=c.createInputStream(b).on("worksheet",d).on("error",e);a.pipe(f)})},createInputStream:function(a){a=a||{};var b=this.workbook.addWorksheet(a.sheetName),c=a.dateFormats||[g.ISO_8601,"MM-DD-YYYY","YYYY-MM-DD"],d=a.map||function(a){if(""===a)return null;if(!isNaN(a))return parseFloat(a);var b=g(a,c,!0);if(b.isValid())return new Date(b.valueOf());var d=j[a];return void 0!==d?d:a},e=f(a).on("data",function(a){b.addRow(a.map(d))}).on("end",function(){e.emit("worksheet",b)});return e},write:function(a,b){var c=this;return new h.Promish(function(e,h){b=b||{};var i=c.workbook.getWorksheet(b.sheetName||b.sheetId),j=f.createWriteStream(b);a.on("finish",function(){e()}),j.on("error",h),j.pipe(a);var k=b.dateFormat,l=b.map||function(a){if(a){if(a.text||a.hyperlink)return a.hyperlink||a.text||"";if(a.formula||a.result)return a.result||"";if(a instanceof Date)return k?g(a).format(k):g(a).format();if(a.error)return a.error;if("object"===(void 0===a?"undefined":d(a)))return JSON.stringify(a)}return a},m=void 0===b.includeEmptyRows||b.includeEmptyRows,n=1;i&&i.eachRow(function(a,b){if(m)for(;n++<b-1;)j.write([]);var c=a.values;c.shift(),j.write(c.map(l)),n=b}),j.end()})},writeFile:function(a,b){b=b||{};var c={encoding:b.encoding||"utf8"},d=e.createWriteStream(a,c);return this.write(d,b)}}},{"../utils/promish":15,"../utils/utils":20,"fast-csv":125,fs:93,moment:176}],3:[function(a,b,c){"use strict";var d=a("../utils/col-cache"),e=a("./enums"),f=a("../utils/shared-formula"),g=f.slideFormula,h=b.exports=function(a,b,c){if(!a||!b)throw new Error("A Cell needs a Row");this._row=a,this._column=b,d.validateAddress(c),this._address=c,this._value=u.create(h.Types.Null,this),this.style=this._mergeStyle(a.style,b.style,{}),this._mergeCount=0};h.Types=e.ValueType,h.prototype={get worksheet(){return this._row.worksheet},get workbook(){return this._row.worksheet.workbook},destroy:function(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address},get numFmt(){return this.style.numFmt},set numFmt(a){this.style.numFmt=a},get font(){return this.style.font},set font(a){this.style.font=a},get alignment(){return this.style.alignment},set alignment(a){this.style.alignment=a},get border(){return this.style.border},set border(a){this.style.border=a},get fill(){return this.style.fill},set fill(a){this.style.fill=a},_mergeStyle:function(a,b,c){var d=a&&a.numFmt||b&&b.numFmt;d&&(c.numFmt=d);var e=a&&a.font||b&&b.font;e&&(c.font=e);var f=a&&a.alignment||b&&b.alignment;f&&(c.alignment=f);var g=a&&a.border||b&&b.border;g&&(c.border=g);var h=a&&a.fill||b&&b.fill;return h&&(c.fill=h),c},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:function(){return this._value.toCsvString()},addMergeRef:function(){this._mergeCount++},releaseMergeRef:function(){this._mergeCount--},get isMerged(){return this._mergeCount>0||this.type===h.Types.Merge},merge:function(a){this._value.release(),this._value=u.create(h.Types.Merge,this,a),this.style=a.style},unmerge:function(){this.type===h.Types.Merge&&(this._value.release(),this._value=u.create(h.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))},isMergedTo:function(a){return this._value.type===h.Types.Merge&&this._value.isMergedTo(a)},get master(){return this.type===h.Types.Merge?this._value.master:this},get isHyperlink(){return this._value.type===h.Types.Hyperlink},get hyperlink(){return this._value.hyperlink},get value(){return this._value.value},set value(a){if(this.type===h.Types.Merge)return void(this._value.master.value=a);this._value.release(),this._value=u.create(u.getType(a),this,a)},get text(){return this._value.toString()},toString:function(){return this.text},_upgradeToHyperlink:function(a){this.type===h.Types.String&&(this._value=u.create(h.Types.Hyperlink,this,{text:this._value.value,hyperlink:a}))},get formula(){return this._value.formula},get result(){return this._value.result},get formulaType(){return this._value.formulaType},get fullAddress(){return{sheetName:this._row.worksheet.name,address:this.address,row:this.row,col:this.col}},get name(){return this.names[0]},set name(a){this.names=[a]},get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set names(a){var b=this,c=this.workbook.definedNames;this.workbook.definedNames.removeAllNames(b.fullAddress),a.forEach(function(a){c.addEx(b.fullAddress,a)})},addName:function(a){this.workbook.definedNames.addEx(this.fullAddress,a)},removeName:function(a){this.workbook.definedNames.removeEx(this.fullAddress,a)},removeAllNames:function(){this.workbook.definedNames.removeAllNames(this.fullAddress)},get _dataValidations(){return this.worksheet.dataValidations},get dataValidation(){return this._dataValidations.find(this.address)},set dataValidation(a){this._dataValidations.add(this.address,a)},get model(){var a=this._value.model;return a.style=this.style,a},set model(a){this._value.release(),this._value=u.create(a.type,this),this._value.model=a,a.style?this.style=a.style:this.style={}}};var i=function(a){this.model={address:a.address,type:h.Types.Null}};i.prototype={get value(){return null},set value(a){},get type(){return h.Types.Null},get effectiveType(){return h.Types.Null},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return""},release:function(){},toString:function(){return""}};var j=function(a,b){this.model={address:a.address,type:h.Types.Number,value:b}};j.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.Number},get effectiveType(){return h.Types.Number},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return""+this.model.value},release:function(){},toString:function(){return this.model.value.toString()}};var k=function(a,b){this.model={address:a.address,type:h.Types.String,value:b}};k.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.String},get effectiveType(){return h.Types.String},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return'"'+this.model.value.replace(/"/g,'""')+'"'},release:function(){},toString:function(){return this.model.value}};var l=function(a,b){this.model={address:a.address,type:h.Types.String,value:b}};l.prototype={get value(){return this.model.value},set value(a){this.model.value=a},toString:function(){return this.model.value.richText.map(function(a){return a.text}).join("")},get type(){return h.Types.RichText},get effectiveType(){return h.Types.RichText},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return'"'+this.text.replace(/"/g,'""')+'"'},release:function(){}};var m=function(a,b){this.model={address:a.address,type:h.Types.Date,value:b}};m.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.Date},get effectiveType(){return h.Types.Date},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return this.model.value.toISOString()},release:function(){},toString:function(){return this.model.value.toString()}};var n=function(a,b){this.model={address:a.address,type:h.Types.Hyperlink,text:b?b.text:void 0,hyperlink:b?b.hyperlink:void 0}};n.prototype={get value(){return{text:this.model.text,hyperlink:this.model.hyperlink}},set value(a){this.model.text=a.text,this.model.hyperlink=a.hyperlink},get text(){return this.model.text},set text(a){this.model.text=a},get hyperlink(){return this.model.hyperlink},set hyperlink(a){this.model.hyperlink=a},get type(){return h.Types.Hyperlink},get effectiveType(){return h.Types.Hyperlink},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return this.model.hyperlink},release:function(){},toString:function(){return this.model.text}};var o=function(a,b){this.model={address:a.address,type:h.Types.Merge,master:b?b.address:void 0},this._master=b,b&&b.addMergeRef()};o.prototype={get value(){return this._master.value},set value(a){a instanceof h?(this._master&&this._master.releaseMergeRef(),a.addMergeRef(),this._master=a):this._master.value=a},isMergedTo:function(a){return a===this._master},get master(){return this._master},get type(){return h.Types.Merge},get effectiveType(){return this._master.effectiveType},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return""},release:function(){this._master.releaseMergeRef()},toString:function(){return this.value.toString()}};var p=function(a,b){this.cell=a,this.model={address:a.address,type:h.Types.Formula,formula:b?b.formula:void 0,sharedFormula:b?b.sharedFormula:void 0,result:b?b.result:void 0}};p.prototype={get value(){return this.model.formula?{formula:this.model.formula,result:this.model.result}:{sharedFormula:this.model.sharedFormula,result:this.model.result}},set value(a){this.model.formula=a.formula,this.model.sharedFormula=a.sharedFormula,this.model.result=a.result},validate:function(a){switch(u.getType(a)){case h.Types.Null:case h.Types.String:case h.Types.Number:case h.Types.Date:break;case h.Types.Hyperlink:case h.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(a){this.model.formula=a},get formulaType(){return this.model.formula?e.FormulaType.Master:this.model.sharedFormula?e.FormulaType.Shared:e.FormulaType.None},get result(){return this.model.result},set result(a){this.model.result=a},get type(){return h.Types.Formula},get effectiveType(){var a=this.model.result;return null===a||void 0===a?e.ValueType.Null:a instanceof String||"string"==typeof a?e.ValueType.String:"number"==typeof a?e.ValueType.Number:a instanceof Date?e.ValueType.Date:a.text&&a.hyperlink?e.ValueType.Hyperlink:a.formula?e.ValueType.Formula:e.ValueType.Null},get address(){return this.model.address},set address(a){this.model.address=a},_getTranslatedFormula:function(){if(!this._translatedFormula&&this.model.sharedFormula){var a=this.cell.worksheet,b=a.findCell(this.model.sharedFormula);this._translatedFormula=b&&g(b.formula,b.address,this.model.address)}return this._translatedFormula},toCsvString:function(){return""+(this.model.result||"")},release:function(){},toString:function(){return this.model.result?this.model.result.toString():""}};var q=function(a,b){this.model={address:a.address,type:h.Types.SharedString,value:b}};q.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.SharedString},get effectiveType(){return h.Types.SharedString},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return""+this.model.value},release:function(){},toString:function(){return this.model.value.toString()}};var r=function(a,b){this.model={address:a.address,type:h.Types.Boolean,value:b}};r.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.Boolean},get effectiveType(){return h.Types.Boolean},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return this.model.value?1:0},release:function(){},toString:function(){return this.model.value.toString()}};var s=function(a,b){this.model={address:a.address,type:h.Types.Error,value:b}};s.prototype={get value(){return this.model.value},set value(a){this.model.value=a},get type(){return h.Types.Error},get effectiveType(){return h.Types.Error},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return this.toString()},release:function(){},toString:function(){return this.model.value.error.toString()}};var t=function(a,b){this.model={address:a.address,type:h.Types.String,value:JSON.stringify(b),rawValue:b}};t.prototype={get value(){return this.model.rawValue},set value(a){this.model.rawValue=a,this.model.value=JSON.stringify(a)},get type(){return h.Types.String},get effectiveType(){return h.Types.String},get address(){return this.model.address},set address(a){this.model.address=a},toCsvString:function(){return this.model.value},release:function(){},toString:function(){return this.model.value}};var u={getType:function(a){return null===a||void 0===a?h.Types.Null:a instanceof String||"string"==typeof a?h.Types.String:"number"==typeof a?h.Types.Number:"boolean"==typeof a?h.Types.Boolean:a instanceof Date?h.Types.Date:a.text&&a.hyperlink?h.Types.Hyperlink:a.formula||a.sharedFormula?h.Types.Formula:a.richText?h.Types.RichText:a.sharedString?h.Types.SharedString:a.error?h.Types.Error:h.Types.JSON},types:[{t:h.Types.Null,f:i},{t:h.Types.Number,f:j},{t:h.Types.String,f:k},{t:h.Types.Date,f:m},{t:h.Types.Hyperlink,f:n},{t:h.Types.Formula,f:p},{t:h.Types.Merge,f:o},{t:h.Types.JSON,f:t},{t:h.Types.SharedString,f:q},{t:h.Types.RichText,f:l},{t:h.Types.Boolean,f:r},{t:h.Types.Error,f:s}].reduce(function(a,b){return a[b.t]=b.f,a},[]),create:function(a,b,c){var d=this.types[a];if(!d)throw new Error("Could not create Value of type "+a);return new d(b,c)}}},{"../utils/col-cache":14,"../utils/shared-formula":16,"./enums":7}],4:[function(a,b,c){"use strict";var d=a("../utils/under-dash"),e=a("../utils/col-cache"),f=b.exports=function(a,b,c){this._worksheet=a,this._number=b,!1!==c&&(this.defn=c)};f.prototype={get number(){return this._number},get worksheet(){return this._worksheet},get letter(){return e.n2l(this._number)},get isCustomWidth(){return void 0!==this.width&&8!==this.width},get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}},set defn(a){a?(this.key=a.key,this.width=a.width,this.outlineLevel=a.outlineLevel,a.style?this.style=a.style:this.style={},this.header=a.header,this._hidden=!!a.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(a){var b=this;void 0!==a?(this._header=a,this.headers.forEach(function(a,c){b._worksheet.getCell(c+1,b.number).value=a})):this._header=[]},get key(){return this._key},set key(a){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=a,a&&this._worksheet.setColumnKey(this._key,this)},get hidden(){return!!this._hidden},set hidden(a){this._hidden=a},get outlineLevel(){return this._outlineLevel||0},set outlineLevel(a){this._outlineLevel=a},get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)},toString:function(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})},equivalentTo:function(a){return this.width===a.width&&this.hidden===a.hidden&&this.outlineLevel===a.outlineLevel&&d.isEqual(this.style,a.style)},get isDefault(){if(this.isCustomWidth)return!1;if(this.hidden)return!1;if(this.outlineLevel)return!1;var a=this.style;return!a||!(a.font||a.numFmt||a.alignment||a.border||a.fill)},get headerCount(){return this.headers.length},eachCell:function(a,b){var c=this.number;b||(b=a,a=null),a&&a.includeEmpty?this._worksheet.eachRow(a,function(a,d){b(a.getCell(c),d)}):this._worksheet.eachRow(function(a,d){var e=a.findCell(c);e&&b(e,d)})},_applyStyle:function(a,b){return this.style[a]=b,this.eachCell(function(c){c[a]=b}),b},get numFmt(){return this.style.numFmt},set numFmt(a){this._applyStyle("numFmt",a)},get font(){return this.style.font},set font(a){this._applyStyle("font",a)},get alignment(){return this.style.alignment},set alignment(a){this._applyStyle("alignment",a)},get border(){return this.style.border},set border(a){this._applyStyle("border",a)},get fill(){return this.style.fill},set fill(a){this._applyStyle("fill",a)}},f.toModel=function(a){var b=[],c=null;return a&&a.forEach(function(a,d){a.isDefault?c&&(c=null):c&&a.equivalentTo(c)?c.max=d+1:(c={min:d+1,max:d+1,width:a.width,style:a.style,isCustomWidth:a.isCustomWidth,hidden:a.hidden,outlineLevel:a.outlineLevel,collapsed:a.collapsed},b.push(c))}),b.length?b:void 0},f.fromModel=function(a,b){b=b||[];for(var c=[],d=1,e=0;e<b.length;){for(var g=b[e++];d<g.min;)c.push(new f(a,d++));for(;d<=g.max;)c.push(new f(a,d++,g))}return c.length?c:null}},{"../utils/col-cache":14,"../utils/under-dash":19}],5:[function(a,b,c){"use strict";(b.exports=function(a){this.model=a||{}}).prototype={add:function(a,b){return this.model[a]=b},find:function(a){return this.model[a]},remove:function(a){this.model[a]=void 0}}},{}],6:[function(a,b,c){"use strict";var d=a("../utils/under-dash"),e=a("../utils/col-cache"),f=a("../utils/cell-matrix"),g=a("./range"),h=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;(b.exports=function(){this.matrixMap={}}).prototype={getMatrix:function(a){return this.matrixMap[a]||(this.matrixMap[a]=new f)},add:function(a,b){var c=e.decodeEx(a);this.addEx(c,b)},addEx:function(a,b){var c=this.getMatrix(b);if(a.top)for(var d=a.left;d<=a.right;d++)for(var f=a.top;f<=a.bottom;f++){var g={sheetName:a.sheetName,address:e.n2l(d)+f,row:f,col:d};c.addCellEx(g)}else c.addCellEx(a)},remove:function(a,b){var c=e.decodeEx(a);this.removeEx(c,b)},removeEx:function(a,b){this.getMatrix(b).removeCellEx(a)},removeAllNames:function(a){d.each(this.matrixMap,function(b){b.removeCellEx(a)})},forEach:function(a){d.each(this.matrixMap,function(b,c){b.forEach(function(b){a(c,b)})})},getNames:function(a){return this.getNamesEx(e.decodeEx(a))},getNamesEx:function(a){return d.map(this.matrixMap,function(b,c){return b.findCellEx(a)&&c}).filter(Boolean)},_explore:function(a,b){function c(c,d){var e=a.findCellAt(h,c,b.col);return!(!e||!e.mark||(i[d]=c,e.mark=!1,0))}function d(b,c){var d,e=[];for(f=i.top;f<=i.bottom;f++){if(!(d=a.findCellAt(h,f,b))||!d.mark)return!1;e.push(d)}i[c]=b;for(var g=0;g<e.length;g++)e[g].mark=!1;return!0}b.mark=!1;var e,f,h=b.sheetName,i=new g(b.row,b.col,b.row,b.col,h);for(f=b.row-1;c(f,"top");f--);for(f=b.row+1;c(f,"bottom");f++);for(e=b.col-1;d(e,"left");e--);for(e=b.col+1;d(e,"right");e++);return i},getRanges:function(a,b){var c=this;return(b=b||this.matrixMap[a])?(b.forEach(function(a){a.mark=!0}),{name:a,ranges:b.map(function(a){return a.mark&&c._explore(b,a)}).filter(Boolean).map(function(a){return a.$shortRange})}):{name:a,ranges:[]}},get model(){var a=this;return d.map(this.matrixMap,function(b,c){return a.getRanges(c,b)}).filter(function(a){return a.ranges.length})},set model(a){var b=this.matrixMap={};a.forEach(function(a){var c=b[a.name]=new f;a.ranges.forEach(function(a){h.test(a.split("!").pop()||"")&&c.addCell(a)})})}}},{"../utils/cell-matrix":13,"../utils/col-cache":14,"../utils/under-dash":19,"./range":8}],7:[function(a,b,c){"use strict";b.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(a,b,c){"use strict";var d=a("./../utils/col-cache"),e=b.exports=function(){this.decode(arguments)};e.prototype={_set_tlbr:function(a,b,c,d,e){this.model={top:Math.min(a,c),left:Math.min(b,d),bottom:Math.max(a,c),right:Math.max(b,d),sheetName:e}},_set_tl_br:function(a,b,c){a=d.decodeAddress(a),b=d.decodeAddress(b),this._set_tlbr(a.row,a.col,b.row,b.col,c)},decode:function(a){switch(a.length){case 5:this._set_tlbr(a[0],a[1],a[2],a[3],a[4]);break;case 4:this._set_tlbr(a[0],a[1],a[2],a[3]);break;case 3:this._set_tl_br(a[0],a[1],a[2]);break;case 2:this._set_tl_br(a[0],a[1]);break;case 1:var b=a[0];if(b instanceof e)this.model={top:b.model.top,left:b.model.left,bottom:b.model.bottom,right:b.model.right,sheetName:b.sheetName};else if(b instanceof Array)this.decode(b);else if(b.top&&b.left&&b.bottom&&b.right)this.model={top:b.top,left:b.left,bottom:b.bottom,right:b.right,sheetName:b.sheetName};else{var c=d.decodeEx(b);c.top?this.model={top:c.top,left:c.left,bottom:c.bottom,right:c.right,sheetName:c.sheetName}:this.model={top:c.row,left:c.col,bottom:c.row,right:c.col,sheetName:c.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() - "+a.length)}},get top(){return this.model.top||1},set top(a){this.model.top=a},get left(){return this.model.left||1},set left(a){this.model.left=a},get bottom(){return this.model.bottom||1},set bottom(a){this.model.bottom=a},get right(){return this.model.right||1},set right(a){this.model.right=a},get sheetName(){return this.model.sheetName},set sheetName(a){this.model.sheetName=a},get _serialisedSheetName(){var a=this.model.sheetName;return a?/^[a-zA-Z0-9]*$/.test(a)?a+"!":"'"+a+"'!":""},expand:function(a,b,c,d){(!this.model.top||a<this.top)&&(this.top=a),(!this.model.left||b<this.left)&&(this.left=b),(!this.model.bottom||c>this.bottom)&&(this.bottom=c),(!this.model.right||d>this.right)&&(this.right=d)},expandRow:function(a){if(a){var b=a.dimensions;b&&this.expand(a.number,b.min,a.number,b.max)}},expandToAddress:function(a){var b=d.decodeEx(a);this.expand(b.row,b.col,b.row,b.col)},get tl(){return d.n2l(this.left)+this.top},get $t$l(){return"$"+d.n2l(this.left)+"$"+this.top},get br(){return d.n2l(this.right)+this.bottom},get $b$r(){return"$"+d.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:function(){return this.range},intersects:function(a){return(!a.sheetName||!this.sheetName||a.sheetName===this.sheetName)&&(!(a.bottom<this.top)&&(!(a.top>this.bottom)&&(!(a.right<this.left)&&!(a.left>this.right))))},contains:function(a){var b=d.decodeEx(a);return this.containsEx(b)},containsEx:function(a){return(!a.sheetName||!this.sheetName||a.sheetName===this.sheetName)&&(a.row>=this.top&&a.row<=this.bottom&&a.col>=this.left&&a.col<=this.right)}}},{"./../utils/col-cache":14}],9:[function(a,b,c){"use strict";var d=a("../utils/under-dash"),e=a("./enums"),f=a("./../utils/col-cache"),g=a("./cell");(b.exports=function(a,b){this._worksheet=a,this._number=b,this._cells=[],this.style={},this.outlineLevel=0}).prototype={get number(){return this._number},get worksheet(){return this._worksheet},commit:function(){this._worksheet._commitRow(this)},destroy:function(){delete this._worksheet,delete this._cells,delete this.style},findCell:function(a){return this._cells[a-1]},getCellEx:function(a){var b=this._cells[a.col-1];if(!b){var c=this._worksheet.getColumn(a.col);b=new g(this,c,a.address),this._cells[a.col-1]=b}return b},getCell:function(a){if("string"==typeof a){var b=this._worksheet.getColumnKey(a);a=b?b.number:f.l2n(a)}return this._cells[a-1]||this.getCellEx({address:f.encodeAddress(this._number,a),row:this._number,col:a})},splice:function(a,b){var c,d,e,f=Array.prototype.slice.call(arguments,2),g=a+b,h=f.length-b,i=this._cells.length;if(h<0)for(c=g;c<=i;c++)d=this._cells[c-1],d?(this.getCell(c+h).value=d.value,d.value=null):(e=this._cells[c+h-1])&&(e.value=null);else if(h>0)for(c=i;c>=g;c--)d=this._cells[c-1],d?this.getCell(c+h).value=d.value:this._cells[c+h-1]=void 0;for(c=0;c<f.length;c++)this.getCell(a+c).value=f[c]},eachCell:function(a,b){if(b||(b=a,a=null),a&&a.includeEmpty)for(var c=this._cells.length,d=1;d<=c;d++)b(this.getCell(d),d);else this._cells.forEach(function(a,c){a&&a.type!==e.ValueType.Null&&b(a,c+1)})},addPageBreak:function(a,b){var c=this._worksheet,d=Math.max(0,a-1)||0,e=Math.max(0,b-1)||16838,f={id:this._number,max:e,man:1};d&&(f.min=d),c.rowBreaks.push(f)},get values(){var a=[];return this._cells.forEach(function(b){b&&b.type!==e.ValueType.Null&&(a[b.col]=b.value)}),a},set values(a){var b=this;if(this._cells=[],a)if(a instanceof Array){var c=0;a.hasOwnProperty("0")&&(c=1),a.forEach(function(a,d){void 0!==a&&(b.getCellEx({address:f.encodeAddress(b._number,d+c),row:b._number,col:d+c}).value=a)})}else this._worksheet.eachColumnKey(function(c,d){void 0!==a[d]&&(b.getCellEx({address:f.encodeAddress(b._number,c.number),row:b._number,col:c.number}).value=a[d])})},get hasValues(){return d.some(this._cells,function(a){return a&&a.type!==e.ValueType.Null})},get cellCount(){return this._cells.length},get actualCellCount(){var a=0;return this.eachCell(function(){a++}),a},get dimensions(){var a=0,b=0;return this._cells.forEach(function(c){c&&c.type!==e.ValueType.Null&&((!a||a>c.col)&&(a=c.col),b<c.col&&(b=c.col))}),a>0?{min:a,max:b}:null},_applyStyle:function(a,b){return this.style[a]=b,this._cells.forEach(function(c){c&&(c[a]=b)}),b},get numFmt(){return this.style.numFmt},set numFmt(a){this._applyStyle("numFmt",a)},get font(){return this.style.font},set font(a){this._applyStyle("font",a)},get alignment(){return this.style.alignment},set alignment(a){this._applyStyle("alignment",a)},get border(){return this.style.border},set border(a){this._applyStyle("border",a)},get fill(){return this.style.fill},set fill(a){this._applyStyle("fill",a)},get hidden(){return!!this._hidden},set hidden(a){this._hidden=a},get outlineLevel(){return this._outlineLevel||0},set outlineLevel(a){this._outlineLevel=a},get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)},get model(){var a=[],b=0,c=0;return this._cells.forEach(function(d){if(d){var e=d.model;e&&((!b||b>d.col)&&(b=d.col),c<d.col&&(c=d.col),a.push(e))}}),this.height||a.length?{cells:a,number:this.number,min:b,max:c,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null},set model(a){var b=this;if(a.number!==this._number)throw new Error("Invalid row number in model");this._cells=[],a.cells.forEach(function(a){switch(a.type){case g.Types.Merge:break;default:b.getCellEx(f.decodeAddress(a.address)).model=a}}),a.height?this.height=a.height:delete this.height,this.hidden=a.hidden,this.outlineLevel=a.outlineLevel||0,this.style=a.style||{}}}},{"../utils/under-dash":19,"./../utils/col-cache":14,"./cell":3,"./enums":7}],10:[function(a,b,c){"use strict";var d=a("./worksheet"),e=a("./defined-names"),f=a("./../xlsx/xlsx"),g=a("./../csv/csv");(b.exports=function(){this.created=new Date,this.modified=this.created,this.properties={},this._worksheets=[],this.views=[],this.media=[],this._definedNames=new e}).prototype={get xlsx(){return this._xlsx||(this._xlsx=new f(this))},get csv(){return this._csv||(this._csv=new g(this))},get nextId(){var a;for(a=1;a<this._worksheets.length;a++)if(!this._worksheets[a])return a;return this._worksheets.length||1},addWorksheet:function(a,b){var c=this.nextId;a=a||"sheet"+c,b&&("string"==typeof b?(console.trace('tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }'),b={properties:{tabColor:{argb:b}}}):(b.argb||b.theme||b.indexed)&&(console.trace("tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }"),b={properties:{tabColor:b}}));var e=Object.assign({},b,{id:c,name:a,workbook:this}),f=new d(e);return this._worksheets[c]=f,f},removeWorksheetEx:function(a){delete this._worksheets[a.id]},removeWorksheet:function(a){var b=this.getWorksheet(a);b&&b.destroy()},getWorksheet:function(a){return void 0===a?this._worksheets.find(function(a){return a}):"number"==typeof a?this._worksheets[a]:"string"==typeof a?this._worksheets.find(function(b){return b&&b.name===a}):void 0},get worksheets(){return this._worksheets.filter(Boolean)},eachSheet:function(a){this._worksheets.forEach(function(b){a(b,b.id)})},get definedNames(){return this._definedNames},clearThemes:function(){this._themes=void 0},addImage:function(a){var b=this.media.length;return this.media.push(Object.assign({},a,{type:"image"})),b},getImage:function(a){return this.media[a]},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.filter(Boolean).map(function(a){return a.model}),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}},set model(a){var b=this;this.creator=a.creator,this.lastModifiedBy=a.lastModifiedBy,this.lastPrinted=a.lastPrinted,this.created=a.created,this.modified=a.modified,this.company=a.company,this.manager=a.manager,this.title=a.title,this.subject=a.subject,this.keywords=a.keywords,this.category=a.category,this.description=a.description,this.language=a.language,this.revision=a.revision,this.contentStatus=a.contentStatus,this.properties=a.properties,this._worksheets=[],a.worksheets.forEach(function(a){var c=a.id,e=a.name;(b._worksheets[c]=new d({id:c,name:e,workbook:b})).model=a}),this._definedNames.model=a.definedNames,this.views=a.views,
this._themes=a.themes,this.media=a.media||[]}}},{"./../csv/csv":2,"./../xlsx/xlsx":87,"./defined-names":6,"./worksheet":11}],11:[function(a,b,c){"use strict";var d=a("../utils/under-dash"),e=a("./../utils/col-cache"),f=a("./range"),g=a("./row"),h=a("./column"),i=a("./enums"),j=a("./data-validations");(b.exports=function(a){a=a||{},this.id=a.id,this.name=a.name||"Sheet"+this.id,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this._workbook=a.workbook,this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},a.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!a.pageSetup||!a.pageSetup.fitToWidth&&!a.pageSetup.fitToHeight||a.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},a.pageSetup),this.dataValidations=new j,this.views=a.views||[],this.autoFilter=a.autoFilter||null,this._media=[]}).prototype={get workbook(){return this._workbook},destroy:function(){this._workbook.removeWorksheetEx(this)},get dimensions(){var a=new f;return this._rows.forEach(function(b){if(b){var c=b.dimensions;c&&a.expand(b.number,c.min,b.number,c.max)}}),a},get columns(){return this._columns},set columns(a){var b=this;this._headerRowCount=a.reduce(function(a,b){var c=b.header&&1||b.headers&&b.headers.length||0;return Math.max(a,c)},0);var c=1,d=this._columns=[];a.forEach(function(a){var e=new h(b,c++,!1);d.push(e),e.defn=a})},getColumnKey:function(a){return this._keys[a]},setColumnKey:function(a,b){this._keys[a]=b},deleteColumnKey:function(a){delete this._keys[a]},eachColumnKey:function(a){d.each(this._keys,a)},getColumn:function(a){if("string"==typeof a){var b=this._keys[a];if(b)return b;a=e.l2n(a)}if(this._columns||(this._columns=[]),a>this._columns.length)for(var c=this._columns.length+1;c<=a;)this._columns.push(new h(this,c++));return this._columns[a-1]},spliceColumns:function(a,b){var c,d=Array.prototype.slice.call(arguments,2),e=this._rows,f=e.length;if(d.length>0)for(c=0;c<f;c++){var g=[a,b];d.forEach(function(a){g.push(a[c]||null)});var h=this.getRow(c+1);h.splice.apply(h,g)}else this._rows.forEach(function(c){c&&c.splice(a,b)});var i=d.length-b,j=a+b,k=this._columns.length;if(i<0){for(c=j;c<=k;c++)this.getColumn(c+i).defn=this.getColumn(c).defn;for(c=k+i+1;c<=k;c++)this.getColumn(c).defn=null}else for(c=k;c>=j;c--)this.getColumn(c+i).defn=this.getColumn(c).defn;for(c=a;c<j+i;c++)this.getColumn(c).defn=null},get columnCount(){var a=0;return this.eachRow(function(b){a=Math.max(a,b.cellCount)}),a},get actualColumnCount(){var a=[],b=0;return this.eachRow(function(c){c.eachCell(function(c){var d=c.col;a[d]||(a[d]=!0,b++)})}),b},_commitRow:function(){},get _lastRowNumber(){for(var a=this._rows,b=a.length;b>0&&void 0===a[b-1];)b--;return b},get _nextRow(){return this._lastRowNumber+1},get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]},findRow:function(a){return this._rows[a-1]},get rowCount(){return this._lastRowNumber},get actualRowCount(){var a=0;return this.eachRow(function(){a++}),a},getRow:function(a){var b=this._rows[a-1];return b||(b=this._rows[a-1]=new g(this,a)),b},addRow:function(a){var b=this.getRow(this._nextRow);return b.values=a,b},addRows:function(a){var b=this;a.forEach(function(a){b.addRow(a)})},spliceRows:function(a,b){var c,d,e=Array.prototype.slice.call(arguments,2),f=a+b,g=e.length-b,h=this._rows.length;if(g<0)for(c=f;c<=h;c++)d=this._rows[c-1],d?(this.getRow(c+g).values=d.values,this._rows[c-1]=void 0):this._rows[c+g-1]=void 0;else if(g>0)for(c=h;c>=f;c--)d=this._rows[c-1],d?this.getRow(c+g).values=d.values:this._rows[c+g-1]=void 0;for(c=0;c<e.length;c++)this.getRow(a+c).values=e[c]},eachRow:function(a,b){if(b||(b=a,a=void 0),a&&a.includeEmpty)for(var c=this._rows.length,d=1;d<=c;d++)b(this.getRow(d),d);else this._rows.forEach(function(a){a&&a.hasValues&&b(a,a.number)})},getSheetValues:function(){var a=[];return this._rows.forEach(function(b){b&&(a[b.number]=b.values)}),a},findCell:function(a,b){var c=e.getAddress(a,b),d=this._rows[c.row-1];return d?d.findCell(c.col):void 0},getCell:function(a,b){var c=e.getAddress(a,b);return this.getRow(c.row).getCellEx(c)},mergeCells:function(){var a=new f(Array.prototype.slice.call(arguments,0));d.each(this._merges,function(b){if(b.intersects(a))throw new Error("Cannot merge already merged cells")});for(var b=this.getCell(a.top,a.left),c=a.top;c<=a.bottom;c++)for(var e=a.left;e<=a.right;e++)(c>a.top||e>a.left)&&this.getCell(c,e).merge(b);this._merges[b.address]=a},_unMergeMaster:function(a){var b=this._merges[a.address];if(b){for(var c=b.top;c<=b.bottom;c++)for(var d=b.left;d<=b.right;d++)this.getCell(c,d).unmerge();delete this._merges[a.address]}},get hasMerges(){return d.some(this._merges,function(){return!0})},unMergeCells:function(){for(var a=new f(Array.prototype.slice.call(arguments,0)),b=a.top;b<=a.bottom;b++)for(var c=a.left;c<=a.right;c++){var d=this.findCell(b,c);d&&(d.type===i.ValueType.Merge?this._unMergeMaster(d.master):this._merges[d.address]&&this._unMergeMaster(d))}},fillFormula:function(a,b,c){var d,f=e.decode(a),g=f.top,h=f.left,i=f.bottom,j=f.right,k=j-h+1,l=e.encodeAddress(g,h);d="function"==typeof c?c:Array.isArray(c)?Array.isArray(c[0])?function(a,b){return c[a-g][b-h]}:function(a,b){return c[(a-g)*k+(b-h)]}:function(){};for(var m=!0,n=g;n<=i;n++)for(var o=h;o<=j;o++)m?(this.getCell(n,o).value={formula:b,result:d(n,o)},m=!1):this.getCell(n,o).value={sharedFormula:l,result:d(n,o)}},addImage:function(a,b){this._media.push({type:"image",imageId:a,range:b})},getImages:function(){return this._media.filter(function(a){return"image"===a.type})},addBackgroundImage:function(a){this._media.push({type:"background",imageId:a})},getBackgroundImageId:function(){return this._media.filter(function(a){return"background"===a.type}).map(function(a){return a.imageId})[0]},get tabColor(){return console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor},set tabColor(a){console.trace("worksheet.tabColor property is now deprecated. Please use worksheet.properties.tabColor"),this.properties.tabColor=a},get model(){var a={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,pageSetup:this.pageSetup,rowBreaks:this.rowBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media};a.cols=h.toModel(this.columns);var b=a.rows=[],c=a.dimensions=new f;return this._rows.forEach(function(a){var d=a&&a.model;d&&(c.expand(d.number,d.min,d.number,d.max),b.push(d))}),a.merges=[],d.each(this._merges,function(b){a.merges.push(b.range)}),a},_parseRows:function(a){var b=this;this._rows=[],a.rows.forEach(function(a){var c=new g(b,a.number);b._rows[c.number-1]=c,c.model=a})},_parseMergeCells:function(a){var b=this;d.each(a.mergeCells,function(a){b.mergeCells(a)})},set model(a){this.name=a.name,this._columns=h.fromModel(this,a.cols),this._parseRows(a),this._parseMergeCells(a),this.dataValidations=new j(a.dataValidations),this.properties=a.properties,this.pageSetup=a.pageSetup,this.views=a.views,this.autoFilter=a.autoFilter,this._media=a.media}}},{"../utils/under-dash":19,"./../utils/col-cache":14,"./column":4,"./data-validations":5,"./enums":7,"./range":8,"./row":9}],12:[function(a,b,c){"use strict";a("./config/set-value")("promise",a("promish/dist/promish-node"),!1);var d={Workbook:a("./doc/workbook")},e=a("./doc/enums");Object.keys(e).forEach(function(a){d[a]=e[a]}),b.exports=d},{"./config/set-value":1,"./doc/enums":7,"./doc/workbook":10,"promish/dist/promish-node":198}],13:[function(a,b,c){"use strict";var d=a("./under-dash"),e=a("./col-cache"),f=function(a){this.template=a,this.sheets={}};f.prototype={addCell:function(a){this.addCellEx(e.decodeEx(a))},getCell:function(a){return this.findCellEx(e.decodeEx(a),!0)},findCell:function(a){return this.findCellEx(e.decodeEx(a),!1)},findCellAt:function(a,b,c){var d=this.sheets[a],e=d&&d[b];return e&&e[c]},addCellEx:function(a){if(a.top)for(var b=a.top;b<=a.bottom;b++)for(var c=a.left;c<=a.right;c++)this.getCellAt(a.sheetName,b,c);else this.findCellEx(a,!0)},getCellEx:function(a){return this.findCellEx(a,!0)},findCellEx:function(a,b){var c=this.findSheet(a,b),d=this.findSheetRow(c,a,b);return this.findRowCell(d,a,b)},getCellAt:function(a,b,c){var d=this.sheets[a]||(this.sheets[a]=[]),f=d[b]||(d[b]=[]);return f[c]||(f[c]={sheetName:a,address:e.n2l(c)+b,row:b,col:c})},removeCellEx:function(a){var b=this.findSheet(a);if(b){var c=this.findSheetRow(b,a);c&&delete c[a.col]}},forEach:function(a){d.each(this.sheets,function(b){b&&b.forEach(function(b){b&&b.forEach(function(b){b&&a(b)})})})},map:function(a){var b=[];return this.forEach(function(c){b.push(a(c))}),b},findSheet:function(a,b){var c=a.sheetName;return this.sheets[c]?this.sheets[c]:b?this.sheets[c]=[]:void 0},findSheetRow:function(a,b,c){var d=b.row;return a&&a[d]?a[d]:c?a[d]=[]:void 0},findRowCell:function(a,b,c){var d=b.col;return a&&a[d]?a[d]:c?a[d]=this.template?Object.assign(b,JSON.parse(JSON.stringify(this.template))):b:void 0}},b.exports=f},{"./col-cache":14,"./under-dash":19}],14:[function(a,b,c){"use strict";var d=b.exports={_dictionary:["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],_l2n:{},_n2l:[],_level:function(a){return a<=26?1:a<=676?2:3},_fill:function(a){var b,c,d,e,f,g=1;if(a>=1)for(;g<=26;)b=this._dictionary[g-1],this._n2l[g]=b,this._l2n[b]=g,g++;if(a>=2)for(;g<=702;)c=g-27,d=c%26,e=Math.floor(c/26),b=this._dictionary[e]+this._dictionary[d],this._n2l[g]=b,this._l2n[b]=g,g++;if(a>=3)for(;g<=16384;)c=g-703,d=c%26,e=Math.floor(c/26)%26,f=Math.floor(c/676),b=this._dictionary[f]+this._dictionary[e]+this._dictionary[d],this._n2l[g]=b,this._l2n[b]=g,g++},l2n:function(a){if(this._l2n[a]||this._fill(a.length),!this._l2n[a])throw new Error("Out of bounds. Invalid column letter: "+a);return this._l2n[a]},n2l:function(a){if(a<1||a>16384)throw new Error(a+" is out of bounds. Excel supports columns from 1 to 16384");return this._n2l[a]||this._fill(this._level(a)),this._n2l[a]},_hash:{},validateAddress:function(a){if(!a.match(/^[A-Z]+\d+$/))throw new Error("Invalid Address: "+a);return!0},decodeAddress:function(a){var b=this._hash[a];if(b)return b;var c=a.match(/[A-Z]+/)[0],d=this.l2n(c),e=a.match(/\d+/)[0],f=parseInt(e,10);a=c+e;var g={address:a,col:d,row:f,$col$row:"$"+c+"$"+e};return d<=100&&f<=100&&(this._hash[a]=g,this._hash[g.$col$row]=g),g},getAddress:function(a,b){if(b){var c=this.n2l(b)+a;return this.decodeAddress(c)}return this.decodeAddress(a)},decode:function(a){var b=a.split(":");if(2===b.length){var c=this.decodeAddress(b[0]),d=this.decodeAddress(b[1]),e={top:Math.min(c.row,d.row),left:Math.min(c.col,d.col),bottom:Math.max(c.row,d.row),right:Math.max(c.col,d.col)};return e.tl=this.n2l(e.left)+e.top,e.br=this.n2l(e.right)+e.bottom,e.dimensions=e.tl+":"+e.br,e}return this.decodeAddress(a)},decodeEx:function(a){var b=a.match(/(?:(?:(?:'((?:[^']|'')*)')|([^'^ !]*))!)?(.*)/),c=b[1]||b[2],d=b[3],e=d.split(":");if(e.length>1){var f=this.decodeAddress(e[0]),g=this.decodeAddress(e[1]),h=Math.min(f.row,g.row),i=Math.min(f.col,g.col),j=Math.max(f.row,g.row),k=Math.max(f.col,g.col);return f=this.n2l(i)+h,g=this.n2l(k)+j,{top:h,left:i,bottom:j,right:k,sheetName:c,tl:{address:f,col:i,row:h,$col$row:"$"+this.n2l(i)+"$"+h,sheetName:c},br:{address:g,col:k,row:j,$col$row:"$"+this.n2l(k)+"$"+j,sheetName:c},dimensions:f+":"+g}}if(d.startsWith("#"))return c?{sheetName:c,error:d}:{error:d};var l=this.decodeAddress(d);return c?Object.assign({sheetName:c},l):l},encodeAddress:function(a,b){return d.n2l(b)+a},encode:function(){switch(arguments.length){case 2:return d.encodeAddress(arguments[0],arguments[1]);case 4:return d.encodeAddress(arguments[0],arguments[1])+":"+d.encodeAddress(arguments[2],arguments[3]);default:throw new Error("Can only encode with 2 or 4 arguments")}}}},{}],15:[function(a,b,c){"use strict";b.exports={Promish:null}},{}],16:[function(a,b,c){"use strict";var d=a("./col-cache"),e=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,f=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i,g=function(a,b,c){var g=d.decode(b),h=d.decode(c);return a.replace(e,function(a,b,c,e,i){if(i)return a;var j=f.exec(e);if(j){var k=j[1],l=j[2].toUpperCase(),m=j[3],n=j[4];if(l.length>3||3===l.length&&l>"XFD")return a;var o=d.l2n(l),p=parseInt(n,10);k||(o+=h.col-g.col),m||(p+=h.row-g.row);return(b||"")+(k||"")+d.n2l(o)+(m||"")+p}return a})};b.exports={slideFormula:g}},{"./col-cache":14}],17:[function(a,b,c){(function(c,d){"use strict";var e=a("stream"),f=a("./promish"),g=a("./utils"),h=a("./string-buf"),i=function(a,b){this._data=a,this._encoding=b};i.prototype={get length(){return this.toBuffer().length},copy:function(a,b,c,d){return this.toBuffer().copy(a,b,c,d)},toBuffer:function(){return this._buffer||(this._buffer=new d(this._data,this._encoding)),this._buffer}};var j=function(a){this._data=a};j.prototype={get length(){return this._data.length},copy:function(a,b,c,d){return this._data._buf.copy(a,b,c,d)},toBuffer:function(){return this._data.toBuffer()}};var k=function(a){this._data=a};k.prototype={get length(){return this._data.length},copy:function(a,b,c,d){this._data.copy(a,b,c,d)},toBuffer:function(){return this._data}};var l=function(a){this.size=a,this.buffer=new d(a),this.iRead=0,this.iWrite=0};l.prototype={toBuffer:function(){if(0===this.iRead&&this.iWrite===this.size)return this.buffer;var a=new d(this.iWrite-this.iRead);return this.buffer.copy(a,0,this.iRead,this.iWrite),a},get length(){return this.iWrite-this.iRead},get eod(){return this.iRead===this.iWrite},get full(){return this.iWrite===this.size},read:function(a){var b;return 0===a?null:void 0===a||a>=this.length?(b=this.toBuffer(),this.iRead=this.iWrite,b):(b=new d(a),this.buffer.copy(b,0,this.iRead,a),this.iRead+=a,b)},write:function(a,b,c){var d=Math.min(c,this.size-this.iWrite);return a.copy(this.buffer,this.iWrite,b,b+d),this.iWrite+=d,d}};var m=b.exports=function(a){a=a||{},this.bufSize=a.bufSize||1048576,this.buffers=[],this.batch=a.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};g.inherits(m,e.Duplex,{toBuffer:function(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return d.concat(this.buffers.map(function(a){return a.toBuffer()}))}},_getWritableBuffer:function(){if(this.buffers.length){var a=this.buffers[this.buffers.length-1];if(!a.full)return a}var b=new l(this.bufSize);return this.buffers.push(b),b},_pipe:function(a){var b=function(b){return new f.Promish(function(c){b.write(a.toBuffer(),function(){c()})})},c=this.pipes.map(b);return c.length?f.Promish.all(c).then(g.nop):f.Promish.resolve()},_writeToBuffers:function(a){for(var b=0,c=a.length;b<c;){b+=this._getWritableBuffer().write(a,b,c-b)}},write:function(a,b,e){b instanceof Function&&(e=b,b="utf8"),e=e||g.nop;var f;if(f=a instanceof h?new j(a):a instanceof d?new k(a):new i(a,b),this.pipes.length)if(this.batch)for(this._writeToBuffers(f);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(f),c.nextTick(e)):this._pipe(f).then(e);else this.paused||this.emit("data",f.toBuffer()),this._writeToBuffers(f),this.emit("readable");return!0},cork:function(){this.corked=!0},_flush:function(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork:function(){this.corked=!1,this._flush()},end:function(a,b,c){var d=this,e=function(a){a?c(a):(d._flush(),d.pipes.forEach(function(a){a.end()}),d.emit("finish"))};a?this.write(a,b,e):e()},read:function(a){var b;if(a){for(b=[];a&&this.buffers.length&&!this.buffers[0].eod;){var c=this.buffers[0],e=c.read(a);a-=e.length,b.push(e),c.eod&&c.full&&this.buffers.shift()}return d.concat(b)}return b=this.buffers.map(function(a){return a.toBuffer()}).filter(Boolean),this.buffers=[],d.concat(b)},setEncoding:function(a){this.encoding=a},pause:function(){this.paused=!0},resume:function(){this.paused=!1},isPaused:function(){return!!this.paused},pipe:function(a){this.pipes.push(a),!this.paused&&this.buffers.length&&this.end()},unpipe:function(a){this.pipes=this.pipes.filter(function(b){return b!==a})},unshift:function(){throw new Error("Not Implemented")},wrap:function(){throw new Error("Not Implemented")}})}).call(this,a("_process"),a("buffer").Buffer)},{"./promish":15,"./string-buf":18,"./utils":20,_process:196,buffer:94,stream:214}],18:[function(a,b,c){(function(a){"use strict";(b.exports=function(b){this._buf=new a(b&&b.size||16384),this._encoding=b&&b.encoding||"utf8",this._inPos=0,this._buffer=void 0}).prototype={get length(){return this._inPos},get capacity(){return this._buf.length},get buffer(){return this._buf},toBuffer:function(){return this._buffer||(this._buffer=new a(this.length),this._buf.copy(this._buffer,0,0,this.length)),this._buffer},reset:function(a){a=a||0,this._buffer=void 0,this._inPos=a},_grow:function(b){for(var c=2*this._buf.length;c<b;)c*=2;var d=new a(c);this._buf.copy(d,0),this._buf=d},addText:function(a){this._buffer=void 0;for(var b=this._inPos+this._buf.write(a,this._inPos,this._encoding);b>=this._buf.length-4;)this._grow(this._inPos+a.length),b=this._inPos+this._buf.write(a,this._inPos,this._encoding);this._inPos=b},addStringBuf:function(a){a.length&&(this._buffer=void 0,this.length+a.length>this.capacity&&this._grow(this.length+a.length),a._buf.copy(this._buf,this._inPos,0,a.length),this._inPos+=a.length)}}}).call(this,a("buffer").Buffer)},{buffer:94}],19:[function(a,b,c){"use strict";var d="function"==typeof Symbol&&"symbol"=