UNPKG

@digital-blueprint/esign-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/esign-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/esign-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/esign-app/) | [Esign Bundle](https://gitlab.tugraz.

18 lines 931 kB
/*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * universal-router: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @tugraz/web-components: LGPL-2.1-or-later * exceljs: MIT */ import{n as e,t}from"./chunk.RTniY5sO.js";var n=t((t,n)=>{ /*! ExcelJS 19-10-2023 */ (function(e){typeof t==`object`&&n!==void 0?n.exports=e():typeof define==`function`&&define.amd?define([],e):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).ExcelJS=e()})(function(){return function t(n,r,i){function a(s,c){if(!r[s]){if(!n[s]){var l=typeof e==`function`&&e;if(!c&&l)return l(s,!0);if(o)return o(s,!0);var u=Error(`Cannot find module '`+s+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=r[s]={exports:{}};n[s][0].call(d.exports,function(e){return a(n[s][1][e]||e)},d,d.exports,t,n,r,i)}return r[s].exports}for(var o=typeof e==`function`&&e,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(e,t,n){let r=e(`fs`),i=e(`fast-csv`),a=e(`dayjs/plugin/customParseFormat`),o=e(`dayjs/plugin/utc`),s=e(`dayjs`).extend(a).extend(o),c=e(`../utils/stream-buf`),{fs:{exists:l}}=e(`../utils/utils`),u={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!`}};t.exports=class{constructor(e){this.workbook=e,this.worksheet=null}async readFile(e,t){if(t||={},!await l(e))throw Error(`File not found: `+e);let n=r.createReadStream(e),i=await this.read(n,t);return n.close(),i}read(e,t){return t||={},new Promise((n,r)=>{let a=this.workbook.addWorksheet(t.sheetName),o=t.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],c=t.map||function(e){if(e===``)return null;let t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t;let n=o.reduce((t,n)=>{if(t)return t;let r=s(e,n,!0);return r.isValid()?r:null},null);if(n)return new Date(n.valueOf());let r=u[e];return r===void 0?e:r},l=i.parse(t.parserOptions).on(`data`,e=>{a.addRow(e.map(c))}).on(`end`,()=>{l.emit(`worksheet`,a)});l.on(`worksheet`,n).on(`error`,r),e.pipe(l)})}createInputStream(){throw 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")}write(e,t){return new Promise((n,r)=>{t||={};let a=this.workbook.getWorksheet(t.sheetName||t.sheetId),o=i.format(t.formatterOptions);e.on(`finish`,()=>{n()}),o.on(`error`,r),o.pipe(e);let{dateFormat:c,dateUTC:l}=t,u=t.map||(e=>{if(e){if(e.text||e.hyperlink)return e.hyperlink||e.text||``;if(e.formula||e.result)return e.result||``;if(e instanceof Date)return c?l?s.utc(e).format(c):s(e).format(c):l?s.utc(e).format():s(e).format();if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}),d=t.includeEmptyRows===void 0||t.includeEmptyRows,f=1;a&&a.eachRow((e,t)=>{if(d)for(;f++<t-1;)o.write([]);let{values:n}=e;n.shift(),o.write(n.map(u)),f=t}),o.end()})}writeFile(e,t){let n={encoding:(t||={}).encoding||`utf8`},i=r.createWriteStream(e,n);return this.write(i,t)}async writeBuffer(e){let t=new c;return await this.write(t,e),t.read()}}},{"../utils/stream-buf":24,"../utils/utils":27,dayjs:391,"dayjs/plugin/customParseFormat":392,"dayjs/plugin/utc":393,"fast-csv":424,fs:216}],2:[function(e,t,n){let r=e(`../utils/col-cache`);class i{constructor(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(this.worksheet=e,t)if(typeof t==`string`){let e=r.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else t.nativeCol===void 0?t.col===void 0?(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0):(this.col=t.col+n,this.row=t.row+n):(this.nativeCol=t.nativeCol||0,this.nativeColOff=t.nativeColOff||0,this.nativeRow=t.nativeRow||0,this.nativeRowOff=t.nativeRowOff||0);else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(e){return e instanceof i||e==null?e:new i(e)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}get colWidth(){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}get rowHeight(){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}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}}t.exports=i},{"../utils/col-cache":19}],3:[function(e,t,n){let r=e(`../utils/col-cache`),i=e(`../utils/under-dash`),a=e(`./enums`),{slideFormula:o}=e(`../utils/shared-formula`),s=e(`./note`);class c{constructor(e,t,n){if(!e||!t)throw Error(`A Cell needs a Row`);this._row=e,this._column=t,r.validateAddress(n),this._address=n,this._value=l.create(c.Types.Null,this),this.style=this._mergeStyle(e.style,t.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&e.font||t&&t.font;i&&(n.font=i);let a=e&&e.alignment||t&&t.alignment;a&&(n.alignment=a);let o=e&&e.border||t&&t.border;o&&(n.border=o);let s=e&&e.fill||t&&t.fill;s&&(n.fill=s);let c=e&&e.protection||t&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===c.Types.Merge}merge(e,t){this._value.release(),this._value=l.create(c.Types.Merge,this,e),t||(this.style=e.style)}unmerge(){this.type===c.Types.Merge&&(this._value.release(),this._value=l.create(c.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{}))}isMergedTo(e){return this._value.type===c.Types.Merge&&this._value.isMergedTo(e)}get master(){return this.type===c.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===c.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(e){this.type===c.Types.Merge?this._value.master.value=e:(this._value.release(),this._value=l.create(l.getType(e),this,e))}get note(){return this._comment&&this._comment.note}set note(e){this._comment=new s(e)}get text(){return this._value.toString()}get html(){return i.escapeHtml(this.text)}toString(){return this.text}_upgradeToHyperlink(e){this.type===c.Types.String&&(this._value=l.create(c.Types.Hyperlink,this,{text:this._value.value,hyperlink:e}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=l.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=s.fromModel(e.comment)}e.style?this.style=e.style:this.style={}}}c.Types=a.ValueType;let l={getType:e=>e==null?c.Types.Null:e instanceof String||typeof e==`string`?c.Types.String:typeof e==`number`?c.Types.Number:typeof e==`boolean`?c.Types.Boolean:e instanceof Date?c.Types.Date:e.text&&e.hyperlink?c.Types.Hyperlink:e.formula||e.sharedFormula?c.Types.Formula:e.richText?c.Types.RichText:e.sharedString?c.Types.SharedString:e.error?c.Types.Error:c.Types.JSON,types:[{t:c.Types.Null,f:class{constructor(e){this.model={address:e.address,type:c.Types.Null}}get value(){return null}set value(e){}get type(){return c.Types.Null}get effectiveType(){return c.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}}},{t:c.Types.Number,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.Number}get effectiveType(){return c.Types.Number}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:c.Types.String,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.String}get effectiveType(){return c.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.model.value.replace(/"/g,`""`)}"`}release(){}toString(){return this.model.value}}},{t:c.Types.Date,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.Date}get effectiveType(){return c.Types.Date}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}}},{t:c.Types.Hyperlink,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){let e={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(e.tooltip=this.model.tooltip),e}set value(e){this.model={text:e.text,hyperlink:e.hyperlink},e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return c.Types.Hyperlink}get effectiveType(){return c.Types.Hyperlink}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.hyperlink}release(){}toString(){return this.model.text}}},{t:c.Types.Formula,f:class{constructor(e,t){this.cell=e,this.model={address:e.address,type:c.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={},n=n=>{let r=e[n];r&&(t[n]=r)};return n(`formula`),n(`result`),n(`ref`),n(`shareType`),n(`sharedFormula`),t}get value(){return this._copyModel(this.model)}set value(e){this.model=this._copyModel(e)}validate(e){switch(l.getType(e)){case c.Types.Null:case c.Types.String:case c.Types.Number:case c.Types.Date:break;case c.Types.Hyperlink:case c.Types.Formula:default:throw Error(`Cannot process that type of result value`)}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,``).match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()}set formula(e){this.model.formula=e}get formulaType(){return this.model.formula?a.FormulaType.Master:this.model.sharedFormula?a.FormulaType.Shared:a.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return c.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?a.ValueType.Null:e instanceof String||typeof e==`string`?a.ValueType.String:typeof e==`number`?a.ValueType.Number:e instanceof Date?a.ValueType.Date:e.text&&e.hyperlink?a.ValueType.Hyperlink:e.formula?a.ValueType.Formula:a.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&o(t.formula,t.address,this.model.address)}return this._translatedFormula}toCsvString(){return``+(this.model.result||``)}release(){}toString(){return this.model.result?this.model.result.toString():``}}},{t:c.Types.Merge,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Merge,master:t?t.address:void 0},this._master=t,t&&t.addMergeRef()}get value(){return this._master.value}set value(e){e instanceof c?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}isMergedTo(e){return e===this._master}get master(){return this._master}get type(){return c.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}}},{t:c.Types.JSON,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.String,value:JSON.stringify(t),rawValue:t}}get value(){return this.model.rawValue}set value(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}get type(){return c.Types.String}get effectiveType(){return c.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}}},{t:c.Types.SharedString,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.SharedString}get effectiveType(){return c.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}}},{t:c.Types.RichText,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}toString(){return this.model.value.richText.map(e=>e.text).join(``)}get type(){return c.Types.RichText}get effectiveType(){return c.Types.RichText}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.text.replace(/"/g,`""`)}"`}release(){}}},{t:c.Types.Boolean,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.Boolean}get effectiveType(){return c.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}}},{t:c.Types.Error,f:class{constructor(e,t){this.model={address:e.address,type:c.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return c.Types.Error}get effectiveType(){return c.Types.Error}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}}}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw Error(`Could not create Value of type `+e);return new r(t,n)}};t.exports=c},{"../utils/col-cache":19,"../utils/shared-formula":23,"../utils/under-dash":26,"./enums":7,"./note":9}],4:[function(e,t,n){let r=e(`../utils/under-dash`),i=e(`./enums`),a=e(`../utils/col-cache`);class o{constructor(e,t,n){this._worksheet=e,this._number=t,!1!==n&&(this.defn=n)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return a.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&r.isEqual(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)return!1;let e=this.style;return!e||!(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection)}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number;t||(t=e,e=null),this._worksheet.eachRow(e,(e,r)=>{t(e.getCell(n),r)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==i.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;e.hasOwnProperty(`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}_applyStyle(e,t){return this.style[e]=t,this.eachCell(n=>{n[e]=t}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){this._applyStyle(`fill`,e)}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:n&&e.equivalentTo(n)?n.max=r+1:(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed},t.push(n))}),t.length?t:void 0}static fromModel(e,t){let n=[],r=1,i=0;for(t=(t||=[]).sort(function(e,t){return e.min-t.min});i<t.length;){let a=t[i++];for(;r<a.min;)n.push(new o(e,r++));for(;r<=a.max;)n.push(new o(e,r++,a))}return n.length?n:null}}t.exports=o},{"../utils/col-cache":19,"../utils/under-dash":26,"./enums":7}],5:[function(e,t,n){t.exports=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){return this.model[e]}remove(e){this.model[e]=void 0}}},{}],6:[function(e,t,n){let r=e(`../utils/under-dash`),i=e(`../utils/col-cache`),a=e(`../utils/cell-matrix`),o=e(`./range`),s=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;t.exports=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new a)}add(e,t){let n=i.decodeEx(e);this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(e.top)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let a={sheetName:e.sheetName,address:i.n2l(t)+r,row:r,col:t};n.addCellEx(a)}else n.addCellEx(e)}remove(e,t){let n=i.decodeEx(e);this.removeEx(n,t)}removeEx(e,t){this.getMatrix(t).removeCellEx(e)}removeAllNames(e){r.each(this.matrixMap,t=>{t.removeCellEx(e)})}forEach(e){r.each(this.matrixMap,(t,n)=>{t.forEach(t=>{e(n,t)})})}getNames(e){return this.getNamesEx(i.decodeEx(e))}getNamesEx(e){return r.map(this.matrixMap,(t,n)=>t.findCellEx(e)&&n).filter(Boolean)}_explore(e,t){t.mark=!1;let{sheetName:n}=t,r=new o(t.row,t.col,t.row,t.col,n),i,a;function s(i,a){let o=e.findCellAt(n,i,t.col);return!(!o||!o.mark)&&(r[a]=i,o.mark=!1,!0)}for(a=t.row-1;s(a,`top`);a--);for(a=t.row+1;s(a,`bottom`);a++);function c(t,i){let o=[];for(a=r.top;a<=r.bottom;a++){let r=e.findCellAt(n,a,t);if(!r||!r.mark)return!1;o.push(r)}r[i]=t;for(let e=0;e<o.length;e++)o[e].mark=!1;return!0}for(i=t.col-1;c(i,`left`);i--);for(i=t.col+1;c(i,`right`);i++);return r}getRanges(e,t){return(t||=this.matrixMap[e])?(t.forEach(e=>{e.mark=!0}),{name:e,ranges:t.map(e=>e.mark&&this._explore(t,e)).filter(Boolean).map(e=>e.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,t){e.forEachInSheet(t,(e,t,n)=>{e&&(e.row===t&&e.col===n||(e.row=t,e.col=n,e.address=i.n2l(n)+t))})}spliceRows(e,t,n,i){r.each(this.matrixMap,r=>{r.spliceRows(e,t,n,i),this.normaliseMatrix(r,e)})}spliceColumns(e,t,n,i){r.each(this.matrixMap,r=>{r.spliceColumns(e,t,n,i),this.normaliseMatrix(r,e)})}get model(){return r.map(this.matrixMap,(e,t)=>this.getRanges(t,e)).filter(e=>e.ranges.length)}set model(e){let t=this.matrixMap={};e.forEach(e=>{let n=t[e.name]=new a;e.ranges.forEach(e=>{s.test(e.split(`!`).pop()||``)&&n.addCell(e)})})}}},{"../utils/cell-matrix":18,"../utils/col-cache":19,"../utils/under-dash":26,"./range":10}],7:[function(e,t,n){t.exports={ValueType:{Null:0,Merge:1,Number:2,String:3,Date:4,Hyperlink:5,Formula:6,SharedString:7,RichText:8,Boolean:9,Error:10},FormulaType:{None:0,Master:1,Shared:2},RelationshipType:{None:0,OfficeDocument:1,Worksheet:2,CalcChain:3,SharedStrings:4,Styles:5,Theme:6,Hyperlink:7},DocumentType:{Xlsx:1},ReadingOrder:{LeftToRight:1,RightToLeft:2},ErrorValue:{NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`}}},{}],8:[function(e,t,n){let r=e(`../utils/col-cache`),i=e(`./anchor`);t.exports=class{constructor(e,t){this.worksheet=e,this.model=t}get model(){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 Error(`Invalid Image Type`)}}set model(e){let{type:t,imageId:n,range:a,hyperlinks:o}=e;if(this.type=t,this.imageId=n,t===`image`)if(typeof a==`string`){let e=r.decode(a);this.range={tl:new i(this.worksheet,{col:e.left,row:e.top},-1),br:new i(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`}}else this.range={tl:new i(this.worksheet,a.tl,0),br:a.br&&new i(this.worksheet,a.br,0),ext:a.ext,editAs:a.editAs,hyperlinks:o||a.hyperlinks}}}},{"../utils/col-cache":19,"./anchor":2}],9:[function(e,t,n){let r=e(`../utils/under-dash`);class i{constructor(e){this.note=e}get model(){let e=null;switch(typeof this.note){case`string`:e={type:`note`,note:{texts:[{text:this.note}]}};break;default:e={type:`note`,note:this.note}}return r.deepMerge({},i.DEFAULT_CONFIGS,e)}set model(e){let{note:t}=e,{texts:n}=t;n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=t}static fromModel(e){let t=new i;return t.model=e,t}}i.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`}},t.exports=i},{"../utils/under-dash":26}],10:[function(e,t,n){let r=e(`../utils/col-cache`);class i{constructor(){this.decode(arguments)}setTLBR(e,t,n,i,a){if(arguments.length<4){let i=r.decodeAddress(e),o=r.decodeAddress(t);this.model={top:Math.min(i.row,o.row),left:Math.min(i.col,o.col),bottom:Math.max(i.row,o.row),right:Math.max(i.col,o.col),sheetName:n},this.setTLBR(i.row,i.col,o.row,o.col,a)}else this.model={top:Math.min(e,n),left:Math.min(t,i),bottom:Math.max(e,n),right:Math.max(t,i),sheetName:a}}decode(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:{let t=e[0];if(t instanceof i)this.model={top:t.model.top,left:t.model.left,bottom:t.model.bottom,right:t.model.right,sheetName:t.sheetName};else if(t instanceof Array)this.decode(t);else if(t.top&&t.left&&t.bottom&&t.right)this.model={top:t.top,left:t.left,bottom:t.bottom,right:t.right,sheetName:t.sheetName};else{let e=r.decodeEx(t);e.top?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName}}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw Error(`Invalid number of arguments to _getDimensions() - `+e.length)}}get top(){return this.model.top||1}set top(e){this.model.top=e}get left(){return this.model.left||1}set left(e){this.model.left=e}get bottom(){return this.model.bottom||1}set bottom(e){this.model.bottom=e}get right(){return this.model.right||1}set right(e){this.model.right=e}get sheetName(){return this.model.sheetName}set sheetName(e){this.model.sheetName=e}get _serialisedSheetName(){let{sheetName:e}=this.model;return e?/^[a-zA-Z0-9]*$/.test(e)?e+`!`:`'${e}'!`:``}expand(e,t,n,r){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||r>this.right)&&(this.right=r)}expandRow(e){if(e){let{dimensions:t,number:n}=e;t&&this.expand(n,t.min,n,t.max)}}expandToAddress(e){let t=r.decodeEx(e);this.expand(t.row,t.col,t.row,t.col)}get tl(){return r.n2l(this.left)+this.top}get $t$l(){return`$${r.n2l(this.left)}$${this.top}`}get br(){return r.n2l(this.right)+this.bottom}get $b$r(){return`$${r.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(e){return(!e.sheetName||!this.sheetName||e.sheetName===this.sheetName)&&!(e.bottom<this.top)&&!(e.top>this.bottom)&&!(e.right<this.left)&&!(e.left>this.right)}contains(e){let t=r.decodeEx(e);return this.containsEx(t)}containsEx(e){return(!e.sheetName||!this.sheetName||e.sheetName===this.sheetName)&&e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let n=this.top;n<=this.bottom;n++)e(r.encodeAddress(n,t),n,t)}}t.exports=i},{"../utils/col-cache":19}],11:[function(e,t,n){let r=e(`../utils/under-dash`),i=e(`./enums`),a=e(`../utils/col-cache`),o=e(`./cell`);t.exports=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new o(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){if(typeof e==`string`){let t=this._worksheet.getColumnKey(e);e=t?t.number:a.l2n(e)}return this._cells[e-1]||this.getCellEx({address:a.encodeAddress(this._number,e),row:this._number,col:e})}splice(e,t){let n=e+t;var r=[...arguments].slice(2);let i=r.length-t,a=this._cells.length,o,s,c;if(i<0)for(o=e+r.length;o<=a;o++)c=this._cells[o-1],s=this._cells[o-i-1],s?(c=this.getCell(o),c.value=s.value,c.style=s.style,c._comment=s._comment):c&&(c.value=null,c.style={},c._comment=void 0);else if(i>0)for(o=a;o>=n;o--)s=this._cells[o-1],s?(c=this.getCell(o+i),c.value=s.value,c.style=s.style,c._comment=s._comment):this._cells[o+i-1]=void 0;for(o=0;o<r.length;o++)c=this.getCell(e+o),c.value=r[o],c.style={},c._comment=void 0}eachCell(e,t){if(t||(t=e,e=null),e&&e.includeEmpty){let e=this._cells.length;for(let n=1;n<=e;n++)t(this.getCell(n),n)}else this._cells.forEach((e,n)=>{e&&e.type!==i.ValueType.Null&&t(e,n+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,e-1)||0,i=Math.max(0,t-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==i.ValueType.Null&&(e[t.col]=t.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let t=0;e.hasOwnProperty(`0`)&&(t=1),e.forEach((e,n)=>{e!==void 0&&(this.getCellEx({address:a.encodeAddress(this._number,n+t),row:this._number,col:n+t}).value=e)})}else this._worksheet.eachColumnKey((t,n)=>{e[n]!==void 0&&(this.getCellEx({address:a.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}get hasValues(){return r.some(this._cells,e=>e&&e.type!==i.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,t=0;return this._cells.forEach(n=>{n&&n.type!==i.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){return this.style[e]=t,this._cells.forEach(n=>{n&&(n[e]=t)}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel||0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}:null}set model(e){if(e.number!==this._number)throw Error(`Invalid row number in model`);let t;this._cells=[],e.cells.forEach(e=>{switch(e.type){case o.Types.Merge:break;default:{let n;if(e.address)n=a.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:a.encodeAddress(e,r),$col$row:`$${a.n2l(r)}$${e}`}}t=n,this.getCellEx(n).model=e;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}}},{"../utils/col-cache":19,"../utils/under-dash":26,"./cell":3,"./enums":7}],12:[function(e,t,n){let r=e(`../utils/col-cache`);class i{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}}t.exports=class{constructor(e,t){this.worksheet=e,t&&(this.table=t,this.validate(),this.store())}getFormula(e){switch(e.totalsRowFunction){case`none`:return null;case`average`:return`SUBTOTAL(101,${this.table.name}[${e.name}])`;case`countNums`:return`SUBTOTAL(102,${this.table.name}[${e.name}])`;case`count`:return`SUBTOTAL(103,${this.table.name}[${e.name}])`;case`max`:return`SUBTOTAL(104,${this.table.name}[${e.name}])`;case`min`:return`SUBTOTAL(105,${this.table.name}[${e.name}])`;case`stdDev`:return`SUBTOTAL(106,${this.table.name}[${e.name}])`;case`var`:return`SUBTOTAL(107,${this.table.name}[${e.name}])`;case`sum`:return`SUBTOTAL(109,${this.table.name}[${e.name}])`;case`custom`:return e.totalsRowFormula;default:throw Error(`Invalid Totals Row Function: `+e.totalsRowFunction)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{}),t(e.style,`theme`,`TableStyleMedium2`),t(e.style,`showFirstColumn`,!1),t(e.style,`showLastColumn`,!1),t(e.style,`showRowStripes`,!1),t(e.style,`showColumnStripes`,!1);let n=(e,t)=>{if(!e)throw Error(t)};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=r.decodeAddress(e.ref);let{row:i,col:a}=e.tl;n(i>0,`Table must be on valid row`),n(a>0,`Table must be on valid col`);let{width:o,filterHeight:s,tableHeight:c}=this;e.autoFilterRef=r.encode(i,a,i+s-1,a+o-1),e.tableRef=r.encode(i,a,i+c-1,a+o-1),e.columns.forEach((e,r)=>{n(e.name,`Column ${r} must have a name`),r===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e))})}store(){let e=(e,t)=>{t&&Object.keys(t).forEach(n=>{e[n]=t[n]})},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r);a.value=t,e(a,n.columns[r].style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);n===0?r.value=t.totalsRowLabel:r.value=this.getFormula(t)?{formula:t.totalsRowFormula,result:t.totalsRowResult}:null,e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{a.getCell(r+t).value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{a.getCell(r+t).value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);t===0?n.value=e.totalsRowLabel:this.getFormula(e)&&(n.value={formula:e.totalsRowFormula,result:e.totalsRowResult})})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=r.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++)n.getCell(e.col+t).value=null}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++)n.getCell(e.col+t).value=null}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++)n.getCell(e.col+t).value=null}}this.store()}addRow(e,t){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e)}removeRows(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.rows.splice(e,t)}getColumn(e){let t=this.table.columns[e];return new i(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.table.name=e}get displayName(){return this.table.displyName||this.table.name}set displayNamename(e){this.table.displayName=e}get headerRow(){return this.table.headerRow}set headerRow(e){this._assign(this.table,`headerRow`,e)}get totalsRow(){return this.table.totalsRow}set totalsRow(e){this._assign(this.table,`totalsRow`,e)}get theme(){return this.table.style.name}set theme(e){this.table.style.name=e}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(e){this.table.style.showFirstColumn=e}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(e){this.table.style.showLastColumn=e}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(e){this.table.style.showRowStripes=e}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(e){this.table.style.showColumnStripes=e}}},{"../utils/col-cache":19}],13:[function(e,t,n){let r=e(`./worksheet`),i=e(`./defined-names`),a=e(`../xlsx/xlsx`),o=e(`../csv/csv`);t.exports=class{constructor(){this.category=``,this.company=``,this.created=new Date,this.description=``,this.keywords=``,this.manager=``,this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject=``,this.title=``,this.views=[],this.media=[],this._definedNames=new i}get xlsx(){return this._xlsx||=new a(this),this._xlsx}get csv(){return this._csv||=new o(this),this._csv}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,t){let n=this.nextId;t&&(typeof t==`string`?(console.trace(`tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { argb: "rbg value" } }`),t={properties:{tabColor:{argb:t}}}):(t.argb||t.theme||t.indexed)&&(console.trace(`tabColor argument is now deprecated. Please use workbook.addWorksheet(name, {properties: { tabColor: { ... } }`),t={properties:{tabColor:t}}));let i=this._worksheets.reduce((e,t)=>(t&&t.orderNo)>e?t.orderNo:e,0),a=new r(Object.assign({},t,{id:n,name:e,orderNo:i+1,workbook:this}));return this._worksheets[n]=a,a}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){let t=this.getWorksheet(e);t&&t.destroy()}getWorksheet(e){return e===void 0?this._worksheets.find(Boolean):typeof e==`number`?this._worksheets[e]:typeof e==`string`?this._worksheets.find(t=>t&&t.name===e):void 0}get worksheets(){return this._worksheets.slice(1).sort((e,t)=>e.orderNo-t.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(t=>{e(t,t.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){let t=this.media.length;return this.media.push(Object.assign({},e,{type:`image`})),t}getImage(e){return this.media[e]}get model(){return{creator:this.creator||`Unknown`,lastModifiedBy:this.lastModifiedBy||`Unknown`,lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,calcProperties:this.calcProperties}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(t=>{let{id:n,name:i,state:a}=t,o=e.sheets&&e.sheets.findIndex(e=>e.id===n);(this._worksheets[n]=new r({id:n,name:i,orderNo:o,state:a,workbook:this})).model=t}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media||[]}}},{"../csv/csv":1,"../xlsx/xlsx":144,"./defined-names":6,"./worksheet":14}],14:[function(e,t,n){let r=e(`../utils/under-dash`),i=e(`../utils/col-cache`),a=e(`./range`),o=e(`./row`),s=e(`./column`),c=e(`./enums`),l=e(`./image`),u=e(`./table`),d=e(`./data-validations`),f=e(`../utils/encryptor`),{copyStyle:p}=e(`../utils/copy-style`);t.exports=class{constructor(e){e||={},this._workbook=e.workbook,this.id=e.id,this.orderNo=e.orderNo,this.name=e.name,this.state=e.state||`visible`,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!(!e.pageSetup||!e.pageSetup.fitToWidth&&!e.pageSetup.fitToHeight||e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.dataValidations=new d,this.views=e.views||[],this.autoFilter=e.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.conditionalFormattings=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet`+this.id),this._name!==e){if(typeof e!=`string`)throw Error(`The name has to be a string.`);if(e===``)throw Error(`The name can't be empty.`);if(e===`History`)throw Error(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw Error(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw Error(`The first or last character of worksheet name cannot be a single quotation mark: `+e);if(e&&e.length>31&&(console.warn(`Worksheet name ${e} exceeds 31 chars. This will be truncated`),e=e.substring(0,31)),this._workbook._worksheets.find(t=>t&&t.name.toLowerCase()===e.toLowerCase()))throw Error(`Worksheet name already exists: `+e);this._name=e}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new a;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=(t.header?1:t.headers&&t.headers.length)||0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new s(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){r.each(this._keys,e)}getColumn(e){if(typeof e==`string`){let t=this._keys[e];if(t)return t;e=i.l2n(e)}if(this._columns||=[],e>this._columns.length){let t=this._columns.length+1;for(;t<=e;)this._columns.push(new s(this,t++))}return this._columns[e-1]}spliceColumns(e,t){let n=this._rows.length;var r=[...arguments].slice(2);if(r.length>0)for(let i=0;i<n;i++){let n=[e,t];r.forEach(e=>{n.push(e[i]||null)});let a=this.getRow(i+1);a.splice.apply(a,n)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=r.length-t,a=e+t,o=this._columns.length;if(i<0)for(let t=e+r.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+r.length;t++)this.getColumn(t).defn=null;this.workbook.definedNames.spliceColumns(this.name,e,t,r.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(n=>{let{col:r}=n;e[r]||(e[r]=!0,t++)})}),t}_commitRow(){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new o(this,e),t}getRows(e,t){if(t<1)return;let n=[];for(let r=e;r<e+t;r++)n.push(this.getRow(r));return n}addRow(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`n`,n=this._nextRow,r=this.getRow(n);return r.values=e,this._setStyleOption(n,t[0]===`i`?t:`n`),r}addRows(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`n`,n=[];return e.forEach(e=>{n.push(this.addRow(e,t))}),n}insertRow(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`n`;return this.spliceRows(e,0,t),this._setStyleOption(e,n),this.getRow(e)}insertRows(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:`n`;if(this.spliceRows(e,0,...t),n!==`n`)for(let r=0;r<t.length;r++)n[0]===`o`&&this.findRow(t.length+e+r)!==void 0?this._copyStyle(t.length+e+r,e+r,n[1]===`+`):n[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e+r,n[1]===`+`);return this.getRows(e,t.length)}_setStyleOption(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`n`;t[0]===`o`&&this.findRow(e+1)!==void 0?this._copyStyle(e+1,e,t[1]===`+`):t[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e,t[1]===`+`)}_copyStyle(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=this.getRow(e),i=this.getRow(t);i.style=p(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=p(e.style)}),i.height=r.height}duplicateRow(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=this._rows[e-1],i=Array(t).fill(r.values);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=r.style,t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=e.style})}}spliceRows(e,t){let n=e+t;var r=[...arguments].slice(2);let i=r.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=n;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=t.style}),this._rows[s-1]=void 0}else this._rows[s+a-1]=void 0;else if(a>0)for(s=o;s>=n;s--)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{if(e.getCell(n).style=t.style,t._value.constructor.name===`MergeValue`){let e=this.getRow(t._row._number+i).getCell(n),r=t._value._master,a=this.getRow(r._row._number+i).getCell(r._column._number);e.merge(a)}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=r[s]}this.workbook.definedNames.spliceRows(this.name,e,t,i)}eachRow(e,t){if(t||(t=e,e=void 0),e&&e.includeEmpty){let e=this._rows.length;for(let n=1;n<=e;n++)t(this.getRow(n),n)}else this._rows.forEach(e=>{e&&e.hasValues&&t(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=i.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,