jsheet-plus
Version:
Jspreadsheet-plus is an enhanced lightweight, vanilla javascript plugin to create amazing web-based interactive data grids with spreadsheet like controls compatible with Excel, Google Spreadsheets and any other spreadsheet software.
15 lines (12 loc) • 177 kB
JavaScript
if (! jSuites && typeof(require) === 'function') {
var jSuites = require('jsuites');
}
if (! formula && typeof(require) === 'function') {
var formula = require('@jspreadsheet/formula');
}
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.jspreadsheet = factory();
}(this, (function () {
var jspreadsheet;(function(){"use strict";var __webpack_modules__={94:function(e,t,s){s.d(t,{My:function(){return d},Th:function(){return a},iY:function(){return c}});var n=s(911),o=s(805),r=s(530),l=s(497),i=s(829);const a=function(e,t){const s=this;for(let e=0;e<s.headers.length;e++)s.headers[e].classList.remove("arrow-up"),s.headers[e].classList.remove("arrow-down");t?s.headers[e].classList.add("arrow-up"):s.headers[e].classList.add("arrow-down")},c=function(e){const t=this;let s=[];for(let n=0;n<e.length;n++)s[n]=t.options.data[e[n]];t.options.data=s,s=[];for(let n=0;n<e.length;n++){s[n]=t.records[e[n]];for(let e=0;e<s[n].length;e++)s[n][e].y=n}t.records=s,s=[];for(let n=0;n<e.length;n++)s[n]=t.rows[e[n]],s[n].y=n;if(t.rows=s,r.o8.call(t),t.results&&t.results.length)t.searchInput.value?t.search(t.searchInput.value):i.F8.call(t);else if(t.results=null,t.pageNumber=0,t.options.pagination>0)t.page(0);else if(1==t.options.lazyLoading)l.wu.call(t,0);else for(let e=0;e<t.rows.length;e++)t.tbody.appendChild(t.rows[e].element)},d=function(e,t){const s=this;if(e>=0){if(s.options.mergeCells&&Object.keys(s.options.mergeCells).length>0){if(!confirm(jSuites.translate("This action will destroy any existing merged cells. Are you sure?")))return!1;s.destroyMerge()}t=null==t?s.headers[e].classList.contains("arrow-down")?1:0:t?1:0;let r=[];if(s.options.columns&&s.options.columns[e]&&("number"==s.options.columns[e].type||"numeric"==s.options.columns[e].type||"percentage"==s.options.columns[e].type||"autonumber"==s.options.columns[e].type||"color"==s.options.columns[e].type))for(let t=0;t<s.options.data.length;t++)r[t]=[t,Number(s.options.data[t][e])];else if(s.options.columns&&s.options.columns[e]&&("calendar"==s.options.columns[e].type||"checkbox"==s.options.columns[e].type||"radio"==s.options.columns[e].type))for(let t=0;t<s.options.data.length;t++)r[t]=[t,s.options.data[t][e]];else for(let t=0;t<s.options.data.length;t++)r[t]=[t,s.records[t][e].element.textContent.toLowerCase()];"function"!=typeof s.parent.config.sorting&&(s.parent.config.sorting=function(e){return function(t,s){const n=t[1],o=s[1];return e?""===n&&""!==o?1:""!==n&&""===o||n>o?-1:n<o?1:0:""===n&&""!==o?1:""!==n&&""===o?-1:n>o?1:n<o?-1:0}}),r=r.sort(s.parent.config.sorting(t));const l=[];for(let e=0;e<r.length;e++)l[e]=r[e][0];return n.Dh.call(s,{action:"orderBy",rows:l,column:e,order:t}),a.call(s,e,t),c.call(s,l),o.A.call(s,"onsort",s,e,t,l.map(e=>e)),!0}}},160:function(e,t,s){s.d(t,{e:function(){return o}});var n=s(530);const o=function(e){const t=this;if(e&&(t.options.footers=e),t.options.footers){t.tfoot||(t.tfoot=document.createElement("tfoot"),t.table.appendChild(t.tfoot));for(let e=0;e<t.options.footers.length;e++){let s;if(t.tfoot.children[e])s=t.tfoot.children[e];else{s=document.createElement("tr");const e=document.createElement("td");s.appendChild(e),t.tfoot.appendChild(s)}for(let o=0;o<t.headers.length;o++){let r;if(t.options.footers[e][o]||(t.options.footers[e][o]=""),t.tfoot.children[e].children[o+1])r=t.tfoot.children[e].children[o+1];else{r=document.createElement("td"),s.appendChild(r);const e=t.options.columns[o].align||t.options.defaultColAlign||"center";r.style.textAlign=e}r.textContent=n.$x.call(t,+t.records.length+o,e,t.options.footers[e][o]),r.style.display=t.cols[o].colElement.style.display}}}}},167:function(e,t,s){s.d(t,{$f:function(){return a},IV:function(){return l},MY:function(){return i},ho:function(){return r}});var n=s(805),o=s(657);const r=function(e){const t=this;return 1!=t.options.search&&1!=t.options.filters||!t.results||(e=t.results.indexOf(e)),Math.ceil((parseInt(e)+1)/parseInt(t.options.pagination))-1},l=function(){const e=this;if(e.pagination.children[0].innerHTML="",e.pagination.children[1].innerHTML="",e.options.pagination){let t;if(t=1!=e.options.search&&1!=e.options.filters||!e.results?e.rows.length:e.results.length,t){const s=Math.ceil(t/e.options.pagination);let n,o;if(e.pageNumber<6?(n=1,o=s<10?s:10):s-e.pageNumber<5?(n=s-9,o=s,n<1&&(n=1)):(n=e.pageNumber-4,o=e.pageNumber+5),n>1){const t=document.createElement("div");t.className="jss_page",t.innerHTML="<",t.title=1,e.pagination.children[1].appendChild(t)}for(let t=n;t<=o;t++){const s=document.createElement("div");s.className="jss_page",s.innerHTML=t,e.pagination.children[1].appendChild(s),e.pageNumber==t-1&&s.classList.add("jss_page_selected")}if(o<s){const t=document.createElement("div");t.className="jss_page",t.innerHTML=">",t.title=s,e.pagination.children[1].appendChild(t)}const r=function(e){const t=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,s){return void 0!==t[s]?t[s]:e})};e.pagination.children[0].innerHTML=r(jSuites.translate("Showing page {0} of {1} entries"),e.pageNumber+1,s)}else e.pagination.children[0].innerHTML=jSuites.translate("No records found")}},i=function(e){const t=this,s=t.pageNumber;let r;r=1!=t.options.search&&1!=t.options.filters||!t.results?t.rows:t.results;const i=parseInt(t.options.pagination);null!=e&&-1!=e||(e=Math.ceil(r.length/i)-1),t.pageNumber=e;let a=e*i,c=e*i+i;for(c>r.length&&(c=r.length),a<0&&(a=0);t.tbody.firstChild;)t.tbody.removeChild(t.tbody.firstChild);for(let e=a;e<c;e++)1!=t.options.search&&1!=t.options.filters||!t.results?t.tbody.appendChild(t.rows[e].element):t.tbody.appendChild(t.rows[r[e]].element);t.options.pagination>0&&l.call(t),o.Aq.call(t),n.A.call(t,"onchangepage",t,e,s,t.options.pagination)},a=function(){const e=this;let t;return t=1!=e.options.search&&1!=e.options.filters||!e.results?e.rows.length:e.results.length,Math.ceil(t/e.options.pagination)}},296:function(e,t,s){s.d(t,{w:function(){return n}});const n=function(){const e=this;let t=0;if(e.options.freezeColumns>0)for(let s=0;s<e.options.freezeColumns;s++){let n;n=e.options.columns&&e.options.columns[s]&&void 0!==e.options.columns[s].width?parseInt(e.options.columns[s].width):void 0!==e.options.defaultColWidth?parseInt(e.options.defaultColWidth):100,t+=n}return t}},392:function(e,t,s){s.d(t,{Ar:function(){return u},ll:function(){return d},nK:function(){return c}});var n=s(978),o=s(530);const r=function(e,t){0!=t.options.editable?e.classList.remove("jtoolbar-disabled"):e.classList.add("jtoolbar-disabled")},l=function(){const e=[],t=this,s=function(){return o.eN.call(t)};e.push({content:"undo",onclick:function(){s().undo()}}),e.push({content:"redo",onclick:function(){s().redo()}}),e.push({content:"save",onclick:function(){const e=s();e&&e.download()}}),e.push({type:"divisor"}),e.push({type:"select",width:"120px",options:["Default","Verdana","Arial","Courier New"],render:function(e){return'<span style="font-family:'+e+'">'+e+"</span>"},onchange:function(e,t,n,o,r){const l=s();let i=l.getSelected(!0);if(i){let e=r?o:"";l.setStyle(Object.fromEntries(i.map(function(t){return[t,"font-family: "+e]})))}},updateState:function(e,t,n){r(n,s())}}),e.push({type:"select",width:"48px",content:"format_size",options:["x-small","small","medium","large","x-large"],render:function(e){return'<span style="font-size:'+e+'">'+e+"</span>"},onchange:function(e,t,n,o){const r=s();let l=r.getSelected(!0);l&&r.setStyle(Object.fromEntries(l.map(function(e){return[e,"font-size: "+o]})))},updateState:function(e,t,n){r(n,s())}}),e.push({type:"select",options:["left","center","right","justify"],render:function(e){return'<i class="material-icons">format_align_'+e+"</i>"},onchange:function(e,t,n,o){const r=s();let l=r.getSelected(!0);l&&r.setStyle(Object.fromEntries(l.map(function(e){return[e,"text-align: "+o]})))},updateState:function(e,t,n){r(n,s())}}),e.push({content:"format_bold",onclick:function(e,t,n){const o=s();let r=o.getSelected(!0);r&&o.setStyle(Object.fromEntries(r.map(function(e){return[e,"font-weight:bold"]})))},updateState:function(e,t,n){r(n,s())}}),e.push({type:"color",content:"format_color_text",k:"color",updateState:function(e,t,n){r(n,s())}}),e.push({type:"color",content:"format_color_fill",k:"background-color",updateState:function(e,t,n,o){r(n,s())}});let l=["top","middle","bottom"];return e.push({type:"select",options:["vertical_align_top","vertical_align_center","vertical_align_bottom"],render:function(e){return'<i class="material-icons">'+e+"</i>"},value:1,onchange:function(e,t,n,o,r){const i=s();let a=i.getSelected(!0);a&&i.setStyle(Object.fromEntries(a.map(function(e){return[e,"vertical-align: "+l[r]]})))},updateState:function(e,t,n){r(n,s())}}),e.push({content:"web",tooltip:jSuites.translate("Merge the selected cells"),onclick:function(){const e=s();if(e.selectedCell&&confirm(jSuites.translate("The merged cells will retain the value of the top-left cell only. Are you sure?"))){const t=[Math.min(e.selectedCell[0],e.selectedCell[2]),Math.min(e.selectedCell[1],e.selectedCell[3]),Math.max(e.selectedCell[0],e.selectedCell[2]),Math.max(e.selectedCell[1],e.selectedCell[3])];let s=(0,n.getCellNameFromCoords)(t[0],t[1]);if(e.records[t[1]][t[0]].element.getAttribute("data-merged"))e.removeMerge(s);else{let n=t[2]-t[0]+1,o=t[3]-t[1]+1;1===n&&1===o||e.setMerge(s,n,o)}}},updateState:function(e,t,n){r(n,s())}}),e.push({type:"select",options:["border_all","border_outer","border_inner","border_horizontal","border_vertical","border_left","border_top","border_right","border_bottom","border_clear"],columns:5,render:function(e){return'<i class="material-icons">'+e+"</i>"},right:!0,onchange:function(e,t,o,r){const l=s();if(l.selectedCell){const e=[Math.min(l.selectedCell[0],l.selectedCell[2]),Math.min(l.selectedCell[1],l.selectedCell[3]),Math.max(l.selectedCell[0],l.selectedCell[2]),Math.max(l.selectedCell[1],l.selectedCell[3])];let s=r;if(e){let o=t.thickness||1,r=t.color||"black";const i=t.style||"solid";"double"===i&&(o+=2);let a={},c=e[0],d=e[1],u=e[2],p=e[3];const h=function(e,t,n){let l=["","","",""];l[0]=("border_top"===s||"border_outer"===s)&&n===d||("border_inner"===s||"border_horizontal"===s)&&n>d||"border_all"===s?"border-top: "+o+"px "+i+" "+r:"border-top: ",l[1]="border_all"!==s&&"border_right"!==s&&"border_outer"!==s||t!==u?"border-right: ":"border-right: "+o+"px "+i+" "+r,l[2]="border_all"!==s&&"border_bottom"!==s&&"border_outer"!==s||n!==p?"border-bottom: ":"border-bottom: "+o+"px "+i+" "+r,l[3]=("border_left"===s||"border_outer"===s)&&t===c||("border_inner"===s||"border_vertical"===s)&&t>c||"border_all"===s?"border-left: "+o+"px "+i+" "+r:"border-left: ",a[e]=l.join(";")};for(let t=e[1];t<=e[3];t++)for(let s=e[0];s<=e[2];s++)h((0,n.getCellNameFromCoords)(s,t),s,t),l.records[t][s].element.getAttribute("data-merged")&&h((0,n.getCellNameFromCoords)(e[0],e[1]),s,t);Object.keys(a)&&l.setStyle(a)}}},onload:function(e,t){let s=document.createElement("div"),n=document.createElement("div");s.appendChild(n);let o=jSuites.color(n,{closeOnChange:!1,onchange:function(e,s){e.parentNode.children[1].style.color=s,t.color=s}}),r=document.createElement("i");r.classList.add("material-icons"),r.innerHTML="color_lens",r.onclick=function(){o.open()},s.appendChild(r),e.children[1].appendChild(s),n=document.createElement("div"),jSuites.picker(n,{type:"select",data:[1,2,3,4,5],render:function(e){return'<div style="height: '+e+'px; width: 30px; background-color: black;"></div>'},onchange:function(e,s,n,o){t.thickness=o},width:"50px"}),e.children[1].appendChild(n);const l=document.createElement("div");jSuites.picker(l,{type:"select",data:["solid","dotted","dashed","double"],render:function(e){return"double"===e?'<div style="width: 30px; border-top: 3px '+e+' black;"></div>':'<div style="width: 30px; border-top: 2px '+e+' black;"></div>'},onchange:function(e,s,n,o){t.style=o},width:"50px"}),e.children[1].appendChild(l),n=document.createElement("div"),n.style.flex="1",e.children[1].appendChild(n)},updateState:function(e,t,n){r(n,s())}}),e.push({type:"divisor"}),e.push({content:"fullscreen",tooltip:"Toggle Fullscreen",onclick:function(e,s,n){"fullscreen"===n.children[0].textContent?(t.fullscreen(!0),n.children[0].textContent="fullscreen_exit"):(t.fullscreen(!1),n.children[0].textContent="fullscreen")},updateState:function(e,t,s,n){!0===n.parent.config.fullscreen?s.children[0].textContent="fullscreen_exit":s.children[0].textContent="fullscreen"}}),e},i=function(e){const t=this,s=e.items;for(let e=0;e<s.length;e++)s[e].tooltip&&(s[e].title=s[e].tooltip,delete s[e].tooltip),"select"==s[e].type?s[e].options?(s[e].data=s[e].options,delete s[e].options):(s[e].data=s[e].v,delete s[e].v,s[e].k&&!s[e].onchange&&(s[e].onchange=function(n,r,l){const i=o.eN.call(t),a=i.getSelected(!0);i.setStyle(Object.fromEntries(a.map(function(t){return[t,s[e].k+": "+l]})))})):"color"==s[e].type&&(s[e].type="i",s[e].onclick=function(n,r,l){l.color||(jSuites.color(l,{onchange:function(n,r){const l=o.eN.call(t),i=l.getSelected(!0);l.setStyle(Object.fromEntries(i.map(function(t){return[t,s[e].k+": "+r]})))},onopen:function(e){e.color.select("")}}),l.color.open())})},a=function(e){const t=this,s=document.createElement("div");return s.classList.add("jss_toolbar"),i.call(t,e),"object"==typeof t.plugins&&Object.entries(t.plugins).forEach(function([,t]){if("function"==typeof t.toolbar){const s=t.toolbar(e);s&&(e=s)}}),jSuites.toolbar(s,e),s},c=function(e){e.parent.toolbar&&e.parent.toolbar.toolbar.update(e)},d=function(){const e=this;if(e.config.toolbar&&!e.toolbar){let t;Array.isArray(e.config.toolbar)?t={items:e.config.toolbar}:"object"==typeof e.config.toolbar?t=e.config.toolbar:(t={items:l.call(e)},"function"==typeof e.config.toolbar&&(t=e.config.toolbar(t))),e.toolbar=e.element.insertBefore(a.call(e,t),e.element.children[1])}},u=function(){const e=this;e.toolbar&&(e.toolbar.parentNode.removeChild(e.toolbar),delete e.toolbar)}},497:function(e,t,s){s.d(t,{AG:function(){return o},G_:function(){return r},p6:function(){return l},wu:function(){return n}});const n=function(e){const t=this;let s;s=1!=t.options.search&&1!=t.options.filters||!t.results?t.rows:t.results;const n=100;null!=e&&-1!=e||(e=Math.ceil(s.length/n)-1);let o=e*n,r=e*n+n;r>s.length&&(r=s.length),o=r-100,o<0&&(o=0);for(let e=o;e<r;e++)1!=t.options.search&&1!=t.options.filters||!t.results?t.tbody.appendChild(t.rows[e].element):t.tbody.appendChild(t.rows[s[e]].element),t.tbody.children.length>n&&t.tbody.removeChild(t.tbody.firstChild)},o=function(){const e=this;if(e.selectedCell){const t=parseInt(e.tbody.firstChild.getAttribute("data-y"))/100,s=parseInt(e.selectedCell[3]/100),n=parseInt(e.rows.length/100);if(t!=s&&s<=n&&!Array.prototype.indexOf.call(e.tbody.children,e.rows[e.selectedCell[3]].element))return e.loadPage(s),!0}return!1},r=function(){const e=this;let t;t=1!=e.options.search&&1!=e.options.filters||!e.results?e.rows:e.results;let s=0;if(t.length>100){let n=parseInt(e.tbody.firstChild.getAttribute("data-y"));if(1!=e.options.search&&1!=e.options.filters||!e.results||(n=t.indexOf(n)),n>0)for(let o=0;o<30;o++)n-=1,n>-1&&(1!=e.options.search&&1!=e.options.filters||!e.results?e.tbody.insertBefore(e.rows[n].element,e.tbody.firstChild):e.tbody.insertBefore(e.rows[t[n]].element,e.tbody.firstChild),e.tbody.children.length>100&&(e.tbody.removeChild(e.tbody.lastChild),s=1))}return s},l=function(){const e=this;let t;t=1!=e.options.search&&1!=e.options.filters||!e.results?e.rows:e.results;let s=0;if(t.length>100){let n=parseInt(e.tbody.lastChild.getAttribute("data-y"));if(1!=e.options.search&&1!=e.options.filters||!e.results||(n=t.indexOf(n)),n<e.rows.length-1)for(let o=0;o<=30;o++)n<t.length&&(1!=e.options.search&&1!=e.options.filters||!e.results?e.tbody.appendChild(e.rows[n].element):e.tbody.appendChild(e.rows[t[n]].element),e.tbody.children.length>100&&(e.tbody.removeChild(e.tbody.firstChild),s=1)),n+=1}return s}},530:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){__webpack_require__.d(__webpack_exports__,{$O:function(){return getWorksheetActive},$x:function(){return parseValue},C6:function(){return showIndex},Dl:function(){return doRenderRowHeader},Em:function(){return executeFormula},P9:function(){return createCell},Rs:function(){return updateScroll},TI:function(){return hideIndex},Xr:function(){return getCellFromCoords},Y5:function(){return fullscreen},am:function(){return updateTable},dw:function(){return isFormula},eN:function(){return getWorksheetInstance},hG:function(){return updateResult},ju:function(){return createNestedHeader},k6:function(){return updateTableHeight},k7:function(){return updateTableWidth},k9:function(){return updateCell},o8:function(){return updateTableReferences},p9:function(){return getLabel},rS:function(){return getMask},tT:function(){return getCell},xF:function(){return updateFormulaChain},yB:function(){return updateFormula}});var _dispatch_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(805),_selection_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(657),_helpers_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(978),_freeze_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(296),_pagination_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(167),_footer_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(160),_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(689),_headers_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(549);const doRenderRowHeader=function(e){const t=this;if(t.rows&&t.rows[e]&&"function"==typeof t.options.rowHeaderRender){const s=t.rows[e].element.children[0];t.options.rowHeaderRender(s,t.options.rows[e],e,t)}},updateTable=function(){const e=this;if(e.options.minSpareRows>0){let t=0;for(let s=e.rows.length-1;s>=0;s--){let n=!1;for(let t=0;t<e.headers.length;t++)e.options.data[s][t]&&(n=!0);if(n)break;t++}e.options.minSpareRows-t>0&&e.insertRow(e.options.minSpareRows-t)}if(e.options.minSpareCols>0){let t=0;for(let s=e.headers.length-1;s>=0;s--){let n=!1;for(let t=0;t<e.rows.length;t++)e.options.data[t][s]&&(n=!0);if(n)break;t++}e.options.minSpareCols-t>0&&e.insertColumn(e.options.minSpareCols-t)}e.options.footers&&_footer_js__WEBPACK_IMPORTED_MODULE_0__.e.call(e),setTimeout(function(){_selection_js__WEBPACK_IMPORTED_MODULE_1__.Aq.call(e)},0)},parseNumber=function(e,t){const s=t&&this.options.columns[t].decimal?this.options.columns[t].decimal:".";let n=""+e;return n=n.split(s),n[0]=n[0].match(/[+-]?[0-9]/g),n[0]&&(n[0]=n[0].join("")),n[1]&&(n[1]=n[1].match(/[0-9]*/g).join("")),n[0]&&Number.isInteger(Number(n[0]))?n[1]?Number(n[0]+"."+n[1]):Number(n[0]+".00"):null},executeFormula=function(expression,x,y){const obj=this,formulaResults=[],formulaLoopProtection=[],execute=function(expression,x,y){const parentId=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([x,y]);if(formulaLoopProtection[parentId])return console.error("Reference loop detected"),"#ERROR";formulaLoopProtection[parentId]=!0;const tokensUpdate=function(e){for(let t=0;t<e.length;t++){const s=[],n=e[t].split(":"),o=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(n[0],!0),r=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(n[1],!0);let l,i,a,c;o[0]<=r[0]?(l=o[0],i=r[0]):(l=r[0],i=o[0]),o[1]<=r[1]?(a=o[1],c=r[1]):(a=r[1],c=o[1]);for(let e=a;e<=c;e++)for(let t=l;t<=i;t++)s.push((0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([t,e]));expression=expression.replace(e[t],s.join(","))}};expression=expression.replace(/\$?([A-Z]+)\$?([0-9]+)/g,"$1$2");let tokens=expression.match(/([A-Z]+[0-9]+)\:([A-Z]+[0-9]+)/g);if(tokens&&tokens.length&&tokensUpdate(tokens),tokens=expression.match(/([A-Z]+[0-9]+)/g),tokens&&tokens.indexOf(parentId)>-1)return console.error("Self Reference detected"),"#ERROR";{const formulaExpressions={};if(tokens)for(let i=0;i<tokens.length;i++)if(obj.formula[tokens[i]]||(obj.formula[tokens[i]]=[]),obj.formula[tokens[i]].indexOf(parentId)<0&&obj.formula[tokens[i]].push(parentId),eval("typeof("+tokens[i]+') == "undefined"')){const e=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(tokens[i],1);let t;if(t=void 0!==obj.options.data[e[1]]&&void 0!==obj.options.data[e[1]][e[0]]?obj.options.data[e[1]][e[0]]:"","="==(""+t).substr(0,1)&&(void 0!==formulaResults[tokens[i]]?t=formulaResults[tokens[i]]:(t=execute(t,e[0],e[1]),formulaResults[tokens[i]]=t)),""==(""+t).trim())formulaExpressions[tokens[i]]=null;else if(t==Number(t)&&0!=obj.parent.config.autoCasting)formulaExpressions[tokens[i]]=Number(t);else{const s=parseNumber.call(obj,t,e[0]);0!=obj.parent.config.autoCasting&&s?formulaExpressions[tokens[i]]=s:formulaExpressions[tokens[i]]='"'+t+'"'}}const ret=_dispatch_js__WEBPACK_IMPORTED_MODULE_3__.A.call(obj,"onbeforeformula",obj,expression,x,y);if(!1===ret)return expression;let res;ret&&(expression=ret);try{res=formula(expression.substr(1),formulaExpressions,x,y,obj),"function"==typeof res&&(res="#ERROR")}catch(e){res="#ERROR",!0===obj.parent.config.debugFormulas&&console.log(expression.substr(1),formulaExpressions,e)}return res}};return execute(expression,x,y)},parseValue=function(e,t,s,n){const o=this;"="==(""+s).substr(0,1)&&0!=o.parent.config.parseFormulas&&(s=executeFormula.call(o,s,e,t));const r=o.options.columns&&o.options.columns[e];if(r&&!isFormula(s)){let e=null;if(e=getMask(r)){s&&s==Number(s)&&(s=Number(s));let t=jSuites.mask.render(s,e,!0);if(n&&e.mask){const o=e.mask.split(";");o[1]&&(o[1].match(new RegExp("\\[Red\\]","gi"))&&(s<0?n.classList.add("red"):n.classList.remove("red")),o[1].match(new RegExp("\\(","gi"))&&s<0&&(t="("+t+")"))}t&&(s=t)}}return s},getDropDownValue=function(e,t){const s=this,n=[];if(s.options.columns&&s.options.columns[e]&&s.options.columns[e].source){const o=[],r=s.options.columns[e].source;for(let e=0;e<r.length;e++)"object"==typeof r[e]?o[r[e].id]=r[e].name:o[r[e]]=r[e];const l=Array.isArray(t)?t:(""+t).split(";");for(let e=0;e<l.length;e++)"object"==typeof l[e]?n.push(o[l[e].id]):o[l[e]]&&n.push(o[l[e]])}else console.error("Invalid column");return n.length>0?n.join("; "):""},validDate=function(e){return"-"==(e=""+e).substr(4,1)&&"-"==e.substr(7,1)||4==(e=e.split("-"))[0].length&&e[0]==Number(e[0])&&2==e[1].length&&e[1]==Number(e[1])},stripScript=function(e){const t=new Option;t.innerHTML=e;let s=null;for(e=t.getElementsByTagName("script");s=e[0];)s.parentNode.removeChild(s);return t.innerHTML},createCell=function(e,t,s){const n=this;let o=document.createElement("td");if(o.setAttribute("data-x",e),o.setAttribute("data-y",t),"none"===n.headers[e].style.display&&(o.style.display="none"),"="==(""+s).substr(0,1)&&1==n.options.secureFormulas){const e=secureFormula(s);e!=s&&(s=e)}if(n.options.columns&&n.options.columns[e]&&"object"==typeof n.options.columns[e].type)!0===n.parent.config.parseHTML?o.innerHTML=s:o.textContent=s,"function"==typeof n.options.columns[e].type.createCell&&n.options.columns[e].type.createCell(o,s,parseInt(e),parseInt(t),n,n.options.columns[e]);else if(n.options.columns&&n.options.columns[e]&&"hidden"==n.options.columns[e].type)o.style.display="none",o.textContent=s;else if(n.options.columns&&n.options.columns[e]&&("checkbox"==n.options.columns[e].type||"radio"==n.options.columns[e].type)){const r=document.createElement("input");r.type=n.options.columns[e].type,r.name="c"+e,r.checked=1==s||1==s||"true"==s,r.onclick=function(){n.setValue(o,this.checked)},1!=n.options.columns[e].readOnly&&0!=n.options.editable||r.setAttribute("disabled","disabled"),o.appendChild(r),n.options.data[t][e]=r.checked}else if(n.options.columns&&n.options.columns[e]&&"calendar"==n.options.columns[e].type){let t=null;if(!validDate(s)){const o=jSuites.calendar.extractDateFromString(s,n.options.columns[e].options&&n.options.columns[e].options.format||"YYYY-MM-DD");o&&(t=o)}o.textContent=jSuites.calendar.getDateString(t||s,n.options.columns[e].options&&n.options.columns[e].options.format)}else if(n.options.columns&&n.options.columns[e]&&"dropdown"==n.options.columns[e].type)o.classList.add("jss_dropdown"),o.textContent=getDropDownValue.call(n,e,s);else if(n.options.columns&&n.options.columns[e]&&"color"==n.options.columns[e].type)if("square"==n.options.columns[e].render){const e=document.createElement("div");e.className="color",e.style.backgroundColor=s,o.appendChild(e)}else o.style.color=s,o.textContent=s;else if(n.options.columns&&n.options.columns[e]&&"image"==n.options.columns[e].type){if(s&&"data:image"==s.substr(0,10)){const e=document.createElement("img");e.src=s,o.appendChild(e)}}else n.options.columns&&n.options.columns[e]&&"html"==n.options.columns[e].type||!0===n.parent.config.parseHTML?o.innerHTML=stripScript(parseValue.call(this,e,t,s,o)):o.textContent=parseValue.call(this,e,t,s,o);n.options.columns&&n.options.columns[e]&&1==n.options.columns[e].readOnly&&(o.className="readonly");const r=n.options.columns&&n.options.columns[e]&&n.options.columns[e].align||n.options.defaultColAlign||"center";return o.style.textAlign=r,n.options.columns&&n.options.columns[e]&&0==n.options.columns[e].wordWrap||!(1==n.options.wordWrap||n.options.columns&&n.options.columns[e]&&1==n.options.columns[e].wordWrap||o.innerHTML.length>200)||(o.style.whiteSpace="pre-wrap"),e>0&&1==this.options.textOverflow&&(s||o.innerHTML?n.records[t][e-1].element.style.overflow="hidden":e==n.options.columns.length-1&&(o.style.overflow="hidden")),_dispatch_js__WEBPACK_IMPORTED_MODULE_3__.A.call(n,"oncreatecell",n,o,e,t,s),o},updateCell=function(e,t,s,n){const o=this;let r;if(1!=o.records[t][e].element.classList.contains("readonly")||n){if("="==(""+s).substr(0,1)&&1==o.options.secureFormulas){const e=secureFormula(s);e!=s&&(s=e)}const n=_dispatch_js__WEBPACK_IMPORTED_MODULE_3__.A.call(o,"onbeforechange",o,o.records[t][e].element,e,t,s);if(null!=n&&(s=n),o.options.columns&&o.options.columns[e]&&"object"==typeof o.options.columns[e].type&&"function"==typeof o.options.columns[e].type.updateCell){const n=o.options.columns[e].type.updateCell(o.records[t][e].element,s,parseInt(e),parseInt(t),o,o.options.columns[e]);void 0!==n&&(s=n)}r={x:e,y:t,col:e,row:t,value:s,oldValue:o.options.data[t][e]};let l=o.options.columns&&o.options.columns[e]&&"object"==typeof o.options.columns[e].type?o.options.columns[e].type:null;if(l)o.options.data[t][e]=s,"function"==typeof l.setValue&&l.setValue(o.records[t][e].element,s);else if(o.options.columns&&o.options.columns[e]&&("checkbox"==o.options.columns[e].type||"radio"==o.options.columns[e].type)){if("radio"==o.options.columns[e].type)for(let t=0;t<o.options.data.length;t++)o.options.data[t][e]=!1;o.records[t][e].element.children[0].checked=1==s||1==s||"true"==s||"TRUE"==s,o.options.data[t][e]=o.records[t][e].element.children[0].checked}else if(o.options.columns&&o.options.columns[e]&&"dropdown"==o.options.columns[e].type)o.options.data[t][e]=s,o.records[t][e].element.textContent=getDropDownValue.call(o,e,s);else if(o.options.columns&&o.options.columns[e]&&"calendar"==o.options.columns[e].type){let n=null;if(!validDate(s)){const t=jSuites.calendar.extractDateFromString(s,o.options.columns[e].options&&o.options.columns[e].options.format||"YYYY-MM-DD");t&&(n=t)}o.options.data[t][e]=s,o.records[t][e].element.textContent=jSuites.calendar.getDateString(n||s,o.options.columns[e].options&&o.options.columns[e].options.format)}else if(o.options.columns&&o.options.columns[e]&&"color"==o.options.columns[e].type)if(o.options.data[t][e]=s,"square"==o.options.columns[e].render){const n=document.createElement("div");n.className="color",n.style.backgroundColor=s,o.records[t][e].element.textContent="",o.records[t][e].element.appendChild(n)}else o.records[t][e].element.style.color=s,o.records[t][e].element.textContent=s;else if(o.options.columns&&o.options.columns[e]&&"image"==o.options.columns[e].type){if(s=""+s,o.options.data[t][e]=s,o.records[t][e].element.innerHTML="",s&&"data:image"==s.substr(0,10)){const n=document.createElement("img");n.src=s,o.records[t][e].element.appendChild(n)}}else o.options.data[t][e]=s,o.options.columns&&o.options.columns[e]&&"html"==o.options.columns[e].type?o.records[t][e].element.innerHTML=stripScript(parseValue.call(o,e,t,s)):!0===o.parent.config.parseHTML?o.records[t][e].element.innerHTML=stripScript(parseValue.call(o,e,t,s,o.records[t][e].element)):o.records[t][e].element.textContent=parseValue.call(o,e,t,s,o.records[t][e].element),o.options.columns&&o.options.columns[e]&&0==o.options.columns[e].wordWrap||!(1==o.options.wordWrap||o.options.columns&&o.options.columns[e]&&1==o.options.columns[e].wordWrap||o.records[t][e].element.innerHTML.length>200)?o.records[t][e].element.style.whiteSpace="":o.records[t][e].element.style.whiteSpace="pre-wrap";e>0&&(o.records[t][e-1].element.style.overflow=s?"hidden":""),o.options.columns&&o.options.columns[e]&&"function"==typeof o.options.columns[e].render&&o.options.columns[e].render(o.records[t]&&o.records[t][e]?o.records[t][e].element:null,s,parseInt(e),parseInt(t),o,o.options.columns[e]),_dispatch_js__WEBPACK_IMPORTED_MODULE_3__.A.call(o,"onchange",o,o.records[t]&&o.records[t][e]?o.records[t][e].element:null,e,t,s,r.oldValue)}else r={x:e,y:t,col:e,row:t};return r},isFormula=function(e){const t=(""+e)[0];return"="==t||"#"==t},getMask=function(e){if(e.format||e.mask||e.locale){const t={};return e.mask?t.mask=e.mask:e.format?t.mask=e.format:(t.locale=e.locale,t.options=e.options),e.decimal&&(t.options||(t.options={}),t.options={decimal:e.decimal}),t}return null},secureFormula=function(e){let t="",s=0;for(let n=0;n<e.length;n++)'"'==e[n]&&(s=0==s?1:0),t+=1==s?e[n]:e[n].toUpperCase();return t};let chainLoopProtection=[];const updateFormulaChain=function(e,t,s){const n=this,o=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([e,t]);if(n.formula[o]&&n.formula[o].length>0)if(chainLoopProtection[o])n.records[t][e].element.innerHTML="#ERROR",n.formula[o]="";else{chainLoopProtection[o]=!0;for(let e=0;e<n.formula[o].length;e++){const t=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(n.formula[o][e],!0),r=""+n.options.data[t[1]][t[0]];"="==r.substr(0,1)?s.push(updateCell.call(n,t[0],t[1],r,!0)):Object.keys(n.formula)[e]=null,updateFormulaChain.call(n,t[0],t[1],s)}}chainLoopProtection=[]},updateFormula=function(e,t){const s=/[A-Z]/,n=/[0-9]/;let o="",r=null,l=null,i="";for(let a=0;a<e.length;a++)s.exec(e[a])?(r=1,l=0,i+=e[a]):n.exec(e[a])?(l=r?1:0,i+=e[a]):(r&&l&&(i=t[i]?t[i]:i),o+=i,o+=e[a],r=0,l=0,i="");return i&&(r&&l&&(i=t[i]?t[i]:i),o+=i),o},updateFormulas=function(e){const t=this;for(let s=0;s<t.options.data.length;s++)for(let n=0;n<t.options.data[0].length;n++){const o=""+t.options.data[s][n];if("="==o.substr(0,1)){const r=updateFormula(o,e);r!=o&&(t.options.data[s][n]=r)}}const s=[],n=Object.keys(t.formula);for(let o=0;o<n.length;o++){let r=n[o];const l=t.formula[r];e[r]&&(r=e[r]),s[r]=[];for(let t=0;t<l.length;t++){let n=l[t];e[n]&&(n=e[n]),s[r].push(n)}}t.formula=s},updateTableReferences=function(){const e=this;if(e.skipUpdateTableReferences)return;const t=!!e.options.columnHeaderRender;for(let s=0;s<e.headers.length;s++)e.headers[s].getAttribute("data-x")!=s&&(e.headers[s].setAttribute("data-x",s),e.headers[s].getAttribute("title")||(e.headers[s].innerHTML=(0,_helpers_js__WEBPACK_IMPORTED_MODULE_4__.getColumnName)(s)),t&&_headers_js__WEBPACK_IMPORTED_MODULE_5__.vq.call(e,s));const s=!!e.options.rowHeaderRender;for(let t=0;t<e.rows.length;t++)e.rows[t]&&e.rows[t].element.getAttribute("data-y")!=t&&(e.rows[t].element.setAttribute("data-y",t),e.rows[t].element.children[0].setAttribute("data-y",t),e.rows[t].element.children[0].innerHTML=t+1,s&&doRenderRowHeader.call(e,t));const n=[],o=[],r=function(t,s,o,r){if(t!=o&&e.records[r][o].element.setAttribute("data-x",o),s!=r&&e.records[r][o].element.setAttribute("data-y",r),t!=o||s!=r){const e=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([t,s]),l=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([o,r]);n[e]=l}};for(let t=0;t<e.records.length;t++)for(let s=0;s<e.records[0].length;s++)if(e.records[t][s]){const n=e.records[t][s].element.getAttribute("data-x"),l=e.records[t][s].element.getAttribute("data-y");if(e.records[t][s].element.getAttribute("data-merged")){const e=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([n,l]),r=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.t3)([s,t]);if(null==o[e])if(e==r)o[e]=!1;else{const i=parseInt(s-n),a=parseInt(t-l);o[e]=[r,i,a]}}else r(n,l,s,t)}const l=Object.keys(o);if(l.length)for(let t=0;t<l.length;t++)if(o[l[t]]){const s=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(l[t],!0);let n=s[0],i=s[1];r(n,i,n+o[l[t]][1],i+o[l[t]][2]);const a=l[t],c=o[l[t]][0];for(let s=0;s<e.options.mergeCells[a][2].length;s++)n=parseInt(e.options.mergeCells[a][2][s].getAttribute("data-x")),i=parseInt(e.options.mergeCells[a][2][s].getAttribute("data-y")),e.options.mergeCells[a][2][s].setAttribute("data-x",n+o[l[t]][1]),e.options.mergeCells[a][2][s].setAttribute("data-y",i+o[l[t]][2]);e.options.mergeCells[c]=e.options.mergeCells[a],delete e.options.mergeCells[a]}updateFormulas.call(e,n),_selection_js__WEBPACK_IMPORTED_MODULE_1__.G9.call(e),updateTable.call(e)},updateScroll=function(e){const t=this,s=t.content.getBoundingClientRect(),n=s.left,o=s.top,r=s.width,l=s.height,i=t.records[t.selectedCell[3]][t.selectedCell[2]].element.getBoundingClientRect(),a=i.left,c=i.top,d=i.width,u=i.height;let p,h;0==e||1==e?(p=a-n+t.content.scrollLeft,h=c-o+t.content.scrollTop-2):(p=a-n+t.content.scrollLeft+d,h=c-o+t.content.scrollTop+u),h>t.content.scrollTop+30&&h<t.content.scrollTop+l||(h<t.content.scrollTop+30?t.content.scrollTop=h-u:t.content.scrollTop=h-(l-2));const m=_freeze_js__WEBPACK_IMPORTED_MODULE_6__.w.call(t);p>t.content.scrollLeft+m&&p<t.content.scrollLeft+r||(p<t.content.scrollLeft+30?(t.content.scrollLeft=p,t.content.scrollLeft<50&&(t.content.scrollLeft=0)):p<t.content.scrollLeft+m?t.content.scrollLeft=p-m-1:t.content.scrollLeft=p-(r-20))},updateResult=function(){const e=this;let t=0,s=0;for(t=1==e.options.lazyLoading?100:e.options.pagination>0?e.options.pagination:e.results?e.results.length:e.rows.length;e.tbody.firstChild;)e.tbody.removeChild(e.tbody.firstChild);for(let n=0;n<e.rows.length;n++)!e.results||e.results.indexOf(n)>-1?(s<t&&(e.tbody.appendChild(e.rows[n].element),s++),e.rows[n].element.style.display=""):e.rows[n].element.style.display="none";return e.options.pagination>0&&_pagination_js__WEBPACK_IMPORTED_MODULE_7__.IV.call(e),_selection_js__WEBPACK_IMPORTED_MODULE_1__.Aq.call(e),t},getCell=function(e,t){if("string"==typeof e){const s=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(e,!0);e=s[0],t=s[1]}return this.records[t][e].element},getCellFromCoords=function(e,t){return this.records[t][e].element},getLabel=function(e,t){if("string"==typeof e){const s=(0,_internalHelpers_js__WEBPACK_IMPORTED_MODULE_2__.vu)(e,!0);e=s[0],t=s[1]}return this.records[t][e].element.innerHTML},fullscreen=function(e){const t=this;null==e&&(e=!t.config.fullscreen),t.config.fullscreen!=e&&(t.config.fullscreen=e,1==e?t.element.classList.add("fullscreen"):t.element.classList.remove("fullscreen"))},showIndex=function(){this.table.classList.remove("jss_hidden_index")},hideIndex=function(){this.table.classList.add("jss_hidden_index")},createNestedHeader=function(e){const t=this,s=document.createElement("tr");s.classList.add("jss_nested");const n=document.createElement("td");n.classList.add("jss_selectall"),s.appendChild(n),e.element=s;let o=0;for(let n=0;n<e.length;n++){e[n].colspan||(e[n].colspan=1),e[n].title||(e[n].title=""),e[n].id||(e[n].id="");let r=e[n].colspan;const l=[];for(let e=0;e<r;e++)t.options.columns[o]&&"hidden"==t.options.columns[o].type&&r++,l.push(o),o++;const i=document.createElement("td");i.setAttribute("data-column",l.join(",")),i.setAttribute("colspan",e[n].colspan),i.setAttribute("align",e[n].align||"center"),i.setAttribute("id",e[n].id),i.textContent=e[n].title,s.appendChild(i)}return s},getWorksheetActive=function(){const e=this.parent?this.parent:this;return e.element.tabs?e.element.tabs.getActive():0},getWorksheetInstance=function(e){const t=void 0!==e?e:getWorksheetActive.call(this);return this.worksheets[t]},updateTableWidth=function(e){const t=this;t.options.tableWidth=e,1==t.options.tableOverflow&&(t.options.tableWidth?(t.content.style["overflow-x"]="auto",t.content.style.width="string"==typeof t.options.tableWidth?t.options.tableWidth:t.options.tableWidth+"px"):(t.content.style["overflow-x"]="",t.content.style.width=""))},updateTableHeight=function(e){const t=this;t.options.tableHeight=e,1==t.options.tableOverflow&&(t.options.tableHeight?(t.content.style["overflow-y"]="auto",t.content.style.height="string"==typeof t.options.tableHeight?t.options.tableHeight:t.options.tableHeight+"px"):(t.content.style["overflow-y"]="",t.content.style.height=""))}},549:function(e,t,s){s.d(t,{BX:function(){return d},Mp:function(){return u},WH:function(){return a},_b:function(){return l},dJ:function(){return i},vq:function(){return c}});var n=s(911),o=s(805),r=s(978);const l=function(e){return this.headers[e].textContent},i=function(e){const t=this,s=[];for(let e=0;e<t.headers.length;e++)s.push(t.getHeader(e));return e?s:s.join(t.options.csvDelimiter)},a=function(e,t){const s=this;if(s.headers[e]){const l=s.headers[e].textContent,i=s.options.columns&&s.options.columns[e]&&s.options.columns[e].title||"";t||(t=(0,r.getColumnName)(e)),s.headers[e].textContent=t,s.headers[e].setAttribute("title",t),s.options.columns||(s.options.columns=[]),s.options.columns[e]||(s.options.columns[e]={}),s.options.columns[e].title=t,n.Dh.call(s,{action:"setHeader",column:e,oldValue:l,newValue:t}),o.A.call(s,"onchangeheader",s,parseInt(e),t,i)}},c=function(e){const t=this;t.headers[e]&&"function"==typeof t.options.columnHeaderRender&&t.options.columnHeaderRender(t.headers[e],t.options.columns[e],e,t)},d=function(e,t){const s=this;s.headers[e]&&s.headers[e].classList.add(t),n.Dh.call(s,{action:"addHeaderClass",column:e,className:t}),o.A.call(s,"onaddheaderclass",s,parseInt(e),t)},u=function(e,t){const s=this;s.headers[e]&&s.headers[e].classList.remove(t),n.Dh.call(s,{action:"removeHeaderClass",column:e,className:t}),o.A.call(s,"onremoveheaderclass",s,parseInt(e),t)}},657:function(e,t,s){s.d(t,{AH:function(){return g},Aq:function(){return d},G9:function(){return b},Jg:function(){return y},Lo:function(){return A},Mp:function(){return p},R5:function(){return v},Ub:function(){return x},at:function(){return B},c6:function(){return m},eO:function(){return k},ef:function(){return E},gE:function(){return h},gG:function(){return C},kA:function(){return f},kF:function(){return j},kV:function(){return I},pY:function(){return u},sp:function(){return L},tW:function(){return _}});var n=s(805),o=s(296),r=s(978),l=s(911),i=s(530),a=s(689),c=s(392);const d=function(){const e=this;if(e.highlighted&&e.highlighted.length){const t=e.highlighted[e.highlighted.length-1].element,s=t.getAttribute("data-x"),n=e.content.getBoundingClientRect(),r=n.left,l=n.top,i=t.getBoundingClientRect(),a=i.left,c=i.top,d=i.width,u=i.height,p=a-r+e.content.scrollLeft+d-4,h=c-l+e.content.scrollTop+u-4;if(e.corner.style.top=h+"px",e.corner.style.left=p+"px",e.options.freezeColumns){const t=o.w.call(e);s>e.options.freezeColumns-1&&a-r+d<t?e.corner.style.display="none":0!=e.options.selectionCopy&&(e.corner.style.display="")}else 0!=e.options.selectionCopy&&(e.corner.style.display="")}else e.corner.style.top="-2000px",e.corner.style.left="-2000px";(0,c.nK)(e),p.call(e)},u=function(){const e=this;e.selectionBorder&&e.highlighted&&e.highlighted.length>0&&p.call(e,!1),!1!==e.options.selectionCopy&&e.highlighted&&e.highlighted.length>0&&d.call(e)},p=function(e=!1){const t=this;if(!t.selectionBorder||!t.highlighted||!t.highlighted.length)return void(t.selectionBorder&&(t.selectionBorder.style.display="none",t.selectionBorder.style.top="-2000px",t.selectionBorder.style.left="-2000px"));const s=t.getSelection();if(!s)return void(t.selectionBorder.style.display="none");const[n,r,l,i]=s,a=t.records[r][n].element,c=t.records[i][l].element,d=t.content.getBoundingClientRect(),u=a.getBoundingClientRect(),p=c.getBoundingClientRect(),h=u.left-d.left+t.content.scrollLeft,m=u.top-d.top+t.content.scrollTop,f=p.left-u.left+p.width+1,g=p.top-u.top+p.height+1;let y="block";if(t.options.freezeColumns){const e=o.w.call(t);(l<t.options.freezeColumns||n>t.options.freezeColumns-1&&u.left-d.left+f<e)&&n>t.options.freezeColumns-1&&u.left-d.left+f<e&&(y="none")}t.selectionBorder.style.display=y,t.selectionBorder.style.left=h+"px",t.selectionBorder.style.top=m+"px",t.selectionBorder.style.width=f+"px",t.selectionBorder.style.height=g+"px",e?(t.selectionBorder.classList.remove("jss_border_active"),t.selectionBorder.classList.add("jss_border_inactive")):(t.selectionBorder.classList.remove("jss_border_inactive"),t.selectionBorder.classList.add("jss_border_active"))},h=function(e){const t=this;let s;const o=t.parent&&t.parent.config&&t.parent.config.keepSelectionOnBlur,r=e&&o;if(t.hasFocus&&t.highlighted&&t.highlighted.length)if(s=1,r)t.highlighted||(t.highlighted=[]);else{for(let e=0;e<t.highlighted.length;e++){t.highlighted[e].element.classList.remove("highlight"),t.highlighted[e].element.classList.remove("highlight-left"),t.highlighted[e].element.classList.remove("highlight-right"),t.highlighted[e].element.classList.remove("highlight-top"),t.highlighted[e].element.classList.remove("highlight-bottom"),t.highlighted[e].element.classList.remove("highlight-selected");const s=parseInt(t.highlighted[e].element.getAttribute("data-x")),n=parseInt(t.highlighted[e].element.getAttribute("data-y"));let o,r;if(t.highlighted[e].element.getAttribute("data-merged")){const l=parseInt(t.highlighted[e].element.getAttribute("colspan")),i=parseInt(t.highlighted[e].element.getAttribute("rowspan"));o=l>0?s+(l-1):s,r=i>0?n+(i-1):n}else o=s,r=n;for(let e=s;e<=o;e++)t.headers[e]&&t.headers[e].classList.remove("selected");for(let e=n;e<=r;e++)t.rows[e]&&t.rows[e].element.classList.remove("selected")}t.highlighted=[],t.selectedCell=null}else s=0;return r?(t.selectionBorder&&p.call(t,!0),t.corner&&(t.corner.style.display="none")):(t.corner.style.top="-2000px",t.corner.style.left="-2000px",t.selectionBorder&&(t.selectionBorder.style.display="none",t.selectionBorder.style.top="-2000px",t.selectionBorder.style.left="-2000px")),1==e&&1==s&&(t.hasFocus=!1,n.A.call(t,"onblur",t)),s},m=function(e,t,s){const n=e.getAttribute("data-x"),o=e.getAttribute("data-y");let r,l;t?(r=t.getAttribute("data-x"),l=t.getAttribute("data-y")):(r=n,l=o),g.call(this,n,o,r,l,s)},f=function(){const e=document.querySelectorAll(".jss_worksheet .copying");for(let t=0;t<e.length;t++)e[t].classList.remove("copying"),e[t].classList.remove("copying-left"),e[t].classList.remove("copying-right"),e[t].classList.remove("copying-top"),e[t].classList.remove("copying-bottom")},g=function(e,t,s,o,r){const l=this;if(null==t){if(t=0,o=l.rows.length-1,null==e)return}else null==e&&(e=0,s=l.options.data[0].length-1);null==s&&(s=e),null==o&&(o=t),e>=l.headers.length&&(e=l.headers.length-1),t>=l.rows.length&&(t=l.rows.length-1),s>=l.headers.length&&(s=l.headers.length-1),o>=l.rows.length&&(o=l.rows.length-1);let i,a,c,u,p=null,h=null,m=null,g=null;parseInt(e)<parseInt(s)?(i=parseInt(e),a=parseInt(s)):(i=parseInt(s),a=parseInt(e)),parseInt(t)<parseInt(o)?(c=parseInt(t),u=parseInt(o)):(c=parseInt(o),u=parseInt(t));for(let e=i;e<=a;e++)for(let t=c;t<=u;t++)if(l.records[t][e]&&l.records[t][e].element.getAttribute("data-merged")){const s=parseInt(l.records[t][e].element.getAttribute("data-x")),n=parseInt(l.records[t][e].element.getAttribute("data-y")),o=parseInt(l.records[t][e].element.getAttribute("colspan")),r=parseInt(l.records[t][e].element.getAttribute("rowspan"));o>1&&(s<i&&(i=s),s+o>a&&(a=s+o-1)),r&&(n<c&&(c=n),n+r>u&&(u=n+r-1))}for(let e=c;e<=u;e++)"none"!=l.rows[e].element.style.display&&(null==m&&(m=e),g=e);for(let e=i;e<=a;e++)for(let t=c;t<=u;t++)l.options.columns&&l.options.columns[e]&&"hidden"==l.options.columns[e].type||(null==p&&(p=e),h=e);if(p||(p=0),h||(h=0),!1===n.A.call(l,"onbeforeselection",l,p,m,h,g,r))return!1;const y=l.resetSelection();l.selectedCell=[e,t,s,o],l.highlighted||(l.highlighted=[]),l.records[t][e]&&l.records[t][e].element.classList.add("highlight-selected");for(let e=i;e<=a;e++)for(let t=c;t<=u;t++)"none"!=l.rows[t].element.style.display&&"none"!=l.records[t][e].element.style.display&&(l.records[t][e].element.classList.add("highlight"),l.highlighted.push(l.records[t][e]));for(let e=p;e<=h;e++)l.options.columns&&l.options.columns[e]&&"hidden"==l.options.columns[e].type||!l.cols[e].colElement.style||"none"==l.cols[e].colElement.style.display||(l.records[m]&&l.records[m][e]&&l.records[m][e].element.classList.add("highlight-top"),l.records[g]&&l.records[g][e]&&l.records[g][e].element.classList.add("highlight-bottom"),l.headers[e].classList.add("selected"));for(let e=m;e<=g;e++)l.rows[e]&&"none"!=l.rows[e].element.style.display&&(l.records[e][p].element.classList.add("highlight-left"),l.records[e][h].element.classList.add("highlight-right"),l.rows[e].element.classList.add("selected"));l.selectedContainer=[p,m,h,g],0==y&&(l.hasFocus=!0,n.A.call(l,"onfocus",l),f()),n.A.call(l,"onselection",l,p,m,h,g,r),d.call(l)},y=function(e){const t=this;if(!t.selectedCell)return[];const s=[];for(let n=Math.min(t.selectedCell[0],t.selectedCell[2]);n<=Math.max(t.selectedCell[0],t.selectedCell[2]);n++)e&&"none"==t.headers[n].style.display||s.push(n);return s},b=function(){const e=this;e.selectedCell&&e.updateSelectionFromCoords(e.selectedCell[0],e.selectedCell[1],e.selectedCell[2],e.selectedCell[3])},C=function(){const e=this;for(let t=0;t<e.selection.length;t++)e.selection[t].classList.remove("selection"),e.selection[t].classList.remove("selection-left"),e.selection[t].classList.remove("selection-right"),e.selection[t].classList.remove("selection-top"),e.selection[t].classList.remove("selection-bottom");e.selection=[]},w=function(e){return 1==(e=""+e).length&&(e="0"+e),e},j=function(e,t){const s=this,o=s.getData(!0,!1),r=s.selectedContainer,c=parseInt(e.getAttribute("data-x")),d=parseInt(e.getAttribute("data-y")),u=parseInt(t.getAttribute("data-x")),p=parseInt(t.getAttribute("data-y")),h=[];let m,f,g=!1;r[0]==c?(m=d<r[1]?d-r[1]:1,f=0):(f=c<r[0]?c-r[0]:1,m=0);let y=0,b=0;for(let e=d;e<=p;e++)if(!s.rows[e]||"none"!=s.rows[e].element.style.display){null==o[b]&&(b=0),y=0,r[0]!=c&&(f=c<r[0]?c-r[0]:1);for(let t=c;t<=u;t++){if(s.records[e][t]&&!s.records[e][t].element.classList.contains("readonly")&&"none"!=s.records[e][t].element.style.display&&0==g){if(!s.selection.length&&""!=s.options.data[e][t]){g=!0;continue}(null==o[b]||null==o[b][y])&&(y=0);let n=o[b][y];if(n&&!o[1]&&0!=s.parent.config.autoIncrement)if(!s.options.columns||!s.options.columns[t]||s.options.columns[t].type&&"text"!=s.options.columns[t].type&&"number"!=s.options.columns[t].type){if(s.options.columns&&s.options.columns[t]&&"calendar"==s.options.columns[t].type){const e=new Date(n);e.setDate(e.getDate()+m),n=e.getFullYear()+"-"+w(parseInt(e.getMonth()+1))+"-"+w(e.getDate())+" 00:00:00"}}else if("="==(""+n).substr(0,1)){const e=n.match(/([A-Z]+[0-9]+)/g);if(e){const t=[];for(let s=0;s<e.length;s++){const n=(0,a.vu)(e[s],1);n[0]+=f,n[1]+=m,n[1]<0&&(n[1]=0);const o=(0,a.t3)([n[0],n[1]]);o!=e[s]&&(t[e[s]]=o)}t&&(n=(0,i.yB)(n,t))}}else n==Number(n)&&(n=Number(n)+m);h.push(i.k9.call(s,t,e,n)),i.xF.call(s,t,e,h)}y++,r[0]!=c&&f++}b++,m++}l.Dh.call(s,{action:"setValue",records:h,selection:s.selectedCell}),i.am.call(s);const C=h.map(function(e){return{x:e.x,y:e.y,value:e.newValue,oldValue:e.oldValue}});n.A.call(s,"onafterchanges",s,C)},_=function(e){let t,s,n=0;if(!e||0===e.length)return n;for(t=0;t<e.length;t++)s=e.charCodeAt(t),n=(n<<5)-n+s,n|=0;return n},B=function(e,t,s){const n=this;if(1==e){if(n.selectedCell&&(t>=n.selectedCell[1]&&t<=n.selectedCell[3]||s>=n.selectedCell[1]&&s<=n.selectedCell[3]))return void n.resetSelection()}else if(n.selectedCell&&(t>=n.selectedCell[0]&&t<=n.selectedCell[2]||s>=n.selectedCell[0]&&s<=n.selectedCell[2]))return void n.resetSelection()},v=function(e){const t=this;if(!t.selectedCell)return[];const s=[];for(let n=Math.min(t.selectedCell[1],t.selectedCell[3]);n<=Math.max(t.selectedCell[1],t.selectedCell[3]);n++)e&&"none"==t.rows[n].element.style.display||s.push(n);return s},x=function(){const e=this;e.selectedCell||(e.selectedCell=[]),e.selectedCell[0]=0,e.selectedCell[1]=0,e.selectedCell[2]=e.headers.length-1,e.selectedCell[3]=e.records.length-1,e.updateSelectionFromCoords(e.selectedCell[0],e.selectedCell[1],e.selectedCell[2],e.selectedCell[3])},A=function(){const e=this;return e.selectedCell?[Math.min(e.selectedCell[0],e.selectedCell[2]),Math.min(e.selectedCell[1],e.selectedCell[3]),Math.max(e.selectedCell[0],e.selectedCell[2]),Math.max(e.selectedCell[1],e.selectedCell[3])]:null},E=function(e){const t=this,s=A.call(t);if(!s)return[];const n=[];for(let o=s[1];o<=s[3];o++)for(let l=s[0];l<=s[2];l++)e?n.push((0,r.getCellNameFromCoords)(l,o)):n.push(t.records[o][l]);return n},k=function(){const e=this,t=A.call(e);if(!t)return"";const s=(0,r.getCellNameFromCoords)(t[0],t[1]),n=(0,r.getCellNameFromCoords)(t[2],t[3]);return s===n?e.options.worksheetName+"!"+s:e.options.worksheetName+"!"+s+":"+n},L=function(e,t){const s=A.call(this);return e>=s[0]&&e<=s[2]&&t>=s[1]&&t<=s[3]},I=function(){const e=A.call(this);return e?[e]:[]}},689:function(e,t,s){s.d(t,{Hh:function(){return o},t3:function(){return l},vu:function(){return r}});var n=s(978);const o=function(e,t,s){if(t<=e.length)return e.slice(0,t).concat(s).concat(e.slice(t));const n=e.slice(0,e.length);for(;t>n.length;)n.push(void 0);return n.concat(s)},r=function(e,t){const s=/^[a-zA-Z]+/.exec(e);if(s){let n=0;for(let e=0;e<s[0].length;e++)n+=parseInt(s[0].charCodeAt(e)-64)*Math.pow(26,s[0].length-1-e);n--,n<0&&(n=0);let o=parseInt(/[0-9]+$/.exec(e));o>0&&