exceljs
Version:
Excel Workbook Manager - Read and Write xlsx and csv Files.
3 lines (2 loc) • 1.14 MB
JavaScript
/*! ExcelJS 14-07-2020 */
"use strict";function _createForOfIteratorHelper2(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=_unsupportedIterableToArray2(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,i,o=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function _toConsumableArray2(e){return _arrayWithoutHoles2(e)||_iterableToArray2(e)||_unsupportedIterableToArray2(e)||_nonIterableSpread2()}function _nonIterableSpread2(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray2(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray2(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray2(e,t):void 0}}function _iterableToArray2(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles2(e){if(Array.isArray(e))return _arrayLikeToArray2(e)}function _arrayLikeToArray2(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _get(e,t,r){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=_superPropBase(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(r):i.value}})(e,t,r||e)}function _superPropBase(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=_getPrototypeOf2(e)););return e}function _classCallCheck2(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass2(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _inherits2(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf2(e,t)}function _setPrototypeOf2(e,t){return(_setPrototypeOf2=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper2(e){return function(){var t,r=_getPrototypeOf2(e);if(_isNativeReflectConstruct2()){var n=_getPrototypeOf2(this).constructor;t=Reflect.construct(r,arguments,n)}else t=r.apply(this,arguments);return _possibleConstructorReturn2(this,t)}}function _possibleConstructorReturn2(e,t){return!t||"object"!==_typeof2(t)&&"function"!=typeof t?_assertThisInitialized2(e):t}function _assertThisInitialized2(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct2(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf2(e){return(_getPrototypeOf2=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _typeof2(e){return(_typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof2(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ExcelJS=e()}}((function(){var define,module,exports;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[a]={exports:{}};t[a][0].call(f.exports,(function(e){return i(t[a][1][e]||e)}),f,f.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,i)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function s(e){i(a,n,o,s,u,"next",e)}function u(e){i(a,n,o,s,u,"throw",e)}s(void 0)}))}}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=e("fs"),u=e("fast-csv"),c=e("dayjs/plugin/customParseFormat"),f=e("dayjs/plugin/utc"),l=e("dayjs").extend(c).extend(f),h=e("../utils/stream-buf"),d=e("../utils/utils").fs.exists,p={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!"}},m=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.workbook=t,this.worksheet=null}var t,r,i,c,f;return t=e,(r=[{key:"readFile",value:(f=o(regeneratorRuntime.mark((function e(t,r){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=r||{},e.next=3,d(t);case 3:if(e.sent){e.next=5;break}throw new Error("File not found: ".concat(t));case 5:return n=s.createReadStream(t),e.next=8,this.read(n,r);case 8:return i=e.sent,n.close(),e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"read",value:function(e,t){var r=this;return t=t||{},new Promise((function(n,i){var o=r.workbook.addWorksheet(t.sheetName),a=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(e){if(""===e)return null;var t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t;var r=a.reduce((function(t,r){if(t)return t;var n=l(e,r,!0);return n.isValid()?n:null}),null);if(r)return new Date(r.valueOf());var n=p[e];return void 0!==n?n:e},c=u.parse(t.parserOptions).on("data",(function(e){o.addRow(e.map(s))})).on("end",(function(){c.emit("worksheet",o)}));c.on("worksheet",n).on("error",i),e.pipe(c)}))}},{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(e,t){var r=this;return new Promise((function(i,o){t=t||{};var a=r.workbook.getWorksheet(t.sheetName||t.sheetId),s=u.format(t.formatterOptions);e.on("finish",(function(){i()})),s.on("error",o),s.pipe(e);var c=t,f=c.dateFormat,h=c.dateUTC,d=t.map||function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink||e.text||"";if(e.formula||e.result)return e.result||"";if(e instanceof Date)return f?h?l.utc(e).format(f):l(e).format(f):h?l.utc(e).format():l(e).format();if(e.error)return e.error;if("object"===n(e))return JSON.stringify(e)}return e},p=void 0===t.includeEmptyRows||t.includeEmptyRows,m=1;a&&a.eachRow((function(e,t){if(p)for(;m++<t-1;)s.write([]);var r=e.values;r.shift(),s.write(r.map(d)),m=t})),s.end()}))}},{key:"writeFile",value:function(e,t){var r={encoding:(t=t||{}).encoding||"utf8"},n=s.createWriteStream(e,r);return this.write(n,t)}},{key:"writeBuffer",value:(c=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new h,e.next=3,this.write(r,t);case 3:return e.abrupt("return",r.read());case 4:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})}])&&a(t.prototype,r),i&&a(t,i),e}();t.exports=m},{"../utils/stream-buf":21,"../utils/utils":24,dayjs:313,"dayjs/plugin/customParseFormat":314,"dayjs/plugin/utc":315,"fast-csv":346,fs:213}],2:[function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=e("../utils/col-cache"),a=function(){function e(t,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(n(this,e),r)if("string"==typeof r){var a=o.decodeAddress(r);this.nativeCol=a.col+i,this.nativeColOff=0,this.nativeRow=a.row+i,this.nativeRowOff=0}else void 0!==r.nativeCol?(this.nativeCol=r.nativeCol||0,this.nativeColOff=r.nativeColOff||0,this.nativeRow=r.nativeRow||0,this.nativeRowOff=r.nativeRowOff||0):void 0!==r.col?(this.col=r.col+i,this.row=r.row+i):(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=t}var t,r,a;return t=e,a=[{key:"asInstance",value:function(t){return t instanceof e||null==t?t:new e(t)}}],(r=[{key:"col",get:function(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth},set:function(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}},{key:"row",get:function(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight},set:function(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-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(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}}])&&i(t.prototype,r),a&&i(t,a),e}();t.exports=a},{"../utils/col-cache":17}],3:[function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}var a=e("../utils/col-cache"),s=e("../utils/under-dash"),u=e("./enums"),c=e("../utils/shared-formula").slideFormula,f=e("./note"),l=function(){function e(t,r,i){if(n(this,e),!t||!r)throw new Error("A Cell needs a Row");this._row=t,this._column=r,a.validateAddress(i),this._address=i,this._value=S.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,r.style,{}),this._mergeCount=0}return o(e,[{key:"destroy",value:function(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}},{key:"_mergeStyle",value:function(e,t,r){var n=e&&e.numFmt||t&&t.numFmt;n&&(r.numFmt=n);var i=e&&e.font||t&&t.font;i&&(r.font=i);var o=e&&e.alignment||t&&t.alignment;o&&(r.alignment=o);var a=e&&e.border||t&&t.border;a&&(r.border=a);var s=e&&e.fill||t&&t.fill;s&&(r.fill=s);var u=e&&e.protection||t&&t.protection;return u&&(r.protection=u),r}},{key:"toCsvString",value:function(){return this._value.toCsvString()}},{key:"addMergeRef",value:function(){this._mergeCount++}},{key:"releaseMergeRef",value:function(){this._mergeCount--}},{key:"merge",value:function(t,r){this._value.release(),this._value=S.create(e.Types.Merge,this,t),r||(this.style=t.style)}},{key:"unmerge",value:function(){this.type===e.Types.Merge&&(this._value.release(),this._value=S.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}},{key:"isMergedTo",value:function(t){return this._value.type===e.Types.Merge&&this._value.isMergedTo(t)}},{key:"toString",value:function(){return this.text}},{key:"_upgradeToHyperlink",value:function(t){this.type===e.Types.String&&(this._value=S.create(e.Types.Hyperlink,this,{text:this._value.value,hyperlink:t}))}},{key:"addName",value:function(e){this.workbook.definedNames.addEx(this.fullAddress,e)}},{key:"removeName",value:function(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}},{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(e){this.style.numFmt=e}},{key:"font",get:function(){return this.style.font},set:function(e){this.style.font=e}},{key:"alignment",get:function(){return this.style.alignment},set:function(e){this.style.alignment=e}},{key:"border",get:function(){return this.style.border},set:function(e){this.style.border=e}},{key:"fill",get:function(){return this.style.fill},set:function(e){this.style.fill=e}},{key:"protection",get:function(){return this.style.protection},set:function(e){this.style.protection=e}},{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===e.Types.Merge}},{key:"master",get:function(){return this.type===e.Types.Merge?this._value.master:this}},{key:"isHyperlink",get:function(){return this._value.type===e.Types.Hyperlink}},{key:"hyperlink",get:function(){return this._value.hyperlink}},{key:"value",get:function(){return this._value.value},set:function(t){this.type!==e.Types.Merge?(this._value.release(),this._value=S.create(S.getType(t),this,t)):this._value.master.value=t}},{key:"note",get:function(){return this._comment&&this._comment.note},set:function(e){this._comment=new f(e)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return s.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(e){this.names=[e]}},{key:"names",get:function(){return this.workbook.definedNames.getNamesEx(this.fullAddress)},set:function(e){var t=this,r=this.workbook.definedNames;r.removeAllNames(this.fullAddress),e.forEach((function(e){r.addEx(t.fullAddress,e)}))}},{key:"_dataValidations",get:function(){return this.worksheet.dataValidations}},{key:"dataValidation",get:function(){return this._dataValidations.find(this.address)},set:function(e){this._dataValidations.add(this.address,e)}},{key:"model",get:function(){var e=this._value.model;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e},set:function(e){if(this._value.release(),this._value=S.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case"note":this._comment=f.fromModel(e.comment)}e.style?this.style=e.style:this.style={}}}]),e}();l.Types=u.ValueType;var h=function(){function e(t){n(this,e),this.model={address:t.address,type:l.Types.Null}}return o(e,[{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}},{key:"value",get:function(){return null},set:function(e){}},{key:"type",get:function(){return l.Types.Null}},{key:"effectiveType",get:function(){return l.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),d=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Number,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Number}},{key:"effectiveType",get:function(){return l.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),p=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),m=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:r}}return o(e,[{key:"toString",value:function(){return this.model.value.richText.map((function(e){return e.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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.RichText}},{key:"effectiveType",get:function(){return l.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),y=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Date,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Date}},{key:"effectiveType",get:function(){return l.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),b=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Hyperlink,text:r?r.text:void 0,hyperlink:r?r.hyperlink:void 0},r&&r.tooltip&&(this.model.tooltip=r.tooltip)}return o(e,[{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 e={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(e.tooltip=this.model.tooltip),e},set:function(e){this.model={text:e.text,hyperlink:e.hyperlink},e.tooltip&&(this.model.tooltip=e.tooltip)}},{key:"text",get:function(){return this.model.text},set:function(e){this.model.text=e}},{key:"hyperlink",get:function(){return this.model.hyperlink},set:function(e){this.model.hyperlink=e}},{key:"type",get:function(){return l.Types.Hyperlink}},{key:"effectiveType",get:function(){return l.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),v=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Merge,master:r?r.address:void 0},this._master=r,r&&r.addMergeRef()}return o(e,[{key:"isMergedTo",value:function(e){return e===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(e){e instanceof l?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return l.Types.Merge}},{key:"effectiveType",get:function(){return this._master.effectiveType}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),g=function(){function e(t,r){n(this,e),this.cell=t,this.model={address:t.address,type:l.Types.Formula,shareType:r?r.shareType:void 0,ref:r?r.ref:void 0,formula:r?r.formula:void 0,sharedFormula:r?r.sharedFormula:void 0,result:r?r.result:void 0}}return o(e,[{key:"_copyModel",value:function(e){var t={},r=function(r){var n=e[r];n&&(t[r]=n)};return r("formula"),r("result"),r("ref"),r("shareType"),r("sharedFormula"),t}},{key:"validate",value:function(e){switch(S.getType(e)){case l.Types.Null:case l.Types.String:case l.Types.Number:case l.Types.Date:break;case l.Types.Hyperlink:case l.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var e=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=e&&c(e.formula,e.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(e){this.model=this._copyModel(e)}},{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(e){this.model.formula=e}},{key:"formulaType",get:function(){return this.model.formula?u.FormulaType.Master:this.model.sharedFormula?u.FormulaType.Shared:u.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(e){this.model.result=e}},{key:"type",get:function(){return l.Types.Formula}},{key:"effectiveType",get:function(){var e=this.model.result;return null==e?u.ValueType.Null:e instanceof String||"string"==typeof e?u.ValueType.String:"number"==typeof e?u.ValueType.Number:e instanceof Date?u.ValueType.Date:e.text&&e.hyperlink?u.ValueType.Hyperlink:e.formula?u.ValueType.Formula:u.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),w=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.SharedString,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.SharedString}},{key:"effectiveType",get:function(){return l.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),_=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Boolean,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Boolean}},{key:"effectiveType",get:function(){return l.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),k=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.Error,value:r}}return o(e,[{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(e){this.model.value=e}},{key:"type",get:function(){return l.Types.Error}},{key:"effectiveType",get:function(){return l.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),x=function(){function e(t,r){n(this,e),this.model={address:t.address,type:l.Types.String,value:JSON.stringify(r),rawValue:r}}return o(e,[{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(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}},{key:"type",get:function(){return l.Types.String}},{key:"effectiveType",get:function(){return l.Types.String}},{key:"address",get:function(){return this.model.address},set:function(e){this.model.address=e}}]),e}(),S={getType:function(e){return null==e?l.Types.Null:e instanceof String||"string"==typeof e?l.Types.String:"number"==typeof e?l.Types.Number:"boolean"==typeof e?l.Types.Boolean:e instanceof Date?l.Types.Date:e.text&&e.hyperlink?l.Types.Hyperlink:e.formula||e.sharedFormula?l.Types.Formula:e.richText?l.Types.RichText:e.sharedString?l.Types.SharedString:e.error?l.Types.Error:l.Types.JSON},types:[{t:l.Types.Null,f:h},{t:l.Types.Number,f:d},{t:l.Types.String,f:p},{t:l.Types.Date,f:y},{t:l.Types.Hyperlink,f:b},{t:l.Types.Formula,f:g},{t:l.Types.Merge,f:v},{t:l.Types.JSON,f:x},{t:l.Types.SharedString,f:w},{t:l.Types.RichText,f:m},{t:l.Types.Boolean,f:_},{t:l.Types.Error,f:k}].reduce((function(e,t){return e[t.t]=t.f,e}),[]),create:function(e,t,r){var n=this.types[e];if(!n)throw new Error("Could not create Value of type ".concat(e));return new n(t,r)}};t.exports=l},{"../utils/col-cache":17,"../utils/shared-formula":20,"../utils/under-dash":23,"./enums":7,"./note":9}],4:[function(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=e("../utils/under-dash"),o=e("./enums"),a=e("../utils/col-cache"),s=function(){function e(t,r,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._worksheet=t,this._number=r,!1!==n&&(this.defn=n)}var t,r,s;return t=e,s=[{key:"toModel",value:function(e){var t=[],r=null;return e&&e.forEach((function(e,n){e.isDefault?r&&(r=null):r&&e.equivalentTo(r)?r.max=n+1:(r={min:n+1,max:n+1,width:void 0!==e.width?e.width:9,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed},t.push(r))})),t.length?t:void 0}},{key:"fromModel",value:function(t,r){r=r||[];for(var n=[],i=1,o=0;o<r.length;){for(var a=r[o++];i<a.min;)n.push(new e(t,i++));for(;i<=a.max;)n.push(new e(t,i++,a))}return n.length?n:null}}],(r=[{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&&i.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(e,n){t(e.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 a.n2l(this._number)}},{key:"isCustomWidth",get:function(){return void 0!==this.width&&9!==this.width}},{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=void 0!==e.width?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;void 0!==e?(this._header=e,this.headers.forEach((function(e,r){t._worksheet.getCell(r+1,t.number).value=e}))):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)return!1;if(this.hidden)return!1;if(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!==o.ValueType.Null&&(e[r]=t.value)})),e},set:function(e){var t=this;if(e){var r=this.number,n=0;e.hasOwnProperty("0")&&(n=1),e.forEach((function(e,i){t._worksheet.getCell(i+n,r).value=e}))}}},{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)}}])&&n(t.prototype,r),s&&n(t,s),e}();t.exports=s},{"../utils/col-cache":17,"../utils/under-dash":23,"./enums":7}],5:[function(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.model=t||{}}var t,r,i;return t=e,(r=[{key:"add",value:function(e,t){return this.model[e]=t}},{key:"find",value:function(e){return this.model[e]}},{key:"remove",value:function(e){this.model[e]=void 0}}])&&n(t.prototype,r),i&&n(t,i),e}();t.exports=i},{}],6:[function(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=e("../utils/under-dash"),o=e("../utils/col-cache"),a=e("../utils/cell-matrix"),s=e("./range"),u=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/,c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.matrixMap={}}var t,r,c;return t=e,(r=[{key:"getMatrix",value:function(e){return this.matrixMap[e]||(this.matrixMap[e]=new a)}},{key:"add",value:function(e,t){var r=o.decodeEx(e);this.addEx(r,t)}},{key:"addEx",value:function(e,t){var r=this.getMatrix(t);if(e.top)for(var n=e.left;n<=e.right;n++)for(var i=e.top;i<=e.bottom;i++){var a={sheetName:e.sheetName,address:o.n2l(n)+i,row:i,col:n};r.addCellEx(a)}else r.addCellEx(e)}},{key:"remove",value:function(e,t){var r=o.decodeEx(e);this.removeEx(r,t)}},{key:"removeEx",value:function(e,t){this.getMatrix(t).removeCellEx(e)}},{key:"removeAllNames",value:function(e){i.each(this.matrixMap,(function(t){t.removeCellEx(e)}))}},{key:"forEach",value:function(e){i.each(this.matrixMap,(function(t,r){t.forEach((function(t){e(r,t)}))}))}},{key:"getNames",value:function(e){return this.getNamesEx(o.decodeEx(e))}},{key:"getNamesEx",value:function(e){return i.map(this.matrixMap,(function(t,r){return t.findCellEx(e)&&r})).filter(Boolean)}},{key:"_explore",value:function(e,t){t.mark=!1;var r,n,i=t.sheetName,o=new s(t.row,t.col,t.row,t.col,i);function a(r,n){var a=e.findCellAt(i,r,t.col);return!(!a||!a.mark||(o[n]=r,a.mark=!1,0))}for(n=t.row-1;a(n,"top");n--);for(n=t.row+1;a(n,"bottom");n++);function u(t,r){var a=[];for(n=o.top;n<=o.bottom;n++){var s=e.findCellAt(i,n,t);if(!s||!s.mark)return!1;a.push(s)}o[r]=t;for(var u=0;u<a.length;u++)a[u].mark=!1;return!0}for(r=t.col-1;u(r,"left");r--);for(r=t.col+1;u(r,"right");r++);return o}},{key:"getRanges",value:function(e,t){var r=this;return(t=t||this.matrixMap[e])?(t.forEach((function(e){e.mark=!0})),{name:e,ranges:t.map((function(e){return e.mark&&r._explore(t,e)})).filter(Boolean).map((function(e){return e.$shortRange}))}):{name:e,ranges:[]}}},{key:"normaliseMatrix",value:function(e,t){e.forEachInSheet(t,(function(e,t,r){e&&(e.row===t&&e.col===r||(e.row=t,e.col=r,e.address=o.n2l(r)+t))}))}},{key:"spliceRows",value:function(e,t,r,n){var o=this;i.each(this.matrixMap,(function(i){i.spliceRows(e,t,r,n),o.normaliseMatrix(i,e)}))}},{key:"spliceColumns",value:function(e,t,r,n){var o=this;i.each(this.matrixMap,(function(i){i.spliceColumns(e,t,r,n),o.normaliseMatrix(i,e)}))}},{key:"model",get:function(){var e=this;return i.map(this.matrixMap,(function(t,r){return e.getRanges(r,t)})).filter((function(e){return e.ranges.length}))},set:function(e){var t=this.matrixMap={};e.forEach((function(e){var r=t[e.name]=new a;e.ranges.forEach((function(e){u.test(e.split("!").pop()||"")&&r.addCell(e)}))}))}}])&&n(t.prototype,r),c&&n(t,c),e}();t.exports=c},{"../utils/cell-matrix":16,"../utils/col-cache":17,"../utils/under-dash":23,"./range":10}],7:[function(e,t,r){t.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(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=e("../utils/col-cache"),o=e("./anchor"),a=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.worksheet=t,this.model=r}var t,r,a;return t=e,(r=[{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(e){var t=e.type,r=e.imageId,n=e.range,a=e.hyperlinks;if(this.type=t,this.imageId=r,"image"===t)if("string"==typeof n){var s=i.decode(n);this.range={tl:new o(this.worksheet,{col:s.left,row:s.top},-1),br:new o(this.worksheet,{col:s.right,row:s.bottom},0),editAs:"oneCell"}}else this.range={tl:new o(this.worksheet,n.tl,0),br:n.br&&new o(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:a||n.hyperlinks}}}])&&n(t.prototype,r),a&&n(t,a),e}();t.exports=a},{"../utils/col-cache":17,"./anchor":2}],9:[function(e,t,r){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=e("../utils/under-dash"),a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.note=t}var t,r,a;return t=e,a=[{key:"fromModel",value:function(t){var r=new e;return r.model=t,r}}],(r=[{key:"model",get:function(){var t=null;switch(n(this.note)){case"string":t={type:"note",note:{texts:[{text:this.note}]}};break;default:t={type:"note",note:this.note}}return o.deepMerge({},e.DEFAULT_CONFIGS,t)},set:function(e){var t=e.note,r=t.texts;1===r.length&&1===Object.keys(r[0]).length?this.note=r[0].text:this.note=t}}])&&i(t.prototype,r),a&&i(t,a),e}();a.DEFAULT_CONFIGS={note:{margins:{insetmode:"auto",inset:[.13,.13,.25,.25]},protection:{locked:"True",lockText:"True"},editAs:"absolute"}},t.exports=a},{"../utils/under-dash":23}],10:[function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var o=e("./../utils/col-cache"),a=function(){function e(){n(this,e),this.decode(arguments)}var t,r,a;return t=e,(r=[{key:"setTLBR",value:function(e,t,r,n,i){if(arguments.length<4){var a=o.decodeAddress(e),s=o.decodeAddress(t);this.model={top:Math.min(a.row,s.row),left:Math.min(a.col,s.col),bottom:Math.max(a.row,s.row),right:Math.max(a.col,s.col),sheetName:r},this.setTLBR(a.row,a.col,s.row,s.col,i)}else this.model={top:Math.min(e,r),left:Math.min(t,n),bottom:Math.max(e,r),right:Math.max(t,n),sheetName:i}}},{key:"decode",value:function(t){switch(t.length){case 5:this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:this.setTLBR(t[0],t[1],t[2]);break;case 2:this.setTLBR(t[0],t[1]);break;case 1:var r=t[0];if(r instanceof e)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(r instanceof Array)this.decode(r);else if(r.top&&r.left&&r.bottom&&r.right)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else{var n=o.decodeEx(r);n.top?this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName}:this.model={top:n.row,left:n.col,bottom:n.row,right:n.col,sheetName:n.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(t.length))}}},{key:"expand",value:function(e,t,r,n){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||r>this.bottom)&&(this.bottom=r),(!this.model.right||n>this.right)&&(this.right=n)}},{key:"expandRow",value:function(e){if(e){var t=e.dimensions,r=e.number;t&&this.expand(r,t.min,r,t.max)}}},{key:"expandToAddress",value:function(e){var t=o.decodeEx(e);this.expand(t.row,t.col,t.row,t.col)}},{key:"toString",value:function(){return this.range}},{key:"intersects",value:function(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottom<this.top||e.top>this.bottom||e.right<this.left||e.left>this.right)}},{key:"contains",value:function(e){var t=o.decodeEx(e);return this.containsEx(t)}},{key:"containsEx",value:function(e){return(!e.sheetName||!this.sheetName||e.sheetName===this.sheetName)&&e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}},{key:"forEachAddress",value:function(e){for(var t=this.left;t<=this.right;t++)for(var r=this.top;r<=this.bottom;r++)e(o.encodeAddress(r,t),r,t)}},{key:"top",get:function(){return this.model.top||1},set:function(e){this.model.top=e}},{key:"left",get:function(){return this.model.left||1},set:function(e){this.model.left=e}},{key:"bottom",get:function(){return this.model.bottom||1},set:function(e){this.model.bottom=e}},{key:"right",get:function(){return this.model.right||1},set:function(e){this.model.right=e}},{key:"sheetName",get:function(){return this.model.sheetName},set:function(e){this.model.sheetName=e}},{key:"_serialisedSheetName",get:function(){var e=this.model.sheetName;return e?/^[a-zA-Z0-9]*$/.test(e)?"".concat(e,"!"):"'".concat(e,"'!"):""}},{key:"tl",get:function(){return o.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(o.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return o.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(o.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)}}])&&i(t.prototype,r),a&&i(t,a),e}();t.exports=a},{"./../utils/col-cache":17}],11:[function(e,t,r){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i=e("../utils/under-dash"),o=e("./enums"),a=e("../utils/col-cache"),s=e("./cell"),u=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._worksheet=t,this._number=r,this._cells=[],this.style={},this.outlineLevel=0}var t,r,u;return t=e,(r=[{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 s(this,r,e.address),this._cells[e.col-1]=t}return t}},{key:"getCell",value:function(e){if("string"==typeof e){var t=this._worksheet.getColumnKey(e);e=t?t.number:a.l2n(e)}return this._cells[e-1]||this.getCellEx({address:a.encodeAddress(this._number,e),row:this._number,col:e})}},{key:"splice",value:function(e,t){for(var r=e+t,n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,s,u,c=i.length-t,f=this._cells.length;if(c<0)for(a=e+i.length;a<=f;a++)u=this._cells[a-1],(s=this._cells[a-c-1])?((u=this.getCell(a)).value=s.value,u.style=s.style,u._comment=s._comment):u&&(u.value=null,u.style={},u._comment=void 0);else if(c>0)for(a=f;a>=r;a--)(s=this._cells[a-1])?((u=this.getCell(a+c)).value=s.value,u.style=s.style,u._comment=s._comment):this._cells[a+c-1]=void 0;for(a=0;a<i.length;a++)(u=this.getCell(e+a)).value=i[a],u.style={},u._comment=void 0}},{key:"eachCell",value:function(e,t){if(t||(t=e,e=null),e&&e.includeEmpty)for(var r=this._cells.length,n=1;n<=r;n++)t(this.getCell(n),n);else this._cells.forEach((function(e,r){e&&e.type!==o.ValueType.Null&&t(e,r+1)}))}},{key:"addPageBreak",value:function(e,t){var r=this._worksheet,n=Math.max(0,e-1)||0,i=Math.max(0,t-1)||16838,o={id:this._number,max:i,man:1};n&&(o.min=n),r.rowBreaks.push(o)}},{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!==o.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(e,n){void 0!==e&&(t.getCellEx({address:a.encodeAddress(t._number,n+r),row:t._number,col:n+r}).value=e)}))}else this._worksheet.eachColumnKey((function(r,n){void 0!==e[n]&&(t.getCellEx({address:a.encodeAddress(t._number,r.number),row:t._number,col:r.number}).value=e[n])}))}},{key:"hasValues",get:function(){return i.some(this._cells,(function(e){return e&&e.type!==o.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!==o.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(n){if(n){var i=n.model;i&&((!t||t>n.col)&&(t=n.col),r<n.col&&(r=n.col),e.push(i))}})),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(e){switch(e.type){case s.Types.Merge:break;default:var n;if(e.address)n=a.decodeAddress(e.address);else if(t){var i=t.row,o=t.col+1;n={row:i,col:o,address:a.encodeAddress(i,o),$col$row:"$".concat(a.n2l(o),"$").concat(i)}}t=n,r.getCellEx(n).model=e}})),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))||{}}}])&&n(t.prototype,r),u&&n(t,u),e}();t.exports=u},{"../utils/col-cache":17,"../utils/under-dash":23,"./cell":3,"./enums":7}],12:[function(e,t,r){function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),e}var a=e("./../utils/col-cache"),s=function(){function e(t,r,i){n(this,e),this.table=t,this.column=r,this.index=i}return o(e,[{key:"_set",value:function(e,t){this.table.cacheState(),this.column[e]=t}},{key:"name",get:function(){return this.column.name},set:function(e){this._set("name",e)}},{key:"filterButton",get:function(){return this.column.filterButton},set:function(e){this.column.filterButton=e}},{key:"style",get:function(){return this.column.style},set:function(e){this.column.style=e}},{key:"totalsRowLabel",get:function(){return this.column.totalsRowLabel},set:function(e){this._set("totalsRowLabel",e)}},{key:"totalsRowFunction",get:function(){return this.column.totalsRowFunction},set:function(e){this._set("totalsRowFunction",e)}},{key:"totalsRowResult",get:function(){return this.column.totalsRowResult},set:function(e){this._set("totalsRowResult",e)}},{key:"totalsRowFormula",get:function(){return this.column.totalsRowFormula},set:function(e){this._set("totalsRowFormula",e)}}]),e}(),u=function(){function e(t,r){n(this,e),this.worksheet=t,r&&(this.table=r,this.validate(),this.store())}return o(e,[{key:"getFormula",value:function(e){switch(e.totalsRowFunction){case"none":return null;case"average":return"SUBTOTAL(101,".concat(this.table.name,"[").concat(e.name,"])");case"countNums":return"SUBTOTAL(102,".concat(this.table.name,"[").concat(e.name,"])");case"count":return"SUBTOTAL(103,".concat(this.table.name,"[").concat(e.name,"])");case"max":return"SUBTOTAL(104,".concat(this.table.name,"[").concat(e.name,"])");case"min":return"SUBTOTAL(105,".concat(this.table.name,"[").concat(e.name,"])");case"stdDev":return"SUBTOTAL(106,".concat(this.table.name,"[").concat(e.name,"])");case"var":return"SUBTOTAL(107,".concat(this.table.name,"[").concat(e.name,"])");case"sum":return"SUBTOTAL(109,".concat(this.table.name,"[").concat(e.name,"])");case"custom":return e.totalsRowFormula;default:throw new Error("Invalid Totals Row Function: ".concat(e.totalsRowFunction))}}},{key: