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