@zlooun/exceljs
Version:
Fixes the problem with writing a file using streams and not using RAM based on 'exeljs'
3 lines (2 loc) • 1.34 MB
JavaScript
/*! ExcelJS 06-03-2023 */
!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 o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(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 o(e[a][1][t]||t)}),f,f.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({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 o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof p?e:p,a=Object.create(o.prototype),s=new P(n||[]);return i(a,"_invoke",{value:S(t,r,s)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var d={};function p(){}function y(){}function m(){}var b={};f(b,s,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==e&&r.call(g,s)&&(b=g);var w=m.prototype=p.prototype=Object.create(b);function _(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var o;i(this,"_invoke",{value:function(i,a){function s(){return new e((function(o,s){!function o(i,a,s,u){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){o("next",t,s,u)}),(function(t){o("throw",t,s,u)})):e.resolve(l).then((function(t){f.value=t,s(f)}),(function(t){return o("throw",t,s,u)}))}u(c.arg)}(i,a,o,s)}))}return o=o?o.then(s,s):s()}})}function S(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===d)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function E(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return y.prototype=m,i(w,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:y,configurable:!0}),y.displayName=f(m,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,f(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},_(x.prototype),f(x.prototype,u,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(w),f(w,c,"Generator"),f(w,s,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=E,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function i(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function a(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 s(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var u=t("fs"),c=t("fast-csv"),f=t("dayjs/plugin/customParseFormat"),l=t("dayjs/plugin/utc"),h=t("dayjs").extend(f).extend(l),d=t("../utils/stream-buf"),p=t("../utils/utils").fs.exists,y={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,f,l;return e=t,(r=[{key:"readFile",value:(l=a(o().mark((function t(e,r){var n,i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=r||{},t.next=3,p(e);case 3:if(t.sent){t.next=5;break}throw new Error("File not found: ".concat(e));case 5:return n=u.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 l.apply(this,arguments)})},{key:"read",value:function(t,e){var r=this;return e=e||{},new Promise((function(n,o){var i=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=h(t,r,!0);return n.isValid()?n:null}),null);if(r)return new Date(r.valueOf());var n=y[t];return void 0!==n?n:t},u=c.parse(e.parserOptions).on("data",(function(t){i.addRow(t.map(s))})).on("end",(function(){u.emit("worksheet",i)}));u.on("worksheet",n).on("error",o),t.pipe(u)}))}},{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(o,i){e=e||{};var a=r.workbook.getWorksheet(e.sheetName||e.sheetId),s=c.format(e.formatterOptions);t.on("finish",(function(){o()})),s.on("error",i),s.pipe(t);var u=e,f=u.dateFormat,l=u.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?l?h.utc(t).format(f):h(t).format(f):l?h.utc(t).format():h(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,y=1;a&&a.eachRow((function(t,e){if(p)for(;y++<e-1;)s.write([]);var r=t.values;r.shift(),s.write(r.map(d)),y=e})),s.end()}))}},{key:"writeFile",value:function(t,e){var r={encoding:(e=e||{}).encoding||"utf8"},n=u.createWriteStream(t,r);return this.write(n,e)}},{key:"writeBuffer",value:(f=a(o().mark((function t(e){var r;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new d,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 f.apply(this,arguments)})}])&&s(e.prototype,r),i&&s(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=m},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:390,"dayjs/plugin/customParseFormat":391,"dayjs/plugin/utc":392,"fast-csv":423,fs:216}],2:[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 o(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 o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var a=t("../utils/col-cache"),s=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(o(this,t),r)if("string"==typeof r){var i=a.decodeAddress(r);this.nativeCol=i.col+n,this.nativeColOff=0,this.nativeRow=i.row+n,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+n,this.row=r.row+n):(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,n;return e=t,n=[{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),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=s},{"../utils/col-cache":19}],3:[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 o(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 o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}function a(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var s=t("../utils/col-cache"),u=t("../utils/under-dash"),c=t("./enums"),f=t("../utils/shared-formula").slideFormula,l=t("./note"),h=function(){function t(e,r,n){if(o(this,t),!e||!r)throw new Error("A Cell needs a Row");this._row=e,this._column=r,s.validateAddress(n),this._address=n,this._value=O.create(t.Types.Null,this),this.style=this._mergeStyle(e.style,r.style,{}),this._mergeCount=0}return a(t,[{key:"worksheet",get:function(){return this._row.worksheet}},{key:"workbook",get:function(){return this._row.worksheet.workbook}},{key:"destroy",value:function(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}},{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:"_mergeStyle",value:function(t,e,r){var n=t&&t.numFmt||e&&e.numFmt;n&&(r.numFmt=n);var o=t&&t.font||e&&e.font;o&&(r.font=o);var i=t&&t.alignment||e&&e.alignment;i&&(r.alignment=i);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:"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:"toCsvString",value:function(){return this._value.toCsvString()}},{key:"addMergeRef",value:function(){this._mergeCount++}},{key:"releaseMergeRef",value:function(){this._mergeCount--}},{key:"isMerged",get:function(){return this._mergeCount>0||this.type===t.Types.Merge}},{key:"merge",value:function(e,r){this._value.release(),this._value=O.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=O.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:"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=O.create(O.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 l(t)}},{key:"text",get:function(){return this._value.toString()}},{key:"html",get:function(){return u.escapeHtml(this.text)}},{key:"toString",value:function(){return this.text}},{key:"_upgradeToHyperlink",value:function(e){this.type===t.Types.String&&(this._value=O.create(t.Types.Hyperlink,this,{text:this._value.value,hyperlink:e}))}},{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:"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:"_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=O.create(t.type,this),this._value.model=t,t.comment)switch(t.comment.type){case"note":this._comment=l.fromModel(t.comment)}t.style?this.style=t.style:this.style={}}}]),t}();h.Types=c.ValueType;var d=function(){function t(e){o(this,t),this.model={address:e.address,type:h.Types.Null}}return a(t,[{key:"value",get:function(){return null},set:function(t){}},{key:"type",get:function(){return h.Types.Null}},{key:"effectiveType",get:function(){return h.Types.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){}},{key:"toString",value:function(){return""}}]),t}(),p=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Number,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.Number}},{key:"effectiveType",get:function(){return h.Types.Number}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),y=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.String,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.String}},{key:"effectiveType",get:function(){return h.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return'"'.concat(this.model.value.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}}]),t}(),m=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.String,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"toString",value:function(){return this.model.value.richText.map((function(t){return t.text})).join("")}},{key:"type",get:function(){return h.Types.RichText}},{key:"effectiveType",get:function(){return h.Types.RichText}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return'"'.concat(this.text.replace(/"/g,'""'),'"')}},{key:"release",value:function(){}}]),t}(),b=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Date,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.Date}},{key:"effectiveType",get:function(){return h.Types.Date}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toISOString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),v=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Hyperlink,text:r?r.text:void 0,hyperlink:r?r.hyperlink:void 0},r&&r.tooltip&&(this.model.tooltip=r.tooltip)}return a(t,[{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 h.Types.Hyperlink}},{key:"effectiveType",get:function(){return h.Types.Hyperlink}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.hyperlink}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.text}}]),t}(),g=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Merge,master:r?r.address:void 0},this._master=r,r&&r.addMergeRef()}return a(t,[{key:"value",get:function(){return this._master.value},set:function(t){t instanceof h?(this._master&&this._master.releaseMergeRef(),t.addMergeRef(),this._master=t):this._master.value=t}},{key:"isMergedTo",value:function(t){return t===this._master}},{key:"master",get:function(){return this._master}},{key:"type",get:function(){return h.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}},{key:"toCsvString",value:function(){return""}},{key:"release",value:function(){this._master.releaseMergeRef()}},{key:"toString",value:function(){return this.value.toString()}}]),t}(),w=function(){function t(e,r){o(this,t),this.cell=e,this.model={address:e.address,type:h.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 a(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:"value",get:function(){return this._copyModel(this.model)},set:function(t){this.model=this._copyModel(t)}},{key:"validate",value:function(t){switch(O.getType(t)){case h.Types.Null:case h.Types.String:case h.Types.Number:case h.Types.Date:break;case h.Types.Hyperlink:case h.Types.Formula:default:throw new Error("Cannot process that type of result value")}}},{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?c.FormulaType.Master:this.model.sharedFormula?c.FormulaType.Shared:c.FormulaType.None}},{key:"result",get:function(){return this.model.result},set:function(t){this.model.result=t}},{key:"type",get:function(){return h.Types.Formula}},{key:"effectiveType",get:function(){var t=this.model.result;return null==t?c.ValueType.Null:t instanceof String||"string"==typeof t?c.ValueType.String:"number"==typeof t?c.ValueType.Number:t instanceof Date?c.ValueType.Date:t.text&&t.hyperlink?c.ValueType.Hyperlink:t.formula?c.ValueType.Formula:c.ValueType.Null}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"_getTranslatedFormula",value:function(){if(!this._translatedFormula&&this.model.sharedFormula){var t=this.cell.worksheet.findCell(this.model.sharedFormula);this._translatedFormula=t&&f(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():""}}]),t}(),_=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.SharedString,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.SharedString}},{key:"effectiveType",get:function(){return h.Types.SharedString}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),x=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Boolean,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.Boolean}},{key:"effectiveType",get:function(){return h.Types.Boolean}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value?1:0}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.toString()}}]),t}(),S=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.Error,value:r}}return a(t,[{key:"value",get:function(){return this.model.value},set:function(t){this.model.value=t}},{key:"type",get:function(){return h.Types.Error}},{key:"effectiveType",get:function(){return h.Types.Error}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.toString()}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value.error.toString()}}]),t}(),k=function(){function t(e,r){o(this,t),this.model={address:e.address,type:h.Types.String,value:JSON.stringify(r),rawValue:r}}return a(t,[{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 h.Types.String}},{key:"effectiveType",get:function(){return h.Types.String}},{key:"address",get:function(){return this.model.address},set:function(t){this.model.address=t}},{key:"toCsvString",value:function(){return this.model.value}},{key:"release",value:function(){}},{key:"toString",value:function(){return this.model.value}}]),t}(),O={getType:function(t){return null==t?h.Types.Null:t instanceof String||"string"==typeof t?h.Types.String:"number"==typeof t?h.Types.Number:"boolean"==typeof t?h.Types.Boolean:t instanceof Date?h.Types.Date:t.text&&t.hyperlink?h.Types.Hyperlink:t.formula||t.sharedFormula?h.Types.Formula:t.richText?h.Types.RichText:t.sharedString?h.Types.SharedString:t.error?h.Types.Error:h.Types.JSON},types:[{t:h.Types.Null,f:d},{t:h.Types.Number,f:p},{t:h.Types.String,f:y},{t:h.Types.Date,f:b},{t:h.Types.Hyperlink,f:v},{t:h.Types.Formula,f:w},{t:h.Types.Merge,f:g},{t:h.Types.JSON,f:k},{t:h.Types.SharedString,f:_},{t:h.Types.RichText,f:m},{t:h.Types.Boolean,f:x},{t:h.Types.Error,f:S}].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=h},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[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 o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var i=t("../utils/under-dash"),a=t("./enums"),s=t("../utils/col-cache"),u=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,n;return e=t,n=[{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=[],o=1,i=0;i<r.length;){for(var a=r[i++];o<a.min;)n.push(new t(e,o++));for(;o<=a.max;)n.push(new t(e,o++,a))}return n.length?n:null}}],(r=[{key:"number",get:function(){return this._number}},{key:"worksheet",get:function(){return this._worksheet}},{key:"letter",get:function(){return s.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:"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:"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:"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:"values",get:function(){var t=[];return this.eachCell((function(e,r){e&&e.type!==a.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,o){e._worksheet.getCell(o+n,r).value=t}))}}},{key:"_applyStyle",value:function(t,e){return this.style[t]=e,this.eachCell((function(r){r[t]=e})),e}},{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)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=u},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[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 o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}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,n;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}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=i},{}],6:[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 o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var i=t("../utils/under-dash"),a=t("../utils/col-cache"),s=t("../utils/cell-matrix"),u=t("./range"),c=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/,f=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,n;return e=t,(r=[{key:"getMatrix",value:function(t){return this.matrixMap[t]||(this.matrixMap[t]=new s)}},{key:"add",value:function(t,e){var r=a.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 o=t.top;o<=t.bottom;o++){var i={sheetName:t.sheetName,address:a.n2l(n)+o,row:o,col:n};r.addCellEx(i)}else r.addCellEx(t)}},{key:"remove",value:function(t,e){var r=a.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(a.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,o=e.sheetName,i=new u(e.row,e.col,e.row,e.col,o);function a(r,n){var a=t.findCellAt(o,r,e.col);return!(!a||!a.mark||(i[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 s(e,r){var a=[];for(n=i.top;n<=i.bottom;n++){var s=t.findCellAt(o,n,e);if(!s||!s.mark)return!1;a.push(s)}i[r]=e;for(var u=0;u<a.length;u++)a[u].mark=!1;return!0}for(r=e.col-1;s(r,"left");r--);for(r=e.col+1;s(r,"right");r++);return i}},{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=a.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 s;t.ranges.forEach((function(t){c.test(t.split("!").pop()||"")&&r.addCell(t)}))}))}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=f},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./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){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 o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var i=t("../utils/col-cache"),a=t("./anchor"),s=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,n;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,o=t.hyperlinks;if(this.type=e,this.imageId=r,"image"===e)if("string"==typeof n){var s=i.decode(n);this.range={tl:new a(this.worksheet,{col:s.left,row:s.top},-1),br:new a(this.worksheet,{col:s.right,row:s.bottom},0),editAs:"oneCell"}}else this.range={tl:new a(this.worksheet,n.tl,0),br:n.br&&new a(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:o||n.hyperlinks}}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.exports=s},{"../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 o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var i=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 i.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}}])&&o(e.prototype,r),a&&o(e,a),Object.defineProperty(e,"prototype",{writable:!1}),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":26}],10:[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 o(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 o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}var a=t("../utils/col-cache"),s=function(){function t(){o(this,t),this.decode(arguments)}var e,r,n;return e=t,(r=[{key:"setTLBR",value:function(t,e,r,n,o){if(arguments.length<4){var i=a.decodeAddress(t),s=a.decodeAddress(e);this.model={top:Math.min(i.row,s.row),left:Math.min(i.col,s.col),bottom:Math.max(i.row,s.row),right:Math.max(i.col,s.col),sheetName:r},this.setTLBR(i.row,i.col,s.row,s.col,o)}else this.model={top:Math.min(t,r),left:Math.min(e,n),bottom:Math.max(t,r),right:Math.max(e,n),sheetName:o}}},{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=a.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:"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:"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=a.decodeEx(t);this.expand(e.row,e.col,e.row,e.col)}},{key:"tl",get:function(){return a.n2l(this.left)+this.top}},{key:"$t$l",get:function(){return"$".concat(a.n2l(this.left),"$").concat(this.top)}},{key:"br",get:function(){return a.n2l(this.right)+this.bottom}},{key:"$b$r",get:function(){return"$".concat(a.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)}},{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=a.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(a.encodeAddress(r,e),r,e)}}])&&i(e.prototype,r),n&&i(e,n),Object.d