12345678910 |
- /*!
- * filename: ej2-spreadsheet.min.js
- * version : 19.1.64
- * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
- * Use of this code is subject to the terms of our license.
- * A copy of the current license can be obtained at any time by e-mailing
- * licensing@syncfusion.com. Any infringement will be prosecuted under
- * applicable laws.
- */
- this.ej=this.ej||{},this.ej.spreadsheet=function(e,t,r,n,i,a,o,s,l,h,d,p){"use strict";function c(e){var t,r=[];return e=e.indexOf("!")>-1?e.split("!")[1]:e,(e=-1===e.indexOf(":")?e+":"+e:e).split(":").forEach(function(e){t=u(e),r.push(t[0]),r.push(t[1])}),r}function u(e){return[parseInt(e.match(/\d+/)[0],10)-1,f(e.match(/[A-Z]+/i)[0].toUpperCase())]}function f(e){for(var t=0,r=(e=e.split("").reverse().join("")).length-1;r>=0;r--)t+=(e[r].charCodeAt(0)-64)*Math.pow(26,r);return t-1}function g(e,t){return v(t+1)+(e+1)}function m(e){return g(e[0],e[1])+":"+(t.isNullOrUndefined(e[2])?g(e[0],e[1]):g(e[2],e[3]))}function v(e){return e/26>1?v(e%26==0?e/26-1:Math.floor(e/26))+String.fromCharCode(e%26==0?"Z".charCodeAt(0):64+e%26):String.fromCharCode(64+e)}function y(e){return c(C(e))}function C(e){return e.split("!")[1]||e}function b(e){return e.name+"!"+e.selectedRange}function S(e,t){var r;return r=t.indexOf("!")>-1?ae(e,se(t)):e.activeSheetIndex,{sheetIndex:r,indices:y(t)}}function x(e){var t=e.slice();return e[0]>e[2]&&w(t,0,2),e[1]>e[3]&&w(t,1,3),t}function w(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function I(e){return e[0]===e[2]&&e[1]===e[3]}function E(e,t,r,n,i){return new St(e,t,r,n,i)}function R(e){var t=e.toString();if(e===parseInt(t,10))return parseInt(t,10)+" ";var r=t.indexOf(".")>-1?t.split(".")[1]:0,n=Math.pow(10,r.toString().replace("-","").length),i=Math.abs(k(r,n));return r/i+"/"+n/i}function k(e,t){return e=Number(e),t=Number(t),t?k(t,e%t):e}function A(e){(e=(e=Number(e))>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+r).toUTCString().replace(" GMT",""))}function T(e,t,r){var n=new Date("01/01/1900"),i=F(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),o=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?o:parseInt(o.toString(),10))+(r?0:o>60?2:1)}function F(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function L(e){return e-parseFloat(e)>=0}function N(e,r,n){var i=t.getDefaultDateObject(),a=i.dateTimeFormats.availableFormats,o={dateObj:null,isCustom:!1,type:""};if("string"==typeof e&&(e=e.toUpperCase()),n&&(o.dateObj=r.parseDate(e,{format:n}),o.dateObj&&(o.type=e.toString().indexOf(":")>-1?"time":"datetime",o.isCustom=!0)),t.isNullOrUndefined(o.dateObj)){for(var s=0,l=Object.keys(i.dateFormats);s<l.length;s++){u=l[s];if(o.dateObj=r.parseDate(e,{format:i.dateFormats[u],skeleton:u}),o.dateObj){o.type="date",o.isCustom=!1;break}}if(t.isNullOrUndefined(o.dateObj))for(var h=0,d=Object.keys(a);h<d.length;h++){u=d[h];if(o.dateObj=r.parseDate(e,{format:a[u],skeleton:u}),o.dateObj){if(o.type=e.toString().indexOf(":")>-1?"time":"datetime","time"===o.type){f=o.dateObj.toLocaleTimeString();o.dateObj=new Date("01/01/1900 "+f)}o.isCustom=!0;break}}if(t.isNullOrUndefined(o.dateObj))for(var p=0,c=Object.keys(i.timeFormats);p<c.length;p++){var u=c[p];if(o.dateObj=r.parseDate(e,{format:i.timeFormats[u],skeleton:u}),o.dateObj){var f=o.dateObj.toLocaleTimeString();o.dateObj=new Date("01/01/1900 "+f),o.type="time",o.isCustom=!1;break}}}return"#DIV/0!"===e||o.dateObj||"Invalid Date"===new Date(e).toString()||(o.dateObj=new Date(e)),o}function D(e){return e&&/^\d*\.?\d*$/.test(e)?parseFloat(e):e}function O(e){var t="General";switch(e.split(" ").join("")){case"Number":t="0.00";break;case"Currency":t="$#,##0.00";break;case"Accounting":t='_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)';break;case"ShortDate":t="mm-dd-yyyy";break;case"LongDate":t="dddd, mmmm dd, yyyy";break;case"Time":t="h:mm:ss AM/PM";break;case"Percentage":t="0.00%";break;case"Fraction":t="# ?/?";break;case"Scientific":t="0.00E+00";break;case"Text":t="@"}return t}function H(e){var t="General";switch(e){case"0.00":case'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-':case'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-':t="Number";break;case"$#,##0.00":case"$#,##0_);[Red]($#,##0)":case"$#,##0.00_);[Red]($#,##0.00)":case"$#,##0.00_);($#,##0.00)":case"$#,##0_);($#,##0)":t="Currency";break;case'_($*#,##0.00_);_($*(#,##0.00);_($*"-"??_);_(@_)':case'_($*#,##0.00_);_($* (#,##0.00);_($*"-"??_);_(@_)':case'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)':case'_ $ * #,##0.00_ ;_ $ * -#,##0.00_ ;_ $ * "-"??_ ;_ @_ ':t="Accounting";break;case"mm-dd-yyyy":case"dd-mm-yyyy":case"dd-mm-yy":case"mm-dd-yy":case"dd/MM/yyyy":case"yyyy-MM-dd":t="ShortDate";break;case"dddd, mmmm dd, yyyy":t="LongDate";break;case"h:mm:ss AM/PM":t="Time";break;case"0.00%":case"0%":t="Percentage";break;case"# ?/?":case"# ??/??":case"# ???/???":t="Fraction";break;case"0.00E+00":t="Scientific";break;case"@":t="Text";break;default:e&&e.indexOf("[$")>-1&&(t=e.indexOf("* ")>-1?"Accounting":"Currency")}return t}function B(e){return void 0===e}function M(e){switch(e){case"dd-MMM-yyyy":case"dd MMM yyyy":e="medium";break;case"MMM-yyyy":case"MMM yyyy":e="yMMM";break;case"MM-dd-yyyy":case"dd-MM-yyyy":case"dd-MM-yy":case"MM/dd/yyyy":case"dd/MM/yyyy":case"dd/MM/yy":e="short";break;case"dddd MMMM dd yyyy":case"dd MMMM yyyy":e="long";break;case"d MMMM yyyy":e="yMMMd";break;case"yyyy":e="y";break;case"h:mm":e="Hm";break;case"h:mm tt":e="hm";break;case"h":e="H";break;case"h tt":e="h";break;case"dddd":e="E";break;case"h:mm:ss tt":e="hms";break;case"h:mm:ss":e="Hms";break;case"d":e="d";break;case"d dddd":e="Ed";break;case"M":e="M";break;case"Md":e="Md";break;case"MMM":e="MMM";break;case"ddd MMM d":e="MMMEd";break;case"MMM d":e="MMMd";break;case"M/yyyy":e="yM";break;default:e=""}return e}function P(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function _(e,r){for(var n=r,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),a=0;a<i.length&&!t.isUndefined(n);a++)n=n[i[a]];return n}function U(e,r,n){var i,a,o=e.replace(/\[/g,".").replace(/\]/g,"").split("."),s=n||{},l=s,h=o.length;for(i=0;i<h;i++)a=o[i],i+1===h?l[a]=void 0===r?{}:r:t.isNullOrUndefined(l[a])&&(l[a]={}),l=l[a];return s}function V(e){for(var t=[],r=0;e>0&&r<9;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")}function z(e,t){return void 0===t&&(t=[]),t.push({member:"workbookBasic",args:[]}),t.push({member:"workbookAll",args:[]}),t.push({member:"dataBind",args:[e]}),t.push({member:"workbookProtectSheet",args:[e]}),e.allowSave&&t.push({member:"workbookSave",args:[e]}),e.allowOpen&&t.push({member:"workbookOpen",args:[e]}),e.allowEditing&&(t.push({member:"workbookEdit",args:[e]}),t.push({member:"workbookFormula",args:[e]})),e.allowNumberFormatting&&t.push({member:"workbookNumberFormat",args:[e]}),e.allowCellFormatting&&t.push({member:"workbookcellformat",args:[e]}),e.allowSorting&&t.push({member:"workbookSort",args:[e]}),e.allowHyperlink&&t.push({member:"workbookHyperlink",args:[e]}),e.allowFiltering&&t.push({member:"workbookFilter",args:[e]}),e.allowFindAndReplace&&t.push({member:"workbookfindAndReplace",args:[e]}),e.allowInsert&&t.push({member:"workbookinsert",args:[e]}),e.allowDelete&&t.push({member:"workbookdelete",args:[e]}),e.allowDataValidation&&t.push({member:"workbookDataValidation",args:[e]}),e.allowMerge&&t.push({member:"workbookmerge",args:[e]}),e.allowDataValidation&&t.push({member:"workbookConditionalFormatting",args:[e]}),e.allowImage&&t.push({member:"workbookImage",args:[e]}),e.allowChart&&t.push({member:"workbookChart",args:[e]}),t}function q(e){return e&&"="===e[0]&&e.length>1}function j(e){var t=e;if((t=t.split("$").join("")).indexOf(":")>-1){var r=t.split(":");if(K(r[0])&&K(r[1]))return!0}else if(t.indexOf(":")<0&&K(t))return!0;return!1}function W(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122}function G(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function Y(e,t,r){var n=e[0]<=t[0]&&e[2]>=t[2]&&e[1]<=t[1]&&e[3]>=t[3];if(n)return!0;if(r){if(t[0]<e[0]&&t[2]<e[0]||t[0]>e[2]&&t[2]>e[2])return!1;if(t[0]<e[0]&&t[2]>e[0]&&(t[0]=e[0],n=!0),t[2]>e[2]&&(t[2]=e[2],n=!0),t[1]<e[1]&&t[3]<e[1]||t[1]>e[3]&&t[3]>e[3])return!1;t[1]<e[1]&&t[3]>e[1]&&(t[1]=e[1],n=!0),t[3]>e[3]&&(t[3]=e[3],n=!0)}return n}function X(e,t){return e||(e={}),!!e.isLocked||!1!==e.isLocked&&(!(!t||!t.isLocked)||!(e.isLocked||!t||!1===t.isLocked))}function K(e){for(var t=e,r=0,n=0,i=[89,71,69],a="",o=t.length,s=0;s<o;s++)W(t[s])&&r++;var l=(a=t.substring(0,r)).length;if(l!==o&&l<4&&1!==o&&isNaN(parseInt(t,10))){for(;n<l;){if(!(a[n]&&a[n].charCodeAt(0)<i[n])){if(!a[n]&&n>0)break;return!1}n++}var h=parseFloat(t.substring(r,o));if(h>0&&h<1048577)return!0}return!1}function $(e,t,r,n,i){var a=ye(r,e);if(!a||!a.cells){if(!n)return i?{}:null;a?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||(i?{}:null)}function Z(e,r,n,i,a){n.rows[e]?n.rows[e].cells||(n.rows[e].cells=[]):n.rows[e]={cells:[]},a&&n.rows[e].cells[r]?t.extend(n.rows[e].cells[r],i,null,!0):n.rows[e].cells[r]=i}function J(e,t){var r={fontFamily:"Calibri",verticalAlign:"bottom",textIndent:"0pt",backgroundColor:"#ffffff",color:"#000000",textAlign:"left",fontSize:"11pt",fontWeight:"normal",fontStyle:"normal",textDecoration:"none",border:"",borderLeft:"",borderTop:"",borderRight:"",borderBottom:""},n={};return Object.keys(t?r:e).forEach(function(t){e[t]!==r[t]&&(n[t]=e[t])}),n}function Q(e,t,r){void 0===t&&(t=!0);for(var n=r.getAddressInfo(e),i=n.indices,a=ce(r,n.sheetIndex),o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)Z(o,s,a,{wrap:t},!0);r.setProperties({sheets:r.sheets},!0),n.sheetIndex===r.activeSheetIndex&&r.notify(At,{range:i,wrap:t,sheet:a})}function ee(e,t,r,n,i,a,o,s){return new Promise(function(l,h){l(function(){var l,h,d=new Map,p=t.indexOf("!")>-1?ae(e,se(t)):e.activeSheetIndex,c=ce(e,p),u=y(t),f=u[0],m=0,C={sheet:c,indexes:u,formulaCellRef:o,sheetIndex:s,promise:new Promise(function(e,t){e(void 0)})};return e.notify(xt,C),C.promise.then(function(){for(var t=e.frozenRowCount(c),o=e.frozenColCount(c);f<=u[2];){var s={};for(h=ye(c,f),l=u[1];l<=u[3];){if(r){if(be(c,f)&&!a){f++;continue}d instanceof Map&&(d=[]);var y=v(l+1);s[y]=n?h?te(e,f,l,p,c):"":h?$(f,l,c):null,u[3]<l+1&&(s.__rowIndex=(f+1).toString()),d[m.toString()]=s}else{var C={};if(Object.assign(C,h?$(f,l,c):null),C.colSpan>1&&C.rowSpan>1)for(var b=void 0,S=f,x=f+C.rowSpan;S<x;S++)for(var w=l,I=l+C.colSpan;w<I;w++)S===f&&w===l||(b=new Object,S!==f&&(b.rowSpan=f-S),w!==l&&(b.colSpan=l-w),c.rows[S]&&c.rows[S].cells&&c.rows[S].cells[w]&&(delete c.rows[S].cells[w].value,delete c.rows[S].cells[w].formula),Z(S,w,c,b,!0));else if(C.colSpan>1)for(var S=l+1,x=l+C.colSpan;S<x;S++)Z(f,S,c,{colSpan:l-S},!0),c.rows[f]&&c.rows[f].cells&&c.rows[f].cells[S]&&(delete c.rows[f].cells[S].value,delete c.rows[f].cells[S].formula);else if(C.rowSpan>1)for(var S=f+1,x=f+C.rowSpan;S<x;S++)Z(S,l,c,{rowSpan:f-S},!0),c.rows[S]&&c.rows[S].cells&&c.rows[S].cells[l]&&(delete c.rows[S].cells[l].value,delete c.rows[S].cells[l].formula);if(!n&&be(c,f)){f++;continue}if(!n&&Ae(c,l)){l++;continue}if(!n&&i&&i.length){if(f>=t&&f<i[0]){f++;continue}if(l>=o&&l<i[1]){l++;continue}}if(C.style){var E={};Object.assign(E,C.style),C.style=E}var R={cell:C,address:g(f,l)};e.trigger(Ot,R),d.set(R.address,R.cell)}l++}f++,m++}return d})}())})}function te(e,t,r,n,i){var a=$(t,r,i);if(a){if(a.format){var o={value:e.getDisplayText(a),rowIndex:t,colIndex:r,sheetIndex:n,dateObj:"",isDate:!1,isTime:!1};return e.notify(Rt,o),o.isDate?o.dateObj:a.value}return a.value}return""}function re(e,r){var n,i,a;if(t.isUndefined(e[r])||!e[r]||e[r].index!==r)for(var o=0;o<=r;o++)if(e&&e[o]){if((n=e[o].index-o)>0){for(e.forEach(function(e,t){e&&e.index&&(a=e.index,i=1),e&&!e.index&&0!==t&&(e.index=a+i),i++});n--;)e.splice(o,0,null);o+=n}}else e?e[o]=null:e=[];return e[r]}function ne(e,r,n){for(var i,a,o,s=0,l=e.length,h=0;h<l;h++)!function(h){if(t.isNullOrUndefined(e[h])||t.isUndefined(e[h].index)||(a=s=e[h].index-h,delete e[h].index),s>0){for(i=0;s--;)r?(n.createSheet(h+i),i++):e.splice(h,0,null);h+=a,l+=a}if(r){e[h].id<1&&(e[h].id=fe(n.sheets),e[h].properties&&(e[h].properties.id=e[h].id)),e[h].name||n.setSheetPropertyOnMute(e[h],"name","Sheet"+ue(n));var d=0;e[h].rows.forEach(function(e){d=Math.max(d,e&&e.cells&&e.cells.length-1||0)}),n.setSheetPropertyOnMute(e[h],"usedRange",{rowIndex:e[h].rows.length?e[h].rows.length-1:0,colIndex:d})}o=h}(h),h=o}function ie(e,r,n,i){var a,o,s=ce(e,n),l=y(r),h=l[0],d=l[2];for(h;h<=d;h++)for(a=l[1],o=l[3],a;a<=o;a++){var p=$(h,a,s);e.notify(Pt,{rowIdx:h,colIdx:a}),!t.isNullOrUndefined(p)&&i&&(delete p.value,t.isNullOrUndefined(p.formula)||delete p.formula,t.isNullOrUndefined(p.hyperlink)||delete p.hyperlink)}}function ae(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].name.toLowerCase()===t.toLowerCase()){r=n;break}return r}function oe(e,t){for(var r,n=0;n<e.sheets.length;n++)if(e.sheets[n].id===t){r=n;break}return r}function se(e){return e.split("!")[0].replace(/\'/gi,"")}function le(e,t,r){for(var n=r.length,i=0;i<n;i++)if(r[i].sheet.toUpperCase()===t.toUpperCase())return r[i].index;return-1}function he(e,t,r,n){void 0===r&&(r={}),e.setSheetPropertyOnMute(r,"selectedRange",n?r.selectedRange+" "+t:t)}function de(e){return e&&e.selectedRange||"A1"}function pe(e){return e.selectedRange.split(" ")[0]}function ce(e,t){return e.sheets[t]}function ue(e){var t=[];e.sheets.forEach(function(e){t.push(e.name.toLowerCase())});for(var r=0;r<t.length;r++){if(!(t.indexOf("sheet"+e.sheetNameCount)>-1))return e.sheetNameCount++;e.sheetNameCount++}return e.sheetNameCount++}function fe(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function ge(e,r){var n=r||e.sheets;n.forEach(function(r){if(r.id=r.id||0,r.name=r.name||"",r.rowCount=t.isUndefined(r.rowCount)?100:r.rowCount,r.colCount=t.isUndefined(r.colCount)?100:r.colCount,r.topLeftCell=r.topLeftCell||"A1",r.activeCell=r.activeCell||"A1",r.selectedRange=r.selectedRange||"A1:A1",r.usedRange=r.usedRange||{rowIndex:0,colIndex:0},e.setSheetPropertyOnMute(r,"ranges",r.ranges?r.ranges:[]),e.setSheetPropertyOnMute(r,"rows",r.rows&&t.extend([],r.rows,null,!0)||[]),e.setSheetPropertyOnMute(r,"columns",r.columns||[]),r.showHeaders=!!t.isUndefined(r.showHeaders)||r.showHeaders,r.showGridLines=!!t.isUndefined(r.showGridLines)||r.showGridLines,r.state=r.state||"Visible",r.maxHgts=[],r.protectSettings=r.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},r.isProtected=r.isProtected||!1,!r.paneTopLeftCell||"A1"===r.paneTopLeftCell){r.frozenRows=r.frozenRows?r.frozenRows:0,r.frozenColumns=r.frozenColumns?r.frozenColumns:0;var n=u(r.topLeftCell);e.setSheetPropertyOnMute(r,"paneTopLeftCell",g(r.frozenRows?n[0]+r.frozenRows:n[0],r.frozenColumns?n[1]+r.frozenColumns:n[1]))}ne(r.columns),me(r.rows)}),ne(n,!0,e)}function me(e){e.forEach(function(e){e&&e.cells&&ne(e.cells)}),ne(e)}function ve(e,t){return void 0===t&&(t=e.activeSheetIndex),ce(e,t).name}function ye(e,t){return e.rows[t]}function Ce(e,t,r){e.rows[t]||(e.rows[t]={}),Object.keys(r).forEach(function(n){e.rows[t][n]=r[n]})}function be(e,t){return e.rows[t]&&e.rows[t].hidden}function Se(e,t,r){var n;if(e&&e.rows&&e.rows[t]){if(e.rows[t].hidden)return 0;n=void 0===e.rows[t].height?20:e.rows[t].height}else n=20;if(r&&window.devicePixelRatio%1>0){var i=n*window.devicePixelRatio%1;return n+(i?(i>.5?1-i:-1*i)/window.devicePixelRatio:0)}return n}function xe(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function we(e,t,r,n){void 0===r&&(r=t);var i,a=0;t>r&&(i=t,t=r,r=i);for(var o=t;o<=r;o++)a+=Se(e,o,n);return a}function Ie(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function Ee(e,t,r){var n=Ie(e,t);Object.keys(r).forEach(function(e){n[e]=r[e]})}function Re(e,t,r,n){var i;if(e&&e.columns&&e.columns[t]){if(!r&&e.columns[t].hidden)return 0;i=e.columns[t].width||e.columns[t].customWidth?e.columns[t].width:64}else i=64;if(n&&window.devicePixelRatio%1>0){var a=i*window.devicePixelRatio%1;return i+(a?(a>.5?1-a:-1*a)/window.devicePixelRatio:0)}return i}function ke(e,t,r,n){void 0===r&&(r=t);var i=0;if(t>r){var a=t;t=r,r=a}for(var o=t;o<=r;o++)i+=Re(e,o,null,n);return i}function Ae(e,t){return e.columns[t]&&e.columns[t].hidden}function Te(e){var t=[];return Fe(e,t),z(e,t),t}function Fe(e,t){t.push({member:"basic",args:[]}),t.push({member:"all",args:[]}),e.showRibbon&&t.push({member:"ribbon",args:[e]}),e.showFormulaBar&&t.push({member:"formulaBar",args:[e]}),e.showSheetTabs&&t.push({member:"sheetTabs",args:[e]}),e.allowEditing&&(t.push({member:"edit",args:[e]}),t.push({member:"formula",args:[e]}),t.push({member:"workbookFormula",args:[e]}),t.push({member:"workbookEdit",args:[e]})),e.allowOpen&&t.push({member:"open",args:[e]}),e.allowSave&&t.push({member:"save",args:[e]}),e.enableContextMenu&&t.push({member:"contextMenu",args:[e]}),"None"!==e.selectionSettings.mode&&t.push({member:"selection",args:[e]}),e.enableKeyboardNavigation&&t.push({member:"keyboardNavigation",args:[e]}),e.allowNumberFormatting&&t.push({member:"numberFormat",args:[e]}),e.enableKeyboardShortcut&&t.push({member:"keyboardShortcut",args:[e]}),e.enableClipboard&&t.push({member:"clipboard",args:[e]}),e.allowCellFormatting&&t.push({member:"cellformat",args:[e]}),e.allowSorting&&t.push({member:"sort",args:[e]}),e.allowResizing&&t.push({member:"resize",args:[e]}),t.push({member:"collaborativeEditing",args:[e]}),t.push({member:"protectSheet",args:[e]}),e.allowHyperlink&&t.push({member:"spreadsheetHyperlink",args:[e]}),e.allowUndoRedo&&t.push({member:"undoredo",args:[e]}),e.allowFiltering&&t.push({member:"filter",args:[e]}),e.allowWrap&&t.push({member:"wrapText",args:[e]}),e.allowInsert&&t.push({member:"insert",args:[e]}),e.allowDelete&&t.push({member:"delete",args:[e]}),e.allowDataValidation&&t.push({member:"dataValidation",args:[e]}),e.allowFindAndReplace&&t.push({member:"findAndReplace",args:[e]}),e.allowMerge&&t.push({member:"merge",args:[e]}),e.allowConditionalFormat&&t.push({member:"conditionalFormatting",args:[e]}),e.allowImage&&t.push({member:"spreadsheetImage",args:[e]}),e.allowChart&&t.push({member:"spreadsheetChart",args:[e]})}function Le(e){requestAnimationFrame(function(){e()})}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function De(e){var t=30;return e.toString().length>3&&(t=10*e.toString().length),t}function Oe(){if(null!==Ln)return Ln;var e=document.createElement("div"),t=0;return e.style.cssText="width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;",document.body.appendChild(e),t=e.offsetWidth-e.clientWidth|0,document.body.removeChild(e),Ln=t}function He(e,t){return void 0===t&&(t=Nn),Be(e,"previous",t)+Be(e,"next",t)}function Be(e,t,r){for(var n=e[t+"ElementSibling"],i=0;n;)r.some(function(e){return n.classList.contains(e)})&&(i+=n.offsetHeight),n=n[t+"ElementSibling"];return i}function Me(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.viewport.topIndex,i=e.viewport.leftIndex,a=n+e.viewport.rowCount+2*e.getThreshold("row"),o=i+e.viewport.colCount+2*e.getThreshold("col"),s=n<=t[0]&&a>=t[2]&&i<=t[1]&&o>=t[3];if(s)return!0;if(r){if(t[0]<n&&t[2]<n||t[0]>a&&t[2]>a)return!1;if(t[0]<n&&t[2]>n&&(t[0]=n,s=!0),t[2]>a&&(t[2]=a,s=!0),t[1]<i&&t[3]<i||t[1]>o&&t[3]>o)return!1;t[1]<i&&t[3]>i&&(t[1]=i,s=!0),t[3]>o&&(t[3]=o,s=!0)}return s}return!0}function Pe(e,t,r,n,i,a,o){var s,l={left:{idx:0,size:0},top:{idx:0,size:0}},h=l.top.size,d=l.left.size;for(s=l.top.idx;s<t[0];s++)r&&r-1<t[0]&&s<r||(h+=Se(e,s,!0));for(s=l.left.idx;s<t[1];s++)n&&n-1<t[1]&&s<n||(d+=Re(e,s,null,!0));return r&&t[0]<r&&(e.showHeaders&&(h+=30),i&&(h-=i)),n&&t[1]<n&&(e.showHeaders&&(d+=o||30),a&&(d-=a)),{top:h,left:d}}function _e(e,r,n,i){void 0===i&&(i="e-selection");var a=e.getActiveSheet();if(a.frozenRows||a.frozenColumns){var o,s=e.frozenRowCount(a),l=e.frozenColCount(a);if("e-active-cell"===i){if(n[0]<s||n[1]<l){r.style.display="none";var h=(o=n[0]<s&&n[1]<l?e.getSelectAllContent():n[0]<s?e.getColumnHeaderContent():e.getRowHeaderContent()).querySelector("."+i);h||(h=r.cloneNode(!0),o.appendChild(h)),Ve(r=h,n,a,e.enableRtl,s,l,!0,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth)}else Ve(r,n,a,e.enableRtl,s,l);r.style.display&&(r.style.display=""),Ue(e.getSelectAllContent(),o,!0),Ue(e.getColumnHeaderContent(),o,!0),Ue(e.getRowHeaderContent(),o,!0)}else{var d=x(n);if(d[0]<s||d[1]<l){r.classList.add("e-hide");var p=[];d[0]<s&&d[1]<l?d[2]<s&&d[3]<l?(p.push(n),Ue(e.getColumnHeaderContent(),o,!1),Ue(e.getRowHeaderContent(),o,!1)):d[2]>s-1?d[3]<l?(Ue(e.getColumnHeaderContent(),o,!1),p.push([d[0],d[1],s-1,d[3]]),p.push([s,d[1],d[2],d[3]])):(p.push([d[0],d[1],s-1,l-1]),p.push([s,d[1],d[2],l-1]),p.push([d[0],l,s-1,d[3]]),p.push([s,l,d[2],d[3]])):d[2]<s?(p.push([d[0],d[1],d[2],l-1]),p.push([d[0],l,d[2],d[3]]),Ue(e.getRowHeaderContent(),o,!1)):(p.push([s,d[1],d[2],l-1]),p.push([d[0],d[1],s-1,l-1]),p.push([s,l,d[2],d[3]]),p.push([d[0],l,s-1,d[3]])):d[0]<s?d[2]<s?p.push(n):(p.push([d[0],d[1],s-1,d[3]]),p.push([s,d[1],d[2],d[3]]),Ue(e.getSelectAllContent(),o,!1),Ue(e.getRowHeaderContent(),o,!1)):d[3]<l?p.push(n):(p.push([d[0],d[1],d[2],l-1]),p.push([d[0],l,d[2],d[3]]),Ue(e.getSelectAllContent(),o,!1),Ue(e.getColumnHeaderContent(),o,!1));var c;p.forEach(function(n){o=n[2]<s&&n[3]<l?e.getSelectAllContent():n[2]<s?e.getColumnHeaderContent():n[3]<l?e.getRowHeaderContent():e.getMainContent();var h;"e-copy-indicator"===i||"e-range-indicator"===i?(h=r.cloneNode(!0),o.appendChild(h),s&&(n[2]+1===s&&p.forEach(function(e){e!==n&&(c=h.getElementsByClassName("e-bottom")[0])&&e[0]===s&&t.detach(c)}),n[0]===s&&o.parentElement.classList.contains("e-main-panel")&&p.forEach(function(e){e!==n&&(c=h.getElementsByClassName("e-top")[0])&&e[2]+1===s&&t.detach(c)})),l&&(n[3]+1===l&&p.forEach(function(e){e!==n&&(c=h.getElementsByClassName("e-right")[0])&&e[1]===l&&t.detach(c)}),n[1]===l&&(o.classList.contains("e-sheet-content")||o.classList.contains("e-column-header"))&&p.forEach(function(e){e!==n&&(c=h.getElementsByClassName("e-left")[0])&&e[3]+1===l&&t.detach(c)}))):(h=o.querySelector("."+i))||(h=r.cloneNode(!0),o.appendChild(h)),Ve(h,n,a,e.enableRtl,s,l,!1,e.viewport.beforeFreezeHeight,e.viewport.beforeFreezeWidth,e.sheetModule.colGroupWidth),h.classList.contains("e-hide")&&h.classList.remove("e-hide")})}else Ue(e.getSelectAllContent(),null,!1),Ue(e.getColumnHeaderContent(),null,!1),Ue(e.getRowHeaderContent(),null,!1),Ve(r,n,a,e.enableRtl,s,l),"e-range-indicator"!==i&&e.getMainContent().querySelector("."+i)||e.getMainContent().appendChild(r)}}else Ve(r,n,a,e.enableRtl,0,0),r&&!e.getMainContent().querySelector("."+i)&&e.getMainContent().appendChild(r)}function Ue(e,r,n){var i;n?e!==r&&(i=e.querySelector(".e-active-cell"))&&t.detach(i):(i=e.querySelector(".e-selection"))&&t.detach(i)}function Ve(e,t,r,n,i,a,o,s,l,h){var d=x(t),p=Pe(r,d,i,a,s,l,h),c=[yt(r,0,!0),yt(r,0,!0,"columns")],u=we(r,t[0],t[2],!0),f=ke(r,t[1],t[3],!0),g={top:(d[0]===c[0]?p.top:p.top-et(1))+"px",height:u&&u+(d[0]===c[0]?0:et(1))+"px",width:f&&f+(d[1]===c[1]?0:et(1))+(o&&a&&d[1]<a&&d[3]>=a?1:0)+"px"};g[n?"right":"left"]=(d[1]===c[1]?p.left:p.left-1)+"px",e&&ze([{element:e,attrs:g}])}function ze(e){requestAnimationFrame(function(){e.forEach(function(e){t.setStyleAttribute(e.element,e.attrs)})})}function qe(){return t.Browser.isPointer?"pointerdown":"mousedown touchstart"}function je(){return t.Browser.isPointer?"pointermove":"mousemove touchmove"}function We(){return t.Browser.isPointer?"pointerup":"mouseup touchend"}function Ge(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function Ye(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function Xe(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function Ke(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function $e(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function Ze(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function Je(e){return e.changedTouches?e.changedTouches[0].clientX:e.clientX}function Qe(e){return e.changedTouches?e.changedTouches[0].clientY:e.clientY}function et(e,t){if(window.devicePixelRatio%1>0){var r=e*window.devicePixelRatio%1;return e+(r?(r>.5||t?1-r:-1*r)/window.devicePixelRatio:0)}return e}function tt(e,t){Object.keys(t).forEach(function(r){e&&e.setAttribute(Dn[r],t[r])})}function rt(e,r){if(e){var n=t.getComponent(e,r);n&&n.destroy()}}function nt(e,t,r,n,i){var a,o,s,l,h,d,p,c,u,f=i.getActiveSheet(),g=i.frozenRowCount(f),m=i.frozenColCount(f);if(n){var v=e<m?i.getSelectAllContent():i.getColumnHeaderContent();a=v.getElementsByTagName("th")[t],o=v.getElementsByTagName("col")[t],s=(e<m?i.getRowHeaderContent():i.getMainContent()).getElementsByTagName("col")[t]}else{a=o=g||m?i.getRow(e,null,m-1):i.getRow(e,i.getRowHeaderTable()),o.style.height=parseInt(r,10)>0?et(parseInt(r,10))+"px":"2px",(s=i.getRow(e,null,m)).style.height=parseInt(r,10)>0?et(parseInt(r,10))+"px":"0px";var y=void 0;if(f.showHeaders){var C=i.getRowHeaderContent().getElementsByClassName("e-row"),b=[];b[0]=C[t].getElementsByTagName("td")[0].cloneNode(!0),y=at(i.getRowHeaderTable(),b,!1,i)+1}for(var S=i.getMainContent().getElementsByClassName("e-row"),x=[],w=0;w<S[t].getElementsByTagName("td").length;w++)x[w]=S[t].getElementsByTagName("td")[w].cloneNode(!0);var I=at(i.getContentTable(),x,!1,i)+1,E=y>=I?y:I;parseInt(s.style.height,10)<E||a&&a.classList.contains("e-reach-fntsize")&&parseInt(s.style.height,10)===E?(f.showHeaders&&(a.classList.add("e-reach-fntsize"),o.style.lineHeight=parseInt(r,10)>=4?parseInt(r,10)-4+"px":parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"),s.style.lineHeight=parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"):(o&&o.style.removeProperty("line-height"),s.style.removeProperty("line-height"),a&&a.classList.contains("e-reach-fntsize")&&a.classList.remove("e-reach-fntsize"))}if(d=s.previousElementSibling,u=s.nextElementSibling,d&&(f.showHeaders&&(l=a.previousElementSibling,h=o.previousElementSibling),d=s.previousElementSibling),u&&(f.showHeaders&&(p=a.nextElementSibling,c=o.nextElementSibling),u=s.nextElementSibling),parseInt(r,10)<=0&&!s.classList.contains("e-zero")&&!s.classList.contains("e-zero-start")){if(d&&u)if(n?(f.showHeaders&&(o.style.width="2px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="2px"),s.style.height="0px"),d.classList.contains("e-zero-start")?(f.showHeaders&&a.classList.add("e-zero-start"),s.classList.add("e-zero-start")):(f.showHeaders&&a.classList.add("e-zero"),s.classList.add("e-zero")),!p||p.classList.contains("e-zero")||p.classList.contains("e-zero-last")||(f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),d.classList.contains("e-zero-last")&&(f.showHeaders&&l.classList.remove("e-zero-last"),d.classList.remove("e-zero-last")),f.showHeaders&&l.classList.contains("e-zero")?(a.classList.contains("e-zero-end"),it(h,-2,n)):f.showHeaders&&it(h,-1,n),f.showHeaders&&l.classList.contains("e-zero-start")&&it(o,-1,n),f.showHeaders&&p.classList.contains("e-zero"))if(a.classList.contains("e-zero-start"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.height,10)&&!n||0!==parseInt(c.style.width,10)&&n){n?(o.style.width=parseInt(o.style.width,10)-1+"px",c.style.width=parseInt(c.style.width,10)-1+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",c.style.height=parseInt(c.style.height,10)-1+"px"),p.classList.remove("e-zero"),p.classList.add("e-zero-start");break}R=void 0;p.classList.remove("e-zero"),p.classList.add("e-zero-start"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,p=i.getColHeaderTable().getElementsByTagName("th")[R+1],c=i.getColHeaderTable().getElementsByTagName("col")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else it(o,-2,n);else f.showHeaders&&(p.classList.contains("e-zero-end")?n?o.style.width="0px":o.style.height="0px":it(c,-1,n));else if(d)n?(f.showHeaders&&(o.style.width="1px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="1px"),s.style.height="0px"),f.showHeaders&&a.classList.add("e-zero-end"),s.classList.add("e-zero-end"),f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last"),f.showHeaders&&l.classList.contains("e-zero")?it(h,-2,n):it(h,-1,n);else if(p)if(a.classList.add("e-zero-start"),s.classList.add("e-zero-start"),p.classList.contains("e-zero")||(a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),n?(o.style.width="1px",s.style.width="0px"):(o.style.height="1px",s.style.height="0px"),f.showHeaders&&p.classList.contains("e-zero"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.width,10)&&n||0!==parseInt(c.style.height,10)&&!n){n?(c.style.width=parseInt(c.style.width,10)-1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(c.style.height=parseInt(c.style.height,10)-1+"px",o.style.height=parseInt(o.style.height,10)-1+"px"),p.classList.add("e-zero-start"),p.classList.remove("e-zero");break}var R=void 0;p.classList.add("e-zero-start"),p.classList.remove("e-zero"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,c=i.getColHeaderTable().getElementsByTagName("col")[R+1],p=i.getColHeaderTable().getElementsByTagName("th")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else f.showHeaders&&it(c,-1,n)}else if(parseInt(r,10)>0){var k=et(parseInt(r,10))+"px";n?(o.style.width=k,s.style.width=k):(o.style.height=k,s.style.height=k),f.showHeaders&&l&&p?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(h.style.width=parseInt(h.style.width,10)+2+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+2+"px",o.style.height=parseInt(o.style.height,10)-1+"px"):it(o,-1,n):a.classList.contains("e-zero")?it(h,1,n):a.classList.contains("e-zero-start")&&(n?(h.style.width=parseInt(h.style.width,10)+1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+1+"px",o.style.height=parseInt(o.style.height,10)-1+"px")),p.classList.contains("e-zero")?it(o,-1,n):(a.classList.contains("e-zero")||a.classList.contains("e-zero-start"))&&it(c,1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"),a.classList.contains("e-zero-last")&&a.classList.remove("e-zero-last"),s.classList.contains("e-zero-last")&&s.classList.remove("e-zero-last"),(l.classList.contains("e-zero")||l.classList.contains("e-zero-start"))&&(l.classList.add("e-zero-last"),d.classList.add("e-zero-last"))):f.showHeaders&&l?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(o.style.width=parseInt(o.style.width,10)-1+"px",h.style.width=parseInt(h.style.width,10)+2+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",h.style.height=parseInt(h.style.height,10)+2+"px"):it(o,-1,n):a.classList.contains("e-zero")?it(h,1,n):it(o,-1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-end")&&a.classList.remove("e-zero-end"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-end")&&s.classList.remove("e-zero-end")):f.showHeaders&&p&&(p.classList.contains("e-zero")?it(o,-1,n):a.classList.contains("e-zero-start")&&(it(c,1,n),a.classList.remove("e-zero-start")),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"))}}function it(e,t,r){r?e.style.width=parseInt(e.style.width,10)+t+"px":e.style.height=parseInt(e.style.height,10)+t+"px"}function at(e,t,r,n,i,a){var o=n.createElement("div",{className:n.element.className,styles:"display: block"}),s=n.createElement("table",{className:e.className+"e-resizetable",styles:"width: auto;height: auto"}),l=n.createElement("tr");r?t.forEach(function(e){var t=l.cloneNode();t.appendChild(e),s.appendChild(t)}):(t.forEach(function(e){l.appendChild(e.cloneNode(!0))}),s.appendChild(l)),o.appendChild(s),document.body.appendChild(o);var h,d,p=s.getBoundingClientRect().width,c=s.getBoundingClientRect().height;return a?(h=r&&parseInt(i,10)>p?p:parseInt(i,10),d=!r&&parseInt(i,10)>c?c:parseInt(i,10)):(d=c,h=p),document.body.removeChild(o),r?Math.ceil(h):Math.ceil(d)}function ot(e,r,n){var i,a,o,s,l,h,d=e.eventArgs;switch(e.action){case"sorting":o={args:{range:e.eventArgs.range,sortOptions:e.eventArgs.sortOptions,cancel:!1},promise:new Promise(function(e,t){e(void 0)})},r.notify(kt,o),o.promise.then(function(e){r.serviceLocator.getService("cell").refreshRange(y(e.range))});break;case"cellSave":s=e.eventArgs,l=d.formula?n?{value:s.formula}:{formula:s.formula}:{value:s.value},r.updateCell(l,s.address);break;case"cellDelete":r.clearRange(e.eventArgs.address,null,!0),r.serviceLocator.getService("cell").refreshRange(c(e.eventArgs.address));break;case"format":if("CellFormat"===d.requestType)if(d.style&&d.style.border&&!t.isNullOrUndefined(d.borderType)){var p={};Object.assign(p,d.style,null,!0),d.style.border=void 0,r.cellFormat(d.style,d.range),d.style.border=p.border,r.setBorder(d.style,d.range,d.borderType),d.style=p}else r.cellFormat(d.style,d.range);else r.numberFormat(d.format,d.range);break;case"clipboard":if(d.copiedInfo.isCut&&!n)return;(d.copiedInfo.isCut?r.cut(d.copiedRange):r.copy(d.copiedRange)).then(function(){r.paste(d.pastedRange,d.type)});break;case"gridLines":r.setSheetPropertyOnMute(r.sheets[d.sheetIdx],"showGridLines",d.isShow);break;case"headers":r.setSheetPropertyOnMute(r.sheets[d.sheetIdx],"showHeaders",d.isShow);break;case"resize":case"resizeToFit":d.isCol?void 0===d.hide?r.setColWidth(d.width,d.index,d.sheetIdx):r.hideColumn(d.index,d.index,d.hide):void 0===d.hide?r.setRowHeight(d.height,d.index,d.sheetIdx+1):r.hideRow(d.index,d.index,d.hide);break;case"renameSheet":r.setSheetPropertyOnMute(r.sheets[d.index-1],"name",d.value);break;case"removeSheet":r.notify($t,{index:d.index,isAction:!0,count:d.sheetCount,clicked:!0});break;case"wrap":Q(e.eventArgs.address,e.eventArgs.wrap,r);break;case"hideShow":d.isCol?r.hideColumn(d.startIndex,d.endIndex,d.hide):r.hideRow(d.startIndex,d.endIndex,d.hide);break;case"replace":r.updateCell({value:d.compareVal},d.address);break;case"filter":r.notify(rr,{predicates:null,range:d.range,sIdx:d.index,isCut:!0});break;case"insert":!1===n?r.delete(e.eventArgs.index,e.eventArgs.index+(e.eventArgs.model.length-1),e.eventArgs.modelType):r.notify(Tt,{model:"Sheet"===e.eventArgs.modelType?r:r.getActiveSheet(),start:e.eventArgs.index,end:e.eventArgs.index+(e.eventArgs.model.length-1),modelType:e.eventArgs.modelType,isAction:!1,checkCount:e.eventArgs.sheetCount,activeSheetIndex:e.eventArgs.activeSheetIndex});break;case"delete":!1===n?r.notify(Tt,{model:"Sheet"===e.eventArgs.modelType?r:r.getActiveSheet(),start:e.eventArgs.deletedModel,modelType:e.eventArgs.modelType,isAction:!1,columnCellsModel:e.eventArgs.deletedCellsModel}):r.delete(e.eventArgs.startIndex,e.eventArgs.endIndex,e.eventArgs.modelType);break;case"validation":if(n){var u={type:d.type,operator:d.operator,value1:d.value1,value2:d.value2,ignoreBlank:d.ignoreBlank,inCellDropDown:d.inCellDropDown};r.notify(Ft,{rules:u,range:d.range})}else r.notify(Dt,{range:d.range});break;case"merge":e.eventArgs.isAction=!1,h=[];for(var f=0,g=d.model.length;f<g;f++){h.push({cells:[]});for(var m=0,v=d.model[f].cells.length;m<v;m++)h[f].cells[m]={},Object.assign(h[f].cells[m],d.model[f].cells[m])}r.notify(Ht,e.eventArgs),d.model=h;break;case"clear":r.notify(lr,{options:e.eventArgs,isPublic:!0});break;case"conditionalFormat":if(n){var C={type:d.type,cFColor:d.cFColor,value:d.value,range:d.range};r.notify(Bt,{conditionalFormat:C})}else r.notify(Mt,{range:d.range});break;case"clearCF":n?r.notify(Mt,{range:d.selectedRange}):r.notify(_t,{conditionalFormats:d.cFormats,oldRange:d.oldRange,selectedRange:d.selectedRange});break;case"insertImage":n?r.notify(dr,{options:{src:e.eventArgs.imageData,height:e.eventArgs.imageHeight,width:e.eventArgs.imageWidth,imageId:e.eventArgs.id},range:e.eventArgs.range,isPublic:!1,isUndoRedo:!0}):r.notify(pr,{id:e.eventArgs.id,sheetIdx:e.eventArgs.sheetIndex+1,range:e.eventArgs.range});break;case"imageRefresh":a=document.getElementById(e.eventArgs.id),n?(e.eventArgs.isUndoRedo=!0,r.notify(hr,e.eventArgs)):r.notify(hr,{prevTop:e.eventArgs.currentTop,prevLeft:e.eventArgs.currentLeft,currentTop:e.eventArgs.prevTop,currentLeft:e.eventArgs.prevLeft,id:e.eventArgs.id,currentHeight:e.eventArgs.prevHeight,currentWidth:e.eventArgs.prevWidth,requestType:"imageRefresh",prevHeight:e.eventArgs.currentHeight,prevWidth:e.eventArgs.currentWidth,isUndoRedo:!0}),a.style.height=n?e.eventArgs.currentHeight+"px":e.eventArgs.prevHeight+"px",a.style.width=n?e.eventArgs.currentWidth+"px":e.eventArgs.prevWidth+"px",a.style.top=n?e.eventArgs.currentTop+"px":e.eventArgs.prevTop+"px",a.style.left=n?e.eventArgs.currentLeft+"px":e.eventArgs.prevLeft+"px";break;case"insertChart":if(n){var b=[{type:d.type,theme:d.theme,isSeriesInRows:d.isSeriesInRows,range:d.range,id:d.id,height:d.height,width:d.width}];r.notify(Ut,{chart:b,isInitCell:d.isInitCell,isUndoRedo:!1,range:d.posRange})}else r.notify(cr,{id:d.id,isUndoRedo:!0});break;case"deleteChart":if(n)r.notify(cr,{id:d.id});else{var S=[{type:d.type,theme:d.theme,isSeriesInRows:d.isSeriesInRows,range:d.range,id:d.id,height:d.height,width:d.width,top:d.top,left:d.left}];r.notify(Ut,{chart:S,isInitCell:d.isInitCell,isUndoRedo:!1,range:d.posRange})}break;case"chartRefresh":(i=document.getElementById(e.eventArgs.id))&&(i.style.height=n?e.eventArgs.currentHeight+"px":e.eventArgs.prevHeight+"px",i.style.width=n?e.eventArgs.currentWidth+"px":e.eventArgs.prevWidth+"px",i.style.top=n?e.eventArgs.currentTop+"px":e.eventArgs.prevTop+"px",i.style.left=n?e.eventArgs.currentLeft+"px":e.eventArgs.prevLeft+"px"),n?(e.eventArgs.isUndoRedo=!0,r.notify(Vt,{height:i.style.height,width:i.style.width,overlayEle:i})):r.notify(Vt,{height:i.style.height,width:i.style.width,overlayEle:i})}}function st(e,t,r,n){for(var i,a=e.sheets[n].ranges,o=0,s=a.length;o<s;o++)if(a[o].template&&(i=c(a[o].address.length?a[o].address:a[o].startCell))[0]<=t&&i[1]<=r&&i[2]>=t&&i[3]>=r)return!0;return!1}function lt(e,t,r,n,i,a,o){void 0===o&&(o=!0);var s=Se(t,n,!0),l=e.frozenColCount(t),h=et(r);(i=i||(t.frozenRows?e.getRow(n,null,l):e.getRow(n)))&&(i.style.height=h+"px"),(a=a||(t.frozenColumns?e.getRow(n,null,l-1):e.getRow(n,e.getRowHeaderTable())))&&(a.style.height=h+"px"),xe(t,n,r),e.setProperties({sheets:e.sheets},!0),o&&e.notify(Qt,{rowIdx:n,threshold:h-s})}function ht(e,t,r){void 0===r&&(r=1);var n=t&&t.fontSize||e.cellStyle.fontSize,i=(n.indexOf("pt")>-1?1.33*parseInt(n,10):parseInt(n,10))*(t&&"Arial Black"===t.fontFamily?1.44:1.24)*r;return Math.ceil(i%1>.9?i+1:i)}function dt(e,t,r){t||(t=r);var n=document.createElement("canvas").getContext("2d");return n.font=(t.fontStyle||r.fontStyle)+" "+(t.fontWeight||r.fontWeight)+" "+(t.fontSize||r.fontSize)+" "+(t.fontFamily||r.fontFamily),et(n.measureText(e).width,!0)}function pt(e,t,r,n){var i,a,o=0,s=e.toString().split(" "),l=dt(" ",r,n),h=0;return s.forEach(function(e){var d=0,p=0;i=dt(e,r,n),s[s.length-1]!==e&&(i+=l),(a=(o+i)/t)>=1?(o&&h++,i/t>=1?(e.split("").forEach(function(e){p=dt(e,r,n),(d+=p)>t&&(h++,d=p)}),o=d+l):o=i):o+=i}),o&&(h+=Math.ceil((o-l)/t)),h}function ct(e,t,r){var n=0,i=$(e,t,r,null,!0),a=$(e,t+1,r,null,!0);return i.style&&(i.style.border?n=(0===t?2:1)*parseFloat(i.style.border.split("px")[0]):(0===t&&i.style.borderLeft&&(n=parseFloat(i.style.borderLeft.split("px")[0])),i.style.borderRight&&(n+=parseFloat(i.style.borderRight.split("px")[0])))),i.style&&(i.style.border||i.style.borderRight)||!a.style||!a.style.borderLeft||(n+=parseFloat(a.style.borderLeft.split("px")[0])),n}function ut(e,t,r){var n=0,i=$(e,t,r,null,!0),a=$(e+1,t,r,null,!0);return i.style&&(i.style.border?n=(0===e?2:1)*parseFloat(i.style.border.split("px")[0]):(0===e&&i.style.borderTop&&(n=parseFloat(i.style.borderTop.split("px")[0])),i.style.borderBottom&&(n+=parseFloat(i.style.borderBottom.split("px")[0])))),i.style&&(i.style.border||i.style.borderBottom)||!a.style||!a.style.borderTop||(n+=parseFloat(a.style.borderTop.split("px")[0])),n}function ft(e,t,r,n){return void 0===n&&(n=r),ke(e,r,n,!0)-et(4+ct(t,r,e))}function gt(e,t,r,n,i,a){return ht(e,i,a)+(ut(t,r,n)||1)}function mt(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function vt(e,t){var r=0,n=e.maxHgts[t];return n&&Object.keys(n).forEach(function(e){n[e]>r&&(r=n[e])}),r}function yt(e,t,r,n){return void 0===n&&(n="rows"),t<0&&(t=-1),e[n][t]&&e[n][t].hidden&&(r?t++:t--,t=yt(e,t,r,n)),t}function Ct(e){if(!document.activeElement.classList.contains("e-text-findNext-short"))if(t.Browser.isIE){var r=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(r,n)}else e.focus({preventScroll:!0})}function bt(e,r){for(var n,i=e.getActiveSheet(),a=t.isNullOrUndefined(r)?x(c(i.selectedRange)):r,o=a[0];o<=a[2];o++)for(var s=a[1];s<=a[3];s++)if(X($(o,s,i),Ie(i,s))){n=!0;break}return n}var St=function(){function e(e,t,r,n,i){this.preventCallback=!1,this.context=e,this.workerTask=t,this.defaultListener=r,this.workerData=n,i&&(this.preventCallback=!0),this.initWorker()}return e.prototype.terminate=function(){this.worker.terminate(),URL.revokeObjectURL(this.workerUrl)},e.prototype.initWorker=function(){var e=new Blob([this.getFnCode()],{type:"text/javascript"});this.workerUrl=URL.createObjectURL(e),this.worker=new Worker(this.workerUrl),this.worker.onmessage=this.messageFromWorker.bind(this),this.worker.onerror=this.onError.bind(this),this.worker.postMessage(this.workerData)},e.prototype.messageFromWorker=function(e){this.terminate(),this.defaultListener.apply(this.context,[e.data])},e.prototype.onError=function(e){throw this.terminate(),e.message||e},e.prototype.getFnCode=function(){var e,t,r="",n="",i=!1;if("function"==typeof this.workerTask)this.workerTask.toString().indexOf("function")<0?n="function "+this.workerTask.toString():(n=this.workerTask.toString(),i=!0),r+="self.workerTask = "+n+"; \n";else if("object"==typeof this.workerTask)for(t=Object.keys(this.workerTask),e=0;e<t.length;e++)this.workerTask[t[e]].toString().indexOf("function")<0?n="function "+this.workerTask[t[e]].toString():(n=this.workerTask[t[e]].toString(),i=!0),r+=(0===e?"self.workerTask":t[e])+"= "+n+"; \n";return r+="self.onmessage = "+(i?"":" function ")+(this.preventCallback?this.getMessageFn.toString():this.getCallbackMessageFn.toString())+"; \n"},e.prototype.getCallbackMessageFn=function(e){postMessage(this.workerTask.apply(this,e.data))},e.prototype.getMessageFn=function(e){this.workerTask.apply(this,e.data)},e}(),xt="updateSheetFromDataSource",wt="setCellFormat",It="applyCellFormat",Et="workbookFormulaOperation",Rt="checkDateFormat",kt="initiateSort",At="wrapText",Tt="insertModel",Ft="setValidation",Lt="gotoHandler",Nt="ShowDialog",Dt="removeValidation",Ot="queryCellInfo",Ht="setMerge",Bt="setCFRule",Mt="clearCFRule",Pt="cFDelete",_t="clearCells",Ut="setChart",Vt="refreshChartSize",zt=function(){function e(e){this.parent=e,this.localeObj=t.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.groupSep=this.localeObj.group,this.addEventListener()}return e.prototype.numberFormatting=function(e){var t=this.parent.activeSheetIndex;e.range&&e.range.indexOf("!")>-1&&(t=ae(this.parent,e.range.split("!")[0]));for(var r,n=this.parent.sheets[t],i=c(e.range?e.range.indexOf("!")>-1?e.range.split("!")[1]:e.range:n.selectedRange),a=i[0];a<=i[2];a++)for(var o=i[1];o<=i[3];o++)Z(a,o,n,{format:e.format},!0),r=$(a,o,n,!0),this.getFormattedCell({type:H(r.format),value:r.value,format:r.format,rowIndex:a,colIndex:o,sheetIndex:t,cell:r})},e.prototype.getFormattedCell=function(e){var r=t.isNullOrUndefined(e.value)?"":e.value,n=this.parent.sheets[t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex],i=c(n.activeCell),a=Number(e.sheetIndex)?Number(e.sheetIndex):this.parent.activeSheetIndex,o=e.cell?e.cell:$(i[0],i[1],n),s=e.cell&&!t.isNullOrUndefined(e.rowIdx)?e.rowIdx:i[0],l=e.cell&&!t.isNullOrUndefined(e.colIdx)?e.colIdx:i[1],h=!1,d={},p=new t.Internationalization;p.getNumberFormat(d);var u=t.getNumberDependable(this.parent.locale,d.currency);if(""===e.format||"General"===e.format){o=o||{};var f={value:e.value,rowIndex:s,colIndex:l,sheetIndex:this.parent.activeSheetIndex,updatedVal:e.value,isDate:!1,isTime:!1};this.checkDateFormat(f),f.isDate?(h=!0,o.value=e.value=f.updatedVal,o.format=e.format=O("ShortDate")):f.isTime&&(h=!0,o.value=e.value=f.updatedVal,o.format=e.format=O("Time"))}e.type=e.format?H(e.format):"General";var g=this.processFormats(e,r,h,o,p,u,d.currency);return this.parent.getActiveSheet().id-1===a&&this.parent.notify("refreshCellElem",{isRightAlign:g.rightAlign,result:g.fResult||e.value,rowIndex:e.rowIndex,colIndex:e.colIndex,sheetIndex:e.sheetIndex,type:e.type,curSymbol:u,value:e.value||""}),!e.onLoad&&(e.rowIndex>n.usedRange.rowIndex||e.colIndex>n.usedRange.colIndex)&&this.parent.setUsedRange(e.rowIndex,e.colIndex),e.formattedText=g.fResult||e.value,e.isRightAlign=g.rightAlign,e.curSymbol=u,e.formattedText},e.prototype.processFormats=function(e,t,r,n,i,a,o){var s;if(e.format=e.format?e.format:"General",""!==t)switch(e.type){case"General":t=(s=this.autoDetectGeneralFormat({args:e,currencySymbol:a,fResult:t,intl:i,isRightAlign:r,curCode:o,cell:n,rowIdx:Number(e.rowIdx),colIdx:Number(e.colIdx)})).fResult,r=s.isRightAlign;break;case"Number":L(t)&&(t=this.applyNumberFormat(e,i),r=!0);break;case"Currency":L(t)&&(t=this.currencyFormat(e,i,o),r=!0);break;case"Percentage":L(t)&&(t=this.percentageFormat(e,i),r=!0);break;case"Accounting":L(t)&&(t=this.accountingFormat(e,i,a,o),r=!0);break;case"ShortDate":r=!!(t=this.shortDateFormat(e,i));break;case"LongDate":r=!!(t=this.longDateFormat(e,i));break;case"Time":r=!!(t=this.timeFormat(e,i));break;case"Fraction":L(t)&&(t=this.fractionFormat(e),r=!0);break;case"Scientific":L(t)&&(t=this.scientificFormat(e),r=!0);break;case"Text":r=!1}return{fResult:t,rightAlign:r}},e.prototype.autoDetectGeneralFormat=function(e){if(L(e.fResult)&&(e.args.format&&""!==e.args.format&&(e.args.format.toString().indexOf("%")>-1?e.fResult=this.percentageFormat(e.args,e.intl):e.args.format.toString().indexOf(e.currencySymbol)>-1?e.fResult=this.currencyFormat(e.args,e.intl,e.curCode):e.fResult=this.applyNumberFormat(e.args,e.intl)),"General"===e.args.format&&e.fResult&&e.fResult.toString().split(this.decimalSep)[0].length>11&&(e.fResult=this.scientificFormat(e.args)),e.isRightAlign=!0),!t.isNullOrUndefined(e.fResult)){var r=e.fResult.toString();r.indexOf("%")>-1&&""!==r.split("%")[0]&&""===r.split("%")[1].trim()&&"NaN"!==Number(r.split("%")[0].split(this.groupSep).join("")).toString()?(e.args.value=Number(r.split("%")[0].split(this.groupSep).join(""))/100,e.cell.format=e.args.format=this.getPercentageFormat(r),e.fResult=this.percentageFormat(e.args,e.intl),e.cell.value=e.args.value.toString(),e.isRightAlign=!0):r.indexOf(e.currencySymbol)>-1&&""!==r.split(e.currencySymbol)[1]&&"NaN"!==Number(r.split(e.currencySymbol)[1].split(this.groupSep).join("")).toString()&&!this.parent.isEdit&&(e.args.value=Number(r.split(e.currencySymbol)[1].split(this.groupSep).join("")),e.cell.format=e.args.format=O("Currency"),e.fResult=this.currencyFormat(e.args,e.intl,e.curCode),e.cell.value=e.args.value.toString(),Z(e.rowIdx,e.colIdx,this.parent.getActiveSheet(),e.cell,!0),e.isRightAlign=!0)}return{isRightAlign:e.isRightAlign,fResult:e.fResult}},e.prototype.getPercentageFormat=function(e){return e.indexOf(this.decimalSep)>-1?O("Percentage"):"0%"},e.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},e.prototype.applyNumberFormat=function(e,r){e.format=this.isCustomFormat(e.format.toString());var n=e.format.toString().split(";");if(Number(e.value)>0)e.format=n[0];else if(0===Number(e.value)){if(e.format=n[2]?n[2]:n[0],e.format.indexOf('"')>-1&&-1===e.format.indexOf("#"))return e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" ").split('"').join(""),e.format}else if(Number(e.value)<0)e.format=t.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),e.format.indexOf("-")>-1&&(e.value=e.value.toString().split("-").join(""));else if(e.format=n[3]?n[3]:n[0],e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" "),e.format.indexOf("@")>-1)return e.format.split("@").join(e.value.toString());if(e.format=e.format.split("_").join(" ").split("*").join(" ").split('"').join(""),e.format.indexOf("?")>-1&&e.format.indexOf(this.decimalSep)>-1){var i=e.format.split(this.decimalSep)[1].length,a="";Number(e.value)%1&&(a=i>e.value.toString().split(".")[1].length?" ":"0"),e.format=e.format.split("?").join(a)}else e.format=e.format.split("?").join(" ");return Number(e.value)<0&&e.cell&&(e.format=e.cell.format),r.formatNumber(Number(e.value),{format:e.format})},e.prototype.isCustomFormat=function(e){return'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e||(e=""),e=""===e?O("Number"):e,e=e.toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},e.prototype.currencyFormat=function(e,r,n){e.format=""===e.format?O("Currency"):e.format,e.format=e.format.toString().split("_(").join(" ").split("_)").join(" ").split("[Red]").join("");var i=e.format.toString().split(";");return Number(e.value)>=0?e.format=i[0]:e.format=t.isNullOrUndefined(i[1])?i[0]:i[1].split("*").join(" "),e.format=this.getFormatForOtherCurrency(e.format),r.formatNumber(Number(e.value),{format:e.format,currency:n})},e.prototype.percentageFormat=function(e,t){return e.format=""===e.format?O("Percentage"):e.format,t.formatNumber(Number(e.value),{format:e.format})},e.prototype.accountingFormat=function(e,t,r,n){e.format=""===e.format?O("Accounting"):e.format,e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var i=e.format.split(";");return Number(e.value)>=0?e.format=i[0]:e.format=i[1].split("*").join(" "),e.format=this.getFormatForOtherCurrency(e.format),0===Number(e.value)?r+"- ":t.formatNumber(Number(e.value),{format:e.format,currency:n}).split("-").join("")},e.prototype.getFormatForOtherCurrency=function(e){if(e.indexOf("[$")>-1){var t=e.split("]")[0].split("[$")[1].split("-")[0];e=e.indexOf("0")>e.indexOf("[$")?t+e.slice(e.indexOf("]")+1,e.length):e.slice(0,e.indexOf("[$"))+t}return e},e.prototype.shortDateFormat=function(e,t){var r,n=A(e.value),i=""===e.format||"General"===e.format?O("ShortDate"):e.format.toString();return i===O("ShortDate")?(i="M/d/yy",r={type:"date",skeleton:"yMd"}):r={type:"date",format:i},t.formatDate(n,r)},e.prototype.longDateFormat=function(e,t){var r=A(e.value),n=""===e.format||"General"===e.format?O("LongDate"):e.format.toString();return n===O("LongDate")&&(n="EEEE, MMMM d, y"),t.formatDate(r,{type:"date",format:n})},e.prototype.timeFormat=function(e,r){if(t.isNullOrUndefined(e.value))return"";t.isNullOrUndefined(e.value.toString().split(this.decimalSep)[1])||(e.value=parseFloat("1"+this.decimalSep+e.value.toString().split(this.decimalSep)[1])||e.value);var n=A(e.value),i=""===e.format||"General"===e.format?O("Time"):e.format.toString();return i===O("Time")&&(i="h:mm:ss a"),r.formatDate(n,{type:"time",skeleton:"medium",format:i})},e.prototype.scientificFormat=function(e){e.format=""===e.format?O("Scientific"):e.format;var t=e.format.split("+")[1],r=this.findDecimalPlaces(e.format,"Scientific"),n=Number(e.value).toExponential(r);return n.indexOf("e+")>-1?n=n.split("e+")[0]+"E+"+this.findSuffix(t,n.split("e+")[1]):n.indexOf("e-")>-1&&(n=n.split("e-")[0]+"E-"+ +this.findSuffix(t,n.split("e-")[1])),n},e.prototype.fractionFormat=function(e){e.format=""===e.format?O("Fraction"):e.format;var t,r="";return e.value.toString().indexOf(this.decimalSep)>-1&&L(e.value)?(r=e.value.toString().split(this.decimalSep)[0],t=R(Number(e.value)),0===Number(r)?" "+t:r+" "+t):r},e.prototype.findDecimalPlaces=function(e,t){var r,n;switch(t){case"Scientific":if(r=e.toUpperCase().indexOf("E"),n=e.indexOf(this.decimalSep),r>-1)return e.substring(n+1,r).length}return 2},e.prototype.checkDateFormat=function(e){var r,n=new t.Internationalization,i=t.isNullOrUndefined(e.value)?"":e.value.toString(),a=$(e.rowIndex,e.colIndex,ce(this.parent,t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex)),o=this.checkCustomDateFormat(i);i&&(i.indexOf("/")>-1||i.indexOf("-")>0||i.indexOf(":")>-1)&&"Invalid"!==o&&(((i=o)&&i.indexOf("/")>-1||i.indexOf("-")>0||i.indexOf(":")>-1)&&(r=N(i,n,a&&a.format),t.isNullOrUndefined(r.dateObj)||"Invalid Date"===r.dateObj.toString()||(a=a||{},i=T(r.dateObj,i.indexOf(":")>-1,r.type&&"time"===r.type).toString(),a.format&&""!==a.format||("time"===r.type?a.format=O("Time"):a.format=O("ShortDate")),e.isDate="date"===r.type||"datetime"===r.type,e.isTime="time"===r.type,e.dateObj=r.dateObj)),e.updatedVal=i)},e.prototype.checkCustomDateFormat=function(e){var t=e.indexOf("/")>-1?e.split("/"):e.indexOf("-")>0?e.split("-"):"",r=["jan","feb","mar","apr","may","jun","jul","aug","sep","sept","oct","nov","dec"];return 2===t.length?r.indexOf(t[0].toLowerCase())>-1&&Number(t[1])<=31?"01-"+t[0]+"-"+t[1]:r.indexOf(t[1].toLowerCase())>-1&&Number(t[0])<=31?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[0])<=31&&Number(t[1])<=12?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[1])<=31&&Number(t[0])<=12?t[0]+"-"+t[1]+"-"+(new Date).getFullYear():Number(t[0])<=12&&Number(t[1])<=9999&&Number(t[1])>=1900?"01-"+t[0]+"-"+t[1]:"Invalid":e},e.prototype.formattedBarText=function(e){var r=H(e.cell?e.cell.format:""),n=new t.Internationalization,i=e.value,a="ShortDate"===r&&e.cell&&e.cell.format?e.cell.format:O("ShortDate"),o=O("Time");switch(r){case"ShortDate":case"LongDate":e.value=this.shortDateFormat({type:r,value:e.value,format:a},n);break;case"Time":e.value=this.shortDateFormat({type:r,value:e.value,format:a},n)+" "+this.timeFormat({type:r,value:e.value,format:o},n)}(!e.value||e.value&&e.value.toString().indexOf("null")>-1)&&(e.value=i)},e.prototype.addEventListener=function(){this.parent.on("applyNumber",this.numberFormatting,this),this.parent.on("getFormattedCell",this.getFormattedCell,this),this.parent.on(Rt,this.checkDateFormat,this),this.parent.on("getFormattedBarText",this.formattedBarText,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyNumber",this.numberFormatting),this.parent.off("getFormattedCell",this.getFormattedCell),this.parent.off(Rt,this.checkDateFormat),this.parent.off("getFormattedBarText",this.formattedBarText))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookNumberFormat"},e}(),qt=function(){function e(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(xt,this.updateSheetFromDataSourceHandler,this),this.parent.on("dataSourceChanged",this.dataSourceChangedHandler,this),this.parent.on("dataChanged",this.dataChangedHandler,this),this.parent.on("triggerDataChange",this.triggerDataChangeHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xt,this.updateSheetFromDataSourceHandler),this.parent.off("dataSourceChanged",this.dataSourceChangedHandler),this.parent.off("dataChanged",this.dataChangedHandler))},e.prototype.updateSheetFromDataSourceHandler=function(e){var t,n,i,a,o,s,l,h,d,p,u=this,f=[],g=[],m=new r.Deferred;if(e.promise=m.promise,e.sheet&&e.sheet.ranges.length)for(var v=this,y=e.sheet.ranges.length-1;y>=0;y--)!function(y){var C=e.indexes[0],b=e.indexes[2],S=e.sheet.ranges[y];h=c(S.startCell)[0],s=S.dataSource instanceof r.DataManager?S.dataSource:S.dataSource?new r.DataManager(S.dataSource):new r.DataManager,o=o||s.dataSource.url,e.sheet.isLocalData=!s.dataSource.url,h<=C?C-=h:h<=b?(b-=h,C=0):C=-1,S.showFieldAsHeader&&0!==C&&(C-=1);var x=!1,w=0;v.initRangeInfo(S);var I=v.getMaxCount(S);if(p=v.getLoadedInfo(C,b,S),C=p.unloadedRange[0],b=p.unloadedRange[1],S.info.insertRowRange&&(S.info.insertRowRange.forEach(function(e){w+=e[1]-e[0]+1}),C-=w,b-=w),C>I?x=!0:b>I&&(b=I),v.requestedInfo.push({deferred:m,indexes:e.indexes,isNotLoaded:p.isNotLoaded}),C>=0&&p.isNotLoaded&&!x){g[y]=C,f[y]=!1;var E=(S.query?S.query:new r.Query).clone();s.executeQuery(E.range(C,b>=I?b:b+1).requiresCount()).then(function(r){if(u.parent&&!u.parent.isDestroyed){if(a=r.result&&r.result.result?r.result.result:r.result,i=c(S.startCell),h=i[0],d=i[1],a&&a.length){if(S.info.count||(I=r.count,S.info.count=r.count),n=Object.keys(a[0]),S.info.fldLen||(S.info.fldLen=n.length,S.info.flds=n),S.info.insertColumnRange){var o=0;S.info.insertColumnRange.forEach(function(e){for(var t=e[0];t<=e[1];t++)t<=d?n.splice(0,0,"emptyCell"+o):n.splice(t-d,0,"emptyCell"+o),o++})}0===g[y]&&S.showFieldAsHeader&&(l=h+g[y]+w,n.forEach(function(r,n){(t=$(l,d+n,e.sheet,!0))?t.value||r.includes("emptyCell")||(t.value=r):e.sheet.rows[h+g[y]].cells[d+n]=r.includes("emptyCell")?{}:{value:r}})),a.forEach(function(r,i){l=h+g[y]+i+(S.showFieldAsHeader?1:0)+w;for(var a=0;a<n.length;a++)(t=$(l,d+a,e.sheet,!0))?t.value||n[a].includes("emptyCell")||Z(l,d+a,e.sheet,u.getCellDataFromProp(r[n[a]]),!0):e.sheet.rows[l].cells[d+a]=n[a].includes("emptyCell")?{}:u.getCellDataFromProp(r[n[a]]),u.checkDataForFormat({args:e,cell:t,colIndex:d+a,rowIndex:l,i:i,j:a,k:y,range:S,sRanges:g,value:r[n[a]]})})}else n=[];if(e.sheet.usedRange.rowIndex=Math.max(h+(I||r.count)+(S.showFieldAsHeader?1:0)+w-1,e.sheet.usedRange.rowIndex),e.sheet.usedRange.colIndex=Math.max(d+n.length-1,e.sheet.usedRange.colIndex),w?(p=u.getLoadedInfo(C,b,S),C=p.unloadedRange[0],b=p.unloadedRange[1],C>I&&(p.isNotLoaded=!1),p.isNotLoaded&&(b>I&&(b=I),S.info.loadedRange.push([C,b]))):S.info.loadedRange.push([C,b]),f[y]=!0,-1===f.indexOf(!1)){if(b+h<h+S.info.count){e.rangeSettingCount||(e.rangeSettingCount=[]),e.rangeSettingCount.push(y);var s={sheet:e.sheet,indexes:[0,0,e.sheet.usedRange.rowIndex,e.sheet.usedRange.colIndex],promise:new Promise(function(e,t){e(void 0)}),rangeSettingCount:e.rangeSettingCount};u.updateSheetFromDataSourceHandler(s),s.promise.then(function(){"workbook"!==u.parent.getModuleName()&&(e.rangeSettingCount.pop(),e.rangeSettingCount.length||u.parent.notify("created",null),e.formulaCellRef&&u.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex))})}else e.formulaCellRef&&u.notfyFormulaCellRefresh(e.formulaCellRef,e.sheetIndex);u.checkResolve(e.indexes)}}})}else 0===y&&-1===f.indexOf(!1)&&v.checkResolve(e.indexes)}(y);else m.resolve()},e.prototype.notfyFormulaCellRefresh=function(e,t){this.parent.formulaRefCell=null,this.parent.notify("updateView",{indexes:c(e),sheetIndex:t,refreshing:!0})},e.prototype.checkResolve=function(e){var t,r,n=0;this.requestedInfo.forEach(function(i,a){((r=JSON.stringify(i.indexes)===JSON.stringify(e))||t)&&(0===a?(i.deferred.resolve(),n++,t=!0):!t||!i.isLoaded&&i.isNotLoaded?r&&t?(i.deferred.resolve(),n++):r?i.isLoaded=!0:t=!1:(i.deferred.resolve(),n++))}),this.requestedInfo.splice(0,n)},e.prototype.getCellDataFromProp=function(e){var t={};return"[object Object]"===Object.prototype.toString.call(e)?e.formula?t.formula=e.formula:e.value&&("string"==typeof e.value&&(0===e.value.indexOf("http://")||0===e.value.indexOf("https://")||0===e.value.indexOf("ftp://")||0===e.value.indexOf("www."))?t.hyperlink=e.value:t.value=e.value):q(e)?t.formula=e:"string"==typeof e&&(0===e.indexOf("http://")||0===e.indexOf("https://")||0===e.indexOf("ftp://")||0===e.indexOf("www."))?t.hyperlink=e:t.value=e,t},e.prototype.checkDataForFormat=function(e){if(""!==e.value){var t={value:e.value,rowIndex:e.rowIndex,colIndex:e.colIndex,isDate:!1,updatedVal:e.value,isTime:!1};this.parent.notify(Rt,t),t.isDate?e.cell?(e.cell.format=O("ShortDate"),e.cell.value=t.updatedVal):(e.args.sheet.rows[e.rowIndex].cells[e.colIndex].format=O("ShortDate"),e.args.sheet.rows[e.rowIndex].cells[e.colIndex].value=t.updatedVal):t.isTime&&(e.cell?(e.cell.format=O("Time"),e.cell.value=t.updatedVal):(e.args.sheet.rows[e.rowIndex].cells[e.colIndex].format=O("Time"),e.args.sheet.rows[e.rowIndex].cells[e.colIndex].value=t.updatedVal))}},e.prototype.getLoadedInfo=function(e,t,r){var n=!0;return r.info.loadedRange.forEach(function(r){r[0]<=e&&e<=r[1]?r[0]<=t&&t<=r[1]?n=!1:e=r[1]+1:r[0]<=t&&t<=r[1]&&(t=r[0]-1)}),{isNotLoaded:n,unloadedRange:[e,t]}},e.prototype.getMaxCount=function(e){if(e.query)for(var t=e.query.queries,r=0;r<t.length;r++)if("onTake"===t[r].fn)return Math.min(t[r].e.nos,e.info.count||t[r].e.nos);return e.info.count},e.prototype.initRangeInfo=function(e){e.info||(e.info={loadedRange:[]})},e.prototype.dataSourceChangedHandler=function(e){var t,r=this,n=this.parent.sheets[e.sheetIdx],i=n.ranges[e.rangeIdx];if(i&&(this.checkRangeHasChanges(n,e.rangeIdx)||!i.info)){var a=i.showFieldAsHeader,o=u(i.startCell);i.info&&(i.info.loadedRange.forEach(function(e){for(var r=e[0];r<=e[1]&&r<i.info.count+(a?1:0);r++)if(t=n.rows[r+o[0]])for(var s=o[1];s<o[1]+i.info.fldLen;s++)t.cells&&t.cells[s]&&delete t.cells[s]}),i.info=null);var s=this.parent.viewport,l=[s.topIndex,s.leftIndex,s.bottomIndex,s.rightIndex],h={sheet:n,indexes:l,promise:new Promise(function(e,t){e(void 0)})};this.updateSheetFromDataSourceHandler(h),h.promise.then(function(){r.parent.notify("updateView",{indexes:l})})}},e.prototype.checkRangeHasChanges=function(e,t){if(this.parent.isAngular){return e.changedRangeIdx===parseInt(t,10)&&(delete e.changedRangeIdx,!0)}return!0},e.prototype.dataChangedHandler=function(e){var t,r,n,i,a,o,s,l,h,d=this,p=[{}],f=this.parent.activeSheetIndex,m=this.parent.sheets[f];m.ranges.forEach(function(v,y){if(v.dataSource){var C=void 0;if(i=u(v.startCell),n=i.concat([i[0]+v.info.count+(v.showFieldAsHeader?0:-1),i[1]+v.info.fldLen-1]),"Row"===e.modelType)e.insertType?(a=(v.showFieldAsHeader||"above"!==e.insertType?n[0]<e.index:n[0]<=e.index)&&n[2]>=e.index,l=[e.index],a?(C=!0,v.info.count+=e.model.length):n[2]+1===e.index&&"below"===e.insertType?(C=!0,v.info.count+=e.model.length):n[0]>=e.index&&(v.startCell=g(i[0]+e.model.length,i[1]))):(a=n[0]<=e.startIndex&&n[2]>=e.startIndex,t="delete");else{l=c("paste"===e.requestType?e.pastedRange.split("!")[1]:e.sheetIdx>-1?e.address:(e.address||e.range).split("!")[1]);var b=[v.showFieldAsHeader?n[0]+1:n[0]].concat(n.slice(1,4));a=Y(b,l,!0),"paste"===e.requestType&&e.copiedInfo.isCut&&(h=[].slice.call(e.copiedInfo.range),o=Y(b,h,!0))}if(a||C||o){if("Row"!==e.modelType||e.insertType){t=C?"add":"edit";var S=0;if(o){S=h[2]-h[0]+1;for(x=0;x<S;x++)!function(e){p[e]={},v.info.flds.forEach(function(t,n){r=$(h[0]+e,i[1]+n,m),p[e][t]=r&&r.value||null})}(x)}if(a||C)for(var x=0;x<(C?e.model.length:l[2]-l[0]+1||1);x++)!function(e){p[e+S]={},v.info.flds.forEach(function(t,n){r=$(l[0]+e,i[1]+n,m),p[e+S][t]=r&&r.value||null})}(x)}else e.deletedModel.forEach(function(e,t){p[t]={},v.info.flds.forEach(function(n,a){e.cells?(r=e.cells[i[1]+a],p[t][n]=r&&r.value||null):p[t][n]=null}),v.info.count-=1}),s={count:e.deletedModel.length,index:e.endIndex};d.parent.trigger("dataSourceChanged",{data:p,action:t,rangeIndex:y,sheetIndex:f})}else s&&s.count&&n[0]>s.index&&(v.startCell=g(i[0]-s.count,i[1]))}})},e.prototype.triggerDataChangeHandler=function(e){var t=["insert","delete","edit","cellDelete","cellSave","clipboard","clear"],r=!0;("delete"===e.action||"insert"===e.action)&&["Column","Sheet"].indexOf(e.eventArgs.modelType)>-1?r=!1:"clear"===e.action&&["Clear Formats","Clear Hyperlinks"].indexOf(e.eventArgs.type)>-1?r=!1:"clipboard"===e.action&&"Formats"===e.eventArgs.requestType&&(r=!1),!e.isUndo||"delete"!==e.action&&"insert"!==e.action||("delete"===e.action?(e.eventArgs.index=e.eventArgs.startIndex,e.eventArgs.model=e.eventArgs.deletedModel,e.eventArgs.insertType="below"):(e.eventArgs.startIndex=e.eventArgs.index,e.eventArgs.endIndex=e.eventArgs.index+e.eventArgs.model.length-1,e.eventArgs.deletedModel=e.eventArgs.model,delete e.eventArgs.insertType)),r&&t.indexOf(e.action)>-1&&this.parent.notify("dataChanged",e.eventArgs)},e.prototype.getModuleName=function(){return"dataBind"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]},e}(),jt="initialLoad",Wt="editOperation",Gt="click",Yt="keyUp",Xt="keyDown",Kt="contextmenuBeforeOpen",$t="removeSheetTab",Zt="cut",Jt="paste",Qt="rowHeightChanged",er="hideShow",tr="autoFitRowsColumns",rr="initiateFilterUI",nr="actionComplete",ir="actionBegin",ar="renderGotoDlgt",or="renderFindDlg",sr="replaceHandler",lr="clearViewer",hr="refreshImgCellObj",dr="createImageElement",pr="deleteImage",cr="deleteChart",ur=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.open=function(e){var t=this;if(this.parent.allowOpen){if(e.jsonObject)return void this.fetchSuccess(e.jsonObject,null);var r=new FormData;if(!e.file)return void(this.parent.isOpen=!1);r.append("file",e.file);var n={passWord:""};e.password&&e.password.length&&(n.passWord=e.password),n.passWord&&n.passWord.length&&(e.password=n.passWord),e.password&&r.append("password",e.password);var i={file:e.file||null,cancel:!1,requestData:{method:"POST",body:r},password:n.passWord};this.parent.trigger("beforeOpen",i),this.parent.notify(ir,{eventArgs:i,action:"beforeOpen"}),i.cancel||fetch(this.parent.openUrl,i.requestData).then(function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})}).then(function(e){return t.fetchSuccess(e,i)}).catch(function(e){return t.fetchFailure(e)})}},e.prototype.fetchFailure=function(e){t.isUndefined(e.status)&&t.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify("openFailure",e),this.parent.isOpen=!1},e.prototype.fetchSuccess=function(e,t){var r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword"],n=e,i=(n="string"==typeof e?JSON.parse(e):e).Workbook;if(r.indexOf(i)>-1)return void this.parent.notify("openSuccess",{context:this,data:i,eventArgs:t});this.updateModel(i),this.parent.notify("openSuccess",{context:this,data:i}),this.parent.isOpen=!1,t&&t.password&&t.password.length>0&&(this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.parent.password="")},e.prototype.updateModel=function(e){this.parent.notify(Et,{action:"unRegisterSheet"}),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify("sheetsDestroyed",{}),e.activeSheetIndex=e.activeSheetIndex||0,this.setSelectAllRange(e.sheets),this.parent.setProperties({sheets:e.sheets,activeSheetIndex:e.activeSheetIndex,definedNames:e.definedNames||[],filterCollection:e.filterCollection||[],sortCollection:e.sortCollection||[]},!0),ge(this.parent),this.parent.notify("sheetCreated",null),this.parent.notify(Et,{action:"registerSheet",isImport:!0}),this.parent.notify(Et,{action:"initiateDefinedNames"}),this.parent.notify("protectSheet",null),this.parent.notify("updateFilter",{isOpen:!0})},e.prototype.setSelectAllRange=function(e){e.forEach(function(e){if(e.selectedRange){var r=c(e.selectedRange),n=(t.isUndefined(e.rowCount)?100:e.rowCount)-1,i=(t.isUndefined(e.colCount)?100:e.colCount)-1;65535===r[2]&&(r[2]=n),255===r[3]&&(r[3]=i),65535===r[0]&&(r[0]=n),255===r[1]&&(r[1]=i),e.selectedRange=m(r)}})},e.prototype.addEventListener=function(){this.parent.on("workbookOpen",this.open.bind(this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("workbookOpen",this.open.bind(this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookOpen"},e}(),fr=function(){function e(e){this.parent=e}return e.prototype.processSheet=function(e,t){return[t,JSON.parse(e,function(e,t){if(!Array.isArray(t)&&"string"!=typeof t||t.length)return t})]},e.prototype.processSave=function(e,t,r){var n,i=new FormData,a=Object.keys(t);for(i.append("JSONData",JSON.stringify(e)),n=0;n<a.length;n++)i.append(a[n],t[a[n]]);for(a=Object.keys(r),n=0;n<a.length;n++)i.append(a[n],r[a[n]]);fetch(t.url,{method:"POST",body:i}).then(function(e){return e.ok?e.blob():Promise.reject({message:e.statusText})}).then(function(e){new Promise(function(t){var r=new FileReader;r.onload=function(){var n=r.result.toString();if(n.indexOf("data:text/plain;base64,")>-1||n.indexOf("data:text/html;base64,")>-1||n.indexOf("data:application/json;base64,")>-1){var i=void 0;if(n=n.replace("data:text/plain;base64,",""),n=n.replace("data:text/html;base64,",""),n.indexOf("data:application/json;base64,")>-1?(n=n.replace("data:application/json;base64,",""),i=atob(n).split(".")):i=atob(n).split(/(\r\n|\n|\r)/gm),i.length){var a=i[0].length>1&&'"'===i[0][0]?i[0].split('"')[1]+".":i[0];postMessage({dialog:a})}}else postMessage(e);t(r.result)},r.readAsDataURL(e)})}).catch(function(e){postMessage({error:e.message})})},e}(),gr=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mr=function(e){function r(t){var r=e.call(this,t)||this;return r.isProcessCompleted=!1,r.saveJSON={},r.isFullPost=!1,r.needBlobData=!1,r.customParams=null,r.addEventListener(),r}return gr(r,e),r.prototype.getModuleName=function(){return"workbookSave"},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on("beginSave",this.initiateSave,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("beginSave",this.initiateSave)},r.prototype.initiateSave=function(e){var t=e.saveSettings;this.parent.notify("getFilteredCollection",null),this.saveSettings={saveType:t.saveType,url:t.url,fileName:t.fileName||"Sample"},this.isFullPost=e.isFullPost,this.needBlobData=e.needBlobData,this.needBlobData&&(this.isFullPost=!1),this.customParams=e.customParams,this.updateBasicSettings(),this.processSheets()},r.prototype.updateBasicSettings=function(){var e=this.getStringifyObject(this.parent,["sheets","_isScalar","observers","closed","isStopped","hasError","__isAsync","beforeCellFormat","beforeCellRender","beforeDataBound","beforeOpen","beforeSave","beforeSelect","beforeSort","cellEdit","cellEditing","cellSave","beforeCellSave","contextMenuItemSelect","contextMenuBeforeClose","contextMenuBeforeOpen","created","dataBound","fileMenuItemSelect","fileMenuBeforeClose","fileMenuBeforeOpen","saveComplete","sortComplete","select","actionBegin","actionComplete","afterHyperlinkClick","afterHyperlinkCreate","beforeHyperlinkClick","beforeHyperlinkCreate","openComplete","openFailure","queryCellInfo","dialogBeforeOpen","dataSourceChanged"]),t=JSON.parse(e);this.parent.sheets.length&&(t.sheets=[]),this.saveJSON=t},r.prototype.processSheets=function(){for(var e=0,t=this.parent.sheets.length,r=["dataSource","startCell","query","showFieldAsHeader"];e<t;)E(this,this.processSheet,this.updateSheet,[this.getStringifyObject(this.parent.sheets[e],r),e]),e++},r.prototype.updateSheet=function(e){this.saveJSON.sheets[e[0]]=e[1],this.isProcessCompleted=this.getSheetLength(this.saveJSON.sheets)===this.parent.sheets.length,this.isProcessCompleted&&this.save(this.saveSettings)},r.prototype.getSheetLength=function(e){var t=0;return e.forEach(function(e){e&&t++}),t},r.prototype.save=function(e){var t={cancel:!1,jsonObject:this.saveJSON};this.parent.notify("onSave",t),t.cancel||(this.isFullPost?this.initiateFullPostSave():E(this,{workerTask:this.processSave},this.updateSaveResult,[this.saveJSON,e,this.customParams],!0)),this.saveJSON={}},r.prototype.updateSaveResult=function(e){var t={status:"Success",message:"",url:this.saveSettings.url,fileName:this.saveSettings.fileName,saveType:this.saveSettings.saveType,blobData:null};"object"==typeof e&&e.error?(t.status="Failure",t.message=e.error.toString()):"object"==typeof e&&e.dialog?this.parent.notify("saveError",{content:e.dialog}):this.needBlobData?t.blobData=e:this.ClientFileDownload(e),this.parent.trigger("saveComplete",t),this.parent.notify("saveCompleted",t)},r.prototype.ClientFileDownload=function(e){var t=this.parent.createElement("a",{attrs:{download:this.getFileNameWithExtension()}}),r=URL.createObjectURL(e);t.href=r,document.body.appendChild(t),t.click(),URL.revokeObjectURL(r),document.body.removeChild(t)},r.prototype.initiateFullPostSave=function(){var e,r=Object.keys(this.saveSettings),n=this.parent.createElement("form",{attrs:{method:"POST",action:this.saveSettings.url}}),i=this.parent.createElement("input",{attrs:{type:"hidden",name:"JSONData"}});for(i.value=JSON.stringify(this.saveJSON),n.appendChild(i),e=0;e<r.length;e++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[e]}})).value=this.saveSettings[r[e]],n.appendChild(i);for(r=Object.keys(this.customParams),e=0;e<r.length;e++)(i=this.parent.createElement("input",{attrs:{type:"hidden",name:r[e]}})).value=this.customParams[r[e]],n.appendChild(i);document.body.appendChild(n),n.submit(),t.detach(n),this.parent.notify("saveCompleted",{})},r.prototype.getStringifyObject=function(e,t){return void 0===t&&(t=[]),JSON.stringify(e,function(e,r){return t.indexOf(e)>-1?void 0:r&&"object"==typeof r&&r.hasOwnProperty("properties")?r.properties:null!==r?r:void 0})},r.prototype.getFileNameWithExtension=function(e){e||(e=this.saveSettings.fileName);var t=this.getFileExtension(),r=e.lastIndexOf(".");return r>-1&&(e=e.substr(0,r)),e+t},r.prototype.getFileExtension=function(){return"."+this.saveSettings.saveType.toLowerCase()},r}(fr),vr=function(){function e(e){this.parent=e}return e.prototype.getModuleName=function(){return"calc-common"},e}(),yr=function(){function e(e){this.loadedModules=[],this.parent=e}return e.prototype.inject=function(e,t){var r=e.length;if(0===r)return void this.clean();this.loadedModules.length&&this.clearUnusedModule(e);for(var n=0;n<r;n++)for(var i=e[n],a=0,o=t;a<o.length;a++){var s=o[a],l=i.member;if(s.prototype.getModuleName()===i.member&&!this.isModuleLoaded(l)){var h=this.createInstance(s,i.args),d=this.getMemberName(l);i.isProperty?U(d,s,this.parent):U(d,h,this.parent);var p=i;p.member=d,this.loadedModules.push(p)}}},e.prototype.createInstance=function(e,t){var r=t;return r.unshift(void 0),new(Function.prototype.bind.apply(e,r))},e.prototype.clean=function(){for(var e=0,t=this.loadedModules;e<t.length;e++){var r=t[e];r.isProperty||_(r.member,this.parent).destroy()}this.loadedModules=[]},e.prototype.clearUnusedModule=function(e){for(var t=this,r=e.map(function(e){return t.getMemberName(e.member)}),n=0,i=this.loadedModules.filter(function(e){return-1===r.indexOf(e.member)});n<i.length;n++){var a=i[n];a.isProperty||_(a.member,this.parent).destroy(),this.loadedModules.splice(this.loadedModules.indexOf(a),1),this.deleteObject(this.parent,a.member)}},e.prototype.getMemberName=function(e){return e[0].toLowerCase()+e.substring(1)+"Module"},e.prototype.deleteObject=function(e,t){delete e[t]},e.prototype.isModuleLoaded=function(e){for(var t=0,r=this.loadedModules;t<r.length;t++)if(r[t].member===this.getMemberName(e))return!0;return!1},e}();!function(e){e[e.na=0]="na",e[e.value=1]="value",e[e.ref=2]="ref",e[e.divzero=3]="divzero",e[e.num=4]="num",e[e.name=5]="name",e[e.null=6]="null"}(e.CommonErrors||(e.CommonErrors={})),function(e){e[e.operators_cannot_start_with_expression=0]="operators_cannot_start_with_expression",e[e.reservedWord_And=1]="reservedWord_And",e[e.reservedWord_Xor=2]="reservedWord_Xor",e[e.reservedWord_If=3]="reservedWord_If",e[e.number_contains_2_decimal_points=4]="number_contains_2_decimal_points",e[e.reservedWord_Else=5]="reservedWord_Else",e[e.reservedWord_Not=6]="reservedWord_Not",e[e.invalid_char_in_number=7]="invalid_char_in_number",e[e.invalid_characters_following_with_operator=6]="invalid_characters_following_with_operator",e[e.mismatched_parentheses=8]="mismatched_parentheses",e[e.unknown_formula_name=9]="unknown_formula_name",e[e.requires_a_single_argument=10]="requires_a_single_argument",e[e.requires_3_args=11]="requires_3_args",e[e.invalid_Math_argument=12]="invalid_Math_argument",e[e.requires_2_args=13]="requires_2_args",e[e.bad_index=14]="bad_index",e[e.too_complex=15]="too_complex",e[e.circular_reference=16]="circular_reference",e[e.missing_formula=17]="missing_formula",e[e.improper_formula=18]="improper_formula",e[e.invalid_expression=19]="invalid_expression",e[e.cell_empty=20]="cell_empty",e[e.bad_formula=21]="bad_formula",e[e.empty_expression=22]="empty_expression",e[e.virtual_mode_required=23]="virtual_mode_required",e[e.mismatched_tics=24]="mismatched_tics",e[e.wrong_number_arguments=25]="wrong_number_arguments",e[e.invalid_arguments=26]="invalid_arguments",e[e.iterations_do_not_converge=27]="iterations_do_not_converge",e[e.calculation_overflow=29]="calculation_overflow",e[e.already_registered=28]="already_registered",e[e.missing_sheet=30]="missing_sheet",e[e.cannot_parse=31]="cannot_parse",e[e.expression_cannot_end_with_an_operator=32]="expression_cannot_end_with_an_operator"}(e.FormulasErrorsStrings||(e.FormulasErrorsStrings={}));var Cr=function(){function n(e){this.formulas=[{formulaName:"SUM",category:"Math & Trig",description:"Sums individual values, cell references or ranges."},{formulaName:"SUMIFS",category:"Math & Trig",description:"Sums the cells specified by a given set of conditionsor criteria."},{formulaName:"SUMPRODUCT",category:"Math & Trig",description:"Returns sum of the product of given ranges of arrays."},{formulaName:"ABS",category:"Math & Trig",description:"Returns the absolute value of a number."},{formulaName:"RAND",category:"Math & Trig",description:"Return a random number between 0 and 1."},{formulaName:"FLOOR",category:"Math & Trig",description:"Returns the round a number down to the nearest integer."},{formulaName:"CEILING",category:"Math & Trig",description:"Returns a number rounded up to a multiple of another number."},{formulaName:"SUMIF",category:"Math & Trig",description:"It will sum up cells that meet the given criteria."},{formulaName:"PRODUCT",category:"Math & Trig",description:"Multiplies all the numbers given as arguments and returns the product."},{formulaName:"AVERAGE",category:"Statistical",description:"The sum of the numbers divided by how many numbers are being averaged."},{formulaName:"AVERAGEIF",category:"Statistical",description:"Computes the average of the numbers in a range that meet the supplied criteria."},{formulaName:"COUNT",category:"Statistical",description:"Counts the numbers in the list of arguments, exclude text entries."},{formulaName:"COUNTA",category:"Statistical",description:"Counts the non-empty values in the list of arguments."},{formulaName:"COUNTIF",category:"Statistical",description:"Counts the number of cells in a range that meet a specified condition."},{formulaName:"COUNTIFS",category:"Statistical",description:"Counts the number of times each cells in all the ranges that meet the specific conditions."},{formulaName:"AVERAGEA",category:"Statistical",description:"Calculates the average of values in the list of arguments.Arguments can be numbers, names, arrays or references."},{formulaName:"AVERAGEIFS",category:"Statistical",description:"Conditionally returns the average of the contents of cells for the set of ranges."},{formulaName:"MIN",category:"Statistical",description:"Returns the smaller number in set of arguments."},{formulaName:"MAX",category:"Statistical",description:"Returns the largest number in set of arguments."},{formulaName:"DATE",category:"Date",description:"Returns the date, given the year, month and day of the month."},{formulaName:"DAY",category:"Date",description:"Returns the day of a given date."},{formulaName:"TODAY",category:"Date",description:"Returns the current date as date value."},{formulaName:"DAYS",category:"Date",description:"Returns the number of days between two dates."},{formulaName:"IF",category:"Logical",description:"Returns one value if a logical expression is TRUE and another if it is FALSE"},{formulaName:"AND",category:"Logical",description:"Returns TRUE if all the arguments are considered TRUE, and FALSE otherwise."},{formulaName:"IFS",category:"Logical",description:"Checks multiple conditions and returns a value corresponding to the first TRUE result."},{formulaName:"IFERROR",category:"Logical",description:"Returns a value you specify if a formula evaluates to an error; otherwise, it returns the result of the formula."},{formulaName:"CHOOSE",category:"Lookup & Reference",description:"Returns a value from a list, given an index number."},{formulaName:"INDEX",category:"Lookup & Reference",description:"Returns a value from a table, given a row and column number."},{formulaName:"FIND",category:"Text",description:"Returns the position of a string of text within another string."},{formulaName:"CONCATENATE",category:"Text",description:" Used to join two or more strings together."},{formulaName:"CONCAT",category:"Text",description:"Concatenates a list or range of text strings."},{formulaName:"SUBTOTAL",category:"Lookup & Reference",description:"Returns a subtotal in a list or database."},{formulaName:"RADIANS",category:"Math & Trig",description:"Converts degrees to radians."},{formulaName:"OR",category:"Logical",description:"Returns TRUE if any arguments considered TRUE, and all the arguments are FALSE it will return FALSE."},{formulaName:"MATCH",category:"Lookup & Reference",description:"Returns the relative position of an checked item in range that matches a specified value in a specified order"},{formulaName:"RANDBETWEEN",category:"Math & Trig",description:"Returns an integer random number in a specified range."},{formulaName:"SLOPE",category:"Statistical",description:"Returns the slope of the line from linear regression of the data points."},{formulaName:"INTERCEPT",category:"Statistical",description:"Calculates the point of the Y-intercept line via linear regression."},{formulaName:"ROUNDUP",category:"Math & Trig",description:"Rounds a number away from zero."},{formulaName:"INT",category:"Math & Trig",description:"Returns a number to the nearest integer."},{formulaName:"LN",category:"Math & Trig",description:"Returns the natural logarithm of a number."},{formulaName:"ISNUMBER",category:"Information",description:"Returns TRUE, if the argument is number and FALSE otherwise."},{formulaName:"ROUND",category:"Math & Trig",description:"Rounds a number to a specified number of digits."},{formulaName:"LOG",category:"Math & Trig",description:"Returns the logarithm of a number to the base that you specify."},{formulaName:"POWER",category:"Math & Trig",description:"Returns the result of a number raised to power."},{formulaName:"TRUNC",category:"Math & Trig",description:"Returns the truncated value of a number to a specified number of decimal places."},{formulaName:"EXP",category:"Math & Trig",description:"Returns e raised to the power of the given number."},{formulaName:"GEOMEAN",category:"Statistical",description:"Returns the geometric mean of an array or range of positive data."},{formulaName:"TEXT",category:"Lookup & Reference",description:"Converts a value to text in specified number format."},{formulaName:"SORT",category:"Lookup & Reference",description:"Sorts a range of an array."}],this.isConcat=!1,this.parent=e,this.init()}return n.prototype.init=function(){for(var e,r=0;r<this.formulas.length;r++)e=t.getValue("Compute"+this.formulas[r].formulaName,this).bind(this),this.addFormulaCollection(this.formulas[r].formulaName.toUpperCase(),e,this.formulas[r].category,this.formulas[r].description)},n.prototype.addFormulaCollection=function(e,t,r,n){this.parent.libraryFormulas={fName:e,handler:t,category:r,description:n}},n.prototype.ComputeSUM=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a,o=0;if(!t.isNullOrUndefined(r))for(var s=r,l=0;l<s.length;l++){var h=s[l].toString();if(h.indexOf(":")>-1&&this.parent.isCellReference(h))for(var d=this.parent.getCellCollection(h.split(this.parent.tic).join("")),p=0;p<d.length;p++){if(i=this.parent.getValueFromArg(d[p]),this.parent.getErrorStrings().indexOf(i)>-1)return i;t.isNullOrUndefined(i[0])||isNaN(this.parent.parseFloat(i))||(o+=this.parent.parseFloat(i))}else{if(s[l].split(this.parent.tic).join("")===this.parent.trueValue&&(s[l]="1"),s[l].split(this.parent.tic).join("")===this.parent.falseValue&&(s[l]="0"),a=this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(t.isNullOrUndefined(a)||isNaN(this.parent.parseFloat(a)))continue;a.length>0&&(o+=this.parent.parseFloat(a+""))}}return o},n.prototype.ComputeINT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o;return(!t.isNullOrUndefined(r)&&1!==r.length||""===r[0])&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),""!==r[0]&&1===r.length&&(o=(i=r[0]).indexOf('"'),i=(i=i.indexOf('"')>-1?i.replace('"',""):i).indexOf('"')>-1?i.replace('"',""):i,i="TRUE"===(i=this.parent.getValueFromArg(i)).toUpperCase()?"1":"FALSE"===i?"0":i,a=this.parent.parseFloat(i),a=Math.floor(a)),isNaN(a)&&(i=o>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]),a||i},n.prototype.ComputeTODAY=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n;if(t&&""!==t[0])n=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];else{var i=new Date(Date.now());n=i.getFullYear()+"/"+this.parent.calculateDate((i.getMonth()+1).toString())+"/"+this.parent.calculateDate(i.getDate().toString())}return n},n.prototype.ComputeSUMPRODUCT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var n,i=0,a=0,o=null,s=t,l=0;l<s.length;++l){var h=s[l];if(h.startsWith(this.parent.tic)||!this.parent.isCellReference(h)){var d=this.parent.getValueFromArg(h);return n=d.indexOf('"'),this.parent.getErrorStrings().indexOf(d)>-1?d:n>-1?0:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]}var p=h.indexOf(":"),c=this.parent.rowIndex(h.substr(0,p)),u=this.parent.rowIndex(h.substr(p+1));if(!(-1!==c||-1===u)==(-1===c||-1!==u))return this.parent.getErrorStrings()[e.CommonErrors.name];var f=this.parent.colIndex(h.substr(0,p)),g=this.parent.colIndex(h.substr(p+1));if(null===o)for(a=(u-c+1)*(g-f+1),o=[],p=0;p<a;++p)o[p]=1;p=0;for(var m=c;m<=u;++m)for(var v=f;v<=g;++v){var y=this.getSheetReference(h)+this.parent.convertAlpha(v)+m,C=this.parent.getValueFromArg(y);if(isNaN(parseFloat(C)))o[p]=0;else{if(isNaN(o[p]))return this.parent.getErrorStrings()[e.CommonErrors.name];o[p]=o[p]*parseFloat(C)}p++}}for(p=0;p<a;++p)i+=o[p];return i},n.prototype.ComputeROUNDUP=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a,o,s,l,h=r.length;if(!t.isNullOrUndefined(r)&&h>2&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),1===h&&""!==r[0])l=r[0].indexOf('"'),o="TRUE"===(o=(o=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?o.replace('"',""):o).toUpperCase()?"1":"FALSE"===o?"0":o,o=this.parent.getValueFromArg(o),(a=this.parent.parseFloat(o))>0?a+=.4999999999:a<0&&(a-=.4999999999),i=(a=this.parent.parseFloat(a.toFixed(0))).toString();else if(2===h&&""!==r[0]&&""!==r[1]){l=r[0].indexOf('"')>-1?r[0].indexOf('"'):r[1].indexOf('"')>-1?r[1].indexOf('"'):-1,o=(o=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?o.replace('"',""):o,s=(s=r[1].indexOf('"')>-1?r[1].replace('"',""):r[1]).indexOf('"')>-1?s.replace('"',""):s,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,s="TRUE"===s.toUpperCase()?"1":"FALSE"===s?"0":s,o=this.parent.getValueFromArg(o),s=this.parent.getValueFromArg(s);var d=Math.ceil(this.parent.parseFloat(s));a=this.parent.parseFloat(o),d>0?(a>0?a+=.4999999999/Math.pow(10,d):a<0&&(a-=.4999999999/Math.pow(10,d)),i=(a=this.parent.parseFloat(a.toFixed(d))).toFixed(d),isNaN(a)&&(i=d.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name])):(a>0?a=a/Math.pow(10,-d)+.49999:a<0&&(a=a/Math.pow(10,-d)-.49999),i=(a=this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-d)).toString(),isNaN(a)&&(i=d.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:i=this.parent.getErrorStrings()[e.CommonErrors.name]))}else i=l>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];return i},n.prototype.ComputeCOUNT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var i,a,o,s=r,l=0,h=0;h<s.length;h++)if((i=s[h]).indexOf(":")>-1&&this.parent.isCellReference(i)){a=this.parent.getCellCollection(i.split(this.parent.tic).join(""));for(var d=0;d<a.length;d++)o=this.parent.getValueFromArg(a[d]),isNaN(this.parent.parseFloat(o))||i.length>0&&""!==i&&" "!==i&&l++}else i=i.split(this.parent.tic).join(""),isNaN(this.parent.parseFloat(this.parent.getValueFromArg(i)))||i.length>0&&""!==i&&" "!==i&&l++;return l},n.prototype.ComputeDATE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=r;if(3!==i.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a=0;a<i.length;++a)i[a]=this.parent.getValueFromArg(i[a]);i[0]="TRUE"===i[0].split(this.parent.tic).join("")?"1":"FALSE"===i[0].split(this.parent.tic).join("")?"0":i[0],i[1]="TRUE"===i[1].split(this.parent.tic).join("")?"1":"FALSE"===i[1].split(this.parent.tic).join("")?"0":i[1],i[2]="TRUE"===i[2].split(this.parent.tic).join("")?"1":"FALSE"===i[2].split(this.parent.tic).join("")?"0":i[2];var o=this.parent.parseFloat(i[0].split(this.parent.tic).join("")),s=this.parent.parseFloat(i[1].split(this.parent.tic).join("")),l=this.parent.parseFloat(i[2].split(this.parent.tic).join("")),h=0;if(isNaN(o)||isNaN(s)||isNaN(l))return this.parent.getErrorStrings()[e.CommonErrors.value].toString();if(o<0)return this.parent.getErrorStrings()[e.CommonErrors.num].toString();for(;s>12;)s-=12,o++;if(0===(h=this.parent.getSerialDateFromDate(o,s,l)))return this.parent.getErrorStrings()[e.CommonErrors.num].toString();var d=this.parent.fromOADate(h);return"Invalid Date"!==d.toString()?d.getFullYear()+"/"+this.parent.calculateDate((d.getMonth()+1).toString())+"/"+this.parent.calculateDate(d.getDate().toString()):h.toString()},n.prototype.ComputeFLOOR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a,o=r,s=o.length,l=o[1].split(this.parent.tic).join(""),h=[];if(2!==s)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(h.push(i=this.parent.parseFloat(this.parent.getValueFromArg(o[0].split(this.parent.tic).join("")))),o[1]=l===this.parent.trueValue?"1":l===this.parent.falseValue?"0":o[1],h.push(a=this.parent.parseFloat(this.parent.getValueFromArg(o[1].split(this.parent.tic).join("")))),i>0&&a<0)return this.parent.getErrorStrings()[e.CommonErrors.num];if(i>0&&0===a)return this.parent.getErrorStrings()[e.CommonErrors.divzero];for(var d=0;d<o.length;d++)if(o[d].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:Math.floor(i/a)*a},n.prototype.ComputeCEILING=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a,o=r,s=[],l=o.length,h=o[1].split(this.parent.tic).join("");if(2!==l)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(s.push(i=this.parent.parseFloat(this.parent.getValueFromArg(o[0].split(this.parent.tic).join("")))),o[1]=h===this.parent.trueValue?"1":h===this.parent.falseValue?"0":o[1],s.push(a=this.parent.parseFloat(this.parent.getValueFromArg(o[1].split(this.parent.tic).join("")))),i>0&&a<0)return this.parent.getErrorStrings()[e.CommonErrors.num];for(var d=0;d<o.length;d++)if(o[d].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:0===a?0:Math.ceil(i/a)*a},n.prototype.ComputeDAY=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i,a=r;if(t.isNullOrUndefined(a)||1===a.length&&""===a[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(a.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=this.parent.getValueFromArg(a[0].split(this.parent.tic).join(""));return isNaN(this.parent.parseFloat(o))?(i=this.parent.parseDate(o),"[object Date]"===Object.prototype.toString.call(i)&&(i=i.getDate()),i):this.parent.getErrorStrings()[e.CommonErrors.name]},n.prototype.ComputeIF=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(this.parent.getErrorStrings().indexOf(r[0])>0)return r[0];var i,a,o=r;if(o.length>3||1===o.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(o.length<=3){if(i=this.parent.getValueFromArg(o[0]),this.parent.getErrorStrings().indexOf(i)>-1)return i;if(i===this.parent.trueValue||this.parent.parseFloat(i)>0||this.parent.parseFloat(i)<0)a=this.parent.getValueFromArg(o[1]);else{if(i!==this.parent.falseValue&&0!==this.parent.parseFloat(i))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.requires_3_args];if(t.isNullOrUndefined(o[2]))return this.parent.falseValue;a=this.parent.getValueFromArg(o[2])}}return a.indexOf(this.parent.tic)>-1?a.split(this.parent.tic).join(""):a},n.prototype.ComputeIFERROR=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a=r;return 2!==a.length?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:(i=this.parent.getValueFromArg(a[0]))===this.parent.trueValue||i===this.parent.falseValue?i:(i[0]===this.parent.arithMarker&&(i=i.replace(this.parent.arithMarker," ")),i=this.parent.getValueFromArg(i).toUpperCase().split(this.parent.tic).join(""),"#"===i[0]||i.indexOf("Infinity")>-1||this.parent.getErrorStrings().indexOf(i)>-1?this.parent.getValueFromArg(a[1]).split(this.parent.tic).join(""):i)},n.prototype.ComputePRODUCT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];var i,a,o,s=1,l=!0;if(!t.isNullOrUndefined(r))for(var h=r,d=0;d<h.length;d++){var p=h[d];if(p.indexOf(":")>-1&&this.parent.isCellReference(p))for(var c=this.parent.getCellCollection(p),u=0;u<c.length;u++){if(i=this.parent.getValueFromArg(c[u].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(i)>-1)return i;i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i,o=this.parent.parseFloat(i),isNaN(o)||i.length>0&&(s*=o,l=!1)}else{if(a=this.parent.getValueFromArg(h[d].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(a="TRUE"===a.split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,o=this.parent.parseFloat(a),isNaN(o)||a.length>0&&(s*=o,l=!1),this.parent.getErrorStrings().indexOf(a)>-1)return a}}return l?"0":s.toString()},n.prototype.ComputeDAYS=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i;if(t.isNullOrUndefined(r)&&1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(2!==r.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=r;a[0].split(this.parent.tic).join("")===this.parent.trueValue&&(a[0]="1"),a[0].split(this.parent.tic).join("")===this.parent.falseValue&&(a[0]="0");var o=this.parent.getValueFromArg(a[0].split(this.parent.tic).join("")),s=this.parent.getValueFromArg(a[1].split(this.parent.tic).join(""));if(s=""===s||null==s?new Date(Date.parse("1899-12-31")).toDateString():s,"#"===(o=""===o||null==o?new Date(Date.parse("1899-12-31")).toDateString():o)[0])return o;if("#"===s[0])return s;var l=this.parent.intToDate(o),h=this.parent.intToDate(s);return"#"===l.toString()[0]?l.toString():"#"===h.toString()[0]?h.toString():"[object Date]"!==Object.prototype.toString.call(l)||"[object Date]"!==Object.prototype.toString.call(h)?this.parent.getErrorStrings()[e.CommonErrors.value]:(i=Math.ceil(l.getTime()-h.getTime())/864e5,Math.round(i))},n.prototype.ComputeCHOOSE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];if(r.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=r;if(i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){if(1!==(l=this.parent.getCellCollection(i[0])).length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}var a=this.parent.getValueFromArg(i[0]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.parseFloat(this.parent.getValueFromArg(i[0].split(this.parent.tic).join("")));if(o<1)return this.parent.getErrorStrings()[e.CommonErrors.value];o=Math.floor(o);var s;if(t.isNullOrUndefined(i[o]))return this.parent.getErrorStrings()[e.CommonErrors.value];if(""===(s=i[o])&&(s="0"),s.indexOf(":")>-1&&this.parent.isCellReference(s)){var l=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));if(1!==l.length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}return this.parent.getValueFromArg(s).split(this.parent.tic).join("")},n.prototype.ComputeSUMIF=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(n[0].indexOf(":")<0&&!this.parent.isCellReference(n[0])||n[2]&&n[2].indexOf(":")<0&&!this.parent.isCellReference(n[2]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(n.length>3||n.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.computeSumIfAndAvgIf(t);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:i[0]},n.prototype.ComputeABS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t,a="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(""===i[0].toString().split(this.parent.tic).join("").trim()||i[0].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];if(this.parent.isCellReference(i[0])){if(""===(a=this.parent.getValueFromArg(i[0])))return this.parent.getErrorStrings()[e.CommonErrors.name];if(n=this.parent.parseFloat(a),isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else if(n=this.parent.parseFloat(i[0]),isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.name];return Math.abs(n)},n.prototype.ComputeAVERAGE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var i=r,a=0;a<i.length;a++)if(i[a].indexOf(":")>-1&&i[a].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return this.parent.calculateAvg(i)},n.prototype.ComputeAVERAGEIF=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(n[0].indexOf(":")<0&&!this.parent.isCellReference(n[0]))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];var i=this.parent.computeSumIfAndAvgIf(t);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:this.parent.parseFloat(i[0])/this.parent.parseFloat(i[1])},n.prototype.ComputeCONCATENATE=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];for(var i=r,a="",o="",s=0;s<i.length;s++){if(i[s].indexOf(":")>-1&&this.parent.isCellReference(i[s])){if(!this.isConcat)return this.parent.getErrorStrings()[e.CommonErrors.value];for(var l=this.parent.getCellCollection(i[s]),h=0;h<l.length;h++)a+=o=this.parent.getValueFromArg(l[h])}else{if(1===i.length&&i[0].indexOf(this.parent.tic)<0)return this.parent.getErrorStrings()[e.CommonErrors.name];a+=o=this.parent.getValueFromArg(i[s])}if(this.parent.getErrorStrings().indexOf(o)>-1)return o}return a.split(this.parent.tic).join("")},n.prototype.ComputeCONCAT=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.isConcat=!0,this.ComputeCONCATENATE.apply(this,e)},n.prototype.ComputeMAX=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"max")},n.prototype.ComputeMIN=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeMinMax(e,"min")},n.prototype.ComputeRAND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 1===t.length&&""===t[0]&&(t.length=0),t.length>0?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:Math.random().toString()},n.prototype.ComputeAND=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeAndOr(e,"and")},n.prototype.ComputeOR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeAndOr(e,"or")},n.prototype.ComputeFIND=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=r;if(i.length>3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=this.parent.removeTics(this.parent.getValueFromArg(i[0])),o=this.parent.removeTics(this.parent.getValueFromArg(i[1]));if(this.parent.getErrorStrings().indexOf(a)>-1||this.parent.getErrorStrings().indexOf(o)>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];var s=1;if(3===i.length){if(s=this.parent.removeTics(this.parent.getValueFromArg(i[2])),this.parent.getErrorStrings().indexOf(s)>-1)return s;s=this.parent.parseFloat(s),isNaN(s)&&(s=1)}if(s<=0||s>o.length)return this.parent.getErrorStrings()[e.CommonErrors.value];var l=o.indexOf(a,s-1);return l<0?this.parent.getErrorStrings()[e.CommonErrors.value]:(Number(l)+Number(1)).toString()},n.prototype.ComputeINDEX=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r,a=i.length;if(t.isNullOrUndefined(r)||1===i.length&&""===i[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(a>3)return this.parent.getErrorStrings()[e.CommonErrors.ref];var o="",s=[];if(a>2)for(var l=0;l<a;l++){if(this.parent.isCellReference(i[l])&&i[l].indexOf(":")<0)return this.parent.getErrorStrings()[e.CommonErrors.ref];this.parent.isCellReference(i[l])&&(s[l]=i[l])}if(o=i[0],i[1]=""===i[1]?"1":i[1],i[1]=this.parent.getValueFromArg(i[1]),this.parent.getErrorStrings().indexOf(i[1])>-1)return i[1];if(!t.isNullOrUndefined(i[2])){if(i[2]=""===i[2]?"1":i[2],i[2]=this.parent.getValueFromArg(i[2]),this.parent.getErrorStrings().indexOf(i[2])>-1)return i[2];if("0"===i[2])return this.parent.getErrorStrings()[e.CommonErrors.value]}var h=parseFloat(i[1]);h=isNaN(h)?-1:h;var d=parseFloat(i[2]?i[2]:"1");if(d=isNaN(d)?-1:d,-1===h||-1===d)return this.parent.getErrorStrings()[e.CommonErrors.value];var p=i[0].indexOf(":"),c=this.parent.rowIndex(o.substring(0,p)),u=this.parent.rowIndex(o.substring(p+1)),f=this.parent.colIndex(o.substring(0,p)),g=this.parent.colIndex(o.substring(p+1));if(h>u-c+1||d>g-f+1)return this.parent.getErrorStrings()[e.CommonErrors.ref];h=c+h-1,d=f+d-1;var m=this.getSheetReference(o)+this.parent.convertAlpha(d)+h,v=this.parent.getValueFromArg(m);return""===v?0:v},n.prototype.getSheetReference=function(e){return 0===e.indexOf(this.parent.sheetToken)&&e.lastIndexOf(this.parent.sheetToken)>e.indexOf(this.parent.sheetToken)?e.substring(0,e.lastIndexOf(this.parent.sheetToken)+1):""},n.prototype.ComputeIFS=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(r)||1===i.length&&""===i[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var a="",o="",s=0;s<i.length;s++){if((a=this.parent.getValueFromArg(i[s]))!==this.parent.trueValue&&a!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];if(a===this.parent.trueValue)return i[s+1].indexOf(this.parent.arithMarker)>-1?this.parent.trueValue:(o=this.parent.isCellReference(i[s+1].split(this.parent.tic).join(""))?this.parent.getValueFromArg(i[s+1]):i[s+1].indexOf(this.parent.tic)>-1?i[s+1].split(this.parent.tic).join(""):this.parent.getErrorStrings()[e.CommonErrors.name],s+=1,o);a===this.parent.falseValue&&(s+=1)}return this.parent.getErrorStrings()[e.CommonErrors.na]},n.prototype.ComputeCOUNTA=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var i,a=r,o=0,s=0;s<a.length;s++)if(a[s].indexOf(":")>-1&&this.parent.isCellReference(a[s])){i=this.parent.getCellCollection(a[s].split(this.parent.tic).join(""));for(var l=0;l<i.length;l++)this.parent.getValueFromArg(i[l]).length>0&&o++}else this.parent.getValueFromArg(a[s].split(this.parent.tic).join("")).length>0&&o++;return o},n.prototype.ComputeAVERAGEA=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];if(t.isNullOrUndefined(r)||1===r.length&&""===r[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var i,a,o,s=r,l=0,h=0,d=0;d<s.length;d++){if(s[d].indexOf(":")>-1&&this.parent.isCellReference(s[d])){i=this.parent.getCellCollection(s[d].split(this.parent.tic).join(""));for(var p=0;p<i.length;p++)if((a=this.parent.getValueFromArg(i[p])).toUpperCase()===this.parent.trueValue)a="1";else if(a.toUpperCase()===this.parent.falseValue||""===a)a="0";else{if(this.parent.getErrorStrings().indexOf(a)>-1)return a;a.length>0&&(o=parseFloat(a),l+=a=isNaN(o)?0:o,h+=1)}h=i.length}else{if(s[d]===this.parent.trueValue&&(s[d]="1"),s[d]!==this.parent.falseValue&&""!==s[d]||(s[d]="0"),a=this.parent.getValueFromArg(s[d].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;a.length>0&&(o=parseFloat(a),l+=a=isNaN(o)?0:o,h+=1)}if(0===h)return this.parent.getErrorStrings()[e.CommonErrors.divzero]}return l/h},n.prototype.ComputeSORT=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a,o=n;if(t.isNullOrUndefined(n)||""===n[0]||o.length>4)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];o[1]=o[1]?o[1]:"1",o[2]=o[2]?o[2]:"1";var s="1"===o[2]?"Ascending":"Descending";o[3]=o[3]?o[3].toUpperCase():"FALSE",o[0]=o[0].split("$").join("");var l,h=[];if(o[0].indexOf(":")>-1){var d=o[0].split(":");if(this.parent.isCellReference(d[0])&&this.parent.isCellReference(d[1])){var p=o[0].indexOf(":"),c=void 0,u=this.parent.rowIndex(this.parent.substring(o[0],0,p)),f=this.parent.colIndex(this.parent.substring(o[0],0,p)),g=this.parent.rowIndex(this.parent.substring(o[0],p+1,p+o[0].length-p-1)),m=this.parent.colIndex(this.parent.substring(o[0],p+1,p+o[0].length-p-1));if(u>g&&(c=g,g=u,u=c),f>m&&(c=m,m=f,f=c),o[2]=this.parent.getValueFromArg(o[2]),"1"!==o[2]&&"-1"!==o[2])return this.parent.getErrorStrings()[e.CommonErrors.value];if(!isNaN(this.parseDouble(o[1]))&&this.parseDouble(o[1])<1)return this.parent.getErrorStrings()[e.CommonErrors.value];if(o[3].toUpperCase()!==this.parent.trueValue&&o[3].toUpperCase()!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];var v="";0===o[0].indexOf("!")&&(v=(v=(v=o[0]).replace("!","")).indexOf("!"),v=o[0].substring(0,v+2)),o[0]=v+V(f)+u+":"+V(m)+g,l=this.parent.getCellCollection(o[0]);for(b=0;b<l.length;b++)h.push(this.parent.getValueFromArg(l[b]));var y=[],C=m-f+1;if("TRUE"===o[3])for(b=0;b<C;b++)h[b+(this.parseDouble(o[1])-1)*C]&&y.push(isNaN(this.parseDouble(h[b+(this.parseDouble(o[1])-1)*C]))?h[b+(this.parseDouble(o[1])-1)*C]:this.parseDouble(h[b+(this.parseDouble(o[1])-1)*C]));if("FALSE"===o[3])for(var b=0;b<h.length;b++)h[b*C+this.parseDouble(o[1])-1]&&y.push(isNaN(this.parseDouble(h[b*C+this.parseDouble(o[1])-1]))?h[b*C+this.parseDouble(o[1])-1]:this.parseDouble(h[b*C+this.parseDouble(o[1])-1]));for(var S=r.DataUtil.sort(y,null,r.DataUtil.fnSort(s)),x=[],w=0;w<S.length;w++)for(var I=0;I<y.length;I++)JSON.stringify(S[w])===JSON.stringify(y[I])&&-1===x.indexOf(I)&&x.push(I);if("TRUE"===o[3]){for(var E=u,R=0;E<=g;E++,R++)for(var w=0,k=0;w<x.length;w++,k++){var A=this.parent.getValueFromArg(v+V(x[w]+f)+E),T=this.parent.actCell,F=this.parent.rowIndex(T),L=this.parent.colIndex(T);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,A,F+R,L+k)}a=this.parent.getValueFromArg(v+V(x[0]+f)+u)}if("FALSE"===o[3]){for(var w=0,R=0;w<x.length;w++,R++)for(var N=f,k=0;N<=m;N++,k++){var D=this.parent.getValueFromArg(v+V(N)+(x[w]+u)),T=this.parent.actCell,F=this.parent.rowIndex(T),L=this.parent.colIndex(T);this.parent.parentObject.setValueRowCol(this.parent.getSheetID(this.parent.grid)+1,D,F+R,L+k)}a=this.parent.getValueFromArg(v+V(f)+(x[0]+u))}}}return a},n.prototype.ComputeCOUNTIF=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(r)||""===r[0]||2!==i.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a,o,s=0,l=[],h="equal",d=i[1].split(this.parent.tic).join("");if(d.startsWith("<=")?(h="lessEq",d=d.substring(2)):d.startsWith(">=")?(h="greaterEq",d=d.substring(2)):d.startsWith("<>")?(h="notEq",d=d.substring(2)):d.startsWith("<")?(h="less",d=d.substring(1)):d.startsWith(">")?(h="greater",d=d.substring(1)):d.startsWith("=")&&(h="equal",d=d.substring(1)),i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){a=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));for(var p=0;p<a.length;p++)o=this.parent.getValueFromArg(a[p]),(d.indexOf("*")>-1||d.indexOf("?")>-1)&&(o=this.parent.findWildCardValue(d,o)),l.push(o),l.push(d),this.parent.processLogical(l,h)===this.parent.trueValue&&s++}return s},n.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.falseValue)},n.prototype.ComputeTEXT=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];for(var i,a=r.length,o=0;o<a;o++)i=t.isNullOrUndefined(i)?r[o]:i+","+r[o];var s=i.indexOf(","),l=i.slice(0,s),h=i.slice(i.indexOf('"')+1,i.length),d=h.indexOf('"');if(s>-1&&d!==h.length-1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var p=l,c=h.slice(0,h.length-1),u=new Date(1900,0,1,0,0,0),f=p+","+c,g=new t.Internationalization;if(this.parent.getErrorStrings().indexOf(f)>-1)return f;if(p=this.parent.getValueFromArg(p),""===(c=c.split(this.parent.tic).join("")))return"";""===p&&(c.length>0&&(c.toUpperCase().indexOf("M")>-1||c.toUpperCase().indexOf("D")>-1||c.toUpperCase().indexOf("Y")>-1||c.toUpperCase().indexOf("S")>-1||c.toUpperCase().indexOf("T")>-1)||c.toUpperCase().indexOf("H")>-1)&&(p=u.toString());var m=this.parseDouble(p);if(isNaN(m)&&null!==this.parent.isDate(new Date(p))&&(m=this.parent.toOADate(new Date(p))),u=Date.parse(p.split(this.parent.tic).join("")),!isNaN(m)||!isNaN(u)){if("["===c[0])return this.parent.tic+p+this.parent.tic;if(c.length>0&&(c.toUpperCase().indexOf("M")>-1||c.toUpperCase().indexOf("D")>-1||c.toUpperCase().indexOf("Y")>-1||c.toUpperCase().indexOf("S")>-1||c.toUpperCase().indexOf("T")>-1)||c.toUpperCase().indexOf("H")>-1){var v=(c=(c=c.split("Y").join("y").split("D").join("d").split("H").join("h")).split("S").join("s").split("m").join("M").split("AM/PM").join("tt")).split(""),y=!1,C=!1,o=0,b=0,S=0;for(o=0;o<v.length;){var x=v[o];"s"===x&&"M"===v[b]&&(v[b]="m","M"===v[b-1]&&(v[b-1]="m")),this.parent.isChar(x)?(b=o,"M"===x&&S++):S>1&&S++,"M"===x&&y&&(v[o]="m",C=!0),"h"===x?y=!0:this.parent.isChar(x)&&"M"!==x&&"h"!==x&&!C&&(y=!1,C=!1),o++}c=(c=String(v)).split(",").join("").split("\n").join(" ");var w=this.parent.fromOADate(m);0===m&&(w=u);var I=M(c);if(""===I)return this.parent.getErrorStrings()[e.CommonErrors.name];p=g.getDateFormat({skeleton:I,type:"date"})(new Date(w.toString()))}else p=g.formatNumber(m,{format:c})}return p},n.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.trueValue)},n.prototype.ComputeAVERAGEIFS=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.parent.computeIfsFormulas(e,this.parent.falseValue,this.parent.trueValue)},n.prototype.ComputeMATCH=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r;if(t.isNullOrUndefined(i)||1===i.length&&""===i[0]||i.length<2||i.length>3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a,o=[],s=i[0].split(this.parent.tic).join("");this.parent.isCellReference(s)&&(s=this.parent.getValueFromArg(s)),i[2]=t.isNullOrUndefined(i[2])?"1":i[2].split(this.parent.tic).join(""),i[2].split(this.parent.tic).join("")===this.parent.trueValue&&(i[2]="1"),i[2].split(this.parent.tic).join("")===this.parent.falseValue&&(i[2]="0");var l=parseFloat(i[2]);if(-1!==l&&0!==l&&1!==l)return this.parent.getErrorStrings()[e.CommonErrors.na];var h=0,d="";if(i[1].indexOf(":")>-1||this.parent.isCellReference(i[1])){a=this.parent.getCellCollection(i[1].split(this.parent.tic).join(""));for(var p=0;p<a.length;p++)o[p]=this.parent.getValueFromArg(a[p]).split(this.parent.tic).join("");for(var c=0;c<o.length;c++)if(1===l){if(s===o[c])return c+1;s>o[c]&&(d?o[c]>d&&(h=c+1,d=o[c]):(h=c+1,d=o[c]))}else if(0===l){if((s.indexOf("*")>-1||s.indexOf("?")>-1)&&(o[c]=this.parent.findWildCardValue(s,o[c])),s===o[c])return c+1;if(this.parent.parseFloat(s)===this.parent.parseFloat(o[c]))return c+1}else if(-1===l){if(s===o[c])return c+1;s<o[c]&&(d?o[c]<d&&(h=c+1,d=o[c]):(h=c+1,d=o[c]))}}return h||this.parent.getErrorStrings()[e.CommonErrors.na]},n.prototype.ComputeSUBTOTAL=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t,i="";if(n.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=this.parent.parseFloat(this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""))),o=n.slice(1,n.length);switch(a){case 1:case 101:i=this.ComputeAVERAGE.apply(this,o);break;case 2:case 102:i=this.ComputeCOUNT.apply(this,o);break;case 3:case 103:i=this.ComputeCOUNTA.apply(this,o);break;case 4:case 104:i=this.ComputeMAX.apply(this,o);break;case 5:case 105:i=this.ComputeMIN.apply(this,o);break;case 6:case 106:i=this.ComputePRODUCT.apply(this,o);break;case 7:case 107:i=this.ComputeDAY.apply(this,o);break;case 8:case 108:i=this.ComputeCONCAT.apply(this,o);break;case 9:case 109:i=this.ComputeSUM.apply(this,o);break;case 10:case 110:i=this.ComputeAVERAGEA.apply(this,o);break;case 11:case 111:i=this.ComputeABS.apply(this,o);break;default:i=this.parent.getErrorStrings()[e.CommonErrors.value]}return i},n.prototype.ComputeRADIANS=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(""===n[0]||n.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n[0].indexOf(":")>-1||""===n[0].split(this.parent.tic).join(""))return this.parent.getErrorStrings()[e.CommonErrors.value];var i=n[0].split(this.parent.tic).join("");n[0]=isNaN(this.parent.parseFloat(i))?n[0]:i;var a=this.parent.getValueFromArg(n[0]),o=this.parent.parseFloat(a);return isNaN(o)?a.indexOf(this.parent.tic)>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.PI*o/180},n.prototype.ComputeRANDBETWEEN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a,o=t.length;if(2!==o)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=0;s<o;s++){if(""===t[s])return this.parent.getErrorStrings()[e.CommonErrors.na];if(t[s].indexOf(this.parent.tic)>-1){if(isNaN(parseFloat(t[s].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];t[s]=t[s].split(this.parent.tic).join("")}if(a=parseFloat(this.parent.getValueFromArg(t[s])),this.parent.isCellReference(t[s])){if(a=""===this.parent.getValueFromArg(t[s])?0:a,0===s?n=a:i=a,0===n&&0===i)return"0";if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.name];0===s?n=a:i=a}}return i<n?this.parent.getErrorStrings()[e.CommonErrors.num]:0===n?Math.floor(Math.random()*(i-(n-1)))+n:i-n==1?Math.round(Math.random()*(i-n)+n):Math.floor(Math.random()*(i-(n-1)))+n},n.prototype.ComputeSLOPE=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(2!==n.length||""===n[0])return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.getCellCollection(n[1].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[0].split(this.parent.tic).join(""));if(a.length!==i.length)return this.parent.getErrorStrings()[e.CommonErrors.na];var o=this.getDataCollection(a),s=this.getDataCollection(i);if(s.indexOf("#NAME?")>-1||o.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,d=0,p=0,c=0,u=s.length;c<u;++c)"NaN"!==Number(s[c]).toString()&&"NaN"!==Number(o[c]).toString()&&(l+=Number(s[c])*Number(o[c]),d+=Number(s[c]),p+=Number(o[c]),h+=Number(s[c])*Number(s[c]));var f=((l-d*p/s.length)/(h-d*d/s.length)).toString();return"NaN"===f?this.parent.getErrorStrings()[e.CommonErrors.divzero]:f},n.prototype.ComputeINTERCEPT=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(""===n[0]||2!==n.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.getCellCollection(n[0].split(this.parent.tic).join("")),a=this.parent.getCellCollection(n[1].split(this.parent.tic).join(""));if(i.length!==a.length)return this.parent.getErrorStrings()[e.CommonErrors.na];var o=this.getDataCollection(a),s=this.getDataCollection(i);if(o.indexOf("#NAME?")>-1||s.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,d=0,p=o.length;d<p;++d)l+=Number(o[d]),h+=Number(s[d]);l/=o.length,h/=o.length;for(var c,u=0,f=0,d=0,p=o.length;d<p;++d)u+=(c=Number(o[d])-l)*(Number(s[d])-h),f+=c*c;var g=(h-u/f*l).toString();return"NaN"===g?this.parent.getErrorStrings()[e.CommonErrors.divzero]:g},n.prototype.ComputeLN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t,o="";if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(this.parent.isCellReference(a[0])){if(o=this.parent.getValueFromArg(a[0]),(n=this.parent.parseFloat(o))<=0||""===o)return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(i=this.parent.getValueFromArg(a[0].split(this.parent.tic).join("")),(n=this.parent.parseFloat(i))<=0||""===n.toString())return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}return Math.log(n)},n.prototype.ComputeISNUMBER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t;if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.isCellReference(n[0])?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""));if(""===i.toString())return!1;var a=this.parent.parseFloat(i);return!isNaN(a)},n.prototype.ComputeROUND=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a,o,s,l=t,h=0,d=0;return 0===t.length||t.length>2?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:1===t.length?(n="TRUE"===l[0].split(this.parent.tic).join("")?"1":"FALSE"===l[0].split(this.parent.tic).join("")?"0":l[0],Math.round(this.parent.parseFloat(n)).toString()):(a=this.parent.getValueFromArg(l[0]),o=""===l[1].split(this.parent.tic).join("")?"0":this.parent.getValueFromArg(l[1].split(this.parent.tic).join("")),a="TRUE"===a.split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,o="TRUE"===o.split(this.parent.tic).join("")?"1":"FALSE"===o.split(this.parent.tic).join("")?"0":o,""!==a&&""!==o&&(h=this.parent.parseFloat(a),d=this.parent.parseFloat(o),!isNaN(d)&&!isNaN(h)&&d>0?i=h.toFixed(d):(s=Math.pow(10,-d),i=Math.round(h/s)*s)),i.toString())},n.prototype.ComputePOWER=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];n=this.parent.getValueFromArg(a[0]),i=this.parent.getValueFromArg(a[1]),n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n,i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:0===o&&s<0?this.parent.getErrorStrings()[e.CommonErrors.divzero]:0===o&&0===s?this.parent.getErrorStrings()[e.CommonErrors.num]:Math.pow(o,s).toString()},n.prototype.ComputeLOG=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a=t;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n=this.parent.getValueFromArg(a[0]),i=2===t.length?this.parent.getValueFromArg(a[1]):"10",""===n||null===n||""===i||null===i)return this.parent.getErrorStrings()[e.CommonErrors.num];n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n,i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return o<=0||s<=0?this.parent.getErrorStrings()[e.CommonErrors.num]:1===s?this.parent.getErrorStrings()[e.CommonErrors.divzero]:isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:(Math.log(o)/Math.LN10/(Math.log(s)/Math.LN10)).toString()},n.prototype.ComputeTRUNC=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t,a=0;if(0===t.length||t.length>2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];2===t.length&&(a="TRUE"===(a=this.parent.getValueFromArg(i[1])).split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,a=this.parent.parseFloat(a)),n="TRUE"===(n=this.parent.getValueFromArg(i[0])).split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n;var o=this.parent.parseFloat(n.split(this.parent.tic).join(""));if(isNaN(o)||isNaN(a))return i[0]===this.parent.tic||this.parent.isCellReference(i[0])||i[1]===this.parent.tic||this.parent.isCellReference(i[1])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name];var s=Math.pow(10,a);return((o<0?-1:1)*Math.floor(s*Math.abs(o))/s).toString()},n.prototype.ComputeEXP=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=t;if(0===t.length||t.length>1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];""===(n="TRUE"===(n=this.parent.getValueFromArg(i[0])).split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n)&&(n="0");var a=this.parent.parseFloat(n);return a>709?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(a)?i[0]===this.parent.tic||this.parent.isCellReference(i[0])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.exp(a).toString()},n.prototype.ComputeGEOMEAN=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i,a,o,s=t,l=1,h=0,d=0;if(0===t.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(i=0;i<s.length;i++)if(s[i].indexOf(":")>-1){if(s[0]===this.parent.tic)return this.parent.getErrorStrings()[e.CommonErrors.value];for(o=this.parent.getCellCollection(s[i].split(this.parent.tic).join("")),a=0;a<o.length;a++){if(d=this.parent.getValueFromArg(o[a]),d="TRUE"===d.split(this.parent.tic).join("")?"1":"FALSE"===d.split(this.parent.tic).join("")?"0":d,(n=this.parent.parseFloat(d))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}}else if((d=this.parent.getValueFromArg(s[i])).length>0){if(d="TRUE"===d.split(this.parent.tic).join("")?"1":"FALSE"===d.split(this.parent.tic).join("")?"0":d,!this.parent.isCellReference(s[i])&&isNaN(this.parent.parseFloat(d)))return this.parent.getErrorStrings()[e.CommonErrors.name];if((n=this.parent.parseFloat(d))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}return h>0&&(l=Math.pow(l,1/h)),l.toString()},n.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.parent.getValueFromArg(e[r]));return t},n.prototype.parseDouble=function(e){var t=this.parent.parseFloat(e.toString());return isNaN(t)?NaN:t},n.prototype.getModuleName=function(){return"basic-formulas"},n}(),br=function(){function r(e){this.emptyStr="",this.storedStringText=this.emptyStr,this.sheetToken="!",this.tokenAdd="a",this.tokenSubtract="s",this.tokenMultiply="m",this.tokenDivide="d",this.tokenLess="l",this.charEm="r",this.charEp="x",this.tokenGreater="g",this.tokenEqual="e",this.tokenLessEq="k",this.tokenGreaterEq="j",this.tokenNotEqual="o",this.tokenAnd="c",this.tokenEm="v",this.tokenEp="t",this.tokenOr=String.fromCharCode(126),this.charAnd="i",this.charLess="<",this.charGreater=">",this.charEqual="=",this.charLessEq="f",this.charGreaterEq="h",this.charNoEqual="z",this.stringGreaterEq=">=",this.stringLessEq="<=",this.stringNoEqual="<>",this.stringAnd="&",this.stringOr="^",this.charOr="w",this.charAdd="+",this.charSubtract="-",this.charMultiply="*",this.charDivide="/",this.fixedReference="$",this.spaceString=" ",this.ignoreBracet=!1,this.isError=!1,this.isFormulaParsed=!1,this.findNamedRange=!1,this.stringsColl=new Map,this.tokens=[this.tokenAdd,this.tokenSubtract,this.tokenMultiply,this.tokenDivide,this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual,this.tokenAnd,this.tokenOr],this.charNOTop=String.fromCharCode(167),this.specialSym=["~","@","#","?"],this.isFailureTriggered=!1,this.parent=e}return r.prototype.parse=function(r,n){if(this.parent.isTextEmpty(r))return r;this.parent.getFormulaCharacter()!==String.fromCharCode(0)&&this.parent.getFormulaCharacter()===r[0]&&(r=r.substring(1)),(this.parent.namedRanges.size>0||this.parent.storedData.size>0)&&(r=this.checkForNamedRangeAndKeyValue(r),this.findNamedRange=!1),r=(r=(r=(r=r.split("-+").join("-")).split("--").join("+")).split("+-").join("-")).split("-(-").join("(");var i=this.storeStrings(r);r=this.storedStringText;var a=0;if(t.isNullOrUndefined(i)&&(r=r.split(" ").join("")),r=r.split("=>").join(">="),(r=r.split("=<").join("<="))[r.length-1]===this.parent.arithMarker&&this.indexOfAny(r,this.tokens)===r.length-2||(r=r.toUpperCase()),r.indexOf(this.sheetToken)>-1){var o=this.parent.getSheetFamilyItem(this.parent.grid);if(null!=o.sheetNameToParentObject&&o.sheetNameToParentObject.size>0){r[0]!==this.sheetToken.toString()&&(r=this.parent.setTokensForSheets(r));var s=this.parent.getSheetToken(r.split(this.parent.tic).join(this.emptyStr)),l=this.checkScopedRange(r.split('"').join(this.emptyStr).split(this.sheetToken).join(""));t.isNullOrUndefined(s)&&""!==s&&this.parent.namedRanges.size>0&&""!==l&&(r=l)}}r=this.markLibraryFormulas(r);try{r=this.formulaAutoCorrection(r)}catch(t){if(!(p={message:t.message,exception:t,isForceCalculable:t.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];if(this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0),!p.isForceCalculable||!p.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];r=this.formulaAutoCorrection(r,p),this.parent.storedData.get(n).formulaText="="+r}if(!this.ignoreBracet)for(a=r.indexOf(")");a>-1;){var h=r.substring(0,a).lastIndexOf("(");if(-1===h)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);if(h===a-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.empty_expression]);var d=this.emptyStr;d=this.ignoreBracet?this.parent.substring(r,h,a-h+1):this.parent.substring(r,h+1,a-h-1);try{r=r.substring(0,h)+this.parseSimple(d)+r.substring(a+1)}catch(e){var p=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0);var c="string"==typeof p.exception?p.exception:p.message;return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+c}a=r.indexOf(")")}if(!this.ignoreBracet&&r.indexOf("(")>-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);return r=this.parseSimple(r),null!==i&&i.size>0&&(r=this.setStrings(r,i)),r},r.prototype.exceptionArgs=function(e){return{message:e.message,exception:e,isForceCalculable:e.formulaCorrection,computeForceCalculate:!1}},r.prototype.formulaAutoCorrection=function(r,n){var i=["*","+","-","/","^","&"],a=[">","=","<"],o=0,s="",l="",h="",d="",p="",c="",u="",f=0;if(this.parent.formulaErrorStrings.indexOf(r)>-1)return r;if(this.indexOfAny(r,this.specialSym)>-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!1);for(;o<r.length;)if(((r=r.split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+")).indexOf("*-")>-1||r.indexOf("/-")>-1)&&(r="-"+r.split("*-").join("*").split("/-").join("/")),this.parent.isDigit(r[o])&&r.length>o+1&&this.indexOfAny(r[o+1],i)>-1&&r.length>o+2&&!t.isNullOrUndefined(r[o+2])&&this.indexOfAny(r[o+2],i)>-1){if(t.isNullOrUndefined(n))throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!0);if(!n.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];this.parent.isDigit(r[o])?(f<1?(c=r[o],h=r[o+1],t.isNullOrUndefined(h)&&(h=this.emptyStr),f+=1,s=s+c+(h="&"===h?"":h)):f<2&&(u=r[o],d=r[o-1],p=r[o+1],f=0,s="-"===d?s+d+u+(p="&"===(p=t.isNullOrUndefined(p)?this.emptyStr:p)?"":p):s+u+(p=t.isNullOrUndefined(p)?this.emptyStr:p)),o+=2):(s="-"===r[o]?s+r[o]:s,o+=1)}else if((this.parent.isDigit(r[o])||r[o]===this.parent.rightBracket||this.parent.storedData.has(r[o].toUpperCase()))&&(t.isNullOrUndefined(r[o+1])||this.indexOfAny(r[o+1],i))>-1)l="&"===(l=t.isNullOrUndefined(r[o+1])?this.emptyStr:r[o+1])?"":l,s="-"===r[o-1]?s+r[o-1]+r[o]+l:s+r[o]+l,o+=2;else if(this.indexOfAny(r[o],a)>-1&&!t.isNullOrUndefined(r[o-1])&&!t.isNullOrUndefined(r[o+1]))s+=r[o],o+=1;else if("q"===r[o])for(;r[o]!==this.parent.leftBracket;)s+=r[o],o+=1;else r[o]===this.parent.leftBracket||r[o]===this.parent.rightBracket||"{"===r[o]||"}"===r[o]||"("===r[o]||")"===r[o]?(s+=r[o],o+=1):this.parent.isUpperChar(r[o])||r[o].indexOf(":")>-1||r[o]===this.parent.getParseArgumentSeparator()||"%"===r[o]&&this.parent.isDigit(r[o-1])?(s+=r[o],o+=1):r[o]===this.parent.tic||" "===r[o]||"."===r[o]||r[o]===this.sheetToken||"$"===r[o]?(s+=r[o],o+=1):(this.parent.isDigit(r[o])&&(s="-"===r[o-1]?s+r[o-1]+r[o]:s+r[o]),"-"!==r[o]&&"+"!==r[o]||(s=(s+=r[o]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==r[o]&&"*"!==r[o]||(s+=r[o]),o+=1);return s=s===this.emptyStr?r:s,this.indexOfAny(s[s.length-1],i)>-1&&(s=s.substring(0,s.length-1)),s=s.split("--").join("-").split("-+").join("-").split("+-").join("-")},r.prototype.checkScopedRange=function(e){var r=this,n=this.emptyStr,i="NaN",a=this.parent.getSheetID(this.parent.grid),o=this.parent.getSheetFamilyItem(this.parent.grid);if(e[0]===this.sheetToken.toString()){var s=e.indexOf(this.sheetToken,1),l=parseInt(e.substr(1,s-1),10);s>1&&!this.parent.isNaN(l)&&(e=e.substring(s+1),a=l)}var h="!"+a.toString()+"!";return null===o||null==o.sheetNameToToken?i:(o.sheetNameToToken.forEach(function(a,s){if(o.sheetNameToToken.get(s).toString()===h){var l=r.emptyStr;r.parent.namedRanges.forEach(function(a,s){l=t.isNullOrUndefined(r.parent.parentObject)?o.sheetNameToToken.get(s).toUpperCase():(r.parent.parentObject.getActiveSheet().name+r.sheetToken+e).toUpperCase(),r.parent.getNamedRanges().has(l)&&(n=r.parent.getNamedRanges().get(l).toUpperCase(),i=n)})}}),i)},r.prototype.storeStrings=function(t){var r,n=0,i=0,a=0,o="",s=null;if(t.indexOf(this.parent.tic)>-1)for(n=t.indexOf(this.parent.tic);n>-1&&t.length>0;){if(null===s&&(s=this.stringsColl),-1===(i=n+1<t.length?t.indexOf(this.parent.tic,n+1):-1))throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_tics]);r=this.parent.substring(t,n,i-n+1),o=this.parent.tic+this.spaceString+a.toString()+this.parent.tic,s=s.set(o,r),t=t.substring(0,n)+o+t.substring(i+1),(n+=o.length)<t.length&&(n=t.indexOf(this.parent.tic,n)),a++}return this.storedStringText=t,s},r.prototype.setStrings=function(e,t){for(var r=0;r<t.size;r++)t.forEach(function(t,r){e=e.split(r).join(t)});return e},r.prototype.parseSimple=function(e){var t=e;if(t.length>0&&"+"===t[0]&&(t=t.substring(1)),"#DIV/0!"===t)return"#DIV/0!";if("#NAME?"===t)return"#NAME?";if(""===t)return t;if(this.parent.formulaErrorStrings.indexOf(t)>-1)return t;t=(t=(t=(t=(t=(t=t.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr);var r=[this.tokenEp,this.tokenEm],n=[this.tokenMultiply,this.tokenDivide],i=[this.tokenAdd,this.tokenSubtract],a=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],l=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],h=[this.charEp,this.charEm],d=[this.tokenAnd],p=[this.charAnd],c=[this.charOr],u=[this.tokenOr];return t=this.parseSimpleOperators(t,r,h),t=this.parseSimpleOperators(t,u,c),t=this.parseSimpleOperators(t,n,a),t=this.parseSimpleOperators(t,i,o),t=this.parseSimpleOperators(t,s,l),t=this.parseSimpleOperators(t,d,p)},r.prototype.parseSimpleOperators=function(t,r,n){if(this.parent.getErrorStrings().indexOf(t)>-1)return t;for(var i=t,a=0,o="",s=0;s<n.length;s++)o+=n[s];(i=(i=i.split("---").join("-").split("--").join("+").split(this.parent.getParseArgumentSeparator()+"-").join(this.parent.getParseArgumentSeparator()+"u").split(this.parent.leftBracket+"-").join(this.parent.leftBracket+"u").split("=-").join("=u")).split(",+").join(",").split(this.parent.leftBracket+"+").join(this.parent.leftBracket).split("=+").join("=").split(">+").join(">").split("<+").join("<").split("/+").join("/").split("*+").join("*").split("++").join("+").split("*-").join("*u").toString()).length>0&&"-"===i[0]?(i="0-"+(i=i.substring(1).split("-").join(this.tokenOr)),i=(i=this.parseSimpleOperators(i,[this.tokenSubtract],[this.charSubtract])).split(this.tokenOr).join("-")):i.length>0&&"+"===i[0]?i=i.substring(1):i.length>0&&"+"===i[i.length-1]&&(i=i.substring(0,i.length-1));try{if(this.indexOfAny(i,n)>-1)for(a=this.indexOfAny(i,n);a>-1;){var l="",h="",d=0,p=0,c=0;if(i[a]===this.charNOTop)d=a;else if(c=a-1,i[c]===this.parent.arithMarker){if((f=this.findLeftMarker(i.substring(0,c-1)))<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f+1,c-f-1),d=f+1}else if(i[c]===this.parent.rightBracket){for(var u=0,f=c-1;f>0&&("q"!==i[f]||0!==u);)"q"===i[f]?u--:i[f]===this.parent.rightBracket&&u++,f--;if(f<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f,c-f+1),d=f}else if(i[c]===this.parent.tic[0]){var g=i.substring(0,c-1).lastIndexOf(this.parent.tic);if(g<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,g,c-g+1),d=g}else{for(v=!1;c>-1&&(this.parent.isDigit(i[c])||!v&&i[c]===this.parent.getParseDecimalSeparator());)i[c]===this.parent.getParseDecimalSeparator()&&(v=!0),c-=1;if(c>-1&&v&&i[c]===this.parent.getParseDecimalSeparator())throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points]);if(0===(c+=1)||c>0&&!this.parent.isUpperChar(i[c-1]))l="n"+this.parent.substring(i,c,a-c),d=c;else{for(c-=1;c>-1&&(this.parent.isUpperChar(i[c])||this.parent.isDigit(i[c]));)c-=1;if(c>-1&&i[c]===this.sheetToken){for(c-=1;c>-1&&i[c]!==this.sheetToken;)c-=1;c>-1&&i[c]===this.sheetToken&&(c-=1)}if(c>-1&&":"===i[c]){for(c-=1;c>-1&&this.parent.isDigit(i[c]);)c-=1;for(;c>-1&&this.parent.isUpperChar(i[c]);)c-=1;if(c>-1&&i[c]===this.sheetToken){for(c--;c>-1&&i[c]!==this.sheetToken;)c--;c>-1&&i[c]===this.sheetToken&&c--}c+=1,l=this.parent.substring(i,c,a-c),l=this.parent.getCellFrom(l)}else c+=1,l=this.parent.substring(i,c,a-c);this.parent.updateDependentCell(l),d=c}(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(l.toUpperCase())||this.parent.storedData.has(l.toUpperCase()))&&(l="n"+this.checkForNamedRangeAndKeyValue(l))}if(a===i.length-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.expression_cannot_end_with_an_operator]);var m="u"===i[c=a+1];if(m&&(c+=1),i[c]===this.parent.tic[0]){if((f=i.substring(c+1).indexOf(this.parent.tic))<0)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];h=this.parent.substring(i,c,f+2),p=f+c+2}else if(i[c]===this.parent.arithMarker){if((f=this.findRightMarker(i.substring(c+1)))<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);h=this.parent.substring(i,c+1,f),p=f+c+2}else if("q"===i[c]){for(var u=0,f=c+1;f<i.length&&(i[f]!==this.parent.rightBracket||0!==u);)i[f]===this.parent.rightBracket?u++:"q"===i[f]&&u--,f++;if(f===i.length)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse];h=this.parent.substring(i,c,f-c+1),m&&(h="u"+h),p=f+1}else if(this.parent.isDigit(i[c])||i[c]===this.parent.getParseDecimalSeparator()){var v=i[c]===this.parent.getParseDecimalSeparator();for(c+=1;c<i.length&&(this.parent.isDigit(i[c])||!v&&i[c]===this.parent.getParseDecimalSeparator());)i[c]===this.parent.getParseDecimalSeparator()&&(v=!0),c+=1;if(c<i.length&&"%"===i[c]&&(c+=1),v&&c<i.length&&i[c]===this.parent.getParseDecimalSeparator())throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.number_contains_2_decimal_points];h="n"+this.parent.substring(i,a+1,c-a-1),p=c}else if(this.parent.isUpperChar(i[c])||i[c]===this.sheetToken||"u"===i[c]){if(i[c]===this.sheetToken)for(c+=1;c<i.length&&i[c]!==this.sheetToken;)c+=1;c+=1;for(var y=0,C=!1;c<i.length&&(this.parent.isUpperChar(i[c])||"_"===i[c]||"."===i[c]||"["===i[c]||"]"===i[c]||"#"===i[c]||" "===i[c]||"%"===i[c]||i[c]===this.parent.getParseDecimalSeparator()&&C);)c!==i.length-1&&"["===i[c]&&"["===i[c+1]&&(C=!0),c!==i.length-1&&"]"===i[c]&&"]"===i[c+1]&&(C=!1),c++,y++;var b=c===i.length||!this.parent.isDigit(i[c]);if(y>1){for(;c<i.length&&(this.parent.isUpperChar(i[c])||this.parent.isDigit(i[c])||" "===i[c]||"_"===i[c]);)c++;b=!0}for(;c<i.length&&this.parent.isDigit(i[c]);)c+=1;if(c<i.length&&":"===i[c]){if((c+=1)<i.length&&i[c]===this.sheetToken){for(c++;c<i.length&&i[c]!==this.sheetToken;)c+=1;c<i.length&&i[c]===this.sheetToken&&c++}for(;c<i.length&&this.parent.isUpperChar(i[c]);)c+=1;for(;c<i.length&&this.parent.isDigit(i[c]);)c+=1;c-=1,h=this.parent.substring(i,a+1,c-a),h=this.parent.getCellFrom(h)}else c-=1,h=this.parent.substring(i,a+1,c-a),(m="u"===i[c])&&(h="u"+h);b&&h.startsWith(this.sheetToken)&&(b=!this.parent.isCellReference(h)),b||this.parent.updateDependentCell(h),(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(h.toUpperCase())||this.parent.storedData.has(h.toUpperCase()))&&(h="n"+this.checkForNamedRangeAndKeyValue(h)),p=c+1}var S=o.indexOf(i[a]),x=this.parent.arithMarker+l+h+r[S]+this.parent.arithMarker;d>0&&(x=i.substring(0,d)+x),p<i.length&&(x+=i.substring(p)),i=x=x.split(this.parent.arithMarker2).join(this.parent.arithMarker.toString()),a=this.indexOfAny(i,n)}else if(i.length>0&&(this.parent.isUpperChar(i[0])||i[0]===this.sheetToken)){for(var w=!0,I=!0,E=!1,R=i.length,f=0;f<R;++f)if(i[f]===this.sheetToken){if(f>0&&!E)throw this.parent.getErrorStrings()[e.CommonErrors.ref];for(E=!0,f++;f<R&&this.parent.isDigit(i[f]);)f++;if(f===R||i[f]!==this.sheetToken){w=!1;break}}else{if(!I&&this.parent.isChar(i[f])){w=!1;break}if(!this.parent.isChar(i[f])&&!this.parent.isDigit(i[f])&&i[f]!==this.sheetToken){w=!1;break}I=this.parent.isUpperChar(i[f])}w&&this.parent.updateDependentCell(i)}return i}catch(e){return e}},r.prototype.indexOfAny=function(e,t){for(var r=0;r<e.length;r++)if(t.indexOf(e[r])>-1)return r;return-1},r.prototype.findLeftMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=e.length-1;n>=0;--n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},r.prototype.findRightMarker=function(e){var t=-1;if(e.indexOf(this.parent.arithMarker)>-1)for(var r=0,n=0;n<e.length;++n)if(e[n]===this.parent.rightBracket)r--;else if(e[n]===this.parent.leftBracket)r++;else if(e[n]===this.parent.arithMarker&&0===r){t=n;break}return t},r.prototype.parseFormula=function(r,n){if(r.length>0&&r[0]===this.parent.getFormulaCharacter()&&(r=r.substring(1)),r.indexOf("#REF!")>-1)return this.parent.getErrorStrings()[e.CommonErrors.ref];r.length>0&&"+"===r[0]&&(r=r.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,r=this.parse(r.trim(),n),this.isFormulaParsed=!0}catch(e){var i=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",i),this.isFailureTriggered=!0);var a="string"==typeof i.exception?i.exception:i.message;r=(t.isNullOrUndefined(this.parent.getErrorLine(e))?"":"#"+this.parent.getErrorLine(e)+": ")+a,this.isError=!0}return r},r.prototype.markLibraryFormulas=function(r){var n=0,i=r.indexOf(")");if(-1===i)r=this.markNamedRanges(r);else for(;i>-1;){for(var a=0,o=i-1;o>-1&&("("!==r[o]||0!==a);)")"===r[o]&&a++,o--;if(-1===o)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);for(var s=o-1;s>-1&&this.parent.isChar(r[s]);)s--;var l=o-s-1,h=this.parent.substring(r,s+1,l);if(l>0&&!t.isNullOrUndefined(this.parent.getFunction(h))){"AREAS"===this.parent.substring(r,s+1,l)?this.ignoreBracet=!0:this.ignoreBracet=!1;var d=this.parent.substring(r,o,i-o+1);try{var p=void 0;d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,p)+")"}catch(t){if(!(p={message:t.message,exception:t,isForceCalculable:t.formulaCorrection,computeForceCalculate:!1}).isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0,n+=1),p.computeForceCalculate=n>0||p.computeForceCalculate,!p.isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(!p.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,p)+")"}d=this.markNamedRanges(d),d=this.swapInnerParens(d),-1===(d=this.addParensToArgs(d)).lastIndexOf(this.parent.getParseArgumentSeparator())&&d.length>2&&"("===d[0]&&")"===d[d.length-1]&&"{"!==d[1]&&"("!==d[1]&&(d=(d=d.substring(0,d.length-1)+"}"+d.substring(d.length-1))[0]+"{"+d.substring(1)),r=r.substring(0,s+1)+"q"+this.parent.substring(r,s+1,l)+d.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+r.substring(i+1)}else{if(l>0)return this.parent.getErrorStrings()[e.CommonErrors.name];var c=this.emptyStr;o>0&&(c=r.substring(0,o)),c=c+"{"+this.parent.substring(r,o+1,i-o-1)+"}",i<r.length&&(c+=r.substring(i+1)),r=c=this.markNamedRanges(c)}i=r.indexOf(")")}return r=r.split("{").join("(").split("}").join(")")},r.prototype.swapInnerParens=function(e){return e.length>2&&(e=e[0]+e.substr(1,e.length-2).split("(").join("{").split(")").join("}")+e[e.length-1]),e},r.prototype.addParensToArgs=function(e){if(0===e.length)return this.emptyStr;var t=[];t.push(this.parent.getParseArgumentSeparator()),t.push(this.parent.rightBracket);var r=e.lastIndexOf(this.parent.getParseArgumentSeparator()),n=0;if(-1===r){if(e.length>2&&"("===e[0]&&")"===e[e.length-1])if("{"!==e[1]&&"("!==e[1])e=(e=e.substring(0,e.length-1)+"}"+e.substring(e.length-1))[0]+"{"+e.substring(1);else{var i=["+","-","*","/"];r=this.lastIndexOfAny(e,i),0===n&&")"===e[e.length-1]&&(n=e.length-1),n>0&&"{"!==e[r+1]&&"}"===e[r-1]&&(e=(e=e.substr(0,n)+"}"+e.substr(n)).substr(0,r+1)+"{"+e.substr(r+1))}}else for(var a=!0;r>-1;){var o=this.indexOfAny(e.substring(r+1,e.length),t);o>=0?o=r+o+1:-1===o&&")"===e[e.length-1]&&(o=e.length-1),o>0&&"{"!==e[r+1]&&"}"!==e[o-1]&&(e=(e=e.substr(0,o)+"}"+e.substr(o)).substr(0,r+1)+"{"+e.substr(r+1)),r=e.substr(0,r).lastIndexOf(this.parent.getParseArgumentSeparator()),a&&-1===r&&"("===e[0]&&(r=0,a=!1)}return e=e.split("{}").join(this.emptyStr)},r.prototype.lastIndexOfAny=function(e,t){for(var r=e.length-1;r>-1;r--)if(t.indexOf(e[r])>-1)return r;return-1},r.prototype.markNamedRanges=function(e){var r=[")",this.parent.getParseArgumentSeparator(),"}","+","-","*","/","<",">","=","&"],n=e.length>0&&("("===e[0]||"{"===e[0])?1:0;e.indexOf("#N/A")>-1&&(e=e.split("#N/A").join("#N~A")),e.indexOf("#DIV/0!")>-1&&(e=e.split("#DIV/0!").join("#DIV~0!"));for(var i=this.indexOfAny(e.substring(n),r);i>-1&&i+n<e.length;){var a=this.emptyStr,o=null;if(this.parent.substring(e,n,i).indexOf("[")>-1?o=this.getTableRange(this.parent.substring(e,n,i)):this.parent.storedData.has(this.parent.substring(e,n,i))?o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i)):this.parent.namedRanges.has(this.parent.substring(e,n,i))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i))),t.isNullOrUndefined(o)&&("NaN"!==(a=this.checkScopedRange(this.parent.substring(e,n,i)))?(this.findNamedRange=!0,o=a):this.parent.substring(e,n,i).startsWith(this.sheetToken.toString()),!t.isNullOrUndefined(o)&&this.findNamedRange&&o.indexOf(this.fixedReference)>-1&&(o=o.split(this.fixedReference).join(this.emptyStr))),t.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),t.isNullOrUndefined(o)||o===this.emptyStr)for(n+=i+1;n<e.length&&!this.parent.isUpperChar(e[n])&&e[n]!==this.sheetToken;)n++;else e=e.substring(0,n)+o+e.substring(n+i),n+=o.length+1;for(i=n,n<e.length-1&&"{"===e[n]&&(n+=1),i=this.indexOfAny(e.substring(n),r);0===i&&n<e.length-1;)n++,i=this.indexOfAny(e.substring(n),r);if((-1===i||e.substring(n).indexOf("[")>-1)&&n<e.length){if(o=e.substring(n).indexOf("[")>-1?this.getTableRange(e.substring(n)):this.parent.storedData.has(e.substring(n))?this.parent.storedData.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o:this.parent.namedRanges.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o,t.isNullOrUndefined(o)&&"NaN"!==(a=this.checkScopedRange(e.substring(n)))&&(o=a),!t.isNullOrUndefined(o)&&o!==this.emptyStr&&(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o)))){var s=e.substring(n);e=")"===s[s.length-1]?e.substring(0,n)+o+")":e.substring(0,n)+o,n+=o.toString().length+1}i=n<e.length?this.indexOfAny(e.substring(n),r):-1}}return e.indexOf("#N~A")>-1&&(e=e.split("#N~A").join("#N/A")),e.indexOf("#DIV~0!")>-1&&(e=e.split("#DIV~0!").join("#DIV/0!")),e},r.prototype.checkForNamedRangeAndKeyValue=function(e){var r=this.emptyStr;if(e.indexOf("[")>-1){var n=this.getTableRange(e);t.isNullOrUndefined(n)||(this.findNamedRange=!0,e=n)}if("NaN"!==(r=this.checkScopedRange(e)))this.findNamedRange=!0,e=r;else{if(e.indexOf(this.sheetToken)>-1){var i=this.parent.getSheetFamilyItem(this.parent.grid),a=e.split('"').join(this.emptyStr);if(a=a.substr(0,a.indexOf(this.sheetToken)),i.sheetNameToToken.has(a.toUpperCase()))parseInt(i.sheetNameToToken.get(a.toUpperCase()).split(this.sheetToken).join(this.emptyStr))}this.parent.storedData.size>0&&this.parent.storedData.has(e)&&(e="A"+this.parent.colIndex(e)),this.parent.namedRanges.size>0&&this.parent.namedRanges.has(e.toUpperCase())&&(t.isNullOrUndefined(this.parent.parentObject)?(e=this.parse(this.parent.namedRanges.get(e.toUpperCase())),(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&e.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):e=this.parse(this.parent.namedRanges.get(e.toUpperCase()))),this.findNamedRange&&"!"!==e[0]&&"q"!==e[0]&&"bq"!==e[0]&&(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&(e=e.split(this.fixedReference).join(this.emptyStr))}return e},r.prototype.getTableRange=function(e){var t=(e=e.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);t.indexOf(this.parent.getParseArgumentSeparator())>-1&&(t.substring(0,t.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),t=t.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_"));this.emptyStr;return t.toUpperCase()},r.prototype.findNextEndIndex=function(e,t){for(var r=0,n=t,i=!1;!i&&t<e.length;)"["===e[n]?r++:"]"===e[n]&&0===--r&&(i=!0),t++;return t-=n},r}(),Sr=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xr=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},wr=function(r){function n(e){var n=r.call(this,null,null)||this;n.lFormulas=new Map,n.storedData=new Map,n.keyToRowsMap=new Map,n.rowsToKeyMap=new Map,n.rightBracket=String.fromCharCode(161),n.leftBracket=String.fromCharCode(162),n.sheetToken="!",n.emptyString="",n.leftBrace="{",n.rightBrace="}",n.cell=n.emptyString,n.cellPrefix="!0!A",n.treatEmptyStringAsZero=!1,n.tic='"',n.singleTic="'",n.trueValue="TRUE",n.falseValue="FALSE",n.parseDecimalSeparator=".",n.arithMarker=String.fromCharCode(180),n.arithMarker2=n.arithMarker+n.arithMarker,n.dependentCells=null,n.dependentFormulaCells=null,n.minValue=Number.MIN_SAFE_INTEGER,n.maxValue=Number.MAX_SAFE_INTEGER,n.categoryCollection=["All"],n.dependencyLevel=0,n.refreshedCells=new Map,n.computedValues=null,n.randomValues=new Map,n.isRandomVal=!1,n.randCollection=[],n.formulaErrorStrings=["binary operators cannot start an expression","cannot parse","bad library","invalid char in front of","number contains 2 decimal points","expression cannot end with an operator","invalid characters following an operator","invalid character in number","mismatched parentheses","unknown formula name","requires a single argument","requires 3 arguments","invalid Math argument","requires 2 arguments","#NAME?","too complex","circular reference: ","missing formula","improper formula","invalid expression","cell empty","bad formula","empty expression","","mismatched string quotes","wrong number of arguments","invalid arguments","iterations do not converge","Control is already registered","Calculation overflow","Missing sheet","cannot_parse","expression_cannot_end_with_an_operator"],n.errorStrings=null,n.parseArgumentSeparator=",",n.dateTime1900=new Date(1900,0,1,0,0,0),n.isParseDecimalSeparatorChanged=!1,n.isArgumentSeparatorChanged=!1,n.sheetFamilyID=0,n.defaultFamilyItem=null,n.sheetFamiliesList=null,n.modelToSheetID=null,n.tokenCount=0,n.sortedSheetNames=null,n.tempSheetPlaceHolder=String.fromCharCode(133),n.namedRanges=new Map,n.formulaInfoTable=null,n.oaDate=new Date(1899,11,30),n.millisecondsOfaDay=864e5,n.parseDateTimeSeparator="/";var a=new yr(n);return n.includeBasicFormulas&&i.Inject(Cr),n.injectedModules&&n.injectedModules.length&&a.inject(n.requiredModules(),n.injectedModules),n.parentObject=t.isNullOrUndefined(e)?n:e,n.grid=n.parentObject,n.parser=new br(n),n}Sr(n,r),i=n,Object.defineProperty(n.prototype,"libraryFormulas",{get:function(){return this.lFormulas},set:function(e){this.lFormulas.set(e.fName,{handler:e.handler,category:e.category,description:e.description})},enumerable:!0,configurable:!0}),n.prototype.getParseArgumentSeparator=function(){return this.isArgumentSeparatorChanged||","===this.parseArgumentSeparator||(this.parseArgumentSeparator=","),this.parseArgumentSeparator},n.prototype.setParseArgumentSeparator=function(e){this.parseArgumentSeparator=e,this.isArgumentSeparatorChanged=!0},n.prototype.getParseDateTimeSeparator=function(){return this.parseDateTimeSeparator},n.prototype.setTreatEmptyStringAsZero=function(e){this.treatEmptyStringAsZero=e},n.prototype.getTreatEmptyStringAsZero=function(){return this.treatEmptyStringAsZero},n.prototype.setParseDateTimeSeparator=function(e){this.parseDateTimeSeparator=e},n.prototype.requiredModules=function(){return P(this)},n.Inject=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.prototype.injectedModules||(this.prototype.injectedModules=[]);for(var r=0;r<e.length;r++)-1===this.prototype.injectedModules.indexOf(e[r])&&this.prototype.injectedModules.push(e[r])},n.prototype.getInjectedModules=function(){return this.injectedModules},n.prototype.onPropertyChanged=function(e,t){},n.prototype.getModuleName=function(){return"calculate"},n.prototype.getFormulaCharacter=function(){return"="},n.prototype.isUpperChar=function(e){var t=e.charCodeAt(0);return t>64&&t<91},n.prototype.resetKeys=function(){this.storedData.clear(),this.keyToRowsMap.clear(),this.rowsToKeyMap.clear()},n.prototype.updateDependentCell=function(e){var t=this.getSheetFamilyItem(this.grid),r=this.cell;if(r!==this.emptyString){if(null!==t.sheetNameToParentObject){var n=t.parentObjectToToken.get(this.grid);-1===r.indexOf(this.sheetToken)&&(r=n+r),-1===e.indexOf(this.sheetToken)&&(e=n+e)}if(this.getDependentCells().has(e)){var i=this.getDependentCells().get(e);i.indexOf(r)<0&&i.push(r)}else this.getDependentCells().set(e,[r]);this.addToFormulaDependentCells(e)}},n.prototype.addToFormulaDependentCells=function(e){var t=this.cell,r=this.getSheetFamilyItem(this.grid);null!=r.sheetNameToParentObject&&-1===t.indexOf(this.sheetToken)&&(t=r.parentObjectToToken.get(this.grid)+t),this.getDependentFormulaCells().has(t)?this.getDependentFormulaCells().get(t).has(e)||this.getDependentFormulaCells().get(t).set(e,e):(this.getDependentFormulaCells().set(t,new Map),this.getDependentFormulaCells().get(t).set(e,e))},n.prototype.getDependentCells=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null==e.sheetDependentCells&&(e.sheetDependentCells=new Map),e.sheetDependentCells}return null==this.dependentCells&&(this.dependentCells=new Map),this.dependentCells},n.prototype.getDependentFormulaCells=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null==e.sheetDependentFormulaCells&&(e.sheetDependentFormulaCells=new Map),e.sheetDependentFormulaCells}return null==this.dependentFormulaCells&&(this.dependentFormulaCells=new Map),this.dependentFormulaCells},n.prototype.getLibraryFormulas=function(){return this.lFormulas},n.prototype.getFunction=function(e){return this.getLibraryFormulas().has(e.toUpperCase())?this.getLibraryFormulas().get(e.toUpperCase()).handler:null},n.prototype.intToDate=function(e){var t=Number(e);return(t=t>0&&t<1?1+t:0===t?1:t)>60&&(t-=1),new Date(864e5*(t-1)+new Date("01/01/1900").getTime())},n.prototype.getFormulaInfoTable=function(){if(this.isSheetMember()){var e=this.getSheetFamilyItem(this.grid);return null===e.sheetFormulaInfotable&&(e.sheetFormulaInfotable=new Map),e.sheetFormulaInfotable}return null===this.formulaInfoTable&&(this.formulaInfoTable=new Map),this.formulaInfoTable},n.prototype.getFormula=function(e){return e=e.toUpperCase(),this.storedData.has(e)?this.storedData.get(e).getFormulaText():""},n.prototype.getParseDecimalSeparator=function(){return this.isParseDecimalSeparatorChanged||"."===this.parseDecimalSeparator||(this.parseDecimalSeparator="."),this.parseDecimalSeparator},n.prototype.setParseDecimalSeparator=function(e){this.parseDecimalSeparator=e,this.isParseDecimalSeparatorChanged=!0},n.prototype.getSheetToken=function(t){var r=0,n=this.emptyString;if(r<t.length&&t[r]===this.sheetToken){for(r++;r<t.length&&t[r]!==this.sheetToken;)r++;n=t.substring(0,r+1)}if(r<t.length)return n;throw this.formulaErrorStrings[e.FormulasErrorsStrings.bad_index]},n.prototype.getSheetID=function(e){var t=this.getSheetFamilyItem(e);if(null!=t.sheetNameToParentObject&&t.sheetNameToParentObject.size>0){var r=t.parentObjectToToken.get(e);if(r){r=r.split(this.sheetToken).join(this.emptyString);var n=this.parseFloat(r);if(!this.isNaN(n))return n}}return-1},n.prototype.parseFloat=function(e){return Number(e)},n.prototype.rowIndex=function(t){var r=0,n=!1;if(r<t.length&&t[r]===this.sheetToken){for(r++;r<t.length&&t[r]!==this.sheetToken;)r++;r++}for(;r<t.length&&this.isChar(t[r]);)n=!0,r++;var i=parseInt(t.substring(r),10);if(r<t.length&&!this.isNaN(i))return i;if(n)return-1;throw this.formulaErrorStrings[e.FormulasErrorsStrings.bad_index]},n.prototype.colIndex=function(e){var t=0,r=0;if(e=e.toUpperCase(),t<e.length&&e[t]===this.sheetToken){for(t++;t<e.length&&e[t]!==this.sheetToken;)t++;t++}for(;t<e.length&&this.isChar(e[t]);)r=26*r+e[t].charCodeAt(0)-64,t++;return 0===r?-1:r},n.prototype.getErrorStrings=function(){return null===this.errorStrings&&(this.errorStrings=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!"]),this.errorStrings},n.prototype.substring=function(e,t,r){return e.substring(t,r+t)},n.prototype.isChar=function(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122},n.prototype.getSheetFamilyItem=function(e){if(0===this.sheetFamilyID)return null==this.defaultFamilyItem&&(this.defaultFamilyItem=new Rr),this.defaultFamilyItem;null==this.sheetFamiliesList&&(this.sheetFamiliesList=new Map);var t=this.modelToSheetID.get(e);return this.sheetFamiliesList.has(t)||this.sheetFamiliesList.set(t,new Rr),this.sheetFamiliesList.get(t)},n.prototype.setKeyValue=function(e,t){e=e.toUpperCase();var r=t.toString().trim();this.storedData.get(e)&&0!==r.indexOf(this.leftBrace)||(this.storedData.set(e,new Er),this.keyToRowsMap.set(e,this.keyToRowsMap.size+1),this.rowsToKeyMap.set(this.rowsToKeyMap.size+1,e));var n=this.storedData.get(e);if(null!=n.getFormulaText()&&n.getFormulaText().length>0&&n.getFormulaText()!==r){var i=this.cellPrefix+this.keyToRowsMap.get(e).toString();null!=this.getDependentFormulaCells().get(i)&&this.clearFormulaDependentCells(i)}r.length>0&&r[0]===this.getFormulaCharacter()?n.setFormulaText(r):n.getFormulaValue()!==r&&(n.setFormulaText(""),n.setParsedFormula(""),n.setFormulaValue(r))},n.prototype.clearFormulaDependentCells=function(e){var t=this,r=this.getDependentFormulaCells().get(e);null!=r&&(r.forEach(function(r,n){var i=n,a=t.getDependentCells().get(i);t.arrayRemove(a,e),0===a.length&&t.getDependentCells().delete(i)}),this.getDependentFormulaCells().delete(e))},n.prototype.arrayRemove=function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},n.prototype.getKeyValue=function(e){if(e=e.toUpperCase(),null!==this.storedData.has(e)){var r=this.storedData.get(e),n=r.getFormulaText();if(n.length>0&&n[0]===this.getFormulaCharacter()){this.cell=this.cellPrefix+this.keyToRowsMap.get(e).toString(),n=n.substring(1);try{r.setParsedFormula(this.parser.parseFormula(n,e))}catch(t){i={message:t.message,exception:t,isForceCalculable:!1,computeForceCalculate:!1};return this.trigger("onFailure",i),r.setFormulaValue(i.message),this.storedData.get(e).getFormulaValue()}try{r.setFormulaValue(this.computeFormula(r.getParsedFormula()))}catch(e){var i={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",i);var a="string"==typeof i.exception?i.exception:i.message;return(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+a}}return this.storedData.get(e).getFormulaValue()}return this.emptyString},n.prototype.getNamedRanges=function(){return this.namedRanges},n.prototype.addNamedRange=function(e,t){var r=e.split(this.sheetToken);if(r.length>1){if(!this.getSheetFamilyItem(this.grid).parentObjectToToken.get(r[0]))return!1;e=r[0]+this.sheetToken+r[1].toUpperCase()}else e=e.toUpperCase();return this.namedRanges.set(e,t),!0},n.prototype.removeNamedRange=function(e){return e=e.toUpperCase(),null!=this.namedRanges.get(e)&&(this.namedRanges.delete(e),!0)},n.prototype.convertAlpha=function(e){for(var t=[],r=0;e>0;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a<r;a++)i[r-a-1]=t[a];return i.join("")},n.prototype.getCellCollection=function(e){if(e.indexOf(":")<0){if(!this.isCellReference(e))return e.split(this.getParseArgumentSeparator());e=e+":"+e}var t=this.emptyString,r=e.indexOf(this.sheetToken);if(r>-1)for(var n=r+1;n<e.length;){if(e[n]===this.sheetToken){t=e.substr(0,n+1);break}n++}var i,a,o,s,l=e.indexOf(":");if(l>0&&this.isChar(e[l-1]))for(var h=l-2;h>=0&&this.isDigit(e[h]);)h--;i=this.rowIndex(this.substring(e,0,l)),a=this.rowIndex(this.substring(e,l+1,l+e.length-l-1)),o=this.colIndex(this.substring(e,0,l)),s=this.colIndex(this.substring(e,l+1,l+e.length-l-1)),i>a&&(l=a,a=i,i=l),o>s&&(l=s,s=o,o=l);var d,p=[],c=0;for(l=i;l<=a;l++)for(d=o;d<=s;d++)p[c]=t+this.emptyString+this.convertAlpha(d)+l.toString(),c++;return p},n.prototype.computeFormula=function(r){var n,i,a,o,s=!1;if(this.parser.isError)return r;n=this.parser.isFormulaParsed?r:this.parser.parseFormula(r),this.parser.isFormulaParsed=!1;try{if((i=this.findLastIndexOfq(n))>0&&(s=!0),n!==this.emptyString&&i>-1)for(var l=i+1;l>-1;)if(n[l]===this.rightBracket){var h=n.substring(i,l+1),d=h.split(this.leftBracket)[0].split("q").join(this.emptyString),p=void 0;if(this.getLibraryFormulas().get(d.toUpperCase()).isCustom){p=h.substring(h.indexOf(this.leftBracket)+1,h.indexOf(this.rightBracket)).split(this.getParseArgumentSeparator());var c=0,u=[];for(c=0;c<p.length;c++)u.push(this.getValueFromArg(p[c]));p=u}else if(p=h.substring(h.indexOf(this.leftBracket)+1,h.indexOf(this.rightBracket)).replace(",n",",").split(this.getParseArgumentSeparator()),h.includes(this.getParseArgumentSeparator()+this.tic))for(var f=null,g=0;g<p.length;g++)p[g]&&p[g][0]===this.tic&&p[g][p[g].length-1]!==this.tic&&(f=g),null!==f&&f===g-1&&p[g][0]!=this.tic&&p[g][p[g].length-1]===this.tic&&(p[f]=p[f]+this.getParseArgumentSeparator()+p[g],p.splice(g,1),f=null);if(a=t.isNullOrUndefined(this.getFunction(d))?this.getErrorStrings()[e.CommonErrors.name]:this.getFunction(d).apply(void 0,p),!s)break;o=this.processNestedFormula(n,h,a);var m=this.findLastIndexOfq(o);0===m&&(s=!1),-1===m&&(a=this.computeValue(o)),i=l=m,n=o}else l++;else this.formulaErrorStrings.indexOf(n)>-1?a=n:n!==this.emptyString&&-1===i&&(a=this.computeValue(n))}catch(e){p={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",p);var v="string"==typeof p.exception?p.exception:p.message;a=(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+v}return a},n.prototype.computeSumIfAndAvgIf=function(r){if(t.isNullOrUndefined(r)||r[0]===this.emptyString||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var n=r,i=0;i<n.length;i++)if(this.isCellReference(n[i])&&t.isNullOrUndefined(n[i].match(/[0-9]/))&&n[i].indexOf("!")<0){var a=n[i].split(":");n[i]=a[0]+"1:"+a[1]+this.spreadSheetUsedRange[0]}var o=n.length;if(2!==o&&3!==o&&0===o)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var s=n[0],l=n[1].trim();if((l=l.split(this.tic).join(this.emptyString)).length>255)return this.getErrorStrings()[e.CommonErrors.value];var h=l.includes("*"),d=h?l.replace(/\*/g,"").trim():l;d=this.isCellReference(d)?this.getValueFromArg(d):l,h&&("*"===l[0]&&(d="*"+d),"*"===l[l.length-1]&&(d+="*")),l=d;var p=this.parser.tokenEqual;l.startsWith("<=")?(p=this.parser.tokenLessEq,l=l.substring(2)):l.startsWith(">=")?(p=this.parser.tokenGreaterEq,l=l.substring(2)):l.startsWith("<>")?(p=this.parser.tokenNotEqual,l=l.substring(2)):l.startsWith("<")?(p=this.parser.tokenLess,l=l.substring(1)):l.startsWith(">")?(p=this.parser.tokenGreater,l=l.substring(1)):l.startsWith("=")&&(p=this.parser.tokenEqual,l=l.substring(1));var c=this.parseFloat(l),u=n[0],f=this.getCellCollection(o>2?n[2]:s),g=this.getCellCollection(u),m=this.getComputeSumIfValue(g,f,l,c,p,h);return[m[0],m[1]]},n.prototype.findWildCardValue=function(e,t){var r="";if(e.indexOf("?")>-1){var n=e[(o=e.indexOf("?"))-1],i=e[o+1];if(t.indexOf(n)>-1&&t.indexOf(i)>-1){var a=t.indexOf(n);r=t[a]===n&&t[a+2]===i?e:t}else r=t}else if(e.indexOf("*")>-1){for(var o=e.indexOf("*"),s="",l="",h=this.falseValue,d=this.falseValue,p=o-1;p>=0;p--)s+=e[p],d=this.trueValue;for(p=o+1;p<e.length;p++)l+=e[p],h=this.trueValue;var c=""===s?-1:t.indexOf(s.split("").reverse().join("")),u=""===l?-1:t.indexOf(l);c>-1||u>-1?d===this.trueValue?r=s.split("").reverse().join("")===t.substr(0,s.length)?e:t:h===this.trueValue&&(r=l===t.substring(t.length-l.length,t.length)?e:t):r=t}return r},n.prototype.getComputeSumIfValue=function(e,t,r,n,i,a){var o=0,s=0;a&&r&&r[0];switch(i){case this.parser.tokenEqual:for(var l=a?r.replace(/\*/g,""):r,h=0;h<e.length;h++){var d=this.getValueFromArg(e[h].split(this.tic).join("")),p=this.parseFloat(d);if(d===r&&p===n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}else d===r?(o+=this.getValueFromRange(t,h),s+=1):a&&l&&d&&("*"===r[0]&&l.length<=d.length&&l===d.slice(0,l.length)&&(o+=this.getValueFromRange(t,h),s+=1),"*"===r[r.length-1]&&l.length<=d.length&&l===d.slice(d.length-l.length,d.length)&&(o+=this.getValueFromRange(t,h),s+=1))}break;case this.parser.tokenLess:for(h=0;h<e.length;h++){d=this.getValueFromArg(e[h].split(this.tic).join(""));if((p=this.parseFloat(d))<n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenGreater:for(h=0;h<e.length;h++){d=this.getValueFromArg(e[h].split(this.tic).join(""));if((p=this.parseFloat(d))>n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenLessEq:for(h=0;h<e.length;h++){d=this.getValueFromArg(e[h].split(this.tic).join(""));if((p=this.parseFloat(d))<=n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenGreaterEq:for(h=0;h<e.length;h++){d=this.getValueFromArg(e[h].split(this.tic).join(""));if((p=this.parseFloat(d))>=n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenNotEqual:for(h=0;h<e.length;h++){var d=this.getValueFromArg(e[h].split(this.tic).join("")),p=this.parseFloat(d);if(d!==r&&p!==n){var c=this.getValueFromArg(t[h].split(this.tic).join("")),u=this.parseFloat(c);o+=u,s+=1}}}return[o,s]},n.prototype.getValueFromRange=function(e,t){var r=e[t];return r=this.getValueFromArg(r),this.parseFloat(r.toString())},n.prototype.computeAndOr=function(t,r){var n,i,a="and"===r;if(0===t.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var o=0,s=t.length;o<s;o++)if(t[o].split(this.tic).join("").trim()===this.emptyString)return this.getErrorStrings()[e.CommonErrors.value];for(var l=t,h=0;h<l.length;h++){if(l[h]===this.tic)return this.getErrorStrings()[e.CommonErrors.value];if(l[h].indexOf(":")>-1&&this.isCellReference(l[h]))for(var d=this.getCellCollection(l[h]),p=0;p<d.length;p++){if(this.getErrorStrings().indexOf(d[p])>-1)return d[p];if(d[p][0]===this.tic)return this.getErrorStrings()[e.CommonErrors.name];if(""===(n=this.getValueFromArg(d[p]))&&(n=this.trueValue),this.getErrorStrings().indexOf(n)>-1)return n;i=this.parseFloat(n)}else{if(n=this.getValueFromArg(l[h]).split(this.tic).join("").toUpperCase(),this.getErrorStrings().indexOf(n)>-1)return n;var c=Date.parse(n.split(this.tic).join(""));if(isNaN(c)){if(n!==this.trueValue&&n!==this.falseValue)return this.getErrorStrings()[e.CommonErrors.value].toString()}else a=!0;i=this.parseFloat(n)}a="and"===r?a&&(n===this.trueValue||!isNaN(i)):a||n===this.trueValue||!isNaN(i)}return a?this.trueValue:this.falseValue},n.prototype.removeTics=function(e){return e.length>1&&e[0]===this.tic[0]&&e[e.length-1]===this.tic[0]&&(e=this.substring(e,1,e.length-2)),e},n.prototype.getCellFrom=function(e){var t,r="",n=e.indexOf(":")>-1?e.split(":"):[e],i=n.length-1,a=this.rowIndex(n[0]);if(a===this.rowIndex(n[i])){var o=this.colIndex(n[0]),s=this.colIndex(n[i]),l=this.colIndex(this.cell);l>=o&&l<=s&&(r=V(l).toString()+a.toString())}else if(this.colIndex(n[0])===this.colIndex(n[i])){t=this.colIndex(n[0]);var h=this.rowIndex(n[i]),d=this.rowIndex(this.cell);d>=a&&d<=h&&(r=V(t).toString()+d.toString())}return r},n.prototype.computeValue=function(t){try{var r=[],n=0,i="";for(r.length=0;n<t.length;){var a="u"===t[n];if(t[n]!==this.arithMarker){if(this.isDigit(t[n])){for(o=this.emptyString;n<t.length&&(this.isDigit(t[n])||t[n]===this.parseDecimalSeparator);)o+=t[n],n+=1;if(r.push(o),!t[n])return r.toString()}if(t[n]===this.sheetToken){for(i=t[n],n+=1;n<t.length&&t[n]!==this.sheetToken;)i+=t[n],n+=1;n<t.length&&(i+=t[n],n+=1)}else if(this.isUpperChar(t[n])){for(var o=this.emptyString,s="";n<t.length&&this.isUpperChar(t[n]);)o+=t[n],n+=1;for(;n<t.length&&this.isDigit(t[n]);)o+=t[n],n+=1;if(n<t.length&&":"===t[n]){if(o+=t[n],(n+=1)<t.length&&t[n]===this.sheetToken)for(o+=t[n],n+=1;n<t.length&&t[n]!==this.sheetToken;)o+=t[n],n+=1;for(;n<t.length&&this.isUpperChar(t[n]);)o+=t[n],n+=1;for(;n<t.length&&this.isDigit(t[n]);)o+=t[n],n+=1;o=i+this.getCellFrom(o)}else o=i+o;if("string"==typeof(s=this.getParentObjectCellValue(o).toString())&&this.getErrorStrings().indexOf(s)>-1)return s;r.push(s)}else if("q"===t[n]){var l=t.substring(n+1).indexOf(this.leftBracket),h=t.substring(n+l+1).indexOf(this.rightBracket);t=this.substring(t,n+l+2,h-1)}else if(t[n]===this.tic[0]){o=t[n].toString();for(n+=1;n<t.length&&t[n]!==this.tic[0];)o+=t[n],n+=1;r.push(o.split(this.tic).join(this.emptyString)),n+=1}else if("%"===t[n]&&r.length>0){var d=r[0],p=this.parseFloat(d);this.isNaN(p)||(r.pop(),r.push((p/100).toString())),n+=1}else if(0===t.substring(n).indexOf(this.trueValue))r.push(this.trueValue),n+=this.trueValue.length;else if(0===t.substring(n).indexOf(this.falseValue))r.push(this.falseValue),n+=this.falseValue.length;else if(t[n]===this.tic[0]||"|"===t[n]){o=t[n].toString();for(n++;n<t.length&&t[n]!==this.tic[0];)o+=t[n],n+=1;r.push(o+this.tic),n+=1}else switch(t[n]){case"#":var c=0;this.getErrorStrings().indexOf(t.substring(n))>-1?(c=-1===t.indexOf("!")||-1===t.substring(n).indexOf("!")?t.indexOf("#N/A")>-1?t.indexOf("#N/A")+4+n:t.indexOf("?")+1+n:t.indexOf("!")+1+n,r.push(this.substring(t,n,c-n))):(c=n+1,r.push(this.substring(t,n,c-n))),n=c;break;case"n":n+=1;o="";if(0===t.substring(n).indexOf("Infinity"))n+=(o="Infinity").length;else{for(("u"===t[n]||a)&&(o="-",a?a=!1:n+=1);n<t.length&&this.isDigit(t[n])||t[n]===this.getParseDecimalSeparator();)o+=t[n],n+=1;if(n<t.length&&"%"===t[n])if(n+=1,""===o){if(r.length>0){var d=r[0],p=this.parseFloat(d);this.isNaN(p)||(r.pop(),r.push((p/100).toString()))}}else o=(this.parseFloat(o)/100).toString()}r.push(o);break;case this.parser.tokenAdd:this.getValArithmetic(r,"add"),n+=1;break;case this.parser.tokenSubtract:this.getValArithmetic(r,"sub"),n+=1;break;case this.parser.tokenMultiply:this.getValArithmetic(r,"mul"),n+=1;break;case this.parser.tokenDivide:this.getValArithmetic(r,"div"),n+=1;break;case this.parser.tokenLess:this.processLogical(r,"less"),n+=1;break;case this.parser.tokenGreater:this.processLogical(r,"greater"),n+=1;break;case this.parser.tokenGreaterEq:this.processLogical(r,"greaterEq"),n+=1;break;case this.parser.tokenLessEq:this.processLogical(r,"lessEq"),n+=1;break;case this.parser.tokenNotEqual:this.processLogical(r,"notEq"),n+=1;break;case this.parser.tokenOr:this.processLogical(r,"or"),n+=1;break;case this.parser.tokenAnd:this.processLogical(r,"and"),n+=1;break;case this.parser.tokenEqual:this.processLogical(r,"equal"),n+=1;break;default:return this.getErrorStrings()[e.CommonErrors.value]}}else n+=1}if(0===r.length)return this.emptyString;for(var o=this.emptyString,u=r.length;u>0;){if((o=r.pop()+o)===this.emptyString&&this.isCellReference(t)&&this.getTreatEmptyStringAsZero())return"0";u--}return o}catch(t){if(this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1)throw t;throw new Ir(this.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression])}},n.prototype.getValArithmetic=function(t,r){var n=t.pop();n=n===this.emptyString?"0":n;var i=Number(n);if(isNaN(i))throw n===this.getErrorStrings()[e.CommonErrors.divzero]?this.getErrorStrings()[e.CommonErrors.divzero]:this.getErrorStrings()[e.CommonErrors.value];var a=t.pop();if(a=a===this.emptyString?t.length?t.pop():"0":a,i=Number(a),isNaN(i))throw n===this.getErrorStrings()[e.CommonErrors.divzero]?this.getErrorStrings()[e.CommonErrors.divzero]:this.getErrorStrings()[e.CommonErrors.value];"add"===r&&t.push((Number(a)+Number(n)).toString()),"sub"===r&&t.push((Number(a)-Number(n)).toString()),"mul"===r&&t.push((Number(a)*Number(n)).toString()),"div"===r&&(this.isNaN(this.parseFloat(n))||this.isNaN(this.parseFloat(a))?t.push(this.getErrorStrings()[e.CommonErrors.value]):0===this.parseFloat(n)?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push((Number(a)/Number(n)).toString()))},n.prototype.processLogical=function(e,t){var r,n,i,a;"and"!==t&&"equal"!==t&&(r=e.pop(),n=e.pop(),i=r.indexOf(this.tic)>-1?r:this.parseFloat(r),a=n.indexOf(this.tic)>-1?n:this.parseFloat(n));var o;return"less"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:a<i?this.trueValue:this.falseValue),"greater"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))>0?this.trueValue:this.falseValue:a>i?this.trueValue:this.falseValue),"lessEq"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:a<=i?this.trueValue:this.falseValue),"greaterEq"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))>=0?this.trueValue:this.falseValue:a>=i?this.trueValue:this.falseValue),"notEq"===t&&(o=n!==r?this.trueValue:this.falseValue),"and"===t&&(r=e.pop().toString(),n="",e.length>0&&(n=e.pop().toString()),o=(o=this.emptyString+n+r+this.emptyString).split(this.tic).join("")),"equal"===t&&(r=e.pop().toString(),""===(n=e.pop().toString())&&""!==r&&(n="0"),o=r===n?this.trueValue:this.falseValue),"or"===t&&(o=Math.pow(this.parseFloat(a),this.parseFloat(i)).toString()),e.push(o),o},n.prototype.computeStoreCells=function(e){for(var t=e.cellValue,r=e.cellRange,n=e.criteria,i=e.argArray,a=e.isCriteria,o=e.storedCells,s=e.isCountIfS,l=e.countVal,h=a===this.trueValue?o:t,d=[],p=0;p<h.length;p++){var c=[],u=this.getValueFromArg(t[p]),f=void 0,g="";if(f=i[2].split(this.tic).join(this.emptyString),f=this.isCellReference(f)?this.getValueFromArg(f):f,(a=s===this.trueValue?this.trueValue:a)===this.trueValue){var m="",v=0,y=0;for(o[p]=s===this.trueValue&&0===l?t[p]:o[p],m=o[p];!this.isDigit(m[v]);)v+=1;if(this.isCellReference(r[l])&&r[l].indexOf(":")>-1){var C=r[l].indexOf(":");for(g=this.substring(r[l],C);!this.isDigit(g[y]);)y+=1}var b=this.substring(m,v),S=this.substring(g,y);g=o[p].split(b).join(S),u=this.getValueFromArg(g),f=s===this.trueValue?n[l].split(this.tic).join(this.emptyString):n[l-1].split(this.tic).join(this.emptyString)}var x="equal";f.startsWith("<=")?(x="lessEq",f=f.substring(2)):f.startsWith(">=")?(x="greaterEq",f=f.substring(2)):f.startsWith("<>")?(x="notEq",f=f.substring(2)):f.startsWith("<")?(x="less",f=f.substring(1)):f.startsWith(">")?(x="greater",f=f.substring(1)):f.startsWith("=")&&(x="equal",f=f.substring(1)),(f.indexOf("*")>-1||f.indexOf("?")>-1)&&(u=this.findWildCardValue(f,u)),c.push(u.toLowerCase()),c.push(f.toLowerCase()),this.processLogical(c,x)===this.trueValue&&(a===this.falseValue?d.push(t[p]):d.push(g))}return o=d,d=[],o},n.prototype.computeIfsFormulas=function(r,n,i){if(t.isNullOrUndefined(r)||""===r[0]||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=r,o=a.length;if(o<2||o>127)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=[],l=[],h=[],d=0,p=0;p<a.length;p++)a[p].indexOf(":")>-1&&this.isCellReference(a[p])?s.push(a[p]):l.push(a[p]);s=(s=s.toString().split(",,").join(",")).split(this.getParseArgumentSeparator());for(var c=[],p=0;p<s.length;p++)c.push(this.getCellCollection(s[p]).length);for(v=0;v<c.length;v++)if(c[v]&&c[v+1]&&c[v]!==c[v+1])return this.getErrorStrings()[e.CommonErrors.value];var u,f;if(n===this.falseValue){f=this.falseValue;g={cellValue:u=this.getCellCollection(s[1]),cellRange:s,criteria:l,argArray:a,isCriteria:f,storedCells:h,isCountIfS:n};if(h=this.computeStoreCells(g),0===h.length)return i===this.trueValue?this.getErrorStrings()[e.CommonErrors.divzero]:0}for(p=n===this.trueValue?0:2;p<s.length;p++){f=this.trueValue,f=n===this.trueValue&&0===p?this.falseValue:this.trueValue;var g={cellValue:u=this.getCellCollection(s[p]),cellRange:s,criteria:l,argArray:a,isCriteria:f,storedCells:h,isCountIfS:n,countVal:p};if(h=this.computeStoreCells(g),0===h.length)return 0}for(var m=0,v=0;v<h.length;v++){var y="",C="",b=0,S=0;for(y=h[v];!this.isDigit(y[b]);)b+=1;if(this.isCellReference(s[0])&&s[0].indexOf(":")>-1){var x=s[0].indexOf(":");for(C=this.substring(s[0],x);!this.isDigit(C[S]);)S+=1}var w=this.substring(y,b),I=this.substring(C,S);if(u=h[v].split(w).join(I),n===this.trueValue)d+=1;else{m++;var E=this.getValueFromArg(u);d+=parseFloat(""===E?"0":E)}}return i===this.trueValue&&(d/=m),d},n.prototype.processNestedFormula=function(e,t,r){return e.split(t).join("n"+r)},n.prototype.isNaN=function(e){return"NaN"===e.toString()||"string"==typeof e},n.prototype.fromOADate=function(e){var t=new Date;return t.setTime(e*this.millisecondsOfaDay+Date.parse(this.oaDate.toString())),t},n.prototype.getSerialDateFromDate=function(e,t,r){var n=0;e<1900&&(e+=1900);for(var i=!1;!i;){for(;t>12;)e++,t-=12;i=!0;for(var a=new Date(e,t,1,-1).getDate();r>a;)a=new Date(e,t,1,-1).getDate(),t++,r-=a,i=!1;r<1&&(t--,r=(a=new Date(e,t,1,-1).getDate())-r)}var o=Date.parse(e.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+r.toString());return this.isNaN(o)||(n=this.toOADate(new Date(o))),n},n.prototype.toOADate=function(e){return(e.getTime()-Date.parse(this.oaDate.toString()))/this.millisecondsOfaDay},n.prototype.calculateDate=function(e){return this.parseFloat(e)<10?"0"+e:e},n.prototype.isTextEmpty=function(e){return null===e||""===e},n.prototype.isDigit=function(e){var t=e.charCodeAt(0);return t>47&&t<58},n.prototype.findLastIndexOfq=function(e){return e.lastIndexOf("q")},n.prototype.getValueFromArg=function(r){var n=r=r.trim(),i=this.dateTime1900,a=n;if(t.isNullOrUndefined(n)||this.isTextEmpty(n))return n;if(r[0]===this.tic||r[0]===this.singleTic)return i=this.isDate(r.split(this.tic).join("")),this.isNaN(this.parseFloat(r.split(this.tic).join("")))&&!t.isNullOrUndefined(i)&&!this.isNaN(i.getDate())&&this.dateTime1900<=i?this.toOADate(i).toString():r;if(r=r.split("u").join("-"),!this.isUpperChar(n[0])&&(this.isDigit(n[0])||n[0]===this.getParseDecimalSeparator()||"-"===n[0]||"n"===n[0]))return"n"===n[0]&&(n=n.substring(1)).indexOf('"n')>-1&&(n=n.replace('"n','"')),n;var o=["+","-","/","*",")",")","{"];if(-1===this.parser.indexOfAny(n,o)&&this.isUpperChar(n[0])||n[0]===this.sheetToken){if(n!==this.trueValue&&n!==this.falseValue&&this.isCellReference(n)){var s=this.getSheetFamilyItem(this.grid);null!==s.sheetNameToParentObject&&s.sheetNameToParentObject.size>0&&-1===n.indexOf(this.sheetToken)&&(n=s.parentObjectToToken.get(this.grid)+n)}if(n===this.cell){var l=this.getDependentCells().get(n);throw null!=l&&l.indexOf(n)>-1&&this.arrayRemove(l,n),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference]+n}return a=this.getParentObjectCellValue(n),this.updateDependentCell(n),a.toString()}return this.getErrorStrings().indexOf(r)>-1?r:this.computeValue(a.toString())},n.prototype.isDate=function(e){if("object"==typeof e||null!==Date.parse(e)){var t=new Date(Date.parse(e));return t>=this.dateTime1900?t:null}return null},n.prototype.isValidCellReference=function(e){var r=0,n=0,i=[89,71,69],a=this.emptyString;if(this.namedRanges.has(e))return!1;for(var o=0;o<e.length;o++)this.isChar(e[o])&&r++;if((a=e.substring(0,r)).length<4){for(;n<a.length;){if(t.isNullOrUndefined(a[n])||!(a[n].charCodeAt(0)<i[n])){if(t.isNullOrUndefined(a[n])&&n>0)break;return!1}n++}if(this.parseFloat(e.substring(r,e.length))<1048576)return!0}return!1},n.prototype.parseDate=function(t){if(!this.isNaN(t)){if(t instanceof Date)return new Date(t);var r=parseInt(t,10);return r<0?this.getErrorStrings()[e.CommonErrors.num]:r<=60?new Date(this.dateTime1900.getTime()+864e5*(r-1)):new Date(this.dateTime1900.getTime()+864e5*(r-2))}return"string"!=typeof t||(t=new Date(t),this.isNaN(t))?this.getErrorStrings()[e.CommonErrors.value]:t},n.prototype.isCellReference=function(e){if(e===this.emptyString)return!1;e=e.trim(),e=this.setTokensForSheets(e);var t=this.getSheetToken(e),r=!1;""!==t&&(e=e.split(t).join(this.emptyString));var n=!1,i=!1;if(e.indexOf(":")!==e.lastIndexOf(":"))return!1;for(var a=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),o=0;o<a.length;o++)if(this.isChar(a[o]))n=!0;else if(this.isDigit(a[o]))i=!0;else{if(":"!==a[o])return!1;n&&i&&(r=!0),n=!1,i=!1}return e.indexOf(":")>-1&&-1===e.indexOf(this.tic)?!!(r&&n&&i)||!(!(n&&!i||!n&&i)||r):!(!n||!i||-1!==e.indexOf(this.tic))},n.prototype.setTokensForSheets=function(e){var t=this.getSheetFamilyItem(this.grid),r=this.getSortedSheetNames();if(null!=r)for(var n=0;n<r.length;n++){var i=t.sheetNameToToken.get(r[n]);i=i.split(this.sheetToken).join(this.tempSheetPlaceHolder);var a=this.singleTic+"SHEET"+r[n]+this.singleTic+this.sheetToken;-1===e.indexOf(a)&&(a="SHEET"+r[n]+this.sheetToken),e=e.split(a).join(i),a=r[n]+this.sheetToken,e=e.split(a).join(i)}if((e=e.split(this.tempSheetPlaceHolder).join(this.sheetToken)).indexOf("!!")>-1){var o=(e=e.replace("!!","!")).split("");o[1]=(parseInt(o[1],10)+1).toString(),e=o.join("")}return e},n.prototype.getParentObjectCellValue=function(t){if(t===this.trueValue||t===this.falseValue)return t;var r=t.lastIndexOf(this.sheetToken),n=0,i=0,a=this.grid,o=this.getSheetFamilyItem(a);if(r>-1&&null!==o.tokenToParentObject)this.grid=o.tokenToParentObject.get(t.substring(0,r+1)),n=this.rowIndex(t),i=this.colIndex(t);else if(-1===r){for(var s=0;s<t.length&&this.isChar(t[s]);)s++;if(s===t.length)return t=t.toLowerCase(),""===t?this.getErrorStrings()[e.CommonErrors.value]:this.getErrorStrings()[e.CommonErrors.name];n=this.rowIndex(t),i=this.colIndex(t),o.isSheetMember&&null!=o.parentObjectToToken&&(t=o.parentObjectToToken.get(this.grid)+t)}var l=""===this.cell||null===this.cell?"":this.cell;if(this.cell=t,l===this.cell)throw this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference];var h=this.getParentCellValue(n,i,this.grid,l,a);return this.grid=a,this.cell=l,h},n.prototype.getParentCellValue=function(e,r,n,i,a){var o;return void 0!==this.parentObject.getValueRowCol?(i&&(i=a===n?"":i+this.getSheetID(a)),o=this.parentObject.getValueRowCol(this.getSheetID(n),e,r,i),t.isNullOrUndefined(o)?this.emptyString:o.toString()):(""!==(o=this.getValueRowCol(this.getSheetID(n),e,r))&&void 0!==o||(o=""),o)},n.prototype.getValueRowCol=function(e,t,r){var n=this.rowsToKeyMap.get(t).toString(),i=this.getKeyValue(n).toString();if(null!=i&&"%"===i[i.length-1]&&i.length>1){var a=this.parseFloat(i.substring(0,i.length-1));this.isNaN(a)&&(i=(Number(a)/100).toString())}return i},n.prototype.defineFunction=function(e,r){"string"==typeof r&&(r=t.getValue(r,window)),e=e.toUpperCase(),this.libraryFormulas.set(e,{handler:r,isCustom:!0})},n.prototype.valueChanged=function(e,r,n,i){var a=e;this.spreadSheetUsedRange=i,this.grid=e;var o=!0,s=!0,l=this.getSheetFamilyItem(a),h=V(r.getColIndex())+r.getRowIndex().toString();this.actCell=h,null!==l.sheetNameToParentObject&&l.sheetNameToParentObject.size>0&&(h=l.parentObjectToToken.get(a)+h);var d=r.getValue().toUpperCase();if(d.indexOf("=RAND()")>-1||d.indexOf("RAND()")>-1||d.indexOf("=RANDBETWEEN(")>-1||d.indexOf("RANDBETWEEN(")>-1||this.randomValues.has(h)){var p=this.randCollection.toString();this.randomValues.has(h)?this.randomValues.has(h)&&(d.indexOf("=RAND()")>-1||d.indexOf("RAND()")>-1||d.indexOf("=RANDBETWEEN(")>-1||d.indexOf("RANDBETWEEN(")>-1?this.randomValues.set(h,r.getValue()):r.getValue().toUpperCase()!==this.randomValues.get(h.toUpperCase())&&(this.randomValues.delete(h),p=p.split(h+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+h).join("").split(h).join(""),this.randCollection=p.split(this.parseArgumentSeparator)),0===this.randomValues.size&&this.randCollection.length&&(this.isRandomVal=!1,this.randomValues.clear(),this.randCollection=[])):(this.randomValues.set(h,r.getValue()),this.randCollection.push(h),this.isRandomVal=!0)}if(r.getValue()&&r.getValue()[0]===this.getFormulaCharacter()){this.cell=h;var c=void 0;if(t.isNullOrUndefined(s)||(s=n),this.getFormulaInfoTable().has(h)){if(c=this.getFormulaInfoTable().get(h),r.getValue()!==c.getFormulaText()||null==c.getParsedFormula()){c.setFormulaText(r.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{c.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){c.setFormulaValue(e),s=!1}}if(s){this.parser.isFormulaParsed=!0;var u=this.computeFormula(c.getParsedFormula());o=u!==c.getFormulaValue(),c.setFormulaValue(u)}}else{(c=new Er).setFormulaText(r.getValue()),this.getDependentFormulaCells().has(h)||this.getDependentFormulaCells().set(h,new Map);try{c.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){c.setFormulaValue(e),s=!1}s&&c.setFormulaValue(this.computeFormula(c.getParsedFormula())),this.getFormulaInfoTable().has(h),this.getFormulaInfoTable().set(h,c)}s&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(a)+1,c.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(a)+1,c.getFormulaValue(),r.getRowIndex(),r.getColIndex()))}else this.getFormulaInfoTable().has(h)&&(this.getFormulaInfoTable().delete(h),this.getDependentFormulaCells().has(h)&&this.clearFormulaDependentCells(h));s&&o&&this.getDependentCells().has(h)&&this.getDependentCells().get(h).toString()!==h&&(this.getComputedValue().clear(),this.refresh(h))},n.prototype.getComputedValue=function(){return null===this.computedValues&&(this.computedValues=new Map),this.computedValues},n.prototype.setValueRowCol=function(e,t,r,n){},n.prototype.getSortedSheetNames=function(){var e=this.getSheetFamilyItem(this.grid);if(null!=e&&null!=e.sheetNameToToken){var t=[];e.sheetNameToToken.forEach(function(e,r){t.push(r),t.sort()}),this.sortedSheetNames=t,this.sortedSheetNames.sort(),this.sortedSheetNames.length>9&&this.sortedSheetNames[0].includes("1")&&this.sortedSheetNames[1].includes("10")&&(this.sortedSheetNames.splice(this.sortedSheetNames.indexOf("2"),0,this.sortedSheetNames[0]),this.sortedSheetNames.splice(0,1))}return this.sortedSheetNames},n.prototype.getErrorLine=function(e){var t=e.stack?e.stack.split("\n")[1].split(":"):null;return t?t[t.length-2]:null},n.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},n.prototype.computeMinMax=function(r,n){var i,a,o=0;if(t.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=0,l=r.length;s<l;s++)if(r[s].split(this.tic).join("").trim()===this.emptyString)return this.getErrorStrings()[e.CommonErrors.value];i="max"===n?this.minValue:this.maxValue;var h=r;if(h.length>255)return this.getErrorStrings()[e.CommonErrors.value];for(var d=0;d<h.length;d++)if(h[d].indexOf(":")>-1&&this.isCellReference(h[d]))for(var p=this.getCellCollection(h[d]),c=0;c<p.length;c++){if(a=this.getValueFromArg(p[c]),this.getErrorStrings().indexOf(a)>-1)return a;f=this.parseFloat(a);""===a||this.isNaN(this.parseFloat(f))?(o+=1)===p.length&&(i=0):i="max"===n?Math.max(i,f):Math.min(i,f)}else{var u=this.getValueFromArg(h[d]);if(this.getErrorStrings().indexOf(u)>-1)return u;var f=this.parseFloat(u);if(""===u||this.isNaN(this.parseFloat(f))){(o+=1)===a.length&&(i=0);continue}i="max"===n?Math.max(i,f):Math.min(i,f)}return i.toString()},n.prototype.calculateAvg=function(r){for(var n=0,i=r,a=[],o=0,s=0,l=0;l<i.length;l++)if(i[l].indexOf(":")>-1&&this.isCellReference(i[l])){s=0,a=this.getCellCollection(i[l]),o=0;for(var h=0;h<a.length;h++){d=this.getValueFromArg(a[h]);t.isNullOrUndefined(d)||isNaN(this.parseFloat(d))||(o+=this.parseFloat(d),s+=1)}if(0===s)return this.getErrorStrings()[e.CommonErrors.divzero];n=(o/=s)+n}else{if(i[l].indexOf(this.tic)>-1&&isNaN(parseFloat(i[l].split(this.tic).join(""))))return this.getErrorStrings()[e.CommonErrors.value];0===i[l].length&&(i[l]="1");var d=this.getValueFromArg(i[l].split(this.tic).join(""));if(t.isNullOrUndefined(d)||isNaN(this.parseFloat(d)))return this.getErrorStrings()[e.CommonErrors.name];n+=this.parseFloat(d)}return(n/(i.length-0)).toString()},n.prototype.registerGridAsSheet=function(e,r,n){t.isNullOrUndefined(this.modelToSheetID)&&(this.modelToSheetID=new Map),t.isNullOrUndefined(this.modelToSheetID.get(r))&&this.modelToSheetID.set(r,n);var i=this.getSheetFamilyItem(r);i.isSheetMember=!0;var a=e.toUpperCase();if(0===i.parentObjectToToken.size&&(i.parentObjectToToken=new Map),0===i.sheetNameToParentObject.size&&(i.sheetNameToParentObject=new Map),0===i.sheetNameToToken.size&&(i.sheetNameToToken=new Map),0===i.tokenToParentObject.size&&(i.tokenToParentObject=new Map),t.isUndefined(i.sheetNameToParentObject.get(a))){o=this.sheetToken+this.tokenCount.toString()+this.sheetToken;this.tokenCount++,i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o),i.sheetNameToToken.set(a,o),i.sheetNameToParentObject.set(a,r)}else{var o=i.sheetNameToToken.get(a);i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o)}return e},n.prototype.unregisterGridAsSheet=function(e,r,n){var i=this,a=[r];n&&(a=[],t.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(e,t){a.push(t)})),a.forEach(function(t){var r=i.getSheetFamilyItem(t),a=(n?t:e).toUpperCase();if(null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(a)){r.sheetNameToParentObject.delete(a);var o=r.sheetNameToToken.get(a);r.sheetNameToToken.delete(a),r.tokenToParentObject.delete(o),r.parentObjectToToken.delete(t),n&&(r.sheetDependentCells=new Map)}})},n.prototype.computeExpression=function(e){var t=this.parser.parseFormula(e);return this.computeFormula(t)},n.prototype.isSheetMember=function(){var e=this.getSheetFamilyItem(this.grid);return!t.isNullOrUndefined(e)&&e.isSheetMember},n.prototype.dispose=function(){this.resetKeys(),this.namedRanges.clear(),this.lFormulas.clear()},n.prototype.refreshRandValues=function(e){var t,r,n,i,a="",o=this.randCollection.toString();this.randomValues.has(e)&&(this.randomValues.delete(e),o=o.split(e+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+e).join("").split(e).join(""),0===this.randomValues.size&&""===o?(this.randomValues.clear(),this.randCollection=[]):this.randCollection=o.split(this.parseArgumentSeparator));for(var s=0;s<this.randomValues.size;s++)t=this.rowIndex(this.randCollection[s]),r=this.colIndex(this.randCollection[s]),a=(parseFloat(this.getSheetToken(this.randCollection[s]).split(this.sheetToken).join(""))+1).toString(),i=this.getSheetFamilyItem(a),this.grid=i.sheetNameToParentObject.get(a),n=this.randomValues.get(this.randCollection[s]),n=this.computeFormula(n),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,n,t,r):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,n,t,r)},n.prototype.refresh=function(e){if(0===this.dependencyLevel&&this.refreshedCells.clear(),this.getDependentCells().has(e)&&null!==this.getDependentCells().get(e)){var t=this.getSheetFamilyItem(this.grid);this.dependencyLevel=this.dependencyLevel+1;try{var r=this.getDependentCells().get(e),n=void 0;for(n=0;n<r.length;n++){var i=r[n],a=this.getSheetToken(i);a.length&&(this.grid=t.tokenToParentObject.get(a));try{var o=this.rowIndex(i),s=this.colIndex(i),l=this.getFormulaInfoTable().get(i),h=void 0;l&&(this.cell=i,this.getComputedValue().has(i)?h=this.getComputedValue().get(i):(this.parser.isFormulaParsed=!0,h=this.computeFormula(l.getParsedFormula()),this.computedValues.set(i,h)),l.setFormulaValue(h)),void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(this.grid)+1,l.getFormulaValue(),o,s):this.parentObject.setValueRowCol(this.getSheetID(this.grid)+1,l.getFormulaValue(),o,s),this.refreshedCells.has(i)||(this.refreshedCells.set(i,[]),this.refresh(i))}catch(e){continue}}}finally{this.grid=t.tokenToParentObject.get(this.getSheetToken(e)),0===--this.dependencyLevel&&this.refreshedCells.clear()}}};var i;return xr([t.Property(!0)],n.prototype,"includeBasicFormulas",void 0),xr([t.Event()],n.prototype,"onFailure",void 0),n=i=xr([t.NotifyPropertyChanges],n)}(t.Base),Ir=function(){function e(e,t){this.formulaCorrection=!1,this.message=e,this.formulaCorrection=t}return e}(),Er=function(){function e(){this.calcID=Number.MIN_VALUE+1,this.calcID1=Number.MIN_VALUE+1}return e.prototype.getFormulaText=function(){return this.formulaText},e.prototype.setFormulaText=function(e){this.formulaText=e},e.prototype.getFormulaValue=function(){return this.formulaValue},e.prototype.setFormulaValue=function(e){this.formulaValue=e},e.prototype.getParsedFormula=function(){return this.parsedFormula},e.prototype.setParsedFormula=function(e){this.parsedFormula=e},e}(),Rr=function(){function e(){this.isSheetMember=!1,this.parentObjectToToken=new Map,this.sheetDependentCells=new Map,this.sheetDependentFormulaCells=new Map,this.sheetNameToParentObject=new Map,this.sheetNameToToken=new Map,this.tokenToParentObject=new Map,this.sheetFormulaInfotable=new Map}return e}(),kr=function(){function e(e,t,r){return this.row=e,this.col=t,this.value=r,this.getRowIndex=function(){return e},this.setRowIndex=function(t){e=t},this.getColIndex=function(){return t},this.setColIndex=function(e){t=e},this.getValue=function(){return r},this}return e}(),Ar=function(){function r(e){this.uniqueOBracket=String.fromCharCode(129),this.uniqueCBracket=String.fromCharCode(130),this.uniqueCSeparator=String.fromCharCode(131),this.uniqueCOperator=String.fromCharCode(132),this.uniquePOperator=String.fromCharCode(133),this.uniqueSOperator=String.fromCharCode(134),this.uniqueMOperator=String.fromCharCode(135),this.uniqueDOperator=String.fromCharCode(136),this.uniqueModOperator=String.fromCharCode(137),this.uniqueConcateOperator=String.fromCharCode(138),this.uniqueEqualOperator=String.fromCharCode(139),this.uniqueExpOperator=String.fromCharCode(140),this.uniqueGTOperator=String.fromCharCode(141),this.uniqueLTOperator=String.fromCharCode(142),this.sheetInfo=[],this.parent=e,this.init()}return r.prototype.init=function(){this.addEventListener(),this.initCalculate(),this.registerSheet()},r.prototype.destroy=function(){this.removeEventListener(),this.calculateInstance.dispose(),this.calculateInstance=null,this.parent=null},r.prototype.addEventListener=function(){this.parent.on(Et,this.performFormulaOperation,this),this.parent.on("aggregateComputation",this.aggregateComputation,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Et,this.performFormulaOperation),this.parent.off("aggregateComputation",this.aggregateComputation))},r.prototype.getModuleName=function(){return"workbookFormula"},r.prototype.initCalculate=function(){this.calculateInstance=new wr(this.parent),this.calcID=this.calculateInstance.createSheetFamilyID(),this.calculateInstance.setTreatEmptyStringAsZero(!0),this.calculateInstance.grid=this.parent.getActiveSheet().id.toString()},r.prototype.performFormulaOperation=function(e){var t,r,n=e.action,i=this.calculateInstance.getLibraryFormulas(),a=Array.from(i.values());switch(n){case"getLibraryFormulas":e.formulaCollection=Array.from(i.keys());break;case"getFormulaCategory":t=["All"];for(o=1;o<Array.from(i.values()).length;o++)t.indexOf(a[o].category)<0&&t.push(a[o].category);e.categoryCollection=t;break;case"dropDownSelectFormulas":for(o=0;o<Array.from(i.values()).length;o++)e.selectCategory===a[o].category&&(e.formulaCollection[o]=Array.from(i.keys())[o]);break;case"getFormulaDescription":for(o=0;o<Array.from(i.values()).length;o++)e.selectedList===Array.from(i.keys())[o]&&(e.description=a[o].description);break;case"registerSheet":this.registerSheet(e.sheetIndex,e.sheetCount),e.isImport&&this.updateSheetInfo();break;case"unRegisterSheet":this.unRegisterSheet(e.sheetIndex,e.sheetCount,e.propertyChange);break;case"refreshCalculate":e.isFormula&&(e.value=this.autoCorrectFormula(e.value,e.rowIndex,e.colIndex)),this.refreshCalculate(e.rowIndex,e.colIndex,e.value,e.isFormula,e.sheetIndex),e.value=e.value?e.value.toString().split("-*").join("-").split("/*").join("/").split("*/").join("*").split("-/").join("-").split("*+").join("*").split("+*").join("+"):e.value;break;case"getArgumentSeparator":e.argumentSeparator=this.calculateInstance.getParseArgumentSeparator();break;case"addDefinedName":e.isAdded=this.addDefinedName(e.definedName);break;case"removeDefinedName":e.isRemoved=this.removeDefinedName(e.definedName,e.scope);break;case"initiateDefinedNames":this.initiateDefinedNames();break;case"renameUpdation":this.renameUpdation(e.value,e.sheetId);break;case"addSheet":this.sheetInfo.push({visibleName:e.visibleName,sheet:e.sheetName,index:e.index});break;case"getSheetInfo":e.sheetInfo=this.sheetInfo;break;case"deleteSheetTab":r=this.sheetInfo.length;for(var o=0;o<r;o++)if(this.sheetInfo[o].index===e.index){e.sheetName=this.sheetInfo[o].sheet,this.sheetInfo.splice(o,1);break}this.calculateInstance.unregisterGridAsSheet((e.index-1).toString(),e.index),this.calculateInstance.tokenCount=this.calculateInstance.tokenCount-1,this.sheetDeletion(e.sheetName,e.index,e.index);break;case"getReferenceError":e.refError=this.referenceError();break;case"getAlpha":e.col=V(e.col);break;case"addCustomFunction":this.addCustomFunction(e.functionHandler,e.functionName);break;case"computeExpression":e.calcValue=this.calculateInstance.computeExpression(e.formula);break;case"registerGridInCalc":this.calculateInstance.grid=e.sheetID;break;case"refreshInsDelFormula":this.refreshInsDelFormula(e.insertArgs);break;case"refreshNamedRange":this.refreshNamedRange(e.insertArgs)}},r.prototype.referenceError=function(){return this.calculateInstance.getErrorStrings()[e.CommonErrors.ref]},r.prototype.getSheetInfo=function(){return this.sheetInfo},r.prototype.addCustomFunction=function(e,t){this.calculateInstance.defineFunction(t,e)},r.prototype.updateSheetInfo=function(){var e=this;this.sheetInfo=[],this.parent.sheets.forEach(function(t,r){e.sheetInfo.push({visibleName:t.name,sheet:"Sheet"+t.id,index:r})})},r.prototype.sheetDeletion=function(e,r,n){var i,a,o=[],s=null,l="";this.calculateInstance.getDependentCells().forEach(function(e,t){o.push(t)}),this.removeSheetTokenIndex(l,n);for(var h=0;h<o.length;h++)for(var d=this.calculateInstance.getDependentCells().get(o[h]),p=0;p<d.length;p++)s=this.calculateInstance.getFormulaInfoTable().get(d[p]),r=parseInt(d[p].split("!")[1],10)+1,!t.isNullOrUndefined(s)&&r>-1&&(l=s.formulaText).toUpperCase().indexOf(e.toUpperCase())>-1&&(l=l.toUpperCase().split(e.toUpperCase()+this.calculateInstance.sheetToken).join(this.referenceError()),i=this.calculateInstance.rowIndex(d[p]),a=this.calculateInstance.colIndex(d[p]),this.updateDataContainer([i-1,a-1],{value:l,sheetId:r,visible:!1}),this.calculateInstance.refresh(s.getParsedFormula())),e.split("Sheet")[1]===o[h].split("!")[1]&&(this.calculateInstance.getFormulaInfoTable().delete(o[h]),this.calculateInstance.clearFormulaDependentCells(o[h]))},r.prototype.removeSheetTokenIndex=function(e,t){var r=this.calculateInstance.getSheetFamilyItem(this.calculateInstance.grid);return r.sheetNameToToken.delete(t.toString()),r.sheetNameToParentObject.delete(t.toString()),r.parentObjectToToken.delete(t.toString()),r.tokenToParentObject.delete("!"+(t-1).toString()+"!"),e},r.prototype.renameUpdation=function(e,t){var r,n,i,a=[],o="",s=[],l=!1;this.calculateInstance.getDependentCells().forEach(function(e,t){a.push(t)});for(d=0;d<this.sheetInfo.length;d++)if(this.sheetInfo[d].index===t){this.sheetInfo[d].visibleName=e;break}for(var h=this.sheetInfo,d=0;d<a.length;d++)for(var p=this.calculateInstance.getDependentCells().get(a[d]),c=0;c<p.length;c++){o=this.calculateInstance.getFormulaInfoTable().get(p[c]).formulaText;for(var u=0;u<h.length;u++)if(h[u].visibleName!==h[u].sheet){var f=h[u].sheet.toUpperCase();o.toUpperCase().indexOf(f)>-1&&(o=o.toUpperCase().split(f).join(u+"/"),s.push(u),l=!0)}if(l){for(var g=0;g<s.length;g++)o=o.split(s[g].toString()+"/").join(h[s[g]].visibleName);r=this.calculateInstance.rowIndex(p[c]),n=this.calculateInstance.colIndex(p[c]),i=le(this.parent,"Sheet"+(parseInt(p[c].split("!")[1],10)+1),this.sheetInfo),this.updateDataContainer([r-1,n-1],{value:o,sheetId:i,visible:!0})}}},r.prototype.updateDataContainer=function(e,r){for(var n,i,a,o=e[0],s=e[1],l=this.parent.sheets.length,h=0;h<l;h++)if(this.parent.sheets[h].id===r.sheetId){n=this.parent.sheets[h].rows;break}t.isNullOrUndefined(r)||(o in n?s in(i=n[o]).cells?((a=i.cells[s]).formula=r.value,a.value=r.visible?a.value:this.referenceError()):i.cells[s]=a={}:(i=n[o]={})[s]=a={})},r.prototype.parseSheetRef=function(e){var t,r=new RegExp("[!@#$%^&()+=';,.{}|\":<>~_-]","g"),n=0,i=this.parent.sheets.length,a=[];a.length=0;var o,s,l,h,d=this.getSheetInfo(),p='(?=[\'!])(?=[^"]*(?:"[^"]*"[^"]*)*$)';for(n=0;n<i;n++)if(d[n].sheet!==d[n].visibleName&&(t=new RegExp(d[n].visibleName.replace(r,"\\$&")+p,"gi"),l=n,e.match(t))){for(var c=n+1;c<i;c++)o=new RegExp(d[c].visibleName.replace(r,"\\$&")+p,"gi"),s=e.search(o),h=e.search(t),s>-1&&(s<h||s===h&&d[c].visibleName.length>d[n].visibleName.length)&&(t=o,l=c);e=e.replace(t,l+"/"),a.push(l)}for(n=0;n<a.length;)t=new RegExp(a[n]+"/"+p,"gi"),e=e.replace(t,d[a[n]].sheet),n++;return e},r.prototype.registerSheet=function(e,t){void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);for(var r;e<t;)r=ce(this.parent,e).id+"",this.calculateInstance.registerGridAsSheet(r,r,this.calcID),e++},r.prototype.unRegisterSheet=function(e,t,r){void 0===e&&(e=0),void 0===t&&(t=this.parent.sheets.length);var n;if(this.calculateInstance.tokenCount=0,r)this.calculateInstance.unregisterGridAsSheet(n,n,r);else for(;e<t;)n=ce(this.parent,e).id+"",this.calculateInstance.unregisterGridAsSheet(n,n),e++},r.prototype.refreshCalculate=function(e,r,n,i,a){void 0===a&&(a=this.parent.activeSheetIndex);var o=ce(this.parent,a).id+"";if(i){n=this.parseSheetRef(n);var s=new kr(e+1,r+1,n),l=[this.parent.getActiveSheet().usedRange.rowIndex,this.parent.getActiveSheet().usedRange.colIndex];this.calculateInstance.valueChanged(o,s,!0,l);var h=this.calculateInstance.randCollection;if(!0===this.calculateInstance.isRandomVal){var d=void 0,p=void 0,u="";if(this.calculateInstance.randomValues.size>1&&this.calculateInstance.randomValues.size===h.length)for(var f=0;f<this.calculateInstance.randomValues.size;f++){d=this.calculateInstance.rowIndex(h[f]),p=this.calculateInstance.colIndex(h[f]),u=this.calculateInstance.randomValues.get(h[f]),o=(parseFloat(this.calculateInstance.getSheetToken(h[f]).split(this.calculateInstance.sheetToken).join(""))+1).toString();var g=new kr(d,p,u);this.calculateInstance.valueChanged(o,g,!0)}}}else{var m=this.calculateInstance.getSheetFamilyItem(o),y=v(r+1)+(e+1);m.isSheetMember&&!t.isNullOrUndefined(m.parentObjectToToken)&&(y=m.parentObjectToToken.get(o)+y),this.calculateInstance.getFormulaInfoTable().has(y)&&(this.calculateInstance.getFormulaInfoTable().delete(y),this.calculateInstance.getDependentCells().has(y)&&this.calculateInstance.clearFormulaDependentCells(y)),this.calculateInstance.getComputedValue().clear(),this.calculateInstance.refresh(y),this.calculateInstance.refreshRandValues(y)}this.calculateInstance.cell="";var C=$(e,r,this.parent.getActiveSheet());if(C&&n&&0===n.toString().toUpperCase().indexOf("=SUM(")){var b=["#N/A","#VALUE!","#REF!","#DIV/0!","#NUM!","#NAME?","#NULL!","invalid arguments"],S=n.toString().toUpperCase().replace("=SUM","").replace("(","").replace(")","").split(":")[0];if(j(S)){var x=c(S),w=$(x[0],x[1],this.parent.getActiveSheet());w&&w.value&&w.format&&b.indexOf(C.value)<0&&b.indexOf(w.value)<0&&(C.format=w.format)}}},r.prototype.autoCorrectFormula=function(e,r,n){if(!t.isNullOrUndefined(e)){2===(e=e.toString()).split("(").length&&e.indexOf(")")<0&&(e+=")");var i=void 0;0===e.indexOf("=")&&(e=e.slice(1),i=!0);var a=e.match(/</g),o=e.match(/>/g),s=e.match(/=/g);if(a){for(var l="",h=0;h<a.length;h++)l+=a[h];e=e.replace(l,"<")}if(o){for(var d="",p=0;p<o.length;p++)d+=o[p];e=e.replace(d,">")}if(s){for(var c="",u=0;u<s.length;u++)c+=s[u];e=e.split(c).join("=")}e=i?"="+e:e,(a||o||s)&&($(r,n,this.parent.getActiveSheet()).formula=e)}return e},r.prototype.initiateDefinedNames=function(){for(var e=this.parent.definedNames,t=0;t<e.length;){var r=e[t],n=this.parseSheetRef(r.refersTo),i=C(n),a=!1,o=n.indexOf("http:")>-1||n.indexOf("https:")>-1;if(i=i.split("$").join(""),(i=i.split("=").join("")).indexOf(":")>-1){var s=i.split(":");j(s[0])&&j(s[1])&&(a=!0)}else i.indexOf(":")<0&&j(i)&&(a=!0);o&&(a=!1),a?this.addDefinedName(r,!0):(this.removeDefinedName(r.name,r.scope),t--),t++}},r.prototype.addDefinedName=function(e,t){var r,n=!0,i=e.name;if(e.refersTo.indexOf("!")<0){var a=ve(this.parent);a=-1!==a.indexOf(" ")?"'"+a+"'":a,e.refersTo=a+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])}var o=e.refersTo,s=this.parseSheetRef(e.refersTo);return e.scope?(r=ae(this.parent,e.scope))>-1&&(i=ve(this.parent,r)+"!"+i):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?n=!1:(this.calculateInstance.addNamedRange(i,"="===s[0]?s.substr(1):s),"="!==s[0]&&(e.refersTo="="+o),this.parent.definedNames.indexOf(e)<0&&this.parent.definedNames.push(e)),n},r.prototype.removeDefinedName=function(e,t){var r=!1,n=this.getIndexFromNameColl(e,t);if(n>-1){var i=e;if(t){var a=ae(this.parent,t);a&&(i=ve(this.parent,a)+"!"+e)}this.calculateInstance.removeNamedRange(i),this.parent.definedNames.splice(n,1),r=!0}return r},r.prototype.checkIsNameExist=function(e,t){return this.parent.definedNames.some(function(r){return r.name===e&&(t?r.scope===t:""===r.scope)})},r.prototype.getIndexFromNameColl=function(e,t){void 0===t&&(t="");var r=-1;return this.parent.definedNames.filter(function(n,i){n.name===e&&n.scope===t&&(r=i)}),r},r.prototype.toFixed=function(e){var t=Number(e);return Math.round(t)!==t&&(e=t.toFixed(2)),e},r.prototype.aggregateComputation=function(e){var t,r,n=this.parent.getActiveSheet(),i=pe(n),a=c(i.split(":")[1]),o=["SUM","AVERAGE","MIN","MAX"],s=[];a[0]+1===n.rowCount&&a[1]+1===n.colCount&&(i="A1:"+g(n.usedRange.rowIndex,n.usedRange.colIndex));var l,h=c(n.activeCell),d=n.rows[h[0]]&&n.rows[h[0]].cells?n.rows[h[0]].cells[h[1]]:{},p=d?d.format:"",u=this.calculateInstance.getCellCollection(i);for(t=0;t<u.length;t++)if(l=this.calculateInstance.getValueFromArg(u[t]),L(l)){e.countOnly=!1;break}if(e.Count=this.calculateInstance.getFunction("COUNTA")(i),e.Count&&!e.countOnly){for(t=0;t<4;t++){var f={formattedText:r=this.toFixed(this.calculateInstance.getFunction(o[t])(i)),value:r,format:p,onLoad:!0};p&&(this.parent.notify("getFormattedCell",f),r=f.formattedText),s.push(r)}e.Sum=s[0],e.Avg=s[1],e.Min=s[2],e.Max=s[3]}},r.prototype.clearFormula=function(e){this.parent.activeSheetIndex===e.sheetIdx&&(e.rowIdx="Row"===e.type?"insert"===e.status?e.rowIdx>=e.startIdx?e.rowIdx-e.count:e.rowIdx:e.rowIdx+e.count:e.rowIdx,e.colIdx="Column"===e.type?"insert"===e.status?e.colIdx>=e.startIdx?e.colIdx-e.count:e.colIdx:e.colIdx+e.count:e.colIdx);var t="!"+e.sheetIdx+"!"+V(-1===e.colIdx?e.colIdx+2:e.colIdx+1)+(-1===e.rowIdx?e.rowIdx+2:e.rowIdx+1);this.calculateInstance.getFormulaInfoTable().delete(t),this.calculateInstance.clearFormulaDependentCells(t)},r.prototype.refreshFormula=function(e,t,r,n,i,a){var o,s,l,h,d,p,u,f=e,g=[],v=this.parent.getActiveSheet(),y=[],C=[];if(q(f)){if("delete"===r)for(h=1;h<=t;h++)y.push(i+h);for(C=this.parseFormula(f),h=0;h<C.length;h++)if(d=C[h].trim(),this.calculateInstance.isCellReference(d)){if((u=h&&C[h-1].trim())&&"!"===u[u.length-1]){if((u=u.replace(/['!]/g,""))!==v.name)continue}else if(0===parseInt(u,10)&&void 0===u[u.length-1]&&v.id-1!==a)continue;g=c(d),o="Column"===n?"insert"===r?g[3]+t:g[3]-t:"insert"===r?g[2]+t:g[2]-t,s="Column"===n?"insert"===r?g[1]+t:g[1]-t:"insert"===r?g[0]+t:g[0]-t,s="Column"===n?i>g[1]?g[1]:s:i>g[0]?g[0]:s,o="Column"===n?i>g[3]?g[3]:o:i>g[2]?g[2]:o,l=s>-1?"Column"===n?m([g[0],s,g[2],o]).split(":")[0]:m([s,g[1],o,g[3]]).split(":")[0]:"#REF!","delete"===r&&(p=parseInt("Row"===n?d.replace(/[A-Z]/g,""):d.replace(/[0-9]/g,""),10),y.indexOf(p)>-1&&(l="#REF!")),C[h]=l}f="="+C.join("")}return f},r.prototype.refreshInsDelFormula=function(e){var t,r,n,i,a,o,s=this.parent.sheets.length;for(a=0;a<s;a++){t=e.model.length;for(var l=(n=[0,0,(r=this.parent.sheets[a]).usedRange.rowIndex,r.usedRange.colIndex])[2];l>=n[0];l--)for(var h=n[1];h<=n[3];h++)(i=$(l,h,r))&&i.formula&&q(i.formula)&&(this.clearFormula({rowIdx:l,colIdx:h,sheetIdx:a,count:t,status:e.name,type:e.modelType,startIdx:e.startIndex}),o=this.refreshFormula(i.formula,t,e.name,e.modelType,e.startIndex,a),this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:[l,h,l,h],value:o,sheetIndex:a}))}},r.prototype.parseFormula=function(e){for(var t,r,n=0,i=[],a=[],o=(a=(a=this.markSpecialChar(e.replace("=",""))).split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g)).length;n<o;)(t=a[n])?(1===t.length?i.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t):(r=t[0],t.indexOf("!")>0?(this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,i.push(t.substr(0,r)),i.push(t.substr(r))):this.isUniqueChar(r)?(i.push(this.getUniqueCharVal(r)),i.push(t.substr(1))):i.push(t)),n++):n++;return i},r.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCSeparator:return",";case this.uniqueCOperator:return":";case this.uniquePOperator:return"+";case this.uniqueSOperator:return"-";case this.uniqueMOperator:return"*";case this.uniqueDOperator:return"/";case this.uniqueModOperator:return"%";case this.uniqueConcateOperator:return"&";case this.uniqueEqualOperator:return"=";case this.uniqueExpOperator:return"^";case this.uniqueGTOperator:return">";case this.uniqueLTOperator:return"<"}return""},r.prototype.isUniqueChar=function(e){var t=e.charCodeAt(e);return t>=129&&t<=142},r.prototype.markSpecialChar=function(e){return e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket),e=e.replace(/,/g,","+this.uniqueCSeparator).replace(/:/g,":"+this.uniqueCOperator),e=e.replace(/\+/g,"+"+this.uniquePOperator).replace(/-/g,"-"+this.uniqueSOperator),e=e.replace(/\*/g,"*"+this.uniqueMOperator).replace(/\//g,"/"+this.uniqueDOperator),e=e.replace(/&/g,"&"+this.uniqueConcateOperator),e=e.replace(/=/g,"="+this.uniqueEqualOperator),e=e.replace(/\^/g,"^"+this.uniqueExpOperator),(e=e.replace(/>/g,">"+this.uniqueGTOperator).replace(/</g,"<"+this.uniqueLTOperator)).replace(/%/g,"%"+this.uniqueModOperator)},r.prototype.refreshNamedRange=function(e){for(var t,r,n,i,a,o,s,l,h,d=!1,p=this.parent.definedNames,u=Object.assign({},p),f=p.length,g=0;g<f;g++){if(t=u[g],r=u[g].refersTo.split("!")[1],n=c(r),h=t.refersTo.split("!")[0].split("=")[1],ae(this.parent,h.replace(/'/g,""))===this.parent.activeSheetIndex&&("insert"===e.name?(i=e.model.length,a=e.index,o=e.index+i,"Row"===e.modelType?n[0]>=o||n[0]>=a&&n[2]>=o?(s=[n[0]+i,n[1],n[2]+i,n[3]],d=!0):(n[0]<=a&&n[2]>=a||n[2]>=o)&&(s=[n[0],n[1],n[2]+i,n[3]],d=!0):"Column"===e.modelType&&(n[1]>=o||n[1]>=a&&n[3]>=o?(s=[n[0],n[1]+i,n[2],n[3]+i],d=!0):(n[1]<=a&&n[3]>=a||n[3]>=o)&&(s=[n[0],n[1],n[2],n[3]+i],d=!0))):(i=e.deletedModel.length,a=e.startIndex,o=e.endIndex,"Row"===e.modelType?n[0]>=o||n[0]>=a&&n[2]>=o?(s=[n[0]-i,n[1],n[2]-i,n[3]],d=!0):(n[0]<=a&&n[2]>=a||n[2]>=o)&&(s=[n[0],n[1],n[2]-i,n[3]],d=!0):"Column"===e.modelType&&(n[1]>=o||n[1]>=a&&n[3]>=o?(s=[n[0],n[1]-i,n[2],n[3]-i],d=!0):(n[1]<=a&&n[3]>=a||n[3]>=o)&&(s=[n[0],n[1],n[2],n[3]-i],d=!0))),d)){l=m(s),t.refersTo=h+"!"+l,this.parent.removeDefinedName(t.name,t.scope);var v={action:"addDefinedName",definedName:t,isAdded:!1};this.parent.notify(Et,v)}p=u}},r}(),Tr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(kt,this.initiateSortHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(kt,this.initiateSortHandler)},e.prototype.initiateSortHandler=function(e){var n=this,i=e.args,a=new r.Deferred,o=this.parent.getActiveSheet(),s=x(y(i.range)),l=i.sortOptions||{sortDescriptors:{},containsHeader:!0},h=!1;if(e.promise=a.promise,s[0]>o.usedRange.rowIndex||s[1]>o.usedRange.colIndex)return void a.reject(this.parent.serviceLocator.getService(dn).getConstant("SortOutOfRangeError"));var d=l.containsHeader;s[0]===s[2]&&(s=this.getSortDataRange(s[0],s[1],o),h=!0,t.isNullOrUndefined(l.containsHeader)&&(d=typeof $(s[0],s[1],o,null,!0).value!=typeof $(s[0]+1,s[1],o,null,!0).value||!this.isSameStyle($(s[0],s[1],o,null,!0).style,$(s[0]+1,s[1],o,null,!0).style))),!t.isNullOrUndefined(i.sortOptions)&&!t.isNullOrUndefined(i.sortOptions.containsHeader)||h||t.isNullOrUndefined($(s[0],s[1],o))||t.isNullOrUndefined($(s[0]+1,s[1],o))||(d=typeof $(s[0],s[1],o).value!=typeof $(s[0]+1,s[1],o).value);var p,c,f=s[0]=d?s[0]+1:s[0],g=v(u(o.activeCell)[1]+1),C=l.sortDescriptors,b=m(s);ee(this.parent,o.name+"!"+b,!0).then(function(e){var t=new r.DataManager(e),h=new r.Query;if(Array.isArray(C)){C&&0!==C.length||(C=[{field:g}]);for(var d=C.length,u=d-1;u>-1;u--)if(C[d-1].field||(C[d-1].field=g),C[u].field){m=C[u].sortComparer||n.sortComparer.bind(n,C[u],l.caseSensitive);h.sortBy(C[u].field,m)}}else{C||(C={field:g}),C.field||(C.field=g);var m=C.sortComparer||n.sortComparer.bind(n,C,l.caseSensitive);h.sortBy(C.field,m)}t.executeQuery(h).then(function(t){var r,n={};Array.prototype.forEach.call(t.result,function(t,i){if(t)for(p=s[1],c=s[3],f=parseInt(e[i].__rowIndex,10)-1,p;p<=c;p++)r=v(p+1),n=t[r],Z(f,p,o,n)});var l={range:o.name+"!"+b,sortOptions:i.sortOptions};a.resolve(l)})})},e.prototype.isSameStyle=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});for(var r=!0,n=Object.keys(e),i=0;i<n.length;i++){if(e[n[i]]!==t[n[i]]&&this.parent.cellStyle[n[i]]!==e[n[i]]){r=!1;break}r=!0}return r},e.prototype.getSortDataRange=function(e,t,r){for(var n,i,a,o,s,l,h=e,d=e,p=t,c=t,u=1;!o&&$(e+u,t,r,null,!0).value?d=e+u:o=!0,!a&&$(e-u,t,r,null,!0).value?h=e-u:a=!0,!a||!o;u++);for(var f=1;;f++){n=p,i=c;for(u=h;u<=d;u++)if(!s&&$(u,p-1,r,null,!0).value&&(p=n-1),!l&&$(u,c+1,r,null,!0).value&&(c=i+1),u===d&&(p===n&&(s=!0),c===i&&(l=!0)),l&&s)return[h,p,d,c]}},e.prototype.sortComparer=function(e,n,i,a){var o=e.order||"",s=r.DataUtil.fnSort(o),l={sensitivity:n?"case":"base"};if(i&&a&&("string"==typeof i.value||"string"==typeof a.value)){L(i.value)&&(i.value=D(i.value)),L(a.value)&&(a.value=D(a.value));var h=new Intl.Collator(this.parent.locale,l);return o&&"ascending"!==o.toLowerCase()?-1*h.compare(i.value,a.value):h.compare(i.value,a.value)}return null!==i&&!t.isNullOrUndefined(i.value)||null!==a&&!t.isNullOrUndefined(a.value)?null===i||t.isNullOrUndefined(i.value)?1:null===a||t.isNullOrUndefined(a.value)?-1:s(i?i.value:i,a?a.value:a):-1},e.prototype.getModuleName=function(){return"workbookSort"},e}(),Fr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.filterRange=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on("initiateFilter",this.initiateFilterHandler,this),this.parent.on("clearAllFilter",this.clearAllFilterHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiateFilter",this.initiateFilterHandler),this.parent.off("clearAllFilter",this.clearAllFilterHandler))},e.prototype.initiateFilterHandler=function(e){var t=this,n=e.args,i=new r.Deferred,a=this.parent.getActiveSheet(),o=n.filterOptions||{};if(e.promise=i.promise,this.filterRange=n.range,o.datasource){this.setFilter(o.datasource,o.predicates);var s={range:n.range,filterOptions:o};i.resolve(s)}else{var l=x(y(n.range));if(l[0]>a.usedRange.rowIndex||l[1]>a.usedRange.colIndex)return void i.reject("Select a cell or range inside the used range and try again.");l[0]===l[2]&&l[2]-l[0]==0&&(l[0]=0,l[1]=0,l[3]=a.usedRange.colIndex),l[2]=a.usedRange.rowIndex,l[0]=l[0]+1;var h=m(l);ee(this.parent,a.name+"!"+h,!0,!0).then(function(e){var n=new r.DataManager(e);t.setFilter(n,o.predicates);var a={range:h,filterOptions:o};i.resolve(a)})}},e.prototype.setFilter=function(e,n){var i=this;if(e&&n){var a=e.dataSource.json,o=new r.Query;n.length&&o.where(r.Predicate.and(n));var s=e.executeLocal(o);a.forEach(function(e){if(e){var r=parseInt(e.__rowIndex,10);i.parent.hideRow(r-1,void 0,s.indexOf(e)<0),t.isNullOrUndefined(i.parent.filteredRows)&&(i.parent.filteredRows={},i.parent.filteredRows.rowIdxColl=[],i.parent.filteredRows.sheetIdxColl=[]);var n=i.parent.filteredRows.rowIdxColl,a=i.parent.filteredRows.sheetIdxColl;if(s.indexOf(e)<0){if(n&&a)for(var o=0,l=a.length;o<l;o++)i.parent.activeSheetIndex===a[o]&&n[o]===r-1&&(n.splice(o,1),a.splice(o,1));n.push(r-1),a.push(i.parent.activeSheetIndex)}else if(n&&a)for(var o=0,h=a.length;o<h;o++)i.parent.activeSheetIndex===a[o]&&n[o]===r-1&&(n.splice(o,1),a.splice(o,1))}});var l=this.parent.getActiveSheet();(l.frozenColumns||l.frozenRows)&&this.parent.notify("dataRefresh",null)}},e.prototype.clearAllFilterHandler=function(){if(this.filterRange){var e=u(this.filterRange),t=this.parent.getActiveSheet();this.parent.hideRow(e[0],t.usedRange.rowIndex-1,!1)}},e.prototype.getModuleName=function(){return"workbookFilter"},e}(),Lr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.setImage=function(e){var t,r=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,n=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,i=c(r),a=n?this.parent.sheets[n]:this.parent.getActiveSheet(),o=$(i[0],i[1],a),s=e.options;if(o&&o.image){t=o.image;for(var l=0;l<s.length;l++)t.push(s[l])}Z(i[0],i[1],a,{image:o&&o.image?t:s},!0)},e.prototype.addEventListener=function(){this.parent.on("setImage",this.setImage,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("setImage",this.setImage)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookImage"},e}(),Nr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Ut,this.setChartHandler,this),this.parent.on("refreshChart",this.refreshChartData,this),this.parent.on("deleteChartColl",this.deleteChartColl,this),this.parent.on(Vt,this.refreshChartSize,this),this.parent.on("focusChartBorder",this.focusChartBorder,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ut,this.setChartHandler),this.parent.off("refreshChart",this.refreshChartData),this.parent.off("deleteChartColl",this.deleteChartColl),this.parent.off(Vt,this.refreshChartSize),this.parent.off("focusChartBorder",this.focusChartBorder))},e.prototype.setChartHandler=function(e){var r=0;e.isInitCell=!t.isNullOrUndefined(e.isInitCell)&&e.isInitCell,e.isUndoRedo=!!t.isNullOrUndefined(e.isUndoRedo)||e.isUndoRedo,e.isPaste=!t.isNullOrUndefined(e.isPaste)&&e.isPaste;var n=e.chart;if(n.length>0)for(;r<n.length;){if(!1===e.isCut&&document.getElementById(e.chart[r].id)&&(n[r]={range:n[r].range,id:"e_spreadsheet_chart_"+this.parent.chartCount,isSeriesInRows:n[r].isSeriesInRows,theme:n[r].theme,type:n[r].type},n[r].id="e_spreadsheet_chart_"+this.parent.chartCount,e.isIdAvailabe=!1),document.getElementById(e.chart[r].id))return;var i=!!t.isNullOrUndefined(e.isIdAvailabe)||e.isIdAvailabe;if(n[r].theme=n[r].theme||"Material",n[r].type=n[r].type||"Line",n[r].isSeriesInRows=n[r].isSeriesInRows||!1,n[r].range=n[r].range||this.parent.getActiveSheet().selectedRange,n[r].range.indexOf("!")<0&&(n[r].range=this.parent.getActiveSheet().name+"!"+n[r].range),t.isNullOrUndefined(n[r].id)&&(n[r].id="e_spreadsheet_chart_"+this.parent.chartCount,i=!1),n[r].height=n[r].height||290,n[r].width=n[r].width||480,this.parent.notify("initiateChart",{option:n[r],chartCount:this.parent.chartCount,isInitCell:e.isInitCell,isUndoRedo:e.isUndoRedo,dataSheetIdx:e.dataSheetIdx,range:e.range,isPaste:e.isPaste}),this.parent.chartColl.push(n[r]),i||this.parent.chartCount++,!e.isInitCell||e.isPaste){var a=n[r].range&&n[r].range.indexOf("!")>0?ae(this.parent,n[r].range.split("!")[0]):this.parent.activeSheetIndex,o=c(e.isPaste?e.range:n[r].range),s=a?this.parent.sheets[a]:this.parent.getActiveSheet(),l=$(o[0],o[1],s);l&&l.chart?l.chart.push(n[r]):Z(o[0],o[1],s,{chart:[n[r]]},!0)}r++}},e.prototype.refreshChartData=function(e){for(var t,r=1,n=this.parent.sheets.length+1;r<n;){var i=this.parent.chartColl;if(t=i?i.length:0)for(;t--;){var a=this.parent.chartColl[t],o=G(c(a.range),e.rIdx,e.cIdx),s=a.range.indexOf("!")>-1?ae(this.parent,se(a.range)):this.parent.activeSheetIndex;o&&s===this.parent.activeSheetIndex&&this.parent.notify("updateChart",{chart:a})}r++}},e.prototype.refreshChartSize=function(e){for(var r,n=1,i=this.parent.sheets.length+1;n<i;){var a=this.parent.chartColl;if(r=a?a.length:0)for(;r--;){var o=this.parent.chartColl[r];if(!t.isNullOrUndefined(e.overlayEle.querySelector("#"+o.id))){var s=this.parent.element.querySelector("."+o.id),l=t.getComponent(s,"chart");l.height=e.height,l.width=e.width}}n++}},e.prototype.focusChartBorder=function(e){for(var r=0;r<this.parent.chartColl.length;r++){var n=document.getElementById(e.id),i=document.getElementById(this.parent.chartColl[r].id);n&&i&&t.closest(i,"."+n.classList[1])===n&&this.parent.notify("initiateChart",{option:this.parent.chartColl[r],chartCount:this.parent.chartCount,isRefresh:!0})}},e.prototype.deleteChartColl=function(e){for(var r=0;r<this.parent.chartColl.length;r++){var n=document.getElementById(this.parent.chartColl[r].id),i=document.getElementById(e.id);i&&n&&t.closest(n,"."+i.classList[1])===i&&this.parent.chartColl.splice(r,1)}},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookChart"},e}(),Dr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.format=function(e){var t,r=e.range;r&&"string"==typeof r&&r.indexOf("!")>-1?(r=r.split("!")[1],t=this.parent.sheets[ae(this.parent,e.range.split("!")[0])]):t=this.parent.getActiveSheet(),void 0===r&&(r=t.selectedRange);var n="object"!=typeof r&&e.onActionUpdate,i={range:r,style:Object.assign({},e.style),requestType:"CellFormat"};e.borderType&&(i.borderType=e.borderType);var a={};if(Object.assign(a,i.style,null,!0),n&&(this.parent.trigger("beforeCellFormat",i),this.parent.notify("actionBegin",{eventArgs:i,action:"format"}),i.cancel))return void(e.cancel=!0);var o="object"==typeof i.range?i.range:x(c(i.range));if(e.borderType&&(this.setTypedBorder(t,e.style.border,o,e.borderType,e.onActionUpdate),delete e.style.border),void 0!==i.style.borderTop){for(h=o[1];h<=o[3];h++)this.checkAdjustantBorder(t,"borderBottom",o[0]-1,h),this.checkFullBorder(t,"borderBottom",o[0]-1,h),this.checkFullBorder(t,"borderTop",o[0],h),this.setCellBorder(t,{borderTop:i.style.borderTop},o[0],h,e.onActionUpdate,h===o[3]);delete i.style.borderTop}if(void 0!==i.style.borderBottom){for(h=o[1];h<=o[3];h++)this.checkAdjustantBorder(t,"borderTop",o[2]+1,h),this.checkFullBorder(t,"borderTop",o[2]+1,h),this.checkFullBorder(t,"borderBottom",o[2],h),this.setCellBorder(t,{borderBottom:i.style.borderBottom},o[2],h,e.onActionUpdate,h===o[3]),this.setBottomBorderPriority(t,o[2],h);delete i.style.borderBottom}if(void 0!==i.style.borderLeft){for(h=o[0];h<=o[2];h++)this.checkAdjustantBorder(t,"borderRight",h,o[1]-1),this.checkFullBorder(t,"borderRight",h,o[1]-1),this.checkFullBorder(t,"borderLeft",h,o[1]),this.setCellBorder(t,{borderLeft:i.style.borderLeft},h,o[1],e.onActionUpdate);delete i.style.borderLeft}if(void 0!==i.style.borderRight){for(h=o[0];h<=o[2];h++)this.checkAdjustantBorder(t,"borderLeft",h,o[3]-1),this.checkFullBorder(t,"borderLeft",h,o[3]-1),this.checkFullBorder(t,"borderRight",h,o[3]),this.setCellBorder(t,{borderRight:i.style.borderRight},h,o[3],e.onActionUpdate);delete i.style.borderRight}var s,l;if(Object.keys(e.style).length)for(var h=o[0];h<=o[2];h++)for(var d=o[1];d<=o[3];d++)void 0===l&&(void 0!==i.style.border?(s=i.style.border,i.style.border=void 0,l=!0):l=!1),l&&this.setFullBorder(t,s,o,h,d,e.onActionUpdate),this.setCellStyle(t,h,d,i.style),this.parent.getActiveSheet().id===t.id&&this.parent.notify(It,{style:i.style,rowIdx:h,colIdx:d,lastCell:d===o[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate});l&&(i.style.border=s),this.parent.setUsedRange(o[2],o[3]),e.refreshRibbon&&this.parent.notify("activeCellChanged",null),n&&(i.style=a,i.range=t.name+"!"+r,this.parent.notify("actionComplete",{eventArgs:i,action:"format"}))},e.prototype.setBottomBorderPriority=function(e,t,r){if(be(e,t+1)){var n=this.skipHiddenRows(e,t+1);""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop&&(e.rows[t].cells[r].style.bottomPriority=!0)}},e.prototype.setFullBorder=function(e,t,r,n,i,a){var o={};n===r[0]&&(this.checkAdjustantBorder(e,"borderBottom",n-1,i),this.checkFullBorder(e,"borderBottom",n-1,i)),i===r[1]&&(this.checkAdjustantBorder(e,"borderRight",n,i-1),this.checkFullBorder(e,"borderRight",n,i-1)),i===r[3]?(this.checkAdjustantBorder(e,"borderLeft",n,i+1),this.checkFullBorder(e,"borderLeft",n,i+1)):this.checkAdjustantBorder(e,"border",n,i+1),o.borderRight=t,o.borderTop=t,o.borderLeft=t,o.borderBottom=t,this.setCellBorder(e,o,n,i,a,i===r[3]),n===r[2]?(this.checkAdjustantBorder(e,"borderTop",n+1,i),this.checkFullBorder(e,"borderTop",n+1,i),this.setBottomBorderPriority(e,n,i)):this.checkAdjustantBorder(e,"border",n+1,i)},e.prototype.checkAdjustantBorder=function(e,t,r,n){var i={};""!==this.parent.getCellStyleValue([t],[r,n])[t]&&(i[t]=void 0,this.setCellStyle(e,r,n,i))},e.prototype.checkFullBorder=function(e,t,r,n){var i=this.parent.getCellStyleValue(["border"],[r,n]).border;if(""!==i){var a={border:void 0};["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){e!==t&&(a[e]=i)}),this.setCellStyle(e,r,n,a)}},e.prototype.textDecorationActionUpdate=function(e){var t=this.parent.getActiveSheet(),r={range:t.selectedRange,style:e.style,requestType:"CellFormat"};if(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),r.cancel)return void(e.cancel=!0);var n,i=x(c(t.selectedRange)),a=e.style.textDecoration,o=a,s=c(t.activeCell),l=this.parent.getCellStyleValue(["textDecoration"],s).textDecoration,h=!1;"underline"===l?o="underline"===a?"none":"underline line-through":"line-through"===l?o="line-through"===a?"none":"underline line-through":"underline line-through"===l&&(o="underline"===a?"line-through":"underline",h=!0),"none"===o&&(h=!0),this.format({style:{textDecoration:o},range:s,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var d=i[0];d<=i[2];d++)for(var p=i[1];p<=i[3];p++)if(d!==s[0]||p!==s[1]){if(n={},"none"===(l=this.parent.getCellStyleValue(["textDecoration"],[d,p]).textDecoration)){if(h)continue;n.textDecoration=a}else if("underline"===l||"line-through"===l)if(h){if(a!==l)continue;n.textDecoration="none"}else n.textDecoration=a!==l?"underline line-through":a;else if("underline line-through"===l){if(!h)continue;n.textDecoration="underline"===a?"line-through":"underline"}this.format({style:n,range:[d,p,d,p],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}r.range=t.name+"!"+r.range,this.parent.notify("actionComplete",{eventArgs:r,action:"format"})},e.prototype.setTypedBorder=function(e,t,r,n,i){var a;if("Outer"===n){for(var o=r[1];o<=r[3];o++)this.checkAdjustantBorder(e,"borderBottom",r[0]-1,o),this.checkFullBorder(e,"borderBottom",r[0]-1,o),this.setCellBorder(e,{borderTop:t},r[0],o,i,o===r[3]),this.checkAdjustantBorder(e,"borderTop",r[2]+1,o),this.checkFullBorder(e,"borderTop",r[2]+1,o),this.setCellBorder(e,{borderBottom:t},r[2],o,i,o===r[3]),this.setBottomBorderPriority(e,r[2],o);for(var s=r[0];s<=r[2];s++)this.checkAdjustantBorder(e,"borderRight",s,r[1]-1),this.checkFullBorder(e,"borderRight",s,r[1]-1),this.setCellBorder(e,{borderLeft:t},s,r[1],i),this.checkAdjustantBorder(e,"borderLeft",s,r[3]+1),this.checkFullBorder(e,"borderLeft",s,r[3]+1),this.setCellBorder(e,{borderRight:t},s,r[3],i)}else if("Inner"===n)for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={};""!==(a=this.parent.getCellStyleValue(["border"],[l,h]).border)&&(d.border=void 0,h!==r[3]&&h!==r[1]&&l!==r[0]&&l!==r[2]||(l===r[0]&&(d.borderTop=a),l===r[2]&&(d.borderBottom=a),h===r[3]&&(d.borderRight=a),h===r[1]&&(d.borderLeft=a))),h!==r[3]&&(d.borderRight=t),l!==r[0]&&(d.borderTop=t),l!==r[2]&&(d.borderBottom=t),h!==r[1]&&(d.borderLeft=t),this.setCellBorder(e,d,l,h,i,h===r[3])}else if("Vertical"===n)for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={borderRight:t,borderLeft:t};h===r[1]&&(this.checkAdjustantBorder(e,"borderRight",l,h-1),this.checkFullBorder(e,"borderRight",l,h-1)),h===r[3]&&(this.checkAdjustantBorder(e,"borderLeft",l,h+1),this.checkFullBorder(e,"borderLeft",l,h+1)),this.setCellBorder(e,d,l,h,i)}else for(var l=r[0];l<=r[2];l++)for(var h=r[1];h<=r[3];h++){var d={borderTop:t,borderBottom:t};l===r[0]&&(this.checkAdjustantBorder(e,"borderBottom",l-1,h),this.checkFullBorder(e,"borderBottom",l-1,h)),this.setCellBorder(e,d,l,h,i,h===r[3]),l===r[2]&&(this.checkAdjustantBorder(e,"borderTop",l+1,h),this.checkFullBorder(e,"borderTop",l+1,h),this.setBottomBorderPriority(e,l,h))}},e.prototype.setCellBorder=function(e,t,r,n,i,a){this.setCellStyle(e,r,n,t),this.parent.getActiveSheet().id===e.id&&this.parent.notify(It,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:a,isHeightCheckNeeded:!0,manualUpdate:!0})},e.prototype.setCellStyle=function(e,t,r,n){e.rows[t]?e.rows[t].cells||(e.rows[t].cells=[]):e.rows[t]={cells:[]},e.rows[t].cells[r]||(e.rows[t].cells[r]={}),e.rows[t].cells[r].style||(e.rows[t].cells[r].style={}),Object.assign(e.rows[t].cells[r].style,n,null,!0)},e.prototype.skipHiddenRows=function(e,t){return t++,be(e,t)&&(t=this.skipHiddenRows(e,t)),t},e.prototype.addEventListener=function(){this.parent.on(wt,this.format,this),this.parent.on("textDecorationUpdate",this.textDecorationActionUpdate,this),this.parent.on("clear",this.clearCellObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wt,this.format),this.parent.off("textDecorationUpdate",this.textDecorationActionUpdate),this.parent.off("clear",this.clearCellObj))},e.prototype.clearCellObj=function(e){var t,r,n=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,i=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,a=ce(this.parent,i),o=y(n),s=o[0],l=o[2];for(s;s<=l;s++)for(t=o[1],r=o[3],t;t<=r;t++){var h=$(s,t,a);if(h)switch(e.type){case"Clear Formats":delete h.format,delete h.rowSpan,delete h.style,delete h.wrap,delete h.colSpan;break;case"Clear Contents":delete h.value,delete h.formula;break;case"Clear Hyperlinks":delete h.hyperlink;break;case"Clear All":Z(s,t,a,{},!1)}}},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookcellformat"},e}(),Or=function(){function e(e){this.parent=e,this.localeObj=t.getNumericObject(this.parent.locale),this.decimalSep=this.localeObj.decimal,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("workbookEditOperation",this.performEditOperation,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("workbookEditOperation",this.performEditOperation)},e.prototype.getModuleName=function(){return"workbookEdit"},e.prototype.performEditOperation=function(e){switch(e.action){case"updateCellValue":this.updateCellValue(e.address,e.value,e.sheetIndex,e.isValueOnly)}},e.prototype.checkDecimalPoint=function(e){if(Number(e)){var t=e.toString().indexOf(this.decimalSep)+1;e=e.toString().substr(t).length<=6?t<7?e:parseFloat(e).toFixed(0):t>7?parseFloat(e).toFixed(0):parseFloat(e).toFixed(6-t+2)}return e},e.prototype.updateCellValue=function(e,r,n,i){void 0===i&&(i=!1),void 0===n&&(n=this.parent.activeSheetIndex);var a;a="string"==typeof e?c(e):e;var o=ce(this.parent,n),s=$(a[0],a[1],o,!0);if(s||(s=o.rows[a[0]].cells[a[1]]={}),i)r&&r.toString().indexOf(this.decimalSep)>-1&&(r=this.checkDecimalPoint(r)),s.value=r;else{var l=q(r);l||(s.formula="",s.value=D(r));var h={action:"refreshCalculate",value:r,rowIndex:a[0],colIndex:a[1],sheetIndex:n,isFormula:l};if("Text"!==H(s.format)){var d={value:r,rowIndex:a[0],colIndex:a[1],sheetIndex:n,updatedVal:""};this.parent.notify(Rt,d),!t.isNullOrUndefined(d.updatedVal)&&d.updatedVal.length>0&&(s.value=d.updatedVal)}this.parent.notify(Et,h),l&&(s.formula=h.value,r=s.value)}this.parent.setUsedRange(a[0],a[1],o),this.parent.allowChart&&this.parent.notify("refreshChart",{cell:s,rIdx:a[0],cIdx:a[1],sheetIdx:n})},e}(),Hr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("setLinkModel",this.setLinkHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("setLinkModel",this.setLinkHandler)},e.prototype.setLinkHandler=function(e){var r,n,i,a=e.hyperlink,o=e.cell,s=this.parent.getActiveSheet();if(o&&-1!==o.indexOf("!")){r=o.split("!");for(var l=this.parent.sheets,h=0;h<l.length;h++)l[h].name===r[0]&&(n=h);s=this.parent.sheets[n],o=r[1]}var d=c(o=o||this.parent.getActiveSheet().activeCell),p=d[0],u=d[1];s&&(t.isNullOrUndefined(s.rows[p])&&(s.rows[p]={}),t.isNullOrUndefined(s.rows[p].cells)&&(s.rows[p].cells=[]),t.isNullOrUndefined(s.rows[p].cells[u])&&(s.rows[p].cells[u]={}),s.rows[p].cells[u].style?(s.rows[p].cells[u].style.textDecoration="underline",s.rows[p].cells[u].style.color="#00e"):s.rows[p].cells[u].style={textDecoration:"underline",color:"#00e"},"string"==typeof a?(0!==a.indexOf("http://")&&0!==a.indexOf("https://")&&0!==a.indexOf("ftp://")&&(i=a=0===a.toLowerCase().indexOf("www.")?"http://"+a:a),s.rows[p].cells[u].hyperlink=a):(0!==(i=a.address).indexOf("http://")&&0!==i.indexOf("https://")&&0!==i.indexOf("ftp://")&&(i=0===i.toLowerCase().indexOf("www.")?"http://"+i:i),s.rows[p].cells[u].hyperlink={address:i}))},e.prototype.getModuleName=function(){return"workbookHyperlink"},e}(),Br=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insertModel=function(e){var t,r,n,i=this;if(e.model){var a,o,s,l=[];if("number"==typeof e.start){a=e.start,e.end=e.end||a,a>e.end&&(a=e.end,e.end=e.start);for(p=a;p<=e.end;p++)l.push({})}else e.start?(a=e.start[0].index||0,l=e.start,s=!0):(a=0,l.push({}));var h;if("Row"===e.modelType){if(e.model=e.model,e.model.rows||(e.model.rows=[]),s&&e.model.usedRange.rowIndex>-1&&a>e.model.usedRange.rowIndex)for(p=e.model.usedRange.rowIndex;p<a-1;p++)l.splice(0,0,{});a<this.parent.frozenRowCount(e.model)&&(this.parent.setSheetPropertyOnMute(e.model,"frozenRows",e.model.frozenRows+l.length),h=!0),(t=e.model.rows).splice.apply(t,[a,0].concat(l)),a>e.model.usedRange.rowIndex?this.parent.setUsedRange(a+(l.length-1),e.model.usedRange.colIndex,e.model):this.parent.setUsedRange(e.model.usedRange.rowIndex+l.length,e.model.usedRange.colIndex,e.model);for(var d=a+l.length,p=0;p<=e.model.usedRange.colIndex;p++)e.model.rows[d]&&e.model.rows[d].cells&&e.model.rows[d].cells[p]&&void 0!==e.model.rows[d].cells[p].rowSpan&&e.model.rows[d].cells[p].rowSpan<0&&void 0===e.model.rows[d].cells[p].colSpan&&this.parent.notify("insertMerge",{range:[d,p,d,p],insertCount:l.length,insertModel:"Row"})}else if("Column"===e.modelType){e.model=e.model,e.model.columns||(e.model.columns=[]),(r=e.model.columns).splice.apply(r,[a,0].concat(l)),a<this.parent.frozenColCount(e.model)&&(this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",e.model.frozenColumns+l.length),h=!0),a>e.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,a+(l.length-1),e.model):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+l.length,e.model),e.model.rows||(e.model.rows=[]);var c=[];e.columnCellsModel||(e.columnCellsModel=[]);for(p=0;p<l.length;p++)c.push(null);o=[];for(p=0;p<=e.model.usedRange.rowIndex;p++){e.model.rows[p]?e.model.rows[p].cells||(e.model.rows[p].cells=[]):e.model.rows[p]={cells:[]},a&&!e.model.rows[p].cells[a-1]&&(e.model.rows[p].cells[a-1]={}),(n=e.model.rows[p].cells).splice.apply(n,[a,0].concat(e.columnCellsModel[p]&&e.columnCellsModel[p].cells?e.columnCellsModel[p].cells:c));d=a+l.length;e.model.rows[p].cells[d]&&void 0!==e.model.rows[p].cells[d].colSpan&&e.model.rows[p].cells[d].colSpan<0&&void 0===e.model.rows[p].cells[d].rowSpan&&o.push({range:[p,d,p,d],insertCount:c.length,insertModel:"Column"})}o.forEach(function(e){i.parent.notify("insertMerge",e)})}else{if(void 0!==e.checkCount&&e.checkCount===this.parent.sheets.length)return;for(var u=l,p=0;p<u.length;p++)if(u[p].name)for(var f=0;f<this.parent.sheets.length;f++)if(u[p].name===this.parent.sheets[f].name){u.splice(p,1),p--;break}if(!u.length)return;delete l[0].index,this.parent.createSheet(a,l);var g;e.activeSheetIndex?this.parent.setProperties({activeSheetIndex:e.activeSheetIndex},!0):!e.isAction&&e.start<this.parent.activeSheetIndex&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(this.parent.activeSheetIndex)},!0),l.forEach(function(e){s&&i.updateRangeModel(e.ranges),g=e.id,i.parent.notify(Et,{action:"addSheet",visibleName:e.name,sheetName:"Sheet"+g,index:g})})}var m={action:"refreshNamedRange",insertArgs:{model:l,index:a,modelType:e.modelType,isAction:e.isAction,activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length,name:"insert"}},v={action:"refreshInsDelFormula",insertArgs:{model:l,startIndex:e.start,endIndex:e.end,modelType:e.modelType,name:"insert",activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length}};"Sheet"!==e.modelType&&(this.parent.notify(Et,m),this.parent.notify(Et,v),e.model!==this.parent.getActiveSheet())||this.parent.notify("insert",{model:l,index:a,modelType:e.modelType,isAction:e.isAction,activeSheetIndex:e.activeSheetIndex,sheetCount:this.parent.sheets.length,insertType:e.insertType,freezePane:h})}},e.prototype.updateRangeModel=function(e){e.forEach(function(e){e.dataSource&&(e.startCell=e.startCell||"A1",e.showFieldAsHeader=void 0===e.showFieldAsHeader||e.showFieldAsHeader,e.template=e.template||"",e.address=e.address||"A1")})},e.prototype.setInsertInfo=function(e,t,r,n,i){void 0===i&&(i="Row");var a=r=t+(r-1);e.ranges.forEach(function(e){e.info&&t<e.info[n]&&(e.info["insert"+i+"Range"]?e.info["insert"+i+"Range"].push([t,a]):e.info["insert"+i+"Range"]=[[t,a]],e.info[n]+=a-t+1)})},e.prototype.addEventListener=function(){this.parent.on(Tt,this.insertModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Tt,this.insertModel)},e.prototype.getModuleName=function(){return"workbookinsert"},e}(),Mr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.deleteModel=function(e){var t=this,r=this.parent.sheets.length;if("Sheet"!==e.modelType||1!==r){var n=e.modelType.toLowerCase()+"s";if(e.start=e.start,e.start>e.end){var i=e.start;e.start=e.end,e.end=i}var a,o,s,l=[],h=e.end-e.start+1;if("Row"===e.modelType){if(e.model=e.model,e.start>e.model.usedRange.rowIndex)return;e.end>e.model.usedRange.rowIndex&&(e.end-=e.end-e.model.usedRange.rowIndex),e.model.usedRange.rowIndex-=e.end-e.start+1,e.model.usedRange.rowIndex<0&&(e.model.usedRange.rowIndex=0),e.model!==this.parent.getActiveSheet()&&this.parent.notify("updateUsedRange",{index:e.model.usedRange.rowIndex,update:"row"});var d=this.parent.frozenRowCount(e.model);e.start<d&&(d=e.end<d?e.end-e.start+1:d-e.start,d=e.model.frozenRows-d,this.parent.setSheetPropertyOnMute(e.model,"frozenRows",d),s=!0);var p=e.end+1,c=void 0,u=void 0;if(e.model.rows[e.start]&&e.model.rows[e.start].cells)for(g=0;g<=e.model.usedRange.colIndex;g++)e.model.rows[e.start].cells[g]&&void 0!==e.model.rows[e.start].cells[g].rowSpan&&e.model.rows[e.start].cells[g].rowSpan<0&&void 0===e.model.rows[e.start].cells[g].colSpan&&(u={range:[e.start,g,e.start,g]},this.parent.notify("activeCellMergedRange",u),u.range=u.range,u.range[2]<=e.end&&((o=$(u.range[0],g,e.model))&&o.rowSpan>1&&(o.rowSpan-(u.range[2]-e.start+1)>1?Z(u.range[0],g,e.model,{colSpan:o.rowSpan-(u.range[2]-e.start+1)},!0):delete e.model.rows[u.range[0]].cells[g].rowSpan),u=null)),e.model.rows[p]&&e.model.rows[p].cells&&e.model.rows[p].cells[g]&&void 0!==e.model.rows[p].cells[g].rowSpan&&e.model.rows[p].cells[g].rowSpan<0&&void 0===e.model.rows[p].cells[g].colSpan&&(u||(u={range:[p,g,p,g]},this.parent.notify("activeCellMergedRange",u)),c=new Object,u.range=u.range,Object.assign(c,$(u.range[0],u.range[1],e.model)),c&&c.rowSpan&&(c.rowSpan>1||c.colSpan>1)&&((v=[])[1]=g,v[3]=c.colSpan>1?g+(c.colSpan-1):g,u.range=u.range,u.range[0]<e.start?(v[0]=v[2]=u.range[0],c.rowSpan-h>1&&(v[2]+=c.rowSpan-h-1)):(v[0]=v[2]=e.start,c.rowSpan-(e.end-u.range[0]+1)>1&&(v[2]+=c.rowSpan-(e.end-u.range[0]+1)-1)),l.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0}))),u=null}else if("Column"===e.modelType){if(e.model=e.model,e.start>e.model.usedRange.colIndex)return;e.end>e.model.usedRange.colIndex&&(e.end-=e.end-e.model.usedRange.colIndex),e.model.usedRange.colIndex-=h,e.model.usedRange.colIndex<0&&(e.model.usedRange.colIndex=0),e.model!==this.parent.getActiveSheet()&&this.parent.notify("updateUsedRange",{index:e.model.usedRange.colIndex,update:"col"});var f=this.parent.frozenColCount(e.model);e.start<f&&(f=e.end<f?e.end-e.start+1:f-e.start,f=e.model.frozenColumns-f,this.parent.setSheetPropertyOnMute(e.model,"frozenColumns",f),s=!0),a=[];for(var p=e.end+1,c=void 0,u=void 0,g=0;g<=e.model.usedRange.rowIndex;g++)if(a.push({}),e.model.rows[g]&&e.model.rows[g].cells){if(e.model.rows[g].cells[e.start]&&void 0!==e.model.rows[g].cells[e.start].colSpan&&e.model.rows[g].cells[e.start].colSpan<0&&void 0===e.model.rows[g].cells[e.start].rowSpan&&(u={range:[g,e.start,g,e.start]},this.parent.notify("activeCellMergedRange",u),u.range=u.range,u.range[3]<=e.end)){var m=$(g,u.range[1],e.model);m&&m.colSpan>1&&(m.colSpan-(u.range[3]-e.start+1)>1?Z(g,u.range[1],e.model,{colSpan:m.colSpan-(u.range[3]-e.start+1)},!0):delete e.model.rows[g].cells[u.range[1]].colSpan),u=null}if(e.model.rows[g].cells[p]&&void 0!==e.model.rows[g].cells[p].colSpan&&e.model.rows[g].cells[p].colSpan<0&&void 0===e.model.rows[g].cells[p].rowSpan&&(u||(u={range:[g,p,g,p]},this.parent.notify("activeCellMergedRange",u)),c=new Object,u.range=u.range,Object.assign(c,$(u.range[0],u.range[1],e.model)),c&&c.colSpan&&(c.colSpan>1||c.rowSpan>1))){var v=[];v[0]=g,v[2]=c.rowSpan>1?g+(c.rowSpan-1):g,u.range=u.range,u.range[1]<e.start?(v[1]=v[3]=u.range[1],c.colSpan-h>1&&(v[3]+=c.colSpan-h-1)):(v[1]=v[3]=e.start,c.colSpan-(e.end-u.range[1]+1)>1&&(v[3]+=c.colSpan-(e.end-u.range[1]+1)-1)),l.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}a[g].cells=e.model.rows[g].cells.splice(e.start,h),u=null}}else if(e.end-e.start==this.parent.sheets.length-1)return;for(var y=[],g=e.start;g<=e.end;g++)this.parent.notify(Et,{action:"deleteSheetTab",sheetName:"",index:g+1}),e.model[n][e.start]?(y.push(e.model[n][e.start]),e.model[n].splice(e.start,1)):y.push({}),g===e.start&&(y[0].index=e.start);l.forEach(function(e){t.parent.notify(Ht,e)});var C={action:"refreshNamedRange",insertArgs:{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:y,deletedCellsModel:a,activeSheetIndex:this.parent.activeSheetIndex,name:"delete"}};this.parent.notify(Et,C),"Sheet"!==e.modelType&&e.model!==this.parent.getActiveSheet()||this.parent.notify("delete",{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:y,deletedCellsModel:a,activeSheetIndex:this.parent.activeSheetIndex,freezePane:s})}},e.prototype.setDeleteInfo=function(e,t,r,n){void 0===n&&(n="Row");var i=t-e+1,a=[];this.parent.getActiveSheet().ranges.forEach(function(o){o.info&&e<o.info[r]&&(o.info["delete"+n+"Range"]?o.info["delete"+n+"Range"].push([e,t]):o.info["delete"+n+"Range"]=[[e,t]],o.info[r]-=i,o.info["insert"+n+"Range"]&&(o.info["insert"+n+"Range"]=a))})},e.prototype.addEventListener=function(){this.parent.on("deleteModel",this.deleteModel,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("deleteModel",this.deleteModel)},e.prototype.getModuleName=function(){return"workbookdelete"},e}(),Pr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Ft,this.addValidationHandler,this),this.parent.on(Dt,this.removeValidationHandler,this),this.parent.on("addHighlight",this.addHighlightHandler,this),this.parent.on("removeHighlight",this.removeHighlightHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ft,this.addValidationHandler),this.parent.off(Dt,this.removeValidationHandler),this.parent.off("addHighlight",this.addHighlightHandler),this.parent.off("removeHighlight",this.removeHighlightHandler))},e.prototype.addValidationHandler=function(e){this.ValidationHandler(e.rules,e.range,!1)},e.prototype.removeValidationHandler=function(e){this.ValidationHandler(e.rules,e.range,!0)},e.prototype.ValidationHandler=function(e,r,n){var i,a=r,o="";r.indexOf("!")>-1&&(a=r.split("!")[1],o=r.split("!")[0]);var s=ce(this.parent,this.parent.getAddressInfo(o+"A1:A1").sheetIndex),l=!1,h=s.rowCount,d=a.split(":");a.match(/\D/g)&&!a.match(/[0-9]/g)?(d[0]+=1,d[1]+=h,a=d[0]+":"+d[1],l=!0):!a.match(/\D/g)&&a.match(/[0-9]/g)&&(d[0]="A"+d[0],d[1]=g(0,s.colCount-1).replace(/[0-9]/g,"")+d[1],a=d[0]+":"+d[1]),t.isNullOrUndefined(o)||(r=o+a);var p=c(r=r||s.selectedRange);if(l)for(m=p[1];m<=p[3];m++){var u=Ie(s,m);n&&u&&u.validation?delete s.columns[m].validation:(t.isNullOrUndefined(u)&&(s.columns[m]=Ie(s,m)),s.columns[m].validation={operator:e.operator,type:e.type,value1:"List"===e.type&&e.value1.length>256?e.value1.substring(0,255):e.value1,value2:e.value2,inCellDropDown:e.inCellDropDown,ignoreBlank:e.ignoreBlank})}else for(var f=p[0];f<=p[2];f++){s.rows[f]||Ce(s,f,{});for(var m=p[1];m<=p[3];m++)if(s.rows[f].cells&&s.rows[f].cells[m]||Z(f,m,s,{}),i=s.rows[f].cells[m],n){if(i.validation){delete i.validation;var v=this.parent.getCellStyleValue(["backgroundColor","color"],[f,m]);this.parent.notify(It,{style:v,rowIdx:f,colIdx:m})}}else i.validation={type:e.type,operator:e.operator,value1:"List"===e.type&&e.value1.length>256?e.value1.substring(0,255):e.value1,value2:e.value2,ignoreBlank:e.ignoreBlank,inCellDropDown:e.inCellDropDown}}},e.prototype.addHighlightHandler=function(e){this.InvalidDataHandler(e.range,!1,e.td)},e.prototype.removeHighlightHandler=function(e){this.InvalidDataHandler(e.range,!0)},e.prototype.getRange=function(e){var t=c(e),r=this.parent.getActiveSheet(),n=r.colCount,i=r.rowCount;return t[2]===i-1&&0===t[0]?e=e.replace(/[0-9]/g,""):t[3]===n-1&&0===t[2]&&(e=e.replace(/\D/g,"")),e},e.prototype.InvalidDataHandler=function(e,t,r){var n,i,a,o=this.parent.getActiveSheet(),s=(e=e||o.selectedRange)?c(e):[],l=!1;(e=this.getRange(e)).match(/\D/g)&&!e.match(/[0-9]/g)&&(l=!0);var h=e?s[0]:0,d=e?s[2]:o.rows.length;for(h;h<=d;h++)if(o.rows[h]){var p=e?s[1]:0,u=e?s[3]:o.rows[h].cells.length;for(p;p<=u;p++)if(o.rows[h].cells[p]){var f=Ie(o,p);(n=o.rows[h].cells[p])&&n.validation?(i=n.validation,t?i.isHighlighted&&(n.validation.isHighlighted=!1):n.validation.isHighlighted=!0):f&&f.validation&&(i=f.validation,t&&l?i.isHighlighted&&(f.validation.isHighlighted=!1):l&&(f.validation.isHighlighted=!0)),a=n.value?n.value:"";var g=[h,p],m=this.parent.activeSheetIndex;if(i&&this.parent.allowDataValidation){this.parent.notify("isValidation",{value:a,range:g,sheetIdx:m,isCell:!1});var v=this.parent.allowDataValidation;this.parent.allowDataValidation=!0,v||this.parent.notify("validationHighlight",{isRemoveHighlightedData:t,rowIdx:h,colIdx:p,td:r})}}}},e.prototype.getModuleName=function(){return"workbookDataValidation"},e}(),_r=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("findNext",this.findNext,this),this.parent.on("findPrevious",this.findPrevious,this),this.parent.on("replace",this.replace,this),this.parent.on("replaceAll",this.replaceAll,this),this.parent.on("count",this.totalCount,this),this.parent.on("findAllValues",this.findAllValues,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("findNext",this.findNext),this.parent.off("findPrevious",this.findPrevious),this.parent.off("replace",this.replace),this.parent.off("replaceAll",this.replaceAll),this.parent.off("count",this.totalCount),this.parent.off("findAllValues",this.findAllValues))},e.prototype.findNext=function(e){var t,r,n,i=this.parent.sheets,a=i[this.parent.activeSheetIndex],o=u(a.activeCell),s=a.usedRange,l=s.colIndex,h=e.value.toString(),d=0,p=s.rowIndex,c=t=o[1],f=r=o[0];if(a.rows[r]&&a.rows[r].cells&&a.rows[r].cells[t]&&(a.rows[r].cells[t].format?n=this.parent.getDisplayText(a.rows[r].cells[t]).toString():a.rows[r].cells[t].value&&(n=a.rows[r].cells[t].value.toString())),n){var g=n.toLowerCase(),m=n.indexOf(e.value)>-1,v=g.indexOf(e.value.toString().toLowerCase())>-1;(h===n||h===g||m||v)&&("By Column"===e.searchBy?r++:t++,d++)}(o[0]>a.usedRange.rowIndex||o[1]>a.usedRange.colIndex)&&(o[0]>a.usedRange.rowIndex&&o[1]<=a.usedRange.colIndex?(r=0,t=o[1]):o[0]<=a.usedRange.rowIndex&&o[1]>a.usedRange.colIndex?(r=o[0],t=0):(r=0,t=0));var y={rowIndex:r,colIndex:t,usedRange:s,endRow:p,endColumn:l,startRow:f,mode:e.mode,loopCount:0,count:d,args:e,val:void 0,stringValue:h,sheetIndex:this.parent.activeSheetIndex,startColumn:c,sheets:i};"By Row"===e.searchBy&&this.findNxtRow(y),"By Column"===e.searchBy&&this.findNxtCol(y)},e.prototype.findNxtRow=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length;t=r.usedRange;var i=u(r.activeCell);for(e.colIndex>=e.usedRange.colIndex+1&&(e.colIndex=0,e.rowIndex++),e.rowIndex;e.rowIndex<=e.endRow+1;e.rowIndex++){if(e.rowIndex>e.endRow){if("Workbook"===e.mode){var a=this.parent.activeSheetIndex;if(e.sheetIndex++,n===e.sheetIndex&&(e.sheetIndex=0),a===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,i=u(r.activeCell),e.rowIndex=0,e.colIndex=0,e.endColumn=t.colIndex,e.endRow=t.rowIndex}if(0===e.colIndex&&e.rowIndex>e.endRow)if(0===i[0]&&0===i[1]){if(0===e.count)return void this.parent.notify(Nt,null)}else(0!==i[0]&&0!==i[1]||0!==i[0]||0!==i[1])&&(e.startColumn=0,e.startRow=0,e.endColumn=t.colIndex,e.endRow=i[0],e.rowIndex=e.startRow,e.colIndex=e.startColumn,e.loopCount++)}if(e.count>0&&t.rowIndex<e.rowIndex&&(e.rowIndex=0,0===e.rowIndex&&(e.colIndex=0)),r.rows[e.rowIndex]){var o=r.rows[e.rowIndex];for(e.colIndex;e.colIndex<=e.endColumn;e.colIndex++)if(o&&o.cells&&o.cells[e.colIndex]&&this.nextCommon(e))return;if(e.colIndex>e.endColumn&&(e.colIndex=0),e.loopCount>0&&i[0]===e.rowIndex)return void this.parent.notify(Nt,null)}}if(0===e.count)return void this.parent.notify(Nt,null)},e.prototype.findNxtCol=function(e){var t,r=e.sheets[e.sheetIndex],n=u(r.activeCell),i=this.parent.sheets.length;for(e.rowIndex>=e.usedRange.rowIndex&&(e.rowIndex=0,e.colIndex++),e.colIndex;e.colIndex<=e.usedRange.colIndex+1;e.colIndex++){if(e.colIndex>=e.endColumn+1&&"Workbook"===e.mode){if(t=this.parent.activeSheetIndex,e.sheetIndex++,i===e.sheetIndex&&(e.sheetIndex=0),t===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);r=e.sheets[e.sheetIndex],e.usedRange=r.usedRange,n=u(r.activeCell),e.colIndex=0,e.rowIndex=0,e.endColumn=e.usedRange.colIndex,e.endRow=e.usedRange.rowIndex}if(e.colIndex>=e.endColumn+1&&(e.colIndex=0),e.rowIndex>e.endRow&&0===e.colIndex)if(0===n[0]&&0===n[1]||n[1]>r.usedRange.rowIndex||n[0]>r.usedRange.colIndex){if(0===e.count)return void this.parent.notify(Nt,null)}else(0!==n[1]||0!==n[0]||0!==n[1]&&0!==n[0])&&(e.startRow=0,e.startColumn=0,e.endRow=n[0],e.endColumn=e.usedRange.colIndex,e.colIndex=e.startColumn,e.rowIndex=e.startRow,e.loopCount++);if(e.count>0&&e.usedRange.colIndex+1<e.colIndex&&(e.colIndex=0,e.rowIndex=0),e.rowIndex>=e.endRow&&(e.rowIndex=0),e.colIndex<=e.usedRange.colIndex){for(e.rowIndex;e.rowIndex<=e.usedRange.rowIndex;e.rowIndex++)if(r.rows[e.rowIndex]&&r.rows[e.rowIndex].cells&&r.rows[e.rowIndex].cells[e.colIndex]&&this.nextCommon(e))return;if(e.loopCount>0&&n[1]===e.colIndex)return void this.parent.notify(Nt,null)}}if(0===e.count)return void this.parent.notify(Nt,null)},e.prototype.nextCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r&&r.value){var n=t.rows[e.rowIndex].cells[e.colIndex];if(n){var i=void 0;if(i=n.format?this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex]):t.rows[e.rowIndex].cells[e.colIndex].value.toString(),e.args.isCSen&&e.args.isEMatch){if(i===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){a=i.indexOf(e.args.value)>-1;if(i===e.stringValue||a){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=i.toString().toLowerCase(),e.val===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=i.toString().toLowerCase();var a=e.val.indexOf(e.args.value.toString().toLowerCase())>-1,o=e.val.indexOf(e.args.value)>-1;if(e.val===e.stringValue||i===e.stringValue||a||i===e.stringValue||o){var s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}}}}return!1},e.prototype.findPrevious=function(e){var t,r=this.parent.sheets,n=e.sheetIndex,i=r[n],a=u(i.activeCell),o=0,s=i.usedRange.rowIndex,l=i.usedRange.colIndex,h=e.value.toString(),d=a[1],p=a[0],c=d,f=p;if(i.rows[p]&&i.rows[p].cells[d]&&(i.rows[p].cells[d].format?t=this.parent.getDisplayText(i.rows[p].cells[d]).toString():i.rows[p].cells[d].value&&(t=i.rows[p].cells[d].value.toString())),t){var g=t.toLowerCase(),m=t.indexOf(e.value)>-1,v=g.indexOf(e.value.toString().toLowerCase())>-1;(h===t||h===g||m||v)&&("By Row"===e.searchBy&&d--,"By Column"===e.searchBy&&p--,o++)}(a[0]>i.usedRange.rowIndex||a[1]>i.usedRange.colIndex)&&(a[0]>i.usedRange.rowIndex&&a[1]<=i.usedRange.colIndex?(p=i.usedRange.rowIndex,d=a[1]):a[0]<=i.usedRange.rowIndex&&a[1]>i.usedRange.colIndex?(p=a[0],d=i.usedRange.colIndex):(p=i.usedRange.rowIndex,d=i.usedRange.colIndex));var y={rowIndex:p,colIndex:d,endRow:s,endColumn:l,startRow:f,loopCount:0,count:o,args:e,val:void 0,stringValue:h,sheets:r,sheetIndex:n,startColumn:c};"By Row"===e.searchBy&&this.findPreRow(y),"By Column"===e.searchBy&&this.findPreCol(y)},e.prototype.findPreRow=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=!1,a=u(r.activeCell);for(-1===e.colIndex&&(e.colIndex=e.endColumn,e.rowIndex--),e.rowIndex;e.rowIndex>=-1;e.rowIndex--){if(e.rowIndex<0&&e.colIndex<=0){if("Workbook"===e.args.mode){var o=this.parent.activeSheetIndex;if(-1===--e.sheetIndex&&(e.sheetIndex=n-1),o===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,a=u(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,a)}if(!i){"Workbook"!==e.args.mode&&e.count>0&&-1===e.rowIndex&&(e.rowIndex=e.endRow),-1===e.rowIndex&&(e.rowIndex=r.usedRange.rowIndex,e.colIndex=r.usedRange.colIndex);var s=r.rows[e.rowIndex];if(s){for(-1===e.colIndex&&(e.colIndex=r.usedRange.colIndex),e.colIndex;e.colIndex>=0;e.colIndex--)if(s&&s.cells&&s.cells[e.colIndex]&&this.prevCommon(e))return;if(e.loopCount>0&&a[0]===e.rowIndex)return void this.parent.notify(Nt,null)}}}if(!i&&0===e.count)return void this.parent.notify(Nt,null)},e.prototype.findPreCol=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=!1,a=u(r.activeCell);for(e.colIndex;e.colIndex>=-1;e.colIndex--){if(e.rowIndex<0&&e.colIndex<=0){if("Workbook"===e.args.mode){var o=this.parent.activeSheetIndex;if(-1===--e.sheetIndex&&(e.sheetIndex=n-1),o===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,a=u(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,a)}if(!i){e.count>0&&e.colIndex<0&&(e.colIndex=e.endColumn),e.rowIndex<0&&(e.rowIndex=r.usedRange.rowIndex),e.colIndex<-1&&(e.colIndex=r.usedRange.colIndex,e.rowIndex--);var s=r.rows[e.rowIndex];for(s&&r.rows[e.rowIndex].cells[e.colIndex]&&-1===e.rowIndex&&(e.rowIndex=r.usedRange.rowIndex),e.rowIndex;e.rowIndex>=0;e.rowIndex--){if(s&&s.cells&&s.cells[e.colIndex]&&this.prevCommon(e))return;if(e.loopCount>0&&a[1]===e.colIndex)return void this.parent.notify(Nt,null)}}}if(!i&&0===e.count)return void this.parent.notify(Nt,null)},e.prototype.commonCondition=function(e,t){var r,n=e.sheets[e.sheetIndex];return t[0]!==e.endRow&&t[1]!==e.endColumn||t[0]!==e.endRow||t[1]!==e.endColumn?(e.startColumn=n.usedRange.colIndex,e.startRow=n.usedRange.rowIndex,e.endColumn=0,e.endRow=t[0],e.rowIndex=e.startRow,e.colIndex=e.startColumn,e.loopCount++,r=!1):(t[0]===n.usedRange.rowIndex&&t[1]===n.usedRange.colIndex||t[0]>n.usedRange.rowIndex||t[1]>n.usedRange.colIndex)&&0!==t[0]&&0!==t[1]&&(this.parent.notify(Nt,null),r=!0),r},e.prototype.prevCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r&&r.value){var n=t.rows[e.rowIndex].cells[e.colIndex];if(n){var i=void 0;if(i=n.format?this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex]):t.rows[e.rowIndex].cells[e.colIndex].value.toString(),e.args.isCSen&&e.args.isEMatch){if(i===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){a=i.indexOf(e.args.value)>-1;if(i===e.stringValue||a){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=i.toString().toLowerCase(),e.val===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=i.toString().toLowerCase();var a=e.val.indexOf(e.args.value.toString().toLowerCase())>-1,o=e.val.indexOf(e.args.value)>-1;if(i===e.stringValue||i===e.stringValue||a||e.val===e.stringValue||o){var s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}}}}return!1},e.prototype.replace=function(e){if(this.parent.getActiveSheet().isProtected)return void this.parent.notify("editAlert",null);var t=this.parent.getActiveSheet(),r=u(t.activeCell),n=t.rows[r[0]].cells[r[1]].value.toString(),i=n.indexOf(e.value)>-1,a=n.toLowerCase().indexOf(e.value.toString().toLowerCase())>-1,o=n.toString().toLowerCase();n===e.value||i||o===e.value||a||(e.findOpt="next",this.findNext(e)),this.parent.getActiveSheet();var s,l=u(t.activeCell),h=t.activeCell,d=t.rows[l[0]].cells[l[1]],p=t.rows[l[0]].cells[l[1]].format,c=t.name+"!"+g(l[0],l[1]),f={undoRedoOpt:"before",address:c,compareVal:s=p?this.parent.getDisplayText(t.rows[l[0]].cells[l[1]]).toString():t.rows[l[0]].cells[l[1]].value.toString()};this.parent.notify("findUndoRedo",f);var m=s.toLowerCase(),v=s.indexOf(e.value)>-1,y=m.indexOf(e.value)>-1;if(e.value===s||e.value===m){t.rows[l[0]].cells[l[1]].value=e.replaceValue,this.parent.updateCell(d,h);var C={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",C)}else if(v){var b=s.replace(e.value,e.replaceValue);t.rows[l[0]].cells[l[1]].value=b,this.parent.updateCell(d,h);var S={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",S)}else if(y){var x=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),w=s.replace(x,e.replaceValue);t.rows[l[0]].cells[l[1]].value=w,this.parent.updateCell(d,h);var I={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",I)}},e.prototype.replaceAll=function(e){var t,r=0,n=this.parent.sheets[r],i=n.usedRange.rowIndex,a=0,o=0,s=n.usedRange.colIndex,l=0,h=[];for(o;o<=i;o++)if(l>s&&o===i&&"Workbook"===e.mode&&(r++,(n=this.parent.sheets[r])&&(l=0,o=0,s=n.usedRange.colIndex,i=n.usedRange.rowIndex)),n&&n.rows[o]){var d=n.rows[o];for(l===s+1&&(l=0),l;l<=s;l++){var p=n.rows[o].cells[l];if(d&&d.cells&&d.cells[l]&&d.cells[l].value){var c=n.rows[o].cells[l];if(c){var u=void 0;if(u=c.format?this.parent.getDisplayText(n.rows[o].cells[l]).toString():n.rows[o].cells[l].value.toString(),e.isCSen&&e.isEMatch)u===e.value&&(n.rows[o].cells[l].value=e.replaceValue,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++);else if(e.isCSen&&!e.isEMatch){m=u.indexOf(e.value)>-1;if(u===e.value||m){C=u.replace(e.value,e.replaceValue);n.rows[o].cells[l].value=C,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++}}else if(!e.isCSen&&e.isEMatch)(f=u.toString().toLowerCase())===e.value&&(n.rows[o].cells[l].value=e.replaceValue,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++);else if(!e.isCSen&&!e.isEMatch){var f=u.toString().toLowerCase(),m=f.indexOf(e.value.toString().toLowerCase())>-1,v=f.indexOf(e.value)>-1;if(u===e.value||m||f===e.value||u===e.value||v){var y=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),C=u.replace(y,e.replaceValue);n.rows[o].cells[l].value=C,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++}}}}}}var b={undoRedoOpt:"beforeReplaceAll",Collection:h,replaceValue:e.value};this.parent.notify("findUndoRedo",b),b={undoRedoOpt:"afterReplaceAll",Collection:h,replaceValue:e.replaceValue},this.parent.notify("findUndoRedo",b);var S=a;this.parent.notify("replaceAllDialog",{count:S,replaceValue:e.replaceValue})},e.prototype.totalCount=function(e){var t=this.parent.sheets[e.sheetIndex],r=t.usedRange.rowIndex,n=0,i=0,a=t.usedRange.colIndex,o=0;for(i;i<=r;i++)if(t.rows[i]){var s=t.rows[i];for(o===a+1&&(o=0),o;o<=a;o++)if(s&&s.cells&&s.cells[o]&&s.cells[o].value){var l=t.rows[i].cells[o];if(l){var h=void 0;if(h=l.format?this.parent.getDisplayText(t.rows[i].cells[o]).toString():l.value.toString(),e.isCSen&&e.isEMatch)h===e.value&&n++;else if(e.isCSen&&!e.isEMatch){d=h.indexOf(e.value)>-1;(h===e.value||d)&&n++}else if(!e.isCSen&&e.isEMatch)(g=h.toString().toLowerCase())===e.value&&n++;else if(!e.isCSen&&!e.isEMatch){var d=(g=h.toString().toLowerCase()).indexOf(e.value.toString().toLowerCase())>-1,p=g.indexOf(e.value)>-1;(g===e.value||h===e.value||d||h===e.value||p)&&n++}}}}var c=n;if((n=c-(this.requiredCount(e)-1))>c&&(n=c),0!==n){var f=u(t.activeCell),g=t.rows[f[0]]?this.parent.getDisplayText(t.rows[f[0]].cells[f[1]]).toString().toLowerCase():null;g&&-1===g.indexOf(e.value.toString().toLowerCase())&&(n-=1)}e.findCount=n+" of "+c},e.prototype.requiredCount=function(e){var t=this.parent.activeSheetIndex,r=this.parent.sheets[t],n=u(r.activeCell),i=r.usedRange.rowIndex,a=0,o=n[0],s=r.usedRange.colIndex,l=n[1];for(o;o<=i;o++)if(r.rows[o]){var h=r.rows[o];for(l===s+1&&(l=0),l;l<=s;l++)if(h&&h.cells&&h.cells[l]&&h.cells[l].value&&r.rows[o].cells[l]){var d=void 0;if(d=r.rows[o].cells[l].format?this.parent.getDisplayText(r.rows[o].cells[l]).toString():r.rows[o].cells[l].value.toString(),e.isCSen&&!e.isEMatch){f=d.indexOf(e.value)>-1;(d===e.value||f)&&a++}else if(e.isCSen&&e.isEMatch)d===e.value&&a++;else if(!e.isCSen&&e.isEMatch)(p=d.toString().toLowerCase())===e.value&&a++;else if(!e.isCSen&&!e.isEMatch){var p=d.toString().toLowerCase(),c=e.value.toString().toLowerCase(),f=p.indexOf(c)>-1,g=p.indexOf(e.value)>-1;(d===e.value||p===c||f||p===e.value||g)&&a++}}}return a},e.prototype.findAllValues=function(e){var r,n=e.sheetIndex,i=this.parent.sheets[n-1],a=i.usedRange.rowIndex,o=0,s=0,l=i.usedRange.colIndex,h=0,d=this.parent.sheets.length,p=e.sheetIndex;for(o;o<=a+1;o++){if(1!==p&&e.sheetIndex===d&&(n=1),o>a&&h>l&&"Workbook"===e.mode){if(n++,p===n)return void 0;n>d-1&&(n=0),(i=this.parent.sheets[n])&&(o=0,h=0,l=i.usedRange.colIndex,a=i.usedRange.rowIndex)}if(!t.isNullOrUndefined(i)&&i.rows[o]){var c=i.rows[o];for(h===l+2&&(h=0),h;h<=l+1;h++)if(c&&c.cells&&c.cells[h]){var u=i.rows[o].cells[h];if(u){var f=void 0;if(f=u.format?this.parent.getDisplayText(i.rows[o].cells[h]).toString():u.value.toString(),e.isCSen&&e.isEMatch)f===e.value&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++);else if(e.isCSen&&!e.isEMatch){v=f.indexOf(e.value)>-1;(f===e.value||v)&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++)}else if(!e.isCSen&&e.isEMatch)(m=f.toString().toLowerCase())===e.value&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++);else if(!e.isCSen&&!e.isEMatch){var m=f.toString().toLowerCase(),v=m.indexOf(e.value.toLowerCase())>-1;(m===e.value||f===e.value||v||f===e.value)&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++)}}}}}},e.prototype.getModuleName=function(){return"workbookfindAndReplace"},e}(),Ur=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.protectsheetHandler=function(e){var r=this.parent.getActiveSheet();this.parent.setSheetPropertyOnMute(r,"protectSettings",{selectCells:e.selectCells,formatCells:e.formatCells,formatColumns:e.formatColumns,formatRows:e.formatRows,insertLink:e.insertLink}),this.parent.notify("protectSheet",r.protectSettings),this.parent.notify("updateToggleItem",{props:"Protect"}),r.columns.forEach(function(e){e&&t.isUndefined(e.isLocked)&&(e.isLocked=!0)})},e.prototype.unprotectsheetHandler=function(e){var t=this.parent.getActiveSheet();e.sheet&&(t=this.parent.sheets[e.sheet]),t.protectSettings.formatCells=t.protectSettings.formatColumns=!1,t.protectSettings.formatRows=t.protectSettings.selectCells=!1,this.parent.setSheetPropertyOnMute(t,"isProtected",!1),this.parent.notify("protectSheet",t.protectSettings),this.parent.notify("updateToggleItem",{props:"Protect"})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("protectsheetHandler",this.protectsheetHandler,this),this.parent.on("unprotectsheetHandler",this.unprotectsheetHandler,this),this.parent.on("setLockCells",this.lockCells,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("protectsheetHandler",this.protectsheetHandler),this.parent.off("setLockCells",this.lockCells),this.parent.off("protectsheetHandler",this.unprotectsheetHandler))},e.prototype.lockCells=function(e){var t,r=this.parent.getActiveSheet(),n="object"==typeof(t=e?e.range:r.selectedRange)?t:x(c(t));if(0===n[0]&&n[2]===r.rowCount-1)for(i=n[1];i<=n[3];i++)Ee(r,i,{isLocked:e.isLocked});for(var i=n[0];i<=n[2];i++)for(var a=n[1];a<=n[3];a++)this.parent.getActiveSheet().id===r.id&&this.parent.notify("applyLockCells",{rowIdx:i,colIdx:a,isLocked:e.isLocked})},e.prototype.getModuleName=function(){return"workbookProtectSheet"},e}(),Vr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){e.isAction&&(this.parent.notify("actionBegin",{eventArgs:e,action:"merge"}),e.model||(e.model=[])),"string"==typeof e.range&&(e.range=c(e.range)),e.range=x(e.range);var t=e.sheet||this.parent.getActiveSheet();e.skipChecking||this.mergedRange(e),e.merge&&"All"!==e.type?"Horizontally"===e.type?this.mergeHorizontally(e):"Vertically"===e.type&&this.mergeVertically(e):(this.mergeAll(e),e.refreshRibbon&&this.parent.notify("activeCellChanged",null)),this.parent.setUsedRange(e.range[2],e.range[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:e,action:"merge"}),this.parent.sheets.indexOf(t)===this.parent.activeSheetIndex&&this.parent.notify("selectRange",{address:t.selectedRange,skipChecking:!0})},e.prototype.mergeAll=function(e){var r,n=0;e.range=e.range;var i,a,o,s=e.sheet||this.parent.getActiveSheet(),l=$(e.range[0],e.range[1],s),h=l&&l.style?l.style.borderLeft:null;"none"===h&&(h="none"!==l.style.borderRight?l.style.borderRight:l.style.borderTop?l.style.borderTop:null),"none"===h&&(h="none"!==l.style.borderBottom?l.style.borderBottom:null),t.isNullOrUndefined(l)||t.isNullOrUndefined(h)||(l.style.borderBottom="",l.style.borderLeft="",l.style.borderTop="",l.style.borderRight="");for(var d=e.range[0];d<=e.range[2];d++){i=0,e.isAction&&e.model.push({cells:[]});for(var p=e.range[1];p<=e.range[3];p++){if((r=$(d,p,s))&&(r.value||r.formula)&&!a&&(a=r.formula||r.value),e.isAction&&e.merge&&(e.model[d-e.range[0]].cells[p-e.range[1]]={},Object.assign(e.model[d-e.range[0]].cells[p-e.range[1]],r)),s.rows[d]&&s.rows[d].cells&&s.rows[d].cells[p]&&(delete s.rows[d].cells[p].rowSpan,delete s.rows[d].cells[p].colSpan,!e.merge&&!e.isAction&&e.model&&e.model[d-e.range[0]]&&e.model[d-e.range[0]].cells[p-e.range[1]]&&e.model[d-e.range[0]].cells[p-e.range[1]]!=={}&&Z(d,p,s,e.model[d-e.range[0]].cells[p-e.range[1]])),e.merge){if(r=new Object,d===e.range[0]&&p===e.range[1]){e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),Z(e.range[0],e.range[1],s,r,!0);continue}d!==e.range[0]&&(r.rowSpan=-n),p!==e.range[1]&&(i++,r.colSpan=-i),s.rows[d]&&s.rows[d].cells&&s.rows[d].cells[p]&&(delete s.rows[d].cells[p].value,delete s.rows[d].cells[p].formula),o=$(d,p,s)||{},Z(d,p,s,Object.assign(r,o))}e.preventRefresh||this.parent.notify("applyMerge",{rowIdx:d,colIdx:p})}n++}e.merge&&(r=this.getCellValue(e.range[0],e.range[1],a,s),Z(e.range[0],e.range[1],s,r,!0),e.preventRefresh||this.parent.notify("applyMerge",{rowIdx:e.range[0],colIdx:e.range[1]})),t.isNullOrUndefined(h)||this.parent.notify(wt,{style:{border:h},range:e.range,onActionUpdate:!0})},e.prototype.mergeHorizontally=function(e){var t;e.range=e.range;for(var r,n,i,a,o=e.sheet||this.parent.getActiveSheet(),s=e.range[0];s<=e.range[2];s++){t=0,e.isAction&&e.model.push({cells:[]});for(var l=e.range[1];l<=e.range[3];l++){if(a=$(s,l,o),r=new Object,e.isAction&&(e.model[s-e.range[0]].cells[l-e.range[1]]={},Object.assign(e.model[s-e.range[0]].cells[l-e.range[1]],a)),l===e.range[1]){if(s===e.range[0])continue;i=s-1,o.rows[i]&&o.rows[i].cells&&o.rows[i].cells[l]&&delete o.rows[i].cells[l].rowSpan,r=this.getCellValue(i,l,n,o),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),n=null,Z(i,l,o,r,!0)}else a&&(a.value||a.formula)&&!n&&(n=a.formula||a.value),i=s,o.rows[i]&&o.rows[i].cells&&o.rows[i].cells[l]&&(delete o.rows[i].cells[l].rowSpan,delete o.rows[i].cells[l].value,delete o.rows[i].cells[l].formula),t++,r.colSpan=-t,Z(i,l,o,r,!0);this.parent.notify("applyMerge",{rowIdx:i,colIdx:l})}}o.rows[e.range[2]]&&o.rows[e.range[2]].cells&&o.rows[e.range[2]].cells[e.range[1]]&&delete o.rows[e.range[2]].cells[e.range[1]].rowSpan,r=this.getCellValue(e.range[2],e.range[1],n,o),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),Z(e.range[2],e.range[1],o,r,!0),this.parent.notify("applyMerge",{rowIdx:e.range[2],colIdx:e.range[1]})},e.prototype.getCellValue=function(e,t,r,n){var i=new Object,a=$(e,t,n);return!r||a&&(a.value||a.formula)||(q(r)?i.formula=r:i.value=r),i},e.prototype.mergeVertically=function(e){var t=0;e.range=e.range;for(var r,n,i,a,o=e.sheet||this.parent.getActiveSheet(),s=e.range[1];s<=e.range[3];s++)for(var l=e.range[0];l<=e.range[2];l++){if(a=$(l,s,o),e.isAction&&(void 0===e.model[l-e.range[0]]&&(e.model[l-e.range[0]]={cells:[]}),e.model[l-e.range[0]].cells[s-e.range[1]]={},Object.assign(e.model[l-e.range[0]].cells[s-e.range[1]],a)),l===e.range[0]){if(t=0,s===e.range[1])continue;i=s-1,o.rows[l]&&o.rows[l].cells&&o.rows[l].cells[i]&&delete o.rows[l].cells[i].colSpan,r=this.getCellValue(l,i,n,o),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),n=null,Z(l,i,o,r,!0)}else r=new Object,a&&(a.value||a.formula)&&!n&&(n=a.formula||a.value),t++,i=s,o.rows[l]&&o.rows[l].cells&&o.rows[l].cells[i]&&(delete o.rows[l].cells[i].colSpan,delete o.rows[l].cells[i].value,delete o.rows[l].cells[i].formula),r.rowSpan=-t,Z(l,i,o,r,!0);this.parent.notify("applyMerge",{rowIdx:l,colIdx:i})}o.rows[e.range[0]]&&o.rows[e.range[0]].cells&&o.rows[e.range[0]].cells[e.range[3]]&&delete o.rows[e.range[0]].cells[e.range[3]].colSpan,r=this.getCellValue(e.range[0],e.range[1],n,o),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),Z(e.range[0],e.range[3],o,r,!0),this.parent.notify("applyMerge",{rowIdx:e.range[0],colIdx:e.range[3]})},e.prototype.activeCellRange=function(e){e.range=e.range;var r=this.parent.getActiveSheet(),n=$(e.range[0],e.range[1],r);n&&(!t.isNullOrUndefined(n.rowSpan)&&n.rowSpan<0&&(e.range[0]+=n.rowSpan,e.insertCount&&(e.range[0]-=e.insertCount)),!t.isNullOrUndefined(n.colSpan)&&n.colSpan<0&&(e.range[1]+=n.colSpan,e.insertCount&&(e.range[1]-=e.insertCount)),(n=$(e.range[0],e.range[1],r))&&(n.rowSpan>1&&(e.range[0]+(n.rowSpan-1)>=e.range[2]||e.insertCount)&&(e.range[2]=e.range[0]+(n.rowSpan-1)),n.colSpan>1&&(e.range[1]+(n.colSpan-1)>=e.range[3]||e.insertCount)&&(e.range[3]=e.range[1]+(n.colSpan-1))))},e.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=c(e.range)),e.range[0]<=e.range[2]&&e.range[1]<=e.range[3]?this.forward(e):e.range[0]>=e.range[2]&&e.range[1]>=e.range[3]?this.reverse(e):e.range[0]<e.range[2]&&e.range[1]>e.range[3]?this.forwardReverse(e):e.range[0]>e.range[2]&&e.range[1]<e.range[3]&&this.reverseForward(e)},e.prototype.forward=function(e){e.range=e.range;var r,n,i=e.sheet||this.parent.getActiveSheet(),a=$(e.range[0],e.range[1],i),o=r=e.range[0],s=n=e.range[1];if(a&&(!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o=r=e.range[0]+a.rowSpan),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s=n=e.range[1]+a.colSpan),(a=$(o,s,i))&&(a.rowSpan>1&&(r+=a.rowSpan-1,o+(a.rowSpan-1)>=e.range[2]&&(e.range[2]=e.range[0],e.range[2]=o+(a.rowSpan-1))),a.colSpan>1&&(n+=a.colSpan-1,s+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=s+(a.colSpan-1))))),e.range[0]=o,e.range[1]=s,e.range[0]===o&&e.range[1]===s&&e.range[2]===r&&e.range[3]===n&&(e.isActiveCell=!0),!e.skipChecking){for(d=e.range[1];d<=e.range[3];d++)(a=$(e.range[2],d,i))&&(o=e.range[2],s=d,!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[0]&&(e.range[0]=o),(a=$(o,s,i))&&(a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1))));for(var l,h,d=e.range[1];d<=e.range[3];d++)(a=$(e.range[0],d,i))&&(h=d,l=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(h+=a.colSpan)<e.range[1]&&(e.range[1]=h),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(l+=a.rowSpan)<e.range[0]&&(e.range[0]=l));for(d=e.range[0];d<=e.range[2];d++)(a=$(d,e.range[3],i))&&(o=d,s=e.range[3],!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[0]&&(e.range[0]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),(a=$(o,s,i))&&(a.rowSpan>1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1)),a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1))))}},e.prototype.forwardReverse=function(e){var r=this.parent.getActiveSheet();e.range=e.range;var n=e.range[1],i=$(e.range[0],e.range[1],r),a=e.range[0];if(i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan,e.range[3]>=n&&(e.range[3]=n)),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<e.range[0]&&(e.range[0]=a),(i=$(a,n,r))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=e.range[2]&&(e.range[2]=a+(i.rowSpan-1)),i.colSpan>1&&n+(i.colSpan-1)>=e.range[1]&&(e.range[1]=n+(i.colSpan-1)))),e.range[0]=a,!e.skipChecking){for(var o,s,l=e.range[3];l<=e.range[1];l++)(i=$(e.range[2],l,r))&&(s=l,o=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)<e.range[0]&&(e.range[0]=o),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[3]&&(e.range[3]=s),(i=$(o,s,r))&&(i.rowSpan>1&&o+(i.rowSpan-1)>e.range[2]&&(e.range[2]=o+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s+(i.colSpan-1))));for(var h,l=e.range[3];l<=e.range[1];l++)(i=$(e.range[0],l,r))&&(s=l,h=e.range[0],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)<e.range[0]&&(e.range[0]=h),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan),(i=$(h,s,r))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))));for(var d,l=e.range[0];l<=e.range[2];l++)(i=$(l,e.range[3],r))&&(h=l,d=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)<e.range[0]&&(e.range[0]=h),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(d+=i.colSpan)<e.range[3]&&(e.range[3]=d),(i=$(h,d,r))&&(i.rowSpan>1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h,e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&d+(i.colSpan-1)>e.range[1]&&(e.range[1]=d,e.range[1]=d+(i.colSpan-1))))}},e.prototype.reverse=function(e){e.range=e.range;var r=e.range[1],n=e.sheet||this.parent.getActiveSheet(),i=$(e.range[0],e.range[1],n),a=e.range[0];i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(r+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),e.range[2]>=a&&(e.range[2]=a,e.isActiveCell=!0),e.range[3]>=r?(e.range[3]=r,e.range[2]===a&&(e.isActiveCell=!0)):e.isActiveCell&&(e.isActiveCell=!1),(i=$(a,r,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&r+(i.colSpan-1)>=e.range[1]&&(e.range[1]=r,e.range[1]=r+(i.colSpan-1))));var o=e.range[3];if(!e.skipChecking){for(h=e.range[3];h<=e.range[1];h++)(i=$(e.range[2],h,n))&&(o=h,a=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)<e.range[2]&&(e.range[2]=a),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan)<e.range[3]&&(e.range[3]=o),(i=$(a,o,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1))));o=e.range[3];for(h=e.range[3];h<=e.range[1];h++)(i=$(e.range[0],h,n))&&(o=h,a=e.range[0],!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),(i=$(a,o,n))&&(i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1)),i.rowSpan>1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1))));for(var s,l,h=e.range[2];h<=e.range[0];h++)(i=$(h,e.range[3],n))&&(l=h,s=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(l+=i.rowSpan)<e.range[2]&&(e.range[2]=l),!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(s+=i.colSpan)<e.range[3]&&(e.range[3]=s),(i=$(l,s,n))&&(i.rowSpan>1&&l+(i.rowSpan-1)>e.range[0]&&(e.range[0]=l,e.range[0]=l+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))))}},e.prototype.reverseForward=function(e){e.range=e.range;var r=e.sheet||this.parent.getActiveSheet(),n=e.range[0],i=e.range[1],a=$(e.range[0],e.range[1],r);if(a&&(!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(n+=a.rowSpan,e.range[2]>=n&&(e.range[2]=n)),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(i+=a.colSpan),(a=$(n,i,r))&&(a.rowSpan>1&&n+(a.rowSpan-1)>=e.range[0]&&(e.range[0]=n,e.range[0]=n+(a.rowSpan-1)),a.colSpan>1&&i+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=i+(a.colSpan-1)))),!e.skipChecking){for(var o,s=e.range[3],l=e.range[1];l<=e.range[3];l++)(a=$(e.range[2],l,r))&&(o=e.range[2],s=l,!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[2]&&(e.range[2]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)<e.range[1]&&(e.range[1]=s),(a=$(o,s,r))&&(a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o)));for(var h,d,l=e.range[1];l<=e.range[3];l++)(a=$(e.range[0],l,r))&&(d=l,h=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(d+=a.colSpan)<e.range[1]&&(e.range[1]=d),!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(h+=a.rowSpan),(a=$(h,d,r))&&a.rowSpan>1&&h+(a.rowSpan-1)>e.range[0]&&(e.range[0]=h+(a.rowSpan-1)));for(var p,l=e.range[2];l<=e.range[0];l++)(a=$(l,e.range[3],r))&&(o=l,p=e.range[3],!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)<e.range[2]&&(e.range[2]=o),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(p+=a.colSpan)<e.range[1]&&(e.range[1]=p),(a=$(o,p,r))&&(a.rowSpan>1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o),a.colSpan>1&&a.colSpan-1+p>e.range[3]&&(e.range[3]=p,e.range[3]=a.colSpan-1+p)))}},e.prototype.insertHandler=function(e){this.activeCellRange(e),e.range=e.range,"Row"===e.insertModel?e.range[2]+=e.insertCount:e.range[3]+=e.insertCount,e.preventRefresh=!0,e.merge=!0,this.mergeAll(e)},e.prototype.pasteHandler=function(e){for(var t,r,n,i=this.parent.getActiveSheet(),a=u(i.activeCell),o=e.range[0],s=0;o<=e.range[2];o++,s++)for(var l=e.range[1],h=0;l<=e.range[3];l++,h++){if((t=$(o,l,e.prevSheet)||{}).rowSpan>1&&(n=$(a[0]+(t.rowSpan-1),a[1],i)||{},r=$(a[0]+1,a[1],i)||{},void 0!==n.colSpan&&n.colSpan<0||void 0!==r.colSpan&&r.colSpan<0))return e.cancel=!0,void this.parent.notify("applyMerge",{showDialog:!0});if(t.colSpan>1&&(n=$(a[0],a[1]+(t.colSpan-1),i)||{},r=$(a[0],a[1]+1,i)||{},void 0!==n.rowSpan&&n.rowSpan<0||void 0!==r.rowSpan&&r.rowSpan<0))return e.cancel=!0,void this.parent.notify("applyMerge",{showDialog:!0})}},e.prototype.addEventListener=function(){this.parent.on(Ht,this.merge,this),this.parent.on("mergedRange",this.mergedRange,this),this.parent.on("activeCellMergedRange",this.activeCellRange,this),this.parent.on("insertMerge",this.insertHandler,this),this.parent.on("pasteMerge",this.pasteHandler,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ht,this.merge),this.parent.off("mergedRange",this.mergedRange),this.parent.off("activeCellMergedRange",this.activeCellRange),this.parent.off("insertMerge",this.insertHandler),this.parent.off("pasteMerge",this.pasteHandler))},e.prototype.getModuleName=function(){return"workbookmerge"},e}(),zr=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(Bt,this.setCFrulHandler,this),this.parent.on(Mt,this.clearRules,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Bt,this.setCFrulHandler),this.parent.off(Mt,this.clearRules))},e.prototype.setCFrulHandler=function(e){var t=e.conditionalFormat,r=t.range,n=this.parent.getAddressInfo(r).sheetIndex,i=ce(this.parent,n),a=x(c(r=r||i.selectedRange));t.range=m(a),i.conditionalFormats||this.parent.setSheetPropertyOnMute(i,"conditionalFormats",[]);var o=i.conditionalFormats.length;i.conditionalFormats[o]=t;for(var s=a[0];s<=a[2];s++){i.rows[s]||Ce(i,s,{});for(var l=a[1];l<=a[3];l++)if(i.rows[s].cells&&i.rows[s].cells[l]||Z(s,l,i,{}),n===this.parent.activeSheetIndex){var h=i.rows[s].cells[l];this.parent.notify("cFInitialCheck",{rowIdx:s,colIdx:l,cell:h,conditionalFormat:t})}}},e.prototype.clearRules=function(e){var r,n,i,a,o,s,l,h,d=!!t.isNullOrUndefined(e.isPublic),p=[],u=[],f=!0,g=e.range,v=this.parent.getAddressInfo(g).sheetIndex,y=ce(this.parent,v),C=y.conditionalFormats,b=c(g);if(v===this.parent.activeSheetIndex)for(var S=b[0];S<=b[2];S++)for(var x=b[1];x<=b[3];x++)this.parent.notify("clearCF",{rIdx:S,cIdx:x});if(C){for(var w=C.length-1;w>=0;w--){var I=!1,E="",R=C[w],k=R.range.split(",");if(v===this.parent.activeSheetIndex)for(var A=0;A<k.length;A++){var T=!1,F=c(k[A]);l=F[0],h=F[0],o=F[1],s=F[1],F[0]>=b[0]&&F[2]<=b[2]&&F[1]>=b[1]&&F[3]<=b[3]&&(T=!0);for(var L=F[0];L<=F[2];L++){for(var N=0,D=F[1];D<=F[3];D++)for(var O=b[0];O<=b[2];O++)for(var H=b[1];H<=b[3];H++)if(O===L&&H===D){var B=this.parent.getCellStyleValue(["backgroundColor","color"],[O,H]);this.parent.notify(It,{style:B,rowIdx:O,colIdx:H,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0}),N+=1,I=!0,O===F[0]?H===F[3]?o===F[1]?s===H?s=H:o=H-1:o!==F[1]&&s+1===H?(s=F[1],o-=1):o!==F[1]&&s===F[1]&&(o=b[1]-1):H===F[1]?s===F[1]&&(s=H+1):o===F[1]&&s===F[1]?(o=H,s=H):s=o===F[1]&&s!==F[1]?H+1:H:H===F[1]?s===F[1]&&F[1]!==F[3]&&(s=H+1):H===F[3]?o===F[1]?s===H?s=H:o=H-1:o!==F[1]&&s===F[1]?o=b[1]-1:o!==F[1]&&s+1===H?(s=F[1],o=b[1]-1):h=O:o===F[1]&&s===F[1]?(o=H,s=H):s!==F[1]&&o!==F[1]?s=H:o!==F[1]&&s===F[1]?o=H:s=H+1}N>0&&!T?(f&&(r=l,n=h,i=o,a=s),o===F[1]&&s!==F[1]?s===F[3]?(l!==L&&(E=E+" "+m([l,i,n,F[3]])),o===F[1]&&s===F[3]&&(L===F[2]?F[1]===b[3]&&(E=E+" "+m([L,s,L,F[3]])):(b[2]===F[0]&&s!==F[3]&&(E=E+" "+m([L,s,L,F[3]])),l=L+1,h=L+1,s=F[1]))):a!==s?(E=E+" "+m([l,a,L-1,F[3]]),s===F[3]&&o===F[1]?(l=L+1,h=L+1,s=F[1]):(l=L,h=L),s===F[3]&&o!==F[1]&&(o=F[1])):i!==o?(E=E+" "+m([l,F[1],L-1,i]),l=L+1,h=L+1,o=F[1],s=F[1]):L===F[2]?E=E+" "+m([l,s,L,F[3]]):(h<L||o===F[1]&&s===F[3])&&(h=L):s===F[1]&&o!==F[1]?(a!==s&&(E=E+" "+m([l,a,L-1,F[3]]),l=L,h=L),i!==o&&(E=E+" "+m([l,i,L-1,F[3]]),l=L,h=L),L===F[2]?E=E+" "+m([l,s,L,o]):h=L):s!==F[1]&&o!==F[1]?L===F[2]&&F[2]===b[0]?E=F[0]===F[2]?(E=E+" "+m([l,F[1],h,o-1]))+" "+m([l,s+1,h,F[3]]):(E=(E=E+" "+m([l,F[1],h,F[3]]))+" "+m([F[2],F[1],F[2],o-1]))+" "+m([F[2],s+1,F[2],F[3]]):L===F[2]?E=(E=E+" "+m([l,F[1],L,o-1]))+" "+m([l,s+1,L,F[3]]):(i===F[1]&&a===F[1]&&(E=E+" "+m([l,i,h,F[3]]),l=L),h=L):o===F[1]&&s===F[1]&&(b[2]!==F[0]?(F[2]>=b[2]&&L>b[2]&&(E=E+" "+m([l,o,h,F[3]])),F[1]===F[3]&&L<=F[2]&&r!==F[2]&&L!==r&&(E=E+" "+m([l,o,h,F[3]])),F[1]===F[3]&&(l=L+1,h=L+1)):((L===F[2]||L===F[0]&&F[1]!==F[3])&&(E=E+" "+m([l,o,h,s])),l=L+1,h=L+1),L===F[2]&&F[0]!==F[2]&&F[1]!==F[3]&&(E=E+" "+m([L,o,L,s]))),f||(r=l,n=h<=F[2]?h:F[2],i=o,a=s<=F[3]?s:F[3]),f=!1):T||(f&&(r=l,n=h,i=o,a=s),o===F[1]&&s===F[1]&&(L===F[2]&&(E=E+" "+m([l,o,L,F[3]])),h=L),s!==F[1]&&o!==F[1]&&(E=(E=E+" "+m([l,F[1],L-1,o-1]))+" "+m([l,s+1,L-1,F[3]]),l=L,h=L,o=F[1],s=F[1]),s!==F[1]&&o===F[1]&&(E=E+" "+m([l,s,L-1,F[3]]),l=L,h=L,o=F[1],s=F[1]),o!==F[1]&&s===F[1]&&(E=E+" "+m([l,s,L-1,o]),l=L,h=L,o=F[1],s=F[1]),f||(r=l,n=h<=F[2]?h:F[2],i=o,a=s<=F[3]?s:F[3]),f=!1)}}""===E?(u.push(y.conditionalFormats[w].range),y.conditionalFormats.splice(w,1)):(u.push(y.conditionalFormats[w].range),y.conditionalFormats[w].range=E.trim().replace(" ",",")),I&&!d&&(R.range=E.trim().replace(" ",","),p.push(R))}if(!d){var M={cFormats:p,oldRange:u,selectedRange:g};this.parent.notify(nr,{eventArgs:M,action:"clearCF"})}}},e.prototype.getModuleName=function(){return"workbookConditionalFormatting"},e}(),qr=function(){function e(){In.Inject(qt,mr,ur,zt,Dr,Or,Ar,Tr,Hr,Fr,Br,Mr,_r,Ur,Pr,Vr,zr,Lr,Nr)}return e.prototype.getModuleName=function(){return"workbookBasic"},e.prototype.destroy=function(){},e}(),jr=function(){function e(){In.Inject(qt,mr,zt,Dr,Or,Ar,ur,Tr,Hr,Fr,Br,Mr,_r,Ur,Pr,Vr,zr,Lr,Nr)}return e.prototype.getModuleName=function(){return"workbook-all"},e.prototype.destroy=function(){},e}(),Wr=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gr=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Yr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("Calibri")],r.prototype,"fontFamily",void 0),Gr([t.Property("bottom")],r.prototype,"verticalAlign",void 0),Gr([t.Property("left")],r.prototype,"textAlign",void 0),Gr([t.Property("0pt")],r.prototype,"textIndent",void 0),Gr([t.Property("#000000")],r.prototype,"color",void 0),Gr([t.Property("#ffffff")],r.prototype,"backgroundColor",void 0),Gr([t.Property("normal")],r.prototype,"fontWeight",void 0),Gr([t.Property("normal")],r.prototype,"fontStyle",void 0),Gr([t.Property("11pt")],r.prototype,"fontSize",void 0),Gr([t.Property("none")],r.prototype,"textDecoration",void 0),Gr([t.Property("")],r.prototype,"border",void 0),Gr([t.Property("")],r.prototype,"borderTop",void 0),Gr([t.Property("")],r.prototype,"borderBottom",void 0),Gr([t.Property("")],r.prototype,"borderLeft",void 0),Gr([t.Property("")],r.prototype,"borderRight",void 0),r}(t.ChildProperty),Xr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property()],r.prototype,"sheetIndex",void 0),Gr([t.Property()],r.prototype,"filterRange",void 0),Gr([t.Property(!1)],r.prototype,"hasFilter",void 0),Gr([t.Property()],r.prototype,"column",void 0),Gr([t.Property()],r.prototype,"criteria",void 0),Gr([t.Property()],r.prototype,"value",void 0),Gr([t.Property()],r.prototype,"dataType",void 0),Gr([t.Property()],r.prototype,"predicates",void 0),r}(t.ChildProperty),Kr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property()],r.prototype,"sortRange",void 0),Gr([t.Property()],r.prototype,"columnIndex",void 0),Gr([t.Property()],r.prototype,"order",void 0),Gr([t.Property()],r.prototype,"sheetIndex",void 0),r}(t.ChildProperty),$r=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"name",void 0),Gr([t.Property("")],r.prototype,"scope",void 0),Gr([t.Property("")],r.prototype,"comment",void 0),Gr([t.Property("")],r.prototype,"refersTo",void 0),r}(t.ChildProperty),Zr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!1)],r.prototype,"selectCells",void 0),Gr([t.Property(!1)],r.prototype,"formatCells",void 0),Gr([t.Property(!1)],r.prototype,"formatRows",void 0),Gr([t.Property(!1)],r.prototype,"formatColumns",void 0),Gr([t.Property(!1)],r.prototype,"insertLink",void 0),r}(t.ChildProperty),Jr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"address",void 0),r}(t.ChildProperty),Qr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("WholeNumber")],r.prototype,"type",void 0),Gr([t.Property("Between")],r.prototype,"operator",void 0),Gr([t.Property("0")],r.prototype,"value1",void 0),Gr([t.Property("0")],r.prototype,"value2",void 0),Gr([t.Property(!0)],r.prototype,"ignoreBlank",void 0),Gr([t.Property(!0)],r.prototype,"inCellDropDown",void 0),Gr([t.Property(!1)],r.prototype,"isHighlighted",void 0),r}(t.ChildProperty),en=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("General")],r.prototype,"format",void 0),Gr([t.Complex({},Yr)],r.prototype,"style",void 0),Gr([t.Property(!0)],r.prototype,"isLocked",void 0),r}(t.ChildProperty),tn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("GreaterThan")],r.prototype,"type",void 0),Gr([t.Complex({},en)],r.prototype,"format",void 0),Gr([t.Property("RedFT")],r.prototype,"cFColor",void 0),Gr([t.Property("")],r.prototype,"value",void 0),Gr([t.Property("")],r.prototype,"range",void 0),r}(t.ChildProperty),rn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!0)],r.prototype,"visible",void 0),Gr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),nn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!1)],r.prototype,"visible",void 0),Gr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),an=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),on=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),sn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"title",void 0),Gr([t.Complex({},an)],r.prototype,"majorGridLines",void 0),Gr([t.Complex({},on)],r.prototype,"minorGridLines",void 0),Gr([t.Property(!0)],r.prototype,"visible",void 0),r}(t.ChildProperty),ln=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("Line")],r.prototype,"type",void 0),Gr([t.Property("Material")],r.prototype,"theme",void 0),Gr([t.Property(!1)],r.prototype,"isSeriesInRows",void 0),Gr([t.Property("")],r.prototype,"range",void 0),Gr([t.Property("")],r.prototype,"id",void 0),Gr([t.Property("")],r.prototype,"title",void 0),Gr([t.Property(290)],r.prototype,"height",void 0),Gr([t.Property(480)],r.prototype,"width",void 0),Gr([t.Property(0)],r.prototype,"top",void 0),Gr([t.Property(0)],r.prototype,"left",void 0),Gr([t.Complex({},rn)],r.prototype,"legendSettings",void 0),Gr([t.Complex({},sn)],r.prototype,"primaryXAxis",void 0),Gr([t.Complex({},sn)],r.prototype,"primaryYAxis",void 0),Gr([t.Complex({},nn)],r.prototype,"dataLabelSettings",void 0),r}(t.ChildProperty),hn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"src",void 0),Gr([t.Property("")],r.prototype,"id",void 0),Gr([t.Property(300)],r.prototype,"height",void 0),Gr([t.Property(400)],r.prototype,"width",void 0),Gr([t.Property(0)],r.prototype,"top",void 0),Gr([t.Property(0)],r.prototype,"left",void 0),r}(t.ChildProperty),dn="spreadsheetLocale",pn={SortOutOfRangeError:"Select a cell or range inside the used range and try again."},cn=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),un=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},fn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return cn(r,e),un([t.Collection([],hn)],r.prototype,"image",void 0),un([t.Collection([],ln)],r.prototype,"chart",void 0),un([t.Property("")],r.prototype,"value",void 0),un([t.Property("")],r.prototype,"formula",void 0),un([t.Property(0)],r.prototype,"index",void 0),un([t.Property("General")],r.prototype,"format",void 0),un([t.Complex({},Yr)],r.prototype,"style",void 0),un([t.Property("")],r.prototype,"hyperlink",void 0),un([t.Property(!1)],r.prototype,"wrap",void 0),un([t.Property(!0)],r.prototype,"isLocked",void 0),un([t.Property("")],r.prototype,"validation",void 0),un([t.Property(1)],r.prototype,"colSpan",void 0),un([t.Property(1)],r.prototype,"rowSpan",void 0),r}(t.ChildProperty),gn=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),mn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},vn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return gn(r,e),r.prototype.setProperties=function(t,r){var n=this;if(this.parentObj.isComplexArraySetter&&this.controlParent&&this.controlParent.isAngular)if(Object.keys(t).length){void 0===this.parentObj.currRangeIdx?this.parentObj.currRangeIdx=0:this.parentObj.currRangeIdx+=1;var i=this.parentObj.ranges[this.parentObj.currRangeIdx];i&&i.info&&(this.info=i.info),setTimeout(function(){void 0!==n.parentObj.currRangeIdx&&delete n.parentObj.currRangeIdx})}else if(this.controlParent.tagObjects[0].instance&&this.controlParent.tagObjects[0].instance.hasChanges&&!this.controlParent.tagObjects[0].instance.isInitChanges){var a=this.controlParent.sheets.indexOf(this.parentObj);if(void 0===this.parentObj.changedRangeIdx){for(var o,s=this.controlParent.tagObjects[0].instance.list[a].tagObjects,l=0;l<s.length;l++)if("ranges"===s[l].name){s[l].instance.list.forEach(function(e,t){e.hasChanges&&(o=t)});break}this.parentObj.changedRangeIdx=o}}e.prototype.setProperties.call(this,t,r)},mn([t.Property(null)],r.prototype,"dataSource",void 0),mn([t.Property("A1")],r.prototype,"startCell",void 0),mn([t.Property(null)],r.prototype,"query",void 0),mn([t.Property(!0)],r.prototype,"showFieldAsHeader",void 0),mn([t.Property("")],r.prototype,"template",void 0),mn([t.Property("A1")],r.prototype,"address",void 0),r}(t.ChildProperty),yn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return gn(r,e),mn([t.Property(0)],r.prototype,"rowIndex",void 0),mn([t.Property(0)],r.prototype,"colIndex",void 0),r}(t.ChildProperty),Cn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return gn(r,e),mn([t.Property(null)],r.prototype,"rows",void 0),mn([t.Property([])],r.prototype,"columns",void 0),mn([t.Complex({},Zr)],r.prototype,"protectSettings",void 0),mn([t.Collection([],vn)],r.prototype,"ranges",void 0),mn([t.Collection([],tn)],r.prototype,"conditionalFormats",void 0),mn([t.Property(0)],r.prototype,"index",void 0),mn([t.Property("")],r.prototype,"name",void 0),mn([t.Property(100)],r.prototype,"rowCount",void 0),mn([t.Property(100)],r.prototype,"colCount",void 0),mn([t.Property("A1:A1")],r.prototype,"selectedRange",void 0),mn([t.Property("A1")],r.prototype,"activeCell",void 0),mn([t.Property({})],r.prototype,"usedRange",void 0),mn([t.Property("A1")],r.prototype,"topLeftCell",void 0),mn([t.Property(!0)],r.prototype,"showHeaders",void 0),mn([t.Property(!0)],r.prototype,"showGridLines",void 0),mn([t.Property(!1)],r.prototype,"isProtected",void 0),mn([t.Property("Visible")],r.prototype,"state",void 0),mn([t.Property(0)],r.prototype,"frozenRows",void 0),mn([t.Property(0)],r.prototype,"frozenColumns",void 0),mn([t.Property("A1")],r.prototype,"paneTopLeftCell",void 0),r}(t.ChildProperty),bn=function(){function e(){this.services={}}return e.prototype.getService=function(e){if(t.isNullOrUndefined(this.services[e]))throw"The service "+e+" is not registered";return this.services[e]},e.prototype.register=function(e,r){t.isNullOrUndefined(this.services[e])&&(this.services[e]=r)},e}(),Sn=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),xn=function(){return(xn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},wn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},In=function(e){function r(t){var r=e.call(this,t)||this;return r.isEdit=!1,r.sheetNameCount=1,r.isOpen=!1,r.chartColl=[],r.chartCount=1,n.Inject(qt,mr,ur,zt,Dr,Or,Ar,Tr,Hr,Fr,Br,_r,Pr,Ur,Vr,zr,Lr,Nr),r.commonCellStyle={},t&&t.cellStyle&&(r.commonCellStyle=t.cellStyle),"workbook"===r.getModuleName()&&(r.serviceLocator=new bn,r.initWorkbookServices(),r.dataBind(),r.initEmptySheet()),r}Sn(r,e),n=r,r.prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=J(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},r.prototype.initWorkbookServices=function(){this.serviceLocator.register(dn,new t.L10n(this.getModuleName(),pn,this.locale))},r.prototype.render=function(){},r.prototype.requiredModules=function(){return z(this)},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(wt,{style:e,range:t,refreshRibbon:t.indexOf(r.activeCell)>-1})},r.prototype.lockCells=function(e,t){var r=this.getActiveSheet();e=e||r.selectedRange,this.notify("setLockCells",{range:e,isLocked:t})},r.prototype.getCellStyleValue=function(e,t){var r=this,n=$(t[0],t[1],this.getActiveSheet()),i={};return e.forEach(function(e){i[e]=r.cellStyle[e],n&&n.style&&n.style[e]&&(i[e]=n.style[e])}),i},r.prototype.numberFormat=function(e,t){this.notify("applyNumber",{format:e,range:t})},r.prototype.createSheet=function(e,t){void 0===e&&(e=this.sheets.length),void 0===t&&(t=[{}]);var r;(r=this.sheets).splice.apply(r,[e,0].concat(t)),ge(this,t),this.notify("sheetCreated",{sheetIndex:e||0,sheets:t}),this.notify(Et,{action:"registerSheet",sheetIndex:e||0,sheetCount:e+t.length})},r.prototype.removeSheet=function(e){this.sheets.splice(e,1)},r.prototype.destroy=function(){this.notify("workbookDestroyed",null),e.prototype.destroy.call(this)},r.prototype.onPropertyChanged=function(e,r){for(var n=0,i=Object.keys(e);n<i.length;n++)switch(i[n]){case"cellStyle":t.merge(this.commonCellStyle,e.cellStyle);break;case"sheets":e.sheets===this.sheets?(this.notify(Et,{action:"unRegisterSheet",propertyChange:!0}),this.sheetNameCount=1,this.notify("sheetsDestroyed",{}),ge(this),this.notify("sheetCreated",null),this.notify(Et,{action:"registerSheet"})):ge(this)}},r.prototype.appendTo=function(t){e.prototype.appendTo.call(this,t)},r.prototype.hideRow=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);var n=this.getActiveSheet();if(!r||!n.frozenRows&&!n.frozenColumns)for(var i=e;i<=t;i++)Ce(n,i,{hidden:r})},r.prototype.hideColumn=function(e,t,r){void 0===t&&(t=e),void 0===r&&(r=!0);var n=this.getActiveSheet();if(!n.frozenRows&&!n.frozenColumns)for(var i=e;i<=t;i++)Ee(n,i,{hidden:r})},r.prototype.setBorder=function(e,t,r){this.notify(wt,{style:e,borderType:r,range:t||this.getActiveSheet().selectedRange})},r.prototype.insertRow=function(e,t,r){this.notify(Tt,{model:this.getSheetModel(r),start:e,end:t,modelType:"Row"})},r.prototype.insertColumn=function(e,t,r){this.notify(Tt,{model:this.getSheetModel(r),start:e,end:t,modelType:"Column"})},r.prototype.insertSheet=function(e,t){this.notify(Tt,{model:this,start:e,end:t,modelType:"Sheet"})},r.prototype.delete=function(e,r,n,i){e=e||0;var a;if(n&&"Sheet"!==n){if(!(a=this.getSheetModel(i)))return}else a=this;this.notify("deleteModel",{model:a,start:e,end:t.isNullOrUndefined(r)?e:r,modelType:n||"Sheet"})},r.prototype.getSheetModel=function(e){if(t.isNullOrUndefined(e))return this.getActiveSheet();var r="string"==typeof e?ae(this,e):e;return t.isNullOrUndefined(r)||r>=this.sheets.length?null:this.sheets[r]},r.prototype.merge=function(e,t){var r,n;e?n=ce(this,r=this.getAddressInfo(e).sheetIndex):e=(n=this.getActiveSheet()).selectedRange,this.notify(Ht,{merge:!0,range:e,type:t||"All",sheet:n,refreshRibbon:e.indexOf(n.activeCell)>-1,preventRefresh:this.activeSheetIndex!==r})},r.prototype.computeExpression=function(e){var t={action:"computeExpression",formula:e};return this.notify(Et,t),t.calcValue},r.prototype.initEmptySheet=function(){this.sheets.length?ge(this):this.createSheet()},r.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},r.prototype.skipHiddenSheets=function(e,t,r){return void 0===r&&(r=0),this.sheets[e]&&"Visible"!==this.sheets[e].state&&(void 0===t&&(t=e),e=e&&e+1===this.sheets.length?t-1:e<t?e--:e++,e=this.skipHiddenSheets(e,t,++r)),r===this.sheets.length?(this.setSheetPropertyOnMute(this.sheets[0],"state","Visible"),0):e},r.prototype.setUsedRange=function(e,t,r){void 0===r&&(r=this.getActiveSheet()),e>r.usedRange.rowIndex&&(r.usedRange.rowIndex=e,r===this.getActiveSheet()&&this.notify("updateUsedRange",{index:e,update:"row"})),t>r.usedRange.colIndex&&(r.usedRange.colIndex=t,r===this.getActiveSheet()&&this.notify("updateUsedRange",{index:t,update:"col"}))},r.prototype.getData=function(e){return ee(this,e)},r.prototype.getModuleName=function(){return"workbook"},r.prototype.getValueRowCol=function(e,r,n,i){var a={action:"getSheetInfo",sheetInfo:[]};if(this.notify(Et,a),-1===le(this,"Sheet"+(e+1),a.sheetInfo)){var o={action:"getReferenceError",refError:""};return this.notify(Et,o),o.refError}var s=ce(this,e=oe(this,e+1)),l=$(r-1,n-1,s);if(i&&i.includes("!")&&!l&&s.ranges&&s.ranges.length){var h;if(this.formulaRefCell&&this.formulaRefCell===i)return l&&l.value;if(s.ranges.forEach(function(e){if(!e.info||!e.info.loadedRange||!e.info.loadedRange.length)return void(h=!0)}),h){if(this.formulaRefCell=i,e=oe(this,Number(i[i.length-1])+1),t.isNullOrUndefined(e))return l&&l.value;i=i.substring(i.lastIndexOf("!")+1,i.length-1),ee(this,s.name+"!A1:"+g(r-1,n-1),null,null,null,null,i,e)}}else l&&l.formula&&t.isNullOrUndefined(l.value)&&this.notify("calculateFormula",{cell:l,rowIdx:r-1,colIdx:n-1,sheetIndex:e});return l&&l.value},r.prototype.setValueRowCol=function(e,t,r,n){e=oe(this,e),this.notify("workbookEditOperation",{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:e,isValueOnly:!0})},r.prototype.open=function(e){this.notify("workbookOpen",e)},r.prototype.openFromJson=function(e){this.isOpen=!0;var t="object"==typeof e.file?JSON.stringify(e.file):e.file;this.notify("workbookOpen",{jsonObject:t})},r.prototype.save=function(e){if(void 0===e&&(e={}),this.allowSave){var t={url:this.saveUrl,fileName:e.fileName||"Sample",saveType:"Xlsx"},r=xn({},t,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1});this.trigger("beforeSave",r),this.notify(ir,{eventArgs:r,action:"beforeSave"}),r.cancel||this.notify("beginSave",{saveSettings:r,isFullPost:r.isFullPost,needBlobData:r.needBlobData,customParams:r.customParams})}},r.prototype.saveAsJson=function(){var e=this;return new Promise(function(t){e.on("onSave",function(r){r.cancel=!0,e.off("onSave"),t({jsonObject:{Workbook:r.jsonObject}}),e.notify("saveCompleted",r)}),e.save()})},r.prototype.addHyperlink=function(e,t){var r={hyperlink:e,cell:t};this.notify("setLinkModel",r)},r.prototype.findHandler=function(e){"next"===e.findOpt?this.notify("findNext",e):"prev"===e.findOpt&&this.notify("findPrevious",e)},r.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify("replace",e):this.notify("replaceAll",e)},r.prototype.protectSheet=function(e,t){this.notify("protectsheetHandler",t)},r.prototype.unprotectSheet=function(e){var t={sheet:e};this.notify("unprotectsheetHandler",t)},r.prototype.sort=function(e,t){if(!this.allowSorting)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,sortOptions:e||{sortDescriptors:{}},cancel:!1},promise:new Promise(function(e,t){e(void 0)})};return this.notify(kt,r),r.promise},r.prototype.addDataValidation=function(e,t){var r={range:t=t||this.getActiveSheet().selectedRange,type:e.type,operator:e.operator,value1:e.value1,value2:e.value2,ignoreBlank:e.ignoreBlank,inCellDropDown:e.inCellDropDown,cancel:!1};this.notify(ir,{eventArgs:r,action:"validation"}),r.cancel||(t=r.range,e.type=r.type,e.operator=r.operator,e.value1=r.value1,e.value2=r.value2,e.ignoreBlank=r.ignoreBlank,e.inCellDropDown=r.inCellDropDown,this.notify(Ft,{rules:e,range:t}),delete r.cancel,this.notify(nr,{eventArgs:r,action:"validation"}))},r.prototype.removeDataValidation=function(e){this.notify(Dt,{range:e})},r.prototype.addInvalidHighlight=function(e){this.notify("addHighlight",{range:e})},r.prototype.removeInvalidHighlight=function(e){this.notify("removeHighlight",{range:e})},r.prototype.conditionalFormat=function(e){e.range=e.range||this.getActiveSheet().selectedRange,this.notify(Bt,{conditionalFormat:e})},r.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,this.notify(Mt,{range:e})},r.prototype.updateCell=function(e,t){var r,n=y(t);t.includes("!")?void 0===(r=ae(this,t.split("!")[0]))&&(r=this.activeSheetIndex):r=this.activeSheetIndex,Z(n[0],n[1],this.sheets[r],e,!0),e.value&&this.notify("workbookEditOperation",{action:"updateCellValue",address:n,value:e.value,sheetIndex:r})},r.prototype.wrap=function(e,t){void 0===t&&(t=!0),Q(e,t,this)},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(Et,t),t.isAdded},r.prototype.removeDefinedName=function(e,t){void 0===t&&(t="");var r={action:"removeDefinedName",isRemoved:!1,definedName:e,scope:t};return this.notify(Et,r),r.isRemoved},r.prototype.clearRange=function(e,r,n){void 0===n&&(n=!0),ie(this,e||this.getActiveSheet().selectedRange,t.isNullOrUndefined(r)?this.activeSheetIndex:r,n)},r.prototype.insertImage=function(e,t){this.notify("setImage",{options:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.insertChart=function(e){this.notify(Ut,{chart:e})},r.prototype.deleteChart=function(e){this.notify(cr,{id:e})},r.prototype.filter=function(e,t){if(!this.allowFiltering)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,filterOptions:e,cancel:!1},promise:new Promise(function(e,t){e(void 0)})};return this.notify("initiateFilter",r),r.promise},r.prototype.clearFilter=function(){this.notify("clearAllFilter",null)},r.prototype.addCustomFunction=function(e,t){var r={action:"addCustomFunction",functionHandler:e,functionName:t=t||("string"==typeof e?e:e.name.replace("bound ",""))};this.notify(Et,r)},r.prototype.clear=function(e){this.notify("clear",e)},r.prototype.getDisplayText=function(e){if(!e)return"";if(e.value&&e.format){var t={formattedText:e.value,value:e.value,format:e.format,onLoad:!0};return this.notify("getFormattedCell",t),t.formattedText}return!e.value&&e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address:e.value?e.value.toString():""},r.prototype.freezePanes=function(e,t,r){void 0===e&&(e=1),void 0===t&&(t=1);var n=this.getSheetModel(r);n.frozenRows===e&&n.frozenColumns===t||(this.setSheetPropertyOnMute(n,"frozenRows",e),this.setSheetPropertyOnMute(n,"frozenColumns",t),this.updateTopLeftCell(),n.name===this.getActiveSheet().name&&this.notify("dataRefresh",null))},r.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},r.prototype.updateTopLeftCell=function(e,r,n,i){i||(i=this.getActiveSheet());var a=u(i.topLeftCell);i.frozenRows||i.frozenColumns?(t.isNullOrUndefined(e)&&(e=i.frozenRows?0:a[0]),t.isNullOrUndefined(r)&&(r=i.frozenColumns?0:a[1]),e+=this.frozenRowCount(i),r+=this.frozenColCount(i),n&&("row"===n?e=u(i.paneTopLeftCell)[0]:r=u(i.paneTopLeftCell)[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r)),i.frozenRows&&(e=a[0]),i.frozenColumns&&(r=a[1])):(t.isNullOrUndefined(e)&&(e=a[0]),t.isNullOrUndefined(r)&&(r=a[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r))),this.setSheetPropertyOnMute(i,"topLeftCell",g(e,r))},r.prototype.getAddressInfo=function(e){return S(this,e)},r.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[t]=r,this.isProtectedOnChange=!1},r.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:u(e.topLeftCell)[0]+e.frozenRows:0},r.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:u(e.topLeftCell)[1]+e.frozenColumns:0};var n;return wn([t.Collection([],Cn)],r.prototype,"sheets",void 0),wn([t.Property(0)],r.prototype,"activeSheetIndex",void 0),wn([t.Property("100%")],r.prototype,"height",void 0),wn([t.Property(!0)],r.prototype,"allowFindAndReplace",void 0),wn([t.Property()],r.prototype,"filterCollection",void 0),wn([t.Property()],r.prototype,"sortCollection",void 0),wn([t.Property("100%")],r.prototype,"width",void 0),wn([t.Property(!0)],r.prototype,"showRibbon",void 0),wn([t.Property(!0)],r.prototype,"showFormulaBar",void 0),wn([t.Property(!0)],r.prototype,"showSheetTabs",void 0),wn([t.Property(!0)],r.prototype,"allowEditing",void 0),wn([t.Property(!0)],r.prototype,"allowOpen",void 0),wn([t.Property(!0)],r.prototype,"allowSave",void 0),wn([t.Property(!0)],r.prototype,"allowSorting",void 0),wn([t.Property(!0)],r.prototype,"allowFiltering",void 0),wn([t.Property(!0)],r.prototype,"allowNumberFormatting",void 0),wn([t.Property(!0)],r.prototype,"allowCellFormatting",void 0),wn([t.Property(!0)],r.prototype,"allowHyperlink",void 0),wn([t.Property(!0)],r.prototype,"allowInsert",void 0),wn([t.Property(!0)],r.prototype,"allowDelete",void 0),wn([t.Property(!0)],r.prototype,"allowMerge",void 0),wn([t.Property(!0)],r.prototype,"allowDataValidation",void 0),wn([t.Property(!0)],r.prototype,"allowImage",void 0),wn([t.Property(!0)],r.prototype,"allowChart",void 0),wn([t.Property(!0)],r.prototype,"allowConditionalFormat",void 0),wn([t.Complex({},Yr)],r.prototype,"cellStyle",void 0),wn([t.Property("")],r.prototype,"openUrl",void 0),wn([t.Property("")],r.prototype,"saveUrl",void 0),wn([t.Property("")],r.prototype,"password",void 0),wn([t.Property(!1)],r.prototype,"isProtected",void 0),wn([t.Collection([],$r)],r.prototype,"definedNames",void 0),wn([t.Event()],r.prototype,"beforeOpen",void 0),wn([t.Event()],r.prototype,"openFailure",void 0),wn([t.Event()],r.prototype,"beforeSave",void 0),wn([t.Event()],r.prototype,"saveComplete",void 0),wn([t.Event()],r.prototype,"beforeCellFormat",void 0),wn([t.Event()],r.prototype,"queryCellInfo",void 0),r=n=wn([t.NotifyPropertyChanges],r)}(t.Component),En=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Rn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},kn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return En(r,e),Rn([t.Collection([],fn)],r.prototype,"cells",void 0),Rn([t.Property(0)],r.prototype,"index",void 0),Rn([t.Property(20)],r.prototype,"height",void 0),Rn([t.Property(!1)],r.prototype,"customHeight",void 0),Rn([t.Property(!1)],r.prototype,"hidden",void 0),Rn([t.Complex({},en)],r.prototype,"format",void 0),r}(t.ChildProperty),An=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Tn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Fn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return An(r,e),Tn([t.Property(0)],r.prototype,"index",void 0),Tn([t.Property(64)],r.prototype,"width",void 0),Tn([t.Property(!1)],r.prototype,"customWidth",void 0),Tn([t.Property(!1)],r.prototype,"hidden",void 0),Tn([t.Complex({},en)],r.prototype,"format",void 0),Tn([t.Property(!0)],r.prototype,"isLocked",void 0),Tn([t.Property("")],r.prototype,"validation",void 0),r}(t.ChildProperty),Ln=null,Nn=["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],Dn={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"},On=function(){function e(e){this.externalMerge=!1,this.parent=e,this.init(),this.addEventListener()}return e.prototype.init=function(){this.parent.element.appendChild(this.parent.createElement("input",{className:"e-clipboard",attrs:{contenteditable:"true"}}))},e.prototype.addEventListener=function(){var e=this.getClipboardEle();this.parent.on(Zt,this.cut,this),this.parent.on("copy",this.copy,this),this.parent.on(Jt,this.paste,this),this.parent.on("clearCopy",this.clearCopiedInfo,this),this.parent.on("tabSwitch",this.tabSwitchHandler,this),this.parent.on(Kt,this.cMenuBeforeOpenHandler,this),this.parent.on("ribboClick",this.ribbonClickHandler,this),this.parent.on("contentLoaded",this.initCopyIndicator,this),this.parent.on(Qt,this.rowHeightChanged,this),t.EventHandler.add(e,"cut",this.cut,this),t.EventHandler.add(e,"copy",this.copy,this),t.EventHandler.add(e,"paste",this.paste,this)},e.prototype.removeEventListener=function(){var e=this.getClipboardEle();this.parent.isDestroyed||(this.parent.off(Zt,this.cut),this.parent.off("copy",this.copy),this.parent.off(Jt,this.paste),this.parent.off("clearCopy",this.clearCopiedInfo),this.parent.off("tabSwitch",this.tabSwitchHandler),this.parent.off(Kt,this.cMenuBeforeOpenHandler),this.parent.off("ribboClick",this.ribbonClickHandler),this.parent.off("contentLoaded",this.initCopyIndicator),this.parent.off(Qt,this.rowHeightChanged)),t.EventHandler.remove(e,"cut",this.cut),t.EventHandler.remove(e,"copy",this.copy),t.EventHandler.remove(e,"paste",this.paste)},e.prototype.ribbonClickHandler=function(e){var t=this.parent.element.id;switch(e.item.id){case t+"_cut":this.cut({isAction:!0});break;case t+"_copy":this.copy({isAction:!0})}Ct(this.parent.element)},e.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},e.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(ki),n=[],i=[],a=[],o=[],s=u(t.activeCell),l=$(s[0],s[1],t),h=t.isProtected&&X(l,Ie(t,s[1]));"Content"!==e.target&&"RowHeader"!==e.target&&"ColumnHeader"!==e.target||(this.parent.enableContextMenuItems([r.getConstant("Paste"),r.getConstant("PasteSpecial")],!!(this.copiedInfo||this.copiedShapeInfo&&!h)),this.parent.enableContextMenuItems([r.getConstant("Cut")],!h)),"Content"===e.target&&h&&this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Filter"),r.getConstant("Sort")],!1),"Content"===e.target&&h&&!t.protectSettings.insertLink&&this.parent.enableContextMenuItems([r.getConstant("Hyperlink")],!1),"ColumnHeader"===e.target&&t.isProtected&&(a=[r.getConstant("DeleteColumn"),r.getConstant("DeleteColumns"),r.getConstant("InsertColumn"),r.getConstant("InsertColumns")],o=[r.getConstant("HideColumn"),r.getConstant("HideColumns"),r.getConstant("UnHideColumns")],this.parent.enableContextMenuItems(a,!1),this.parent.enableContextMenuItems(o,!!t.protectSettings.formatColumns)),"RowHeader"===e.target&&t.isProtected&&(n=[r.getConstant("DeleteRow"),r.getConstant("DeleteRows"),r.getConstant("InsertRow"),r.getConstant("InsertRows")],i=[r.getConstant("HideRow"),r.getConstant("HideRows"),r.getConstant("UnHideRows")],this.parent.enableContextMenuItems(n,!1),this.parent.enableContextMenuItems(i,!!t.protectSettings.formatRows))},e.prototype.rowHeightChanged=function(e){if(this.copiedInfo&&this.copiedInfo.range[0]>e.rowIdx){var t=this.parent.element.getElementsByClassName("e-copy-indicator")[0];t&&(t.style.top=parseInt(t.style.top,10)+e.threshold+"px")}},e.prototype.cut=function(e){this.setCopiedInfo(e,!0)},e.prototype.copy=function(e){this.copiedSheet=this.parent.getActiveSheet(),this.setCopiedInfo(e,!1)},e.prototype.paste=function(e){if(!(this.parent.isEdit||this.parent.element.getElementsByClassName("e-dialog").length>0)){var r;e.isAction=!0;var n,i=e&&e.clipboardData||window.clipboardData,a=this.getCopiedIdx(),o=Object.assign({},this.copiedInfo);if(i||this.copiedShapeInfo||e.isInternal&&this.copiedInfo){var s=e&&e.sIdx>-1?e.sIdx:this.parent.activeSheetIndex,l=ce(this.parent,s),h=x(e&&e.range||c(l.selectedRange)),d=i&&this.getExternalCells(e);if(!e.isInternal&&d&&d.internal&&(i=!1,!this.copiedInfo))return;if(i&&!d.length)return;var p=0;if(d)for(H=0;H<d.length;H++)p=d[H].cells.length>p?d[H].cells.length:p;var u=h[0],f=i?[0,0,d.length-1,p-1]:x(this.copiedShapeInfo?c(l.selectedRange):this.copiedInfo.range),v=(h[2]-h[0]+1)%(f[2]-f[0]+1)==0&&(h[3]-h[1]+1)%(f[3]-f[1]+1)==0;r=v?h:[h[0],h[1]].concat([h[0]+f[2]-f[0],h[1]+f[3]-f[1]||h[1]]);var y={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:m(f),pastedRange:m(r),type:e&&e.type||"All",cancel:!1};if(e.isAction&&!this.copiedShapeInfo&&this.copiedInfo&&this.parent.notify(ir,{eventArgs:y,action:"clipboard"}),y.cancel)return;var C=void 0,b=void 0,S=void 0,w=[],E=ce(this.parent,i?s:a),R=I(f)&&this.isRangeMerged(h,l);u=(h=c(y.pastedRange))[0];var k={range:f=i?[0,0,d.length-1,p-1]:x(this.copiedShapeInfo?c(l.selectedRange):this.copiedInfo.range),prevSheet:E,cancel:!1};if(r=(v=(h[2]-h[0]+1)%(f[2]-f[0]+1)==0&&(h[3]-h[1]+1)%(f[3]-f[1]+1)==0&&!R)?h:[h[0],h[1]].concat([h[0]+f[2]-f[0],h[1]+f[3]-f[1]||h[1]]),this.parent.getActiveSheet().isProtected&&bt(this.parent,r))return void this.parent.notify("editAlert",null);if(this.copiedShapeInfo&&!this.copiedInfo){var A=this.copiedShapeInfo.pictureElem;A.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(Ut,{chart:[this.copiedShapeInfo.chartInfo],isInitCell:!0,isUndoRedo:!0,isPaste:!0,dataSheetIdx:this.copiedShapeInfo.sheetIdx,isCut:this.copiedShapeInfo.isCut,range:e.range||l.selectedRange,isIdAvailabe:!1})):this.parent.notify(dr,{options:{src:A.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,imageId:this.copiedShapeInfo.isCut?A.id:""},range:m([u,h[1],u,h[1]]),isPublic:!1,isUndoRedo:!0});var T=$(u,h[1],l);if(T&&!t.isNullOrUndefined(T.image)){var F=T.image?T.image.length-1:0,L={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:ve(this.parent)+"!"+m([u,h[1],u,h[1]]),pastedPictureElement:document.getElementById(T.image[F].id)};this.parent.notify(nr,{eventArgs:L,action:"clipboard"})}}else{if(this.parent.notify("pasteMerge",k),k.cancel)return;for(var N=y.type?y.type:e.type,D=[],O=this.isInRange(f,h,a),H=f[0],B=0;H<=f[2];H++,B++)if(O&&(D[h[0]+B]={cells:[]}),be(this.parent.getActiveSheet(),H))h[2]=h[2]-1,B-=1;else{for(var M=f[1],P=0;M<=f[3];M++,P++){if(O&&(D[h[0]+B].cells[h[1]+P]=$(h[0]+B,h[1]+P,E)),C=i?d[H].cells[M]:Object.assign({},O&&D[H]&&D[H].cells[M]?D[H].cells[M]:$(H,M,E)),this.copiedCell=[H,M],C&&e&&e.type||N){switch(N){case"Formats":C={format:C.format,style:C.style};break;case"Values":(C={value:C.value}).value&&C.value.toString().indexOf("\n")>-1&&this.parent.getCell(h[0],h[1]).classList.add("e-alt-unwrap")}b=["Formats","Values"].indexOf(e.type)>-1}if(!this.parent.scrollSettings.isFinite&&(f[2]-f[0]>1048575-h[0]||f[3]-f[1]>16383-h[1])||this.parent.scrollSettings.isFinite&&(f[2]-f[0]>l.rowCount-1-h[0]||f[3]-f[1]>l.colCount-1-h[1]))return void this.showDialog();if(v)for(var _=h[0];_<=h[2];_+=f[2]-f[0]+1)for(var U=h[1];U<=h[3];U+=f[3]-f[1]+1){if(S=$(_+B,U+P,l)||{},!this.externalMerge&&void 0!==S.colSpan||void 0!==S.rowSpan){var V={range:(k={range:[_+B,U+P,_+B,U+P]}).range,merge:!1,isAction:!1,type:"All"};w.push(V),this.parent.activeSheetIndex===l.index&&this.parent.notify(Ht,V)}var z=U+P;if(this.externalMerge&&this.externalMergeRow===_+B?z+=1:this.externalMerge=!1,!b){var q=this.isFormula([_+B,z]);t.isNullOrUndefined(q)||(C.formula=q)}var j=!1;if(this.parent.filteredRows&&this.parent.filteredRows.rowIdxColl&&this.parent.filteredRows.sheetIdxColl)for(var W=0,Y=this.parent.filteredRows.sheetIdxColl.length;W<Y;W++)if(this.parent.filteredRows.sheetIdxColl[W]===this.parent.activeSheetIndex&&this.parent.filteredRows.rowIdxColl[W]===_+B){j=!0;break}j||(this.parent.getActiveSheet().isProtected&&C&&(t.isNullOrUndefined(C.isLocked)||!0===C.isLocked)&&(C.isLocked=S.isLocked),this.setCell(_+B,z,l,C,b,!1,U===h[3],i));var X=this.parent.activeSheetIndex,K=this.parent.getCell(_+B,z),Z=g(_+B,z),J={address:this.parent.sheets[X].name+"!"+Z,requestType:"paste",value:$(_+B,z,l)?$(_+B,z,l).value:"",oldValue:S.value,element:K,displayText:this.parent.getDisplayText(C)};this.parent.trigger("cellSave",J)}else!i&&st(this.parent,H,M,a)||(R?this.setCell(u,h[1]+P,l,{value:C.value},!0,!1,M===f[3]):this.setCell(u,h[1]+P,l,C,b,!1,M===f[3]));if(!i&&this.copiedInfo.isCut&&(!G(h,H,M)||a!==this.parent.activeSheetIndex)){var Q=$(H,M,E);Q&&(Q.isLocked||t.isNullOrUndefined(Q.isLocked)?Q=null:!1===Q.isLocked&&(Q=this.parent.getActiveSheet().isProtected?{isLocked:!1}:null)),this.setCell(H,M,E,Q,!1,!0,M===f[3])}}u++}if(this.parent.notify("refreshRibbonIcons",null),this.parent.setUsedRange(r[2]+1,r[3]),s===this.parent.activeSheetIndex&&(this.parent.serviceLocator.getService("cell").refreshRange(r),this.parent.notify("selectRange",{address:m(r)})),!i&&this.copiedInfo.isCut&&(n=this.copiedInfo.isCut,a===this.parent.activeSheetIndex&&this.parent.serviceLocator.getService("cell").refreshRange(f),this.clearCopiedInfo(),this.cutInfo=n),(i||O)&&this.copiedInfo&&this.clearCopiedInfo(),(i||e&&e.isAction)&&Ct(this.parent.element),e.isAction){var ee=o&&o.sId?oe(this.parent,o.sId):this.parent.activeSheetIndex,L={requestType:"paste",copiedInfo:o,mergeCollection:w,pasteSheetIndex:this.parent.activeSheetIndex,copiedRange:this.parent.sheets[ee].name+"!"+m(o&&o.range?o.range:c(this.parent.sheets[ee].selectedRange)),pastedRange:ve(this.parent)+"!"+m(r),type:N||"All"};i||this.parent.notify(nr,{eventArgs:L,action:"clipboard"})}if(n){this.updateFilter(o,r),mt(E,f[0],f[1],this.parent.getCell(f[0],f[1]).offsetHeight);re=vt(E,f[0]);lt(this.parent,E,re,f[0])}var te=ce(this.parent,a);if(!i&&f[0]===f[2]&&f[3]-f[1]==te.colCount-1){for(var re=te.rows[f[0]].height,H=h[0];H<=h[2];H++)lt(this.parent,this.parent.getActiveSheet(),re,H);n&<(this.parent,te,20,f[0])}}}else this.getClipboardEle().select()}},e.prototype.isRangeMerged=function(e,t){var r=$(e[0],e[1],t);if(r&&(r.colSpan>1||r.rowSpan>1)){var n={range:e.slice(2,4).concat(e.slice(2,4))};return this.parent.notify("activeCellMergedRange",n),n.range[0]===e[0]&&n.range[1]===e[1]&&n.range[2]===e[2]&&n.range[3]===e[3]}return!1},e.prototype.updateFilter=function(e,t){var r,n;this.parent.notify("getFilteredCollection",null);for(var i=0;i<this.parent.sheets.length;i++)if(this.parent.filterCollection&&this.parent.filterCollection[i]&&this.parent.filterCollection[i].sheetIndex===oe(this.parent,e.sId)){var a=e.range,o=c(this.parent.filterCollection[i].filterRange);a=x(a),o[0]===a[0]&&o[2]===a[2]&&o[1]===a[1]&&o[3]===a[3]&&(r=!0,n=[Math.abs(a[0]-o[0]),Math.abs(a[1]-o[1]),Math.abs(a[2]-o[2]),Math.abs(a[3]-o[3])])}var s=this.parent.getCell(e.range[0],e.range[1]),l=(s=s?s.querySelector(".e-filter-icon")?s:this.parent.getCell(e.range[2],e.range[3]):s)?s.querySelector(".e-sortasc-filter"):s,h=s?s.querySelector(".e-sortdesc-filter"):s;if(r)for(var d=0;d<this.parent.filterCollection.length;d++){var p=this.parent.filterCollection[d],u=e&&e.sId?oe(this.parent,e.sId):this.parent.activeSheetIndex;if(p.sheetIndex===u&&this.parent.notify(rr,{predicates:null,range:p.filterRange,sIdx:u,isCut:!0}),p.sheetIndex===u&&u===this.parent.activeSheetIndex&&(n=[t[0]+n[0],t[1]+n[1],Math.abs(t[2]-n[2]),Math.abs(t[3]-n[3])],this.parent.notify(rr,{predicates:null,range:m(n),sIdx:null,isCut:!0}),e.range[3]===e.range[1])){var f=this.parent.getCell(t[0],t[1]);l&&f&&f.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"),h&&f&&f.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter")}}},e.prototype.isInRange=function(e,t,r){var n=this.parent.activeSheetIndex;return G(e,t[0],t[1])&&r===n||G(e,t[2],t[3])&&r===n},e.prototype.isFormula=function(e){var r,n,i;if(t.isNullOrUndefined(this.copiedCell)||(i=t.isNullOrUndefined(this.copiedSheet)?this.parent.getActiveSheet():this.copiedSheet,n=$(this.copiedCell[0],this.copiedCell[1],i),t.isNullOrUndefined(n)||(r=n.formula?n.formula.toUpperCase():"")),""===r||t.isNullOrUndefined(r))return null;0===r.indexOf("=")&&(r=r.slice(1));var a=r.indexOf("("),o=r.indexOf(")");a>-1&&o>-1&&(r=r.slice(a+1,o));for(var s=[],l=["+","-","*","/"],h=void 0,d=r,p=0;p<l.length;p++)d=(h=d.split(l[p])).join(",");var f=void 0;1===(h=d.split(",")).length&&h.indexOf(":")&&(h=d.split(":"),f=!0);for(C=0;C<h.length;C++)if(j(h[C])){var m=u(h[C]),v=[this.copiedCell[0]-m[0],this.copiedCell[1]-m[1]];s.push(v[0]),s.push(v[1])}for(var y=[],C=0;C<s.length;C++){var b=g(e[0]-s[0+C],e[1]-s[1+C]);y.push(b),C++}for(var S=void 0,x=0;x<y.length;x++)if(j(y[x])?((m=c(y[x]))[0]<0||m[1]<0)&&(S=!0):S=!0,S){if(f){y=["#REF!"],h=[h.join(":")];break}y[x]="#REF!"}r=n.formula.toUpperCase();for(p=0;p<h.length;p++)for(C=0;C<y.length;C++)r=r.replace(h[p].toUpperCase(),y[C].toUpperCase()),p++;return r},e.prototype.setCell=function(e,t,r,n,i,a,o,s){var l=r?oe(this.parent,r.id):null;if(Z(e,t,r,n,i),n&&n.formula&&this.parent.notify(Et,{action:"refreshCalculate",value:a?"":n.formula,rowIndex:e,colIndex:t,sheetIndex:this.parent.activeSheetIndex,isFormula:!0}),n&&!n.formula&&this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:[e,t,e,t],value:n.value,sheetIndex:l}),r.name===this.parent.getActiveSheet().name&&this.parent.serviceLocator.getService("cell").refresh(e,t,o),n&&n.style&&s){var h=gt(this.parent,e,t,r,n.style||this.parent.cellStyle,n.wrap?pt(this.parent.getDisplayText(n),ft(r,e,t),n.style,this.parent.cellStyle):1);(h=Math.round(h))<20&&(h=20),mt(r,e,t,h);var d=we(r,e),p=vt(r,e);p>d&<(this.parent,r,p,e)}},e.prototype.getCopiedIdx=function(){if(this.copiedInfo){for(var e=0;e<this.parent.sheets.length;e++)if(this.parent.sheets[e].id===this.copiedInfo.sId)return e;this.clearCopiedInfo()}return-1},e.prototype.setCopiedInfo=function(e,n){var i=this;if(!this.parent.isEdit){var a=new r.Deferred;e.promise=a.promise;var o,s=this.parent.getActiveSheet();if(e&&e.range){var l={range:e.range};this.parent.notify("mergedRange",l),o=l.range}else o=c(s.selectedRange);var h={sheet:s,indexes:[0,0,s.rowCount-1,s.colCount-1],promise:new Promise(function(e,t){e(void 0)})},d=document.getElementsByClassName("e-ss-overlay-active"),p=d.length;!s.isLocalData||e&&e.clipboardData||0!==o[0]||o[2]!==s.rowCount-1||(this.parent.showSpinner(),this.parent.notify("updateSheetFromDataSource",h)),h.promise.then(function(){if(p>0){var r={clientY:d[0].offsetTop,isImage:!0};i.parent.notify("getRowIdxFromClientY",r);var l={clientX:d[0].offsetLeft,isImage:!0};i.parent.notify("getColIdxFromClientX",l),i.copiedShapeInfo={sId:e&&e.sId?e.sId:s.id,sheetIdx:s.index,isCut:n,pictureElem:d[0],copiedRange:m([r.clientY,l.clientX,r.clientY,l.clientX]),height:d[0].offsetHeight,width:d[0].offsetWidth,chartInfo:i.getChartElemInfo(d[0])},i.hidePaste(!0),n&&(d[0].classList.contains("e-datavisualization-chart")?i.parent.deleteChart(i.copiedShapeInfo.chartInfo.id):i.parent.notify(pr,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))}else e&&e.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:o,sId:e&&e.sId?e.sId:s.id,isCut:n},i.hidePaste(!0),i.initCopyIndicator(),t.Browser.isIE||i.getClipboardEle().select(),e&&e.isAction&&document.execCommand(n?"cut":"copy"),i.parent.hideSpinner());t.Browser.isIE&&i.setExternalCells(e),a.resolve()}),e&&e.clipboardData&&(this.setExternalCells(e),Ct(this.parent.element))}},e.prototype.getChartElemInfo=function(e){var t=this.parent.chartColl;if(e.classList.contains("e-datavisualization-chart"))for(var r=e.getElementsByClassName("e-control")[0].id,n=0;n<t.length;n++)if(t[n].id===r)return t[n];return null},e.prototype.clearCopiedInfo=function(){this.copiedInfo&&(this.parent.getActiveSheet().id===this.copiedInfo.sId&&(this.removeIndicator(this.parent.getSelectAllContent()),this.removeIndicator(this.parent.getColumnHeaderContent()),this.removeIndicator(this.parent.getRowHeaderContent()),this.removeIndicator(this.parent.getMainContent())),this.copiedInfo=null,this.hidePaste()),this.copiedShapeInfo&&(this.copiedShapeInfo=null,this.hidePaste())},e.prototype.removeIndicator=function(e){if(e){var r=e.querySelector(".e-copy-indicator");r&&t.detach(r)}},e.prototype.initCopyIndicator=function(){if(this.copiedInfo&&this.parent.getActiveSheet().id===this.copiedInfo.sId){var e=this.parent.createElement("div",{className:"e-copy-indicator"});e.appendChild(this.parent.createElement("div",{className:"e-top"})),e.appendChild(this.parent.createElement("div",{className:"e-bottom"})),e.appendChild(this.parent.createElement("div",{className:"e-left"})),e.appendChild(this.parent.createElement("div",{className:"e-right"})),_e(this.parent,e,this.copiedInfo.range,"e-copy-indicator")}},e.prototype.showDialog=function(){var e=this;this.parent.serviceLocator.getService(Ai).show({header:"Spreadsheet",target:this.parent.element,height:205,width:340,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).getConstant("PasteAlert"),beforeOpen:function(t){var r={dialogName:"PasteDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0)}})},e.prototype.hidePaste=function(e){this.parent.getActiveSheet().isProtected&&(e=!1),this.parent.notify("enableToolbarItems",[{items:[this.parent.element.id+"_paste"],enable:e||!1}])},e.prototype.setExternalCells=function(e){for(var r,n="",i=this.copiedInfo.range,a=this.parent.getActiveSheet(),o='<html><body><table class="e-spreadsheet" xmlns="http://www.w3.org/1999/xhtml"><tbody>',s=i[0];s<=i[2];s++){o+="<tr>";for(var l=i[1];l<=i[3];l++){if(r=$(s,l,a),o+='<td style="white-space:'+(r&&r.wrap?"normal":"nowrap")+";vertical-align:bottom;",r&&r.style&&Object.keys(r.style).forEach(function(e){var t=e.match(/[A-Z]/);o+=("backgroundColor"===e?"background":t?e.replace(t[0],"-"+t[0].toLowerCase()):e)+":"+("backgroundColor"===e||"color"===e?r.style[e].slice(0,7):r.style[e])+";"}),o+='">',r&&r.value){var h={formattedText:r.value,value:r.value,format:r.format,onLoad:!0};r.format&&this.parent.notify("getFormattedCell",h),o+=h.formattedText,n+=h.formattedText}o+="</td>",n+=l===i[3]?"":"\t"}o+="</tr>",n+=s===i[2]?"":"\n"}o+="</tbody></table></body></html>",t.Browser.isIE?window.clipboardData.setData("text",n):(e.clipboardData.setData("text/html",o),e.clipboardData.setData("text/plain",n),e.preventDefault())},e.prototype.getExternalCells=function(e){var r,n,i,a=this,o=[],s=[],l=this.parent.createElement("span");return t.Browser.isIE?n=window.clipboardData.getData("text"):(r=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),l.innerHTML=r),l.querySelector("table")?l.querySelector(".e-spreadsheet")&&this.copiedInfo?o={internal:!0}:l.querySelectorAll("tr").forEach(function(e){e.querySelectorAll("td").forEach(function(e,t){i=a.getStyle(e,l),e.textContent=e.textContent.replace(/(\r\n|\n|\r)/gm,"");var r,n=isNaN(parseInt(e.getAttribute("colspan"),10))?1:parseInt(e.getAttribute("colspan"),10),o=isNaN(parseInt(e.getAttribute("rowspan"),10))?1:parseInt(e.getAttribute("rowspan"),10);i.whiteSpace&&(r=!0,delete i.whiteSpace),s[t]={value:e.textContent?D(e.textContent.trim()):null,style:i,colSpan:n,rowSpan:o,wrap:r}}),o.push({cells:s}),s=[]}):n&&(r&&[].slice.call(l.children).forEach(function(e){e.getAttribute("style")&&(i=a.getStyle(e,l))}),n.trim().split("\n").forEach(function(e){e.split("\t").forEach(function(e,t){if(e){var r=void 0;i&&i.whiteSpace&&(r=!0,delete i.whiteSpace),s[t]={style:i,wrap:r},q(e)?s[t].formula=e:s[t].value=D(e.trim())}}),o.push({cells:s}),s=[]})),setTimeout(function(){a.getClipboardEle().innerHTML=""},0),o},e.prototype.getStyle=function(e,t){var r=[],n={},i=Object.keys(this.parent.commonCellStyle);if(e.classList.length||e.getAttribute("style")||i.length){if(t.querySelector("style")&&e.classList.length&&t.querySelector("style").innerHTML.indexOf(e.classList[0])>-1&&r.push(t.querySelector("style").innerHTML.split(e.classList[0])[1].split("{")[1].split("}")[0]),e.getAttribute("style")&&(r.push(e.getAttribute("style")),e.children&&e.children.length))for(var a=0,o=e.children.length;a<o;a++)if(e.children[a]&&e.children[a].getAttribute("style")&&(r.push(e.children[a].getAttribute("style")),e.children[a]&&e.children[a].children))for(var s=0,l=e.children[s].children.length;s<l;s++)e.children[s]&&e.children[s].children[s]&&e.children[s].children[s].getAttribute("style")&&r.push(e.children[s].children[s].getAttribute("style"));if(i.length&&t.querySelector("style"))for(var h=t.querySelector("style").innerHTML.split("td")[1].split("{")[1].split("}")[0],a=0;a<i.length;a++){var d=i[a],p=d.match(/[A-Z]/);p&&(d=d.replace(p[0],"-"+p[0].toLowerCase())),h.indexOf(d)>-1&&(n[i[a]]=h.split(d+":")[1].split(";")[0])}r.forEach(function(e){e.split(";").forEach(function(e){var t=e.split(":")[0].trim();if(["font-family","vertical-align","text-align","text-indent","color","background","font-weight","font-style","font-size","text-decoration","border-bottom","border-top","border-right","border-left","border","white-space"].indexOf(t)>-1){var r=(t="background"===t?"backgroundColor":t).match(/-[a-z]/),i=e.split(":")[1];n[r?t.replace(r[0],r[0].charAt(1).toUpperCase()):t]="font-weight"===t&&-1===["bold","normal"].indexOf(i)?i>"599"?"bold":"normal":i}})})}return e.innerHTML.indexOf("<s>")>-1&&(n.textDecoration="line-through"),this.defaultCellStyle(n)},e.prototype.defaultCellStyle=function(e){var t=["underline","line-through","underline line-through","none"],r=["left","center","right"],n=["bottom","middle","top"],i=e.fontSize?e.fontSize.trim():null;return e.textDecoration&&t.indexOf(e.textDecoration.trim())<0&&(e.textDecoration="none"),e.textAlign&&r.indexOf(e.textAlign.trim())<0&&(e.textAlign="left"),e.verticalAlign&&n.indexOf(e.verticalAlign.trim())<0&&(e.verticalAlign="bottom"),i&&(i=i.indexOf("px")>-1?.75*parseFloat(i)+"pt":i,e.fontSize=Math.round(parseFloat(i))+"pt"),e},e.prototype.getClipboardEle=function(){return this.parent.element.getElementsByClassName("e-clipboard")[0]},e.prototype.getModuleName=function(){return"clipboard"},e.prototype.destroy=function(){this.removeEventListener();var e=this.getClipboardEle();t.detach(e),this.parent=null},e}(),Hn=function(){function e(e){this.editorElem=null,this.editCellData={},this.isEdit=!1,this.isCellEdit=!0,this.isNewValueEdit=!0,this.isAltEnter=!1,this.validCharacters=["+","-","*","/",",","(","=","&"],this.formulaBarCurStartPos=null,this.curEndPos=null,this.curStartPos=null,this.selectionStart=null,this.selectionEnd=null,this.keyCodes={BACKSPACE:8,SPACE:32,TAB:9,DELETE:46,ESC:27,ENTER:13,FIRSTALPHABET:65,LASTALPHABET:90,FIRSTNUMBER:48,LASTNUMBER:59,FIRSTNUMPAD:96,LASTNUMPAD:111,SYMBOLSETONESTART:186,SYMBOLSETONEEND:192,SYMBOLSETTWOSTART:219,SYMBOLSETTWOEND:222,FIREFOXEQUALPLUS:61,FIREFOXMINUS:173,F2:113},this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.editorElem=null},e.prototype.addEventListener=function(){t.EventHandler.add(this.parent.element,"dblclick",this.dblClickHandler,this),this.parent.on("mouseDown",this.mouseDownHandler,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on(Xt,this.keyDownHandler,this),this.parent.on(Wt,this.performEditOperation,this),this.parent.on("initiateCur",this.initiateCurPosition,this),this.parent.on("editValue",this.updateFormulaBarValue,this),this.parent.on("addressHandle",this.addressHandler,this),this.parent.on("initiateEdit",this.initiateRefSelection,this),this.parent.on("forRefSelRender",this.refSelectionRender,this)},e.prototype.removeEventListener=function(){t.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off("mouseDown",this.mouseDownHandler),this.parent.off(Yt,this.keyUpHandler),this.parent.off(Xt,this.keyDownHandler),this.parent.off(Wt,this.performEditOperation),this.parent.off("initiateCur",this.initiateCurPosition),this.parent.off("editValue",this.updateFormulaBarValue),this.parent.off("addressHandle",this.addressHandler),this.parent.off("initiateEdit",this.initiateRefSelection),this.parent.off("forRefSelRender",this.refSelectionRender))},e.prototype.getModuleName=function(){return"edit"},e.prototype.performEditOperation=function(e){switch(e.action){case"renderEditor":this.renderEditor();break;case"refreshEditor":this.refreshEditor(e.value,e.refreshFormulaBar,e.refreshEditorElem,e.isAppend,e.trigEvent),e.refreshCurPos&&this.setCursorPosition();break;case"startEdit":if(this.isEdit){var t={isEdit:!1};this.parent.notify("isFormulaBarEdit",t),t.isEdit&&(this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos))}else this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos);break;case"endEdit":this.isEdit&&this.endEdit(e.refreshFormulaBar);break;case"cancelEdit":this.isEdit&&this.cancelEdit(e.refreshFormulaBar);break;case"getCurrentEditValue":e.editedValue=this.editCellData.value;break;case"refreshDependentCellValue":this.refreshDependentCellValue(e.rowIdx,e.colIdx,e.sheetIdx);break;case"getElement":e.element=this.getEditElement(this.parent.getActiveSheet());break;case"focusEditorElem":this.editorElem.focus();break;case"getCurrentEditSheetIdx":e.sheetIndex=this.editCellData.sheetIndex}},e.prototype.keyUpHandler=function(e){if(this.isEdit){var t=this.getEditElement(this.parent.getActiveSheet());if(e.altKey&&13===e.keyCode?(t.focus(),this.altEnter(),this.isAltEnter=!0):this.isCellEdit&&this.editCellData.value!==t.textContent&&16!==e.keyCode&&this.refreshEditor(t.textContent,this.isCellEdit),(q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("="))&&16!==e.keyCode){var r=this.parent.element.querySelector(".e-formularef-indicator");r&&r.parentElement.removeChild(r),this.editCellData.value!==t.textContent&&this.refreshEditor(t.textContent,!0);var n=this.editCellData.sheetIndex,i=this.editCellData.value;this.parent.notify("initiateFormulaReference",{range:i,formulaSheetIdx:n})}}},e.prototype.keyDownHandler=function(e){var r=e.target,n=e.keyCode,i=this.parent.getActiveSheet(),a=u(i.activeCell),o=$(a[0],a[1],i)||{};if(!t.closest(e.target,".e-findtool-dlg")&&!t.closest(e.target,".e-validationerror-dlg")&&!t.closest(e.target,".e-hyperlink-dlg"))if(i.isProtected&&!t.closest(e.target,".e-sheet-rename")&&X(o,Ie(i,a[1]))){if((n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET||n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER||n===this.keyCodes.DELETE||n===this.keyCodes.BACKSPACE||n===this.keyCodes.SPACE||n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD||n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND||n>=219&&n<=222||!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2)&&67!==n&&89!==n&&90!==n){if(i.protectSettings.insertLink&&75===n)return;this.parent.element.querySelector(".e-editAlert-dlg")||e.ctrlKey||70===e.keyCode||r.parentElement.classList.contains("e-unprotectpwd-content")||r.parentElement.classList.contains("e-password-content")||this.parent.notify("editAlert",null)}}else if(this.isEdit){var s=this.getEditElement(i),l=q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=");if((this.isCellEdit||l&&this.editCellData.value!==s.textContent&&16!==e.keyCode)&&(a[1]<this.parent.frozenColCount(i)&&(!i.frozenRows||a[0]>=this.parent.frozenRowCount(i))&&s&&"auto"!==s.style.height&&dt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)&&(s.style.height="auto"),dt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)-5&&(s.style.height="auto"),a[0]<this.parent.frozenRowCount(i)&&s&&!s.style.overflow&&dt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)&&(s.style.overflow="auto"),this.refreshEditor(s.textContent,this.isCellEdit)),!e.altKey)switch(n){case this.keyCodes.ENTER:if(t.Browser.isWindows&&e.preventDefault(),this.isAltEnter){var h=s.textContent;h&&h.indexOf("\n")>-1&&(Q(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(s.textContent,this.isCellEdit),this.isAltEnter=!1)}if(l){var d=this.parent.element.querySelector(".e-formularef-indicator");d&&d.parentElement.removeChild(d),this.editCellData.sheetIndex===i.id-1?this.endEdit(!1,e):(this.parent.goTo(this.editCellData.fullAddr),this.endEdit(!1,e))}else this.endEdit(!1,e);break;case this.keyCodes.TAB:this.hasFormulaSuggSelected()||this.endEdit(!1,e);break;case this.keyCodes.ESC:this.cancelEdit(!0,!0,e)}}else if(!this.isEdit&&(r.classList.contains("e-spreadsheet")||t.closest(r,".e-sheet-panel"))){var p=n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET,c=n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER,f=n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD,g=n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND;g||(g=n>=this.keyCodes.SYMBOLSETTWOSTART&&n<=this.keyCodes.SYMBOLSETTWOEND);var m=n===this.keyCodes.FIREFOXEQUALPLUS||n===this.keyCodes.FIREFOXMINUS,v=!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2,y=n===this.keyCodes.BACKSPACE;if(!e.ctrlKey&&!e.metaKey&&!e.altKey&&(!e.shiftKey&&n===this.keyCodes.SPACE||p||c||f||g||"mozilla"===t.Browser.info.name&&m)||v||y){v&&(this.isNewValueEdit=!1);var C=document.getElementsByClassName("e-ss-overlay-active");C.length>0?n===this.keyCodes.DELETE&&this.parent.notify(pr,{id:C[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.startEdit(null,null,!0,!0)}n===this.keyCodes.DELETE&&(i.isProtected&&bt(this.parent)?this.parent.notify("editAlert",null):(this.editingHandler("delete"),this.parent.notify("activeCellChanged",null)))}},e.prototype.renderEditor=function(){if(!this.editorElem||!t.select("#"+this.parent.element.id+"_edit",this.parent.element)){var e=this.parent.createElement("div",{id:this.parent.element.id+"_edit",className:"e-spreadsheet-edit"});e.contentEditable="true",e.spellcheck=!1,this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0]&&this.parent.element.getElementsByClassName("e-spreadsheet-edit")[0].remove(),this.parent.element.querySelector(".e-sheet-content").appendChild(e),this.editorElem=e}this.parent.notify("formulaOperation",{action:"renderAutoComplete"})},e.prototype.refreshEditor=function(e,t,r,n,i){void 0===i&&(i=!0),n?e=this.editCellData.value=this.editCellData.value+e:this.editCellData.value=e;var a=this.getEditElement(this.parent.getActiveSheet());r&&(a.textContent=e),t&&this.parent.notify("formulaBarOperation",{action:"refreshFormulabar",value:e}),i&&this.editCellData.value===a.textContent&&this.triggerEvent("cellEditing")&&this.cancelEdit()},e.prototype.startEdit=function(e,t,r,n){void 0===r&&(r=!0),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true");var i=this.parent.getActiveSheet(),a=u(i.activeCell),o=$(a[0],a[1],i,!1,!0);if(st(this.parent,a[0],a[1],this.parent.activeSheetIndex)){var s=this.parent.getCell(a[0],a[1]),l=!1,h=s.innerHTML;if(s&&h.indexOf("<")>-1&&h.indexOf(">")>-1&&h.indexOf("input")>-1&&(l=!0),l)return}this.updateEditCellDetail(e,t),this.initiateEditor(r),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify("clearCopy",null),this.parent.notify("enableToolbarItems",[{enable:!1}]),o.formula&&!n&&this.parent.notify("initiateFormulaReference",{range:o.formula,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.setCursorPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet()),t=e.textContent.length;if(t){var r=document.getSelection(),n=document.createRange();n.setStart(e.firstChild,t),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}e.focus()},e.prototype.hasFormulaSuggSelected=function(){var e=document.getElementById(this.parent.element.id+"_ac_popup");return e&&"visible"===e.style.visibility&&e.querySelectorAll(".e-item-focus").length>0},e.prototype.editingHandler=function(e){var t=document.getElementsByClassName("e-ss-overlay-active"),r=t.length;switch(e){case"delete":if(r>0)t[0].classList.contains("e-datavisualization-chart")?this.parent.notify(cr,{id:t[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(pr,{id:t[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var n=this.parent.getActiveSheet(),i=n.selectedRange;this.parent.notify(ir,{action:"cellDelete",eventArgs:{address:n.name+"!"+i}});var a=y(i);i=m(a=a[0]>a[2]?x(a):a),this.parent.clearRange(i,null,!0),this.parent.serviceLocator.getService("cell").refreshRange(a),this.parent.notify("selectionComplete",{}),this.parent.notify(nr,{action:"cellDelete",eventArgs:{address:n.name+"!"+i}})}}},e.prototype.mouseDownHandler=function(e){if(!t.closest(e.target,".e-findtool-dlg")&&this.isEdit){var r=window.getSelection();if(this.editorElem.textContent===this.editCellData.value){if(this.selectionStart=r.anchorOffset,this.selectionEnd=r.focusOffset,this.selectionStart>this.selectionEnd){var n=this.selectionStart;this.selectionStart=this.selectionEnd,this.selectionEnd=n}this.curStartPos=this.selectionStart,this.curEndPos=this.selectionEnd}if(r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")&&this.editorElem.textContent===this.editCellData.value){var i=r.focusNode.getElementsByClassName("e-formula-bar e-css")[0];this.selectionStart=i.selectionStart,this.selectionEnd=i.selectionEnd,this.curStartPos=this.selectionStart,this.curEndPos=this.selectionEnd}var a=e.target,o=this.parent.getActiveSheet(),s=this.parent.element.querySelector(".e-formularef-indicator");this.isCellEdit=a.classList.contains("e-spreadsheet-edit");var l=q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("="),h=this.getEditElement(o);if(a.classList.contains("e-cell")||a.classList.contains("e-header-cell")||a.classList.contains("e-selectall")||t.closest(a,".e-toolbar-item.e-active")||t.closest(a,".e-table")){if(this.isAltEnter){var d=h.textContent;d&&d.indexOf("\n")>-1&&(this.isAltEnter=!1,Q(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(h.textContent,this.isCellEdit))}if(l){var p=this.selectionEnd,c=u(o.activeCell),f=$(c[0],c[1],o);if(this.selectionStart!==this.selectionEnd&&this.editCellData.value===h.textContent&&-1!==this.validCharacters.indexOf(h.textContent.substring(this.selectionStart-1,this.selectionStart))&&j(h.textContent.substring(this.selectionStart,this.selectionEnd))&&h.textContent.indexOf(":")!==this.selectionEnd&&(this.editCellData.value=h.textContent.substring(0,this.selectionStart)+h.textContent.substring(this.selectionEnd,h.textContent.length)),this.editCellData.value===h.textContent&&h.textContent.indexOf("(")!==h.textContent.length-1&&-1!==h.textContent.indexOf("(")&&this.selectionStart===this.selectionEnd)if(this.editCellData.sheetIndex!==o.id-1){var g=this.parent.element.querySelector(".e-formula-bar");if(","!==h.textContent.substring(g.selectionEnd-1,g.selectionEnd)&&!e.shiftKey)return s&&s.parentElement.removeChild(s),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}else if(-1===this.validCharacters.indexOf(h.textContent.substring(p-1,p)))return s&&s.parentElement.removeChild(s),void this.endEdit(!1,e);if(!f)return;if((l=!!f.formula&&(q($(c[0],c[1],o).formula)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=")))&&this.parent.isEdit){var m=this.selectionEnd;this.editCellData.value.length===m?(")"===this.editCellData.value.substring(this.editCellData.value.length-1)||L(this.editCellData.value.substring(this.editCellData.value.length-1)))&&(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)):this.editCellData.value===h.textContent&&(-1===this.validCharacters.indexOf((this.editCellData.value+o.selectedRange).substring(m-1,m))?(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)):(-1===this.validCharacters.indexOf(h.textContent.substring(m-1,m))||")"!==h.textContent.substring(m,m+1)&&-1===this.validCharacters.indexOf(h.textContent.substring(m,m+1)))&&(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)))}}else this.endEdit(!1,e)}else if(l&&this.editCellData.value===h.textContent&&h.textContent.indexOf("(")!==h.textContent.length-1&&!this.isCellEdit&&-1===this.validCharacters.indexOf(this.editCellData.value.substring(this.selectionStart-1,this.selectionStart))&&this.editCellData.sheetIndex===o.id-1){p=window.getSelection().focusOffset;if(-1===this.validCharacters.indexOf(h.textContent.substring(p-1,p)))return s&&s.parentElement.removeChild(s),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}}},e.prototype.dblClickHandler=function(e){var r=e.target,n=this.parent.getActiveSheet(),i=u(n.activeCell),a=$(i[0],i[1],n)||{};if(!t.closest(r,".e-datavisualization-chart"))if(n.isProtected&&X(a,Ie(n,i[1])))(r.classList.contains("e-active-cell")||r.classList.contains("e-cell"))&&this.parent.notify("editAlert",null);else if(r.className.indexOf("e-ss-overlay")<0&&(r.classList.contains("e-active-cell")||r.classList.contains("e-cell")||t.closest(r,".e-sheet-content")||r.classList.contains("e-table")))if(this.isEdit)if(q(this.editCellData.value)){var o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name===o&&this.endEdit()}else this.endEdit();else this.isNewValueEdit=!1,this.startEdit()},e.prototype.updateEditCellDetail=function(e,t){var r,n;if(this.editCellData.sheetIndex||(r=e&&e.split("!").length>1?ae(this.parent,se(e)):this.parent.activeSheetIndex),this.editCellData.addr?q(this.editCellData.value)&&(n=ce(this.parent,r),this.isNewValueEdit=!1):(n=ce(this.parent,r),e=e?C(e):n.activeCell),e){var i=c(e),a=i[0],o=i[1],s=this.parent.getCell(a,o),l=Pe(n,i,this.parent.frozenRowCount(n),this.parent.frozenColCount(n),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);this.editCellData={addr:e,fullAddr:ve(this.parent,r)+"!"+e,rowIndex:a,colIndex:o,sheetIndex:r,element:s,value:t||"",position:l}}},e.prototype.initiateEditor=function(e){var r=this;this.parent.getData(this.editCellData.fullAddr).then(function(n){n.forEach(function(n){var i={cell:n,value:n?n.value:""};r.parent.notify("getFormattedBarText",i);var a=n?i.value:"";n&&n.formula&&(a=n.formula),r.editCellData.oldValue=a,r.editCellData.value?a=r.editCellData.value:r.editCellData.value=a,r.isNewValueEdit?a="":r.isNewValueEdit=!0,t.isUndefined(a)||r.refreshEditor(a,!1,!0,!1,!1),e&&r.setCursorPosition(),r.triggerEvent("cellEdit")&&r.cancelEdit(!0,!1)})})},e.prototype.positionEditor=function(e){var r,n=this.editCellData.element,i={isEdit:!1};if(this.parent.notify("isFormulaBarEdit",i),i.isEdit&&t.isNullOrUndefined(n)&&(n=r=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=r),n){n.classList.add("e-ss-edited");var a=this.parent.getActiveSheet(),o=$(this.editCellData.rowIndex,this.editCellData.colIndex,a,!1,!0),s=this.editCellData.position.left+1,l=this.editCellData.position.top+1,h={range:[this.editCellData.rowIndex,this.editCellData.colIndex,this.editCellData.rowIndex,this.editCellData.colIndex]};this.parent.notify("activeCellMergedRange",h);var d=we(a,h.range[0],h.range[2])-3,p=ke(a,h.range[1],h.range[3])-3,c=this.parent.element.getElementsByClassName("e-main-panel")[0],u=void 0,f=this.parent.frozenColCount(a),g=void 0,m=void 0,v=this.parent.frozenRowCount(a),y=void 0;this.editCellData.colIndex<f?(u=Math.abs(this.parent.getRowHeaderContent().getBoundingClientRect()[this.parent.enableRtl?"left":"right"]-n.getBoundingClientRect()[this.parent.enableRtl?"right":"left"])-1,this.editCellData.rowIndex<v?"2"===this.parent.getRowHeaderContent().style.zIndex&&(g="3"):dt(o.value,o.style,this.parent.cellStyle)>u&&(y=!0)):u=c.offsetWidth-s-28-this.parent.sheetModule.getRowHeaderWidth(a),this.editCellData.rowIndex<v&&(m=!0);var C=!m&&(o&&o.wrap||n&&e||y)?"auto;":d+"px;",b="display:block;top:"+l+"px;"+(this.parent.enableRtl?"right:":"left:")+s+"px;min-width:"+p+"px;max-width:"+(o&&o.wrap?p:u)+"px;height:"+C+(o&&o.wrap?"width:"+p+"px;":"")+"min-height:"+d+"px;"+(g?"z-index: "+g+";":"")+(m&&(o&&!o.wrap||n&&e)&&(dt(o.value,o.style,this.parent.cellStyle)>u||n&&e)?"overflow: auto;":"");b+=n.style.cssText;var S=this.getEditElement(a,!0);S.setAttribute("style",b),dt(S.textContent,o.style,this.parent.cellStyle)>u&&(S.style.height="auto"),this.parent.element.querySelector(".e-active-cell").style.height=d+4+"px",n.classList.contains("e-right-align")?S.classList.add("e-right-align"):n.classList.contains("e-center-align")&&S.classList.add("e-center-align")}},e.prototype.updateEditedValue=function(e){void 0===e&&(e=!0);var t=this.editCellData.oldValue,r=t?t.toString().toUpperCase():"",n=!0,i=this.editCellData.addr,a=c(this.parent.getActiveSheet().activeCell),o=this.parent.getActiveSheet(),s=$(a[0],a[1],o),l=Ie(o,a[1]);if(this.parent.notify("setActionData",{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}}),this.parent.allowDataValidation&&(s&&s.validation||l&&l.validation)){var h=this.getEditElement(o).innerText,d=this.parent.activeSheetIndex,p=void 0;p="string"==typeof i?c(i):i,this.parent.notify("isValidation",{value:h,range:p,sheetIdx:d,isCell:!0}),n=this.parent.allowDataValidation,this.editCellData.value=n?h:this.editCellData.value,this.parent.allowDataValidation=!0}if((t!==this.editCellData.value||r.indexOf("=RAND()")>-1||r.indexOf("RAND()")>-1||r.indexOf("=RANDBETWEEN(")>-1||r.indexOf("RANDBETWEEN(")>-1)&&n){var u=this.parent.getActiveSheet(),f=c(u.activeCell);this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value});var g=$(f[0],f[1],u,!0),m=this.getRefreshNodeArgs(g);this.editCellData.value=m.value,g&&g.formula&&(this.editCellData.formula=g.formula),g&&g.wrap&&this.parent.notify(At,{range:f,wrap:!0,sheet:u}),e&&this.parent.refreshNode(this.editCellData.element,m)}return this.parent.allowConditionalFormat&&this.parent.notify("checkConditionalFormat",{rowIdx:a[0],colIdx:a[1],cell:s}),n},e.prototype.refreshDependentCellValue=function(e,t,r){if(e&&t&&(e--,t--,(this.editCellData.rowIndex!==e||this.editCellData.colIndex!==t)&&this.parent.activeSheetIndex===r)){var n=this.parent.getCell(e,t);if(n){var i=$(e,t,ce(this.parent,r)),a=this.getRefreshNodeArgs(i);this.parent.refreshNode(n,a)}}},e.prototype.getRefreshNodeArgs=function(e){var t=(e=e||{})&&e.format?e.format:"",r={value:e.value,format:t,onLoad:!0,formattedText:"",isRightAlign:!1,type:"General"};return this.parent.notify("getFormattedCell",r),r.formattedText=this.parent.allowNumberFormatting?r.formattedText:r.value,{isRightAlign:r.isRightAlign,result:r.formattedText,type:r.type,value:r.value,curSymbol:r.curSymbol}},e.prototype.endEdit=function(e,t){void 0===e&&(e=!1);var r=u(this.parent.getActiveSheet().activeCell),n=this.parent.getCell(r[0],r[1]),i="";if(this.editCellData.element&&this.editCellData.element.children[0]&&"e-cf-databar"===this.editCellData.element.children[0].className&&(i=n.children[0].querySelector(".e-databar-value").style.fontSize),e&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1),this.triggerEvent("beforeCellSave"))return void t.preventDefault();this.updateEditedValue()?(this.triggerEvent("cellSave",t),this.resetEditState(),this.focusElement()):t&&t.preventDefault(),""!==i&&(n.children[0].querySelector(".e-databar-value").style.fontSize=i),this.parent.showSheetTabs&&!this.parent.isProtected&&this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled")},e.prototype.cancelEdit=function(e,t,r){void 0===e&&(e=!0),void 0===t&&(t=!0),this.refreshEditor(this.editCellData.oldValue,e,!1,!1,!1),t&&this.triggerEvent("cellSave",r),this.resetEditState(),this.focusElement()},e.prototype.focusElement=function(){Ct(this.parent.element),this.parent.notify("enableToolbarItems",[{enable:!0}])},e.prototype.triggerEvent=function(e,t){var r=$(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet()),n={element:this.editCellData.element,value:this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr,displayText:this.parent.getDisplayText(r)};return n.value!==n.oldValue&&("cellSave"===e&&(this.editCellData.formula&&(n.formula=this.editCellData.formula),n.originalEvent=t,this.parent.notify(nr,{eventArgs:n,action:"cellSave"})),"cellSave"!==e&&(n.cancel=!1)),this.parent.trigger(e,n),n.cancel},e.prototype.altEnter=function(){this.positionEditor(!0);var e,t=window.getSelection(),r=t.anchorNode,n=document.createRange();0===(e=3===r.nodeType?t.anchorOffset:r.textContent.length)&&r.textContent.length>0&&(e=r.textContent.length);var i=r.textContent,a=i.slice(0,e),o=i.slice(e)||" ";r.textContent=a+"\n"+o,n=document.createRange(),3===r.nodeType?(n.setStart(r,e+1),n.setEnd(r,e+1)):1===r.nodeType&&(n.setStart(r.firstChild,e+1),n.setEnd(r.firstChild,e+1)),t.removeAllRanges(),t.addRange(n)},e.prototype.resetEditState=function(e){if(void 0===e&&(e=!0),e){var r=this.getEditElement(this.parent.getActiveSheet());q(r.textContent)&&this.parent.notify("clearCellRef",null),this.editCellData.element&&(this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",r===this.editorElem?(this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")):t.detach(r))}this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify("formulaOperation",{action:"endEdit"})},e.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&q(e.textContent)&&this.parent.notify("initiateFormulaReference",{range:e.textContent,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.initiateRefSelection=function(){var e=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),t=this.parent.element.querySelector(".e-formula-bar").value;this.parent.getActiveSheet().name===e&&q(this.editCellData.value)?(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify("initiateFormulaReference",{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).innerHTML=t,this.initiateCurPosition()):this.initiateCurPosition()},e.prototype.addressHandler=function(e){var t=window.getSelection();if(this.selectionStart=t.anchorOffset,this.selectionEnd=t.focusOffset,this.selectionStart>this.selectionEnd){var r=this.selectionStart;this.selectionStart=this.selectionEnd,this.selectionEnd=r}if(t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")){var n=t.focusNode.getElementsByClassName("e-formula-bar e-css")[0];this.selectionStart=n.selectionStart,this.selectionEnd=n.selectionEnd}var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,i);var a=e.range,o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),s=this.editCellData.sheetIndex,l=this.getEditElement(this.parent.getActiveSheet());if(this.parent.getActiveSheet().name!==o&&(a="'"+this.parent.getActiveSheet().name+"'!"+a),e.isSelect)this.parent.notify("initiateFormulaReference",{range:i.editedValue+a,formulaSheetIdx:s});else{var h=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));if(this.parent.getActiveSheet().name===h){var d=i.editedValue;this.selectionStart!==this.selectionEnd?(this.formulaBarCurStartPos=this.selectionStart,this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+a.length,l.textContent=d.substring(0,this.selectionStart)+a+d.substring(this.selectionStart)):d.indexOf(")")===d.length-1&&this.selectionEnd===d.length?(l.textContent=d.substring(0,d.length-1)+a+d.substring(d.length-1),this.curEndPos=l.textContent.length-1):d.indexOf(")")!==d.length-1?(l.textContent=d+a,this.curEndPos=l.textContent.length):l.textContent!==d?(l.textContent=d.substring(0,this.curStartPos)+a+d.substring(this.curStartPos),this.curEndPos=this.curStartPos+a.length):this.selectionStart!==this.selectionEnd||-1===this.validCharacters.indexOf(d.substring(this.selectionStart-1,this.selectionEnd))||-1===this.validCharacters.indexOf(d.substring(this.selectionStart,this.selectionEnd+1))&&")"!==d.substring(this.selectionStart,this.selectionEnd+1)||(l.textContent=d.substring(0,this.selectionStart)+a+d.substring(this.selectionEnd),this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+a.length,this.formulaBarCurStartPos=this.curStartPos)}}},e.prototype.updateFormulaBarValue=function(){var e=window.getSelection(),r=this.editCellData.value,n=this.parent.getActiveSheet().selectedRange;n=I(y(n))?n.split(":")[0]:n;var i=this.parent.element.querySelector(".e-formula-bar");if(r&&q(r)){var a=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name!==a&&(n="'"+this.parent.getActiveSheet().name+"'!"+n),t.isNullOrUndefined(this.formulaBarCurStartPos)?r.indexOf(")")===r.length-1&&e.focusOffset===r.length?i.value=r.substring(0,r.length-1)+n+r.substring(r.length-1):r.indexOf(")")!==r.length-1?i.value=r+n:i.value!==r&&(i.value=r.substring(0,this.curStartPos)+n+r.substring(this.curStartPos)):i.value=r.substring(0,this.formulaBarCurStartPos)+n+r.substring(this.formulaBarCurStartPos),this.curEndPos=this.curStartPos+n.length}},e.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},e.prototype.initiateCurPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet(),!0),t=e.innerText,r=window.getSelection();if(r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")){var n=this.parent.element.querySelector(".e-formula-bar");return void this.setFormulaBarCurPosition(n,this.curEndPos,this.curEndPos)}if(t){var i=document.createRange();t.indexOf(")"),t.length,i.setStart(e.childNodes[0],this.curEndPos),i.setEnd(e.childNodes[0],this.curEndPos),r.removeAllRanges(),r.addRange(i)}if(this.editCellData.sheetIndex!==this.parent.getActiveSheet().id-1){var a=this.parent.element.querySelector(".e-formula-bar");if(a.value){var o=a.value.length;a.value.indexOf(")")===o-1?this.setFormulaBarCurPosition(a,o-1,o-1):this.setFormulaBarCurPosition(a,o,o)}}},e.prototype.getEditElement=function(e,t){if((this.isEdit||t)&&(e.frozenRows||e.frozenColumns)){var r=this.parent.frozenRowCount(e),n=this.parent.frozenColCount(e),i=u(e.activeCell),a=void 0;if(i[0]<r&&i[1]<n)a=this.parent.getSelectAllContent();else if(i[0]<r)a=this.parent.getColumnHeaderContent();else{if(!(i[1]<n))return this.editorElem;a=this.parent.getRowHeaderContent()}var o=a.getElementsByClassName("e-spreadsheet-edit")[0];return!o&&t&&(o=a.appendChild(this.editorElem.cloneNode())),o}return this.editorElem},e}(),Bn=function(){function e(e){this.uniqueOBracket=String.fromCharCode(129),this.uniqueCBracket=String.fromCharCode(130),this.uniqueCSeparator=String.fromCharCode(131),this.uniqueCOperator=String.fromCharCode(132),this.uniquePOperator=String.fromCharCode(133),this.uniqueSOperator=String.fromCharCode(134),this.uniqueMOperator=String.fromCharCode(135),this.uniqueDOperator=String.fromCharCode(136),this.uniqueModOperator=String.fromCharCode(137),this.uniqueConcateOperator=String.fromCharCode(138),this.uniqueEqualOperator=String.fromCharCode(139),this.uniqueExpOperator=String.fromCharCode(140),this.uniqueGTOperator=String.fromCharCode(141),this.uniqueLTOperator=String.fromCharCode(142),this.invalidOperators=["%"],this.formulaRange=[],this.tableRangesFormula={},this.parent=e,this.addEventListener(),this.mouseMoveEvt=this.mouseMoveHandler.bind(this)}return e.prototype.addEventListener=function(){this.parent.on("contentLoaded",this.init,this),this.parent.on("mouseDown",this.mouseDownHandler,this),this.parent.on("virtualContentLoaded",this.virtualContentLoadedHandler,this),this.parent.on("cellNavigate",this.cellNavigateHandler,this),this.parent.on("selectRange",this.selectRange,this),this.parent.on(Qt,this.rowHeightChanged,this),this.parent.on("colWidthChanged",this.colWidthChanged,this),this.parent.on("protectSelection",this.protectHandler,this),this.parent.on("initiateFormulaReference",this.initiateFormulaSelection,this),this.parent.on("clearCellRef",this.clearBorder,this),this.parent.on("getRowIdxFromClientY",this.getRowIdxFromClientY,this),this.parent.on("getColIdxFromClientX",this.getColIdxFromClientX,this),this.parent.on("focusBorder",this.chartBorderHandler,this),this.parent.on("selectionStatus",this.isTouchSelectionStarted,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("contentLoaded",this.init),this.parent.off("mouseDown",this.mouseDownHandler),this.parent.off("virtualContentLoaded",this.virtualContentLoadedHandler),this.parent.off("cellNavigate",this.cellNavigateHandler),this.parent.off("selectRange",this.selectRange),this.parent.off(Qt,this.rowHeightChanged),this.parent.off("colWidthChanged",this.colWidthChanged),this.parent.off("protectSelection",this.protectHandler),this.parent.off("initiateFormulaReference",this.initiateFormulaSelection),this.parent.off("clearCellRef",this.clearBorder),this.parent.off("getRowIdxFromClientY",this.getRowIdxFromClientY),this.parent.off("getColIdxFromClientX",this.getColIdxFromClientX),this.parent.off("focusBorder",this.chartBorderHandler),this.parent.off("selectionStatus",this.isTouchSelectionStarted))},e.prototype.isTouchSelectionStarted=function(e){e.touchSelectionStarted=this.touchSelectionStarted},e.prototype.rowHeightChanged=function(e){var t=this;Le(function(){var r=t.getActiveCell(),n=t.parent.getActiveSheet();if(r){var i=u(n.activeCell);if(n.frozenRows||n.frozenColumns){var a={range:[i[0],i[1],i[0],i[1]]};t.parent.notify("activeCellMergedRange",a),_e(t.parent,r,a.range,"e-active-cell")}else i[0]===e.rowIdx?r.style.height=parseFloat(r.style.height)+e.threshold+"px":i[0]>e.rowIdx&&(r.style.top=parseFloat(r.style.top)+e.threshold+"px")}if(r=t.getSelectionElement()){var o=c(n.selectedRange),s=x(o),l={range:s,isActiveCell:!1,skipChecking:!0};if(t.parent.notify("mergedRange",l),l.isActiveCell||s[0]===s[2]&&s[1]===s[3])return;if(n.frozenRows||n.frozenColumns)return void _e(t.parent,r,o);var h=s[0],d=s[2];h<=e.rowIdx&&d>=e.rowIdx&&r?r.style.height=parseFloat(r.style.height)+e.threshold+"px":h>e.rowIdx&&r&&(r.style.top=parseFloat(r.style.top)+e.threshold+"px")}})},e.prototype.colWidthChanged=function(e){var t=this;Le(function(){var r=t.parent.getActiveSheet(),n=t.getActiveCell();if(n){var i=u(t.parent.getActiveSheet().activeCell);if(r.frozenRows||r.frozenColumns){var a={range:[i[0],i[1],i[0],i[1]]};t.parent.notify("activeCellMergedRange",a),_e(t.parent,n,a.range,"e-active-cell")}else i[1]===e.colIdx?n.style.width=parseFloat(n.style.width)+e.threshold+"px":i[1]>e.colIdx&&(n.style.left=parseFloat(n.style.left)+e.threshold+"px")}n=t.getSelectionElement();var o=c(t.parent.getActiveSheet().selectedRange),s=x(o),l={range:s,isActiveCell:!1,skipChecking:!0};if(t.parent.notify("mergedRange",l),!(l.isActiveCell||s[0]===s[2]&&s[1]===s[3])){if(r.frozenRows||r.frozenColumns)return void _e(t.parent,n,o);var h=s[1],d=s[3];h<=e.colIdx&&d>=e.colIdx&&n?n.style.width=parseFloat(n.style.width)+e.threshold+"px":h>e.colIdx&&n&&(n.style.left=parseFloat(n.style.left)+e.threshold+"px")}})},e.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?m(u(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},e.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),t=x(c(e.selectedRange)),r=u(e.activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectMultiRange(e.selectedRange,!0,n)},e.prototype.selectMultiRange=function(e,t,r,n){var i=this,a=this.parent.activeSheetIndex;e.indexOf("!")>-1&&(a=ae(this.parent,se(e)),e=e.split("!")[1]),this.parent.activeSheetIndex===a?e.split(" ").forEach(function(e,a){i.selectRangeByIdx(c(e),{type:"mousedown",ctrlKey:0!==a},null,r,t,n)}):he(this.parent,e,this.parent.sheets[a])},e.prototype.createSelectionElement=function(){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-selection"});e.appendChild(t),t=this.parent.createElement("div",{className:"e-active-cell"}),e.appendChild(t)},e.prototype.mouseDownHandler=function(e){if(!(t.closest(e.target,".e-scrollbar")||e.target.classList.contains("e-main-panel")||e.target.classList.contains("e-sheet"))){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,r);var n=r.editedValue&&0===r.editedValue.toString().indexOf("=")||q(r.editedValue);if(!this.parent.isEdit||n){var i=document.getElementById(this.parent.element.id+"_overlay");if("string"==typeof e.target.className){if(e.target.className.indexOf("e-ss-overlay")>-1)return}else i&&i.classList.remove("e-ss-overlay-active");if(t.closest(e.target,".e-datavisualization-chart"))return;if(this.parent.getActiveSheet().isProtected&&!this.parent.getActiveSheet().protectSettings.selectCells)return;if(!t.closest(e.target,".e-findtool-dlg")&&this.getSheetElement().contains(e.target)&&!e.target.classList.contains("e-colresize")&&!e.target.classList.contains("e-rowresize")){var a=this.parent.getActiveSheet(),o=this.parent.selectionSettings.mode,s=this.getRowIdxFromClientY({clientY:Qe(e),target:e.target}),l=this.getColIdxFromClientX({clientX:Je(e),target:e.target}),h=u(a.activeCell),d=void 0,p=void 0;if(a.showHeaders){var f=e.target;if(a.frozenColumns||a.frozenRows){var g=this.parent.getSelectAllContent().querySelector("thead");p=g?(this.parent.getColumnHeaderContent().contains(f)||g.contains(f))&&f.classList.contains("e-header-cell"):this.parent.getColumnHeaderContent().contains(f)&&f.classList.contains("e-header-cell"),d=(g=this.parent.getSelectAllContent().querySelector("tbody"))?(this.parent.getRowHeaderContent().contains(f)||g.contains(f))&&f.classList.contains("e-header-cell"):this.parent.getRowHeaderContent().contains(f)&&f.classList.contains("e-header-cell")}else d=this.parent.getRowHeaderContent().contains(e.target),p=this.parent.getColumnHeaderContent().contains(e.target)}if(3===e.which&&this.isSelected(s,l))return;if("Multiple"===o&&(!Xe(e)&&(!Ge(e)||Ge(e)&&h[0]===s&&h[1]===l)||p||d)?(document.addEventListener(je().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.addEventListener(je().split(" ")[1],this.mouseMoveEvt,{passive:!1}),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,Xe(e)||t.EventHandler.add(document,We(),this.mouseUpHandler,this),Ge(e)&&!p&&!d)return void(this.touchEvt=e);var m=c(a.topLeftCell);d?(this.isRowSelected=!0,e.shiftKey&&"Single"!==o||(this.startCell=[s,0]),this.selectRangeByIdx([this.startCell[0],a.frozenColumns?m[1]:0,s,a.colCount-1],e)):p?(this.isColSelected=!0,e.shiftKey&&"Single"!==o||(this.startCell=[0,l]),this.selectRangeByIdx([a.frozenRows?m[0]:0,this.startCell[1],a.rowCount-1,l],e)):t.closest(e.target,".e-select-all-cell")?(this.startCell=[a.frozenRows?m[0]:0,a.frozenColumns?m[1]:0],this.selectRangeByIdx([].concat(this.startCell,[a.rowCount-1,a.colCount-1]),e)):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==o||(this.startCell=[s,l]),this.selectRangeByIdx([].concat(this.startCell?this.startCell:u(a.activeCell),[s,l]),e)),this.parent.isMobileView()&&(this.parent.element.classList.add("e-mobile-focused"),this.parent.renderModule.setSheetPanelSize())}}if(n&&(e.target.classList.contains("e-cell")||e.target.classList.contains("e-header-cell"))&&this.parent.isEdit){var v=this.parent.getActiveSheet().selectedRange;v=I(y(v))?v.split(":")[0]:v,this.parent.notify("addressHandle",{range:v,isSelect:!1})}}},e.prototype.mouseMoveHandler=function(e){var t=this,r=this.parent.getActiveSheet();Ye(e)&&e.preventDefault();var n={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,n);var i=q(n.editedValue)||n.editedValue&&0===n.editedValue.toString().indexOf("="),a=this.parent.getMainContent().parentElement,o=this.parent.element.getElementsByClassName("e-scroller")[0],s=a.getBoundingClientRect(),l=this.parent.frozenColCount(r),h=s.left+this.parent.sheetModule.getRowHeaderWidth(r),d=s.top,p=s.right,f=s.bottom,g=Je(e),m=Qe(e),v=this.isRowSelected?r.colCount-1:this.getColIdxFromClientX({clientX:Math.min(g,p),target:e.target}),y=this.isColSelected?r.rowCount-1:this.getRowIdxFromClientY({clientY:Math.min(m,f),target:e.target}),C=c(r.selectedRange),b={range:[y,v,y,v]};if(this.parent.notify("activeCellMergedRange",b),b.range[2]!==C[2]||b.range[3]!==C[3]){var S=this.parent.frozenRowCount(r),x=m>f&&y<r.rowCount,w=m<d&&y>=0&&!this.isColSelected&&!!a.scrollTop,I=g>p&&v<r.colCount,E=g<h&&v>=0&&!this.isRowSelected&&!!o.scrollLeft;this.clearInterval();var R,k;if(i||this.isColSelected||this.isRowSelected||(C=u(r.activeCell)),x||w||I||E)(w||E)&&(R=y,k=v),this.scrollInterval=setInterval(function(){if((x||w)&&!t.isColSelected){if((y=t.getRowIdxFromClientY({clientY:x?f:d}))>=r.rowCount)return void t.clearInterval();a.scrollTop+=(x?1:-1)*Se(r,y)}if((I||E)&&!t.isRowSelected){if((v=t.getColIdxFromClientX({clientX:I?p:h}))>=r.colCount)return void t.clearInterval();o.scrollLeft+=(I?1:-1)*Re(r,v)}if(w&&!a.scrollTop||E&&!o.scrollLeft)return t.selectRangeByIdx([].concat(C[0],C[1],[R,k]),e),void t.clearInterval();t.selectRangeByIdx([].concat(C[0],C[1],[y,v]),e)},100);else{var A=[].concat(C[0],C[1],[y,v]);S&&A[0]<S&&A[2]>=S&&a.scrollTop&&(a.scrollTop=0,A[2]=S),l&&A[1]<l&&A[3]>=l&&o.scrollLeft&&(o.scrollLeft=0,A[3]=l),this.selectRangeByIdx(A,e)}if(i&&this.parent.isEdit){var T=this.parent.getActiveSheet().selectedRange;this.parent.notify("addressHandle",{range:T,isSelect:!1})}}},e.prototype.mouseUpHandler=function(e){var r=this.getRowIdxFromClientY({clientY:Qe(e),target:e.target}),n=this.getColIdxFromClientX({clientX:Je(e),target:e.target});this.clearInterval(),!Xe(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:Qe(this.touchEvt),target:e.target})!==r||this.getColIdxFromClientX({clientX:Je(this.touchEvt),target:e.target})!==n||this.mouseDownHandler(e),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),document.removeEventListener(je().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.removeEventListener(je().split(" ")[1],this.mouseMoveEvt),t.EventHandler.remove(document,We(),this.mouseUpHandler),this.parent.notify("mouseUpAfterSelection",e);var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,i),(q(i.editedValue)||i.editedValue&&0===i.editedValue.toString().indexOf("="))&&this.parent.isEdit&&!e.target.classList.contains("e-spreadsheet-edit")&&this.parent.notify("initiateCur",{})},e.prototype.isSelected=function(e,t){var r=x(c(this.parent.getActiveSheet().selectedRange));return r[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]},e.prototype.virtualContentLoadedHandler=function(e){var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.selectedRange);i.selectedRange.split(" ").forEach(function(o,s){a=c(o),r=0===a[1]&&a[3]===e.prevRowColCnt.colCount-1,(t=0===a[0]&&a[2]===e.prevRowColCnt.rowCount-1)&&r?n.selectRangeByIdx([0,0,i.rowCount-1,i.colCount-1],null,!0,null,null,null,s):t?n.selectRangeByIdx([0,a[1],i.rowCount-1,a[3]],null,!0,null,null,null,s):r?n.selectRangeByIdx([a[0],0,a[2],i.colCount-1],null,!0,null,null,null,s):(a=c(o),n.highlightHdr(a,0!==s,a[0]>=n.parent.viewport.topIndex||a[2]>=n.parent.viewport.topIndex,a[1]>=n.parent.viewport.leftIndex||a[3]>=n.parent.viewport.leftIndex))})},e.prototype.clearInterval=function(){clearInterval(this.scrollInterval),this.scrollInterval=null},e.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},e.prototype.cellNavigateHandler=function(e){var t=this.parent.getActiveSheet();t.isProtected&&!t.protectSettings.selectCells||this.selectRangeByIdx(e.range.concat(e.range))},e.prototype.getColIdxFromClientX=function(e){var r=0,n=this.parent.getActiveSheet(),i=0;if(e.isImage)i=e.clientX;else{var a=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect();i=this.parent.enableRtl?a.right-this.parent.sheetModule.getRowHeaderWidth(n,!0)-1-e.clientX:e.clientX-(a.left+this.parent.sheetModule.getRowHeaderWidth(n,!0)+1),i+=this.parent.viewport.beforeFreezeWidth,e.target&&(!e.target||t.closest(e.target,".e-row-header")||t.closest(e.target,".e-selectall-container"))||(i+=this.getScrollLeft())}for(var o=0;;o++)if(r+=Re(n,o,null,!0),i<r||this.parent.scrollSettings.isFinite&&o===n.colCount-1)return e.isImage||(e.size=i),e.clientX=o,o},e.prototype.getRowIdxFromClientY=function(e){var r=0,n=this.parent.getActiveSheet(),i=0;if(e.isImage)i=e.clientY;else{var a=document.getElementById(this.parent.element.id+"_sheet");i=e.clientY+this.parent.viewport.beforeFreezeHeight-(a.getBoundingClientRect().top+(n.showHeaders?31:0)),(!e.target||e.target&&!t.closest(e.target,".e-header-panel"))&&(i+=this.parent.getMainContent().parentElement.scrollTop)}for(var o=0;;o++)if(r+=Se(n,o,!0),i<r||this.parent.scrollSettings.isFinite&&o===n.rowCount-1)return e.isImage||(e.size=i),e.clientY=o,o},e.prototype.initFormulaReferenceIndicator=function(e){if(this.parent.isEdit){var t=this.parent.createElement("div",{className:"e-formularef-indicator"});t.appendChild(this.parent.createElement("div",{className:"e-top"})),t.appendChild(this.parent.createElement("div",{className:"e-bottom"})),t.appendChild(this.parent.createElement("div",{className:"e-left"})),t.appendChild(this.parent.createElement("div",{className:"e-right"})),this.parent.getMainContent().appendChild(t),_e(this.parent,t,e,"e-formularef-indicator")}},e.prototype.selectRangeByIdx=function(e,r,n,i,a,o,s){var l={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,l);var h,d=q(l.editedValue)||l.editedValue&&0===l.editedValue.toString().indexOf("="),p=r&&r.ctrlKey&&Ke(r),u=this.getSelectionElement(r,s),f=this.parent.getActiveSheet(),g=this.parent.element.querySelector(".e-formularef-indicator"),v={range:[].slice.call(e),isActiveCell:!1,skipChecking:o},y=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");this.isColSelected||this.isRowSelected||this.parent.notify("mergedRange",v),e!==v.range&&(h=!0);var C={range:m(e=v.range),cancel:!1};if(this.parent.trigger("beforeSelect",C),!C.cancel){if(d&&g&&g.parentElement.removeChild(g),!I(e)&&!v.isActiveCell||p)if(d&&this.parent.isEdit)r&&r.target&&!r.target.classList.contains("e-spreadsheet-edit")&&this.parent.isEdit&&(this.parent.notify("addressHandle",{range:m(e),isSelect:!0}),this.initFormulaReferenceIndicator(e));else{u&&u.classList.remove("e-hide");var b=this.isColSelected&&this.isRowSelected?void 0:this.getOffset(e[2],e[3]);h&&b&&(b.left={idx:0,size:0}),_e(this.parent,u,e)}else u&&(u.classList.contains("e-multi-range")||u.classList.add("e-hide"),(f.frozenRows||f.frozenColumns)&&(Ue(this.parent.getSelectAllContent(),null,!1),Ue(this.parent.getColumnHeaderContent(),null,!1),Ue(this.parent.getRowHeaderContent(),null,!1))),f.frozenColumns||f.frozenRows||!u||_e(this.parent,u,e),d&&r&&r.target&&!r.target.classList.contains("e-spreadsheet-edit")&&this.parent.isEdit&&(this.parent.notify("addressHandle",{range:m(e).split(":")[0],isSelect:!0}),this.initFormulaReferenceIndicator(e));var S={action:"getCurrentEditSheetIdx",sheetIndex:null};this.parent.notify(Wt,S);var x=m(e);if(r&&r.ctrlKey&&($e(r)||Ze(r)))x=f.selectedRange.slice(0,f.selectedRange.lastIndexOf(" "))+" "+x;else if(s>-1){var w=f.selectedRange.split(" ");w[s]=x,x=w.join(" ")}d?a||he(this.parent,x,f,p):he(this.parent,x,f,p),this.UpdateRowColSelected(e),this.highlightHdr(e,r&&r.ctrlKey),n||r&&("mousemove"===r.type||Ye(r))||(d?S.sheetIndex===this.parent.getActiveSheet().id-1&&a?(i=!0,this.updateActiveCell(i?c(f.activeCell):e,a)):this.parent.isEdit||this.updateActiveCell(i?c(f.activeCell):e,a):this.updateActiveCell(i?c(f.activeCell):e,a)),t.isNullOrUndefined(r)&&(r={type:"mousedown"}),d?a||this.parent.notify("selectionComplete",r):this.parent.notify("selectionComplete",r),this.parent.notify("showAggregate",{}),this.parent.notify("refreshImgElem",{}),y&&this.parent.notify("removeDesignChart",{}),this.parent.notify("clearChartBorder",{})}},e.prototype.UpdateRowColSelected=function(e){var t=this.parent.getActiveSheet();this.isRowSelected=0===e[1]&&e[3]===t.colCount-1,this.isColSelected=0===e[0]&&e[2]===t.rowCount-1},e.prototype.updateActiveCell=function(e,t){var r,n,i,a=this.parent.getActiveSheet(),o=c(a.topLeftCell);this.isColSelected?(r=o[0],n=e[1],this.isRowSelected&&(n=o[1])):(r=e[0],n=e[1],this.isRowSelected&&(n=o[1]));var s={range:[r,n].concat([r,n])};if(this.parent.notify("activeCellMergedRange",s),e!==s.range&&(i=!0),e=s.range,a.activeCell!==g(e[0],e[1])||t){if(this.parent.setSheetPropertyOnMute(a,"activeCell",g(e[0],e[1])),this.getActiveCell()){var l=this.getOffset(e[2],e[3]);i&&(l.left={idx:0,size:0}),_e(this.parent,this.getActiveCell(),e,"e-active-cell")}this.parent.notify("activeCellChanged",null)}else _e(this.parent,this.getActiveCell(),e,"e-active-cell")},e.prototype.getOffset=function(e,t){var r={left:{idx:0,size:0},top:{idx:0,size:0}};return this.parent.scrollModule&&(t>=this.parent.scrollModule.offset.left.idx&&(r.left=this.parent.scrollModule.offset.left),e>=this.parent.scrollModule.offset.top.idx&&(r.top=this.parent.scrollModule.offset.top)),r},e.prototype.getSelectionElement=function(e,r){if(e&&e.ctrlKey){if(Ze(e)||$e(e))return this.parent.getMainContent().querySelector(".e-selection:last-child");var n=this.parent.element.getElementsByClassName("e-selection")[0];n.classList.remove("e-hide");var i=n.cloneNode();return i.classList.add("e-multi-range"),this.parent.getMainContent().appendChild(i)}return r>-1?this.parent.getMainContent().getElementsByClassName("e-selection")[r]:([].slice.call(this.parent.element.getElementsByClassName("e-multi-range")).forEach(function(e){t.remove(e)}),this.parent.getMainContent().getElementsByClassName("e-selection")[0])},e.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},e.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},e.prototype.highlightHdr=function(e,r,n,i){if(void 0===n&&(n=!0),void 0===i&&(i=!0),this.parent.getActiveSheet().showHeaders){var a=this.parent.getActiveSheet(),o=[],s=[],l=x(e);l=this.getHdrIndexes(l);var h=this.parent.element.getElementsByClassName("e-select-all-cell")[0];if(r||(t.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),t.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight")),h&&t.removeClass([h],["e-prev-highlight-right","e-prev-highlight-bottom"]),n){var d,p=this.parent.frozenRowCount(a),c=void 0;(C=this.parent.getSelectAllContent().querySelector("tbody"))&&(d=[].slice.call(C.querySelectorAll(".e-header-cell")));for(var f=[].slice.call(this.parent.getRowHeaderContent().querySelectorAll(".e-header-cell")),g=u(a.topLeftCell)[0],m=l[0];m<l[2]+1;m++)(c=m<p?d[m-g]:f[m-p])&&o.push(c)}if(i){var v,y=this.parent.frozenColCount(a),c=void 0,C=this.parent.getSelectAllContent().querySelector("thead");C&&(v=[].slice.call(C.querySelectorAll(".e-header-cell")));for(var f=[].slice.call(this.parent.getColumnHeaderContent().querySelectorAll("th")),b=u(a.topLeftCell)[1],m=l[1];m<l[3]+1;m++)(c=m<y?v[m-b]:f[m-y])&&s.push(c)}a.isProtected&&!a.protectSettings.selectCells?t.removeClass([].concat(o,s),"e-highlight"):t.addClass([].concat(o,s),"e-highlight"),o.length&&o[0].parentElement.previousElementSibling&&o[0].parentElement.previousElementSibling.classList.add("e-prev-highlight"),s.length&&s[0].previousElementSibling&&s[0].previousElementSibling.classList.add("e-prev-highlight"),this.isRowSelected&&this.isColSelected&&(a.isProtected&&!a.protectSettings.selectCells?document.getElementById(this.parent.element.id+"_select_all").classList.remove("e-highlight"):document.getElementById(this.parent.element.id+"_select_all").classList.add("e-highlight")),h&&(0===l[0]&&h.classList.add("e-prev-highlight-bottom"),0===l[1]&&h.classList.add("e-prev-highlight-right"))}},e.prototype.protectHandler=function(){var e=c(this.parent.getActiveSheet().selectedRange),t=x(e),r=u(this.parent.getActiveSheet().activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectRangeByIdx(e,null,null,n)},e.prototype.getHdrIndexes=function(e){if(this.parent.scrollSettings.enableVirtualization){var t=[],r=this.parent.hiddenCount(this.parent.viewport.topIndex,e[0]),n=this.parent.hiddenCount(this.parent.viewport.leftIndex,e[1],"columns");return t[0]=this.isColSelected?e[0]:e[0]-this.parent.viewport.topIndex<0?0:e[0]-r-this.parent.viewport.topIndex,t[1]=this.isRowSelected?e[1]:e[1]-this.parent.viewport.leftIndex<0?0:e[1]-n-this.parent.viewport.leftIndex,t[2]=this.isColSelected?this.parent.viewport.rowCount+2*this.parent.getThreshold("row"):e[2]-this.parent.hiddenCount(e[0],e[2])-r-this.parent.viewport.topIndex,t[3]=this.isRowSelected?this.parent.viewport.colCount+2*this.parent.getThreshold("col"):e[3]-this.parent.hiddenCount(e[1],e[3],"columns")-n-this.parent.viewport.leftIndex,t}return e},e.prototype.initiateFormulaSelection=function(e){this.processFormulaEditRange(e.range,e.formulaSheetIdx)},e.prototype.processFormulaEditRange=function(e,t){var r,n=t,i=0,a=this.parseFormula(e),o=a.length,s=0,l=[["e-vborderright","e-vborderbottom"],["e-pborderright","e-pborderbottom"],["e-cborderright","e-cborderbottom"],["e-gborderright","e-gborderbottom"],["e-oborderright","e-oborderbottom"],["e-bborderright","e-bborderbottom"]];this.clearBorder();for(var h=this.parent.getActiveSheet().id-1;i<o&&(r=a[i],!(this.invalidOperators.indexOf(r)>-1));){if(j(r.toUpperCase())){if(r=r.replace(/\$/g,""),i>0&&a[i-1].indexOf("!")===a[i-1].length-1){var d=a[i-1].split("!");n=ae(this.parent,d[0].substring(1,d[0].length-1))}":"===a[i+1]&&a[++i+1]&&j(a[i+1].toUpperCase())&&(r=r+":"+a[i+1],i++),h===n&&this.updateFormulaEditRange(r,s,l),n=t,s++}i++}},e.prototype.updateFormulaEditRange=function(e,t,r){var n=c(e);this.formulaRange[t]=e,this.dStartCell={rowIndex:n[0],colIndex:n[1]},this.dEndCell={rowIndex:n[2],colIndex:n[3]},this.focusBorder(this.dStartCell,this.dEndCell,r[t%6])},e.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},e.prototype.focusBorder=function(e,r,n,i){i=!t.isNullOrUndefined(i)&&i;var a=x([e.rowIndex,e.colIndex,r.rowIndex,r.colIndex]),o=this.parent.getActiveSheet();if(o.frozenRows||o.frozenColumns){var s=this.parent.createElement("div",{className:i?"e-range-indicator e-chart-range":"e-range-indicator e-formuala-range"});return s.appendChild(this.parent.createElement("div",{className:"e-top"})),s.appendChild(this.parent.createElement("div",{className:"e-bottom"})),s.appendChild(this.parent.createElement("div",{className:"e-left"})),s.appendChild(this.parent.createElement("div",{className:"e-right"})),void _e(this.parent,s,a,"e-range-indicator")}var l=a[0],h=a[1],d=a[2],p=a[3];l&&this.getEleFromRange([l-1,h,l-1,p]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([l,p,d,p]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([d,h,d,p]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),h&&this.getEleFromRange([l,h-1,d,h-1]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))})},e.prototype.getEleFromRange=function(e){var t,r,n,i,a=e[0],o=e[1],s=e[2],l=e[3],h=[],d=[];if(a>s&&(n=a,a=s,s=n),o>l&&(n=o,o=l,l=n),this.parent.scrollSettings.enableVirtualization)for(t=a;t<=s;t++)if((r=t)>-1){var p=this.parent.getRow(r,null);p&&(i=p.getElementsByClassName("e-cell"),h=l===o?[i[l]]:this.getRowCells(i,o,l+1),this.merge(d,h))}return d},e.prototype.getRowCells=function(e,t,r){var n=[];for(t;t<r;t++)e[t]&&n.push(e[t]);return n},e.prototype.merge=function(e,t){e&&t&&Array.prototype.push.apply(e,t)},e.prototype.clearBorder=function(){var e=this.parent.getActiveSheet();if(e.frozenColumns||e.frozenRows)return void[].slice.call(this.parent.element.getElementsByClassName("e-formuala-range")).forEach(function(e){t.detach(e)});for(var r=this.parent.element.getElementsByClassName("e-formularef-selection"),n=0;n<r.length;n++)for(var i=r[n],a=["e-vborderright","e-vborderbottom","e-pborderright","e-pborderbottom","e-cborderright","e-cborderbottom","e-gborderright","e-gborderbottom","e-oborderright","e-oborderbottom","e-bborderright","e-bborderbottom"],o=0;o<a.length;o++)i.classList.remove(a[o])},e.prototype.parseFormula=function(e){for(var t,r,n=0,i=[],a=(e=this.markSpecialChar(e.replace("=",""))).split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g),o=a.length;n<o;)if(t=a[n]){if(1===t.length)i.push(this.isUniqueChar(t)?this.getUniqueCharVal(t):t);else if(r=t[0],t.indexOf("!")>0){this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1));var s=t.indexOf("!")+1;i.push(t.substr(0,s)),i.push(t.substr(s))}else this.isUniqueChar(r)?(i.push(this.getUniqueCharVal(r)),i.push(t.substr(1))):i.push(t);n++}else n++;return i},e.prototype.isUniqueChar=function(e){var t=e.charCodeAt(e.charAt[0]);return t>=129&&t<=142},e.prototype.getUniqueCharVal=function(e){switch(e){case this.uniqueOBracket:return"(";case this.uniqueCBracket:return")";case this.uniqueCOperator:return":";case this.uniqueSOperator:return"-";case this.uniquePOperator:return"+";case this.uniqueMOperator:return"*";case this.uniqueDOperator:return"/";case this.uniqueModOperator:return"%";case this.uniqueCSeparator:return",";case this.uniqueConcateOperator:return"&";case this.uniqueEqualOperator:return"=";case this.uniqueExpOperator:return"^";case this.uniqueLTOperator:return"<";case this.uniqueGTOperator:return">"}return""},e.prototype.markSpecialChar=function(e){return e=e.replace(/\(/g,"("+this.uniqueOBracket).replace(/\)/g,")"+this.uniqueCBracket),e=e.replace(/,/g,","+this.uniqueCSeparator).replace(/:/g,":"+this.uniqueCOperator),e=e.replace(/\+/g,"+"+this.uniquePOperator).replace(/-/g,"-"+this.uniqueSOperator),e=e.replace(/\*/g,"*"+this.uniqueMOperator).replace(/\//g,"/"+this.uniqueDOperator),e=e.replace(/&/g,"&"+this.uniqueConcateOperator),e=e.replace(/=/g,"="+this.uniqueEqualOperator),e=e.replace(/\^/g,"^"+this.uniqueExpOperator),(e=e.replace(/>/g,">"+this.uniqueGTOperator).replace(/</g,"<"+this.uniqueLTOperator)).replace(/%/g,"%"+this.uniqueModOperator)},e.prototype.getModuleName=function(){return"selection"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Mn=function(){function e(e){this.clientX=0,this.parent=e,this.addEventListener(),this.initProps()}return e.prototype.onContentScroll=function(e){var r,n,i=this.parent.getMainContent().parentElement,a=e.scrollLeft,o=e.scrollTop||i.scrollTop,s=a&&this.parent.enableRtl?this.initScrollValue-a:a;if(!t.isNullOrUndefined(a)&&this.prevScroll.scrollLeft!==s){var l=s>this.prevScroll.scrollLeft;n=this.offset.left.size,this.offset.left=this.getColOffset(s,l,e.skipHidden),e.preventScroll||(this.parent.getColumnHeaderContent().scrollLeft=a,this.parent.getMainContent().scrollLeft=a,e.scrollLeft=a),r={cur:this.offset.left,prev:{idx:this.leftIndex,size:n},increase:l,preventScroll:e.preventScroll},this.updateTopLeftCell(l),this.parent.notify("horizontalScroll",r),this.parent.scrollSettings.enableVirtualization||!l||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=r.prev.idx,this.prevScroll.scrollLeft=s}if(this.prevScroll.scrollTop!==o){var h=o>this.prevScroll.scrollTop;n=this.offset.top.size,this.offset.top=this.getRowOffset(o,h),r={cur:this.offset.top,prev:{idx:this.topIndex,size:n},increase:h,preventScroll:e.preventScroll},this.updateTopLeftCell(h),this.parent.notify("verticalScroll",r),this.parent.scrollSettings.enableVirtualization||!h||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=r.prev.idx,this.prevScroll.scrollTop=o}var d={isEdit:!1};this.parent.notify("isFormulaBarEdit",d),d.isEdit&&this.parent.element.querySelector(".e-formula-bar").focus()},e.prototype.updateNonVirtualRows=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("row");this.offset.top.idx>e.rowCount-(this.parent.viewport.rowCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:e.rowCount,colIndex:0,direction:"first",refresh:"RowPart"},g(e.rowCount,0)+":"+g(e.rowCount+t-1,e.colCount-1)),this.parent.setSheetPropertyOnMute(e,"rowCount",e.rowCount+t),this.parent.viewport.bottomIndex=e.rowCount-1)},e.prototype.updateNonVirtualCols=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("col");this.offset.left.idx>e.colCount-(this.parent.viewport.colCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:0,colIndex:e.colCount,direction:"first",refresh:"ColumnPart"},g(0,e.colCount)+":"+g(e.rowCount-1,e.colCount+t-1)),this.parent.setSheetPropertyOnMute(e,"colCount",e.colCount+t),this.parent.viewport.rightIndex=e.colCount-1)},e.prototype.updateTopLeftCell=function(e){var t=this.parent.getActiveSheet(),r=this.offset.top.idx,n=this.offset.left.idx;e||(r=yt(t,r,!0),n=yt(t,n,!0,"columns")),this.parent.updateTopLeftCell(r,n)},e.prototype.getRowOffset=function(e,t){var r,n=this.offset.top.size,i=this.parent.getActiveSheet(),a=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,o=this.parent.frozenRowCount(i);if(this.parent.scrollSettings.isFinite){if(r=i.rowCount,t&&a+this.parent.viewport.rowCount+this.parent.getThreshold("row")>=r)return{idx:this.offset.top.idx,size:this.offset.top.size}}else r=1/0;for(e=Math.round(e);a<r;)if(t){if(n+=Se(i,a-1+o,!0),Math.abs(Math.round(n)-e)<=1)return{idx:a,size:n};if(Math.round(n)>e)return{idx:a-1,size:n-Se(i,a-1+o,!0)};a++}else{if(0===n)return{idx:0,size:0};if((n-=Se(i,a+o,!0))<0&&(n=0),Math.abs(Math.round(n)-e)<=1)return{idx:a,size:n};if(Math.round(n)<e)return n+=Se(i,a+o,!0),Math.round(n)>e?{idx:a,size:n-Se(i,a+o,!0)<0?0:n-Se(i,a+o,!0)}:{idx:a+1,size:n};a--}return{idx:this.offset.top.idx,size:this.offset.top.size}},e.prototype.getColOffset=function(e,t,r){var n,i=this.offset.left.size,a=this.parent.getActiveSheet(),o=t?this.offset.left.idx+1:this.offset.left.idx-1,s=this.parent.frozenColCount(a);if(this.parent.scrollSettings.isFinite){if(n=a.colCount,t&&o+this.parent.viewport.colCount+this.parent.getThreshold("col")>=n)return{idx:this.offset.left.idx,size:this.offset.left.size}}else n=1/0;for(e=Math.round(e);o<n;)if(t){if(i+=Re(a,o-1+s,r,!0),Math.round(i)===e)return{idx:o,size:i};if(Math.round(i)>e)return{idx:o-1,size:i-Re(a,o-1+s,r,!0)};o++}else{if(0===i)return{idx:0,size:0};if(i-=Re(a,o+s,r,!0),Math.round(i)===e)return{idx:o,size:i};if(Math.round(i)<e)return i+=Re(a,o+s,r,!0),Math.round(i)>e?{idx:o,size:i-Re(a,o+s,r,!0)}:{idx:o+1,size:i};o--}return{idx:this.offset.left.idx,size:this.offset.left.size}},e.prototype.contentLoaded=function(){if(this.setScrollEvent(),this.parent.enableRtl&&(this.initScrollValue=this.parent.getScrollElement().scrollLeft),!this.parent.scrollSettings.enableVirtualization){var e=this.parent.createElement("div",{className:"e-virtualtrack"});this.updateNonVirualScrollWidth({scrollTrack:e}),this.parent.getScrollElement().appendChild(e)}},e.prototype.updateNonVirualScrollWidth=function(e){e.scrollTrack||(e.scrollTrack=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0]),e.scrollTrack.style.width=Math.abs(this.parent.getContentTable().getBoundingClientRect().width)+"px"},e.prototype.onWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY},e.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},e.prototype.mouseDownHandler=function(e){if("mousedown"!==e.type){var r={touchSelectionStarted:!1};if(this.parent.notify("selectionStatus",r),!r.touchSelectionStarted){var n=document.getElementById(this.parent.element.id+"_sheet");this.clientX=e.changedTouches[0].clientX,t.EventHandler.add(n,"touchmove",this.mouseMoveHandler,this),t.EventHandler.add(n,"touchend",this.mouseUpHandler,this)}}},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-scroller")[0],r=this.clientX-e.changedTouches[0].clientX;(r>10||r<-10)&&(e.preventDefault(),t.scrollLeft+=r,this.clientX=e.changedTouches[0].clientX)},e.prototype.mouseUpHandler=function(){var e=document.getElementById(this.parent.element.id+"_sheet");t.EventHandler.remove(e,"touchmove",this.mouseMoveHandler),t.EventHandler.remove(e,"touchend",this.mouseUpHandler)},e.prototype.setScrollEvent=function(e){void 0===e&&(e={set:!0}),e.set?(t.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),t.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onWheel,this),t.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onWheel,this),t.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)):(t.EventHandler.remove(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"wheel",this.onWheel),t.EventHandler.remove(this.parent.getSelectAllContent(),"wheel",this.onWheel),t.EventHandler.remove(this.parent.getScrollElement(),"scroll",this.scrollHandler))},e.prototype.initProps=function(){this.topIndex=0,this.leftIndex=0,this.prevScroll={scrollLeft:0,scrollTop:0},this.offset={left:{idx:0,size:0},top:{idx:0,size:0}}},e.prototype.setPadding=function(){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var e=Oe();if(e>0){var t=this.parent.getColumnHeaderContent(),r=this.parent.enableRtl?{margin:"marginLeft",border:"borderLeftWidth"}:{margin:"marginRight",border:"borderRightWidth"};t.parentElement.style[r.margin]=e+"px",t.style[r.border]="1px"}},e.prototype.addEventListener=function(){this.parent.on("contentLoaded",this.contentLoaded,this),this.parent.on("onContentScroll",this.onContentScroll,this),this.parent.on("deInitProperties",this.initProps,this),this.parent.on("spreadsheetDestroyed",this.destroy,this),this.parent.on("setScrollEvent",this.setScrollEvent,this),this.parent.on("mouseDown",this.mouseDownHandler,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on("virtualContentLoaded",this.updateNonVirualScrollWidth,this),this.parent.on("colWidthChanged",this.updateNonVirualScrollWidth,this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off("contentLoaded",this.contentLoaded),this.parent.off("onContentScroll",this.onContentScroll),this.parent.off("deInitProperties",this.initProps),this.parent.off("spreadsheetDestroyed",this.destroy),this.parent.off("setScrollEvent",this.setScrollEvent),this.parent.off("mouseDown",this.mouseDownHandler),this.parent.scrollSettings.enableVirtualization||(this.parent.off("virtualContentLoaded",this.updateNonVirualScrollWidth),this.parent.off("colWidthChanged",this.updateNonVirualScrollWidth))},e}(),Pn=function(){function e(e){this.scroll=[],this.parent=e,this.addEventListener()}return e.prototype.createVirtualElement=function(e){var r=this.parent.getActiveSheet(),n=this.parent.getMainContent();this.content=this.parent.createElement("div",{className:"e-virtualable"}),this.content.appendChild(n.querySelector(".e-table")),n.appendChild(this.content);var i,a=n.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"})),o=0;this.parent.sheets.length>this.scroll.length&&this.initScroll();var s=this.parent.viewport.bottomIndex;r.rowCount>s+1||r.usedRange.rowIndex>s?(!this.parent.scrollSettings.isFinite&&r.rowCount<=r.usedRange.rowIndex&&this.parent.setSheetPropertyOnMute(r,"rowCount",r.usedRange.rowIndex+1),this.setScrollCount(r.rowCount,"row")):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"rowCount",s+1),this.scroll[this.parent.activeSheetIndex].rowCount=r.rowCount);var l=this.parent.frozenRowCount(r),h=u(r.topLeftCell);e.top&&(o=e.top,r.frozenRows&&(o+=we(r,h[0],l-1,!0)),l=u(r.paneTopLeftCell)[0]),o+=we(r,l,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),s=this.parent.viewport.rightIndex;var d=0,p=this.parent.frozenColCount(r);e.left?(d=e.left,p&&(d+=ke(r,h[1],p-1,!0)),l=u(r.paneTopLeftCell)[1]):l=p,r.colCount>s+1||r.usedRange.colIndex>s?(!this.parent.scrollSettings.isFinite&&r.colCount<=r.usedRange.colIndex&&this.parent.setSheetPropertyOnMute(r,"colCount",r.usedRange.colIndex+1),d+=ke(r,l,s,!0),this.setScrollCount(r.colCount,"col"),i=d+ke(r,s+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"colCount",s+1),d+=ke(r,l,r.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=r.colCount,i=d),t.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),t.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),e.left&&(d=ke(r,this.parent.viewport.leftIndex+p,s,!0)),t.isNullOrUndefined(this.translateX)&&(this.translateX=0),t.isNullOrUndefined(this.translateY)&&(this.translateY=0),n=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.rowHeader);var c=n.appendChild(a.cloneNode());this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",n=this.parent.getColumnHeaderContent(),this.colHeader=this.content.cloneNode(),this.colHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.colHeader);var f=n.appendChild(a.cloneNode());this.colHeader.style.width=d+"px",c.style.height=o+"px",f.style.width=i+"px",this.colHeader.style.transform="translate("+this.translateX+"px, 0px)",this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",this.content.style.width=d+"px",a.style.height=o+"px",a.style.width=i+"px",this.parent.allowScrolling&&this.parent.getScrollElement().appendChild(f.cloneNode(!0))},e.prototype.initScroll=function(){for(var e=0;e<this.parent.sheets.length;)this.scroll[e]||this.scroll.push({rowCount:0,colCount:0}),e++},e.prototype.setScrollCount=function(e,t){var r=this.parent.activeSheetIndex;this.scroll[r][t+"Count"]||(this.scroll[r][t+"Count"]=e)},e.prototype.getRowAddress=function(e){var t=this.parent.getActiveSheet();return m([e[0],t.frozenColumns?u(t.topLeftCell)[1]:this.parent.viewport.leftIndex,e[1],this.parent.viewport.rightIndex])},e.prototype.getColAddress=function(e){var t=this.parent.getActiveSheet();return m([t.frozenRows?u(t.topLeftCell)[0]:this.parent.viewport.topIndex,e[0],this.parent.viewport.bottomIndex,e[1]])},e.prototype.updateScrollCount=function(e,t,r){void 0===r&&(r=e);var n=this.parent.getActiveSheet(),i=e+this.parent.viewport[t+"Count"]+1+r,a=this.scroll[this.parent.activeSheetIndex][t+"Count"];if(i<a){if(n[t+"Count"]===a)return;i=a}this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(n,t+"Count",i)},e.prototype.onVerticalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),a=this.parent.getThreshold("row");if(i>Math.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateY&&n>a){this.translateY=0;var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(this.parent.viewport.topIndex=n-(a-p),!e.preventScroll){var c=d?u(h.topLeftCell)[1]:this.parent.viewport.leftIndex,f=d?[p,this.parent.viewport.leftIndex+d]:[];if(i<this.parent.viewport.rowCount+a){s=this.parent.viewport.topIndex-1,o=this.parent.skipHidden(p,s)[0],this.parent.viewport.topIndex=this.skipHiddenIdx(o-p,!0);var g=this.hiddenCount(o,s),m=this.skipHiddenIdx(this.parent.viewport.bottomIndex-(s-o+1-g),e.increase);this.parent.viewport.bottomIndex-=s-o+1-g+this.hiddenCount(m,this.parent.viewport.bottomIndex),this.parent.renderModule.refreshUI({colIndex:c,rowIndex:o,direction:"last",refresh:"RowPart",skipUpdateOnFirst:!0,frozenIndexes:f},this.getRowAddress([o,this.skipHiddenIdx(s,!1)]))}else{var v=this.parent.viewport.leftIndex;this.parent.renderModule.refreshUI({rowIndex:0,colIndex:c,refresh:"Row",skipUpdateOnFirst:!0,frozenIndexes:f}),d&&(this.parent.viewport.leftIndex=v)}Ct(this.parent.element)}}this.updateScrollCount(a,"row")}if(n<a&&(i=Math.abs(t-a)),t>a){if(l=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-a,e.increase&&l>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=l);p=this.parent.frozenRowCount(h);if(this.translateY=r-this.getThresholdHeight(this.parent.viewport.topIndex+p,a),!e.preventScroll){var c=(d=this.parent.frozenColCount(h))?u(h.topLeftCell)[1]:this.parent.viewport.leftIndex,y=[];if(h.frozenColumns&&(y=[p,this.parent.viewport.leftIndex+d]),i<this.parent.viewport.rowCount+a)if(e.increase){if(o=this.parent.viewport.bottomIndex+1,s=this.parent.viewport.bottomIndex+(this.parent.viewport.topIndex-l),s-=this.hiddenCount(l,this.parent.viewport.topIndex-1),this.parent.viewport.topIndex=this.skipHiddenIdx(this.parent.viewport.topIndex,e.increase),s<=this.parent.viewport.bottomIndex)return;var C=this.parent.skipHidden(o,s);o=C[0],s=this.checkLastIdx(C[1],"row"),this.parent.viewport.bottomIndex=s,this.parent.renderModule.refreshUI({colIndex:c,rowIndex:o,direction:"first",refresh:"RowPart",frozenIndexes:y},this.getRowAddress([o,s]))}else{s=(o=this.parent.viewport.topIndex+p)+i-1;var g=this.hiddenCount(o,s),m=this.skipHiddenIdx(this.parent.viewport.bottomIndex-(s-o-g),e.increase);this.parent.viewport.bottomIndex-=i-g+this.hiddenCount(m,this.parent.viewport.bottomIndex),o=this.parent.skipHidden(o,s)[0],this.parent.viewport.topIndex=this.skipHiddenIdx(o-p,!0),this.parent.renderModule.refreshUI({colIndex:c,rowIndex:o,direction:"last",refresh:"RowPart",frozenIndexes:y},this.getRowAddress([o,s]))}else l=this.parent.viewport.leftIndex,this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:c,refresh:"Row",frozenIndexes:y}),d&&(this.parent.viewport.leftIndex=l);this.updateScrollCount(t,"row",a),this.focusSheet()}}e.prev.idx=t}},e.prototype.skipHiddenIdx=function(e,t,r,n){return void 0===r&&(r="rows"),void 0===n&&(n=this.parent.getActiveSheet()),n[r][e]&&n[r][e].hidden&&(e=t?e++:e--,e=this.skipHiddenIdx(e,t,r,n)),e},e.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=0,i=this.parent.getActiveSheet(),a=e;a<=t;a++)i[r][a]&&i[r][a].hidden&&n++;return n},e.prototype.checkLastIdx=function(e,t){if(this.parent.scrollSettings.isFinite){var r=this.parent.getActiveSheet()[t+"Count"]-1;e>r&&(e=r)}return e},e.prototype.onHorizontalScroll=function(e){var t=e.cur.idx,r=e.cur.size,n=e.prev.idx,i=Math.abs(t-n),a=this.parent.getThreshold("col");if(i>Math.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateX&&n>a){var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(this.translateX=0,this.parent.viewport.leftIndex=n-(a-d),!e.preventScroll){var c=p?u(h.topLeftCell)[0]:this.parent.viewport.topIndex,f=p?[this.parent.viewport.topIndex+p,d]:[];if(i<this.parent.viewport.colCount+a){s=this.parent.viewport.leftIndex-1,o=this.parent.skipHidden(d,s,"columns")[0],this.parent.viewport.leftIndex=this.skipHiddenIdx(o-d,!0);var g=this.hiddenCount(o,s,"columns"),m=this.skipHiddenIdx(this.parent.viewport.rightIndex-(s-o+1-g),e.increase,"columns");this.parent.viewport.rightIndex-=s-o+1-g+this.hiddenCount(m,this.parent.viewport.rightIndex,"columns"),this.parent.renderModule.refreshUI({rowIndex:c,colIndex:o,direction:"last",refresh:"ColumnPart",skipUpdateOnFirst:!0,frozenIndexes:f},this.getColAddress([o,this.skipHiddenIdx(s,!1,"columns")]))}else{var v=this.parent.viewport.topIndex;this.parent.renderModule.refreshUI({rowIndex:c,colIndex:0,refresh:"Column",skipUpdateOnFirst:!0,frozenIndexes:f}),p&&(this.parent.viewport.topIndex=v)}Ct(this.parent.element)}}this.updateScrollCount(a,"col")}if(n<a&&(i=Math.abs(t-a)),t>a){if(l=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-a,e.increase&&l>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=l);d=this.parent.frozenColCount(h);if(this.translateX=r-this.getThresholdWidth(this.parent.viewport.leftIndex+d,a),!e.preventScroll){var c=(p=this.parent.frozenRowCount(h))?u(h.topLeftCell)[0]:this.parent.viewport.topIndex,y=[];if(p&&(y=[p+this.parent.viewport.topIndex,d]),i<this.parent.viewport.colCount+a)if(e.increase){if(o=this.parent.viewport.rightIndex+1,s=this.parent.viewport.rightIndex+(this.parent.viewport.leftIndex-l),s-=this.hiddenCount(l,this.parent.viewport.leftIndex-1,"columns"),this.parent.viewport.leftIndex=this.skipHiddenIdx(this.parent.viewport.leftIndex,e.increase,"columns"),s<=this.parent.viewport.rightIndex)return;var C=this.parent.skipHidden(o,s,"columns");o=C[0],s=this.checkLastIdx(C[1],"col"),this.parent.viewport.rightIndex=s,this.parent.renderModule.refreshUI({rowIndex:c,colIndex:o,direction:"first",refresh:"ColumnPart",frozenIndexes:y},this.getColAddress([o,s]))}else{s=(o=this.parent.viewport.leftIndex+d)+i-1;var g=this.hiddenCount(o,s,"columns"),m=this.skipHiddenIdx(this.parent.viewport.rightIndex-(s-o-g),e.increase,"columns");this.parent.viewport.rightIndex-=i-g+this.hiddenCount(m,this.parent.viewport.rightIndex,"columns"),o=this.parent.skipHidden(o,s,"columns")[0],this.parent.viewport.leftIndex=this.skipHiddenIdx(o-d,!0,"columns",h),this.parent.renderModule.refreshUI({rowIndex:c,colIndex:o,direction:"last",refresh:"ColumnPart",frozenIndexes:y},this.getColAddress([o,s]))}else l=this.parent.viewport.topIndex,this.parent.renderModule.refreshUI({rowIndex:c,colIndex:this.parent.viewport.leftIndex,refresh:"Column",frozenIndexes:y}),p&&(this.parent.viewport.topIndex=l);this.updateScrollCount(t,"col",a),this.focusSheet()}}e.prev.idx=t}},e.prototype.focusSheet=function(){document.activeElement.classList.contains("e-text-findNext-short")&&t.closest(document.activeElement,"#"+this.parent.element.id)||Ct(this.parent.element)},e.prototype.getThresholdHeight=function(e,t){for(var r=0,n=this.parent.getActiveSheet(),i=e;i<e+t;i++)r+=Se(n,i,!0);return r},e.prototype.getThresholdWidth=function(e,t){for(var r=0,n=this.parent.getActiveSheet(),i=e;i<e+t;i++)r+=Re(n,i,null,!0);return r},e.prototype.translate=function(e){var t=this.parent.enableRtl?-this.translateX:this.translateX;"Row"!==e.refresh&&"RowPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)"),"Column"!==e.refresh&&"ColumnPart"!==e.refresh||(this.content.style.transform="translate("+t+"px, "+this.translateY+"px)",this.colHeader.style.transform="translate("+t+"px, 0px)")},e.prototype.updateColumnWidth=function(e){if("Column"===e.refresh){this.content.style.width="";var t=this.parent.getActiveSheet(),r=ke(t,this.parent.viewport.leftIndex+this.parent.frozenColCount(t),this.parent.viewport.rightIndex,!0);if(this.colHeader.style.width=r+"px",this.content.style.width=r+"px",this.parent.allowScrolling){var n=this.parent.element.querySelector(".e-scroller .e-virtualtrack"),i=parseInt(n.style.width,10),a=r+this.translateX+this.parent.viewport.beforeFreezeWidth;if(a>i){o=a-i;n.style.width=i+o+"px"}else{var o=i-a,s=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];i-o<parseInt(s.style.width,10)&&(n.style.width=s.style.width)}}}else{var s=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0],l=parseInt(s.style.height,10),h=this.content.getBoundingClientRect().height+this.translateY+this.parent.viewport.beforeFreezeHeight;if(h>l){o=h-l;s.style.height=l+o+"px"}else{var o=l-h,d=this.parent.getRowHeaderContent().getElementsByClassName("e-virtualtrack")[0];l-o<parseInt(d.style.height,10)&&(s.style.height=d.style.height)}}},e.prototype.updateUsedRange=function(e){if(this.scroll.length){var t=this.parent.getActiveSheet();if("row"===e.update){if(e.index!==this.scroll[this.parent.activeSheetIndex].rowCount-1){var r=this.getVTrackHeight("height"),n=r;if(e.index>=this.scroll[this.parent.activeSheetIndex].rowCount?n+=we(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n-=we(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),n<r)return;this.scroll[this.parent.activeSheetIndex].rowCount=e.index+1,this.updateVTrack(this.rowHeader,r,"height"),this.scroll[this.parent.activeSheetIndex].rowCount>t.rowCount&&this.parent.setSheetPropertyOnMute(t,"rowCount",this.scroll[this.parent.activeSheetIndex].rowCount)}}else if(e.index>this.scroll[this.parent.activeSheetIndex].colCount){var i=this.getVTrackHeight("width");i+=ke(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0),this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,i,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&this.parent.setSheetPropertyOnMute(t,"colCount",this.scroll[this.parent.activeSheetIndex].colCount)}}},e.prototype.getVTrackHeight=function(e){var t=this.content.nextElementSibling.style[e];if(t.includes("e+")){var r=(t=t.split("px")[0]).split("e+");return Number(r[0])*Math.pow(10,Number(r[1]))}return parseFloat(t)},e.prototype.updateVTrackHeight=function(e){var t=this.parent.viewport.rowCount+1+2*this.parent.getThreshold("row");e.rowIdx>=t&&e.rowIdx<this.scroll[this.parent.activeSheetIndex].rowCount&&this.updateVTrack(this.rowHeader,this.getVTrackHeight("height")+e.threshold,"height")},e.prototype.updateVTrackWidth=function(e){if(e.colIdx>=this.parent.viewport.leftIndex&&e.colIdx<=this.parent.viewport.rightIndex){var t=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0];t.style.width=parseFloat(t.style.width)+e.threshold+"px";var r=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];r.style.width=parseFloat(r.style.width)+e.threshold+"px";var n=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0];n.style.width=parseFloat(n.style.width)+e.threshold+"px";var i=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0];i.style.width=parseFloat(i.style.width)+e.threshold+"px"}},e.prototype.updateVTrack=function(e,t,r){e.nextElementSibling.style[r]=t+"px",this.content.nextElementSibling.style[r]=t+"px"},e.prototype.deInitProps=function(){this.parent.viewport.leftIndex=null,this.parent.viewport.topIndex=null,this.parent.viewport.bottomIndex=null,this.translateX=null,this.translateY=null},e.prototype.updateScrollProps=function(e){var t=this;void 0===e&&(e={sheetIndex:0,sheets:this.parent.sheets}),0===this.scroll.length?this.initScroll():e.sheets.forEach(function(){t.scroll.splice(e.sheetIndex,0,{rowCount:0,colCount:0})})},e.prototype.sliceScrollProps=function(e){t.isNullOrUndefined(e.sheetIndex)?this.scroll.length=0:this.scroll.splice(e.sheetIndex,1)},e.prototype.addEventListener=function(){this.parent.on("beforeContentLoaded",this.createVirtualElement,this),this.parent.on("beforeVirtualContentLoaded",this.translate,this),this.parent.on("virtualContentLoaded",this.updateColumnWidth,this),this.parent.on("updateTableWidth",this.updateColumnWidth,this),this.parent.on("verticalScroll",this.onVerticalScroll,this),this.parent.on("horizontalScroll",this.onHorizontalScroll,this),this.parent.on("updateUsedRange",this.updateUsedRange,this),this.parent.on(Qt,this.updateVTrackHeight,this),this.parent.on("colWidthChanged",this.updateVTrackWidth,this),this.parent.on("deInitProperties",this.deInitProps,this),this.parent.on("sheetsDestroyed",this.sliceScrollProps,this),this.parent.on("sheetCreated",this.updateScrollProps,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.rowHeader=null,this.colHeader=null,this.content=null,this.parent=null,this.scroll.length=0,this.translateX=null,this.translateY=null},e.prototype.removeEventListener=function(){this.parent.off("beforeContentLoaded",this.createVirtualElement),this.parent.off("beforeVirtualContentLoaded",this.translate),this.parent.off("virtualContentLoaded",this.updateColumnWidth),this.parent.off("updateTableWidth",this.updateColumnWidth),this.parent.off("verticalScroll",this.onVerticalScroll),this.parent.off("horizontalScroll",this.onHorizontalScroll),this.parent.off("updateUsedRange",this.updateUsedRange),this.parent.off(Qt,this.updateVTrackHeight),this.parent.off("colWidthChanged",this.updateVTrackWidth),this.parent.off("sheetsDestroyed",this.sliceScrollProps),this.parent.off("sheetCreated",this.updateScrollProps),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),_n=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Xt,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Xt,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){if(!this.parent.isEdit&&(document.activeElement.classList.contains("e-spreadsheet")||t.closest(document.activeElement,".e-sheet"))){var r=void 0,n=this.parent.enableRtl,i=this.parent.getActiveSheet(),a={e:e,isFilterCell:!1},o=u(this.parent.getActiveSheet().activeCell);if([9,37,38,39,40].indexOf(e.keyCode)>-1&&e.preventDefault(),e.shiftKey&&this.shiftSelection(e),e.shiftKey||!e.altKey||38!==e.keyCode&&40!==e.keyCode||this.parent.notify("filterCellKeyDown",a),!e.shiftKey&&(!n&&37===e.keyCode||n&&39===e.keyCode)||e.shiftKey&&9===e.keyCode)if(o[1]>0)o[1]-=1,r=!0;else{l=this.parent.getMainContent();0===o[1]&&l.scrollLeft&&!n&&(l.scrollLeft=0)}else if(e.shiftKey&&13===e.keyCode){if(!this.parent.element.querySelector(".e-find-toolbar"))if(o[0]>0)o[0]-=1,r=!0;else{l=this.parent.getMainContent().parentElement;0===o[0]&&l.scrollTop&&(l.scrollTop=0)}}else if(a.isFilterCell||e.shiftKey||38!==e.keyCode){if(!e.shiftKey&&(!n&&39===e.keyCode||n&&37===e.keyCode)||9===e.keyCode)(s=$(o[0],o[1],i))&&s.colSpan>1&&(o[1]+=s.colSpan-1),o[1]<i.colCount-1&&(o[1]+=1,r=!0);else if(!a.isFilterCell&&!e.shiftKey&&40===e.keyCode||13===e.keyCode){var s=$(o[0],o[1],i);s&&s.rowSpan>1&&(o[0]+=s.rowSpan-1),o[0]<i.rowCount-1&&(o[0]+=1,r=!0)}}else if(o[0]>0)o[0]-=1,r=!0;else{var l=this.parent.getMainContent().parentElement;0===o[0]&&l.scrollTop&&(l.scrollTop=0)}if(r){for(;be(this.parent.getActiveSheet(),o[0]);)40===e.keyCode&&(o[0]=o[0]+1),38===e.keyCode&&(o[0]=o[0]-1);this.scrollNavigation(o,!1),this.parent.setSheetPropertyOnMute(i,"activeCell",m(o)),this.parent.notify("cellNavigate",{range:o})}}e.target.classList.contains("e-sheet-rename")&&(32===e.keyCode?e.stopPropagation():13!==e.keyCode&&27!==e.keyCode||this.parent.notify("renameSheet",e))},e.prototype.shiftSelection=function(e){var r=this.parent.getActiveSheet(),n=c(r.selectedRange),i=x(n),a=!0;if(38===e.keyCode){for(o=i[1];o<=i[3];o++){s=$(n[2],o,this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan<0){n[2]=n[2]-(Math.abs(s.rowSpan)+1),a=!1;break}}a&&(n[2]=n[2]-1),n[2]<0&&(n[2]=0)}if(40===e.keyCode){for(o=i[1];o<=i[3];o++){s=$(n[2],o,this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan>0){n[2]=n[2]+Math.abs(s.rowSpan),a=!1;break}}a&&(n[2]=n[2]+1)}if(39===e.keyCode){for(o=i[0];o<=i[2];o++){s=$(o,n[3],this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan>0){n[3]=n[3]+Math.abs(s.colSpan),a=!1;break}}a&&(n[3]=n[3]+1)}if(37===e.keyCode){for(var o=i[0];o<=i[2];o++){var s=$(o,n[3],this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan<0){n[3]=n[3]-(Math.abs(s.colSpan)+1),a=!1;break}}a&&(n[3]=n[3]-1),n[3]<0&&(n[3]=0)}if(e.shiftKey&&e.ctrlKey&&!this.parent.scrollSettings.enableVirtualization){var l=[r.usedRange.rowIndex,r.usedRange.colIndex];37===e.keyCode&&(n[3]<=l[1]?n[3]=0:n[3]=l[1]),38===e.keyCode&&(n[2]<=l[0]?n[2]=0:n[2]=l[0]),39===e.keyCode&&(n[3]<=l[1]?n[3]=l[1]:n[3]=this.parent.getActiveSheet().colCount),40===e.keyCode&&(n[2]<=l[0]?n[2]=l[0]:n[2]=this.parent.getActiveSheet().rowCount)}if(37===e.keyCode||39===e.keyCode||38===e.keyCode||40===e.keyCode){for(;be(this.parent.getActiveSheet(),n[2]);)40===e.keyCode&&(n[2]=n[2]+1),38===e.keyCode&&(n[2]=n[2]-1);this.parent.selectRange(m(n)),this.scrollNavigation([n[2],n[3]],!1)}},e.prototype.scrollNavigation=function(e,t){if(this.parent.allowScrolling){var r=this.parent.enableRtl?-1:1,n=this.parent.getMainContent().parentElement,i=this.parent.getScrollElement(),a=this.parent.getActiveSheet(),o=x(c(a.selectedRange)),s=u(a.topLeftCell),l=this.parent.frozenRowCount(a),h=this.parent.frozenColCount(a),d=u(a.paneTopLeftCell),p=e[0]<l?s[0]:d[0],f=e[1]<h?s[1]:d[1],g=this.parent.scrollModule.offset.left.size,m=this.parent.scrollModule.offset.top.size;if(l&&e[0]!==o[2]&&n.scrollTop){if(e[0]===l)return void(n.scrollTop=0);e[0]===l-1&&(n.scrollTop=0)}if(h&&e[1]!==o[3]&&i.scrollLeft){if(e[1]===h)return void(i.scrollLeft=0);e[1]===h-1&&(i.scrollLeft=0)}this.getBottomIdx(p)<=e[0]||t?n.scrollTop=m+Se(a,d[0],!0):p>e[0]&&(n.scrollTop=m-Math.ceil(Se(a,e[0],!0))),this.getRightIdx(f)<=e[1]||t?i.scrollLeft=g+Re(a,d[1],null,!0)*r:f>e[1]&&(i.scrollLeft=g-Re(a,e[1],null,!0)*r)}},e.prototype.getBottomIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=(r.frozenRows?this.parent.viewport.height-this.parent.sheetModule.getColHeaderHeight(r,!0):this.parent.viewport.height)-17||20,i=e;;i++)if((t+=Se(r,i,!0))>=n)return i},e.prototype.getRightIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=this.parent.getMainContent().parentElement.offsetWidth-this.parent.sheetModule.getRowHeaderWidth(r),i=e;;i++)if((t+=Re(r,i,null,!0))>=n-17)return i},e.prototype.getModuleName=function(){return"keyboardNavigation"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Un=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Xt,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Xt,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){if(e.ctrlKey||e.metaKey){if(t.closest(e.target,".e-find-dlg")||[79,83,65].indexOf(e.keyCode)>-1&&e.preventDefault(),79===e.keyCode)t.select("#"+this.parent.element.id+"_fileUpload",this.parent.element).click();else if(83===e.keyCode)this.parent.saveUrl&&this.parent.allowSave&&this.parent.save();else if(67===e.keyCode)this.parent.notify("copy",{promise:Promise});else if(75===e.keyCode){var r=u(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]],i=void 0;e.preventDefault(),t.isNullOrUndefined(n)||(i=n.cells[r[1]]),t.isNullOrUndefined(i)&&Z(r[0],r[1],this.parent.getActiveSheet(),i,!1),i&&i.hyperlink?this.parent.notify("editHyperlink",null):this.parent.notify("initiateHyperlink",null)}else 90===e.keyCode?this.parent.isEdit||(e.preventDefault(),this.parent.notify("performUndoRedo",{isUndo:!0})):89===e.keyCode&&(this.parent.isEdit||(e.preventDefault(),this.parent.notify("performUndoRedo",{isUndo:!1})));var a=this.parent.sheets[this.parent.getActiveSheet().id-1],o=void 0;if(a){var s=u(a.activeCell),l=$(s[0],s[1],a);o=a.isProtected&&X(l,Ie(a,s[1]))}if(70===e.keyCode&&(e.preventDefault(),this.parent.notify("ribbonFind",null)),!(o&&a.isProtected||70===e.keyCode)){if(71===e.keyCode)e.preventDefault(),this.parent.notify(ar,null);else if(72===e.keyCode)e.preventDefault(),this.parent.notify(or,null);else if(88===e.keyCode)this.parent.notify(Zt,{promise:Promise});else if(86===e.keyCode)o||this.parent.notify(Jt,{isAction:!0});else if(66===e.keyCode)e.preventDefault(),h="bold"===(h=this.parent.getCellStyleValue(["fontWeight"],u(this.parent.getActiveSheet().activeCell)).fontWeight)?"normal":"bold",this.parent.notify(wt,{style:{fontWeight:h},onActionUpdate:!0,refreshRibbon:!0});else if(73===e.keyCode){e.preventDefault();var h=this.parent.getCellStyleValue(["fontStyle"],u(this.parent.getActiveSheet().activeCell)).fontStyle;h="italic"===h?"normal":"italic",this.parent.notify(wt,{style:{fontStyle:h},onActionUpdate:!0,refreshRibbon:!0})}else 85===e.keyCode?(e.preventDefault(),this.parent.notify("textDecorationUpdate",{style:{textDecoration:"underline"},refreshRibbon:!0})):53===e.keyCode&&(e.preventDefault(),this.parent.notify("textDecorationUpdate",{style:{textDecoration:"line-through"},refreshRibbon:!0}));e.shiftKey&&76===e.keyCode&&(this.parent.isEdit||(e.preventDefault(),this.parent.applyFilter()))}}27===e.keyCode&&this.parent.notify("clearCopy",null)},e.prototype.getModuleName=function(){return"keyboardShortcut"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Vn=function(){function e(e){this.checkHeight=!1,this.parent=e,this.row=e.createElement("tr",{className:"e-row"}),this.parent.on(jt,this.addEventListener,this)}return e.prototype.applyCellFormat=function(e){var t=Object.keys(e.style),r=this.parent.getActiveSheet();if(!(e.lastCell&&vt(r,e.rowIdx)<=20)||t.length){var n=e.cell||this.parent.getCell(e.rowIdx,e.colIdx);if(n){if(void 0!==e.style.border||void 0!==e.style.borderTop||void 0!==e.style.borderLeft){var i={};Object.keys(e.style).forEach(function(t){i[t]=e.style[t]}),void 0!==i.border&&(Object.assign(n.style,{borderRight:e.style.border,borderBottom:e.style.border}),this.setLeftBorder(e.style.border,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first),this.setTopBorder(e.style.border,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate),delete i.border),void 0!==i.borderTop&&(this.setTopBorder(e.style.borderTop,n,e.rowIdx,e.colIdx,e.pRow,e.pHRow,e.onActionUpdate,e.first,e.lastCell,e.manualUpdate),delete i.borderTop),void 0!==i.borderLeft&&(this.setLeftBorder(e.style.borderLeft,n,e.rowIdx,e.colIdx,e.row,e.onActionUpdate,e.first),delete i.borderLeft),Object.keys(i).length&&(void 0!==i.borderBottom&&this.setThickBorderHeight(i.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,i))}else{void 0!==e.style.borderBottom&&this.setThickBorderHeight(e.style.borderBottom,e.rowIdx,e.colIdx,n,e.row,e.hRow,e.onActionUpdate,e.lastCell,e.manualUpdate),Object.assign(n.style,e.style);var a=$(e.rowIdx,e.colIdx,r);a&&(a.rowSpan||a.colSpan)&&n.offsetHeight>0&&(s=ht(this.parent,a.style||this.parent.cellStyle))>n.offsetHeight&<(this.parent,r,n.offsetHeight,e.rowIdx)}if(e.isHeightCheckNeeded&&(!r.rows[e.rowIdx]||!r.rows[e.rowIdx].customHeight))if(e.manualUpdate)this.checkHeight||(this.checkHeight=this.isHeightCheckNeeded(e.style,e.onActionUpdate)),n&&n.children[0]&&"e-cf-databar"===n.children[0].className&&e.style.fontSize&&(n.children[0].querySelector(".e-databar-value").style.fontSize=e.style.fontSize),this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate);else{var o=$(e.rowIdx,e.colIdx,r);if(o&&o.wrap||!this.isHeightCheckNeeded(e.style)||mt(r,e.rowIdx,e.colIdx,gt(this.parent,e.rowIdx,e.colIdx,r,e.style)),e.lastCell){var s=vt(r,e.rowIdx);s>20&&s>Se(r,e.rowIdx)&<(this.parent,r,s,e.rowIdx,e.row,e.hRow,!1)}}}else this.updateRowHeight(e.rowIdx,e.colIdx,!0,e.onActionUpdate)}},e.prototype.updateRowHeight=function(e,r,n,i){if(this.checkHeight){var a=0,o=void 0,s=this.parent.getActiveSheet(),l=$(e,r,s,null,!0),h=this.parent.getCell(e,r);if(l&&!l.rowSpan&&!l.colSpan){if(a=gt(this.parent,e,r,s,l.style||this.parent.cellStyle,l.wrap?pt(this.parent.getDisplayText(l),ft(s,e,r),l.style,this.parent.cellStyle):1),!t.isNullOrUndefined(l.value)&&l.value.toString().indexOf("\n")>-1){var d=void 0,p=l.value.split("\n"),c=0,u=p.length;for(d=0;d<u;d++){var f=pt(p[d],ft(s,e,r),l.style,this.parent.cellStyle);0===f&&(f=1),c+=f}a=gt(this.parent,e,r,s,l.style||this.parent.cellStyle,c)}if(a<20&&(a=20),h&&h.children[0]&&"e-cf-databar"===h.children[0].className&&(h.children[0].style.height="100%",h.children[0].firstElementChild.nextElementSibling.style.height="100%"),mt(s,e,r,a),n){this.checkHeight=!1;var g=s.frozenRows?this.parent.getRow(e,null,s.frozenColumns):this.parent.getRow(e);if(!g)return;var m=Se(s,e);o=vt(s,e),(i?o!==m:o>m)&<(this.parent,s,o,e,g)}}}},e.prototype.isHeightCheckNeeded=function(e,t){var r=Object.keys(e);return(t?r.indexOf("fontSize")>-1:r.indexOf("fontSize")>-1&&Number(e.fontSize.split("pt")[0])>12)||r.indexOf("fontFamily")>-1||r.indexOf("borderTop")>-1||r.indexOf("borderBottom")>-1},e.prototype.setLeftBorder=function(e,t,r,n,i,a,o){if(!o||!o.includes("Column"))for(var s=0;s<t.rowSpan;s++){for(var l=this.parent.getCell(r+s,n-1,i),h=1;l&&"none"===l.style.display;)l=this.parent.getCell(r+s,n-1-h,i),h++;l?(a&&""!==e&&n===this.parent.viewport.leftIndex&&(this.parent.getMainContent().scrollLeft-=this.getBorderSize(e)),l.style.borderRight="none"===e?l.style.borderRight:e):t.style.borderLeft=e}},e.prototype.setTopBorder=function(e,t,r,n,i,a,o,s,l,h){if(!s||!s.includes("Row"))for(var d=0;d<t.colSpan;d++){var p=this.parent.getCell(r-1,n+d,i);if(p){if(be(this.parent.getActiveSheet(),r-1)){var c=[Number(p.parentElement.getAttribute("aria-rowindex"))-1,n];if(this.parent.getCellStyleValue(["bottomPriority"],c).bottomPriority)return}o&&""!==e&&this.parent.getActiveSheet().topLeftCell.includes(""+(r+1))&&(this.parent.getMainContent().parentElement.scrollTop-=this.getBorderSize(e)),this.setThickBorderHeight(e,r-1,n+d,p,i,a,o,l,h),p.style.borderBottom="none"===e?p.style.borderBottom:e}else t.style.borderTop=e}},e.prototype.setThickBorderHeight=function(e,t,r,n,i,a,o,s,l){var h=e?this.getBorderSize(e):1,d=this.parent.getActiveSheet();if(h>2&&(!d.rows[t]||!d.rows[t].customHeight))if(l)this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o);else{var p=Se(d,t),c=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3));c>p&&(lt(this.parent,d,c,t,i,a,!1),this.parent.notify(Qt,{rowIdx:t,threshold:c-20}))}!o||!s&&this.checkHeight||!(h<3)||d.rows[t]&&d.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o))},e.prototype.getBorderSize=function(e){var t=e.split(" ")[0];return"thin"===t?1:"medium"===t?2:"thick"===t?3:parseInt(t,10)?parseInt(t,10):1},e.prototype.clearObj=function(e){var r,n,i=e.options,a=i.range?i.range.indexOf("!")>0?i.range.split("!")[1]:i.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,o=i.range&&i.range.indexOf("!")>0?ae(this.parent,i.range.split("!")[0]):this.parent.activeSheetIndex,s=c(a),l=this.parent.sheets[o],h=s[0],d=s[2],p={range:a,type:i.type,requestType:"clear",sheetIndex:o};if(e.isPublic||this.parent.notify(ir,{action:"beforeClear",eventArgs:p}),"Clear Formats"===i.type||"Clear All"===i.type)for(this.parent.notify(Mt,{range:a,isPublic:!1}),h;h<=d;h++)for(r=s[1],n=s[3],r;r<=n;r++){var u=$(h,r,l),f=this.parent.getCell(h,r);u&&(u.wrap&&this.parent.notify(At,{range:[h,r,h,r],wrap:!1,sheet:l}),u.hyperlink&&(t.removeClass(f.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"),"Clear All"===i.type&&this.parent.removeHyperlink(m([h,r,h,r]))))}if("Clear Hyperlinks"===i.type)return void this.parent.removeHyperlink(a);this.parent.notify("clear",{range:l.name+"!"+a,type:i.type}),this.parent.serviceLocator.getService("cell").refreshRange(c(a)),e.isPublic||(p={range:l.name+"!"+a,type:i.type,sheetIndex:o},this.parent.notify("actionComplete",{eventArgs:p,action:"clear"})),this.parent.notify("selectRange",{address:a})},e.prototype.addEventListener=function(){this.parent.on(It,this.applyCellFormat,this),this.parent.on(lr,this.clearObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(jt,this.addEventListener),this.parent.off(It,this.applyCellFormat),this.parent.off(lr,this.clearObj))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.row=null,this.checkHeight=null},e.prototype.getModuleName=function(){return"cellformat"},e}(),zn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("contentLoaded",this.wireEvents,this),this.parent.on(tr,this.autoFit,this),this.parent.on("setAutoFit",this.setAutoFitHandler,this)},e.prototype.autoFit=function(e){for(var t=e.isRow?this.parent.getRowHeaderTable():this.parent.getColHeaderTable().rows[0],r=e.startIndex;r<=e.endIndex;r++)this.trgtEle=e.isRow?this.parent.getRow(r,t):this.parent.getCell(null,r,t),this.setAutofit(r,!e.isRow)},e.prototype.wireEvents=function(){var e=this.parent.getRowHeaderContent(),r=this.parent.element.getElementsByClassName("e-header-panel")[0];t.EventHandler.add(r,"dblclick",this.dblClickHandler,this),t.EventHandler.add(e,"dblclick",this.dblClickHandler,this),t.EventHandler.add(r,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(e,r)},e.prototype.wireResizeCursorEvent=function(e,r){t.EventHandler.add(e,"mousemove",this.setTarget,this),t.EventHandler.add(r,"mousemove",this.setTarget,this)},e.prototype.unWireResizeCursorEvent=function(){t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget),t.EventHandler.remove(this.parent.element.getElementsByClassName("e-header-panel")[0],"mousemove",this.setTarget)},e.prototype.unwireEvents=function(){t.EventHandler.remove(this.parent.getColumnHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("contentLoaded",this.wireEvents),this.parent.off(tr,this.autoFit),this.parent.off("setAutoFit",this.setAutoFitHandler))},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-colresize-handler")[0],r=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];(t||r)&&(this.isMouseMoved=!0,t?e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left&&(t.style.left=e.clientX-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().left+"px"):r&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(r.style.top=e.clientY-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().top+"px"))},e.prototype.mouseDownHandler=function(e){if(t.closest(e.target,".e-header-cell")){if(this.event=e,this.trgtEle=e.target,this.trgtEle.parentElement.classList.contains("e-hide-end")||this.trgtEle.classList.contains("e-hide-end")){var r=this.trgtEle.offsetHeight,n=e.offsetY;(r>=10&&n<5||r-2<8&&n<Math.ceil((n-2)/2))&&this.trgtEle.classList.add("e-skip-resize")}this.updateTarget(e,this.trgtEle);var i=this.trgtEle,a=i.classList.contains("e-colresize")?"e-colresize-handler":i.classList.contains("e-rowresize")?"e-rowresize-handler":"";this.createResizeHandler(i,a),this.unWireResizeCursorEvent(),t.EventHandler.add(this.parent.element,"mousemove",this.mouseMoveHandler,this),t.EventHandler.add(document,"mouseup",this.mouseUpHandler,this)}},e.prototype.mouseUpHandler=function(e){var r=this.parent.element.getElementsByClassName("e-colresize-handler")[0],n=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];this.resizeOn(e),this.isMouseMoved=null;var i=r||n;i&&(document.getElementById(this.parent.element.id+"_sheet").removeChild(i),this.updateCursor()),t.EventHandler.remove(document,"mouseup",this.mouseUpHandler),t.EventHandler.remove(this.parent.element,"mousemove",this.mouseMoveHandler),this.wireResizeCursorEvent(this.parent.getRowHeaderContent(),this.parent.element.getElementsByClassName("e-header-panel")[0])},e.prototype.dblClickHandler=function(e){if(t.closest(e.target,".e-header-cell"))if(this.trgtEle=e.target,this.updateTarget(e,this.trgtEle),this.trgtEle.classList.contains("e-colresize")){var r=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1,n=Re(this.parent.getActiveSheet(),r)+"px";this.trgtEle.classList.contains("e-unhide-column")?this.showHiddenColumns(r-1):this.setAutofit(r,!0,n)}else if(this.trgtEle.classList.contains("e-rowresize")){var i=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,a=Se(this.parent.getActiveSheet(),i)+"px";this.setAutofit(i,!1,a)}},e.prototype.setTarget=function(e){if(t.closest(e.target,".e-header-cell")){var r=e.target,n=this.parent.getActiveSheet();if(n.isProtected&&(!n.protectSettings.formatColumns||!n.protectSettings.formatRows)){if(!n.protectSettings.formatRows&&!n.protectSettings.formatColumns)return;if(n.protectSettings.formatRows&&t.closest(r,".e-colhdr-table"))return;if(n.protectSettings.formatColumns&&t.closest(r,".e-rowhdr-table"))return}var i,a,o,s;if(t.closest(r,".e-header-row"))o=e.offsetX,a=r.offsetWidth,s="e-colresize",(l=this.getColPrevSibling(r))&&!l.classList.contains("e-select-all-cell")?i=l:Number(r.getAttribute("aria-colindex"))>1&&(i=r);else if(t.closest(r,".e-row")){o=e.offsetY,a=r.offsetHeight,s="e-rowresize";var l=this.getRowPrevSibling(r);l?i=l.firstElementChild:Number(r.parentElement.getAttribute("aria-rowindex"))>1&&(i=r)}if(a-2<8&&o!==Math.ceil((a-2)/2))o<Math.ceil((a-2)/2)?(r.classList.add(s),i.classList.add(s)):o>Math.ceil((a-2)/2)&&r.classList.add(s);else if(a-5<o&&o<=a&&a>=10)r.classList.add(s);else if(o<5&&i&&a>=10)r.classList.add(s),i.classList.add(s);else for(var h=this.parent.element.getElementsByClassName(s),d=0;d<h.length;d++)h[d].classList.remove(s)}},e.prototype.getColPrevSibling=function(e){var r=this.parent.frozenColCount(this.parent.getActiveSheet());return e.previousElementSibling||(r&&t.closest(e,".e-column-header")?this.parent.getSelectAllContent().querySelector(".e-header-row").lastElementChild:null)},e.prototype.getRowPrevSibling=function(e){var r=this.parent.frozenRowCount(this.parent.getActiveSheet());return e.parentElement.previousElementSibling||(r&&t.closest(e,".e-row-header")?this.parent.getSelectAllContent().querySelector("tbody").lastElementChild:null)},e.prototype.updateTarget=function(e,r){if(t.closest(r,".e-header-row")){if(r.offsetWidth<10&&e.offsetX<Math.ceil((r.offsetWidth-2)/2)||e.offsetX<5&&r.offsetWidth>=10&&r.classList.contains("e-colresize")){var n=this.parent.getActiveSheet(),i=Number(this.trgtEle.getAttribute("aria-colindex"))-2;(a=this.getColPrevSibling(r))&&!Ae(n,i)?this.trgtEle=a:i>-1&&this.trgtEle.classList.add("e-unhide-column")}}else if(r.offsetHeight<10&&e.offsetY<Math.ceil((r.offsetHeight-2)/2)||e.offsetY<5&&r.offsetHeight>=10&&r.classList.contains("e-rowresize")){var n=this.parent.getActiveSheet(),i=Number(r.parentElement.getAttribute("aria-rowindex"))-2,a=this.getRowPrevSibling(r);if(a||be(n,i))if("dblclick"===e.type&&be(n,i)){var o=x(c(n.selectedRange)),s=void 0;s=i<=o[2]&&i>o[0]?{startIndex:o[0],endIndex:o[2],hide:!1,autoFit:!0}:{startIndex:i,endIndex:i,hide:!1,autoFit:!0},this.parent.notify(er,s)}else be(n,i)||(this.trgtEle=a.getElementsByClassName("e-header-cell")[0])}},e.prototype.setAutoFitHandler=function(e){this.setAutofit(e.idx,e.isCol)},e.prototype.setAutofit=function(e,t,r){var n=0,i=this.parent.getActiveSheet(),a=this.parent.getMainContent(),o=t?Re(this.parent.getActiveSheet(),e)+"px":Se(this.parent.getActiveSheet(),e)+"px",s=[],l=a.getElementsByClassName("e-content-table")[0];this.parent.getActiveSheet().showHeaders&&(t?this.parent.getColHeaderTable():this.parent.getRowHeaderTable()).getElementsByTagName("tr");var h=!1,d=0;if(t)for(var p=i.rows.length,c=0;c<p;c++)i.rows[c]&&i.rows[c].cells&&i.rows[c].cells[e]&&($(c,e,i).wrap&&(h=!0,d++),(g=this.parent.createElement("td",{className:"e-cell"})).textContent=this.parent.getDisplayText(i.rows[c].cells[e]),i.rows[c].cells[e].style&&((m=i.rows[c].cells[e].style).fontFamily&&(g.style.fontFamily=m.fontFamily),m.fontSize&&(g.style.fontSize=m.fontSize)),s[n]=g,n++);else for(var u=i.rows[e]&&i.rows[e].cells?i.rows[e].cells.length:0,f=0;f<u;f++)if(i.rows[e]&&i.rows[e].cells[f]){$(e,f,i).wrap&&(h=!0,d++);var g=this.parent.createElement("td");if(g.textContent=this.parent.getDisplayText(i.rows[e].cells[f]),i.rows[e].cells[f].style){var m=i.rows[e].cells[f].style;m.fontFamily&&(g.style.fontFamily=m.fontFamily),m.fontSize&&(g.style.fontSize=m.fontSize)}s[n]=g,n++}if(0===d){var v=at(l,s,t,this.parent,r,h);t&&(v=this.getFloatingElementWidth(v,e));var y=0===v?parseInt(o,10):v,C=parseInt(o,10)>y?-(parseInt(o,10)-y):y-parseInt(o,10);if(t)if(e>=this.parent.viewport.leftIndex&&e<=this.parent.viewport.rightIndex)Ie(i,e).width=y>0?y:0,this.resizeStart(e,this.parent.getViewportIndex(e,!0),y+"px",t,!0,r),this.parent.notify("colWidthChanged",{threshold:C,colIdx:e});else{var b,S=Re(i,e);b=y>0?-(S-y):-S,this.parent.notify("colWidthChanged",{threshold:b,colIdx:e}),Ie(i,e).width=y>0?y:0}else if(!t)if(e>=this.parent.viewport.topIndex&&e<=this.parent.viewport.bottomIndex)xe(i,e,(y=y>20?y:20)>0?y:0),this.resizeStart(e,this.parent.getViewportIndex(e),y+"px",t,!0,r),this.parent.notify(Qt,{threshold:C,rowIdx:e});else{var x,w=Se(i,e);x=y>0?-(w-y):-w,this.parent.notify(Qt,{threshold:x,rowIdx:e}),xe(i,e,y>0?y:0)}}},e.prototype.createResizeHandler=function(e,t){var r=this.parent.createElement("div",{className:t}),n=document.getElementById(this.parent.element.id+"_sheet");e.classList.contains("e-colresize")?(r.style.height=this.parent.getMainContent().parentElement.clientHeight+this.parent.getColumnHeaderContent().offsetHeight+"px",r.style.left=this.event.clientX-n.getBoundingClientRect().left+"px",r.style.top="0px"):e.classList.contains("e-rowresize")&&(r.style.width=this.parent.getMainContent().parentElement.clientWidth+"px",r.style.left="0px",r.style.top=this.event.clientY-n.getBoundingClientRect().top+"px"),n.appendChild(r),this.updateCursor()},e.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=et(r)-n;if(a<0&&n<-a&&(a=-n),r>0){if(this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column"))return this.showHiddenColumns(e,r),void this.parent.notify(nr,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIdx:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!1},action:"resize"});this.resizeStart(e,t,r+"px",!0,!1,n+"px"),Ee(i,e,{width:r,customWidth:!0}),this.parent.notify("colWidthChanged",{threshold:a,colIdx:e})}else this.isMouseMoved&&(this.parent.hideColumn(e),this.parent.notify(nr,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIdx:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!0},action:"resize"}))},e.prototype.showHiddenColumns=function(e,t){var r,n,i,a=this.parent.getActiveSheet(),o=c(a.selectedRange);if(e>=o[1]&&e<=o[3]&&o[2]===a.rowCount-1&&u(a.activeCell)[0]===u(a.topLeftCell)[0]?(r=o[1],n=o[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var s=r;s<=n;s++)Ee(a,s,{width:t,customWidth:!0}),s>=this.parent.viewport.leftIndex&&s<=this.parent.viewport.rightIndex&&!Ae(a,s)&&(i.children[this.parent.getViewportIndex(s,!0)].style.width=t+"px");this.trgtEle.classList.remove("e-unhide-column"),this.parent.hideColumn(r,n,!1),void 0===t&&this.autoFit({isRow:!1,startIndex:r,endIndex:n})},e.prototype.setRowHeight=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=this.parent.frozenColCount(i),o=parseInt(this.parent.getRow(e,null,a).style.height,10),s=r,l=et(parseInt(s,10))-o;l<0&&o<-l&&(l=-o),this.resizeStart(e,t,s,!1,!1,n),Ce(i,e,{height:parseInt(s,10)>0?parseInt(s,10):0,customHeight:!0}),this.parent.notify(Qt,{threshold:l,rowIdx:e,isCustomHgt:!0})},e.prototype.resizeOn=function(e){var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.activeCell),o=$(a[0],a[1],i);if(this.trgtEle.classList.contains("e-rowresize")){var s=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&be(i,s)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var l={startIndex:s,endIndex:s,hide:!1,skipAppend:!0};this.parent.notify(er,l);var h=this.parent.getRowHeaderTable().tBodies[0],d=this.parent.getContentTable().tBodies[0];l.hdrRow.style.display="none",l.row.style.display="none",h.insertBefore(l.hdrRow,h.children[l.insertIdx]),d.insertBefore(l.row,d.children[l.insertIdx]),this.trgtEle=l.hdrRow.firstElementChild,l.hdrRow.nextElementSibling.classList.remove("e-hide-end"),l.mergeCollection.forEach(function(e){n.parent.notify(Ht,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&be(i,s)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}r=t=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,t=this.parent.getViewportIndex(r);var p=this.parent.frozenColCount(i),u=this.parent.getRow(r,null,p).style.height,f=e.clientY-this.event.clientY+parseInt(u,10);if(f<=0)return this.parent.hideRow(r),Ce(i,r,{height:0,customHeight:!0}),void this.parent.notify(nr,{eventArgs:{index:r,height:"0px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:u},action:"resize"});if(this.setRowHeight(r,t,f+"px",u),o&&o.rowSpan){b=this.parent.getCell(a[0],a[1]);this.parent.element.querySelector(".e-active-cell").style.height=b.offsetHeight+"px"}if("none"===this.trgtEle.parentElement.style.display){var g=this.parent.getActiveSheet(),m=x(c(g.selectedRange));if(r<=m[2]&&r>m[0]){f=Se(g,r);for(var v=void 0,y=m[0];y<=m[2];y++)y!==r&&(u=Se(g,y)+"px",Ce(g,y,{customHeight:!0,height:f}),be(g,y)?v||(v=y):(this.parent.getRow(y).style.height=f+"px",g.showHeaders&&(this.parent.getRow(y,this.parent.getRowHeaderTable()).style.height=f+"px")),this.parent.notify(nr,{eventArgs:{index:y,height:f+"px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:u},action:"resize"}));this.parent.hideRow(m[0],r-1,!1),t+=Math.abs(r-v)}else 0===t||be(g,r-1)?0!==t&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(g.selectedRange);this.trgtEle.parentElement.style.display="",this.parent.getContentTable().rows[t].style.display=""}}else if(this.trgtEle.classList.contains("e-colresize")){this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column")&&e.clientX<this.trgtEle.getBoundingClientRect().left&&(this.trgtEle.classList.remove("e-unhide-column"),this.trgtEle.previousElementSibling&&(this.trgtEle=this.trgtEle.previousElementSibling)),t=parseInt(this.trgtEle.getAttribute("aria-colindex"),10)-1;var C=void 0;if(this.trgtEle.classList.contains("e-unhide-column")?(t-=1,C=0):C=Re(this.parent.getActiveSheet(),t),this.setColWidth(t,this.parent.getViewportIndex(t,!0),e.clientX-this.event.clientX+C,C),o&&o.colSpan){var b=this.parent.getCell(a[0],a[1]);this.parent.element.querySelector(".e-active-cell").style.width=b.offsetWidth+"px"}}},e.prototype.resizeStart=function(e,t,r,n,i,a){nt(e,t,r,n,this.parent);var o,s,l=i?"resizeToFit":"resize";n?(o={index:e,width:r,isCol:n,sheetIdx:this.parent.activeSheetIndex,oldWidth:a},s=a!==r):(o={index:e,height:r,isCol:n,sheetIdx:this.parent.activeSheetIndex,oldHeight:a},s=a!==r),s&&this.parent.notify(nr,{eventArgs:o,action:l})},e.prototype.updateCursor=function(){this.parent.element.getElementsByClassName("e-colresize-handler")[0]?this.parent.element.classList.add("e-col-resizing"):this.parent.element.classList.contains("e-col-resizing")&&this.parent.element.classList.remove("e-col-resizing"),this.parent.element.getElementsByClassName("e-rowresize-handler")[0]?this.parent.element.classList.add("e-row-resizing"):this.parent.element.classList.contains("e-row-resizing")&&this.parent.element.classList.remove("e-row-resizing")},e.prototype.getFloatingElementWidth=function(e,t){var r=e,n={filterRange:[],hasFilter:!1};return this.parent.notify("getFilterRange",n),n.hasFilter&&n.filterRange&&n.filterRange[1]<=t&&n.filterRange[3]>=t&&(r=e+22),r},e.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"resize"},e}(),qn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshClients=function(e){ot(e,this.parent)},e.prototype.addEventListener=function(){this.parent.on("collaborativeUpdate",this.refreshClients,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("collaborativeUpdate",this.refreshClients)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"collaborativeEditing"},e}(),jn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.hideShow=function(e){var t=this.parent.getActiveSheet();if(!t.frozenRows&&!t.frozenColumns){if(e.startIndex>e.endIndex){var r=e.startIndex;e.startIndex=e.endIndex,e.endIndex=r}e.actionUpdate&&this.parent.notify(ir,{eventArgs:e,action:"hideShow"}),e.isCol?this.hideCol(e):this.hideRow(e),e.actionUpdate&&this.parent.notify(nr,{eventArgs:e,action:"hideShow"})}},e.prototype.hideRow=function(e){var r,n,i,a,o=this,s=this.parent.getActiveSheet(),l=0;if(e.hide){for(var h=void 0,d=void 0,p=void 0,c=e.startIndex;c<=e.endIndex;c++)if(!be(s,c))if(void 0===n&&(s.showHeaders&&(d=this.parent.getRowHeaderTable()),h=this.parent.getContentTable(),n=this.parent.getViewportIndex(c),l=0),Ce(s,c,{hidden:!0}),p=h&&h.rows[n]){if(!a)for(m=0;m<=s.usedRange.colIndex;m++)if(((r=$(c,m,s)||{}).colSpan||r.rowSpan)&&(e.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){a=!0;break}if(a)continue;if(s.showHeaders&&t.detach(d.rows[n]),t.detach(p),l++,(p=h.rows[n])&&c===e.endIndex)for(var u=void 0,f=(i=yt(s,c+1,!0))!==yt(s,0,!0)&&i===(this.parent.viewport.topIndex>=e.startIndex?e.endIndex+1:this.parent.viewport.topIndex)?"Row":"",m=this.parent.viewport.leftIndex;m<=this.parent.viewport.rightIndex;m++)""!==(F=this.parent.getCellStyleValue(["borderTop"],[i,m]).borderTop)&&(u=p.cells[m],this.parent.notify(It,{onActionUpdate:!1,rowIdx:i,colIdx:m,style:{borderTop:F},row:p,pRow:p.previousElementSibling,first:f,cell:u}))}else c<=this.parent.viewport.bottomIndex?l++:l--;if(a&&(e.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))return this.parent.selectRange(s.selectedRange),void this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"});if(!l)return;if(this.parent.selectRange(s.selectedRange),this.parent.scrollSettings.enableVirtualization){this.parent.viewport.topIndex>=e.startIndex&&(this.parent.viewport.topIndex=e.endIndex+1),e.startIndex=this.parent.viewport.bottomIndex+1,e.endIndex=e.startIndex+l-1;var v=this.parent.skipHidden(e.startIndex,e.endIndex);e.startIndex=v[0],e.endIndex=v[1],this.parent.viewport.bottomIndex=e.endIndex,this.parent.renderModule.refreshUI({colIndex:this.parent.viewport.leftIndex,direction:"",refresh:"RowPart"},g(e.startIndex,this.parent.viewport.leftIndex)+":"+g(e.endIndex,this.parent.viewport.leftIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col")))}s.showHeaders&&(0===n?d.rows[0]&&d.rows[0].classList.add("e-hide-end"):(d&&d.rows[n-1]&&d.rows[n-1].classList.add("e-hide-start"),d&&d.rows[n]&&d.rows[n].classList.add("e-hide-end")))}else{for(var y=void 0,C=void 0,b=void 0,p=void 0,S=void 0,x=void 0,w=void 0,I=void 0,E=e.startIndex-1,R=void 0,k=[],c=e.startIndex,A=e.endIndex;c<=A;c++)if(be(s,c))if(void 0===R)if(c>this.parent.viewport.bottomIndex){if(Ce(s,c,{hidden:!1}),void 0===I)return}else{void 0===I&&(I=c),Ce(s,c,{hidden:!1}),void 0===n&&(y=document.createDocumentFragment(),C=document.createDocumentFragment(),S=this.parent.serviceLocator.getService("row"),s.showHeaders&&this.parent.getRowHeaderTable()&&(x=this.parent.getRowHeaderTable().tBodies[0]),w=this.parent.getContentTable()?this.parent.getContentTable().tBodies[0]:this.parent.getContentTable(),c<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex=c),n=0===c?0:this.parent.getViewportIndex(c)),E++,s.showHeaders&&(b=S.refresh(c,null,null,!0),y.appendChild(b),x&&t.detach(x.lastElementChild)),p=C.appendChild(S.refresh(c,p,b)),w&&t.detach(w.lastElementChild);for(m=this.parent.viewport.leftIndex;m<=this.parent.viewport.rightIndex;m++)if(void 0!==(r=$(c,m,s)||{}).rowSpan){var T={range:[c,m,c,m],isAction:!1,merge:!0,type:"All",skipChecking:!0};this.parent.notify("activeCellMergedRange",T),k.length&&T.range[1]===k[k.length-1].range[1]||k.push(T)}}else A=c;else{if(e.startIndex===e.endIndex)return;void 0===n?E++:R=c}if(this.parent.viewport.bottomIndex=this.parent.viewport.topIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),l=this.parent.hiddenCount(this.parent.viewport.topIndex,e.startIndex)+this.parent.hiddenCount(e.endIndex+1,this.parent.viewport.bottomIndex),this.parent.viewport.bottomIndex+=l,e.insertIdx=n,e.row=C.querySelector(".e-row"),e.mergeCollection=k,s.showHeaders&&(e.hdrRow=y.querySelector(".e-row"),0!==n&&!be(s,E-1)&&x.children[n-1]&&x.children[n-1].classList.remove("e-hide-start"),0!==e.startIndex&&be(s,e.startIndex-1)&&e.hdrRow.classList.add("e-hide-end"),be(s,E+1)?y.lastElementChild.classList.add("e-hide-start"):x.children[n]&&x.children[n].classList.remove("e-hide-end")),p&&w&&w.children[n]){i=yt(s,E+1,!0);for(c=this.parent.viewport.leftIndex;c<=this.parent.viewport.rightIndex;c++){var F=this.parent.getCellStyleValue(["borderTop"],[i,c]).borderTop;if(""!==F){this.parent.notify(It,{onActionUpdate:!1,rowIdx:i,colIdx:c,style:{borderTop:F},pRow:p,cell:w.children[n].children[c],first:""});var L=yt(s,I-1,!1);L>-1?!w.children[n-1]||this.parent.getCellStyleValue(["borderBottom"],[L,c]).borderBottom||this.parent.getCellStyleValue(["borderTop"],[I,c]).borderTop||(w.children[n-1].children[c].style.borderBottom=""):w.children[n].children[c].style.borderTop=""}}}if(e.skipAppend)return;s.showHeaders&&x&&x.insertBefore(y,x.children[n]),w&&w.insertBefore(C,w.children[n]),this.parent.selectRange(s.selectedRange),e.autoFit&&s.showHeaders&&this.parent.notify(tr,{startIndex:e.startIndex,endIndex:e.endIndex,isRow:!0}),k.forEach(function(e){o.parent.notify(Ht,e)}),void 0!==R&&R!==e.endIndex&&(e.startIndex=R,this.hideRow(e))}},e.prototype.hideCol=function(e){for(var t,r=this,n=this.parent.getActiveSheet(),i=[],a=[],o=u(n.topLeftCell),s=e.startIndex;s<=e.endIndex;s++)(e.hide?!Ae(n,s):Ae(n,s))&&(Ee(n,s,{hidden:e.hide}),this.parent.scrollSettings.enableVirtualization&&(s<this.parent.viewport.leftIndex||s>this.parent.viewport.rightIndex)?s<this.parent.viewport.leftIndex&&a.push(s):(i.push(s),e.hide&&o[1]===s&&(t=!0)));if(a.length||i.length)if(e.hide){if(!i.length)return;if((i.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization)&&this.removeCell(n,i),this.parent.scrollSettings.enableVirtualization){if(i[0]===this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex=yt(n,i[i.length-1]+1,!0,"columns")),t){var l=0;if(i.slice(0,i.indexOf(o[1])).forEach(function(e){l+=Re(n,e,!0)}),l){this.parent.notify("setScrollEvent",{set:!1});var h=this.parent.getMainContent();h.scrollLeft-=l,this.parent.notify("onContentScroll",{scrollLeft:h.scrollLeft,preventScroll:!0,skipHidden:!0}),Le(function(){return r.parent.notify("setScrollEvent",{set:!0})})}}if(this.parent.scrollSettings.isFinite){var d=yt(n,n.colCount-1,!1,"columns"),p=this.parent.viewport.leftIndex,c=this.parent.viewport.rightIndex;if(c+i.length>=d){var f=yt(n,p-(c+i.length-d),!1,"columns");return f>-1&&(this.parent.viewport.leftIndex=f,this.parent.viewport.leftIndex-=this.parent.hiddenCount(c,d)),this.parent.viewport.rightIndex=d,p!==this.parent.viewport.leftIndex||c!==this.parent.viewport.rightIndex?this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}):this.parent.notify("updateTableWidth",{refresh:"Column"}),void this.parent.selectRange(n.selectedRange)}}if(i.length<=this.parent.getThreshold("col")){var v=this.parent.skipHidden(this.parent.viewport.rightIndex+1,this.parent.viewport.rightIndex+i.length,"columns");this.parent.viewport.rightIndex=v[1],this.parent.renderModule.refreshUI({rowIndex:this.parent.viewport.topIndex,colIndex:v[0],direction:"",refresh:"ColumnPart"},""+m([this.parent.viewport.topIndex,v[0],this.parent.viewport.bottomIndex,v[1]]))}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"})}this.parent.selectRange(n.selectedRange)}else{if(a.length){if(a.sort(function(e,t){return e-t}),this.parent.scrollSettings.enableVirtualization&&a[0]<this.parent.getThreshold("col")){var y=u(n.topLeftCell)[0]+1;this.parent.setSheetPropertyOnMute(n,"topLeftCell","A"+y),this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:this.parent.viewport.topIndex,colIndex:0,refresh:"Column"}),this.parent.selectRange(n.selectedRange)}else this.parent.goTo(g(this.parent.viewport.topIndex,a[0]));return}i.length<=this.parent.getThreshold("col")||!this.parent.scrollSettings.enableVirtualization?(this.appendCell(n,i),this.parent.scrollSettings.enableVirtualization&&this.parent.notify("virtualContentLoaded",{refresh:"Column",prevRowColCnt:{rowCount:n.rowCount,colCount:n.colCount}})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}),this.parent.selectRange(n.selectedRange)}},e.prototype.removeCell=function(e,r){var n,i,a,o,s,l,h=this,d=0,p=this.parent.getViewportIndex(r[0],!0)+1;this.parent.scrollSettings.enableVirtualization?(n=this.parent.viewport.topIndex,i=this.parent.viewport.bottomIndex):(n=0,i=e.rowCount-1);var c,u=this.parent.getContentTable(),f=u.getElementsByTagName("colgroup")[0];if(e.showHeaders){var g=this.parent.getColHeaderTable();s=g.getElementsByTagName("colgroup")[0],a=g.rows[0]}for(var m=r.length-1;n<=i;)be(e,n)?n++:(o=u.rows[d],r.forEach(function(i,u){if(t.detach(o.cells[p]),0===d&&(e.showHeaders&&(t.detach(a.cells[p]),t.detach(s.children[p])),t.detach(f.children[p])),0===u&&void 0!==(l=$(n,i,e)||{}).colSpan&&(void 0===l.rowSpan||l.colSpan>1)&&h.parent.notify("hiddenMerge",{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m]}),u===m){c=yt(e,i+1,!0,"columns");var g=h.parent.getCellStyleValue(["borderLeft"],[d,c]).borderLeft;""!==g&&h.parent.notify(It,{onActionUpdate:!1,rowIdx:d,colIdx:c,style:{borderLeft:g},row:o,first:""}),void 0!==(l=$(n,i,e)||{}).colSpan&&(void 0===l.rowSpan||l.colSpan>1)&&h.parent.notify("hiddenMerge",{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m],isEnd:!0})}}),n++,d++);p-1>-1&&e.showHeaders&&a.cells[p-1]&&a.cells[p-1].classList.add("e-hide-start"),a.cells[p]&&a.cells[p].classList.add("e-hide-end")},e.prototype.appendCell=function(e,r){var n,i,a,o,s,l,h=this,d=0;this.parent.scrollSettings.enableVirtualization?(n=this.parent.viewport.topIndex,i=this.parent.viewport.bottomIndex):(n=0,i=e.rowCount-1);var p=this.parent.getContentTable(),c=this.parent.getColHeaderTable(),u=p.getElementsByTagName("colgroup")[0];e.showHeaders&&(s=c.getElementsByTagName("colgroup")[0],a=c.rows[0]);var f=this.parent.serviceLocator.getService("cell");r.sort(function(e,t){return e-t});for(var m,v,y,C=[],b=[],S=r.length-1;n<=i;)be(e,n)?n++:(o=p.rows[d],r.forEach(function(i,p){if(0===d&&(b[p]=h.parent.getViewportIndex(i,!0),u.children[b[p]]?(u.insertBefore(h.parent.sheetModule.updateCol(e,i),u.children[b[p]]),e.showHeaders&&(y=a.cells[b[p]],0===p&&r[p]&&!Ae(e,r[p]-1)&&y.previousElementSibling.classList.remove("e-hide-start"),a.insertBefore(f.renderColHeader(i),y),p===S&&y.classList.remove("e-hide-end"))):(u.appendChild(h.parent.sheetModule.updateCol(e,i)),e.showHeaders&&a.appendChild(f.renderColHeader(i))),t.detach(u.lastChild),e.showHeaders&&(t.detach(a.lastChild),p===S&&(t.detach(s),c.insertBefore(u.cloneNode(!0),c.tHead[0])))),t.detach(o.lastChild),y=o.cells[b[p]],v=f.render({rowIdx:n,colIdx:i,cell:$(n,i,e),address:g(n,i),lastCell:i===S,isHeightCheckNeeded:!0,first:i!==yt(e,0,!0,"columns")&&i===h.parent.viewport.leftIndex?"Column":"",checkNextBorder:p===S?"Column":""}),y?o.insertBefore(v,y):o.appendChild(v),0===p&&v.previousSibling&&""!==h.parent.getCellStyleValue(["borderLeft"],[d,yt(e,r[r.length-1]+1,!0,"columns")]).borderLeft&&(l=yt(e,r[0]-1,!1,"columns"))>-1&&!h.parent.getCellStyleValue(["borderRight"],[d,l]).borderRight&&!h.parent.getCellStyleValue(["borderLeft"],[d,r[0]]).borderLeft&&(v.previousSibling.style.borderRight=""),void 0!==(m=$(d,i,e)||{}).colSpan&&(void 0===m.rowSpan||m.colSpan>1)){var x={range:[d,i,d,i],isAction:!1,merge:!0,type:"All",skipChecking:!0};h.parent.notify("activeCellMergedRange",x),C.length&&x.range[1]===C[C.length-1].range[1]||C.push(x)}}),n++,d++);C.forEach(function(e){h.parent.notify(Ht,e)}),this.parent.viewport.rightIndex=yt(e,this.parent.viewport.rightIndex-r.length,!1,"columns")},e.prototype.addEventListener=function(){this.parent.on(er,this.hideShow,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(er,this.hideShow),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),Wn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("initiateHyperlink",this.initiateHyperlinkHandler,this),this.parent.on("editHyperlink",this.editHyperlinkHandler,this),this.parent.on("openHyperlink",this.openHyperlinkHandler,this),this.parent.on(Gt,this.hyperlinkClickHandler,this),this.parent.on("createHyperlinkElement",this.createHyperlinkElementHandler,this),this.parent.on(Yt,this.keyUpHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiateHyperlink",this.initiateHyperlinkHandler),this.parent.off("editHyperlink",this.editHyperlinkHandler),this.parent.off("openHyperlink",this.openHyperlinkHandler),this.parent.off(Gt,this.hyperlinkClickHandler),this.parent.off("createHyperlinkElement",this.createHyperlinkElementHandler),this.parent.off(Yt,this.keyUpHandler))},e.prototype.getModuleName=function(){return"spreadsheetHyperlink"},e.prototype.keyUpHandler=function(e){var r=e.target;if(t.closest(r,".e-document")){var n=document.querySelector(".e-hyp-text"),i=this.parent.element.querySelector(".e-hyperlink-alert-span"),a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;n&&n.value&&(j(n.value.toUpperCase())?i&&(i.remove(),a.removeAttribute("disabled")):(this.showDialog(),a.setAttribute("disabled","true")))}if(r.classList.contains("e-text")&&t.closest(r,".e-cont")&&t.closest(r,".e-webpage")&&t.closest(r,".e-webpage").getElementsByClassName("e-cont")[1]===r.parentElement){a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):!!t.closest(r,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||a.setAttribute("disabled","true")}},e.prototype.initiateHyperlinkHandler=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.getActiveSheet();if(r.isProtected&&!r.protectSettings.insertLink)return void this.parent.notify("editAlert",null);if(!this.parent.element.querySelector(".e-hyperlink-dlg")){var n=this.parent.serviceLocator.getService(Ai);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-hyperlink-dlg",header:t.getConstant("InsertLink"),beforeOpen:function(t){var r={dialogName:"InsertLinkDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),n.dialogInstance.content=e.hyperlinkContent(),n.dialogInstance.dataBind(),Ct(e.parent.element)},open:function(){setTimeout(function(){Ct(n.dialogInstance.element.querySelectorAll(".e-webpage input")[1])})},buttons:[{buttonModel:{content:t.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){e.dlgClickHandler(),n.hide()}}]})}},e.prototype.dlgClickHandler=function(){var e,t,r=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(r)if(r.querySelector(".e-webpage")){e=r.getElementsByClassName("e-cont")[0].querySelector(".e-text").value;o={address:t=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,e,!1)}else{e=r.getElementsByClassName("e-cont")[0].querySelector(".e-text").value,t=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;var n=r.getElementsByClassName("e-cont")[2];if(n.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){o={address:t=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent+"!"+t.toUpperCase()};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,e,!1)}else if(n.querySelector(".e-active"))for(var i=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,a=0;a<this.parent.definedNames.length;a++)if(this.parent.definedNames[a].name===i){var o={address:this.parent.definedNames[a].name};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,e,!1)}}},e.prototype.showDialog=function(){this.parent.element.querySelector(".e-hyperlink-alert-span")&&this.parent.element.querySelector(".e-hyperlink-alert-span").remove();var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("span",{className:"e-hyperlink-alert-span",innerHTML:e.getConstant("HyperlinkAlert")});(this.parent.element.querySelector(".e-hyperlink-dlg")||this.parent.element.querySelector(".e-edithyperlink-dlg")).querySelector(".e-dlg-content").appendChild(t)},e.prototype.editHyperlinkHandler=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.serviceLocator.getService(Ai);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-edithyperlink-dlg",header:t.getConstant("EditLink"),beforeOpen:function(t){var n={dialogName:"EditLinkDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.hyperEditContent(),r.dialogInstance.dataBind(),Ct(e.parent.element)},open:function(){setTimeout(function(){Ct(r.dialogInstance.element.querySelector(".e-webpage")?r.dialogInstance.element.querySelectorAll(".e-webpage input")[1]:r.dialogInstance.element.querySelectorAll(".e-document input")[1])})},buttons:[{buttonModel:{content:t.getConstant("Update"),isPrimary:!0},click:function(){e.dlgClickHandler(),r.hide()}}]})},e.prototype.openHyperlinkHandler=function(){var e=u(this.parent.getActiveSheet().activeCell),t=this.parent.getCell(e[0],e[1]);t.getElementsByClassName("e-hyperlink")[0]&&(t=t.querySelector(".e-hyperlink")),this.hlOpenHandler(t)},e.prototype.hlOpenHandler=function(e){var r=this;if(e.classList.contains("e-hyperlink")){var n=["",""],i=void 0,a=!0;e.style.color="#551A8B",t.closest(e,".e-cell")&&(t.closest(e,".e-cell").style.color="#551A8B");var o=this.parent.getActiveSheet(),s=parseInt(e.parentElement.getAttribute("aria-colindex"),10)-1,l=parseInt(e.parentElement.parentElement.getAttribute("aria-rowindex"),10)-1,h=o.rows[l].cells[s].hyperlink,d=void 0,p={hyperlink:h,cell:this.parent.getActiveSheet().activeCell,target:"_blank",cancel:!1};if(this.parent.trigger("beforeHyperlinkClick",p),p.cancel)return;var u={hyperlink:h=p.hyperlink,cell:this.parent.getActiveSheet().activeCell};"string"==typeof h&&(d=h),"object"==typeof h&&(d=h.address);var f=d;if(-1===d.indexOf("http://")&&-1===d.indexOf("https://")&&-1===d.indexOf("ftp://")){if(!t.isNullOrUndefined(d)){if(this.parent.definedNames)for(v=0;v<this.parent.definedNames.length;v++)if(this.parent.definedNames[v].name===d){d=(d=this.parent.definedNames[v].refersTo).slice(1);break}-1!==d.indexOf("!")?-1!==(n=d.split("!"))[0].indexOf(" ")&&(n[0]=n[0].slice(1,n[0].length-1)):(n[0]=this.parent.getActiveSheet().name,n[1]=d);for(var g,v=0;v<this.parent.sheets.length;v++)this.parent.sheets[v].name===n[0]&&(g=v);if(o=this.parent.sheets[g],-1!==n[1].indexOf(":")){var y=n[1].indexOf(":"),C=n[1].substr(0,y),b=n[1].substr(y+1,n[1].length);C=C.replace("$",""),(b=b.replace("$","")).match(/\D/g)&&!b.match(/[0-9]/g)&&C.match(/\D/g)&&!C.match(/[0-9]/g)?(C+="1",b+=o.rowCount,n[1]=C+":"+b):!b.match(/\D/g)&&b.match(/[0-9]/g)&&!C.match(/\D/g)&&C.match(/[0-9]/g)&&(i=[parseInt(C,10)-1,0,parseInt(b,10)-1,o.colCount-1],a=!1)}var S=void 0,x=this.parent.definedNames;if(!t.isNullOrUndefined(x))for(v=0;v<x.length;v++)if(x[v].name===f){S=!0;break}if(j(n[1])||S){if(i=a?c(n[1]):i,this.parent.scrollSettings.enableVirtualization&&(i[0]=i[0]>=this.parent.viewport.topIndex?i[0]-this.parent.viewport.topIndex:i[0],i[1]=i[1]>=this.parent.viewport.leftIndex?i[1]-this.parent.viewport.leftIndex:i[1]),!t.isNullOrUndefined(o)){var w=m(i);if(o===this.parent.getActiveSheet())Le(function(){r.parent.goTo(w)});else{if(w.indexOf(":")>=0){var I=w.split(":");w=I[0]===I[1]?I[0]:w}Le(function(){r.parent.goTo(r.parent.sheets[g].name+"!"+w)})}}}else this.showInvalidHyperlinkDialog()}}else this.isValidUrl(d)?window.open(d,p.target):this.showInvalidHyperlinkDialog();this.parent.trigger("afterHyperlinkClick",u)}},e.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},e.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(Ai),t=this.parent.serviceLocator.getService(ki);e.show({width:323,isModal:!0,showCloseIcon:!0,header:t.getConstant("Hyperlink"),content:t.getConstant("InvalidHyperlinkAlert"),buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.hide()}}]},!1)},e.prototype.hyperlinkClickHandler=function(e){var r=e.target;if(t.closest(r,".e-link-dialog")&&t.closest(r,".e-toolbar-item")){var n=(c=(p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0]).firstChild,i=p.querySelector(".e-document"),a=p.querySelector(".e-webpage"),o=a?a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value,s=i?i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:o;if(t.closest(r,".e-toolbar-items").getElementsByClassName("e-toolbar-item")[1].classList.contains("e-active")){var l=i.querySelectorAll(".e-cont")[2].querySelector(".e-active");i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=o,t.closest(l,".e-list-item").classList.contains("e-level-2")&&n.hasAttribute("disabled")?n.removeAttribute("disabled"):t.closest(l,".e-list-item").classList.contains("e-level-1")&&!n.hasAttribute("disabled")&&n.setAttribute("disabled","true")}else{var h=!a.querySelectorAll(".e-cont")[1].querySelector(".e-text").value;a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=s,h&&!n.hasAttribute("disabled")?n.setAttribute("disabled","true"):!h&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")}}if(t.closest(r,".e-list-item")&&r.classList.contains("e-fullrow")){var d=this.parent.element.getElementsByClassName("e-link-dialog")[0].getElementsByClassName("e-content")[0].getElementsByClassName("e-active")[0].getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0],p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg"),c=p.getElementsByClassName("e-footer-content")[0],n=c.firstChild;t.closest(r,".e-list-item").classList.contains("e-level-2")?("defName"===t.closest(r,".e-list-item").getAttribute("data-uid")?d.classList.contains("e-disabled")||d.hasAttribute("readonly")||(d.setAttribute("readonly","true"),d.classList.add("e-disabled"),d.setAttribute("disabled","true")):"sheet"===t.closest(r,".e-list-item").getAttribute("data-uid")&&d.classList.contains("e-disabled")&&d.hasAttribute("readonly")&&(d.removeAttribute("readonly"),d.classList.remove("e-disabled"),d.removeAttribute("disabled")),n.hasAttribute("disabled")&&n.removeAttribute("disabled")):t.closest(r,".e-list-item").classList.contains("e-level-1")&&n.setAttribute("disabled","true")}else this.hlOpenHandler(r)},e.prototype.createHyperlinkElementHandler=function(e){var r=e.cell,n=e.td,i=this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"});if(i.style.color="#00e",t.isNullOrUndefined(r.hyperlink))n.querySelector("a")&&r.hyperlink&&"string"==typeof r.hyperlink&&n.querySelector("a").setAttribute("href",r.hyperlink);else{var a=r.hyperlink;"string"==typeof a?(-1===a.indexOf("http://")&&-1===a.indexOf("https://")&&-1===a.indexOf("ftp://")&&-1!==a.indexOf("www.")&&(a="http://"+a),0===a.indexOf("http://")||0===a.indexOf("https://")||0===a.indexOf("ftp://")?(i.setAttribute("href",a),i.setAttribute("target","_blank")):(a.includes("=")||a.includes("!"))&&i.setAttribute("ref",a),i.innerText=""!==n.innerText?n.innerText:a,n.textContent="",n.innerText="",n.appendChild(i)):"object"==typeof a&&(0===a.address.indexOf("http://")||0===a.address.indexOf("https://")||0===a.address.indexOf("ftp://")?(i.setAttribute("href",a.address),i.setAttribute("target","_blank")):(a.address.includes("=")||a.address.includes("!"))&&i.setAttribute("ref",a.address),"Accounting"===H(r.format)?i.innerHTML=n.innerHTML:i.innerText=""!==n.innerText?n.innerText:a.address,n.textContent="",n.innerText="",n.appendChild(i))}},e.prototype.hyperEditContent=function(){var e=!0,t=this.hyperlinkContent(),r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]].cells[r[1]];this.parent.scrollSettings.enableVirtualization&&(r[0]=r[0]-this.parent.viewport.topIndex,r[1]=r[1]-this.parent.viewport.leftIndex);var i,a=this.parent.getDisplayText(n),o=n.hyperlink;"string"==typeof o?(i=o,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1)):"object"==typeof o&&(i=o.address,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1));for(var s=0,l=0,h=this.parent.definedNames,d=this.parent.sheets,p=0,u=h.length;p<u;p++)h[p].name===i&&s++;for(var p=0,u=d.length;p<u;p++)i.includes(d[p].name)&&l++;0===s&&0===l&&(e=!0);var f=t.querySelector(".e-content");if(e){var g=f.querySelector(".e-webpage");g.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",a),"string"==typeof o?g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o):g.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",o.address)}else{var m=void 0,v=f.querySelector(".e-document");v.getElementsByClassName("e-cont")[0].getElementsByClassName("e-text")[0].setAttribute("value",a);var y=void 0;if(this.parent.definedNames)for(p=0;p<this.parent.definedNames.length;p++)if(this.parent.definedNames[p].name===i){m=!0;break}if(m){var C=v.getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0];C.setAttribute("readonly","true"),C.classList.add("e-disabled"),C.setAttribute("disabled","true");for(var b=(x=v.getElementsByClassName("e-cont")[2]).querySelectorAll(".e-list-item.e-level-1")[1],p=0;p<b.getElementsByTagName("li").length;p++)b.getElementsByTagName("li")[p].innerText===i&&b.getElementsByTagName("li")[p].classList.add("e-active")}else{i&&-1!==i.indexOf("!")&&(y=i.split("!"));var S=y[0];v.getElementsByClassName("e-cont")[1].querySelector(".e-text").setAttribute("value",y[1]);for(var x=v.getElementsByClassName("e-cont")[2],b=x.querySelectorAll(".e-list-item.e-level-1")[0],p=0;p<b.getElementsByTagName("li").length;p++)if(b.getElementsByTagName("li")[p].innerText===S){if(b.getElementsByTagName("li")[p].classList.contains("e-active"))break;b.getElementsByTagName("li")[p].classList.add("e-active")}else b.getElementsByTagName("li")[p].classList.contains("e-active")&&b.getElementsByTagName("li")[p].classList.remove("e-active")}}return t},e.prototype.hyperlinkContent=function(){var e,r,i=this.parent.serviceLocator.getService(ki),a=0,o=0,s=!0,l=!0,h=c(this.parent.getActiveSheet().activeCell),d=this.parent.getActiveSheet(),p=$(h[0],h[1],d),u=!0;if(p){u=!!(p.value&&"string"==typeof p.value&&null!==p.value.match("[A-Za-z]+")||""===p.value||t.isNullOrUndefined(p.value));var f=p.hyperlink;if("string"==typeof f)-1===(g=f).indexOf("http://")&&-1===g.indexOf("https://")&&-1===g.indexOf("ftp://")&&(r=f,s=!1);else if("object"==typeof f){var g=f.address;-1===g.indexOf("http://")&&-1===g.indexOf("https://")&&-1===g.indexOf("ftp://")&&(r=f.address,s=!1)}if(r){for(var m=0,v=0,y=this.parent.definedNames,C=this.parent.sheets,b=0,S=C.length;b<S;b++)r.includes(C[b].name)&&v++;for(var x=0,S=y.length;x<S;x++)y[x].name===r&&m++;0===m&&0===v&&(s=!0)}if(o=s?0:1,this.parent.definedNames)for(var w=0;w<this.parent.definedNames.length;w++)if(this.parent.definedNames[w].name===r){e=!0,l=!1;break}}var I=this.parent.createElement("div",{className:"e-link-dialog"}),E=this.parent.createElement("div",{className:"e-webpage"}),R=this.parent.createElement("div",{className:"e-document"});new n.Tab({selectedItem:o,items:[{header:{text:i.getConstant("WebPage")},content:E},{header:{text:i.getConstant("ThisDocument")},content:R}]}).appendTo(I),s?I.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 0; right: 136px"):I.querySelector(".e-toolbar-items").querySelector(".e-indicator").setAttribute("style","left: 136px; right: 0");var k=this.parent.createElement("div",{className:"e-cont"}),A=this.parent.createElement("div",{className:"e-cont"}),T=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("DisplayText")}),F=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("Url")}),L=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(L.classList.add("e-disabled"),L.setAttribute("readonly","true"),L.setAttribute("disabled","true")),p&&t.isNullOrUndefined(p.hyperlink)&&L.setAttribute("value",this.parent.getDisplayText(p));var N=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});L.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),N.setAttribute("placeholder",i.getConstant("EnterTheUrl")),k.appendChild(L),k.insertBefore(T,L),A.appendChild(N),A.insertBefore(F,N),E.appendChild(A),E.insertBefore(k,A);var D=[],O=[],H=this.parent.sheets;for(a;a<this.parent.sheets.length;a++){var B=this.parent.sheets[a].name;H[a]===this.parent.getActiveSheet()?D.push({nodeId:"sheet",nodeText:-1!==B.indexOf(" ")?"'"+B+"'":B,selected:!0}):D.push({nodeId:"sheet",nodeText:-1!==B.indexOf(" ")?"'"+B+"'":B})}for(a=0;a<this.parent.definedNames.length;a++)O.push({nodeId:"defName",nodeText:this.parent.definedNames[a].name});var M=[{nodeId:"01",nodeText:i.getConstant("CellReference"),expanded:l,nodeChild:D},{nodeId:"02",nodeText:i.getConstant("DefinedNames"),expanded:e,nodeChild:O}],P=new n.TreeView({fields:{dataSource:M,id:"nodeId",text:"nodeText",child:"nodeChild"}}),_=this.parent.createElement("div",{className:"e-cont"}),U=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("CellReference")}),V=this.parent.createElement("input",{className:"e-input e-text e-hyp-text",attrs:{type:"Text"}});V.setAttribute("value","A1"),_.appendChild(V),_.insertBefore(U,V);var z=this.parent.createElement("div",{className:"e-cont"}),q=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("DisplayText")}),j=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"Text"}});u||(j.classList.add("e-disabled"),j.setAttribute("readonly","true"),j.setAttribute("disabled","true")),p&&t.isNullOrUndefined(p.hyperlink)&&j.setAttribute("value",this.parent.getDisplayText(p)),j.setAttribute("placeholder",i.getConstant("EnterTheTextToDisplay")),z.appendChild(j),z.insertBefore(q,j);var W=this.parent.createElement("div",{className:"e-cont"}),G=this.parent.createElement("div",{className:"e-header",innerHTML:i.getConstant("Sheet")}),Y=this.parent.createElement("div",{className:"e-refcont"});return W.appendChild(Y),W.insertBefore(G,Y),R.appendChild(_),R.insertBefore(z,_),P.appendTo(Y),R.appendChild(W),I},e}(),Gn=function(){function e(e){this.undoCollection=[],this.redoCollection=[],this.isUndo=!1,this.undoRedoStep=100,this.parent=e,this.addEventListener()}return e.prototype.setActionData=function(e){var t,r=this.parent.getActiveSheet(),n=[],i=[],a=e.args,o=a.eventArgs,s={};switch(a.action){case"format":t=c(a.eventArgs.range);break;case"clipboard":s=o.copiedInfo,t=c(C(o.pastedRange)),s.isCut&&(i=this.getCellDetails(s.range,ce(this.parent,oe(this.parent,s.sId))));break;case"beforeSort":(t=c(a.eventArgs.range))[0]===t[2]&&t[2]-t[0]==0&&(t[0]=0,t[1]=0,t[2]=r.usedRange.rowIndex,t[3]=r.usedRange.colIndex);break;case"beforeCellSave":case"cellDelete":t=c(o.address);break;case"beforeWrap":case"beforeReplace":t=this.parent.getAddressInfo(o.address).indices;break;case"beforeClear":case"beforeInsertImage":case"beforeInsertChart":case"filter":t=c(o.range)}n=this.getCellDetails(t,r),this.beforeActionData={cellDetails:n,cutCellDetails:i}},e.prototype.getBeforeActionData=function(e){e.beforeDetails=this.beforeActionData},e.prototype.performUndoRedo=function(e){var r=e.isUndo?this.undoCollection.pop():this.redoCollection.pop();if(this.isUndo=e.isUndo,r){switch(r.action){case"cellSave":case"format":case"sorting":case"wrap":case"cellDelete":r=this.performOperation(r);break;case"clipboard":r=this.undoForClipboard(r);break;case"resize":r=this.undoForResize(r);break;case"hideShow":r.eventArgs.hide=!r.eventArgs.hide,ot(r,this.parent);break;case"replace":r=this.performOperation(r);break;case"insert":case"filter":case"delete":case"validation":ot(r,this.parent,!e.isUndo);break;case"merge":r.eventArgs.merge=!r.eventArgs.merge,ot(r,this.parent);break;case"clear":r=this.performOperation(r);break;case"conditionalFormat":case"clearCF":case"insertImage":case"imageRefresh":ot(r,this.parent,!e.isUndo);break;case"insertChart":case"deleteChart":case"chartRefresh":ot(r,this.parent,!e.isUndo)}e.isUndo?this.redoCollection.push(r):this.undoCollection.push(r),this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons();var n=Object.assign({},r.eventArgs);n.requestType=e.isUndo?"undo":"redo",delete n.beforeActionData,e.isPublic||(this.parent.notify("triggerDataChange",t.extend({isUndo:e.isUndo},r,null,!0)),this.parent.notify(nr,{eventArgs:n,action:"undoRedo"})),this.parent.notify("refreshRibbonIcons",null)}},e.prototype.updateUndoRedoCollection=function(e){var t=["clipboard","format","sorting","cellSave","resize","resizeToFit","wrap","hideShow","replace","validation","merge","clear","conditionalFormat","clearCF","insertImage","imageRefresh","insertChart","deleteChart","chartRefresh","filter","cellDelete"];"insert"!==e.args.action&&"delete"!==e.args.action||"Sheet"===e.args.eventArgs.modelType||t.push(e.args.action);var r=e.args.action;if(-1!==t.indexOf(r)||e.isPublic){var n=e.args.eventArgs;if("clipboard"===r||"sorting"===r||"format"===r||"cellSave"===r||"wrap"===r||"replace"===r||"validation"===r||"clear"===r||"conditionalFormat"===r||"clearCF"===r||"insertImage"===r||"imageRefresh"===r||"insertChart"===r||"chartRefresh"===r||"filter"===r||"cellDelete"===r){var i={beforeDetails:{cellDetails:[]}};this.parent.notify("getBeforeActionData",i),n.beforeActionData=i.beforeDetails}this.undoCollection.push(e.args),this.redoCollection=[],this.undoCollection.length>this.undoRedoStep&&this.undoCollection.splice(0,1),this.updateUndoRedoIcons()}},e.prototype.clearUndoRedoCollection=function(){this.undoCollection=[],this.redoCollection=[],this.updateUndoRedoIcons()},e.prototype.updateUndoRedoIcons=function(){var e=this.parent.serviceLocator.getService(ki);this.parent.notify("enableToolbarItems",[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:this.undoCollection.length>0}]),this.parent.notify("enableToolbarItems",[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_redo"],enable:this.redoCollection.length>0}])},e.prototype.undoForClipboard=function(e){var t,r=this,n=e.eventArgs,i=n.pastedRange.split("!"),a=c(i[1]),o=ae(this.parent,i[0]),s=ce(this.parent,o),l=n.copiedInfo,h=n.beforeActionData,d=this.checkRefreshNeeded(o);if("imagePaste"===e.eventArgs.requestType){var p=n.copiedShapeInfo;this.isUndo?(t=p.pictureElem,p.isCut?(this.parent.notify(pr,{id:t.id,sheetIdx:n.pasteSheetIndex+1}),this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:p.height,width:p.width,imageId:t.id},range:p.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(pr,{id:n.pastedPictureElement.id,sheetIdx:n.pasteSheetIndex+1})):p.isCut?(t=p.pictureElem,this.parent.notify(pr,{id:t.id,sheetIdx:p.sId}),this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:p.height,width:p.width,imageId:t.id},range:p.pastedRange,isPublic:!1,isUndoRedo:!0})):(t=n.pastedPictureElement,this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:t.offsetHeight,width:t.offsetWidth,imageId:t.id},range:p.pastedRange,isPublic:!1,isUndoRedo:!0}))}else{if(this.isUndo){if(l.isCut){var u=h.cutCellDetails;this.updateCellDetails(u,ce(this.parent,oe(this.parent,l.sId)),x(l.range),d),this.parent.notify("getFilteredCollection",null);for(var f=0;f<this.parent.sheets.length;f++){var g=oe(this.parent,l.sId);if(this.parent.filterCollection&&this.parent.filterCollection[f]&&this.parent.filterCollection[f].sheetIndex===n.pasteSheetIndex){var v=this.parent.filterCollection[f],y=c(v.filterRange),C=x(a);if(y[0]>=C[0]&&y[2]<=C[2]){this.parent.notify(rr,{predicates:null,range:v.filterRange,sIdx:n.pasteSheetIndex,isCut:!0});var b=[Math.abs(C[0]-y[0]),Math.abs(C[1]-y[1]),Math.abs(C[2]-y[2]),Math.abs(C[3]-y[3])],S=x(l.range);b=[S[0]+b[0],S[1]+b[1],Math.abs(S[2]-b[2]),Math.abs(S[3]-b[3])],this.parent.notify(rr,{predicates:null,range:m(b),sIdx:g,isCut:!0})}}}}h&&this.updateCellDetails(h.cellDetails,s,a,d),mt(s,a[0],a[1],20);var w=vt(s,a[0]);lt(this.parent,s,w,a[0]),n.mergeCollection.forEach(function(e){e.merge=!e.merge,r.parent.notify(Ht,e),e.merge=!e.merge})}else ot(e,this.parent,l.isCut);d&&this.parent.notify("selectRange",{address:i[1]})}return e},e.prototype.undoForResize=function(e){var t=e.eventArgs;if(void 0===t.hide)if(t.isCol){r=t.oldWidth;t.oldWidth=t.width,t.width=r}else{var r=t.oldHeight;t.oldHeight=t.height,t.height=r}else t.hide=!t.hide;ot(e,this.parent);var n=this.parent.getActiveSheet(),i=c(n.activeCell),a=$(i[0],i[1],n);if(a&&a.rowSpan){o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.height=o.offsetHeight+"px"}else if(a&&a.colSpan){var o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.width=o.offsetWidth+"px"}return e},e.prototype.performOperation=function(e){var t=e.eventArgs,r="cellSave"===e.action||"wrap"===e.action||"replace"===e.action||"cellDelete"===e.action?t.address.split("!"):t.range.split("!"),n=c(r[1]),i=n,a=ae(this.parent,r[0]),o=ce(this.parent,a),s=t.beforeActionData,l=this.checkRefreshNeeded(a);if(this.isUndo)this.updateCellDetails(s.cellDetails,o,n,l,e);else{var h=e.eventArgs,d=c(o.activeCell),p=this.parent.getCellStyleValue(["textDecoration"],d).textDecoration;if(h&&h.style&&h.style.textDecoration){var u=h.style.textDecoration,f=u,g=void 0,m=!1;"underline"===p?f="underline"===u?"none":"underline line-through":"line-through"===p?f="line-through"===u?"none":"underline line-through":"underline line-through"===p&&(f="underline"===u?"line-through":"underline",m=!0),"none"===f&&(m=!0),h.style.textDecoration=f,e.eventArgs=h,this.parent.notify(wt,{style:{textDecoration:f},range:d,refreshRibbon:!0,onActionUpdate:!0});for(var v=i[0];v<=i[2];v++)for(var y=i[1];y<=i[3];y++)if(v!==d[0]||y!==d[1]){if(g={},"none"===(p=this.parent.getCellStyleValue(["textDecoration"],[v,y]).textDecoration)){if(m)continue;g.textDecoration=u}else if("underline"===p||"line-through"===p)if(m){if(u!==p)continue;g.textDecoration="none"}else g.textDecoration=u!==p?"underline line-through":u;else if("underline line-through"===p){if(!m)continue;g.textDecoration="underline"===u?"line-through":"underline"}this.parent.notify(wt,{style:{textDecoration:g.textDecoration},range:[v,y,v,y],refreshRibbon:!0,onActionUpdate:!0})}h.style.textDecoration=u,e.eventArgs=h}else ot(e,this.parent,!0)}return l&&this.parent.notify("selectRange",{address:r[1]}),e},e.prototype.getCellDetails=function(e,t){for(var r,n=[],i=(e=x(e))[0];i<=e[2];i++)for(var a=e[1];a<=e[3];a++)r=$(i,a,t),n.push({rowIndex:i,colIndex:a,format:r?r.format:null,isLocked:r?r.isLocked:null,style:r&&r.style?Object.assign({},r.style):null,value:r?r.value:"",formula:r?r.formula:"",wrap:r&&r.wrap,rowSpan:r&&r.rowSpan,colSpan:r&&r.colSpan,hyperlink:r&&r.hyperlink,image:r&&r.image&&r.chart});return n},e.prototype.updateCellDetails=function(e,r,n,i,a){for(var o,s=e.length,l=0;l<s;l++)Z(e[l].rowIndex,e[l].colIndex,r,{value:e[l].value,format:e[l].format,isLocked:e[l].isLocked,style:e[l].style&&Object.assign({},e[l].style),formula:e[l].formula,wrap:e[l].wrap,rowSpan:e[l].rowSpan,colSpan:e[l].colSpan,hyperlink:e[l].hyperlink}),this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:[e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex],value:e[l].formula?e[l].formula:e[l].value}),a&&"wrap"===a.action&&a.eventArgs.wrap&&this.parent.notify(At,{range:[e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex],wrap:!1,sheet:r}),a&&e[l].hyperlink&&"clear"===a.action&&(a.eventArgs.range=r.name+"!"+m([e[l].rowIndex,e[l].colIndex,e[l].rowIndex,e[l].colIndex]),o=this.parent.getCell(e[l].rowIndex,e[l].colIndex),"Clear All"===a.eventArgs.type||"Clear Hyperlinks"===a.eventArgs.type?this.parent.addHyperlink(e[l].hyperlink,a.eventArgs.range):"Clear Formats"===a.eventArgs.type&&t.addClass(o.querySelectorAll(".e-hyperlink"),"e-hyperlink-style"));i&&this.parent.serviceLocator.getService("cell").refreshRange(n)},e.prototype.checkRefreshNeeded=function(e){var t=!0;return e!==this.parent.activeSheetIndex&&(this.parent.activeSheetIndex=e,this.parent.dataBind(),t=!1),t},e.prototype.addEventListener=function(){this.parent.on("performUndoRedo",this.performUndoRedo,this),this.parent.on("updateUndoRedoCollection",this.updateUndoRedoCollection,this),this.parent.on("setActionData",this.setActionData,this),this.parent.on("getBeforeActionData",this.getBeforeActionData,this),this.parent.on("clearUndoRedoCollection",this.clearUndoRedoCollection,this),this.parent.on("setUndoRedo",this.updateUndoRedoIcons,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("performUndoRedo",this.performUndoRedo),this.parent.off("updateUndoRedoCollection",this.updateUndoRedoCollection),this.parent.off("setActionData",this.setActionData),this.parent.off("getBeforeActionData",this.getBeforeActionData),this.parent.off("clearUndoRedoCollection",this.clearUndoRedoCollection),this.parent.off("setUndoRedo",this.updateUndoRedoIcons))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"undoredo"},e}(),Yn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("ribboClick",this.ribbonClickHandler,this),this.parent.on(At,this.wrapTextHandler,this),this.parent.on(Qt,this.rowHeightChangedHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("ribboClick",this.ribbonClickHandler),this.parent.off(At,this.wrapTextHandler),this.parent.off(Qt,this.rowHeightChangedHandler))},e.prototype.wrapTextHandler=function(e){if(Me(this.parent,e.range,!0))for(var r=void 0,n=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=e.range[0];l<=e.range[2];l++){o=0,a=ye(e.sheet,l).customHeight||e.isCustomHgt;for(var h=e.range[1];h<=e.range[3];h++)if(!((n=$(l,h,e.sheet,null,!0)).rowSpan<0||n.colSpan<0||((r=e.initial?e.td:this.parent.getCell(l,h))&&(e.wrap?r.classList.add(Ri):r.classList.remove(Ri),a&&(0!==r.children.length&&r.querySelector(".e-wrap-content")||(r.innerHTML=this.parent.createElement("span",{className:"e-wrap-content",innerHTML:r.innerHTML}).outerHTML))),t.Browser.isIE&&r.classList.add("e-ie-wrap"),a))){i=ft(e.sheet,l,h,n.colSpan>1?h+n.colSpan-1:h);var d=this.parent.getDisplayText(n);if(d.indexOf("\n")<0){var p=this.parent.element.querySelector(".e-spreadsheet-edit");p&&p.textContent.indexOf("\n")>-1&&(d=p.textContent)}if(d)if(e.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var c=void 0,u=0,f=void 0;if(d.indexOf("\n")>-1){var g=d.split("\n"),m=g.length;for(f=0;f<m;f++)0===(c=pt(g[f],i,n.style,this.parent.cellStyle))&&(c=1),u+=c;c=u}else c=pt(d,i,n.style,this.parent.cellStyle);if(s=gt(this.parent,l,h,e.sheet,n.style||this.parent.cellStyle,c),o=Math.max(o,s),n.rowSpan>1){var v=we(e.sheet,l,l+(n.rowSpan-1));if(v>=o)return;s=o=Se(e.sheet,l)+(o-v)}mt(e.sheet,l,h,s)}else d.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap"),s=gt(this.parent,l,h,e.sheet,n.style||this.parent.cellStyle,1),mt(e.sheet,l,h,s),o=Math.max(vt(e.sheet,l),20);else e.wrap||(mt(e.sheet,l,h,20),o=20);h===e.range[3]&&(e.wrap&&o>20&&vt(e.sheet,l)<=o||!e.wrap&&vt(e.sheet,l)<Se(e.sheet,l)&&Se(e.sheet,l)>20)&<(this.parent,e.sheet,o,l,e.row,e.hRow)}}},e.prototype.ribbonClickHandler=function(e){var r=t.closest(e.originalEvent.target,".e-btn");if(r&&r.id===this.parent.element.id+"_wrap"){var n=r.classList.contains("e-active"),i=b(this.parent.getActiveSheet()),a={address:i,wrap:n,cancel:!1};this.parent.notify(ir,{action:"beforeWrap",eventArgs:a}),a.cancel||(Q(this.parent.getActiveSheet().selectedRange,n,this.parent),this.parent.notify(nr,{action:"wrap",eventArgs:{address:i,wrap:n}}))}},e.prototype.rowHeightChangedHandler=function(e){if(e.isCustomHgt)for(var t=this.parent.getActiveSheet(),r=this.parent.viewport.leftIndex,n=r+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),i=r;i<n;i++){var a=$(e.rowIdx,i,t);if(a&&a.wrap){var o=this.parent.getCell(e.rowIdx,i);0!==o.children.length&&o.querySelector(".e-wrap-content")||(o.innerHTML=this.parent.createElement("span",{className:"e-wrap-content",innerHTML:o.innerHTML}).outerHTML)}}},e.prototype.getModuleName=function(){return"wrapText"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Xn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.insert=function(e){var t;switch(e.isAction&&(t=!0,delete e.isAction),t&&this.parent.notify(ir,{eventArgs:e,action:"insert"}),e.modelType){case"Sheet":this.parent.notify("insertSheetTab",{startIdx:e.index,endIdx:e.index+(e.model.length-1),preventUpdate:!t}),this.parent.renderModule.refreshSheet(),Ct(this.parent.element);break;case"Row":if(!this.parent.scrollSettings.enableVirtualization||e.index<=this.parent.viewport.bottomIndex){if(this.parent.scrollSettings.enableVirtualization){if(e.freezePane){this.parent.renderModule.refreshSheet();break}e.index<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex+=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.topIndex===yt(this.parent.getActiveSheet(),0,!0),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Row"})}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:e.index,colIndex:0,refresh:"Row"});this.parent.selectRange(this.parent.getActiveSheet().selectedRange)}break;case"Column":if(!this.parent.scrollSettings.enableVirtualization||e.index<=this.parent.viewport.rightIndex){if(e.freezePane){this.parent.renderModule.refreshSheet();break}this.parent.scrollSettings.enableVirtualization?(e.index<this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex+=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(this.parent.getActiveSheet(),0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"})):this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,rowIndex:0,colIndex:e.index,refresh:"Column"}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)}}this.refreshImgElement(e.model.length,this.parent.activeSheetIndex,e.modelType,e.index),t&&this.parent.notify(nr,{eventArgs:e,action:"insert"})},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],o=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],s=0;s<=o[2];s++)for(var l=o[1];l<=o[3];l++)(i=$(s,l,a))&&i.image&&i.image.length>0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify("refreshImagePosition",{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},e.prototype.addEventListener=function(){this.parent.on("insert",this.insert,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("insert",this.insert)},e.prototype.getModuleName=function(){return"insert"},e}(),Kn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.delete=function(e){var t;if(e.isAction&&(t=!0,delete e.isAction),t&&this.parent.notify(ir,{eventArgs:e,action:"delete"}),"Sheet"===e.modelType){var r=e.activeSheetIndex>=e.startIndex&&e.activeSheetIndex<=e.endIndex;r&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(e.startIndex<this.parent.sheets.length?e.startIndex:e.startIndex?e.startIndex-1:0)},!0),this.parent.notify("refreshSheetTabs",null),r&&this.parent.renderModule.refreshSheet(),Ct(this.parent.element)}else"Row"===e.modelType?(!this.parent.scrollSettings.enableVirtualization||e.startIndex<=this.parent.viewport.bottomIndex)&&(e.freezePane?this.parent.renderModule.refreshSheet():this.parent.scrollSettings.enableVirtualization?(e.startIndex<this.parent.viewport.topIndex&&(this.parent.viewport.topIndex-=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.topIndex===yt(this.parent.getActiveSheet(),0,!0),rowIndex:this.parent.viewport.topIndex,refresh:"Row",colIndex:this.parent.viewport.leftIndex}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Row",rowIndex:e.startIndex,colIndex:0}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange))):(!this.parent.scrollSettings.enableVirtualization||e.startIndex<=this.parent.viewport.rightIndex)&&(e.freezePane?this.parent.renderModule.refreshSheet():this.parent.scrollSettings.enableVirtualization?(e.startIndex<this.parent.viewport.leftIndex&&(this.parent.viewport.leftIndex-=e.model.length),this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(this.parent.getActiveSheet(),0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,refresh:"Column",colIndex:this.parent.viewport.leftIndex}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)):(this.parent.renderModule.refreshUI({skipUpdateOnFirst:!0,refresh:"Column",rowIndex:0,colIndex:e.startIndex}),this.parent.selectRange(this.parent.getActiveSheet().selectedRange)));this.refreshImgElement(e.deletedModel.length,this.parent.activeSheetIndex,e.modelType,e.startIndex),t&&this.parent.notify(nr,{eventArgs:e,action:"delete"})},e.prototype.refreshImgElement=function(e,t,r,n){for(var i,a=this.parent.sheets[t],o=[0,0,a.usedRange.rowIndex,a.usedRange.colIndex],s=0;s<=o[2];s++)for(var l=o[1];l<=o[3];l++)(i=$(s,l,a))&&i.image&&i.image.length>0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify("refreshImagePosition",{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})},e.prototype.addEventListener=function(){this.parent.on("delete",this.delete,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("delete",this.delete)},e.prototype.getModuleName=function(){return"delete"},e}(),$n=function(){function e(e){this.data=[],this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener();var e=t.select("#"+this.parent.element.id+"_datavalidation-popup");e&&e.remove(),this.parent=null},e.prototype.addEventListener=function(){t.EventHandler.add(this.parent.element,"dblclick",this.listOpen,this),t.EventHandler.add(document,"mousedown",this.mouseDownHandler,this),this.parent.on("initiatedatavalidation",this.initiateDataValidationHandler,this),this.parent.on("invalidData",this.invalidDataHandler,this),this.parent.on("isValidation",this.checkDataValidation,this),this.parent.on("activeCellChanged",this.listHandler,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on("removeDataValidation",this.removeValidationHandler,this),this.parent.on("validationHighlight",this.InvalidElementHandler,this)},e.prototype.removeEventListener=function(){t.EventHandler.remove(this.parent.element,"dblclick",this.listOpen),t.EventHandler.remove(document,"mousedown",this.mouseDownHandler),this.parent.isDestroyed||(this.parent.off("initiatedatavalidation",this.initiateDataValidationHandler),this.parent.off("invalidData",this.invalidDataHandler),this.parent.off("isValidation",this.checkDataValidation),this.parent.off("activeCellChanged",this.listHandler),this.parent.off(Yt,this.keyUpHandler),this.parent.off("removeDataValidation",this.removeValidationHandler),this.parent.off("validationHighlight",this.InvalidElementHandler))},e.prototype.removeValidationHandler=function(e){var t=this.getRange(this.parent.getActiveSheet().selectedRange);this.parent.removeDataValidation(t)},e.prototype.mouseDownHandler=function(e){var r=e.target,n=t.closest(r,".e-ddl");n&&n.getAttribute("id")===this.parent.element.id+"listValid_popup"&&this.parent.notify("formulaBarOperation",{action:"refreshFormulabar",value:r.innerText})},e.prototype.keyUpHandler=function(e){var r=e.target,n=this.parent.element.querySelector(".e-datavalidation-dlg");if(t.closest(r,".e-values")&&n&&13!==e.keyCode){var i=n.querySelector(".e-values"),a=i.querySelector(".e-dlg-error"),o=n.querySelector(".e-footer-content").querySelector(".e-primary");o.hasAttribute("disabled")&&o.removeAttribute("disabled"),a&&i.removeChild(a)}},e.prototype.listOpen=function(e){var t=e.target;this.listObj&&t.classList.contains("e-cell")&&t.querySelector(".e-validation-list")&&this.listObj.showPopup()},e.prototype.invalidDataHandler=function(e){e.isRemoveHighlight?this.parent.removeInvalidHighlight():this.parent.addInvalidHighlight()},e.prototype.listHandler=function(){var e=this;if(this.parent.allowDataValidation){var r=this.parent.getActiveSheet(),n=u(r.activeCell),i=$(n[0],n[1],r),a=Ie(r,n[1]),s=this.parent.getCell(n[0],n[1]),l=void 0;if(!s)return;if(document.getElementsByClassName("e-validation-list")[0]&&(t.remove(document.getElementsByClassName("e-validation-list")[0]),this.data=[]),i&&i.validation?l=i.validation:a&&a.validation&&(l=a.validation),l&&"List"===l.type&&(l.ignoreBlank=!!t.isNullOrUndefined(l.ignoreBlank)||l.ignoreBlank,l.inCellDropDown=!!t.isNullOrUndefined(l.inCellDropDown)||l.inCellDropDown,l.inCellDropDown)){var h=this.parent.createElement("div",{className:"e-validation-list"}),d=this.parent.createElement("input",{id:this.parent.element.id+"listValid"});h.appendChild(d),l.inCellDropDown||(h.style.display="none"),s.insertBefore(h,s.firstChild);var p=this.updateDataSource(i,l);this.listObj=new o.DropDownList({index:this.setDropDownListIndex(p,i,l),dataSource:p,fields:{text:"text",value:"id"},width:"0px",popupWidth:s.offsetWidth-1,popupHeight:"200px",change:function(){e.listValueChange(e.listObj.text)},open:function(e){e.popup.offsetX=4-(s.offsetWidth-20),e.popup.offsetY=-13}}),this.listObj.appendTo("#"+this.parent.element.id+"listValid")}i&&i.validation&&(i.validation=l)}},e.prototype.setDropDownListIndex=function(e,t,r){if(t&&t.value)for(var n=0,i=e.length;n<i;n++)if(e[n].text===t.value.toString())return n;return null},e.prototype.updateDataSource=function(e,t){this.data=[];var r=0,n=t.value1;if(-1!==n.indexOf("=")){var i=n.indexOf("!")>-1?ce(this.parent,ae(this.parent,n.split("=")[1].split("!")[0])):this.parent.getActiveSheet(),a=n.indexOf("!")>-1?n.split("!")[1]:n.split("=")[1],o=void 0,s=a.split(":");if(s[0].match(/[a-z]+$/gi)&&s[1].match(/[a-z]+$/gi)||s[0].match(/^[0-9]/g)&&s[1].match(/^[0-9]/g)){var l=this.parent.getIndexes(a);o=l.isCol?[0,l.startIdx,i.usedRange.rowIndex,l.startIdx]:[l.startIdx,0,l.startIdx,i.usedRange.colIndex]}else o=c(a);for(var h=o[0];h<=o[2];h++){i.rows[h]||Ce(i,h,{});for(var d=o[1];d<=o[3];d++){i.rows[h].cells||Z(h,d,i,{}),r+=1,e=i.rows[h].cells[d];var p=this.parent.getDisplayText(e)?this.parent.getDisplayText(e):"";this.data.push({text:p,id:"list-"+r})}}}else for(var u=n.split(","),f=0;f<u.length;f++)r+=1,this.data.push({text:u[f],id:"list-"+r});return this.data},e.prototype.listValueChange=function(e){var t=this.parent.getActiveSheet(),r=y(t.activeCell),n=Object.assign({},$(r[0],r[1],t));t.isProtected&&X(n,Ie(t,r[1]))?this.parent.notify("editAlert",null):(this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:t.activeCell,value:e}),this.parent.serviceLocator.getService("cell").refreshRange(r),this.parent.trigger("cellSave",{value:e,oldValue:n&&n.value,address:t.name+"!"+t.activeCell,displayText:this.parent.getDisplayText($(r[0],r[1],t))}))},e.prototype.getRange=function(e){var t=this.parent.getActiveSheet(),r=c(e),n=t.rowCount,i=t.colCount;return r[2]===n-1&&0===r[0]?e=e.replace(/[0-9]/g,""):r[3]===i-1&&0===r[2]&&(e=e.replace(/\D/g,"")),e},e.prototype.initiateDataValidationHandler=function(){var e,r,n,i,a,o=this,s=this.parent.serviceLocator.getService(ki),l=!0,h=!0,d=!0,p=this.parent.getActiveSheet(),u=p.selectedRange,f=c(u);u=this.getRange(u);for(var g=f[0];g<=f[2];g++)if(p.rows[g])for(var m=f[1];m<=f[3];m++)p.rows[g].cells&&p.rows[g].cells[m]&&(a=p.rows[g].cells[m]).validation&&(d=!1,e=a.validation.type,r=a.validation.operator,n=a.validation.value1,i=a.validation.value2,l=t.isNullOrUndefined(a.validation.ignoreBlank)?l:a.validation.ignoreBlank,h=t.isNullOrUndefined(a.validation.inCellDropDown)?h:a.validation.inCellDropDown);if(!this.parent.element.querySelector(".e-datavalidation-dlg")){var v=this.parent.serviceLocator.getService(Ai);v.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-datavalidation-dlg",header:s.getConstant("DataValidation"),target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(t){var a={dialogName:"ValidationDialog",element:t.element,target:t.target,cancel:t.cancel};o.parent.trigger("dialogBeforeOpen",a),a.cancel&&(t.cancel=!0),v.dialogInstance.content=o.dataValidationContent(d,e,r,n,i,l,h,u),v.dialogInstance.dataBind(),Ct(o.parent.element)},buttons:[{buttonModel:{content:s.getConstant("CLEARALL"),cssClass:"e-btn e-clearall-btn e-flat"},click:function(){v.dialogInstance.content=o.dataValidationContent(!0,e,r,n,i,l,h,u),v.dialogInstance.dataBind(),Ct(o.parent.element)}},{buttonModel:{content:s.getConstant("APPLY"),isPrimary:!0},click:function(){o.dlgClickHandler(v)}}]}),v.dialogInstance.refresh()}},e.prototype.dataValidationContent=function(e,t,r,n,s,l,h,d){var p=this,c=this.parent.serviceLocator.getService(ki),u=e?"0":n,f=e?"0":s,g=this.parent.createElement("div",{className:"e-validation-dlg"}),m=this.parent.createElement("div",{className:"e-cellrange"}),v=this.parent.createElement("div",{className:"e-allowdata"}),y=this.parent.createElement("div",{className:"e-values"}),C=this.parent.createElement("div",{className:"e-ignoreblank"});g.appendChild(m),g.appendChild(v),g.appendChild(y),g.appendChild(C);var b=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("CellRange")}),S=this.parent.createElement("input",{className:"e-input",attrs:{value:d}});m.appendChild(b),m.appendChild(S);var x=this.parent.createElement("div",{className:"e-allow"}),w=this.parent.createElement("div",{className:"e-data"});v.appendChild(x),v.appendChild(w);var I=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Allow")});this.typeData=[{text:c.getConstant("WholeNumber"),id:"type-1"},{text:c.getConstant("Decimal"),id:"type-2"},{text:c.getConstant("Date"),id:"type-3"},{text:c.getConstant("Time"),id:"type-4"},{text:c.getConstant("TextLength"),id:"type-5"},{text:c.getConstant("List"),id:"type-6"}],this.operatorData=[{text:c.getConstant("Between"),id:"operator-1"},{text:c.getConstant("NotBetween"),id:"operator-2"},{text:c.getConstant("EqualTo"),id:"operator-3"},{text:c.getConstant("NotEqualTo"),id:"operator-4"},{text:c.getConstant("Greaterthan"),id:"operator-5"},{text:c.getConstant("Lessthan"),id:"operator-6"},{text:c.getConstant("GreaterThanOrEqualTo"),id:"operator-7"},{text:c.getConstant("LessThanOrEqualTo"),id:"operator-8"}];var E=this.parent.createElement("input",{className:"e-select"}),R=0;if(!e)for(F=0;F<this.typeData.length;F++)if(t===this.typeData[F].text.replace(" ","")){R=F;break}if(e||"List"!==t){var k=0,A=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Data")}),T=this.parent.createElement("input",{className:"e-select"});if(!e)for(var F=0;F<this.operatorData.length;F++)if(r===this.FormattedValue(this.operatorData[F].text)){k=F;break}w.appendChild(A),w.appendChild(T),this.dataList=new o.DropDownList({dataSource:this.operatorData,index:k,popupHeight:"200px",change:function(){p.userInput(N,p.dataList)}}),this.dataList.appendTo(T)}else{var L=this.parent.createElement("input",{className:"e-checkbox"});w.appendChild(L),new a.CheckBox({label:c.getConstant("InCellDropDown"),checked:h}).appendTo(L)}x.appendChild(I),x.appendChild(E);var N=new o.DropDownList({dataSource:this.typeData,index:R,popupHeight:"200px",change:function(){p.userInput(N,p.dataList)}});if(N.appendTo(E),e||"List"!==N.value&&("Between"===this.dataList.value||"Not between"===this.dataList.value)){var D=this.parent.createElement("div",{className:"e-minimum"}),O=this.parent.createElement("div",{className:"e-maximum"});y.appendChild(D),y.appendChild(O);var H=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Minimum")}),B=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Maximum")}),M=this.parent.createElement("input",{id:"minvalue",className:"e-input",attrs:{value:u}}),P=this.parent.createElement("input",{id:"maxvalue",className:"e-input",attrs:{value:f}});D.appendChild(H),D.appendChild(M),O.appendChild(B),O.appendChild(P),new i.NumericTextBox({value:0}).appendTo("#minvalue"),new i.NumericTextBox({value:0}).appendTo("#maxvalue")}else if(e&&" List"!==t){var _=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Value")}),U=this.parent.createElement("input",{className:"e-input",attrs:{value:u}});y.appendChild(_),y.appendChild(U)}else{var _=this.parent.createElement("span",{className:"e-header",innerHTML:c.getConstant("Sources")}),U=this.parent.createElement("input",{className:"e-input",attrs:{value:u}});y.appendChild(_),y.appendChild(U)}var V=l,z=this.parent.createElement("input",{className:"e-checkbox"});return C.appendChild(z),new a.CheckBox({label:c.getConstant("IgnoreBlank"),checked:V}).appendTo(z),g},e.prototype.userInput=function(e,t){for(var r=this.parent.element.querySelector(".e-datavalidation-dlg").querySelector(".e-validation-dlg"),n=r.querySelector(".e-allowdata"),o=r.querySelector(".e-values"),s=this.parent.serviceLocator.getService(ki),l=n.querySelector(".e-data");o.lastChild;)o.removeChild(o.lastChild);if("List"===e.value){for(;l.lastChild;)l.removeChild(l.lastChild);var h=this.parent.createElement("input",{className:"e-checkbox"});l.appendChild(h),new a.CheckBox({label:s.getConstant("InCellDropDown"),checked:!0}).appendTo(h)}else if(l.getElementsByClassName("e-checkbox-wrapper")[0]){for(;l.lastChild;)l.removeChild(l.lastChild);var d=this.parent.createElement("span",{className:"e-header",innerHTML:"Data"}),p=this.parent.createElement("input",{className:"e-select"});l.appendChild(d),l.appendChild(p),t.appendTo(p)}if("List"===e.value||"Between"!==t.value&&"Not between"!==t.value){var c="List"===e.value?s.getConstant("Sources"):s.getConstant("Value"),u=this.parent.createElement("span",{className:"e-header",innerHTML:c}),f="List"===e.value?this.parent.createElement("input",{className:"e-input",attrs:{placeholder:"Enter value"}}):this.parent.createElement("input",{className:"e-input",attrs:{value:"0"}});o.appendChild(u),o.appendChild(f)}else{var g=this.parent.createElement("div",{className:"e-minimum"}),m=this.parent.createElement("div",{className:"e-maximum"});o.appendChild(g),o.appendChild(m);var v=this.parent.createElement("span",{className:"e-header",innerHTML:s.getConstant("Minimum")}),y=this.parent.createElement("span",{className:"e-header",innerHTML:s.getConstant("Maximum")}),C=this.parent.createElement("input",{id:"min",className:"e-input",attrs:{value:"0"}}),b=this.parent.createElement("input",{id:"max",className:"e-input",attrs:{value:"0"}});new i.NumericTextBox({value:0}).appendTo("min"),new i.NumericTextBox({value:0}).appendTo("max"),g.appendChild(v),g.appendChild(C),m.appendChild(y),m.appendChild(b)}},e.prototype.dlgClickHandler=function(e){var t,r,n=this.parent.serviceLocator.getService(ki),i=!0,a=this.parent.element.querySelector(".e-datavalidation-dlg"),o=a.querySelector(".e-footer-content"),s=a.getElementsByClassName("e-dlg-content")[0].getElementsByClassName("e-validation-dlg")[0],l=s.getElementsByClassName("e-allowdata")[0],h=l.getElementsByClassName("e-allow")[0].getElementsByTagName("input")[0],d=l.getElementsByClassName("e-data")[0].getElementsByTagName("input")[0],p=s.getElementsByClassName("e-values")[0],c=p.getElementsByTagName("input")[0].value,f=p.getElementsByTagName("input")[1]?p.getElementsByTagName("input")[1].value:"",g="true"===s.querySelector(".e-ignoreblank").querySelector(".e-checkbox-wrapper").getAttribute("aria-checked"),m=l.querySelector(".e-data").querySelector(".e-checkbox-wrapper")?!!l.querySelector(".e-data").querySelector(".e-checkbox-wrapper").querySelector(".e-check"):null,v=s.querySelector(".e-cellrange").getElementsByTagName("input")[0].value,y=h.value;d&&(r=d.value,r=this.FormattedValue(r)),y&&(y=y.replace(" ",""));var C=[],b=[];if(""!==c&&b.push(c),""!==f&&b.push(f),"List"===y)if(-1!==c.indexOf("=")){if(-1!==c.indexOf(":")){var S=c.indexOf("!")>-1?c.split("!")[1]:c.split("=")[1],x=!(c.indexOf("!")>-1)||ae(this.parent,c.split("=")[1].split("!")[0])>-1;C=S.split(":");var w=!!S.match(/[a-z]/gi)&&C[0].replace(/[0-9]/g,"")===C[1].replace(/[0-9]/g,""),I=!!S.match(/\d/g)&&C[0].replace(/\D/g,"")===C[1].replace(/\D/g,"");(i=!!x&&(!!w||!!I))||(t=n.getConstant("DialogError"))}}else c.length>256&&(i=!1,t=n.getConstant("ListLengthError"));if("List"!==y||i){var E=this.parent.getActiveSheet(),R=y,k=this.isDialogValidator(b,R,r);if(t=k.errorMsg,i=k.isValidate){var A=u(this.parent.getActiveSheet().activeCell);if(E&&E.rows[A[0]]&&E.rows[A[0]].cells[A[1]]&&E.rows[A[0]].cells[A[1]].validation&&"List"===E.rows[A[0]].cells[A[1]].validation.type){var T=this.parent.getMainContent().getElementsByTagName("tr")[A[0]].getElementsByClassName("e-cell")[A[1]];T&&T.getElementsByClassName("e-validation-list")[0]&&(T.removeChild(T.getElementsByClassName("e-validation-list")[0]),this.listObj.destroy())}var F={type:y,operator:r,value1:c,value2:f,ignoreBlank:g,inCellDropDown:m};this.parent.addDataValidation(F,v),"List"===y&&i&&this.listHandler(),document.getElementsByClassName("e-validationerror-dlg")[0]||(e.dialogInstance?e.dialogInstance.hide():e.hide())}}if(!i){var L=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid",innerHTML:t});p.appendChild(L),o.querySelector(".e-primary").setAttribute("disabled","true")}},e.prototype.FormattedValue=function(e){switch(e){case"Between":e="Between";break;case"Not between":e="NotBetween";break;case"Equal to":e="EqualTo";break;case"Not equal to":e="NotEqualTo";break;case"Greater than":e="GreaterThan";break;case"Less than":e="LessThan";break;case"Greater than or equal to":e="GreaterThanOrEqualTo";break;case"Less than or equal to":e="LessThanOrEqualTo";break;default:e="Between"}return e},e.prototype.isDialogValidator=function(e,t,r){var n,i=this.parent.serviceLocator.getService(ki),a=0;if("List"===t?!(e.length>0):"Between"===r||"NotBetween"===r?2!==e.length:!(e.length>0))n={isValidate:!1,errorMsg:i.getConstant("EmptyError")};else{for(var o=0;o<e.length&&(n=this.formatValidation(e[o],t)).isValidate;o++)a+=1;n.isValidate=a===e.length}return{isValidate:n.isValidate,errorMsg:n.errorMsg}},e.prototype.isValidationHandler=function(e){var r=this.parent.serviceLocator.getService(ki);e.value=e.value?e.value:"";var n,i,a,o=e.value,s=this.parent.sheets[e.sheetIdx],l=$(e.range[0],e.range[1],s),h=Ie(s,e.range[1]);if(l&&l.validation?a=l.validation:h&&h.validation&&(a=h.validation),a){var d=e.value,p=a.value1,c=a.value2,u=a.operator,f=a.type,g=!!t.isNullOrUndefined(a.ignoreBlank)||a.ignoreBlank,m=this.formatValidation(e.value,f);if(n=m.isValidate,i=m.errorMsg,n){if(n=!1,"Date"===f||"Time"===f)for(b=0;b<=3;b++){e.value=0===b?e.value:1===b?a.value1:a.value2;var v={value:e.value,rowIndex:e.range[0],colIndex:e.range[1],sheetIndex:e.sheetIdx,updatedVal:""};""!==e.value&&this.parent.notify(Rt,v);var y=v.updatedVal;0===b?d="Date"===f?e.value:y.slice(y.indexOf(".")+1,y.length):1===b?p="Date"===f?y:y.slice(y.indexOf(".")+1,y.length):c="Date"===f?y:y.slice(y.indexOf(".")+1,y.length)}else"TextLength"===a.type&&(d=e.value.toString().length.toString());if("List"===f)if(-1!==p.indexOf("="))for(b=0;b<this.data.length;b++)e.value.toString()===this.data[b].text&&(n=!0);else for(var C=p.split(","),b=0;b<C.length;b++)e.value.toString()===C[b]&&(n=!0);else switch("Decimal"===f?(d=parseFloat(d.toString()),p=parseFloat(p.toString()),c=c?parseFloat(c.toString()):null):(d=parseInt(d.toString(),10),p=parseInt(p.toString(),10),c=c?parseInt(c.toString(),10):null),u){case"EqualTo":n=d===p||!(!g||""!==o);break;case"NotEqualTo":n=d!==p||!(!g||""!==o);break;case"Between":n=d>=p&&d<=c||!(!g||""!==o);break;case"NotBetween":n=!(d>=p&&d<=c);break;case"GreaterThan":n=d>p||!(!g||""!==o);break;case"LessThan":n=d<p||!(!g||""!==o);break;case"GreaterThanOrEqualTo":n=d>=p||!(!g||""!==o);break;case"LessThanOrEqualTo":n=d<=p||!(!g||""!==o)}}}if(i=r.getConstant("ValidationError"),n){var S=this.parent.getCellStyleValue(["backgroundColor","color"],[e.range[0],e.range[1]]);this.parent.notify(It,{style:S,rowIdx:e.range[0],colIdx:e.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})}return{isValidate:n,errorMsg:i}},e.prototype.checkDataValidation=function(e){var t=this.isValidationHandler({value:e.value,range:e.range,sheetIdx:e.sheetIdx});!t.isValidate&&e.isCell&&this.validationErrorHandler(t.errorMsg),this.parent.allowDataValidation=t.isValidate},e.prototype.formatValidation=function(e,t){var r,n=this.parent.element.getElementsByClassName("e-sheet-panel")[0],a=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),o=this.parent.createElement("input",{id:"e-validation",innerHTML:e});o.setAttribute("name","validation"),o.setAttribute("type","text"),o.setAttribute("value",e),a.appendChild(o),n.appendChild(a);var s;switch(t){case"Date":s={rules:{validation:{date:!0}},customPlacement:function(e,t){r=t.innerText}};break;case"Decimal":s={rules:{validation:{number:!0}},customPlacement:function(e,t){r=t.innerText}};break;case"WholeNumber":s={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){r=t.innerText}}}var l=new i.FormValidator("#formId",s).validate();return n.removeChild(n.getElementsByClassName("form-horizontal")[0]),{isValidate:l,errorMsg:r}},e.prototype.InvalidElementHandler=function(e){var t=e.rowIdx,r=e.colIdx,n=e.isRemoveHighlightedData;if(n){if(n){var i=this.parent.getCellStyleValue(["backgroundColor","color"],[t,r]);this.parent.notify(It,{style:i,rowIdx:t,colIdx:r,cell:e.td})}}else this.parent.notify(It,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,cell:e.td})},e.prototype.validationErrorHandler=function(e){var t=this,r=document.getElementsByClassName("e-spreadsheet-edit")[0],n=this.parent.serviceLocator.getService(ki);if(!this.parent.element.querySelector(".e-validationerror-dlg")){var i=this.parent.serviceLocator.getService(Ai),a={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validationerror-dlg",target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(n){var a={dialogName:"ValidationErrorDialog",element:n.element,target:n.target,cancel:n.cancel,content:e};t.parent.trigger("dialogBeforeOpen",a),a.cancel&&(t.errorDlgHandler(i,"Cancel"),n.cancel=!0),r.focus(),i.dialogInstance.content=a.content,i.dialogInstance.dataBind()},buttons:[{buttonModel:{content:n.getConstant("Retry"),isPrimary:!0},click:function(){t.errorDlgHandler(i,"Retry")}},{buttonModel:{content:n.getConstant("Cancel")},click:function(){t.errorDlgHandler(i,"Cancel")}}]};i.show(a,!1)}},e.prototype.errorDlgHandler=function(e,t){if("Retry"===t){var r=document.getElementsByClassName("e-spreadsheet-edit")[0];if(e.hide(),r.innerText){var n=document.createRange();n.setStart(r.childNodes[0],0),n.setEnd(r.childNodes[0],r.innerText.length);var i=window.getSelection();i.removeAllRanges(),i.addRange(n),this.listObj&&this.listObj.showPopup()}}else{var a=u(this.parent.getActiveSheet().activeCell),o=$(a[0],a[1],this.parent.getActiveSheet()),s=o?this.parent.getDisplayText(o):"";this.parent.notify(Wt,{action:"cancelEdit",value:s,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide()}},e.prototype.getModuleName=function(){return"dataValidation"},e}(),Zn=function(){function e(e){this.password="",this.parent=e,this.init()}return e.prototype.init=function(){this.addEventListener()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("applyProtect",this.protect,this),this.parent.on("protectSheet",this.protectSheetHandler,this),this.parent.on("editAlert",this.editProtectedAlert,this),this.parent.on("applyLockCells",this.lockCellsHandler,this),this.parent.on("protectWorkbook",this.protectWorkbook,this),this.parent.on(Yt,this.KeyUpHandler,this),this.parent.on("unProtectWorkbook",this.unProtectWorkbook,this),this.parent.on("getPassWord",this.getPassWord,this),this.parent.on("importProtectWorkbook",this.importProtectWorkbook,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyProtect",this.protect),this.parent.off("protectSheet",this.protectSheetHandler),this.parent.off("editAlert",this.editProtectedAlert),this.parent.off("applyLockCells",this.lockCellsHandler),this.parent.off("protectWorkbook",this.protectWorkbook),this.parent.off(Yt,this.KeyUpHandler),this.parent.off("unProtectWorkbook",this.unProtectWorkbook),this.parent.off("getPassWord",this.getPassWord),this.parent.off("importProtectWorkbook",this.importProtectWorkbook))},e.prototype.protect=function(e){this.parent.notify("clearCopy",null),e.isActive?(this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1),this.parent.notify("updateToggleItem",{props:"Protect"}),this.parent.notify("protectSheet",{isActive:e.isActive}),this.parent.notify("protectSelection",null)):this.createDialogue()},e.prototype.createDialogue=function(){var e=this,r=this.parent.serviceLocator.getService(ki),n=[{text:r.getConstant("SelectCells"),id:"1"},{text:r.getConstant("FormatCells"),id:"2"},{text:r.getConstant("FormatRows"),id:"3"},{text:r.getConstant("FormatColumns"),id:"4"},{text:r.getConstant("InsertLinks"),id:"5"}];this.optionList=new s.ListView({width:"250px",dataSource:n,showCheckBox:!0,select:this.dialogOpen.bind(this)});var i=this.parent.createElement("div",{className:"e-protect-content",innerHTML:r.getConstant("ProtectAllowUser")});this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1);var o=new a.CheckBox({checked:!0,label:r.getConstant("ProtectContent"),cssClass:"e-protect-checkbox"}),l=this.parent.createElement("div",{className:"e-protect-option-list",id:this.parent.element.id+"_option_list"}),h=this.parent.createElement("div",{className:"e-header-content",innerHTML:r.getConstant("ProtectSheet")}),d=this.parent.createElement("input",{id:this.parent.element.id+"_protect_check",attrs:{type:"checkbox"}});this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({header:h.outerHTML,content:d.outerHTML+i.outerHTML+l.outerHTML,showCloseIcon:!0,isModal:!0,cssClass:"e-protect-dlg",beforeOpen:function(t){var r={dialogName:"ProtectSheetDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),Ct(e.parent.element)},open:function(){e.okBtnFocus()},beforeClose:function(){var r=document.getElementById(e.parent.element.id+"_protect_check");t.EventHandler.remove(r,"focus",e.okBtnFocus),t.EventHandler.remove(o.element,"click",e.checkBoxClickHandler),Ct(e.parent.element)},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:r.getConstant("Ok"),isPrimary:!0}}]}),o.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"}]),t.EventHandler.add(o.element,"click",this.checkBoxClickHandler,this)},e.prototype.okBtnFocus=function(){var e=this;document.getElementById(this.parent.element.id+"_protect_check").addEventListener("focus",function(){e.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus()})},e.prototype.checkBoxClickHandler=function(){!1===document.getElementById(this.parent.element.id+"_protect_check").checked?this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!0:(this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").disabled=!1,this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus())},e.prototype.dialogOpen=function(){this.dialog.dialogInstance.element.getElementsByClassName("e-footer-content")[0].querySelector("button").focus()},e.prototype.selectOption=function(){var e=this.parent.serviceLocator.getService(ki),t=this.optionList.getSelectedItems();this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!0);var r={selectCells:t.text.indexOf(e.getConstant("SelectCells"))>-1,formatCells:t.text.indexOf(e.getConstant("FormatCells"))>-1,formatRows:t.text.indexOf(e.getConstant("FormatRows"))>-1,formatColumns:t.text.indexOf(e.getConstant("FormatColumns"))>-1,insertLink:t.text.indexOf(e.getConstant("InsertLinks"))>-1};this.parent.protectSheet(null,r),this.parent.notify("protectSelection",null),this.parent.notify("clearUndoRedoCollection",null),this.dialog.hide()},e.prototype.protectSheetHandler=function(){var e=this.parent.getActiveSheet(),t=this.parent.element.id,r=[t+"_undo",t+"_redo",t+"_cut",t+"_copy",t+"_paste",t+"_number_format",t+"_font_name",t+"_font_size",t+"_bold",t+"_italic",t+"_line-through",t+"_underline",t+"_font_color_picker",t+"_fill_color_picker",t+"_borders",t+"_merge_cells",t+"_text_align",t+"_vertical_align",t+"_wrap",t+"_sorting",t+"_clear",t+"_conditionalformatting"],n=[t+"_cut",t+"_copy",t+"_number_format",t+"_font_name",t+"_font_size",t+"_bold",t+"_italic",t+"_line-through",t+"_underline",t+"_font_color_picker",t+"_fill_color_picker",t+"_borders",t+"_text_align",t+"_vertical_align",t+"_wrap",t+"_sorting",t+"_clear",t+"_conditionalformatting"],i=[t+"_insert_function"],a=[t+"_hyperlink",t+"_",t+"_chart"],o=[t+"_"],s=[t+"_find"],l=[t+"_datavalidation"],h=[t+"_chart"],d=document.getElementById(this.parent.element.id+"_sheet_panel");d&&(e.isProtected&&e.protectSettings.selectCells?d.classList.remove("e-protected"):d.classList.add("e-protected"),e.isProtected||d.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify("protectCellFormat",{disableHomeBtnId:r,enableHomeBtnId:n,enableFrmlaBtnId:i,enableInsertBtnId:a,findBtnId:s,dataValidationBtnId:l,imageBtnId:o,chartBtnId:h}),this.parent.notify("enableFormulaInput",null),e.isProtected&&this.parent.notify("updateToggleItem",{props:"Protect"})},e.prototype.editProtectedAlert=function(){var e=this,t=this.parent.serviceLocator.getService(ki);this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({content:t.getConstant("EditAlert"),isModal:!0,closeOnEscape:!0,showCloseIcon:!0,width:"400px",cssClass:"e-editAlert-dlg",beforeOpen:function(t){var r={dialogName:"EditAlertDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),Ct(e.parent.element)},close:function(){return Ct(e.parent.element)}})},e.prototype.lockCellsHandler=function(e){var t=this.parent.getActiveSheet(),r={isLocked:!!e.isLocked&&e.isLocked};Z(e.rowIdx,e.colIdx,t,r,!0)},e.prototype.protectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.serviceLocator.getService(Ai);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-protectworkbook-dlg",header:t.getConstant("ProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"ProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.passwordProtectContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.alertMessage(),e.dlgClickHandler(r)}}]})},e.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("div",{className:"e-password-dialog"}),r=this.parent.createElement("div",{className:"e-password-content"}),n=this.parent.createElement("div",{className:"e-password-content"}),i=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("Password")}),a=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("ConfirmPassword")}),o=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}),s=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return o.setAttribute("placeholder",e.getConstant("EnterThePassword")),s.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(o),r.insertBefore(i,o),n.appendChild(s),n.insertBefore(a,s),t.appendChild(n),t.insertBefore(r,n),t},e.prototype.KeyUpHandler=function(e){var r=e.target;if(r.classList.contains("e-text")&&t.closest(r,".e-password-content")&&t.closest(r,".e-password-dialog")&&t.closest(r,".e-password-dialog").getElementsByClassName("e-password-content")[1]===r.parentElement){var n=t.closest(r,".e-protectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?n.removeAttribute("disabled"):n.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-unprotectpwd-content")&&t.closest(r,".e-unprotectpwd-dialog")&&t.closest(r,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===r.parentElement){var i=t.closest(r,".e-unprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?i.removeAttribute("disabled"):i.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-importprotectpwd-content")&&t.closest(r,".e-importprotectpwd-dialog")&&t.closest(r,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===r.parentElement){var a=t.closest(r,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}},e.prototype.alertMessage=function(){var e=this.parent.element.querySelector(".e-pwd-alert-span"),t=this.parent.element.querySelector(".e-unprotectpwd-alert-span"),r=this.parent.element.querySelector(".e-importprotectpwd-alert-span");e&&e.remove(),t&&t.remove(),r&&r.remove()},e.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[0].querySelector(".e-input"),n=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[1].querySelector(".e-input"),i=this.parent.createElement("span",{className:"e-pwd-alert-span"});r.value===n.value?(this.parent.password=r.value,this.parent.isProtected=!0,e.hide(),this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled")),this.parent.notify("updateToggleItem",{props:"Protectworkbook"})):""===r.value?i.textContent=t.getConstant("PasswordAlertMsg"):""===n.value?i.textContent=t.getConstant("ConfirmPasswordAlertMsg"):r.value!==n.value&&(i.textContent=t.getConstant("PasswordAlert")),this.parent.element.querySelector(".e-protectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i)},e.prototype.unProtectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.serviceLocator.getService(Ai);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworkbook-dlg",header:t.getConstant("UnProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"UnProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.unProtectPasswordContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.unprotectdlgOkClick(r)}}]})},e.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("div",{className:"e-unprotectpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectpwd-content"}),n=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("EnterThePassword")}),i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},e.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.element.querySelector(".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0].querySelector(".e-input");if(this.parent.password===r.value)e.hide(),this.parent.password="",this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),document.getElementById(this.parent.element.id+"_protectworkbook").classList.remove("e-active"),this.parent.notify("updateToggleItem",{props:"Protectworkbook"});else{var n=this.parent.createElement("span",{className:"e-unprotectpwd-alert-span",innerHTML:t.getConstant("UnProtectPasswordAlert")});this.parent.element.querySelector(".e-unprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(n)}},e.prototype.getPassWord=function(e){e.passWord=this.password},e.prototype.importProtectWorkbook=function(e){var t=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-importprotectworkbook-dlg",header:r.getConstant("UnProtectWorkbook"),beforeOpen:function(r){var i={dialogName:"ImportProtectWorkbook",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.importProtectPasswordContent(e),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){t.alertMessage(),t.importOkClick(e)}}]})},e.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.createElement("div",{className:"e-importprotectpwd-dialog"}),n=this.parent.createElement("div",{className:"e-importprotectpwd-content"}),i=this.parent.createElement("span",{className:"e-header",innerHTML:'"'+e.file.name+'" '+t.getConstant("IsProtected")}),a=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return a.setAttribute("placeholder",t.getConstant("EnterThePassword")),n.appendChild(i),n.appendChild(a),r.appendChild(n),r},e.prototype.importOkClick=function(e){var t=this.parent.element.querySelector(".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0].querySelector(".e-input");this.parent.password=t.value;var r={file:e.file,password:t.value};this.parent.open(r)},e.prototype.getModuleName=function(){return"protectSheet"},e}(),Jn=function(){function e(e){this.shortValue="",this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(or,this.renderFindDlg,this),this.parent.on(ar,this.renderGotoDlg,this),this.parent.on(Lt,this.gotoHandler,this),this.parent.on("findHandler",this.findHandler,this),this.parent.on(sr,this.replaceHandler,this),this.parent.on(Nt,this.showDialog,this),this.parent.on("replaceAllDialog",this.replaceAllDialog,this),this.parent.on("findUndoRedo",this.findUndoRedo,this),this.parent.on("findKeyUp",this.findKeyUp,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(or,this.renderFindDlg),this.parent.off(ar,this.renderGotoDlg),this.parent.off(Lt,this.gotoHandler),this.parent.off("findHandler",this.findHandler),this.parent.off(sr,this.replaceHandler),this.parent.off(Nt,this.showDialog),this.parent.off("replaceAllDialog",this.replaceAllDialog),this.parent.off("findUndoRedo",this.findUndoRedo),this.parent.off("findKeyUp",this.findKeyUp))},e.prototype.findUndoRedo=function(e){var t={address:e.address,compareVal:e.compareVal,cancel:!1};if("before"===e.undoRedoOpt)this.parent.notify(ir,{action:"beforeReplace",eventArgs:t});else if("after"===e.undoRedoOpt){if(!t.cancel){var r={address:e.address,compareVal:e.compareVal};this.parent.notify(nr,{action:"replace",eventArgs:r})}}else if("beforeReplaceAll"===e.undoRedoOpt){if(!t.cancel){var n={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(ir,{action:"beforeReplaceAll",eventArgs:n})}}else if("afterReplaceAll"===e.undoRedoOpt&&!t.cancel){var i={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(nr,{action:"replaceAll",eventArgs:i})}},e.prototype.renderFindDlg=function(){var e=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var i={isModal:!1,showCloseIcon:!0,cssClass:"e-find-dlg",allowDragging:!0,header:r.getConstant("FindAndReplace"),closeOnEscape:!1,beforeOpen:function(t){var r={dialogName:"FindAndReplaceDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),n.dialogInstance.content=e.findandreplaceContent(),n.dialogInstance.dataBind(),Ct(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(t){if(e.dialogMessage(),t&&13===t.keyCode)return void e.findDlgClick("next");e.findDlgClick("prev")}},{buttonModel:{content:r.getConstant("FindNextBtn"),isPrimary:!0,cssClass:"e-btn-findNext",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("next")}},{buttonModel:{content:r.getConstant("ReplaceBtn"),isPrimary:!0,cssClass:"e-btn-replace",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("replace")}},{buttonModel:{content:r.getConstant("ReplaceAllBtn"),isPrimary:!0,cssClass:"e-btn-replaceAll",disabled:!0},click:function(){e.dialogMessage(),e.findDlgClick("replaceAll")}}],open:function(){if(e.parent.element.querySelector(".e-text-findNext").value){var r=e.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(r,"btn").disabled=!1,t.getComponent(e.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}},close:function(){n.hide()}};n.show(i,!1)}else n.hide()},e.prototype.dialogMessage=function(){this.parent.element.querySelector(".e-replace-alert-span")?this.parent.element.querySelector(".e-replace-alert-span").remove():this.parent.element.querySelector(".e-find-alert-span")&&this.parent.element.querySelector(".e-find-alert-span").remove()},e.prototype.renderGotoDlg=function(){var e=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);if(t.isNullOrUndefined(this.parent.element.querySelector(".e-find-dlg"))){var i={width:300,isModal:!1,showCloseIcon:!0,cssClass:"e-goto-dlg",allowDragging:!0,header:r.getConstant("GotoHeader"),beforeOpen:function(t){var r={dialogName:"GoToDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),n.dialogInstance.content=e.GotoContent(),n.dialogInstance.dataBind(),Ct(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn-goto-ok"},click:function(){e.gotoHandler()}}],close:function(){n.hide()},open:function(){e.textFocus()}};n.show(i,!1)}else n.hide()},e.prototype.textFocus=function(){var e=this;this.parent.element.querySelector(".e-text-goto").addEventListener("focus",function(){e.parent.element.querySelector(".e-goto-alert-span")&&e.parent.element.querySelector(".e-goto-alert-span").remove()})},e.prototype.findDlgClick=function(e){"prev"===e?this.findHandler({findOption:e}):"next"===e?this.findHandler({findOption:e}):this.replaceHandler({findDlgArgs:e})},e.prototype.findHandler=function(e){var r=this.parent.element.querySelector(".e-text-findNext");r||(r=this.parent.element.querySelector(".e-text-findNext-short"))||this.gotoAlert();var n=r.value;if(""!==r.value){var i=this.parent.activeSheetIndex,a=this.parent.element.querySelector(".e-findnreplace-checkcase"),o=void 0;o=!!a&&t.getComponent(a,"checkbox").checked;var s=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=void 0;l=!!s&&t.getComponent(s,"checkbox").checked;var h=this.parent.element.querySelector(".e-findnreplace-searchby"),d=void 0;d=h?t.getComponent(h,"dropdownlist").value.toString():"By Row";var p=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=void 0;c=p?t.getComponent(p,"dropdownlist").value.toString():"Sheet";var u={value:n,sheetIndex:i,findOpt:e.findOption,mode:c,isCSen:o,isEMatch:l,searchBy:d};"next"===e.findOption||"prev"===e.findOption?this.parent.find(u):"count"===e.countArgs.countOpt&&(this.parent.notify("count",u),e.countArgs.findCount=u.findCount)}},e.prototype.replaceHandler=function(e){var r=this.parent.activeSheetIndex,n=this.parent.element.querySelector(".e-text-findNext"),i=this.parent.element.querySelector(".e-text-replaceInp"),a=this.parent.element.querySelector(".e-findnreplace-checkcase"),o=t.getComponent(a,"checkbox"),s=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=t.getComponent(s,"checkbox"),h=this.parent.element.querySelector(".e-findnreplace-searchby"),d=t.getComponent(h,"dropdownlist"),p=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=t.getComponent(p,"dropdownlist"),u={value:n.value,mode:c.value.toString(),isCSen:o.checked,isEMatch:l.checked,searchBy:d.value.toString(),findOpt:"next",replaceValue:i.value,replaceBy:e.findDlgArgs?e.findDlgArgs:e.replaceMode,sheetIndex:r};this.parent.replace(u)},e.prototype.gotoHandler=function(e){if(e)this.parent.goTo(e.address);else{var t=this.parent.element.querySelector(".e-text-goto").value,r=t.split("");if(""===t||isNaN(parseInt(r[1],10)))return void this.gotoAlert();var n=t.toString().toUpperCase();this.parent.goTo(n)}},e.prototype.gotoAlert=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("span",{className:"e-goto-alert-span",innerHTML:e.getConstant("InsertingEmptyValue")});this.parent.element.querySelector(".e-goto-alert-span")&&this.parent.element.querySelector(".e-goto-alert-span").remove(),this.parent.element.querySelector(".e-goto-dlg").querySelector(".e-dlg-content").appendChild(t)},e.prototype.showDialog=function(){this.parent.element.querySelector(".e-replace-alert-span")&&this.parent.element.querySelector(".e-replace-alert-span").remove();var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("span",{className:"e-find-alert-span",innerHTML:e.getConstant("NoElements")});this.parent.element.querySelector(".e-find-dlg")&&this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").appendChild(t)},e.prototype.replaceAllDialog=function(e){this.parent.element.querySelector(".e-find-alert-span")&&this.parent.element.querySelector(".e-find-alert-span").remove();var t=this.parent.serviceLocator.getService(ki),r=this.parent.createElement("span",{className:"e-replace-alert-span",innerHTML:e.count+t.getConstant("ReplaceAllEnd")+e.replaceValue});this.parent.element.querySelector(".e-find-dlg")&&this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").appendChild(r)},e.prototype.findKeyUp=function(e){if(e.target.classList.contains("e-text-findNext")){var r=this.parent.element.querySelector(".e-text-findNext").value;if(t.isNullOrUndefined(r)||""===r)t.getComponent(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage();else{var n=this.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(n,"btn").disabled=!1,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}}var i=this.parent.element.querySelector(".e-text-findNext").value,a=this.parent.element.querySelector(".e-text-replaceInp").value;t.isNullOrUndefined(i)||t.isNullOrUndefined(a)||""===i||""===a?(t.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):!1===this.parent.getActiveSheet().isProtected&&(t.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!1,t.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!1)},e.prototype.findandreplaceContent=function(){this.parent.element.querySelector(".e-text-findNext-short")&&(this.shortValue=this.parent.element.querySelector(".e-text-findNext-short").value);var e=this.parent.createElement("div",{className:"e-link-dialog"}),t=this.parent.createElement("div",{className:"e-find"}),r=this.parent.createElement("div",{className:"e-findCheck"}),n=this.parent.serviceLocator.getService(ki);e.appendChild(t);var s=this.parent.createElement("div",{className:"e-cont"}),l=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("FindWhat")}),h=this.parent.createElement("input",{className:"e-input e-text-findNext",attrs:{type:"Text",placeholder:n.getConstant("FindValue"),value:this.shortValue}});s.appendChild(h),s.insertBefore(l,h),t.appendChild(s);var d=new i.TextBox({width:"70%"});d.createElement=this.parent.createElement,d.appendTo(h);var p=this.parent.createElement("div",{className:"e-cont"}),c=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("ReplaceWith")}),u=this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}});p.appendChild(u),p.insertBefore(c,u),t.appendChild(p);var f=new i.TextBox({width:"70%"});f.createElement=this.parent.createElement,f.appendTo(u);var g=[{Id:"Sheet",Within:n.getConstant("Sheet")},{Id:"Workbook",Within:n.getConstant("Workbook")}],m=new o.DropDownList({dataSource:g,cssClass:"e-searchby",fields:{value:"Id",text:"Within"},width:"50%",index:0}),v=this.parent.createElement("input",{className:"e-findnreplace-searchwithin",attrs:{type:"select",label:n.getConstant("SearchBy")}}),y=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("SearchWithin")});t.appendChild(y),t.appendChild(v),m.createElement=this.parent.createElement,m.appendTo(v);var C=[{Id:"By Row",Search:n.getConstant("ByRow")},{Id:"By Column",Search:n.getConstant("ByColumn")}],b=new o.DropDownList({dataSource:C,cssClass:"e-searchby",fields:{value:"Id",text:"Search"},width:"50%",index:0}),S=this.parent.createElement("input",{className:"e-findnreplace-searchby",attrs:{type:"select",label:n.getConstant("SearchBy")}}),x=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("SearchBy")});t.appendChild(x),t.appendChild(S),b.createElement=this.parent.createElement,b.appendTo(S);var w=new a.CheckBox({label:n.getConstant("MatchCase"),checked:!1,cssClass:"e-findnreplace-casecheckbox"}),I=this.parent.createElement("input",{className:"e-findnreplace-checkcase",attrs:{type:"checkbox"}});r.appendChild(I),w.createElement=this.parent.createElement,w.appendTo(I);var E=new a.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"}),R=this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}});return r.appendChild(R),E.createElement=this.parent.createElement,E.appendTo(R),t.appendChild(r),e},e.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("div",{className:"e-link-dialog"}),r=this.parent.createElement("div",{className:"e-goto"});t.appendChild(r);var n=this.parent.createElement("div",{className:"e-cont"}),a=this.parent.createElement("p",{className:"e-header",innerHTML:e.getConstant("Reference")}),o=new i.TextBox({placeholder:e.getConstant("EntercellAddress")}),s=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(s),n.insertBefore(a,s),r.appendChild(n),o.createElement=this.parent.createElement,o.appendTo(s),t},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"findAndReplace"},e}(),Qn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){var t=this;if(e.showDialog)return void this.parent.serviceLocator.getService(Ai).show({target:this.parent.element,height:180,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).getConstant("PasteMergeAlert"),beforeOpen:function(e){var r={dialogName:"MergeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),Ct(t.parent.element)}});this.parent.serviceLocator.getService("cell").refresh(e.rowIdx,e.colIdx,e.lastCell,e.element)},e.prototype.hideHandler=function(e){var t=this.parent.getActiveSheet(),r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify("activeCellMergedRange",r),r.range=r.range;var n=$(r.range[0],r.range[1],t)||{},i="row"===e.model?r.range[0]:r.range[1],a=i+((n[e.model+"Span"]||1)-1);if(!(!e.isEnd&&(e.start===i||Ae(t,i))||e.isEnd&&e.start>i&&!Ae(t,i))&&n[e.model+"Span"]>1&&a>=e.start)if("row"===e.model?be(t,i):Ae(t,i)){if(e.end<a&&(a-e.end>1||n.rowSpan>1)){var o=this.parent.getCell(e.rowIdx,e.end+1);if(o&&(a-e.end>1&&(o.colSpan=a-e.end),o.style.display=""),n.rowSpan>1){var s=n.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(n.rowSpan-1));s>1&&(o.rowSpan=s)}}}else this.merge({rowIdx:r.range[0],colIdx:r.range[1]})},e.prototype.checkPrevMerge=function(e){var t,r,n,i=this.parent.getActiveSheet();if(e.isRow)return void(e.rowIdx-1>-1&&be(i,e.rowIdx-1)&&(void 0===(t=$(e.rowIdx-1,e.colIdx,i)||{}).rowSpan&&void 0===t.colSpan||!(void 0===t.colSpan||t.colSpan>1||e.colIdx-1>-1&&Ae(i,e.colIdx-1))||(r={range:[e.rowIdx-1,e.colIdx,e.rowIdx-1,e.colIdx]},this.parent.notify("activeCellMergedRange",r),r.range=r.range,be(i,r.range[0])&&r.range[2]>=e.rowIdx&&(t=$(r.range[0],r.range[1],i)||{}).rowSpan>1&&((n=r.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(r.range[2]-e.rowIdx)))>1&&(e.td.rowSpan=n,e.td.style.display=""),t.colSpan>1&&!(e.colIdx-1>-1&&Ae(i,e.colIdx-1))&&(n=t.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(t.colSpan-1),"columns"))>1&&(e.td.colSpan=n,e.td.style.display="")))));e.colIdx-1>-1&&Ae(i,e.colIdx-1)&&(void 0===(t=$(e.rowIdx,e.colIdx-1,i)||{}).colSpan&&void 0===t.rowSpan||!(void 0===t.rowSpan||t.rowSpan>1||e.rowIdx-1>-1&&be(i,e.rowIdx-1))||(r={range:[e.rowIdx,e.colIdx-1,e.rowIdx,e.colIdx-1]},this.parent.notify("activeCellMergedRange",r),r.range=r.range,Ae(i,r.range[1])&&r.range[3]>=e.colIdx&&(t=$(r.range[0],r.range[1],i)||{}).colSpan>1&&((n=r.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,e.colIdx+(t.colSpan-1),"columns"))>1&&(e.td.colSpan=n,e.td.style.display=""),t.rowSpan>1&&!(e.rowIdx-1>-1&&be(i,e.rowIdx-1))&&(n=t.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(t.rowSpan-1)))>1&&(e.td.rowSpan=n,e.td.style.display=""))))},e.prototype.checkMerge=function(e){var t=this.parent.getActiveSheet(),r=$(e.rowIdx,e.colIdx,t)||{};if(e.isRow){if(void 0===r.colSpan||Ae(t,e.colIdx-1)){if((n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=n.range,this.parent.notify("activeCellMergedRange",n),Ae(t,e.colIdx-1)&&!Ae(t,n.range[1])||e.isFreezePane&&n.range[0]<this.parent.frozenRowCount(t))return void(e.insideFreezePane=n.range[0]<this.parent.frozenRowCount(t));r=$(n.range[0],n.range[1],t),(i=n.range[2]-e.rowIdx+1-this.parent.hiddenCount(e.rowIdx,n.range[2]))>1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.rowSpan=i,e.td.style.display="")}}else if(void 0===r.rowSpan||be(t,e.rowIdx-1)){var n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};if(n.range=n.range,this.parent.notify("activeCellMergedRange",n),be(t,e.rowIdx-1)&&!be(t,n.range[0])||e.isFreezePane&&n.range[1]<this.parent.frozenColCount(t))return void(e.insideFreezePane=n.range[1]<this.parent.frozenColCount(t));r=$(n.range[0],n.range[1],t);var i=n.range[3]-e.colIdx+1-this.parent.hiddenCount(e.colIdx,n.range[3],"columns");i>1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.colSpan=i,e.td.style.display="")}},e.prototype.addEventListener=function(){this.parent.on("applyMerge",this.merge,this),this.parent.on("hiddenMerge",this.hideHandler,this),this.parent.on("checkPrevMerge",this.checkPrevMerge,this),this.parent.on("checkMerge",this.checkMerge,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyMerge",this.merge),this.parent.off("hiddenMerge",this.hideHandler),this.parent.off("checkPrevMerge",this.checkPrevMerge),this.parent.off("checkMerge",this.checkMerge))},e.prototype.getModuleName=function(){return"merge"},e}(),ei=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("cFRender",this.cFInitialRender,this),this.parent.on("cFInitialCheck",this.cFInitialCheckHandler,this),this.parent.on("checkConditionalFormat",this.checkConditionalFormatHandler,this),this.parent.on("initiateConditionalFormat",this.initiateCFHandler,this),this.parent.on("setCF",this.setCFHandler,this),this.parent.on(Pt,this.cFDeleteHandler,this),this.parent.on("clearCF",this.clearCFHandler,this),this.parent.on(_t,this.addClearCFHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("cFRender",this.cFInitialRender),this.parent.off("cFInitialCheck",this.cFInitialCheckHandler),this.parent.off("checkConditionalFormat",this.checkConditionalFormatHandler),this.parent.off("initiateConditionalFormat",this.initiateCFHandler),this.parent.off("setCF",this.setCFHandler),this.parent.off(Pt,this.cFDeleteHandler),this.parent.off("clearCF",this.clearCFHandler))},e.prototype.setCF=function(e){e.range=e.range||this.parent.getActiveSheet().selectedRange;var t={range:e.range,type:e.type,cFColor:e.cFColor,value:e.value,cancel:!1};this.parent.notify(ir,{eventArgs:t,action:"conditionalFormat"}),t.cancel||(e.type=t.type,e.cFColor=t.cFColor,e.value=t.value,e.range=t.range,this.parent.notify(Bt,{conditionalFormat:e}),delete t.cancel,this.parent.notify(nr,{eventArgs:t,action:"conditionalFormat"}))},e.prototype.addClearCFHandler=function(e){for(var t=this.parent.getActiveSheet(),r=e.conditionalFormats,n=e.oldRange,i=e.selectedRange,a=t.conditionalFormats,o=0;o<r.length;o++){for(var s=!1,l=0;l<a.length;l++)if(a[l].type===r[o].type&&a[l].range===r[o].range){s=!0,a[l].range=n[o],t.conditionalFormats[l].range=n[o];for(var h=c(i),d=n[o].split(","),p=0;p<d.length;p++)for(var u=c(d[p]),f=u[0];f<=u[2];f++)for(var g=u[1];g<=u[3];g++)for(var m=h[0];m<=h[2];m++)for(var v=h[1];v<=h[3];v++)if(m===f&&v===g){var y=this.parent.getCell(f,g),C=t.rows[f]&&t.rows[f].cells[g]?t.rows[f].cells[g]:null;C&&this.cFInitialCheckHandler({rowIdx:f,colIdx:g,cell:C,td:y,conditionalFormat:a[l]})}}if(!s){var b=r[o];b.range=n[o],this.parent.notify(Bt,{conditionalFormat:b})}}},e.prototype.cFDeleteHandler=function(e){var t=this.parent.getCell(e.rowIdx,e.colIdx);t&&(t.querySelector(".e-cf-databar")&&t.removeChild(t.querySelector(".e-cf-databar")),t.querySelector(".e-iconsetspan")&&t.removeChild(t.querySelector(".e-iconsetspan")))},e.prototype.clearCFHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.getCell(e.rIdx,e.cIdx),n=$(e.rIdx,e.cIdx,t);if(r){if(r.classList.remove("e-redft"),r.classList.remove("e-yellowft"),r.classList.remove("e-greenft"),r.classList.remove("e-redf"),r.classList.remove("e-redt"),r.classList.remove("e-iconset"),r.style){if(r.style.backgroundColor){r.style.backgroundColor="";i=this.parent.getCellStyleValue(["backgroundColor"],[e.rIdx,e.cIdx]);this.parent.notify(It,{style:i,rowIdx:e.rIdx,colIdx:e.cIdx})}if(r.style.color){r.style.color="";var i=this.parent.getCellStyleValue(["color"],[e.rIdx,e.cIdx]);this.parent.notify(It,{style:i,rowIdx:e.rIdx,colIdx:e.cIdx})}}r.querySelector(".e-cf-databar")&&(r.removeChild(r.querySelector(".e-cf-databar")),r.textContent=this.parent.getDisplayText(n)),r.querySelector(".e-iconsetspan")&&(r.removeChild(r.querySelector(".e-iconsetspan")),r.textContent=this.parent.getDisplayText(n))}},e.prototype.setCFHandler=function(e){"cf_databars"===e.action?this.setCF({type:e.id}):"cf_colorscales"===e.action?this.setCF({type:e.id}):"cf_iconsets"===e.action&&this.setCF({type:e.id})},e.prototype.initiateCFHandler=function(e){var t=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);n.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-conditionalformatting-dlg",header:e.action.replace("...",""),target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(){n.dialogInstance.content=t.cFDlgContent(e.action),n.dialogInstance.dataBind(),Ct(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){n.dialogInstance.element.getElementsByClassName("e-clearall-btn")[0].disabled||(t.dlgClickHandler(e.action),n.hide())}}]}),n.dialogInstance.refresh()},e.prototype.dlgClickHandler=function(e){var t="",r="",n=this.parent.element.querySelector(".e-conditionalformatting-dlg").getElementsByClassName("e-dlg-content")[0].querySelector(".e-cf-dlg"),i=n.querySelector(".e-cfmain");if(i){var a=i.getElementsByTagName("input")[0];a&&a.parentElement.classList.contains("e-cfmain")&&(t=i.getElementsByTagName("input")[0].value),r=i.getElementsByTagName("input")[1]?n.querySelector(".e-cfmain").getElementsByTagName("input")[1].value:""}var o=this.getCFColor(n.querySelector(".e-cfsub").getElementsByTagName("input")[0].value),s="Duplicate Values..."===e?n.querySelector(".e-cfmain").getElementsByTagName("input")[0].value:this.getType(e);""!==t&&""!==r?this.setCF({type:s,cFColor:o,value:t+","+r}):""!==t?this.setCF({type:s,cFColor:o,value:t}):this.setCF({type:s,cFColor:o,value:r})},e.prototype.getType=function(e){var t=this.parent.serviceLocator.getService(ki),r="";switch(e){case t.getConstant("GreaterThan")+"...":r="GreaterThan";break;case t.getConstant("LessThan")+"...":r="LessThan";break;case t.getConstant("Between")+"...":r="Between";break;case t.getConstant("CFEqualTo")+"...":r="EqualTo";break;case t.getConstant("TextThatContains")+"...":r="ContainsText";break;case t.getConstant("ADateOccuring")+"...":r="DateOccur";break;case t.getConstant("Top10Items")+"...":r="Top10Items";break;case t.getConstant("Bottom10Items")+"...":r="Bottom10Items";break;case t.getConstant("Top10")+" %...":r="Top10Percentage";break;case t.getConstant("Bottom10")+" %...":r="Bottom10Percentage";break;case t.getConstant("AboveAverage")+"...":r="AboveAverage";break;case t.getConstant("BelowAverage")+"...":r="BelowAverage"}return r},e.prototype.getCFColor=function(e){var t=this.parent.serviceLocator.getService(ki),r="RedFT";switch(e){case t.getConstant("LightRedFillWithDarkRedText"):r="RedFT";break;case t.getConstant("YellowFillWithDarkYellowText"):r="YellowFT";break;case t.getConstant("GreenFillWithDarkGreenText"):r="GreenFT";break;case t.getConstant("RedFill"):r="RedF";break;case t.getConstant("RedText"):r="RedT"}return r},e.prototype.cFDlgContent=function(e){var t=this.getDlgText(e),r=this.parent.serviceLocator.getService(ki),n=this.parent.createElement("div",{className:"e-cf-dlg"}),a=this.parent.createElement("div",{className:"e-cfmain"}),s=this.parent.createElement("div",{className:"e-cfsub"}),l=this.parent.createElement("span",{className:"e-header e-top-header",innerHTML:t}),h=this.parent.createElement("input",{className:"e-input",id:"valueInput",attrs:{type:"text"}}),d=this.parent.createElement("input",{className:"e-select"}),p=this.parent.createElement("span",{className:"e-header",innerHTML:r.getConstant("With")}),c=this.parent.createElement("input",{className:"e-select"});n.appendChild(a),n.appendChild(s),a.appendChild(l);var u;if(e!==r.getConstant("DuplicateValues")+"..."){if(e!==r.getConstant("AboveAverage")+"..."&&e!==r.getConstant("BelowAverage")+"..."){a.appendChild(h),u=!0;var f=e===r.getConstant("Top10")+" %..."||e===r.getConstant("Bottom10")+" %...";(e===r.getConstant("Top10Items")+"..."||e===r.getConstant("Bottom10Items")+"..."||f)&&(h.maxLength=f?3:4,new i.NumericTextBox({value:10,min:1,max:f?100:1e3,format:"###"}).appendTo(h))}}else{a.appendChild(d);var g=[{text:r.getConstant("Duplicate"),id:"duplicate"},{text:r.getConstant("Unique"),id:"unique"}];new o.DropDownList({dataSource:g,index:0,popupHeight:"200px"}).appendTo(d)}if(e===r.getConstant("Between")+"..."){var m=this.parent.createElement("span",{className:"e-header e-header-2",innerHTML:r.getConstant("And")}),v=this.parent.createElement("input",{className:"e-input e-between"});a.appendChild(m),a.appendChild(v),v.addEventListener("input",this.validateCfInput.bind(this))}u&&(this.validateCfInput({target:h}),h.addEventListener("input",this.validateCfInput.bind(this))),s.appendChild(p),s.appendChild(c);var y=[{text:r.getConstant("LightRedFillWithDarkRedText"),value:"redft",id:"redft"},{text:r.getConstant("YellowFillWithDarkYellowText"),id:"yellowft"},{text:r.getConstant("GreenFillWithDarkGreenText"),id:"greenft"},{text:r.getConstant("RedFill"),id:"redf"},{text:r.getConstant("RedText"),id:"redt"}];return new o.DropDownList({dataSource:y,index:0,popupHeight:"200px"}).appendTo(c),n},e.prototype.validateCfInput=function(e){var t=this.parent.serviceLocator.getService(Ai),r=e.target.value,n=t.dialogInstance.element.getElementsByClassName("e-clearall-btn")[0];r&&(e.target.classList.contains("e-between")||e.target.parentElement.querySelector(".e-between"))&&(r=e.target.parentElement.querySelector(e.target.classList.contains("e-between")?".e-input":".e-between").value),n.disabled=!r},e.prototype.checkCellHandler=function(e,t,r){for(var n=!1,i=r.range.trim().split(","),a=0;a<i.length;a++){var o=i[a],s=c(o=o.indexOf(":")>-1?o:o+":"+o);if(e>=s[0]&&e<=s[2]&&t>=s[1]&&t<=s[3]){n=!0;break}}return n},e.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(ki),r="";switch(e){case t.getConstant("GreaterThan")+"...":r=t.getConstant("FormatCellsGreaterThan");break;case t.getConstant("LessThan")+"...":r=t.getConstant("FormatCellsLessThan");break;case t.getConstant("Between")+"...":r=t.getConstant("FormatCellsBetween");break;case t.getConstant("CFEqualTo")+"...":r=t.getConstant("FormatCellsEqualTo");break;case t.getConstant("TextThatContains")+"...":r=t.getConstant("FormatCellsThatContainTheText");break;case t.getConstant("ADateOccuring")+"...":r=t.getConstant("FormatCellsThatContainADateOccurring");break;case t.getConstant("DuplicateValues")+"...":r=t.getConstant("FormatCellsDuplicate");break;case t.getConstant("Top10Items")+"...":case t.getConstant("Top10")+" %...":r=t.getConstant("FormatCellsTop");break;case t.getConstant("Bottom10Items")+"...":case t.getConstant("Bottom10")+" %...":r=t.getConstant("FormatCellsBottom");break;case t.getConstant("AboveAverage")+"...":r=t.getConstant("FormatCellsAbove");break;case t.getConstant("BelowAverage")+"...":r=t.getConstant("FormatCellsBelow")}return r},e.prototype.cFInitialRender=function(e){var t=this.parent.getActiveSheet().conditionalFormats;if(t)for(var r=0;r<t.length;r++){this.checkCellHandler(e.rowIdx,e.colIdx,t[r])&&this.cFInitialCheckHandler({rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell,td:e.td,conditionalFormat:t[r]})}},e.prototype.cFInitialCheckHandler=function(e){var t,r=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"],n=e.cell.value||"",i=e.conditionalFormat,a=e.td||this.parent.getCell(e.rowIdx,e.colIdx);if(a&&(i.type=i.type||"GreaterThan",i.cFColor=i.cFColor?i.cFColor:i.format?i.cFColor:"RedFT",this.cFRCheck(i,n,a,e.rowIdx,e.colIdx,!0))){for(var o=0;o<r.length;o++)if(a.classList.contains(r[o])){a.classList.remove(r[o]);break}i.format&&i.format.style&&(t=i.format.style);var s={};i.cFColor?(a.classList.add("e-"+i.cFColor.toLowerCase()),s=this.setFormat(s,i)):s=t,s.backgroundColor&&a.style.setProperty("background-color",s.backgroundColor),s.color&&a.style.setProperty("color",s.color),s.fontWeight&&a.style.setProperty("font-weight",s.fontWeight),s.fontStyle&&a.style.setProperty("font-style",s.fontStyle),s.textDecoration&&a.style.setProperty("text-decoration",s.textDecoration)}},e.prototype.checkConditionalFormatHandler=function(e){var r,n,i=!1,a=!1,o=this.parent.getActiveSheet(),s=e.cell,l=o.conditionalFormats,h=s?t.isNullOrUndefined(s.value)?"":s.value:"",d=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"];if(n=this.parent.getCell(e.rowIdx,e.colIdx),l&&!(l.length<1))for(var p=l.length-1;p>=0;p--){for(var u=l[p].range.trim().split(","),f=0;f<u.length;f++)if(g=(g=u[f]).indexOf(":")>-1?g:g+":"+g,r=c(g),e.rowIdx>=r[0]&&e.colIdx>=r[1]&&e.rowIdx<=r[2]&&e.colIdx<=r[3]){a=!0;break}if(a){if("GreaterThanLessThanEqualToBetweenContainsTextDateOccur".includes(o.conditionalFormats[p].type)){y=$(e.rowIdx,e.colIdx,o)&&$(e.rowIdx,e.colIdx,o).value?$(e.rowIdx,e.colIdx,o).value:"";i=(!t.isNullOrUndefined(y)||""!==y)&&this.cFRCheck(o.conditionalFormats[p],y,n),this.setColor(n,e.rowIdx,e.colIdx,p,i)}else if("Top10ItemsBottom10ItemsTop10%Bottom10%AboveAverageBelowAverageDuplicateUnique".includes(o.conditionalFormats[p].type))for(f=0;f<u.length;f++)for(var g=u[f],m=(r=c(g=g.indexOf(":")>-1?g:g+":"+g))[0];m<=r[2];m++){o.rows[m]||Ce(o,m,{});for(var v=r[1];v<=r[3];v++){o.rows[m].cells&&o.rows[m].cells[v]||Z(m,v,o,{});var y=$(m,v,o)&&$(m,v,o).value?$(m,v,o).value:"";i=this.cFRCheck(o.conditionalFormats[p],y,n,m,v,!1),n=this.parent.getCell(m,v),this.setColor(n,m,v,p,i)}}else if("BlueDataBarGreenDataBarRedDataBarOrangeDataBarLightBlueDataBarPurpleColorScaleGYRColorScaleRYGColorScaleGWRColorScaleRWGColorScaleBWRColorScaleRWBColorScaleWRColorScaleRWColorScaleGWColorScaleWGColorScaleGYColorScaleYGColorScaleThreeArrowsThreeArrowsGrayFourArrowsGrayFourArrowsFiveArrowsGrayFiveArrowsThreeTrafficLights1ThreeTrafficLights2ThreeSignsFourTrafficLightsFourRedToBlackThreeSymbolsThreeSymbols2ThreeFlagsFourRatingFiveQuartersFiveRatingThreeTrianglesThreeStarsFiveBoxes".includes(o.conditionalFormats[p].type)){for(var C=0;C<d.length;C++)n.classList.contains(d[C])&&n.classList.remove(d[C]);i=this.cFRCheck(o.conditionalFormats[p],h,n,e.rowIdx,e.colIdx,!1)}a=!1}if(i)break}},e.prototype.setColor=function(e,r,n,i,a){var o=this.parent.getActiveSheet().conditionalFormats,s=["e-redft","e-yellowft","e-greenft","e-redf","e-redt"],l=!1;if(o[i].cFColor)e&&e.classList.contains("e-"+o[i].cFColor.toLowerCase())&&(l=!0);else if(o[i].format.style.backgroundColor&&e.style.backgroundColor){var h=this.hexToRgb(o[i].format.style.backgroundColor);"rgb("+h.r+", "+h.g+", "+h.b+")"===e.style.backgroundColor&&(l=!0)}if(a){if(l)for(d=0;d<s.length;d++)if(e.classList.contains(s[d])){e.classList.remove(s[d]);break}c={};o[i].cFColor?(e.classList.add("e-"+o[i].cFColor.toLowerCase()),c=this.setFormat(c,o[i])):c=o[i].format.style,this.parent.notify(It,{style:c,rowIdx:r,colIdx:n,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0})}else{if(l){for(var d=0;d<s.length;d++)if(e.classList.contains(s[d])){e.classList.remove(s[d]);break}e.removeAttribute("style")}var p=$(r,n,this.parent.getActiveSheet(),null,!0),c=t.extend({},this.parent.commonCellStyle,p.style);this.parent.notify(It,{style:c,rowIdx:r,colIdx:n})}},e.prototype.hexToRgb=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null},e.prototype.cFRCheck=function(e,t,r,n,i,a){var o="",s="",l=t.toString();if(e.value){var h=e.value.split(",");if(h.length>1)if(h[0].split("(").length>1){for(var d="",p=0;p<h.length;p++)(d+=h[p]+",").split("(").length===d.split(")").length&&""===o&&(o=d.substring(0,d.length-1),d="");s=d.substring(0,d.length-1)}else{o=h[0];for(p=1;p<h.length;p++)s+=p+1===h.length?h[p]:h[p]+","}else o=e.value}var c=!1,u=e.type;"BlueDataBarGreenDataBarRedDataBarOrangeDataBarLightBlueDataBarPurpleDataBar".includes(u)&&(u="DataBar"),"GYRColorScaleRYGColorScaleGWRColorScaleRWGColorScaleBWRColorScaleRWBColorScaleWRColorScaleRWColorScaleGWColorScaleWGColorScaleGYColorScaleYGColorScale".includes(u)&&(u="ColorScale"),"ThreeArrowsThreeArrowsGrayFourArrowsGrayFourArrowsFiveArrowsGrayFiveArrowsThreeTrafficLights1ThreeTrafficLights2ThreeSignsFourTrafficLightsFourRedToBlackThreeSymbolsThreeSymbols2ThreeFlagsFourRatingFiveQuartersFiveRatingThreeTrianglesThreeStarsFiveBoxes".includes(u)&&(u="IconSet");var f={};switch(u){case"GreaterThan":c=this.isGreaterThanLessThan(e,l,o,!0);break;case"LessThan":c=this.isGreaterThanLessThan(e,l,o,!1);break;case"Between":c=this.isBetWeen(e,l,o,s);break;case"EqualTo":c=this.isEqualTo(e,l,o);break;case"ContainsText":c=this.isContainsText(l,o);break;case"DateOccur":f={value:o,rowIndex:0,colIndex:0,sheetIndex:0,updatedVal:""},this.parent.notify(Rt,f),l===f.updatedVal&&(c=!0);break;case"Unique":case"Duplicate":c=this.isDuplicateUnique(l,e);break;case"Top10Items":c=this.isTopBottomTenValue(l,o,e,!0);break;case"Bottom10Items":c=this.isTopBottomTenValue(l,o,e,!1);break;case"Top10Percentage":c=this.isTopBottomTenPercentage(l,o,e,!0);break;case"Bottom10Percentage":c=this.isTopBottomTenPercentage(l,o,e,!1);break;case"AboveAverage":c=this.isAboveBelowAverage(l,o,e,!0);break;case"BelowAverage":c=this.isAboveBelowAverage(l,o,e,!1);break;case"DataBar":case"ColorScale":case"IconSet":this.isDataBarColorScalesIconSets(u,l,e,r,n,i,a)}return c},e.prototype.isDataBarColorScalesIconSets=function(e,t,r,n,i,a,o){var s=this.parent.getActiveSheet();if(o)"DataBar"===e?this.applyDataBars(t,r,n,i,a):"ColorScale"===e?this.applyColorScale(t,r,n,i,a):this.applyIconSet(t,r,n,i,a);else{n=null;for(var l=r.range.split(","),h=0;h<l.length;h++)for(var d=c(l[h]),p=d[0];p<=d[2];p++)for(var u=d[1];u<=d[3];u++)if($(p,u,s)){var f=$(p,u,s).value;n=this.parent.getCell(p,u),"DataBar"===e?this.applyDataBars(f,r,n,p,u):"ColorScale"===e?this.applyColorScale(f,r,n,p,u):this.applyIconSet(f,r,n,p,u)}}},e.prototype.applyIconSet=function(e,r,n,i,a){var o=parseInt(e,10),s=this.getIconList(r.type).split(","),l=[],h=this.parent.getActiveSheet(),d=h.rows[i]&&h.rows[i].cells[a]?h.rows[i].cells[a]:null;if(d){for(var p=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[a],u=r.range.split(","),f=0;f<u.length;f++){var g=c(u[f]);l=this.getNumericArray(g,l)}var m,v=(l=l.sort(function(e,t){return e-t}))[0],y=l[l.length-1];if(3===s.length){var C=v+.33*(y-v);m="e-"+(o>=v+.67*(y-v)?s[0].trim():o>=C?s[1].trim():s[2].trim())}else if(4===s.length){var b=v+.25*(y-v),S=v+.5*(y-v);m="e-"+(o>=(x=v+.75*(y-v))?s[0].trim():o>=S?s[1].trim():o>=b?s[2].trim():s[3].trim())}else if(5===s.length){var b=v+.2*(y-v),S=v+.4*(y-v),x=v+.6*(y-v);m="e-"+(o>=v+.8*(y-v)?s[0].trim():o>=x?s[1].trim():o>=S?s[2].trim():o>=b?s[3].trim():s[4].trim())}if(!t.isNullOrUndefined(d)){var w=this.parent.createElement("span",{className:"e-icon"});w.classList.add("e-iconsetspan"),w.classList.add(m),this.applyIconSetIcon({rowIndex:i,colIndex:a},w,p)}}},e.prototype.applyIconSetIcon=function(e,t,r){var n=this.parent.getActiveSheet(),i=$(e.rowIndex,e.colIndex,n).value,a=r;a.classList.contains("e-iconset")&&a.querySelector(".e-iconsetspan")&&a.removeChild(a.querySelector(".e-iconsetspan")),L(i)&&(a.insertBefore(t,a.childNodes[0]),a.classList.add("e-iconset"))},e.prototype.getIconList=function(e){switch(e){case"ThreeArrows":return"3arrows-1,3arrows-2,3arrows-3";case"ThreeArrowsGray":return"3arrowsgray-1,3arrowsgray-2,3arrowsgray-3";case"FourArrowsGray":return"4arrowsgray-1,4arrowsgray-2,4arrowsgray-3,4arrowsgray-4";case"FourArrows":return"4arrows-1,4arrows-2,4arrows-3,4arrows-4";case"FiveArrowsGray":return"5arrowsgray-1,5arrowsgray-2,5arrowsgray-3,5arrowsgray-4,5arrowsgray-5";case"FiveArrows":return"5arrows-1,5arrows-2,5arrows-3,5arrows-4,5arrows-5";case"ThreeTrafficLights1":return"3trafficlights-1,3trafficlights-2,3trafficlights-3";case"ThreeTrafficLights2":return"3rafficlights2-1,3rafficlights2-2,3rafficlights2-3";case"ThreeSigns":return"3signs-1,3signs-2,3signs-3";case"FourTrafficLights":return"4trafficlights-1,4trafficlights-2,4trafficlights-3,4trafficlights-4";case"FourRedToBlack":return"4redtoblack-1,4redtoblack-2,4redtoblack-3,4redtoblack-4";case"ThreeSymbols":return"3symbols-1,3symbols-2,3symbols-3";case"ThreeSymbols2":return"3symbols2-1,3symbols2-2,3symbols2-3";case"ThreeFlags":return"3flags-1,3flags-2,3flags-3";case"FourRating":return"4rating-1,4rating-2,4rating-3,4rating-4";case"FiveQuarters":return"5quarters-1,5quarters-2,5quarters-3,5quarters-4,5quarters-5";case"FiveRating":return"5rating-1,5rating-2,5rating-3,5rating-4,5rating-5";case"ThreeTriangles":return"3triangles-1,3triangles-2,3triangles-3";case"ThreeStars":return"3stars-1,3stars-2,3stars-3";case"FiveBoxes":return"5boxes-1,5boxes-2,5boxes-3,5boxes-4,5boxes-5"}return"3arrows-1,3arrows-2,3arrows-3"},e.prototype.applyColorScale=function(e,r,n,i,a){var o,s=this.parent.getActiveSheet(),l=parseInt(e,10),h=[],d=this.getColor(r.type),p=s.rows[i]&&s.rows[i].cells[a]?s.rows[i].cells[a]:null;if(p){for(var u=r.range.split(","),f=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[a],g=0;g<u.length;g++){var m=c(u[g]);h=this.getNumericArray(m,h)}h=h.sort(function(e,t){return e-t}).reverse();for(var v=0;v<h.length;v++)if(h[v]===l){o=v;break}var y=0===o?d[0]:o===h.length-1?d[d.length-1]:3===h.length&&1===o?d[1]:this.getGradient(o,d[0],d[1],d[2],h.length);if(!t.isNullOrUndefined(p)){var C={};t.isNullOrUndefined(o)?(C=this.parent.getCellStyleValue(["backgroundColor"],[i,a]),f.style.backgroundColor=C.backgroundColor):(C={backgroundColor:y},f.style.backgroundColor=y)}}},e.prototype.applyDataBars=function(e,r,n,i,a){var o=this.parent.getActiveSheet(),s={},l={},h="",d="",p=r.type,u=o.rows[i].cells&&o.rows[i].cells[a]?o.rows[i].cells[a]:null;if(u){for(var f,g=[],m=this.parent.getMainContent().getElementsByClassName("e-row")[i],v=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[a],y=m&&m.style?parseInt(m.style.height,10):20,C=[],b=[],S=0,x=parseInt(e,10),w=r.range.split(","),I=0;I<w.length;I++){var E=c(w[I]);g=this.getNumericArray(E,g)}for(var R=0;R<g.length;R++)for(var k=0;k<g.length;k++)g[k]>0?C.push(g[k]):b.push(g[k]);if(p="BlueDataBar"===p?"B":"GreenDataBar"===p?"G":"RedDataBar"===p?"R":"OrangeDataBar"===p?"O":"LightBlueDataBar"===p?"LB":"PurpleDataBar"===p?"P":"",h=this.getColor(p)[0],d=this.getColor("R")[0],C=C.sort(function(e,t){return e-t}).reverse(),(b=b.sort(function(e,t){return e-t})).length&&C.length)f=C[0]+Math.abs(b[0]),S=Math.abs(b[0]/f*100);else{if(!b.length&&!C.length)return;f=b.length?b[0]:C[0]}if(v&&(t.isNullOrUndefined(x)||""===e)&&v.getElementsByClassName("e-cf-databar")[0]&&v.removeChild(v.getElementsByClassName("e-cf-databar")[0]),L(x)){var A=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),T=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),F=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),N=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),D=void 0;s=T.style,l=F.style,A.appendChild(N),A.insertBefore(F,N),A.insertBefore(T,F),v.querySelector(".e-iconsetspan")&&(D=v.querySelector(".e-iconsetspan")),v.textContent="",v.appendChild(A),D&&v.insertBefore(D,v.firstElementChild),N.innerHTML=this.parent.getDisplayText(u),A.style.height=y-1+"px",N.style.fontSize="11pt",b.length?C.length?x>-1?(s.width=S+"%",s.height=y-3+"px",s.backgroundColor="transparent",s.left="0px",l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=h,l.left=S+"%"):x<0&&(s.width=Math.ceil(Math.abs(x/f*100))+"%",s.height=y-3+"px",s.backgroundColor=d,s.width===S+"%"?s.left="0px":s.right=100-S+"%"):(l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=d,l.left="0px"):(l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=h,l.left="0px")}}},e.prototype.getNumericArray=function(e,r){for(var n=this.parent.getActiveSheet(),i=e[0];i<=e[2];i++)for(var a=e[1];a<=e[3];a++){var o=$(i,a,n)&&$(i,a,n).value?$(i,a,n).value:"";if(t.isNullOrUndefined(o)||L(o)||F(o)){var s=parseInt(o,10);t.isNullOrUndefined(o)||""===o||r.push(s)}}return r},e.prototype.getColor=function(e){if("LB"===e)return["#008aef"];for(var t=e.split(""),r=[],n=0;n<t.length;n++)switch(t[n]){case"G":r.push("#63be7b");break;case"Y":r.push("#ffeb84");break;case"R":r.push("#f8696b");break;case"W":r.push("#ffffff");break;case"B":r.push("#5a8ac6");break;case"O":r.push("#ffb628");break;case"LB":r.push("#008aef");break;case"P":r.push("#d6007b")}return r},e.prototype.getGradient=function(e,r,n,i,a){if(t.isNullOrUndefined(i))return this.getLinear(r,n,e/a);var o=a/2;return e>=o?this.getLinear(n,i,Math.abs((e-o)/o)):this.getLinear(r,n,e/o)},e.prototype.getLinear=function(e,t,r){return"#"+this.byteLinear(e[1]+e[2],t[1]+t[2],r)+this.byteLinear(e[3]+e[4],t[3]+t[4],r)+this.byteLinear(e[5]+e[6],t[5]+t[6],r)},e.prototype.byteLinear=function(e,t,r){var n=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(n).toString(16)},e.prototype.isGreaterThanLessThan=function(e,t,r,n){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g),a=!1;if(L(t))if(L(r))a=n?parseFloat(t)>parseFloat(r.replace(i,"")):parseFloat(t)<parseFloat(r.replace(i,""));else{var o={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(Rt,o),o.isDate||o.isTime?(a=n?t>o.updatedVal:t<o.updatedVal,e.value=o.updatedVal.toString()):a=n?t.toLowerCase()>r.toLowerCase():t.toLowerCase()<r.toLowerCase()}else""!==t||n||(a=!0);return a},e.prototype.isBetWeen=function(e,t,r,n){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g),a=!1;if(r=r.replace(i,""),n=n.replace(i,""),L(t))if(L(r))a=parseFloat(t)>=parseFloat(r)&&parseFloat(t)<=parseFloat(n);else if(r&&n){var o={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1},s={value:n,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(Rt,o),this.parent.notify(Rt,s),(o.isDate||o.isTime)&&(s.isDate||s.isTime)?(a=t>=o.updatedVal&&t<=s.updatedVal,e.value=o.updatedVal.toString()+","+s.updatedVal.toString()):a=t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase()}return a},e.prototype.isEqualTo=function(e,t,r){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g),i=!1;if(L(t))if(L(r))i=parseFloat(t)===parseFloat(r.replace(n,""));else{var a={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(Rt,a),a.isTime||a.isDate?(i=t===a.updatedVal,e.value=a.updatedVal.toString()):i=t.toLowerCase()===r.toLowerCase()}return i},e.prototype.isContainsText=function(e,r){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g),i=!1;return t.isNullOrUndefined(e)||!e.length?i=!1:L(r.replace(n,""))?(r=r.replace(n,""),F(e)&&(e=T(e).toString()),i=e.indexOf(r)>-1):F(r)?(F(e)&&(e=T(e).toString()),i=e.indexOf(T(r).toString())>-1):i=e.toLowerCase().indexOf(r.toLowerCase())>-1,i},e.prototype.isTopBottomTenValue=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=parseInt(e,10),s=parseInt(t,10),l=!1;if(L(t)){L(e)?(o=parseFloat(e),s=parseFloat(t.replace(a,""))):F(e)&&(o=T(e),s=parseFloat(t));for(var h=[],d=void 0,p=r.range.split(","),u=0;u<p.length;u++)for(var f=c(p[u]),g=f[0];g<=f[2];g++)for(var m=f[1];m<=f[3];m++)(d=$(g,m,i)&&$(g,m,i).value?$(g,m,i).value:"")&&L(d)&&(d=parseFloat(d),h.push(d));l=(h=(h=n?h.sort(function(e,t){return e-t}).reverse():h.sort(function(e,t){return e-t})).slice(0,s)).indexOf(o)>-1}return l},e.prototype.isTopBottomTenPercentage=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=parseInt(e,10),s=parseInt(t,10),l=!1;if(L(t)){L(e)?(o=parseFloat(e),s=parseFloat(t.replace(a,""))):F(e)&&(o=T(e),s=parseFloat(t));for(var h=[],d=void 0,p=0,u=void 0,f=r.range.split(","),g=0;g<f.length;g++)for(var m=c(f[g]),v=m[0];v<=m[2];v++)for(var y=m[1];y<=m[3];y++)(d=$(v,y,i)&&$(v,y,i).value?$(v,y,i).value:"")&&L(d)&&(d=parseFloat(d),h.push(d)),p++;u=s/(100/p),u=Math.ceil(u),l=(h=(h=n?h.sort(function(e,t){return e-t}).reverse():h.sort(function(e,t){return e-t})).slice(0,u||1)).indexOf(o)>-1}return l},e.prototype.isAboveBelowAverage=function(e,t,r,n){for(var i,a=this.parent.getActiveSheet(),o=parseFloat(e),s=r.range.split(","),l=[],h=0,d=0;d<s.length;d++)for(var p=c(s[d]),u=p[0];u<=p[2];u++)for(var f=p[1];f<=p[3];f++)(i=$(u,f,a)&&$(u,f,a).value?$(u,f,a).value:"")&&L(i)&&(i=parseFloat(i),l.push(i));for(var g=0;g<l.length;g++)h+=l[g];return h/=l.length,n?o>h:o<h},e.prototype.isDuplicateUnique=function(e,r){var n,i=r.type,a=0,o=this.parent.getActiveSheet(),s=e,l=r.range.split(",");if(t.isNullOrUndefined(s)||""===s)return!1;for(var h=0;h<l.length;h++)for(var d=c(l[h]),p=d[0];p<=d[2];p++)for(var u=d[1];u<=d[3];u++)if((n=$(p,u,o)&&$(p,u,o).value?$(p,u,o).value.toString():"")&&""!==n&&2===(a=s.toLowerCase()===n.toLowerCase()?a+1:a))return"Duplicate"===i;return"Duplicate"!==i},e.prototype.setFormat=function(e,t){switch(t.cFColor){case"RedFT":e.backgroundColor="#ffc7ce",e.color="#9c0055";break;case"YellowFT":e.backgroundColor="#ffeb9c",e.color="#9c6500";break;case"GreenFT":e.backgroundColor="#c6efce",e.color="#006100";break;case"RedF":e.backgroundColor="#ffc7ce";break;case"RedT":e.color="#9c0055"}return e},e.prototype.getModuleName=function(){return"conditionalFormatting"},e}(),ti=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ri=function(){return(ri=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e}).apply(this,arguments)},ni=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},ii=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ti(r,e),ni([t.Property("")],r.prototype,"text",void 0),ni([t.Property("")],r.prototype,"iconCss",void 0),ni([t.Property("left")],r.prototype,"iconPosition",void 0),r}(t.ChildProperty),ai=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ti(r,e),ni([t.Complex({},ii)],r.prototype,"header",void 0),ni([t.Collection([],n.Item)],r.prototype,"content",void 0),ni([t.Property("")],r.prototype,"cssClass",void 0),ni([t.Property(!1)],r.prototype,"disabled",void 0),r}(t.ChildProperty),oi=function(e){function r(t,r){return e.call(this,t)||this}return ti(r,e),r.prototype.preRender=function(){},r.prototype.render=function(){this.element.id||(this.element.id=t.getUniqueID("ribbon")),this.renderRibbon()},r.prototype.destroy=function(){var r=this.element.querySelector(".e-drop-icon");if(r&&r.removeEventListener("click",this.ribbonExpandCollapse.bind(this)),this.menuItems.length){var n=document.getElementById(this.element.id+"_menu");n&&t.getComponent(n,"menu").destroy()}this.toolbarObj.destroy(),this.tabObj.destroy(),this.element.innerHTML="",this.toolbarObj=null,this.tabObj=null,e.prototype.destroy.call(this)},r.prototype.getTabItems=function(){var e=this,t=[];return this.menuItems.length&&t.push({header:{text:this.initMenu(this.menuItems)},content:this.toolbarObj.element,cssClass:"e-menu-tab"}),this.items.forEach(function(r){t.push({header:r.header,content:e.toolbarObj.element})}),t},r.prototype.initMenu=function(e){var r=this,i=this.createElement("ul",{id:this.element.id+"_menu"});this.element.appendChild(i);var a=new n.Menu({cssClass:"e-file-menu",items:e,showItemOnClick:!0,beforeOpen:function(t){t.parentItem.text===e[0].text&&(a.showItemOnClick=!1),r.trigger("beforeOpen",t)},select:function(e){r.trigger("fileMenuItemSelect",e)},beforeClose:function(n){if("mouseover"===n.event.type&&!t.closest(n.event.target,".e-menu-popup"))return void(n.cancel=!0);r.trigger("beforeClose",n),n.parentItem&&n.parentItem.text!==e[0].text||requestAnimationFrame(function(){return a.setProperties({showItemOnClick:!0},!0)})},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)}});return a.createElement=this.createElement,a.appendTo(i),i.parentElement},r.prototype.renderRibbon=function(){var e=this,r=this.createElement("div"),i=this.createElement("div");this.toolbarObj=new n.Toolbar({items:this.items[this.selectedTab].content,clicked:function(t){return e.trigger("clicked",t)}}),this.toolbarObj.createElement=this.createElement,this.toolbarObj.appendTo(i),this.tabObj=new n.Tab({selectedItem:this.getIndex(this.selectedTab),animation:{next:{duration:0},previous:{duration:0}},items:this.getTabItems(),selecting:function(r){if(e.menuItems.length&&0===r.selectingIndex)r.cancel=!0;else{if(r.selectingIndex===e.getIndex(e.selectedTab))return;e.updateToolbar(e.getIndex(r.selectingIndex,!0)),e.toolbarObj.dataBind(),e.element.classList.contains("e-collapsed")&&t.EventHandler.remove(r.selectedItem,"click",e.ribbonExpandCollapse);var n=void 0;e.menuItems.length?((n=ri({},r)).selectingIndex-=1,n.selectedIndex-=1):n=r,e.trigger("selecting",n)}},selected:function(t){t.selectedIndex!==e.getIndex(e.selectedTab)&&(e.setProperties({selectedTab:e.getIndex(t.selectedIndex,!0)},!0),e.element.classList.contains("e-collapsed")&&(e.element.classList.remove("e-collapsed"),e.trigger("expandCollapse",{element:e.toolbarObj.element,expanded:!0})))},created:function(){e.toolbarObj.refreshOverflow()}}),this.element.appendChild(r),this.tabObj.createElement=this.createElement,this.tabObj.appendTo(r);var a=this.createElement("span",{className:"e-drop-icon e-icons"});a.addEventListener("click",this.ribbonExpandCollapse.bind(this)),this.element.appendChild(a)},r.prototype.ribbonExpandCollapse=function(e){var r,n={element:this.toolbarObj.element,expanded:!0};this.element.classList.contains("e-collapsed")?(r=this.tabObj.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[this.tabObj.selectedItem],this.element.classList.remove("e-collapsed"),r.classList.add("e-active"),t.EventHandler.remove(r,"click",this.ribbonExpandCollapse),this.trigger("expandCollapse",n)):(r=this.tabObj.element.querySelector(".e-tab-header .e-toolbar-item.e-active"),this.element.classList.add("e-collapsed"),n.expanded=!1,r.classList.remove("e-active"),t.EventHandler.add(r,"click",this.ribbonExpandCollapse,this),this.trigger("expandCollapse",n))},r.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},r.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},r.prototype.enableMenuItems=function(e,r,n){void 0===r&&(r=!0),this.menuItems.length&&t.getComponent(document.getElementById(this.element.id+"_menu"),"menu").enableItems(e,r,n)},r.prototype.hideMenuItems=function(e,r,n){if(void 0===r&&(r=!0),this.menuItems.length){var i=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");r?i.hideItems(e,n):i.showItems(e,n)}},r.prototype.addMenuItems=function(e,r,n,i){if(void 0===n&&(n=!0),this.menuItems.length){var a=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");n?a.insertAfter(e.reverse(),r,i):a.insertBefore(e,r,i)}},r.prototype.hideTabs=function(e,t){var r=this;void 0===t&&(t=!0);var n,i,a,o;if(t||(o=this.isAllHidden()),e.forEach(function(e){(n=r.getTabIndex(e,-1))>-1&&(t?r.items[n].cssClass.includes(" e-hide")||(r.items[n].cssClass=r.items[n].cssClass+" e-hide",r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0):r.items[n].cssClass.includes(" e-hide")&&(r.items[n].cssClass=r.items[n].cssClass.replace(" e-hide",""),r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(o=this.isAllHidden())&&(i=!1),!t&&o&&(i=!i),a&&o&&(this.element.classList.contains("e-collapsed")?(this.element.classList.remove("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.remove("e-hide")):(this.element.classList.add("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.add("e-hide"))),i)for(var s=0;s<this.items.length;s++)if(!this.items[s].cssClass.includes(" e-hide")){this.tabObj.selectedItem=this.getIndex(s),this.tabObj.dataBind();break}},r.prototype.isAllHidden=function(){for(var e=!0,t=0;t<this.items.length;t++)if(!this.items[t].cssClass.includes(" e-hide")){e=!1;break}return e},r.prototype.enableTabs=function(e,t){var r=this;void 0===t&&(t=!0),e.forEach(function(e){var n=r.getTabIndex(e,-1);n>-1&&(r.items[n].disabled=!t,n=r.getIndex(n),r.tabObj.enableTab(n,t))}),this.setProperties({items:this.items},!0)},r.prototype.addTabs=function(e,t){var r=this,n=this.getTabIndex(t);e.forEach(function(e){e=new ai(r.items[0],"items",e,!0),r.items.splice(n,0,e),r.tabObj.addTab([{header:e.header,content:r.toolbarObj.element}],r.getIndex(n)),n++}),this.setProperties({items:this.items},!0),this.setProperties({selectedTab:this.getIndex(this.tabObj.selectedItem,!0)},!0)},r.prototype.getTabIndex=function(e,t){if(void 0===t&&(t=this.items.length),e)for(var r=0;r<this.items.length;r++)if(this.items[r].header.text===e){t=r;break}return t},r.prototype.addToolbarItems=function(e,r,i){var a=this,o=this.getTabIndex(e);t.isNullOrUndefined(i)&&(i=this.items[o].content.length),r.forEach(function(e){e=new n.Item(a.items[o].content[0],"content",e,!0),a.items[o].content.splice(i,0,e),i++}),this.setProperties({items:this.items},!0),o===this.selectedTab&&r.length&&this.updateToolbar(o)},r.prototype.enableItems=function(e,t,r){if(void 0===r&&(r=!0),t){var n=this.getTabIndex(e,-1);if(n<0)return;for(var i=0;i<t.length;i++){if("string"==typeof t[i])for(var a=0;a<this.items[n].content.length;a++)if(this.items[n].content[a].id===t[i]){t[i]=a;break}if("string"==typeof t[i])return;this.items[n].content[t[i]].disabled=!r,n!==this.selectedTab&&this.setProperties({items:this.items},!0)}n===this.selectedTab&&this.updateToolbar(n)}else this.toolbarObj.disable(!r)},r.prototype.hideToolbarItems=function(e,t,r){var n=this;void 0===r&&(r=!0);for(var i,a=0;a<this.items.length;a++)if(this.items[a].header.text===e){i=a,t.forEach(function(e){n.items[i].content[e]&&(r?n.items[i].content[e].cssClass.includes(" e-hide")||(n.items[i].content[e].cssClass=n.items[i].content[e].cssClass+" e-hide"):n.items[i].content[e].cssClass.includes(" e-hide")&&(n.items[i].content[e].cssClass=n.items[i].content[e].cssClass.replace(" e-hide","")))});break}this.setProperties({items:this.items},!0),void 0!==i&&i===this.selectedTab&&this.updateToolbar(i)},r.prototype.getModuleName=function(){return"ribbon"},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.onPropertyChanged=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++)switch(n[r]){case"selectedTab":this.tabObj.selectedItem=this.getIndex(e.selectedTab),this.tabObj.dataBind()}},ni([t.Property("")],r.prototype,"cssClass",void 0),ni([t.Property(!0)],r.prototype,"menuType",void 0),ni([t.Collection([],n.MenuItem)],r.prototype,"menuItems",void 0),ni([t.Property(0)],r.prototype,"selectedTab",void 0),ni([t.Collection([],ai)],r.prototype,"items",void 0),ni([t.Event()],r.prototype,"selecting",void 0),ni([t.Event()],r.prototype,"fileMenuItemSelect",void 0),ni([t.Event()],r.prototype,"beforeFileMenuItemRender",void 0),ni([t.Event()],r.prototype,"beforeOpen",void 0),ni([t.Event()],r.prototype,"beforeClose",void 0),ni([t.Event()],r.prototype,"selectFormat",void 0),ni([t.Event()],r.prototype,"clicked",void 0),ni([t.Event()],r.prototype,"created",void 0),ni([t.Event()],r.prototype,"expandCollapse",void 0),r=ni([t.NotifyPropertyChanges],r)}(t.Component),si=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.render=function(){var e=this,r=this.parent.element.id,n=this.parent.createElement("input",{attrs:{type:"color"}});this.fontColorPicker=new i.ColorPicker({value:"#000000ff",mode:"Palette",showButtons:!1,presetColors:Fi,enableOpacity:!1,beforeClose:function(){return e.beforeCloseHandler(e.fontColorPicker)},open:this.openHandler.bind(this),beforeModeSwitch:function(t){return e.beforeModeSwitch(e.fontColorPicker,t)},change:function(t){var r={style:{color:e.fontColorPicker.getValue(t.currentValue.rgba)},onActionUpdate:!0};e.parent.notify(wt,r),r.cancel?e.fontColorPicker.setProperties({value:e.fontColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.color,e.fontColorPicker.element),Ct(e.parent.element)},created:function(){return e.wireFocusEvent(e.fontColorPicker.element,"#000000")}}),this.fontColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.fontColorPicker.appendTo(n),n.parentElement.id=r+"_font_color_picker",t.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-font-color"]),n=this.parent.createElement("input",{attrs:{type:"color"}}),this.filColorPicker=new i.ColorPicker({value:"#ffff00ff",mode:"Palette",presetColors:Li,showButtons:!1,enableOpacity:!1,open:this.openHandler.bind(this),beforeClose:function(){return e.beforeCloseHandler(e.filColorPicker)},beforeModeSwitch:function(t){return e.beforeModeSwitch(e.filColorPicker,t)},change:function(t){var r={style:{backgroundColor:e.filColorPicker.getValue(t.currentValue.rgba)},onActionUpdate:!0};e.parent.notify(wt,r),r.cancel?e.filColorPicker.setProperties({value:e.filColorPicker.getValue(t.previousValue.rgba,"HEXA")},!0):e.updateSelectedColor(r.style.backgroundColor,e.filColorPicker.element),Ct(e.parent.element)},created:function(){return e.wireFocusEvent(e.filColorPicker.element,"#ffff00")}}),this.filColorPicker.createElement=this.parent.createElement,this.parent.element.appendChild(n),this.filColorPicker.appendTo(n),n.parentElement.id=r+"_fill_color_picker",t.addClass([n.nextElementSibling.getElementsByClassName("e-selected-color")[0]],["e-icons","e-fill-color"])},e.prototype.updateSelectedColor=function(e,t){t.nextElementSibling.querySelector(".e-selected-color").style.borderBottomColor=e},e.prototype.wireFocusEvent=function(e,t){var r=this;this.updateSelectedColor(t,e),(e=e.parentElement.querySelector(".e-split-colorpicker")).addEventListener("focus",function(){Ct(r.parent.element)})},e.prototype.openHandler=function(e){e.element.querySelector(".e-mode-switch-btn").title=this.parent.serviceLocator.getService(ki).getConstant("MoreColors")},e.prototype.beforeCloseHandler=function(e){e.modeSwitcher||e.setProperties({modeSwitcher:!0},!0),e.showButtons&&e.setProperties({showButtons:!1},!0)},e.prototype.beforeModeSwitch=function(e,t){var r=this.parent.serviceLocator.getService(ki);"Picker"===t.mode?(e.showButtons=!0,e.dataBind(),t.element.querySelector(".e-apply").title=r.getConstant("Apply"),t.element.querySelector(".e-cancel").title=r.getConstant("Cancel"),t.element.querySelector(".e-mode-switch-btn").title=r.getConstant("StandardColors")):(e.showButtons=!1,e.dataBind(),t.element.querySelector(".e-mode-switch-btn").title=r.getConstant("MoreColors"))},e.prototype.destroy=function(){this.parent&&(this.removeEventListener(),this.fontColorPicker.destroy(),this.fontColorPicker=null,this.filColorPicker.destroy(),this.filColorPicker=null,this.parent=null)},e.prototype.addEventListener=function(){this.parent.on("beforeRibbonCreate",this.render,this),this.parent.on("destroyRibbonComponents",this.destroy,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off("beforeRibbonCreate",this.render),this.parent.off("destroyRibbonComponents",this.destroy),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e}(),li=function(){function e(e){this.border="1px solid #000000",this.fontNameIndex=5,this.numPopupWidth=0,this.findValue="",this.preTabIdx=1,this.chartThemeIndex=5,this.parent=e,this.addEventListener(),new si(e)}return e.prototype.getModuleName=function(){return"ribbon"},e.prototype.initRibbon=function(e){if(!this.parent.showRibbon&&this.ribbon)return void this.destroy();this.parent.notify("beforeRibbonCreate",{}),this.parent.isMobileView()?this.createMobileView():this.createRibbon(e)},e.prototype.getRibbonMenuItems=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.element.id;return[{text:this.parent.isMobileView()?"":e.getConstant("File"),iconCss:this.parent.isMobileView()?"e-icons e-file-menu-icon":null,id:t+"_File",items:[{text:e.getConstant("New"),id:t+"_New",iconCss:"e-new e-icons"},{text:e.getConstant("Open"),id:t+"_Open",iconCss:"e-open e-icons"},{text:e.getConstant("SaveAs"),iconCss:"e-save e-icons",id:t+"_Save_As",items:[{text:e.getConstant("ExcelXlsx"),id:t+"_Xlsx",iconCss:"e-xlsx e-icons"},{text:e.getConstant("ExcelXls"),id:t+"_Xls",iconCss:"e-xls e-icons"},{text:e.getConstant("CSV"),id:t+"_Csv",iconCss:"e-csv e-icons"},{text:e.getConstant("PDF"),id:t+"_Pdf",iconCss:"e-pdf e-icons"}]}]}]},e.prototype.getRibbonItems=function(){var e=this,r=this.parent.element.id,n=this.parent.serviceLocator.getService(ki),i=[{header:{text:n.getConstant("Home")},content:[{prefixIcon:"e-undo-icon",tooltipText:n.getConstant("Undo")+" (Ctrl+Z)",id:r+"_undo",disabled:!0},{prefixIcon:"e-redo-icon",tooltipText:n.getConstant("Redo")+" (Ctrl+Y)",id:r+"_redo",disabled:!0},{type:"Separator",id:r+"_separator_1"},{prefixIcon:"e-cut-icon",tooltipText:n.getConstant("Cut")+" (Ctrl+X)",id:r+"_cut"},{prefixIcon:"e-copy-icon",tooltipText:n.getConstant("Copy")+" (Ctrl+C)",id:r+"_copy"},{tooltipText:n.getConstant("Paste")+" (Ctrl+V)",template:this.getPasteBtn(r),id:r+"_paste",disabled:!0},{type:"Separator",id:r+"_separator_2"},{template:this.getNumFormatDDB(r),tooltipText:n.getConstant("NumberFormat"),id:r+"_number_format"},{type:"Separator",id:r+"_separator_3"},{template:this.getFontNameDDB(r),tooltipText:n.getConstant("Font"),id:r+"_font_name"},{type:"Separator",id:r+"_separator_4"},{template:this.getFontSizeDDB(r),tooltipText:n.getConstant("FontSize"),id:r+"_font_size"},{type:"Separator",id:r+"_separator_5"},{template:this.getBtn(r,"bold"),tooltipText:n.getConstant("Bold")+" (Ctrl+B)",id:r+"_bold"},{template:this.getBtn(r,"italic"),tooltipText:n.getConstant("Italic")+" (Ctrl+I)",id:r+"_italic"},{template:this.getBtn(r,"line-through"),tooltipText:n.getConstant("Strikethrough")+" (Ctrl+5)",id:r+"_line-through"},{template:this.getBtn(r,"underline"),tooltipText:n.getConstant("Underline")+" (Ctrl+U)",id:r+"_underline"},{template:document.getElementById(r+"_font_color_picker"),tooltipText:n.getConstant("TextColor"),id:r+"_font_color_picker"},{type:"Separator",id:r+"_separator_6"},{template:document.getElementById(r+"_fill_color_picker"),tooltipText:n.getConstant("FillColor"),id:r+"_fill_color_picker"},{template:this.getBordersDBB(r),tooltipText:n.getConstant("Borders"),id:r+"_borders"},{template:this.getMergeSplitBtn(r),tooltipText:n.getConstant("MergeCells"),id:r+"_merge_cells",disabled:!0},{type:"Separator",id:r+"_separator_7"},{template:this.getTextAlignDDB(r),tooltipText:n.getConstant("HorizontalAlignment"),id:r+"_text_align"},{template:this.getVerticalAlignDDB(r),tooltipText:n.getConstant("VerticalAlignment"),id:r+"_vertical_align"},{template:this.getBtn(r,"wrap",!1),tooltipText:""+n.getConstant("WrapText"),id:r+"_wrap"}]},{header:{text:n.getConstant("Insert")},content:[{prefixIcon:"e-hyperlink-icon",text:n.getConstant("Link"),id:r+"_hyperlink",tooltipText:n.getConstant("Link"),click:function(){e.getHyperlinkDlg()}},{prefixIcon:"e-image-icon",text:n.getConstant("Image"),id:r+"_",tooltipText:n.getConstant("Image"),click:function(){t.select("#"+r+"_imageUpload",e.parent.element).click()}}]},{header:{text:n.getConstant("Formulas")},content:[{prefixIcon:"e-insert-function",tooltipText:n.getConstant("InsertFunction"),text:n.getConstant("InsertFunction"),id:r+"_insert_function"}]},{header:{text:n.getConstant("Data")},content:[{prefixIcon:"e-protect-icon",text:n.getConstant("ProtectSheet"),id:r+"_protect",tooltipText:n.getConstant("ProtectSheet")},{prefixIcon:"e-password-protect-icon",text:n.getConstant("ProtectWorkbook"),id:r+"_protectworkbook",tooltipText:n.getConstant("ProtectWorkbook")},{type:"Separator",id:r+"_separator_8"},{template:this.datavalidationDDB(r),tooltipText:n.getConstant("DataValidation"),id:r+"_datavalidation"}]},{header:{text:n.getConstant("View")},content:[{prefixIcon:"e-hide-headers",text:this.getLocaleText("Headers"),id:r+"_headers",tooltipText:this.getLocaleText("Headers")},{type:"Separator",id:r+"_separator_9"},{prefixIcon:"e-hide-gridlines",text:this.getLocaleText("GridLines"),id:r+"_gridlines",tooltipText:this.getLocaleText("GridLines")},{type:"Separator",id:r+"_separator_13"},{prefixIcon:"e-freeze-pane",text:n.getConstant("FreezePanes"),id:r+"_freezepanes",tooltipText:n.getConstant("FreezePanes")},{prefixIcon:"e-freeze-row",text:n.getConstant("FreezeRows"),id:r+"_freezerows",tooltipText:n.getConstant("FreezeRows")},{prefixIcon:"e-freeze-column",text:n.getConstant("FreezeColumns"),id:r+"_freezecolumns",tooltipText:n.getConstant("FreezeColumns")}]}];return this.parent.allowConditionalFormat&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({type:"Separator",id:r+"_separator_10"},{template:this.getCFDBB(r),tooltipText:n.getConstant("ConditionalFormatting"),id:r+"_conditionalformatting"}),this.parent.allowChart&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Insert")}).content.push({type:"Separator",id:r+"_separator_11"},{template:this.getChartDDB(r,!0),text:n.getConstant("Chart"),tooltipText:n.getConstant("Chart"),id:r+"_chart"}),this.parent.allowCellFormatting&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({type:"Separator",id:r+"_separator_12"},{template:this.getClearDDB(r),tooltipText:n.getConstant("Clear"),id:r+"_clear"}),(this.parent.allowSorting||this.parent.allowFiltering)&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({template:this.getSortFilterDDB(r),tooltipText:n.getConstant("SortAndFilter"),id:r+"_sorting"}),this.parent.allowFindAndReplace&&i.find(function(e){return e.header&&e.header.text===n.getConstant("Home")}).content.push({template:this.getFindDDb(r),prefixIcon:"e-tbar-search-icon tb-icons",tooltipText:n.getConstant("FindReplaceTooltip"),id:r+"_find"}),i},e.prototype.getPasteBtn=function(e){var t=this,r=this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_paste"})),n=this.parent.serviceLocator.getService(ki);return this.pasteSplitBtn=new l.SplitButton({iconCss:"e-icons e-paste-icon",items:[{text:n.getConstant("All"),id:"All"},{text:n.getConstant("Values"),id:"Values"},{text:n.getConstant("Formats"),id:"Formats"}],select:function(e){t.parent.notify(Jt,{type:e.item.id,isAction:!0,isInternal:!0})},click:function(){t.parent.notify(Jt,{isAction:!0,isInternal:!0})},close:function(){Ct(t.parent.element)}}),this.pasteSplitBtn.createElement=this.parent.createElement,this.pasteSplitBtn.appendTo(r),r.parentElement},e.prototype.getHyperlinkDlg=function(){var e,r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]];t.isNullOrUndefined(n)||(e=n.cells[r[1]]),t.isNullOrUndefined(e)&&Z(r[0],r[1],this.parent.getActiveSheet(),e,!1),e&&e.hyperlink?this.parent.notify("editHyperlink",null):this.parent.notify("initiateHyperlink",null)},e.prototype.passwordProtectDlg=function(){this.parent.password.length>0?this.parent.notify("unProtectWorkbook",null):document.getElementById(this.parent.element.id+"_protectworkbook").classList.contains("e-active")?(document.getElementById(this.parent.element.id+"_protectworkbook").classList.remove("e-active"),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled")):this.parent.notify("protectWorkbook",null)},e.prototype.getLocaleText=function(e,t){var r,n=this.parent.serviceLocator.getService(ki);return this.parent.getActiveSheet()["show"+e]?(t&&document.getElementById(this.parent.element.id+"_sheet").classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Hide"+e)):(t&&document.getElementById(this.parent.element.id+"_sheet").classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Show"+e)),r},e.prototype.getLocaleProtectText=function(e,t){var r,n=this.parent.serviceLocator.getService(ki);return this.parent.getActiveSheet().isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Unprotect"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Protect"+e)),r},e.prototype.getLocaleProtectWorkbook=function(e,t){var r,n=this.parent.serviceLocator.getService(ki);return this.parent.isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant(e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant(e)),r},e.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.ribbon.items.length-1;if(this.preTabIdx=this.ribbon.selectedTab,this.parent.allowChart&&this.ribbon.items[r]&&this.ribbon.items[r].header.text!==t.getConstant("ChartDesign")){var n=this.parent.element.id,i=[{header:{text:t.getConstant("ChartDesign")},content:[{template:this.getAddChartEleDBB(n),tooltipText:t.getConstant("AddChartElement"),id:n+"add_chart_ element_chart"},{type:"Separator"},{prefixIcon:"e-switch-row-column-icon",text:t.getConstant("SwitchRowColumn"),tooltipText:t.getConstant("SwitchRowColumn"),id:n+"switch_row_column_chart",click:function(){e.parent.notify("chartDesignTab",{switchRowColumn:!0})}},{type:"Separator"},{template:this.getChartThemeDDB(n),tooltipText:t.getConstant("ChartTheme"),id:n+"_chart_theme"},{type:"Separator"},{template:this.getChartDDB(n,!1),tooltipText:t.getConstant("ChartType"),id:n+"_chart_type"}]}];this.parent.addRibbonTabs(i),r=this.ribbon.items.length,this.ribbon.tabObj.select(r)}},e.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(ki),t=this.ribbon.items.length-1;this.parent.allowChart&&this.ribbon.items[t]&&this.ribbon.items[t].header.text===e.getConstant("ChartDesign")&&(this.ribbon.tabObj.select(this.preTabIdx+1),this.parent.hideRibbonTabs([e.getConstant("ChartDesign")],!0),document.getElementsByClassName("e-addchart-ddb").length>0&&document.getElementsByClassName("e-addchart-ddb")[0].remove(),document.getElementsByClassName("e-chart-type-ddb").length>0&&document.getElementsByClassName("e-chart-type-ddb")[0].remove(),document.getElementsByClassName("e-charttheme-ddb").length>0&&document.getElementsByClassName("e-charttheme-ddb")[0].remove(),delete this.ribbon.items[t].content[0],this.ribbon.items.length=this.ribbon.items.length-1)},e.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});if(this.ribbon=new oi({selectedTab:0,menuItems:this.getRibbonMenuItems(),items:this.getRibbonItems(),fileMenuItemSelect:this.fileMenuItemSelect.bind(this),beforeOpen:this.fileMenuBeforeOpen.bind(this),beforeClose:this.fileMenuBeforeClose.bind(this),clicked:this.toolbarClicked.bind(this),created:this.ribbonCreated.bind(this),selecting:this.tabSelecting.bind(this),expandCollapse:this.expandCollapseHandler.bind(this),beforeFileMenuItemRender:this.beforeRenderHandler.bind(this)}),this.ribbon.createElement=this.parent.createElement,e&&e.uiUpdate){var r=this.parent.element.querySelector(".e-formula-bar-panel")||document.getElementById(this.parent.element.id+"_sheet_panel");this.parent.element.insertBefore(t,r)}else this.parent.element.appendChild(t);this.ribbon.appendTo(t)},e.prototype.tabSelecting=function(e){e.selectingIndex!==this.ribbon.selectedTab&&(this.refreshRibbonContent(e.selectingIndex),this.parent.notify("tabSwitch",{activeTab:e.selectingIndex}))},e.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(ki);e.item.text!==t.getConstant("Open")||this.parent.openUrl&&this.parent.allowOpen||e.element.classList.add("e-disabled"),e.item.text!==t.getConstant("SaveAs")||this.parent.saveUrl&&this.parent.allowSave||e.element.classList.add("e-disabled")},e.prototype.getChartThemeDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_chart_theme"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"Material"})),this.chartThemeDDB=new l.DropDownButton({items:this.getChartThemeDdbItems(),content:"",select:function(e){return t.chartThemeDDBSelect(e)},close:function(){return t.parent.element.focus()},cssClass:"e-flat e-charttheme-ddb",beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.chartThemeDDB.createElement=this.parent.createElement,this.chartThemeDDB.appendTo(r),r},e.prototype.getNumFormatDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_number_format"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"General"})),this.numFormatDDB=new l.DropDownButton({items:this.getNumFormatDdbItems(e),content:"",select:function(e){return t.numDDBSelect(e)},open:function(e){return t.numDDBOpen(e)},beforeItemRender:function(e){return t.previewNumFormat(e)},close:function(){return Ct(t.parent.element)},cssClass:"e-flat e-numformat-ddb",beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.numFormatDDB.createElement=this.parent.createElement,this.numFormatDDB.appendTo(r),r},e.prototype.getFontSizeDDB=function(e){var t=this;return this.fontSizeDdb=new l.DropDownButton({cssClass:"e-font-size-ddb",content:"11",items:[{text:"8"},{text:"9"},{text:"10"},{text:"11"},{text:"12"},{text:"14"},{text:"16"},{text:"18"},{text:"20"},{text:"22"},{text:"24"},{text:"26"},{text:"28"},{text:"36"},{text:"48"},{text:"72"}],beforeOpen:function(e){t.tBarDdbBeforeOpen(e.element,e.items),t.refreshSelected(t.fontSizeDdb,e.element,"content","text")},select:function(e){var r={style:{fontSize:e.item.text+"pt"},onActionUpdate:!0};t.parent.notify(wt,r),r.cancel||(t.fontSizeDdb.content=r.style.fontSize.split("pt")[0],t.fontSizeDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),this.fontSizeDdb.createElement=this.parent.createElement,this.fontSizeDdb.appendTo(this.parent.createElement("button",{id:e+"_font_size"})),this.fontSizeDdb.element},e.prototype.getChartDDB=function(e,r){var i=this,a=this.parent.serviceLocator.getService(ki),o=r?"e-chart-menu":"e-chart-type-menu";this.chartMenu=new n.Menu({cssClass:o,items:[{iconCss:"e-icons e-column",text:a.getConstant("Column"),items:[{id:"column_chart"}]},{iconCss:"e-icons e-bar",text:a.getConstant("Bar"),items:[{id:"bar_chart"}]},{iconCss:"e-icons e-area",text:a.getConstant("Area"),items:[{id:"area_chart"}]},{iconCss:"e-icons e-pie-doughnut",text:a.getConstant("PieAndDoughnut"),items:[{id:"pie_doughnut_chart"}]},{iconCss:"e-icons e-line",text:a.getConstant("Line"),items:[{id:"line_chart"}]},{iconCss:"e-icons e-scatter",text:a.getConstant("Scatter"),items:[{id:"scatter_chart"}]}],orientation:"Vertical",beforeOpen:function(e){e.parentItem.text===a.getConstant("Column")?(e.element.firstChild.appendChild(s),e.element.parentElement.classList.add("e-column-chart")):e.parentItem.text===a.getConstant("Bar")?(e.element.firstChild.appendChild(y),e.element.parentElement.classList.add("e-bar-chart")):e.parentItem.text===a.getConstant("Area")?(e.element.firstChild.appendChild(A),e.element.parentElement.classList.add("e-area-chart")):e.parentItem.text===a.getConstant("Line")?(e.element.firstChild.appendChild(O),e.element.parentElement.classList.add("e-line-chart")):e.parentItem.text===a.getConstant("PieAndDoughnut")?(e.element.firstChild.appendChild(U),e.element.parentElement.classList.add("e-pie-doughnut-chart")):e.parentItem.text===a.getConstant("Radar")?(e.element.firstChild.appendChild(W),e.element.parentElement.classList.add("e-radar-chart")):e.parentItem.text===a.getConstant("Scatter")&&(e.element.firstChild.appendChild($),e.element.parentElement.classList.add("e-scatter-chart"))},select:this.chartSelected.bind(this)}),this.chartMenu.createElement=this.parent.createElement;var s=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),h=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text",innerHTML:a.getConstant("Column")}),d=this.parent.createElement("div",{id:"column1_cont",className:"e-column1-cont"}),p=this.parent.createElement("div",{id:"column2_cont",className:"e-column2-cont"});s.appendChild(h),s.appendChild(d);var c=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons"}),u=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons"}),f=this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons"}),g=this.parent.createElement("span",{id:"clusteredColumn3D",className:"e-clusteredColumn3D e-column-icon"}),m=this.parent.createElement("span",{id:"stackedColumn3D",className:"e-stackedColumn3D e-column-icon"}),v=this.parent.createElement("span",{id:"stackedColumn1003D",className:"e-stackedColumn1003D e-column-icon"});c.title=a.getConstant("ClusteredColumn"),u.title=a.getConstant("StackedColumn"),f.title=a.getConstant("StackedColumn100"),v.title=a.getConstant("OrangeDataBar"),m.title=a.getConstant("LightblueDataBar"),g.title=a.getConstant("PurpleDataBar"),d.appendChild(c),d.appendChild(u),d.appendChild(f),p.appendChild(g),p.appendChild(m),p.appendChild(v);var y=this.parent.createElement("div",{id:"bar_main",className:"e-bar-main"}),C=this.parent.createElement("div",{id:"bar1_text",className:"e-bar1-text",innerHTML:a.getConstant("Bar")}),b=this.parent.createElement("div",{id:"bar1_cont",className:"e-bar1-cont"}),S=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"});y.appendChild(C),y.appendChild(b);var x=this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons"}),w=this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons"}),I=this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons"}),E=this.parent.createElement("span",{id:"clusteredBar3D",className:"e-clusteredBar3D e-bar-icon"}),R=this.parent.createElement("span",{id:"stackedBar3D",className:"e-stackedBar3D e-bar-icon"}),k=this.parent.createElement("span",{id:"stackedBar1003D",className:"e-stackedBar1003D e-bar-icon"});x.title=a.getConstant("ClusteredBar"),w.title=a.getConstant("StackedBar"),I.title=a.getConstant("StackedBar100"),k.title=a.getConstant("OrangeDataBar"),R.title=a.getConstant("LightblueDataBar"),E.title=a.getConstant("PurpleDataBar"),b.appendChild(x),b.appendChild(w),b.appendChild(I),S.appendChild(E),S.appendChild(R),S.appendChild(k);var A=this.parent.createElement("div",{id:"area_main",className:"e-area-main"}),T=this.parent.createElement("div",{id:"area_text",className:"e-area-text",innerHTML:a.getConstant("Area")}),F=this.parent.createElement("div",{id:"area_cont",className:"e-area-cont"});A.appendChild(T),A.appendChild(F);var L=this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons"}),N=this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons"}),D=this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons"});L.title=a.getConstant("Area"),N.title=a.getConstant("StackedArea"),D.title=a.getConstant("StackedArea100"),F.appendChild(L),F.appendChild(N),F.appendChild(D);var O=this.parent.createElement("div",{id:"line_main",className:"e-line-main"}),H=this.parent.createElement("div",{id:"line_text",className:"e-line-text",innerHTML:a.getConstant("Line")}),B=this.parent.createElement("div",{id:"line_cont",className:"e-line-cont"});O.appendChild(H),O.appendChild(B);var M=this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons"}),P=this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons"}),_=this.parent.createElement("span",{id:"stackedline100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons"});M.title=a.getConstant("Line"),P.title=a.getConstant("StackedLine"),_.title=a.getConstant("StackedLine100"),B.appendChild(M),B.appendChild(P),B.appendChild(_);var U=this.parent.createElement("div",{id:"pie_main",className:"e-pie-main"}),V=this.parent.createElement("div",{id:"pie_text",className:"e-pie-text",innerHTML:a.getConstant("Pie")}),z=this.parent.createElement("div",{id:"pie_cont",className:"e-pie-cont"});U.appendChild(V),U.appendChild(z);var q=this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons"}),j=this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons"});q.title=a.getConstant("Pie"),j.title=a.getConstant("Doughnut"),z.appendChild(q),z.appendChild(j);var W=this.parent.createElement("div",{id:"radar_main",className:"e-radar-main"}),G=this.parent.createElement("div",{id:"radar_text",className:"e-radar-text",innerHTML:"Radar"}),Y=this.parent.createElement("div",{id:"radar_cont",className:"e-radar-cont"});W.appendChild(G),W.appendChild(Y);var X=this.parent.createElement("span",{id:"radar",className:"e-radar e-radar-icon e-menu-icon e-icons"}),K=this.parent.createElement("span",{id:"radar_markers",className:"e-radar-markers e-radar-icon e-menu-icon e-icons"});X.title=a.getConstant("BlueDataBar"),K.title=a.getConstant("GreenDataBar"),Y.appendChild(X),Y.appendChild(K);var $=this.parent.createElement("div",{id:"scatter_main",className:"e-scatter-main"}),Z=this.parent.createElement("div",{id:"scatter_text",className:"e-scatter-text",innerHTML:a.getConstant("Scatter")}),J=this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"});$.appendChild(Z),$.appendChild(J);var Q=this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons"});Q.title=a.getConstant("Scatter"),J.appendChild(Q);var ee=r?"_chart_menu":"_chart_type_menu",te=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+ee,styles:"display: none;"}));this.chartMenu.appendTo(te),te.classList.add("e-ul");var re=r?"e-chart-icon":"e-chart-type-icon",ne=r?"e-chart-ddb":"e-chart-type-ddb",ie=r?e+"_chart-btn":e+"_chart-type-btn";this.chartDdb=new l.DropDownButton({iconCss:"e-icons "+re,cssClass:ne,target:this.chartMenu.element.parentElement,created:function(){i.chartMenu.element.style.display=""},beforeClose:function(e){e.event&&t.closest(e.event.target,"."+ne)&&t.closest(e.event.target,"."+ne).id!==ie&&(e.cancel=!0)},close:function(){return Ct(i.parent.element)}}),this.chartDdb.createElement=this.parent.createElement;var ae;return r?(ae=this.parent.createElement("button",{id:ie})).appendChild(this.parent.createElement("span",{id:e+"_chart",innerHTML:a.getConstant("Chart")})):(ae=this.parent.createElement("button",{id:ie})).appendChild(this.parent.createElement("span",{id:e+"_chart_type",innerHTML:a.getConstant("ChartType")})),this.chartDdb.appendTo(ae),this.chartDdb.element},e.prototype.getAddChartEleDBB=function(e){var r=this,i=this.parent.serviceLocator.getService(ki);this.addChartMenu=new n.Menu({cssClass:"e-addchart-menu",title:i.getConstant("AddChartElement"),items:[{iconCss:"e-icons e-axes",text:i.getConstant("Axes"),items:[{iconCss:"e-icons e-ph-axes",id:"PHAxes",text:i.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axes",id:"PVAxes",text:i.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-axis-title",text:i.getConstant("AxisTitle"),items:[{iconCss:"e-icons e-ph-axistitle",id:"PHAxisTitle",text:i.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axistitle",id:"PVAxisTitle",text:i.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-chart-title",text:i.getConstant("ChartTitle"),items:[{iconCss:"e-icons e-ct-none",id:"ChartTitleNone",text:i.getConstant("None")},{iconCss:"e-icons e-ct-abovechart",id:"ChartTitleAbove",text:i.getConstant("AboveChart")}]},{iconCss:"e-icons e-data-labels",text:i.getConstant("DataLabels"),items:[{iconCss:"e-icons e-dl-none",id:"DLNone",text:i.getConstant("None")},{iconCss:"e-icons e-dl-center",id:"DLCenter",text:i.getConstant("Center")},{iconCss:"e-icons e-dl-insideend",id:"DLInsideend",text:i.getConstant("InsideEnd")},{iconCss:"e-icons e-dl-insidebase",id:"DLInsidebase",text:i.getConstant("InsideBase")},{iconCss:"e-icons e-dl-outsideend",id:"DLOutsideend",text:i.getConstant("OutsideEnd")}]},{iconCss:"e-icons e-gridlines",text:i.getConstant("Gridlines"),items:[{iconCss:"e-icons e-gl-major-horizontal",id:"GLMajorHorizontal",text:i.getConstant("PrimaryMajorHorizontal")},{iconCss:"e-icons e-gl-major-vertical",id:"GLMajorVertical",text:i.getConstant("PrimaryMajorVertical")},{iconCss:"e-icons e-gl-minor-horizontal",id:"GLMinorHorizontal",text:i.getConstant("PrimaryMinorHorizontal")},{iconCss:"e-icons e-gl-minor-vertical",id:"GLMinorVertical",text:i.getConstant("PrimaryMinorVertical")}]},{iconCss:"e-icons e-legends",text:i.getConstant("Legends"),items:[{iconCss:"e-icons e-legends-none",id:"LegendNone",text:i.getConstant("None")},{iconCss:"e-icons e-legends-right",id:"LegendsRight",text:i.getConstant("Right")},{iconCss:"e-icons e-legends-left",id:"LegendsLeft",text:i.getConstant("Left")},{iconCss:"e-icons e-legends-bottom",id:"LegendsBottom",text:i.getConstant("Bottom")},{iconCss:"e-icons e-legends-top",id:"LegendsTop",text:i.getConstant("Top")}]}],orientation:"Vertical",select:this.addChartEleSelected.bind(this)});var a=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_add_chart_menu",styles:"display: none;"}));this.addChartMenu.appendTo(a),a.classList.add("e-ul"),this.addChartDdb=new l.DropDownButton({iconCss:"e-icons e-addchart-icon",cssClass:"e-addchart-ddb",target:this.addChartMenu.element.parentElement,created:function(){r.addChartMenu.element.style.display=""},beforeClose:function(r){r.event&&t.closest(r.event.target,".e-addchart-ddb")&&t.closest(r.event.target,".e-addchart-ddb").id!==e+"_addchart"&&(r.cancel=!0)},close:function(){return r.parent.element.focus()}}),this.addChartDdb.createElement=this.parent.createElement;var o=this.parent.createElement("button",{id:e+"_addchart"});return o.appendChild(this.parent.createElement("span",{id:e+"_chart",innerHTML:i.getConstant("AddChartElement")})),this.addChartDdb.appendTo(o),this.addChartDdb.element},e.prototype.getCFDBB=function(e){var t=this,r=this.parent.serviceLocator.getService(ki);this.cFMenu=new n.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:r.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan",text:r.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan",text:r.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between",text:r.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto",text:r.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textthatcontains",text:r.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring",text:r.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues",text:r.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:r.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items",text:r.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10",text:r.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items",text:r.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10",text:r.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage",text:r.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage",text:r.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:r.getConstant("DataBars"),items:[{id:"cf_databars"}]},{iconCss:"e-icons e-colorscales",text:r.getConstant("ColorScales"),items:[{id:"cf_colorscales"}]},{iconCss:"e-icons e-iconsets",text:r.getConstant("IconSets"),items:[{id:"cf_iconsets"}]},{iconCss:"e-icons e-clearrules",text:r.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:r.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:r.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){e.parentItem.text===r.getConstant("DataBars")?(e.element.firstChild.appendChild(i),e.element.parentElement.classList.add("e-databars")):e.parentItem.text===r.getConstant("ColorScales")?(e.element.firstChild.appendChild(f),e.element.parentElement.classList.add("e-colorscales")):e.parentItem.text===r.getConstant("IconSets")&&(e.element.firstChild.appendChild(F),e.element.parentElement.classList.add("e-iconsets"))},select:this.cFSelected.bind(this)});var i=this.parent.createElement("div",{id:"db",className:"e-db"}),a=this.parent.createElement("div",{id:"db1",className:"e-db1"}),o=this.parent.createElement("div",{id:"db2",className:"e-db2"});i.appendChild(a),i.appendChild(o);var s=this.parent.createElement("span",{id:"BlueDataBar",className:"e-bdatabar e-databar-icon"}),h=this.parent.createElement("span",{id:"GreenDataBar",className:"e-gdatabar e-databar-icon"}),d=this.parent.createElement("span",{id:"RedDataBar",className:"e-rdatabar e-databar-icon"}),p=this.parent.createElement("span",{id:"OrangeDataBar",className:"e-odatabar e-databar-icon"}),c=this.parent.createElement("span",{id:"LightBlueDataBar",className:"e-lbdatabar e-databar-icon"}),u=this.parent.createElement("span",{id:"PurpleDataBar",className:"e-pdatabar e-databar-icon"});s.title=r.getConstant("BlueDataBar"),h.title=r.getConstant("GreenDataBar"),d.title=r.getConstant("RedDataBar"),p.title=r.getConstant("OrangeDataBar"),c.title=r.getConstant("LightblueDataBar"),u.title=r.getConstant("PurpleDataBar"),a.appendChild(s),a.appendChild(h),a.appendChild(d),o.appendChild(p),o.appendChild(c),o.appendChild(u),this.cFMenu.createElement=this.parent.createElement;var f=this.parent.createElement("div",{id:"db",className:"e-cs"}),g=this.parent.createElement("div",{id:"cs1",className:"e-cs1"}),m=this.parent.createElement("div",{id:"cs2",className:"e-cs2"}),v=this.parent.createElement("div",{id:"cs3",className:"e-cs3"});f.appendChild(g),f.appendChild(m),f.appendChild(v);var y=this.parent.createElement("span",{id:"GYRColorScale",className:"e-gyr e-colorscale-icon"}),C=this.parent.createElement("span",{id:"RYGColorScale",className:"e-ryg e-colorscale-icon"}),b=this.parent.createElement("span",{id:"GWRColorScale",className:"e-gwr e-colorscale-icon"}),S=this.parent.createElement("span",{id:"RWGColorScale",className:"e-rwg e-colorscale-icon"}),x=this.parent.createElement("span",{id:"BWRColorScale",className:"e-bwr e-colorscale-icon"}),w=this.parent.createElement("span",{id:"RWBColorScale",className:"e-rwb e-colorscale-icon"}),I=this.parent.createElement("span",{id:"WRColorScale",className:"e-wr e-colorscale-icon"}),E=this.parent.createElement("span",{id:"RWColorScale",className:"e-rw e-colorscale-icon"}),R=this.parent.createElement("span",{id:"GWColorScale",className:"e-gw e-colorscale-icon"}),k=this.parent.createElement("span",{id:"WGColorScale",className:"e-wg e-colorscale-icon"}),A=this.parent.createElement("span",{id:"GYColorScale",className:"e-gy e-colorscale-icon"}),T=this.parent.createElement("span",{id:"YGColorScale",className:"e-yg e-colorscale-icon"});y.title=r.getConstant("GYRColorScale"),C.title=r.getConstant("RYGColorScale"),b.title=r.getConstant("GWRColorScale"),S.title=r.getConstant("RWGColorScale"),x.title=r.getConstant("BWRColorScale"),w.title=r.getConstant("RWBColorScale"),I.title=r.getConstant("WRColorScale"),E.title=r.getConstant("RWColorScale"),R.title=r.getConstant("GWColorScale"),k.title=r.getConstant("WGColorScale"),A.title=r.getConstant("GYColorScale"),T.title=r.getConstant("YGColorScale"),g.appendChild(y),g.appendChild(C),g.appendChild(b),g.appendChild(S),m.appendChild(x),m.appendChild(w),m.appendChild(I),m.appendChild(E),v.appendChild(R),v.appendChild(k),v.appendChild(A),v.appendChild(T);var F=this.parent.createElement("div",{id:"is",className:"e-is"}),L=this.parent.createElement("div",{id:"is1",className:"e-is1",innerHTML:"Directional"}),N=this.parent.createElement("div",{id:"is2",className:"e-is2"}),D=this.parent.createElement("div",{id:"is3",className:"e-is3",innerHTML:"Shapes"}),O=this.parent.createElement("div",{id:"is4",className:"e-is4"}),H=this.parent.createElement("div",{id:"is5",className:"e-is5",innerHTML:"Indicators"}),B=this.parent.createElement("div",{id:"is6",className:"e-is6"}),M=this.parent.createElement("div",{id:"is7",className:"e-is7",innerHTML:"Ratings"}),P=this.parent.createElement("div",{id:"is8",className:"e-is8"});L.title=r.getConstant("GYColorScale"),N.title=r.getConstant("YGColorScale"),D.title=r.getConstant("GYColorScale"),O.title=r.getConstant("YGColorScale"),H.title=r.getConstant("GYColorScale"),B.title=r.getConstant("YGColorScale"),M.title=r.getConstant("GYColorScale"),P.title=r.getConstant("YGColorScale"),F.appendChild(L),F.appendChild(N),F.appendChild(D),F.appendChild(O),F.appendChild(H),F.appendChild(B),F.appendChild(M),F.appendChild(P);var _=this.parent.createElement("div",{id:"ThreeArrows",className:"e-3arrows e-is-wrapper"}),U=this.parent.createElement("div",{id:"ThreeArrowsGray",className:"e-3arrowsgray e-is-wrapper"}),V=this.parent.createElement("div",{id:"ThreeTriangles",className:"e-3triangles e-is-wrapper"}),z=this.parent.createElement("div",{id:"FourArrowsGray",className:"e-4arrowsgray e-is-wrapper"}),q=this.parent.createElement("div",{id:"FourArrows",className:"e-4arrows e-is-wrapper"}),j=this.parent.createElement("div",{id:"FiveArrowsGray",className:"e-5arrowsgray e-is-wrapper"}),W=this.parent.createElement("div",{id:"FiveArrows",className:"e-5arrows e-is-wrapper"});_.title=r.getConstant("ThreeArrowsColor"),U.title=r.getConstant("ThreeArrowsGray"),V.title=r.getConstant("ThreeTriangles"),z.title=r.getConstant("FourArrowsColor"),q.title=r.getConstant("FourArrowsGray"),j.title=r.getConstant("FiveArrowsColor"),W.title=r.getConstant("FiveArrowsGray"),N.appendChild(_),N.appendChild(U),N.appendChild(V),N.appendChild(z),N.appendChild(q),N.appendChild(j),N.appendChild(W);var G=this.parent.createElement("div",{id:"ThreeTrafficLights1",className:"e-3trafficlights e-is-wrapper"}),Y=this.parent.createElement("div",{id:"ThreeTrafficLights2",className:"e-3rafficlights2 e-is-wrapper"}),X=this.parent.createElement("div",{id:"ThreeSigns",className:"e-3signs e-is-wrapper"}),K=this.parent.createElement("div",{id:"FourTrafficLights",className:"e-4trafficlights e-is-wrapper"}),$=this.parent.createElement("div",{id:"FourRedToBlack",className:"e-4redtoblack e-is-wrapper"});G.title=r.getConstant("ThreeTrafficLights1"),Y.title=r.getConstant("ThreeTrafficLights2"),X.title=r.getConstant("ThreeSigns"),K.title=r.getConstant("FourTrafficLights"),$.title=r.getConstant("RedToBlack"),O.appendChild(G),O.appendChild(Y),O.appendChild(X),O.appendChild(K),O.appendChild($);var Z=this.parent.createElement("div",{id:"ThreeSymbols",className:"e-3symbols e-is-wrapper"}),J=this.parent.createElement("div",{id:"ThreeSymbols2",className:"e-3symbols2 e-is-wrapper"}),Q=this.parent.createElement("div",{id:"ThreeFlags",className:"e-3flags e-is-wrapper"});Z.title=r.getConstant("ThreeSymbols1"),J.title=r.getConstant("ThreeSymbols2"),Q.title=r.getConstant("ThreeFlags"),B.appendChild(Z),B.appendChild(J),B.appendChild(Q);var ee=this.parent.createElement("div",{id:"ThreeStars",className:"e-3stars e-is-wrapper"}),te=this.parent.createElement("div",{id:"FourRating",className:"e-4rating e-is-wrapper"}),re=this.parent.createElement("div",{id:"FiveQuarters",className:"e-5quarters e-is-wrapper"}),ne=this.parent.createElement("div",{id:"FiveRating",className:"e-5rating e-is-wrapper"}),ie=this.parent.createElement("div",{id:"FiveBoxes",className:"e-5boxes e-is-wrapper"});ee.title=r.getConstant("ThreeStars"),te.title=r.getConstant("FourRatings"),re.title=r.getConstant("FiveQuarters"),ne.title=r.getConstant("FiveRatings"),ie.title=r.getConstant("FiveBoxes"),P.appendChild(ee),P.appendChild(te),P.appendChild(re),P.appendChild(ne),P.appendChild(ie),_.appendChild(this.createElement("span","e-3arrows-1 e-iconsetspan")),_.appendChild(this.createElement("span","e-3arrows-2 e-iconsetspan")),_.appendChild(this.createElement("span","e-3arrows-3 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-1 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-2 e-iconsetspan")),U.appendChild(this.createElement("span","e-3arrowsgray-3 e-iconsetspan")),V.appendChild(this.createElement("span","e-3triangles-1 e-iconsetspan")),V.appendChild(this.createElement("span","e-3triangles-2 e-iconsetspan")),V.appendChild(this.createElement("span","e-3triangles-3 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-1 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-2 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-3 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-4 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-1 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-2 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-3 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-4 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-1 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-2 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-3 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-4 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-5 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-1 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-2 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-3 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-4 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-5 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-1 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-2 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-3 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-1 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-2 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-3 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-1 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-2 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-3 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-1 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-2 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-3 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-4 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-1 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-2 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-3 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-4 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-1 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-2 e-iconsetspan")),Z.appendChild(this.createElement("span","e-3symbols-3 e-iconsetspan")),J.appendChild(this.createElement("span","e-3symbols2-1 e-iconsetspan")),J.appendChild(this.createElement("span","e-3symbols2-2 e-iconsetspan")),J.appendChild(this.createElement("span","e-3symbols2-3 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-1 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-2 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-3 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-1 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-2 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-3 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-1 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-2 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-3 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-4 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-1 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-2 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-3 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-4 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-5 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-1 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-2 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-3 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-4 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-5 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-1 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-2 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-3 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-4 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-5 e-iconsetspan"));var ae=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_cf_menu",styles:"display: none;"}));return this.cFMenu.appendTo(ae),ae.classList.add("e-ul"),this.cFDdb=new l.DropDownButton({iconCss:"e-icons e-conditionalformatting-icon",cssClass:"e-cf-ddb",target:this.cFMenu.element.parentElement,created:function(){t.cFMenu.element.style.display=""},close:function(){return Ct(t.parent.element)}}),this.cFDdb.createElement=this.parent.createElement,this.cFDdb.appendTo(this.parent.createElement("button",{id:e+"_conditionalformatting"})),this.cFDdb.element},e.prototype.createElement=function(e,t){return this.parent.createElement(e,{className:t})},e.prototype.getBordersDBB=function(e){var r,a=this,o=this.parent.serviceLocator.getService(ki);this.bordersMenu=new n.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:o.getConstant("TopBorders")},{iconCss:"e-icons e-left-borders",text:o.getConstant("LeftBorders")},{iconCss:"e-icons e-right-borders",text:o.getConstant("RightBorders")},{iconCss:"e-icons e-bottom-borders",text:o.getConstant("BottomBorders")},{iconCss:"e-icons e-all-borders",text:o.getConstant("AllBorders")},{iconCss:"e-icons e-horizontal-borders",text:o.getConstant("HorizontalBorders")},{iconCss:"e-icons e-vertical-borders",text:o.getConstant("VerticalBorders")},{iconCss:"e-icons e-outside-borders",text:o.getConstant("OutsideBorders")},{iconCss:"e-icons e-inside-borders",text:o.getConstant("InsideBorders")},{iconCss:"e-icons e-no-borders",text:o.getConstant("NoBorders")},{separator:!0},{text:o.getConstant("BorderColor"),items:[{id:e+"_border_colors"}]},{text:o.getConstant("BorderStyle"),items:[{iconCss:"e-icons e-selected-icon",id:e+"_1px"},{id:e+"_2px"},{id:e+"_3px"},{id:e+"_dashed"},{id:e+"_dotted"},{id:e+"_double"}]}],orientation:"Vertical",beforeOpen:function(e){"Border Color"===e.parentItem.text?(a.colorPicker.refresh(),r=a.colorPicker.element.parentElement,e.element.firstElementChild.appendChild(r),r.style.display="inline-block",e.element.parentElement.classList.add("e-border-color")):e.element.classList.add("e-border-style")},beforeClose:function(e){"Border Color"===e.parentItem.text&&(!t.closest(e.event.target,".e-border-colorpicker")||t.closest(e.event.target,".e-apply")||t.closest(e.event.target,".e-cancel")?(a.colorPicker=t.getComponent(a.cPickerEle,"colorpicker"),"Picker"===a.colorPicker.mode&&(a.colorPicker.mode="Palette",a.colorPicker.dataBind()),r.style.display="",a.parent.element.appendChild(r)):e.cancel=!0)},onOpen:function(e){"Border Color"===e.parentItem.text&&(e.element.parentElement.style.overflow="visible")},select:this.borderSelected.bind(this)}),this.bordersMenu.createElement=this.parent.createElement;var s=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_borders_menu",styles:"display: none;"}));return this.bordersMenu.appendTo(s),s.classList.add("e-ul"),this.cPickerEle=this.parent.createElement("input",{id:e+"_cell_border_color",attrs:{type:"color"}}),this.parent.element.appendChild(this.cPickerEle),this.colorPicker=new i.ColorPicker({cssClass:"e-border-colorpicker",mode:"Palette",inline:!0,change:function(e){var t=a.border.split(" ");t[2]=e.currentValue.hex,a.border=t.join(" ")},created:function(){r=a.colorPicker.element.parentElement}}),this.colorPicker.createElement=this.parent.createElement,this.colorPicker.appendTo(this.cPickerEle),this.bordersDdb=new l.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:this.bordersMenu.element.parentElement,created:function(){a.bordersMenu.element.style.display=""},beforeOpen:function(e){return a.tBarDdbBeforeOpen(e.element.firstElementChild,a.bordersMenu.items,1)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-borders-menu")&&(e.cancel=!0)},close:function(){return Ct(a.parent.element)}}),this.bordersDdb.createElement=this.parent.createElement,this.bordersDdb.appendTo(this.parent.createElement("button",{id:e+"_borders"})),this.bordersDdb.element},e.prototype.chartSelected=function(e){var r=!t.isNullOrUndefined(t.closest(e.element,".e-chart-menu")),n=e.element.id;if("column_chartbar_chartarea_chartpie_doughnut_chartline_chartradar_chartscatter_chart".includes(n)){var i=e.event.target.id;this.parent.notify("insertChart",{action:n,id:i,isChart:r})}},e.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify("chartDesignTab",{addChartEle:t})},e.prototype.cFSelected=function(e){var t=e.element.id;if("cf_greaterthancf_lessthancf_betweencf_eqaultocf_textthatcontainscf_adateoccuringcf_duplicatevaluescf_top10itemscf_top10cf_bottom10itemscf_bottom10cf_aboveaveragecf_belowaverage".includes(t))this.parent.notify("initiateConditionalFormat",{action:e.item.text});else if("cf_databarscf_colorscales".includes(t)){var r=e.event.target.id;this.parent.notify("setCF",{action:t,id:r})}else if("cf_iconsets"===e.element.id){var n=e.event.target,i=""===n.id?n.parentElement.id:n.id;this.parent.notify("setCF",{action:t,id:i})}if("cf_cr_cells"===t)this.parent.notify(Mt,{range:this.parent.getActiveSheet().selectedRange,isPublic:!1});else if("cf_cr_sheet"===t){var a=this.parent.getActiveSheet(),o=m([0,0,a.rowCount-1,a.colCount-1]);this.parent.conditionalFormat=null,this.parent.notify(Mt,{range:o,isPublic:!1})}},e.prototype.borderSelected=function(e){if(!e.item.items.length&&e.item.id!==this.parent.element.id+"_border_colors"){if(!e.item.text){var t=this.parent.element.id,r=this.border.split(" "),n="solid"===r[1]?t+"_"+r[0]:t+"_"+r[1];if(n===e.item.id)return;return e.item.id===t+"_1px"||e.item.id===t+"_2px"||e.item.id===t+"_3px"?(r[0]=e.item.id.split(t+"_")[1],r[1]="solid"):(r[1]=e.item.id.split(t+"_")[1],r[0]="double"===r[1]?"3px":"1px"),this.border=r.join(" "),this.bordersMenu.items[12].items.forEach(function(t){t.id===n&&(t.iconCss=null),t.id===e.item.id&&(t.iconCss="e-icons e-selected-icon")}),void this.bordersMenu.setProperties({items:this.bordersMenu.items},!0)}switch(this.bordersDdb.toggle(),this.parent.showSpinner(),e.item.text){case"Top Borders":this.parent.notify(wt,{style:{borderTop:this.border},onActionUpdate:!0});break;case"Left Borders":this.parent.notify(wt,{style:{borderLeft:this.border},onActionUpdate:!0});break;case"Right Borders":this.parent.notify(wt,{style:{borderRight:this.border},onActionUpdate:!0});break;case"Bottom Borders":this.parent.notify(wt,{style:{borderBottom:this.border},onActionUpdate:!0});break;case"All Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0});break;case"Horizontal Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case"Vertical Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case"Outside Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case"Inside Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case"No Borders":this.parent.notify(wt,{style:{border:""},onActionUpdate:!0})}this.parent.hideSpinner()}},e.prototype.getFontNameDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_font_name"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"Calibri"})),this.fontNameDdb=new l.DropDownButton({cssClass:"e-font-family",items:this.getFontFamilyItems(),select:function(e){var r={style:{fontFamily:e.item.text},onActionUpdate:!0};t.parent.notify(wt,r),r.cancel||t.refreshFontNameSelection(r.style.fontFamily)},close:function(){return Ct(t.parent.element)},beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.fontNameDdb.createElement=this.parent.createElement,this.fontNameDdb.appendTo(r),r},e.prototype.getBtn=function(e,t,r){void 0===r&&(r=!0);var n=new a.Button({iconCss:"e-icons e-"+t+"-icon",isToggle:!0});return n.createElement=this.parent.createElement,n.appendTo(this.parent.createElement("button",{id:e+"_"+t})),r&&n.element.addEventListener("click",this.toggleBtnClicked.bind(this)),n.element},e.prototype.datavalidationDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(ki);return this.datavalidationDdb=new l.DropDownButton({cssClass:"e-datavalidation-ddb",iconCss:"e-datavalidation-icon e-icons",items:[{text:n.getConstant("DataValidation")},{text:n.getConstant("HighlightInvalidData")},{text:n.getConstant("ClearHighlight")},{text:n.getConstant("ClearValidation")}],beforeOpen:function(e){r.refreshSelected(r.datavalidationDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case n.getConstant("DataValidation"):r.parent.notify("initiatedatavalidation",null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify("invalidData",{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify("invalidData",{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify("removeDataValidation",null);break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:t}}})}},close:function(){return Ct(r.parent.element)}}),this.datavalidationDdb.createElement=this.parent.createElement,this.datavalidationDdb.appendTo(this.parent.createElement("button",{id:e+"_datavalidation"})),this.datavalidationDdb.element},e.prototype.getTextAlignDDB=function(e){var t=this;return this.textAlignDdb=new l.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-left-icon",items:[{iconCss:"e-icons e-left-icon"},{iconCss:"e-icons e-center-icon"},{iconCss:"e-icons e-right-icon"}],beforeItemRender:this.alignItemRender.bind(this),beforeOpen:function(e){t.refreshSelected(t.textAlignDdb,e.element,"iconCss")},select:function(e){var r={style:{textAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(wt,r),r.cancel||(t.textAlignDdb.iconCss="e-icons e-"+r.style.textAlign+"-icon",t.textAlignDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),this.textAlignDdb.createElement=this.parent.createElement,this.textAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_text_align"})),this.textAlignDdb.element},e.prototype.getVerticalAlignDDB=function(e){var t=this;return this.verticalAlignDdb=new l.DropDownButton({cssClass:"e-align-ddb",iconCss:"e-icons e-bottom-icon",items:[{iconCss:"e-icons e-top-icon"},{iconCss:"e-icons e-middle-icon"},{iconCss:"e-icons e-bottom-icon"}],beforeItemRender:this.alignItemRender.bind(this),beforeOpen:function(e){t.refreshSelected(t.verticalAlignDdb,e.element,"iconCss")},select:function(e){var r={style:{verticalAlign:e.item.iconCss.split(" e-")[1].split("-icon")[0]},onActionUpdate:!0};t.parent.notify(wt,r),r.cancel||(t.verticalAlignDdb.iconCss="e-icons e-"+r.style.verticalAlign+"-icon",t.verticalAlignDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),this.verticalAlignDdb.createElement=this.parent.createElement,this.verticalAlignDdb.appendTo(this.parent.createElement("button",{id:e+"_vertical_align"})),this.verticalAlignDdb.element},e.prototype.getMergeSplitBtn=function(e){var t=this;this.parent.element.appendChild(this.parent.createElement("button",{id:e+"_merge"}));var r=this.parent.serviceLocator.getService(ki);return this.mergeSplitBtn=new l.SplitButton({cssClass:"e-merge-ddb",iconCss:"e-icons e-merge-icon",items:[{text:r.getConstant("MergeAll"),id:e+"_merge_all"},{text:r.getConstant("MergeHorizontally"),id:e+"_merge_horizontally"},{text:r.getConstant("MergeVertically"),id:e+"_merge_vertically"},{separator:!0,id:e+"_merge_separator"},{text:r.getConstant("Unmerge"),id:e+"_unmerge"}],select:this.mergeSelectHandler.bind(this),close:function(){return Ct(t.parent.element)},click:function(e){e.element.classList.contains("e-active")?(t.toggleActiveState(!1),t.unMerge()):(t.toggleActiveState(!0),t.merge(t.parent.element.id+"_merge_all"))},created:function(){t.mergeSplitBtn.element.title=r.getConstant("MergeCells"),t.mergeSplitBtn.element.nextElementSibling.title=r.getConstant("SelectMergeType")}}),this.mergeSplitBtn.createElement=this.parent.createElement,this.mergeSplitBtn.appendTo("#"+e+"_merge"),this.mergeSplitBtn.element.parentElement},e.prototype.mergeSelectHandler=function(e){e.item.id===this.parent.element.id+"_unmerge"?this.unMerge():this.merge(e.item.id)},e.prototype.unMerge=function(){this.parent.showSpinner(),this.parent.notify(Ht,{merge:!1,range:this.parent.getActiveSheet().selectedRange,isAction:!0,refreshRibbon:!0,type:"All"}),this.parent.hideSpinner()},e.prototype.merge=function(e){for(var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.selectedRange),o=a[0];o<=a[2];o++)for(var s=a[1];s<=a[3];s++)o===a[0]&&s===a[1]&&e.includes("merge_all")||o===a[0]&&e.includes("merge_vertically")||s===a[1]&&e.includes("_merge_horizontally")||((t=$(o,s,i)||{}).value||t.formula)&&(r=!0);if(!r)return void this.performMerge(e);var l=this.parent.serviceLocator.getService(Ai);l.show({target:this.parent.element,height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).getConstant("MergeCellsAlert"),beforeOpen:function(e){var t={dialogName:"MergeAlertDialog",element:e.element,target:e.target,cancel:e.cancel};n.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),Ct(n.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(ki).getConstant("Ok"),isPrimary:!0},click:function(){l.hide(),n.performMerge(e)}}]})},e.prototype.performMerge=function(e){var t=this.parent.element.id;switch(this.parent.showSpinner(),e){case t+"_merge_all":this.parent.notify(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},e.prototype.getSortFilterDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(ki);return this.sortingDdb=new l.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:n.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:n.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:n.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:n.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:e+"_applyfilter"},{text:n.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:e+"_clearfilter"},{text:n.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:e+"_reapplyfilter"}],beforeItemRender:function(t){var n={isFiltered:!1,isClearAll:!0};if(r.parent.notify("getFilteredColumn",n),t.item.id===e+"_clearfilter"||t.item.id===e+"_reapplyfilter")n.isFiltered?t.element.classList.remove("e-disabled"):t.element.classList.add("e-disabled");else if(t.item.id===e+"_applyfilter"){var i=r.parent.getActiveSheet();(i.frozenColumns||i.frozenRows)&&t.element.classList.add("e-disabled")}},beforeOpen:function(e){r.refreshSelected(r.sortingDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case n.getConstant("Filter"):r.parent.applyFilter();break;case n.getConstant("ClearAllFilter"):r.parent.clearFilter();break;case n.getConstant("ReapplyFilter"):r.parent.notify("reapplyFilter",null);break;case n.getConstant("CustomSort")+"...":r.parent.notify("initiateCustomSort",null);break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:t}}})}},close:function(){return Ct(r.parent.element)}}),this.sortingDdb.createElement=this.parent.createElement,this.sortingDdb.appendTo(this.parent.createElement("button",{id:e+"_sorting"})),this.sortingDdb.element},e.prototype.getFindDDb=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_findbtn"});return this.findDdb=new a.Button({cssClass:"e-spreadsheet-find-ddb e-caret-hide",iconCss:"e-icons e-search-icon"}),this.findDdb.createElement=this.parent.createElement,this.findDdb.appendTo(r),r.onclick=function(){t.findToolDlg()},this.findDdb.element},e.prototype.findToolDlg=function(){var e,r=this;if(t.isNullOrUndefined(this.parent.element.querySelector(".e-findtool-dlg"))){var i,a=this.parent.createElement("div",{className:"e-input-group"}),o=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text",value:this.findValue}}),s=this.parent.serviceLocator.getService(ki);o.setAttribute("placeholder",s.getConstant("FindValue"));var l=this.parent.createElement("span",{className:"e-input-group-icon"});o.onkeyup=function(){e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount;var n=document.querySelector(".e-text-findNext-short").value,a=document.querySelector(".e-findRib-next"),o=document.querySelector(".e-findRib-prev");t.isNullOrUndefined(n)||""===n||"0 of 0"===e.findCount?(i.enableItems(a,!1),i.enableItems(o,!1),l.textContent="0 of 0"):t.isNullOrUndefined(n)&&"0 of 0"===e.findCount||(i.enableItems(a,!0),i.enableItems(o,!0))},o.onkeydown=function(t){e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e});var n=e.findCount;r.findOnKeyDown(t,n)},a.appendChild(o),a.appendChild(l);var d=[{type:"Input",template:a},{prefixIcon:"e-icons e-prev-icon",tooltipText:"Find Previous",type:"Button",cssClass:"e-findRib-prev",disabled:!0},{prefixIcon:"e-icons e-next-icon",tooltipText:"Find Next",type:"Button",cssClass:"e-findRib-next",disabled:!0},{type:"Separator"},{prefixIcon:"e-icons e-option-icon",tooltipText:"More Options",type:"Button",cssClass:"e-findRib-more"},{prefixIcon:"e-icons e-close",tooltipText:"Close",type:"Button",cssClass:"e-findRib-close"}];i=new n.Toolbar({clicked:function(t){"e-findRib-next"===t.item.cssClass?(r.parent.notify("findHandler",{findOption:"next"}),e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount):"e-findRib-prev"===t.item.cssClass?(r.parent.notify("findHandler",{findOption:"prev"}),e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount):"e-findRib-more"===t.item.cssClass&&(r.parent.notify(or,null),r.findDialog.hide())},width:"auto",height:"auto",items:d,cssClass:"e-find-toolObj"});var p=this.parent.createElement("div",{className:"e-find-toolbar"}),c=this.parent.createElement("div",{className:"e-dlg-div"});this.findDialog=new h.Dialog({isModal:!1,showCloseIcon:!1,cssClass:"e-findtool-dlg",content:p,visible:!1,allowDragging:!0,target:this.parent.element.querySelector(".e-sheet"),beforeOpen:function(){t.EventHandler.add(document,"click",r.closeDialog,r)},open:function(){r.textFocus(i.element)},beforeClose:function(){r.findValue=r.parent.element.querySelector(".e-text-findNext-short").value,i.destroy();var e=document.querySelector(".e-find-toolbar");t.EventHandler.remove(e,"focus",r.textFocus),t.EventHandler.remove(document,"click",r.closeDialog),Ct(r.parent.element)},created:function(){i.createElement=r.parent.createElement,i.appendTo(p),r.findDialog.width=getComputedStyle(document.querySelector(".e-findtool-dlg")).width;var e=r.parent.element.querySelector(".e-main-panel").getBoundingClientRect(),t=r.findDialog.width.toString();r.findDialog.position={X:e.width-parseInt(t,10)-(r.parent.allowScrolling?Oe():0),Y:r.parent.getActiveSheet().showHeaders?31:0},r.findDialog.dataBind(),r.findDialog.show()}}),this.findDialog.createElement=this.parent.createElement,this.findDialog.appendTo(c)}else t.isNullOrUndefined(this.parent.element.querySelector(".e-findtool-dlg"))||(this.findDialog.hide(),t.detach(this.parent.element.querySelector(".e-findtool-dlg")),this.findDialog=null,Ct(this.parent.element))},e.prototype.findOnKeyDown=function(e,t){if(document.querySelector(".e-text-findNext-short").value&&"0 of 0"!==t)if(e.shiftKey){if(13===e.keyCode){var r={findOption:"prev"};this.parent.notify("findHandler",r)}}else if(13===e.keyCode){var n={findOption:"next"};this.parent.notify("findHandler",n)}},e.prototype.closeDialog=function(e){!t.closest(e.target,".e-findRib-close")&&t.closest(e.target,".e-spreadsheet")||t.isNullOrUndefined(this.findDialog)||(this.findDialog.hide(),t.detach(this.parent.element.querySelector(".e-findtool-dlg")),this.findDialog=null)},e.prototype.textFocus=function(e){document.querySelector(".e-find-toolbar").addEventListener("focus",function(){var e=document.querySelector(".e-text-findNext-short");e.focus(),e.classList.add("e-input-focus"),e.setSelectionRange(0,e.value.length)})},e.prototype.getClearDDB=function(e){var t=this,r=this.parent.serviceLocator.getService(ki);return this.clearDdb=new l.DropDownButton({cssClass:"e-clear-ddb",iconCss:"e-icons e-clear-icon",items:[{text:r.getConstant("ClearAll")},{text:r.getConstant("ClearFormats")},{text:r.getConstant("ClearContents")},{text:r.getConstant("ClearHyperlinks")}],select:function(e){t.parent.notify(lr,{options:{type:e.item.text}})},close:function(){return Ct(t.parent.element)}}),this.clearDdb.createElement=this.parent.createElement,this.clearDdb.appendTo(this.parent.createElement("button",{id:e+"_clear"})),this.clearDdb.element},e.prototype.ribbonCreated=function(){this.ribbon.element.querySelector(".e-drop-icon").title=this.parent.serviceLocator.getService(ki).getConstant("CollapseToolbar")},e.prototype.alignItemRender=function(e){var t=e.item.iconCss.split(" e-")[1].split("-icon")[0];t=t[0].toUpperCase()+t.slice(1,t.length),e.element.title=this.parent.serviceLocator.getService(ki).getConstant("Align"+t)},e.prototype.toggleBtnClicked=function(e){var r,n,i,a,o,s=t.closest(e.target,".e-btn"),l=this.parent.element.id,h=s.id,d=wt;switch(h){case l+"_bold":n={fontWeight:"normal"},i={fontWeight:"bold"},o="fontWeight";break;case l+"_italic":n={fontStyle:"normal"},i={fontStyle:"italic"},o="fontStyle";break;case l+"_line-through":d="textDecorationUpdate",i=n={textDecoration:"line-through"},o="textDecoration";break;case l+"_underline":d="textDecorationUpdate",i=n={textDecoration:"underline"},o="textDecoration"}s.classList.contains("e-active")?(r=i[o],a={style:i,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.remove("e-active")):(r=n[o],a={style:n,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.add("e-active")),a.cancel||r===a.style[o]||this.refreshToggleBtn(u(this.parent.getActiveSheet().activeCell)),Ct(this.parent.element)},e.prototype.getCellStyleValue=function(e,t){var r=$(t[0],t[1],this.parent.getActiveSheet()),n=this.parent.cellStyle[e];return r&&r.style&&r.style[e]&&(n=r.style[e]),n},e.prototype.refreshSelected=function(e,t,r,n){void 0===n&&(n=r);for(var i=0;i<e.items.length;i++)if(e.items[i][n]===e[r]){t.children[i].classList.add("e-selected");break}},e.prototype.expandCollapseHandler=function(e){var t=this.ribbon.element.querySelector(".e-drop-icon"),r=this.parent.serviceLocator.getService(ki);e.expanded?t.title=r.getConstant("CollapseToolbar"):t.title=r.getConstant("ExpandToolbar"),this.parent.setPanelSize()},e.prototype.getChartThemeDdbItems=function(){var e=this.parent.serviceLocator.getService(ki);return[{id:"Material",text:e.getConstant("Material")},{id:"Fabric",text:e.getConstant("Fabric")},{id:"Bootstrap",text:e.getConstant("Bootstrap")},{id:"HighContrastLight",text:e.getConstant("HighContrastLight")},{id:"MaterialDark",text:e.getConstant("MaterialDark")},{id:"FabricDark",text:e.getConstant("FabricDark")},{id:"HighContrast",text:e.getConstant("HighContrast")},{id:"BootstrapDark",text:e.getConstant("BootstrapDark")},{id:"Bootstrap4",text:e.getConstant("Bootstrap4")}]},e.prototype.getNumFormatDdbItems=function(e){var t=this.parent.serviceLocator.getService(ki);return[{id:e+"_General",text:t.getConstant("General")},{id:e+"_Number",text:t.getConstant("Number")},{id:e+"_Currency",text:t.getConstant("Currency")},{id:e+"_Accounting",text:t.getConstant("Accounting")},{id:e+"_ShortDate",text:t.getConstant("ShortDate")},{id:e+"_LongDate",text:t.getConstant("LongDate")},{id:e+"_Time",text:t.getConstant("Time")},{id:e+"_Percentage",text:t.getConstant("Percentage")},{id:e+"_Fraction",text:t.getConstant("Fraction")},{id:e+"_Scientific",text:t.getConstant("Scientific")},{id:e+"_Text",text:t.getConstant("Text")}]},e.prototype.getFontFamilyItems=function(){return[{text:"Arial"},{text:"Arial Black"},{text:"Axettac Demo"},{text:"Batang"},{text:"Book Antiqua"},{text:"Calibri",iconCss:"e-icons e-selected-icon"},{text:"Courier"},{text:"Courier New"},{text:"Din Condensed"},{text:"Georgia"},{text:"Helvetica"},{text:"Helvetica New"},{text:"Roboto"},{text:"Tahoma"},{text:"Times New Roman"},{text:"Verdana"}]},e.prototype.numDDBSelect=function(e){var t={format:O(e.item.id.split(this.parent.element.id+"_")[1]),range:this.parent.getActiveSheet().selectedRange,cancel:!1,requestType:"NumberFormat"},r={range:this.parent.getActiveSheet().name+"!"+t.range,format:t.format,requestType:"NumberFormat"};this.parent.trigger("beforeCellFormat",t),this.parent.notify(ir,{eventArgs:t,action:"format"}),t.cancel||(this.parent.notify("applyNumber",t),this.parent.notify("selectionComplete",{type:"mousedown"}),this.refreshNumFormatSelection(e.item.text),this.parent.notify(nr,{eventArgs:r,action:"format"}))},e.prototype.chartThemeDDBSelect=function(e){this.parent.notify("selectionComplete",{type:"mousedown"}),this.refreshChartThemeSelection(e.item.id),this.parent.notify("chartDesignTab",{chartTheme:e.item.id})},e.prototype.tBarDdbBeforeOpen=function(e,t,r){void 0===r&&(r=0);var n=this.parent.viewport.height,i=parseInt(getComputedStyle(e.firstElementChild).height,10)*(t.length-r)+2*parseInt(getComputedStyle(e).paddingTop,10);if(r){var a=getComputedStyle(e.querySelector(".e-separator"));i+=r*(parseInt(a.borderBottomWidth,10)+2*parseInt(a.marginTop,10))}i>n?(e.style.height=n+"px",e.style.overflowY="auto"):e.style.height&&(e.style.height="",e.style.overflowY="")},e.prototype.numDDBOpen=function(e){this.numPopupWidth=0;for(var t=e.element.querySelectorAll("span.e-numformat-preview-text"),r=0,n=t.length;r<n;r++)this.numPopupWidth<t[r].offsetWidth&&(this.numPopupWidth=t[r].offsetWidth);var i=this.numPopupWidth+160;document.querySelector(".e-numformat-ddb.e-dropdown-popup").style.width=i+"px"},e.prototype.previewNumFormat=function(e){var t=u(this.parent.getActiveSheet().activeCell),r=$(t[0],t[1],this.parent.getActiveSheet()),n={type:e.item.text,formattedText:"",value:r&&r.value?r.value:"",format:O(e.item.id.split(this.parent.element.id+"_")[1]),sheetIndex:this.parent.activeSheetIndex,onLoad:!0},i=this.parent.createElement("div",{className:"e-numformat-text",styles:"width:100%",innerHTML:e.element.innerHTML});e.element.innerHTML="",this.parent.notify("getFormattedCell",n);var a=this.parent.createElement("span",{className:"e-numformat-preview-text",styles:"float:right;",innerHTML:n.formattedText.toString()});i.appendChild(a),e.element.appendChild(i)},e.prototype.refreshRibbonContent=function(e){if(this.ribbon){t.isNullOrUndefined(e)&&(e=this.ribbon.selectedTab);var r=this.parent.serviceLocator.getService(ki),n=this.parent.getActiveSheet();switch(this.ribbon.items[e].header.text){case r.getConstant("Home"):this.refreshHomeTabContent(u(n.activeCell));break;case r.getConstant("Insert"):case r.getConstant("Formulas"):break;case r.getConstant("Data"):this.refreshDataTabContent(e);break;case r.getConstant("View"):this.refreshViewTabContent(e)}}},e.prototype.refreshHomeTabContent=function(e){t.isNullOrUndefined(document.getElementById(this.parent.element.id+"_number_format"))||(this.numFormatDDB=t.getComponent(document.getElementById(this.parent.element.id+"_number_format"),l.DropDownButton));var r=this.parent.getActiveSheet(),n=u(this.parent.getActiveSheet().activeCell),i=this.parent.serviceLocator.getService(ki),a=$(n[0],n[1],this.parent.getActiveSheet())||{},o=H(a.format?a.format:"General");if(this.numFormatDDB&&(r.isProtected&&!r.protectSettings.formatCells?(o="General",this.refreshNumFormatSelection(o)):this.refreshNumFormatSelection(i.getConstant(o))),this.fontNameDdb&&(r.isProtected&&!r.protectSettings.formatCells?this.refreshFontNameSelection("Calibri"):this.refreshFontNameSelection(this.getCellStyleValue("fontFamily",e))),this.fontSizeDdb){h=this.getCellStyleValue("fontSize",e);r.isProtected&&!r.protectSettings.formatCells?this.fontSizeDdb.content="11":(h=h.includes("pt")?h.split("pt")[0]:"11")!==this.fontSizeDdb.content&&(this.fontSizeDdb.content=h,this.fontSizeDdb.dataBind())}if(this.textAlignDdb){var s=this.getCellStyleValue("textAlign",e);r.isProtected&&!r.protectSettings.formatCells?this.textAlignDdb.iconCss="e-icons e-left-icon":(void 0===a.value||"left"!==s||"Accounting"!==o&&!L(a.value)||(s="right"),(h="e-icons e-"+s.toLowerCase()+"-icon")!==this.textAlignDdb.iconCss&&(this.textAlignDdb.iconCss=h,this.textAlignDdb.dataBind()))}if(this.verticalAlignDdb){var h="e-icons e-"+this.getCellStyleValue("verticalAlign",e).toLowerCase()+"-icon";r.isProtected&&!r.protectSettings.formatCells?this.verticalAlignDdb.iconCss="e-icons e-bottom-icon":h!==this.verticalAlignDdb.iconCss&&(this.verticalAlignDdb.iconCss=h,this.verticalAlignDdb.dataBind())}if(this.refreshToggleBtn(e),!r.isProtected&&(a.rowSpan>1||a.colSpan>1))this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0);else{var d=c(r.selectedRange);this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:d[0]!==d[2]||d[1]!==d[3]}]),this.toggleActiveState(!1)}},e.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(ki);this.parent.getActiveSheet().isProtected||(e?(this.mergeSplitBtn.element.classList.add("e-active"),this.mergeSplitBtn.element.title=t.getConstant("UnmergeCells")):(this.mergeSplitBtn.element.classList.contains("e-active")&&this.mergeSplitBtn.element.classList.remove("e-active"),this.mergeSplitBtn.element.title=t.getConstant("MergeCells")))},e.prototype.refreshToggleBtn=function(e){var t,r,n,i=this,a=this.parent.getActiveSheet(),o=this.parent.element.id,s=$(e[0],e[1],a),l=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(h,d){(t=document.getElementById(o+"_"+h))&&(a.isProtected&&!a.protectSettings.formatCells?t.classList.remove("e-active"):"wrap"===h?n=s&&s.wrap:(r=i.getCellStyleValue(l[d],e).toLowerCase(),n=r.indexOf(h)>-1),n?t.classList.add("e-active"):t.classList.contains("e-active")&&t.classList.remove("e-active"))})},e.prototype.refreshFontNameSelection=function(e){e=e.split('"').join(""),this.fontNameDdb.element.firstElementChild.textContent=e;for(var t=0;t<this.fontNameDdb.items.length;t++)if(this.fontNameDdb.items[t].text===e){this.fontNameDdb.items[t].iconCss="e-icons e-selected-icon",t!==this.fontNameIndex&&(this.fontNameDdb.items[this.fontNameIndex].iconCss=""),this.fontNameDdb.setProperties({items:this.fontNameDdb.items},!0),this.fontNameIndex=t;break}["Arial","Arial Black","Axettac Demo","Batang","Book Antiqua","Calibri","Courier","Courier New","Din Condensed","Georgia","Helvetica","Helvetica New","Roboto","Tahoma","Times New Roman","Verdana"].indexOf(e)<0&&(this.fontNameDdb.items[this.fontNameIndex].iconCss="")},e.prototype.refreshNumFormatSelection=function(e){for(var t=0;t<this.numFormatDDB.items.length;t++)""!==this.numFormatDDB.items[t].iconCss&&(this.numFormatDDB.items[t].iconCss=""),this.numFormatDDB.items[t].text===e&&(this.numFormatDDB.items[t].iconCss="e-icons e-selected-icon");this.numFormatDDB.element.firstElementChild.textContent=e,this.numFormatDDB.setProperties({items:this.numFormatDDB.items},!0)},e.prototype.refreshChartThemeSelection=function(e){if(e!==this.chartThemeDDB.items[this.chartThemeIndex].text){this.chartThemeDDB.element.firstElementChild.textContent=this.getChartThemeText(e);for(var t=0;t<this.chartThemeDDB.items.length;t++)if(this.chartThemeDDB.items[t].id===e){this.chartThemeDDB.items[t].iconCss="e-icons e-selected-icon",this.chartThemeDDB.items[this.chartThemeIndex].iconCss="",this.chartThemeDDB.setProperties({items:this.chartThemeDDB.items},!0),this.chartThemeIndex=t;break}}},e.prototype.getChartThemeText=function(e){var t=this.parent.serviceLocator.getService(ki),r="";switch(e){case"Material":r=t.getConstant("Material");break;case"Fabric":r=t.getConstant("Fabric");break;case"Bootstrap":r=t.getConstant("Bootstrap");break;case"HighContrastLight":r=t.getConstant("HighContrastLight");break;case"MaterialDark":r=t.getConstant("MaterialDark");break;case"FabricDark":r=t.getConstant("FabricDark");break;case"HighContrast":r=t.getConstant("HighContrast");break;case"BootstrapDark":r=t.getConstant("BootstrapDark");break;case"Bootstrap4":r=t.getConstant("Bootstrap4")}return r},e.prototype.fileMenuItemSelect=function(e){var r=this,n=t.extend({cancel:!1},e);this.parent.trigger("fileMenuItemSelect",n);var i,a=this.parent.element.id;if(!n.cancel)switch(e.item.id){case a+"_Open":t.select("#"+a+"_fileUpload",this.parent.element).click();break;case a+"_Xlsx":case a+"_Xls":case a+"_Csv":case a+"_Pdf":this.parent.save({saveType:e.item.id.split(a+"_")[1]});break;case a+"_New":(i=this.parent.serviceLocator.getService(Ai)).show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).getConstant("DestroyAlert"),beforeOpen:function(e){var t={dialogName:"DestroySheetDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),Ct(r.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(ki).getConstant("Ok"),isPrimary:!0},click:function(){r.parent.sheets.length=0,r.parent.createSheet(),i.hide(),r.parent.activeSheetIndex=r.parent.sheets.length-1,r.parent.notify("refreshSheetTabs",{}),r.parent.notify("sheetsDestroyed",{}),r.parent.renderModule.refreshSheet()}}]})}},e.prototype.toolbarClicked=function(e){if("spreadsheet_find"!==e.item.id){var t=this.parent.element.id,r=this.parent.getActiveSheet(),n=void 0,i=void 0,a=void 0,o=void 0,s=void 0;switch(e.item.id){case t+"_headers":if(n={isShow:!r.showHeaders,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(nr,{eventArgs:n,action:"headers"}),n.cancel)return;this.parent.setSheetPropertyOnMute(r,"showHeaders",!r.showHeaders),this.parent.serviceLocator.getService("sheet").showHideHeaders(),this.toggleRibbonItems({props:"Headers",activeTab:this.ribbon.selectedTab}),Ct(this.parent.element);break;case t+"_gridlines":if(i={isShow:!r.showGridLines,sheetIdx:this.parent.activeSheetIndex,cancel:!1},this.parent.notify(nr,{eventArgs:i,action:"gridLines"}),i.cancel)return;this.parent.setSheetPropertyOnMute(r,"showGridLines",!r.showGridLines),this.toggleRibbonItems({props:"GridLines",activeTab:this.ribbon.selectedTab}),Ct(this.parent.element);break;case t+"_protect":this.parent.setSheetPropertyOnMute(r,"isProtected",!r.isProtected),a=!r.isProtected,this.parent.notify("applyProtect",{isActive:a,id:t+"_protect"});break;case t+"_undo":this.parent.notify("performUndoRedo",{isUndo:!0});break;case t+"_redo":this.parent.notify("performUndoRedo",{isUndo:!1});break;case t+"_freezepanes":o=u(r.topLeftCell),s=r.frozenRows||r.frozenColumns?o:u(r.activeCell),this.parent.notify("freeze",{row:s[0]-o[0],column:s[1]-o[1],isAction:!0});break;case t+"_freezerows":this.parent.notify("freeze",{row:r.frozenRows?0:u(r.activeCell)[0]-u(r.topLeftCell)[0],column:r.frozenColumns,isAction:!0});break;case t+"_freezecolumns":this.parent.notify("freeze",{row:r.frozenRows,column:r.frozenColumns?0:u(r.activeCell)[1]-u(r.topLeftCell)[1],isAction:!0});break;case t+"_protectworkbook":this.parent.password.length>0?this.parent.notify("unProtectWorkbook",null):this.parent.isProtected?(this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab})):this.parent.element.querySelector(".e-add-sheet-tab").classList.contains("e-disabled")?this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab}):this.parent.notify("protectWorkbook",null)}this.parent.notify("ribboClick",e)}},e.prototype.toggleRibbonItems=function(e){var r="",n=this.parent.serviceLocator.getService(ki).getConstant("View"),i=this.parent.serviceLocator.getService(ki).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(t.isNullOrUndefined(e.activeTab))for(var a=0,o=this.ribbon.items.length;a<o;a++)if(this.ribbon.items[a].header.text===n){e.activeTab=a;break}for(var s=this.getLocaleText(e.props,"GridLines"===e.props),l=this.parent.element.id+"_"+e.props.toLowerCase(),h=this.ribbon.items[e.activeTab].content.length,a=void 0;a<h;a++)"Separator"!==this.ribbon.items[e.activeTab].content[a].type&&this.ribbon.items[e.activeTab].content[a].id===l&&(this.ribbon.items[e.activeTab].content[a].text=s,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===n&&this.updateToggleText(e.props.toLowerCase(),s)}if(this.ribbon.items[this.ribbon.selectedTab].header.text===i){if(t.isNullOrUndefined(e.activeTab))for(var a=0,d=this.ribbon.items.length;a<d;a++)if(this.ribbon.items[a].header.text===i){e.activeTab=a;break}if((l=this.parent.element.id+"_"+e.props.toLowerCase())===this.parent.element.id+"_protect"){var p=this.ribbon.items[this.ribbon.selectedTab].content.length,c=void 0;for(c=0;c<p&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protect";c++);r=this.getLocaleProtectText("Sheet",!0)}else if(l===this.parent.element.id+"_protectworkbook"){var u=this.ribbon.items[this.ribbon.selectedTab].content.length,c=void 0;for(c=0;c<u&&this.ribbon.items[this.ribbon.selectedTab].content[c].id!==this.parent.element.id+"_protectworkbook";c++);this.parent.isProtected||this.parent.password.length>0?r=this.getLocaleProtectWorkbook("UnProtectWorkbook"):this.parent.isProtected||(r=this.getLocaleProtectWorkbook("ProtectWorkbook"))}for(var h=this.ribbon.items[e.activeTab].content.length,a=void 0;a<h;a++)"Separator"!==this.ribbon.items[e.activeTab].content[a].type&&this.ribbon.items[e.activeTab].content[a].id===l&&(this.ribbon.items[e.activeTab].content[a].text=r,this.ribbon.setProperties({items:this.ribbon.items},!0));this.ribbon.items[this.ribbon.selectedTab].header.text===i&&this.updateToggleText(e.props.toLowerCase(),r)}},e.prototype.enableFileMenuItems=function(e){this.ribbon.enableMenuItems(e.items,e.enable,e.isUniqueId)},e.prototype.hideRibbonTabs=function(e){this.ribbon.hideTabs(e.tabs,e.hide)},e.prototype.addRibbonTabs=function(e){this.ribbon.addTabs(e.items,e.insertBefore),t.select(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab).e-hide",this.parent.element)&&this.parent.updateActiveBorder(t.selectAll(".e-ribbon .e-tab-header .e-toolbar-item:not(.e-menu-tab)",this.parent.element)[this.ribbon.selectedTab])},e.prototype.updateToggleText=function(e,r){var n=this;Le(function(){var i=t.select("#"+n.parent.element.id+"_"+e+" .e-tbar-btn-text",n.ribbon.element);i&&(i.textContent=r)}),"headers"===e&&this.findDialog&&(this.findDialog.position.Y=this.parent.getActiveSheet().showHeaders?31:0,this.findDialog.dataBind())},e.prototype.refreshViewTabContent=function(e){for(var t=this.parent.element.id,r=this.parent.getActiveSheet(),n=this.parent.serviceLocator.getService(ki),i=0;i<this.ribbon.items[e].content.length;i++)"Separator"!==this.ribbon.items[e].content[i].type&&(this.ribbon.items[e].content[i].id===t+"_headers"&&this.updateViewTabContent(e,"Headers",i),this.ribbon.items[e].content[i].id===t+"_gridlines"&&this.updateViewTabContent(e,"GridLines",i),this.ribbon.items[e].content[i].id===t+"_freezepanes"&&(r.frozenRows||r.frozenColumns?this.ribbon.items[e].content[i].text===n.getConstant("FreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Unfreeze","Panes",i,e)):this.ribbon.items[e].content[i].text===n.getConstant("UnfreezePanes")&&this.updateToggleText("freezepanes",this.updateRibbonItemText("Freeze","Panes",i,e))),this.ribbon.items[e].content[i].id===t+"_freezerows"&&(r.frozenRows?this.ribbon.items[e].content[i].text===n.getConstant("FreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Unfreeze","Rows",i,e)):this.ribbon.items[e].content[i].text===n.getConstant("UnfreezeRows")&&this.updateToggleText("freezerows",this.updateRibbonItemText("Freeze","Rows",i,e))),this.ribbon.items[e].content[i].id===t+"_freezecolumns"&&(r.frozenColumns?this.ribbon.items[e].content[i].text===n.getConstant("FreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Unfreeze","Columns",i,e)):this.ribbon.items[e].content[i].text===n.getConstant("UnfreezeColumns")&&this.updateToggleText("freezecolumns",this.updateRibbonItemText("Freeze","Columns",i,e))))},e.prototype.updateViewTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(ki);n["show"+t]?this.ribbon.items[e].content[r].text===i.getConstant("Show"+t)&&this.updateToggleText(t.toLowerCase(),this.updateRibbonItemText("Hide",t,r,e)):this.ribbon.items[e].content[r].text===i.getConstant("Hide"+t)&&this.updateToggleText(t.toLowerCase(),this.updateRibbonItemText("Show",t,r,e))},e.prototype.updateRibbonItemText=function(e,t,r,n){var i=this.parent.serviceLocator.getService(ki).getConstant(e+t);return this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),i},e.prototype.refreshDataTabContent=function(e){for(var t,r=this.parent.element.id,n=0;n<this.ribbon.items[e].content.length;n++)if("Separator"!==this.ribbon.items[e].content[n].type){if(this.ribbon.items[e].content[n].id===r+"_protect"){if(this.updateDataTabContent(e,"Sheet",n),t)break;t=!0}this.ribbon.items[e].content[n].id===r+"_protectworkbook"&&this.updateDataTabContent(e,"Workbook",n)}},e.prototype.updateDataTabContent=function(e,t,r){var n=this.parent.getActiveSheet(),i=this.parent.serviceLocator.getService(ki);if("Sheet"===t)n.isProtected?this.ribbon.items[e].content[r].text===i.getConstant("Protect"+t)&&(this.ribbon.items[e].content[r].cssClass="e-active",this.updateProtectBtn("Unprotect",t,r,e)):this.updateProtectBtn("Protect",t,r,e);else if("Workbook"===t){var a=this.parent.serviceLocator.getService(ki);this.parent.isProtected?this.ribbon.items[e].content[r].text===a.getConstant("Protect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("UnProtect",t,r,e)):this.ribbon.items[e].content[r].text===a.getConstant("UnProtect"+t)&&this.updateToggleText("protectworkbook",this.updateRibbonItemText("Protect",t,r,e))}},e.prototype.updateProtectBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(ki).getConstant(e+t);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protect",i)},e.prototype.updateProtectWorkbookBtn=function(e,t,r,n){var i=this.parent.serviceLocator.getService(ki).getConstant(e);this.ribbon.items[n].content[r].text=i,this.ribbon.setProperties({items:this.ribbon.items},!0),this.updateToggleText("protectworkbook",i)},e.prototype.addToolbarItems=function(e){this.ribbon.addToolbarItems(e.tab,e.items,e.index)},e.prototype.enableToolbarItems=function(e){var t=this;e.forEach(function(e){t.ribbon.enableItems(e.tab||t.ribbon.items[t.ribbon.selectedTab].header.text,e.items,e.enable)})},e.prototype.createMobileView=function(){var e=this,t=this.parent.element.id,r=this.parent.createElement("div",{className:"e-header-toolbar"}),i=this.parent.createElement("ul");r.appendChild(i);var a=new n.Toolbar({items:[{prefixIcon:"e-tick-icon",align:"Left",id:t+"focused_tick",cssClass:"e-focused-tick"},{template:i,align:"Right",id:t+"file_menu"}],clicked:function(r){switch(r.item.id){case t+"focused_tick":e.parent.element.classList.remove("e-mobile-focused"),e.parent.renderModule.setSheetPanelSize()}},created:function(){var t=new n.Menu({cssClass:"e-mobile e-file-menu",enableRtl:!0,showItemOnClick:!0,items:e.getRibbonMenuItems(),select:e.fileMenuItemSelect.bind(e),beforeOpen:function(t){t.element.parentElement.classList.remove("e-rtl"),e.fileMenuBeforeOpen(t)},beforeClose:e.fileMenuBeforeClose.bind(e)});t.createElement=e.parent.createElement,t.appendTo(i)}});a.createElement=this.parent.createElement,a.appendTo(r),this.parent.element.insertBefore(r,this.parent.element.firstElementChild),this.renderMobileToolbar()},e.prototype.renderMobileToolbar=function(){var e=this,t=this.parent.createElement("div",{className:"e-toolbar-panel e-ribbon"}),r=this.parent.createElement("div"),i=this.parent.createElement("button");t.appendChild(r),t.appendChild(i),t.style.display="block",this.parent.element.appendChild(t);var a=new l.DropDownButton({cssClass:"e-caret-hide",content:this.ribbon.items[0].header.text,items:[{text:this.ribbon.items[0].header.text},{text:this.ribbon.items[1].header.text},{text:this.ribbon.items[2].header.text},{text:this.ribbon.items[3].header.text}],select:function(t){t.item.text!==a.content&&(o.element.style.display="none",a.content=t.item.text,a.dataBind(),o.items=e.ribbon.items[a.items.indexOf(t.item)+1].content,o.width="calc(100% - "+i.getBoundingClientRect().width+"px)",o.element.style.display="",o.dataBind(),o.items[0].text=t.item.text,o.dataBind())},open:function(e){var t=e.element.parentElement,r=t.getBoundingClientRect(),n=h.calculatePosition(a.element,"right","bottom");t.style.left=n.left-r.width+"px",t.style.top=n.top-r.height+"px";for(var i=0;i<a.items.length;i++)if(a.content===a.items[i].text){e.element.children[i].classList.add("e-selected");break}},close:function(){return Ct(e.parent.element)}});a.createElement=this.parent.createElement,a.appendTo(i);var o=new n.Toolbar({width:"calc(100% - "+i.getBoundingClientRect().width+"px)",items:this.ribbon.items[0].content,clicked:this.toolbarClicked.bind(this)});o.createElement=this.parent.createElement,o.appendTo(r),t.style.display=""},e.prototype.fileMenuBeforeOpen=function(e){var t,r=this,n=this.parent.serviceLocator.getService(ki),i=[".xlsx",".xls",".csv",".pdf"];e.parentItem.text===n.getConstant("SaveAs")&&[].slice.call(e.element.children).forEach(function(e,n){t=r.parent.createElement("div",{innerHTML:e.innerHTML}),e.innerHTML="",t.appendChild(r.parent.createElement("span",{className:"e-extension",innerHTML:i[n]})),e.appendChild(t)}),this.parent.trigger("fileMenuBeforeOpen",e)},e.prototype.enableRibbonTabs=function(e){this.ribbon.enableTabs(e.tabs,e.enable)},e.prototype.fileMenuBeforeClose=function(e){this.parent.trigger("fileMenuBeforeClose",e)},e.prototype.hideFileMenuItems=function(e){this.ribbon.hideMenuItems(e.items,e.hide,e.isUniqueId)},e.prototype.addFileMenuItems=function(e){this.ribbon.addMenuItems(e.items,e.text,e.insertAfter,e.isUniqueId)},e.prototype.hideToolbarItems=function(e){this.ribbon.hideToolbarItems(e.tab,e.indexes,e.hide)},e.prototype.protectSheetHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(ki);t.isProtected&&t.protectSettings.formatCells||!t.isProtected?(this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.enableHomeBtnId,enable:!0}]),this.parent.notify("setUndoRedo",null)):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.disableHomeBtnId,enable:!1}]),t.isProtected&&t.protectSettings.insertLink||!t.isProtected?this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.enableInsertBtnId,enable:!1}]),t.isProtected&&t.protectSettings.selectCells||!t.isProtected?this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!0}]):this.enableToolbarItems([{tab:r.getConstant("Home"),items:e.findBtnId,enable:!1}]);var n,i=this.ribbon.items[this.ribbon.selectedTab].content.length;for(n=0;n<i&&this.ribbon.items[this.ribbon.selectedTab].content[n].id!==this.parent.element.id+"_protectworkbook";n++);t.isProtected?(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnProtectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnProtectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:!1}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:!1}])):(this.parent.isProtected&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook")&&this.parent.element.querySelector("#"+this.parent.element.id+"_protectworkbook").querySelector(".e-tbar-btn-text").textContent===r.getConstant("UnProtectWorkbook")?this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("UnProtectWorkbook")):this.ribbon.items[this.ribbon.selectedTab].header.text===r.getConstant("Data")&&(this.ribbon.items[this.ribbon.selectedTab].content[n].text=r.getConstant("ProtectWorkbook")),this.enableToolbarItems([{tab:r.getConstant("Data"),items:e.dataValidationBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Formulas"),items:e.enableFrmlaBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.imageBtnId,enable:!0}]),this.enableToolbarItems([{tab:r.getConstant("Insert"),items:e.chartBtnId,enable:!0}]))},e.prototype.updateMergeItem=function(e){if("mousemove"===e.type||"pointermove"===e.type||e.shiftKey&&"mousedown"===e.type){var t=c(this.parent.getActiveSheet().selectedRange);t[1]===t[3]&&t[0]===t[2]||this.parent.getActiveSheet().isProtected||(this.enableToolbarItems([{tab:this.parent.serviceLocator.getService(ki).getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!1))}},e.prototype.addEventListener=function(){this.parent.on("ribbon",this.initRibbon,this),this.parent.on("enableToolbarItems",this.enableToolbarItems,this),this.parent.on("activeCellChanged",this.refreshRibbonContent,this),this.parent.on("updateToggleItem",this.toggleRibbonItems,this),this.parent.on("enableFileMenuItems",this.enableFileMenuItems,this),this.parent.on("hideRibbonTabs",this.hideRibbonTabs,this),this.parent.on("addRibbonTabs",this.addRibbonTabs,this),this.parent.on("addToolbarItems",this.addToolbarItems,this),this.parent.on("hideFileMenuItems",this.hideFileMenuItems,this),this.parent.on("addFileMenuItems",this.addFileMenuItems,this),this.parent.on("hideToolbarItems",this.hideToolbarItems,this),this.parent.on("enableRibbonTabs",this.enableRibbonTabs,this),this.parent.on("protectCellFormat",this.protectSheetHandler,this),this.parent.on("selectionComplete",this.updateMergeItem,this),this.parent.on("refreshRibbonIcons",this.refreshRibbonContent,this),this.parent.on("insertDesignChart",this.insertDesignChart,this),this.parent.on("removeDesignChart",this.removeDesignChart,this),this.parent.on("ribbonFind",this.findToolDlg,this)},e.prototype.destroy=function(){var e=this.parent.element,r=this.ribbon.element,n=this.cPickerEle,i=e.id;["bold","italic","line-through","underline"].forEach(function(r){rt(t.select("#"+i+"_"+r,e),a.Button)}),this.pasteSplitBtn.destroy(),this.pasteSplitBtn=null,this.mergeSplitBtn.destroy(),this.mergeSplitBtn=null,this.numFormatDDB.destroy(),this.numFormatDDB=null,this.fontSizeDdb.destroy(),this.fontSizeDdb=null,this.fontNameDdb.destroy(),this.fontNameDdb=null,this.textAlignDdb.destroy(),this.textAlignDdb=null,this.verticalAlignDdb.destroy(),this.verticalAlignDdb=null,this.sortingDdb.destroy(),this.sortingDdb=null,this.clearDdb.destroy(),this.clearDdb=null,this.colorPicker.destroy(),this.colorPicker=null,this.bordersMenu.destroy(),this.bordersMenu=null,this.bordersDdb.destroy(),this.bordersDdb=null,this.findDdb.destroy(),this.findDdb=null,this.chartDdb.destroy(),this.chartDdb=null,this.chartMenu.destroy(),this.chartMenu=null,this.cFDdb.destroy(),this.cFDdb=null,this.parent.notify("destroyRibbonComponents",null),this.ribbon.destroy(),r&&t.detach(r),this.ribbon=null,n&&t.detach(n),this.cPickerEle=null,this.removeEventListener()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("ribbon",this.initRibbon),this.parent.off("enableToolbarItems",this.enableToolbarItems),this.parent.off("activeCellChanged",this.refreshRibbonContent),this.parent.off("updateToggleItem",this.toggleRibbonItems),this.parent.off("enableFileMenuItems",this.enableFileMenuItems),this.parent.off("hideRibbonTabs",this.hideRibbonTabs),this.parent.off("addRibbonTabs",this.addRibbonTabs),this.parent.off("addToolbarItems",this.addToolbarItems),this.parent.off("hideFileMenuItems",this.hideFileMenuItems),this.parent.off("addFileMenuItems",this.addFileMenuItems),this.parent.off("hideToolbarItems",this.hideToolbarItems),this.parent.off("enableRibbonTabs",this.enableRibbonTabs),this.parent.off("protectCellFormat",this.protectSheetHandler),this.parent.off("selectionComplete",this.updateMergeItem),this.parent.off("refreshRibbonIcons",this.refreshRibbonContent),this.parent.off("insertDesignChart",this.insertDesignChart),this.parent.off("removeDesignChart",this.removeDesignChart),this.parent.on("ribbonFind",this.findToolDlg,this))},e}(),hi=function(){function e(e){this.categoryCollection=[],this.formulaCollection=[],this.isGoto=!1,this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"formulaBar"},e.prototype.createFormulaBar=function(e){if(!this.parent.showFormulaBar&&this.insertFnRipple)return void this.destroy();var r=this.parent.serviceLocator.getService(ki),n=this.parent.element.id,i=this.parent.createElement("div",{className:"e-formula-bar-panel"});if(!this.parent.isMobileView()){var a=this.parent.createElement("input",{id:n+"_name_box",attrs:{type:"text"}});i.appendChild(a),this.comboBoxInstance=new o.ComboBox({value:"A1",cssClass:"e-name-box",width:"",noRecordsTemplate:"",fields:{text:"name",value:"refersTo"},beforeOpen:this.nameBoxBeforeOpen.bind(this),blur:this.nameBoxBlur.bind(this),select:this.nameBoxSelect.bind(this),change:function(){}}),this.comboBoxInstance.createElement=this.parent.createElement,this.comboBoxInstance.appendTo(a),this.comboBoxInstance.element.parentElement.title=r.getConstant("NameBox")}i.appendChild(this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-insert-function",attrs:{title:r.getConstant("InsertFunction")}})).appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons"})),this.insertFnRipple=t.rippleEffect(i,{selector:".e-insert-function"}),i.appendChild(this.parent.createElement("div",{className:"e-separator"}));var s=i.appendChild(this.parent.createElement("textarea",{className:"e-formula-bar e-css",id:n+"_formula_input",attrs:{title:r.getConstant("FormulaBar"),spellcheck:"false"}}));s.rows=1,this.parent.isMobileView()?(s.placeholder=r.getConstant("MobileFormulaBarPlaceHolder"),t.EventHandler.add(s,"focus",this.textAreaFocusIn,this),t.EventHandler.add(s,"blur",this.textAreaFocusOut,this)):i.appendChild(this.parent.createElement("span",{className:"e-drop-icon e-icons",attrs:{title:r.getConstant("ExpandFormulaBar")}})),e&&e.uiUpdate?this.parent.element.insertBefore(i,document.getElementById(n+"_sheet_panel")):this.parent.element.appendChild(i)},e.prototype.textAreaFocusIn=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel"),t=this.parent.createElement("button",{className:"e-btn e-css e-flat e-icon-btn e-formula-submit"});t.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-tick-icon"})),e.classList.add("e-focused"),e.appendChild(t)},e.prototype.textAreaFocusOut=function(){var e=this.parent.element.querySelector(".e-formula-bar-panel");e.classList.remove("e-focused"),t.detach(e.querySelector(".e-formula-submit"))},e.prototype.keyDownHandler=function(e){var t=e.target;if(this.parent.isEdit&&!this.parent.getActiveSheet().isProtected){if((q(t.value)||t.validity&&0===t.value.toString().indexOf("="))&&16===e.keyCode)return;t.classList.contains("e-formula-bar")&&this.parent.notify(Wt,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=e.target;if(t.classList.contains("e-formula-bar")){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,r),r.editedValue!==t.value&&16!==e.keyCode&&this.parent.notify(Wt,{action:"refreshEditor",value:t.value,refreshEditorElem:!0})}}},e.prototype.nameBoxBeforeOpen=function(e){this.comboBoxInstance.element.classList.contains("e-name-editing")?e.cancel=!0:this.comboBoxInstance.element.select()},e.prototype.nameBoxBlur=function(){this.comboBoxInstance.element.classList.contains("e-name-editing")&&(this.comboBoxInstance.element.classList.remove("e-name-editing"),this.UpdateValueAfterMouseUp())},e.prototype.nameBoxSelect=function(e){if(e.isInteracted){var t=e.itemData.refersTo.substr(1),r=ae(this.parent,se(t)),n=C(t),i=ce(this.parent,r);if(-1!==n.indexOf(":")){var a=n.indexOf(":"),o=n.substr(0,a),s=n.substr(a+1,n.length);o=o.replace("$",""),(s=s.replace("$","")).match(/\D/g)&&!s.match(/[0-9]/g)&&o.match(/\D/g)&&!o.match(/[0-9]/g)?n=(o+="1")+":"+(s+=i.rowCount):!s.match(/\D/g)&&s.match(/[0-9]/g)&&!o.match(/\D/g)&&o.match(/[0-9]/g)&&(n=(o=g(parseInt(o,10)-1,0))+":"+(s=g(parseInt(s,10)-1,i.colCount-1)))}r===this.parent.activeSheetIndex?(this.parent.selectRange(n),Ct(this.parent.element)):(he(this.parent,n,i),this.parent.activeSheetIndex=r)}},e.prototype.formulaBarUpdateHandler=function(e){var r,n=this,i=this.parent.getActiveSheet().selectedRange.split(":"),a=document.getElementsByClassName("e-spreadsheet-edit")[0],o=this.parent.element.querySelector(".e-formula-bar"),s=new t.Internationalization;if("mousemove"===e.type||"pointermove"===e.type){var l=c(i[0]),h=c(i[1]);r=Math.abs(l[0]-h[0])+1+"R x "+(Math.abs(l[1]-h[1])+1)+"C",this.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?this.parent.notify("editValue",null):a&&(o.value=a.textContent))}else r=i[0],this.parent.getData(ve(this.parent)+"!"+r).then(function(i){var l,h="";i.forEach(function(i){var d=i&&i.format?H(i.format):"General";i&&(t.isNullOrUndefined(i.value)||(l=A(Number(i.value)),h="Invalid Date"===l.toString()||"ShortDate"!==d&&"LongDate"!==d?"Invalid Date"!==l.toString()&&"Time"===d?s.formatDate(l,{type:"dateTime",skeleton:"yMd"})+" "+s.formatDate(l,{type:"dateTime",skeleton:"hms"}):i.value:s.formatDate(l,{type:"date",skeleton:"yMd"})),i.formula&&(h=i.formula));var p={action:"getCurrentEditValue",editedValue:""};n.parent.notify(Wt,p);var u=p.editedValue&&0===p.editedValue.toString().indexOf("=")||q(p.editedValue),f=document.getElementById(n.parent.element.id+"_formula_input"),g=c(r),m=n.parent.getCell(g[0],g[1]);i&&!i.formula&&m?f.value=m.textContent:f.value=h,t.isNullOrUndefined(h)||u||n.parent.notify(Wt,{action:"refreshEditor",value:f.value,refreshEditorElem:!0}),n.parent.isEdit&&(e.target&&!e.target.classList.contains("e-spreadsheet-edit")?n.parent.notify("editValue",null):a&&(o.value=a.textContent))})});this.updateComboBoxValue(r)},e.prototype.UpdateValueAfterMouseUp=function(){this.updateComboBoxValue(this.parent.getActiveSheet().selectedRange.split(":")[0])},e.prototype.updateComboBoxValue=function(e){var t=this.parent.getActiveSheet(),r={action:"getNameFromRange",range:ve(this.parent)+"!"+t.selectedRange,definedName:null};if(this.parent.notify("formulaOperation",r),r.definedName&&(e=r.definedName.name),!this.parent.isMobileView()){if(this.comboBoxInstance.text===e)return;this.comboBoxInstance.text=e,this.comboBoxInstance.dataBind()}},e.prototype.disabletextarea=function(){var e=this.getFormulaBar();this.parent.getActiveSheet().isProtected?e.disabled=!0:e.disabled=!1},e.prototype.formulaBarScrollEdit=function(){var e=c(this.parent.getActiveSheet().selectedRange),t=u(this.parent.getActiveSheet().topLeftCell);e[0]<t[0]&&(this.parent.goTo(this.parent.getActiveSheet().selectedRange),this.isGoto=!0),this.parent.notify(Wt,{action:"startEdit",refreshCurPos:!1})},e.prototype.formulaBarClickHandler=function(e){var r=this,n=e.target;if(n.classList.contains("e-drop-icon")&&t.closest(n,".e-formula-bar-panel"))this.toggleFormulaBar(n);else if(n.classList.contains("e-formula-bar"))this.parent.isEdit||this.parent.getActiveSheet().isProtected?this.parent.getActiveSheet().isProtected&&this.parent.notify("editAlert",null):this.formulaBarScrollEdit();else if(n.parentElement&&n.parentElement.classList.contains("e-name-box"))if(n.classList.contains("e-ddl-icon")){l={action:"getNames",names:[]};this.parent.notify("formulaOperation",l),this.comboBoxInstance.dataSource=l.names}else this.comboBoxInstance.element.classList.add("e-name-editing"),this.comboBoxInstance.element.select();if(!t.isNullOrUndefined(n.offsetParent)&&(n.offsetParent.classList.contains("e-insert-function")||n.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.offsetParent.id||this.parent.element.id+"_insert_function"===n.id||n.parentElement.classList.contains("e-insert-function")||this.parent.element.id+"_insert_function"===n.parentElement.id)){if(this.parent.getActiveSheet().isProtected)return void this.parent.notify("editAlert",null);var i=!this.parent.isEdit,a={action:"getCurrentEditValue",editedValue:""};if(!i){var l={action:"isFormulaEditing",isFormulaEdit:!1};this.parent.notify("formulaOperation",l),i=l.isFormulaEdit,this.parent.notify(Wt,a)}if(i||""===a.editedValue){""===a.editedValue&&this.parent.notify(Wt,{action:"refreshEditor",value:"="});var h=this.parent.serviceLocator.getService(ki),d=this.parent.createElement("div",{className:"e-formula-description",id:this.parent.element.id+"_description_content"}),p=this.parent.createElement("div",{className:"e-category-content",id:this.parent.element.id+"_category_content",innerHTML:h.getConstant("PickACategory")}),c=this.parent.createElement("input",{className:"e-formula-category",id:this.parent.element.id+"_formula_category"}),u=this.parent.createElement("div",{className:"e-formula-list",id:this.parent.element.id+"_formula_list"}),f=this.parent.createElement("div",{className:"e-description-content",innerHTML:h.getConstant("Description")}),g=this.parent.createElement("div",{className:"e-header-content",innerHTML:h.getConstant("InsertFunction")}),m={action:"getFormulaCategory",categoryCollection:[]};this.parent.notify(Et,m),this.categoryCollection=m.categoryCollection,this.categoryList=new o.DropDownList({dataSource:this.categoryCollection,index:0,width:"285px",popupHeight:"210px",select:this.dropDownSelect.bind(this)});var v={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(Et,v),this.formulaCollection=v.formulaCollection,this.formulaList=new s.ListView({dataSource:this.formulaCollection.sort(),actionComplete:this.updateFormulaList.bind(this),select:this.listSelected.bind(this),width:"285px",height:"200px"}),this.dialog=this.parent.serviceLocator.getService("dialog"),this.dialog.show({header:g.outerHTML,content:p.outerHTML+c.outerHTML+u.outerHTML+f.outerHTML+d.outerHTML,width:"320px",height:"485px",cssClass:"e-spreadsheet-function-dlg",showCloseIcon:!0,isModal:!0,beforeOpen:function(e){var t={dialogName:"InsertFunctionDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0),Ct(r.parent.element)},open:this.dialogOpen.bind(this),beforeClose:this.dialogBeforeClose.bind(this),close:this.dialogClose.bind(this),buttons:[{click:this.selectFormula.bind(this,this.dialog,this),buttonModel:{content:h.getConstant("Ok"),isPrimary:!0}}]}),this.categoryList.appendTo("#"+this.parent.element.id+"_formula_category"),this.formulaList.appendTo("#"+this.parent.element.id+"_formula_list"),t.EventHandler.add(this.formulaList.element,"dblclick",this.formulaClickHandler,this)}}},e.prototype.toggleFormulaBar=function(e){var t=e.parentElement,r=this.parent.serviceLocator.getService(ki);t.classList.contains("e-expanded")?(t.classList.remove("e-expanded"),document.getElementById(this.parent.element.id+"_formula_input").rows=1,e.title=r.getConstant("ExpandFormulaBar")):(t.classList.add("e-expanded"),document.getElementById(this.parent.element.id+"_formula_input").rows=3,e.title=r.getConstant("CollapseFormulaBar")),this.parent.setPanelSize()},e.prototype.dialogOpen=function(){this.focusOkButton()},e.prototype.dialogClose=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,e),"="===e.editedValue.toString().trim()&&this.parent.notify(Wt,{action:"refreshEditor",value:""})},e.prototype.dialogBeforeClose=function(){t.EventHandler.remove(this.formulaList.element,"dblclick",this.formulaClickHandler);var e=document.getElementById("_dialog-content");e.parentNode.removeChild(e),this.dialog.dialogInstance.storeActiveElement=document.getElementById(this.parent.element.id+"_edit")},e.prototype.selectFormula=function(e,t){var r=t.formulaList.getSelectedItems().text,n=ce(this.parent,this.parent.activeSheetIndex);this.parent.isEdit?this.parent.notify(Wt,{action:"refreshEditor",value:r+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Wt,{action:"startEdit",value:"="+r+"(",address:n.activeCell}),this.parent.notify("formulaBarOperation",{action:"refreshFormulabar",value:"="+r+"("})),e.hide()},e.prototype.listSelected=function(){this.updateFormulaDescription()},e.prototype.updateFormulaList=function(){this.activeListFormula(),this.updateFormulaDescription()},e.prototype.dropDownSelect=function(e){this.formulaCollection=[];var t={action:"getLibraryFormulas",formulaCollection:[]};if("All"===e.item.textContent)this.parent.notify(Et,t),this.formulaCollection=t.formulaCollection;else{var r={action:"dropDownSelectFormulas",formulaCollection:[],selectCategory:e.item.textContent};this.parent.notify(Et,r),this.formulaCollection=r.formulaCollection}this.formulaList.dataSource=this.formulaCollection.sort()},e.prototype.focusOkButton=function(){document.getElementById("_dialog-content").nextElementSibling.firstElementChild.focus()},e.prototype.activeListFormula=function(){var e=document.getElementById(this.parent.element.id+"_formula_list").children[0].children[0].firstElementChild;this.formulaList.selectItem(e)},e.prototype.updateFormulaDescription=function(){var e=this.formulaList.getSelectedItems().text,t={action:"getFormulaDescription",description:"",selectedList:e};this.parent.notify(Et,t),this.focusOkButton();var r=document.getElementById(this.parent.element.id+"_description_content");e="AND"===e?"CalculateAND":"OR"===e?"CalculateOR":e,r.innerHTML=this.parent.serviceLocator.getService(ki).getConstant(e)},e.prototype.formulaClickHandler=function(e){var t=e.target,r=ce(this.parent,this.parent.activeSheetIndex);(t.offsetParent.classList.contains("e-text-content")||t.classList.contains("e-list-item"))&&(this.parent.isEdit?this.parent.notify(Wt,{action:"refreshEditor",value:t.innerText+"(",refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!0}):(this.parent.notify(Wt,{action:"startEdit",value:"="+t.innerText+"(",address:r.activeCell}),this.parent.notify("formulaBarOperation",{action:"refreshFormulabar",value:"="+t.innerText+"("})),this.dialog.hide())},e.prototype.addEventListener=function(){this.parent.on("formulaBar",this.createFormulaBar,this),this.parent.on(Gt,this.formulaBarClickHandler,this),this.parent.on(Xt,this.keyDownHandler,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on("selectionComplete",this.formulaBarUpdateHandler,this),this.parent.on("mouseUpAfterSelection",this.UpdateValueAfterMouseUp,this),this.parent.on("formulaBarOperation",this.editOperationHandler,this),this.parent.on("enableFormulaInput",this.disabletextarea,this),this.parent.on("isFormulaBarEdit",this.isFormulaBarEdit,this)},e.prototype.destroy=function(){this.removeEventListener(),this.comboBoxInstance.destroy(),this.comboBoxInstance=null,this.insertFnRipple(),this.insertFnRipple=null;var e=this.parent.element.querySelector(".e-formula-bar-panel");e&&t.detach(e)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("formulaBar",this.createFormulaBar),this.parent.off(Gt,this.formulaBarClickHandler),this.parent.off(Xt,this.keyDownHandler),this.parent.off(Yt,this.keyUpHandler),this.parent.off("selectionComplete",this.formulaBarUpdateHandler),this.parent.off("mouseUpAfterSelection",this.UpdateValueAfterMouseUp),this.parent.off("formulaBarOperation",this.editOperationHandler),this.parent.off("enableFormulaInput",this.disabletextarea),this.parent.off("isFormulaBarEdit",this.isFormulaBarEdit))},e.prototype.editOperationHandler=function(e){switch(e.action){case"refreshFormulabar":this.getFormulaBar().value=t.isUndefined(e.value)?"":e.value;break;case"getElement":e.element=this.getFormulaBar()}},e.prototype.isFormulaBarEdit=function(e){this.parent.isEdit&&this.isGoto?e.isEdit=!0:e.isEdit=!1},e.prototype.getFormulaBar=function(){return t.select("#"+this.parent.element.id+"_formula_input",this.parent.element)},e}(),di=function(){function e(e){this.isFormulaBar=!1,this.isFormula=!1,this.isPopupOpened=!1,this.isPreventClose=!1,this.isSubFormula=!1,this.keyCodes={UP:38,DOWN:40,LEFT:37,RIGHT:39,FIRSTALPHABET:65,LASTALPHABET:90,SPACE:32,BACKSPACE:8,TAB:9,DELETE:46,ENTER:13,ESC:27},this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"formula"},e.prototype.destroy=function(){this.removeEventListener(),this.autocompleteInstance&&(this.autocompleteInstance.destroy(),this.autocompleteInstance.element&&this.autocompleteInstance.element.remove()),this.autocompleteInstance=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on("formulaOperation",this.performFormulaOperation,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on(Xt,this.keyDownHandler,this),this.parent.on(Gt,this.formulaClick,this),this.parent.on("refreshFormulaDatasource",this.refreshFormulaDatasource,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("formulaOperation",this.performFormulaOperation),this.parent.off(Yt,this.keyUpHandler),this.parent.off(Xt,this.keyDownHandler),this.parent.off(Gt,this.formulaClick),this.parent.off("refreshFormulaDatasource",this.refreshFormulaDatasource))},e.prototype.performFormulaOperation=function(e){var t=this,r=e.action,n=this.parent.serviceLocator.getService(ki);switch(r){case"renderAutoComplete":this.renderAutoComplete();break;case"endEdit":this.endEdit();break;case"addDefinedName":e.isAdded=this.addDefinedName(e.definedName);break;case"getNames":e.sheetName||(e.sheetName=ve(this.parent)),e.names=this.getNames(e.sheetName);break;case"getNameFromRange":e.definedName=this.getNameFromRange(e.range);break;case"isFormulaEditing":e.isFormulaEdit=this.isFormula;break;case"isCircularReference":this.parent.serviceLocator.getService(Ai).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:n.getConstant("CircularReference"),beforeOpen:function(e){var r={dialogName:"CircularReferenceDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),e.argValue="0"}},e.prototype.renderAutoComplete=function(){if(!t.select("#"+this.parent.element.id+"_ac",this.parent.element)){var e=this.parent.createElement("input",{id:this.parent.element.id+"_ac",className:"e-ss-ac"});this.parent.element.appendChild(e);var r={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(Et,r);var n={dataSource:r.formulaCollection,cssClass:"e-ss-atc",popupWidth:"130px",allowFiltering:!0,filterType:"StartsWith",sortOrder:"Ascending",open:this.onSuggestionOpen.bind(this),close:this.onSuggestionClose.bind(this),select:this.onSelect.bind(this),actionComplete:this.onSuggestionComplete.bind(this)};this.autocompleteInstance=new o.AutoComplete(n,e),this.autocompleteInstance.createElement=this.parent.createElement}},e.prototype.onSuggestionOpen=function(e){var t=this;this.isPopupOpened=!0,e.popup.relateTo=this.getRelateToElem(),e.popup.element.firstChild.style.maxHeight="180px",new Promise(function(e,t){setTimeout(function(){e()},100)}).then(function(){t.triggerKeyDownEvent(t.keyCodes.DOWN)})},e.prototype.onSuggestionClose=function(e){this.isPreventClose?e.cancel=!0:this.isPopupOpened=!1},e.prototype.onSelect=function(e){var t="="+e.itemData.value+"(";if(this.isSubFormula){var r=this.getEditingValue(),n=r.lastIndexOf(this.getArgumentSeparator());n>-1?t=r.slice(0,n+1):(n=r.lastIndexOf("("))>-1&&(t=r.slice(0,n+1)),t+=e.itemData.value+"("}this.parent.notify(Wt,{action:"refreshEditor",value:t,refreshFormulaBar:!0,refreshEditorElem:!0,refreshCurPos:!this.isFormulaBar})},e.prototype.onSuggestionComplete=function(e){this.isPreventClose=e.result.length>0,this.isPreventClose||(e.cancel=!0,this.hidePopUp())},e.prototype.refreshFormulaDatasource=function(){var e={action:"getLibraryFormulas",formulaCollection:[]};this.parent.notify(Et,e),this.autocompleteInstance.dataSource=e.formulaCollection},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=this.getEditingValue();this.isFormula=q(t),(this.isFormula||this.isPopupOpened)&&(e.keyCode!==this.keyCodes.TAB&&this.isFormula&&(t=this.getSuggestionKeyFromFormula(t)),this.refreshFormulaSuggestion(e,t))}else this.isPopupOpened&&this.hidePopUp()},e.prototype.keyDownHandler=function(e){var t=e.keyCode;if(this.isFormula){if(this.isPopupOpened)switch(t){case this.keyCodes.UP:case this.keyCodes.DOWN:e.preventDefault(),this.triggerKeyDownEvent(t);break;case this.keyCodes.TAB:e.preventDefault(),this.triggerKeyDownEvent(this.keyCodes.ENTER)}}else{var r=e.target;if(r.id===this.parent.element.id+"_name_box")switch(t){case this.keyCodes.ENTER:this.addDefinedName({name:r.value}),Ct(this.parent.element);break;case this.keyCodes.ESC:Ct(this.parent.element)}}},e.prototype.formulaClick=function(e){if(this.parent.isEdit){var t=e.target;this.isFormulaBar=t.classList.contains("e-formula-bar")}},e.prototype.refreshFormulaSuggestion=function(e,t){if(t.length>0){var r=this.autocompleteInstance.element,n=e.keyCode,i=this.isPopupOpened;this.isNavigationKey(n)||(r.value=t,r.dispatchEvent(new Event("input")),r.dispatchEvent(new Event("keyup")),i&&this.triggerKeyDownEvent(this.keyCodes.DOWN))}else this.isPopupOpened&&(this.isPreventClose=!1,this.hidePopUp())},e.prototype.endEdit=function(){if(this.isSubFormula=!1,this.isPreventClose=!1,this.isFormula=!1,this.isFormulaBar=!1,this.isPopupOpened){this.hidePopUp();var e=t.select("#"+this.parent.element.id+"_ac_popup");e&&t.detach(e),this.isPopupOpened=!1}},e.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},e.prototype.getSuggestionKeyFromFormula=function(e){var t="";if(e=e.substr(1)){var r=e.lastIndexOf("("),n=(e=e.substr(r+1)).split(this.getArgumentSeparator());1===n.length?(t=n[0],this.isSubFormula=r>-1):(t=n[n.length-1],this.isSubFormula=!0);var i=t.match(/\w/);(!i||i&&0!==i.index)&&(t="")}return t},e.prototype.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify("formulaBarOperation",e):this.parent.notify(Wt,e),e.element},e.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(Wt,e),e.editedValue},e.prototype.isNavigationKey=function(e){return e===this.keyCodes.UP||e===this.keyCodes.DOWN||e===this.keyCodes.LEFT||e===this.keyCodes.RIGHT},e.prototype.triggerKeyDownEvent=function(e){var t=this.autocompleteInstance.element;t.dispatchEvent(new Event("input"));var r=new Event("keydown");r.keyCode=e,r.which=e,r.altKey=!1,r.shiftKey=!1,r.ctrlKey=!1,t.dispatchEvent(r)},e.prototype.getArgumentSeparator=function(){if(this.argumentSeparator)return this.argumentSeparator;var e={action:"getArgumentSeparator",argumentSeparator:""};return this.parent.notify(Et,e),this.argumentSeparator=e.argumentSeparator,e.argumentSeparator},e.prototype.getNames=function(e){return this.parent.definedNames.filter(function(t){return"Workbook"===t.scope||""===t.scope||t.scope===e})},e.prototype.getNameFromRange=function(e){var t=e.slice(0,e.indexOf(":")),r=e.slice(e.indexOf("!")+1).split(":"),n=r.length>1&&r[0]===r[1],i=this.parent.definedNames.filter(function(r){return!(!n||r.refersTo!=="="+t)||r.refersTo==="="+e});return i&&i[0]},e.prototype.addDefinedName=function(e){var r=this,n=e.name,i=!1;if(!e.refersTo){var a=ce(this.parent,this.parent.activeSheetIndex),o=ve(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o;var s=a.selectedRange;if(!t.isNullOrUndefined(s)){var l=s.indexOf(":"),h=s.substr(0,l),d=s.substr(l+1,s.length);parseInt(d.replace(/\D/g,""),10)===a.rowCount&&1===parseInt(h.replace(/\D/g,""),10)?(d=d.replace(/[0-9]/g,""),s="$"+(h=h.replace(/[0-9]/g,""))+":$"+d):u(d)[1]===a.colCount-1&&0===u(h)[1]?(d=d.replace(/\D/g,""),s="$"+(h=h.replace(/\D/g,""))+":$"+d):s=h===d?h:s}e.refersTo=o+"!"+s,e.scope="Workbook"}if(n.length>0&&/^([a-zA-Z_0-9.]){0,255}$/.test(n)){var p={action:"addDefinedName",definedName:e,isAdded:!1};this.parent.notify(Et,p),i=p.isAdded,p.isAdded||this.parent.serviceLocator.getService(Ai).show({content:this.parent.serviceLocator.getService(ki).getConstant("DefineNameExists"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameExistsDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}})}else this.parent.serviceLocator.getService(Ai).show({content:this.parent.serviceLocator.getService(ki).getConstant("DefineNameInValid"),width:"300",beforeOpen:function(e){var t={dialogName:"DefineNameInValidDialog",element:e.element,target:e.target,cancel:e.cancel};r.parent.trigger("dialogBeforeOpen",t),t.cancel&&(e.cancel=!0)}});return i},e}(),pi=function(){function e(e){this.aggregateContent="",this.isSelectCancel=!1,this.selaggregateCnt="Sum",this.parent=e,this.addEventListener()}return e.prototype.getModuleName=function(){return"sheetTabs"},e.prototype.createSheetTabs=function(){var e=this;if(!this.parent.showSheetTabs&&this.tabInstance)return void this.destroy();var r=this.parent.serviceLocator.getService(ki),i=this.parent.createElement("div",{className:"e-sheet-tab-panel",id:this.parent.element.id+"_sheet_tab_panel"}),a=this.parent.createElement("button",{className:"e-add-sheet-tab e-btn e-css e-flat e-icon-btn"+(this.parent.allowInsert?"":" e-disabled"),attrs:{title:r.getConstant("AddSheet")}});a.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-add-icon"})),a.addEventListener("click",this.addSheetTab.bind(this)),a.disabled=!this.parent.allowInsert,i.appendChild(a),this.addBtnRipple=t.rippleEffect(i,{selector:".e-add-sheet-tab"});var o=this.parent.createElement("button",{attrs:{title:r.getConstant("ListAllSheets")}});i.appendChild(o),this.parent.element.appendChild(i);var s=this.getSheetTabItems();this.dropDownInstance=new l.DropDownButton({iconCss:"e-icons",items:s.ddbItems,beforeItemRender:function(t){var r=e.parent.sheets[e.dropDownInstance.items.indexOf(t.item)];"Hidden"===r.state?t.element.classList.add("e-hide"):"VeryHidden"===r.state&&(t.element.style.display="none")},select:function(t){return e.updateSheetTab({idx:e.dropDownInstance.items.indexOf(t.item)})},beforeOpen:function(t){return e.beforeOpenHandler(e.dropDownInstance,t.element)},open:function(t){return e.openHandler(e.dropDownInstance,t.element,"left")},cssClass:"e-sheets-list e-flat e-caret-hide",close:function(){return Ct(e.parent.element)}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(o);var h=this.parent.createElement("div",{className:"e-sheet-tab"});this.tabInstance=new n.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:s.tabItems,scrollStep:250,selecting:function(t){var r={currentSheetIndex:t.selectingIndex,previousSheetIndex:t.selectedIndex,cancel:!1};e.isSelectCancel||e.parent.notify(ir,{eventArgs:r,action:"gotoSheet"}),e.isSelectCancel=r.cancel},selected:function(t){if(t.selectedIndex!==t.previousIndex){if(e.parent.notify("removeDesignChart",{}),e.parent.isEdit){var r=window.getSelection(),n=e.parent.element.getElementsByClassName("e-spreadsheet-edit")[0],i=!!n&&q(n.textContent);r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")&&(i=q(e.parent.element.querySelector(".e-formula-bar").value)),i||e.parent.endEdit()}if(e.isSelectCancel)e.tabInstance.selectedItem=t.previousIndex,e.tabInstance.dataBind(),Ct(e.parent.element);else{e.parent.activeSheetIndex=t.selectedIndex,e.parent.dataBind(),e.updateDropDownItems(t.selectedIndex,t.previousIndex),Ct(e.parent.element);var a={previousSheetIndex:t.previousIndex,currentSheetIndex:t.selectedIndex};e.parent.notify(nr,{eventArgs:a,action:"gotoSheet"});var o={action:"registerGridInCalc",sheetID:(t.selectedIndex+1).toString()};e.parent.notify(Et,o)}}},created:function(){var r=e.tabInstance.element.querySelector(".e-toolbar-items");r.classList.add("e-sheet-tabs-items"),t.EventHandler.add(r,"dblclick",e.renameSheetTab,e)}}),i.appendChild(h),this.tabInstance.createElement=this.parent.createElement,this.tabInstance.appendTo(h),t.EventHandler.remove(this.tabInstance.element,"keydown",this.tabInstance.spaceKeyDown);for(var d=s.tabItems.length,p=0;p<d;p++){var c={action:"addSheet",sheetName:"Sheet"+(p+1),index:p+1,visibleName:ve(this.parent,p)};this.parent.notify(Et,c)}this.parent.notify(Et,{action:"initiateDefinedNames"}),this.parent.notify("protectSheet",null)},e.prototype.updateDropDownItems=function(e,t){t>-1&&(this.dropDownInstance.items[t].iconCss=""),this.dropDownInstance.items[e].iconCss="e-selected-icon e-icons",this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0)},e.prototype.beforeOpenHandler=function(e,t){var r=this.parent.viewport.height;parseInt(getComputedStyle(t.firstElementChild).height,10)*e.items.length+2*parseInt(getComputedStyle(t).paddingTop,10)>r&&(t.style.height=r+"px",t.style.overflowY="auto"),t.parentElement.style.visibility="hidden"},e.prototype.openHandler=function(e,t,r){var n,i=t.parentElement;if(-1===h.isCollide(i).indexOf("bottom")){n="auto"===t.style.overflowY?this.parent.viewport.height:i.getBoundingClientRect().height;var a=h.calculatePosition(e.element,r,"top");"right"===r&&(a.left-=i.getBoundingClientRect().width),i.style.left=a.left+"px",i.style.top=a.top-n+"px"}i.style.visibility=""},e.prototype.getSheetTabItems=function(){var e,t=this,r=[],n=[];return this.parent.sheets.forEach(function(i,a){e=ve(t.parent,a),r.push({header:{text:e},cssClass:"Visible"===i.state?"":"e-hide"}),n.push({text:e,iconCss:a===t.parent.activeSheetIndex?"e-selected-icon e-icons":""})}),{tabItems:r,ddbItems:n}},e.prototype.refreshSheetTab=function(){var e=this.getSheetTabItems();this.dropDownInstance.items=e.ddbItems,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.items=e.tabItems,this.tabInstance.selectedItem=this.parent.activeSheetIndex,this.tabInstance.dataBind()},e.prototype.addSheetTab=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,e),this.parent.notify(Tt,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1}),Ct(this.parent.element)},e.prototype.insertSheetTab=function(e){this.parent.notify("removeDesignChart",{}),e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[this.tabInstance.selectedItem].iconCss="");for(var t=e.startIdx;t<=e.endIdx;t++){var r=this.parent.sheets[t].name;this.dropDownInstance.items.splice(t,0,{text:r}),this.tabInstance.addTab([{header:{text:r},content:""}],t)}e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[e.startIdx].iconCss="e-selected-icon e-icons"),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),e.preventUpdate?e.startIdx!==this.tabInstance.selectedItem&&this.refreshSheetTab():this.updateSheetTab({idx:e.startIdx})},e.prototype.updateSheetTab=function(e){if("activeSheetChanged"===e.name)e.idx=this.parent.skipHiddenSheets(e.idx);else if("Hidden"===this.parent.sheets[e.idx].state){if(this.parent.isProtected)return;this.parent.setSheetPropertyOnMute(this.parent.sheets[e.idx],"state","Visible"),this.tabInstance.items[e.idx].cssClass="",this.tabInstance.dataBind()}this.tabInstance.selectedItem=e.idx,this.tabInstance.dataBind(),this.parent.notify("protectSheet",null)},e.prototype.switchSheetTab=function(e){var r=t.closest(e.event.target,".e-toolbar-item");if(r){for(var n=r.querySelector(".e-tab-text").textContent,i=0,a=this.tabInstance.items.length;i<a;i++)if(this.tabInstance.items[i].header.text===n){this.parent.activeSheetIndex!==i&&this.updateSheetTab({idx:i});break}e.element.classList.contains("e-contextmenu")&&e.items[0]&&e.items[0].id===this.parent.element.id+"_cmenu_insert_sheet"&&(1===this.skipHiddenSheets()&&(e.element.children[1].classList.add("e-disabled"),e.element.children[3].classList.add("e-disabled")),this.parent.allowInsert||e.element.children[0].classList.add("e-disabled"),this.parent.allowDelete||e.element.children[1].classList.add("e-disabled")),(this.parent.password.length>0||this.parent.isProtected)&&(e.element.children[0].classList.add("e-disabled"),e.element.children[1].classList.add("e-disabled"),e.element.children[2].classList.add("e-disabled"),e.element.children[3].classList.add("e-disabled"))}},e.prototype.skipHiddenSheets=function(){var e=this.parent.sheets.length;return this.parent.sheets.forEach(function(t){"Visible"!==t.state&&--e}),e},e.prototype.renameSheetTab=function(){var e=this.tabInstance.element.querySelector(".e-toolbar-item.e-active");if(e){var r=(e=e.querySelector(".e-text-wrap")).querySelector(".e-tab-text").textContent,n={eventArgs:{name:r,index:this.parent.getActiveSheet().id},action:"renameSheet",cancel:!1};if(this.parent.trigger("actionBegin",n),n.cancel)return;var i=this.parent.createElement("input",{id:this.parent.element.id+"_rename_input",className:"e-input e-sheet-rename",styles:"width: "+e.getBoundingClientRect().width+"px",attrs:{type:"text",name:"Rename",required:"",value:r,spellcheck:"false",maxlength:"31"}});e.firstElementChild.style.display="none",e.appendChild(i),t.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),t.EventHandler.add(i,"input",this.updateWidth,this),i.focus(),i.setSelectionRange(0,r.length),t.EventHandler.remove(t.closest(e,".e-toolbar-items"),"dblclick",this.renameSheetTab)}},e.prototype.updateWidth=function(e){var t=e.target,r=t.value.length,n=t.value.split(" ");if(n.length){var i=n.length-1;r-=i,r+=.5*i}t.style.width=r+"ch"},e.prototype.renameInputFocusOut=function(e){var r=e.target;if("mousedown"!==e.type&&"touchstart"!==e.type||!r.classList.contains("e-sheet-rename")&&!t.closest(r,".e-dlg-container")){if(r=document.getElementById(this.parent.element.id+"_rename_input"),"keydown"===e.type&&27===e.keyCode)return this.removeRenameInput(r),void Ct(this.parent.element);var n=r.value,i=this.parent.serviceLocator.getService(ki);if(n){var a=this.tabInstance.selectedItem;if(n.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(r,i.getConstant("SheetRenameInvalidAlert"));else{if(this.tabInstance.items[a].header.text!==n)for(var o=0,s=this.parent.sheets.length;o<s;o++)if(o!==this.parent.activeSheetIndex&&this.parent.sheets[o].name.toLowerCase()===n.toLowerCase())return void this.showRenameDialog(r,i.getConstant("SheetRenameAlreadyExistsAlert"));var l=this.removeRenameInput(r);this.tabInstance.items[a].header.text!==n&&(this.parent.setSheetPropertyOnMute(this.parent.sheets[a],"name",n),this.updateSheetName({value:n,idx:a,items:l})),("keydown"===e.type||t.closest(e.target,".e-spreadsheet"))&&Ct(this.parent.element)}}else this.showRenameDialog(r,i.getConstant("SheetRenameEmptyAlert"));var h=this.parent.getActiveSheet().id,d={action:"renameUpdation",value:n,sheetId:h};this.parent.notify(Et,d);var p={index:h,value:n};this.parent.notify(nr,{eventArgs:p,action:"renameSheet"})}},e.prototype.updateSheetName=function(e){this.tabInstance.items[e.idx].header.text=e.value,this.dropDownInstance.items[e.idx].text=e.value,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),e.value.indexOf(" ")>-1?(this.tabInstance.setProperties({items:this.tabInstance.items},!0),e.items.querySelector(".e-toolbar-item.e-active .e-tab-text").textContent=e.value):this.tabInstance.dataBind()},e.prototype.hideSheet=function(){this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"state","Hidden"),this.tabInstance.items[this.parent.activeSheetIndex].cssClass="e-hide",this.tabInstance.dataBind(),this.tabInstance.selectedItem=this.parent.skipHiddenSheets(this.parent.activeSheetIndex===this.parent.sheets.length-1?this.parent.activeSheetIndex-1:this.parent.activeSheetIndex+1),this.tabInstance.dataBind()},e.prototype.removeRenameInput=function(e){var r=e.parentElement.querySelector(".e-tab-text"),n=t.closest(e,".e-toolbar-items");return t.EventHandler.add(n,"dblclick",this.renameSheetTab,this),t.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut),t.EventHandler.remove(e,"input",this.updateWidth),t.remove(e),r.style.display="",n},e.prototype.showRenameDialog=function(e,t){var r=this;this.parent.serviceLocator.getService(Ai).show({target:document.getElementById(this.parent.element.id+"_sheet_panel"),height:180,width:400,isModal:!0,showCloseIcon:!0,content:t,beforeOpen:function(t){var n={dialogName:"SheetRenameDialog",element:t.element,target:t.target,cancel:t.cancel};r.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),e.focus()},close:function(){return e.setSelectionRange(0,e.value.length)}})},e.prototype.focusRenameInput=function(){var e=document.getElementById(this.parent.element.id+"_rename_input");e&&e.focus()},e.prototype.removeSheetTab=function(e){var t=this;if(!e.count||e.count!==this.parent.sheets.length){var r=this.parent.serviceLocator.getService(ki);if(this.skipHiddenSheets()>1){var n=e.sheetName?ce(this.parent,ae(this.parent,e.sheetName)):this.parent.getActiveSheet(),i=e.index||ae(this.parent,n.name),a={index:i,sheetCount:this.parent.sheets.length,sheetName:n.name};if(!(!n.rows||!n.rows.length)&&(1!==n.rows.length||!(!n.rows[0].cells||!n.rows[0].cells.length))){var o=this.parent.serviceLocator.getService(Ai);e.clicked?this.forceDelete(i):o.show({height:200,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("DeleteSheetAlert"),beforeOpen:function(e){var r={dialogName:"DeleteSheetDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),Ct(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),t.forceDelete(i),t.parent.notify("clearUndoRedoCollection",null),e&&!e.isAction&&(a.sheetCount=t.parent.sheets.length,t.parent.notify(nr,{eventArgs:a,action:"removeSheet"}))}}]})}else{var s={action:"deleteSheetTab",sheetName:"",index:i+1};this.parent.notify(Et,s),this.destroySheet(i),this.parent.notify("clearUndoRedoCollection",null),e&&!e.isAction&&(a.sheetCount=this.parent.sheets.length,this.parent.notify(nr,{eventArgs:a,action:"removeSheet"}))}}else this.parent.serviceLocator.getService(Ai).show({target:document.getElementById(this.parent.element.id+"_sheet_panel"),height:180,width:400,isModal:!0,showCloseIcon:!0,content:r.getConstant("DeleteSingleLastSheetAlert"),beforeOpen:function(e){var r={dialogName:"DeleteSingleSheetDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0),Ct(t.parent.element)}})}},e.prototype.forceDelete=function(e){var t={action:"deleteSheetTab",sheetName:"",index:e+1};this.parent.notify("removeDesignChart",{}),this.parent.notify(Et,t),this.destroySheet(e)},e.prototype.destroySheet=function(e){var t=e||this.parent.activeSheetIndex;this.parent.removeSheet(t),this.parent.notify("sheetsDestroyed",{sheetIndex:t}),this.dropDownInstance.items.splice(t,1),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.removeTab(t);var r=this.parent.skipHiddenSheets(this.tabInstance.selectedItem);this.parent.activeSheetIndex=r,this.parent.setProperties({activeSheetIndex:r},!0),this.parent.renderModule.refreshSheet(),this.tabInstance.selectedItem=r,this.tabInstance.dataBind(),this.updateDropDownItems(r),this.parent.notify("protectSheet",null),Ct(this.parent.element)},e.prototype.showAggregate=function(){var e=this;if(!I(c(this.parent.getActiveSheet().selectedRange))){var t={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0};if(this.parent.notify("aggregateComputation",t),t.Count>1){this.aggregateContent=t.countOnly?"Count":this.selaggregateCnt,t.countOnly&&(this.aggregateContent="Count",delete t.Sum,delete t.Avg,delete t.Min,delete t.Max);var r=t.countOnly?"e-aggregate-list e-flat e-aggregate-list-countonly e-caret-hide":"e-aggregate-list e-flat";delete t.countOnly;var n=this.aggregateContent,i=n+": "+t[n];if(this.aggregateDropDown)this.updateAggregateContent(i,t);else{var a=this.parent.createElement("button",{id:this.parent.element.id+"_aggregate"});document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(a),this.aggregateDropDown=new l.DropDownButton({content:i,items:this.getAggregateItems(t),select:function(r){return e.updateAggregateContent(r.item.text,t,!0)},beforeOpen:function(t){return e.beforeOpenHandler(e.aggregateDropDown,t.element)},open:function(t){return e.openHandler(e.aggregateDropDown,t.element,"right")},close:function(){return Ct(e.parent.element)},cssClass:r}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(a)}}else this.removeAggregate()}},e.prototype.getAggregateItems=function(e){var t,r,n=this,i=[];return Object.keys(e).forEach(function(a){"aggregateComputation"!==e[a]&&(t=a+": "+e[a],r=a===n.aggregateContent?"e-selected-icon e-icons":"",i.push({text:t,iconCss:r}))}),i},e.prototype.updateAggregateContent=function(e,t,r){this.aggregateContent=e.split(": ")[0],r&&(this.selaggregateCnt=e.split(": ")[0]),this.aggregateDropDown.content=e,this.aggregateDropDown.dataBind(),this.aggregateDropDown.setProperties({items:this.getAggregateItems(t)},!0)},e.prototype.removeAggregate=function(){t.isNullOrUndefined(this.aggregateDropDown)||(this.aggregateDropDown.destroy(),t.remove(this.aggregateDropDown.element),this.aggregateDropDown=null)},e.prototype.addEventListener=function(){this.parent.on("sheetTabs",this.createSheetTabs,this),this.parent.on("refreshSheetTabs",this.refreshSheetTab,this),this.parent.on("insertSheetTab",this.insertSheetTab,this),this.parent.on($t,this.removeSheetTab,this),this.parent.on("renameSheetTab",this.renameSheetTab,this),this.parent.on(Kt,this.switchSheetTab,this),this.parent.on("activeSheetChanged",this.updateSheetTab,this),this.parent.on("renameSheet",this.renameInputFocusOut,this),this.parent.on("activeCellChanged",this.removeAggregate,this),this.parent.on("verticalScroll",this.focusRenameInput,this),this.parent.on("horizontalScroll",this.focusRenameInput,this),this.parent.on("sheetNameUpdate",this.updateSheetName,this),this.parent.on("hideSheet",this.hideSheet,this),this.parent.on("showAggregate",this.showAggregate,this)},e.prototype.destroy=function(){this.removeEventListener(),this.dropDownInstance.destroy(),this.dropDownInstance=null,this.tabInstance.destroy(),this.tabInstance=null,this.removeAggregate(),this.aggregateContent=null,this.addBtnRipple(),this.addBtnRipple=null,t.EventHandler.remove(document,"mousedown touchstart",this.renameInputFocusOut);var e=document.getElementById(this.parent.element.id+"_sheet_tab_panel");e&&t.remove(e),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("sheetTabs",this.createSheetTabs),this.parent.off("refreshSheetTabs",this.refreshSheetTab),this.parent.off("insertSheetTab",this.insertSheetTab),this.parent.off($t,this.removeSheetTab),this.parent.off("renameSheetTab",this.renameSheetTab),this.parent.off(Kt,this.switchSheetTab),this.parent.off("activeSheetChanged",this.updateSheetTab),this.parent.off("renameSheet",this.renameInputFocusOut),this.parent.off("activeCellChanged",this.removeAggregate),this.parent.off("verticalScroll",this.focusRenameInput),this.parent.off("horizontalScroll",this.focusRenameInput),this.parent.off("sheetNameUpdate",this.updateSheetName),this.parent.off("hideSheet",this.hideSheet),this.parent.off("showAggregate",this.showAggregate))},e}(),ci=function(){function e(e){this.parent=e,this.addEventListener(),this.renderFileUpload()}return e.prototype.addEventListener=function(){this.parent.on("openSuccess",this.openSuccess,this),this.parent.on("openFailure",this.openFailed,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("openSuccess",this.openSuccess),this.parent.off("openFailure",this.openFailed))},e.prototype.renderFileUpload=function(){var e=this.parent.element.id+"_fileUpload";this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".xls, .xlsx, .csv, .xlsm",name:"fileUpload"}}));var t=document.getElementById(e);t.onchange=this.fileSelect.bind(this),t.onerror=this.openFailed.bind(this),t.style.display="none"},e.prototype.fileSelect=function(e){var t=e.target.files[0];if(!(t&&t.length<1)){var r={file:t};this.parent.open(r),document.getElementById(this.parent.element.id+"_fileUpload").value=""}},e.prototype.openSuccess=function(e){var t=this,r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword"];if(r.indexOf(e.data)>-1)if(r[2]===e.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify("importProtectWorkbook",e.eventArgs);else{if(r[3]!==e.data)return(a=this.parent.serviceLocator.getService(Ai)).hide(),this.parent.serviceLocator.getService(Ai).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant(e.data),width:"300",beforeOpen:function(e){var r={dialogName:"OpenDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),void this.parent.hideSpinner();var n=this.parent.serviceLocator.getService(ki),i=this.parent.createElement("span",{className:"e-importprotectpwd-alert-span",innerHTML:n.getConstant("InCorrectPassword")});this.parent.element.querySelector(".e-importprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i)}else{var a=this.parent.serviceLocator.getService(Ai);a.hide(),this.parent.showSpinner()}this.parent.element&&(this.parent.trigger("openComplete",{response:e}),this.parent.notify(nr,{response:e,action:"import"}),this.parent.renderModule.refreshSheet(!0),this.parent.notify("refreshSheetTabs",this),this.parent.hideSpinner())},e.prototype.openFailed=function(e){this.parent.trigger("openFailure",e),this.parent.hideSpinner()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"open"},e}(),ui=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("beginSave",this.initiateSave,this),this.parent.on("saveCompleted",this.saveCompleted,this),this.parent.on("saveError",this.showErrorDialog,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("beginSave",this.initiateSave),this.parent.off("saveCompleted",this.saveCompleted),this.parent.off("saveError",this.showErrorDialog))},e.prototype.getModuleName=function(){return"save"},e.prototype.initiateSave=function(){this.parent.showSpinner()},e.prototype.saveCompleted=function(){this.parent.hideSpinner()},e.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(Ai).show({target:this.parent.element,isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return Ct(t.parent.element)}})},e}(),fi=function(){function e(e){this.parent=e,this.init()}return e.prototype.init=function(){this.initContextMenu(),this.addEventListener()},e.prototype.initContextMenu=function(){var e=document.createElement("ul");e.id=this.parent.element.id+"_contextmenu",this.parent.element.appendChild(e),this.contextMenuInstance=new n.ContextMenu({cssClass:"e-spreadsheet-contextmenu",target:"#"+this.parent.element.id,filter:"e-numericcontainer e-active-cell e-selection e-row e-header-row e-select-all-cell e-sheet-tabs-items",select:this.selectHandler.bind(this),beforeOpen:this.beforeOpenHandler.bind(this),beforeClose:this.beforeCloseHandler.bind(this)},e)},e.prototype.beforeCloseHandler=function(e){this.parent.trigger("contextMenuBeforeClose",e)},e.prototype.selectHandler=function(e){var r=t.extend({cancel:!1},e);this.parent.trigger("contextMenuItemSelect",r);var n,i,a,o=this.parent.element.id+"_cmenu";if(!r.cancel){var s=void 0;switch(e.item.id){case o+"_cut":this.parent.notify(Zt,{isAction:!0,promise:Promise});break;case o+"_copy":this.parent.notify("copy",{isAction:!0,promise:Promise});break;case o+"_paste":this.parent.notify(Jt,{isAction:!0,isInternal:!0});break;case o+"_pastevalues":this.parent.notify(Jt,{type:"Values",isAction:!0,isInternal:!0});break;case o+"_pasteformats":this.parent.notify(Jt,{type:"Formats",isAction:!0,isInternal:!0});break;case o+"_rename":this.parent.notify("renameSheetTab",{});break;case o+"_delete_sheet":this.parent.notify($t,{});break;case o+"_insert_sheet":this.parent.notify(Tt,{model:this.parent,start:this.parent.activeSheetIndex,end:this.parent.activeSheetIndex,modelType:"Sheet",isAction:!0});break;case o+"_hide_sheet":this.parent.notify("hideSheet",null);break;case o+"_ascending":this.parent.notify("applySort",null);break;case o+"_descending":this.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:"Descending"}}});break;case o+"_customsort":this.parent.notify("initiateCustomSort",null);break;case o+"_filtercellvalue":this.parent.notify("filterByCellValue",null);break;case o+"_clearfilter":n=v(u(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify("clearFilter",{field:n});break;case o+"_reapplyfilter":this.parent.notify("reapplyFilter",null);break;case o+"_hide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[0],endIndex:s[2],hide:!0,isCol:!1,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_unhide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[0],endIndex:s[2],hide:!1,isCol:!1,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_hide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[1],endIndex:s[3],hide:!0,isCol:!0,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_unhide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[1],endIndex:s[3],hide:!1,isCol:!0,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_insert_row_above":case o+"_delete_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[0],end:s[2],modelType:"Row",isAction:!0,insertType:"above"}),Ct(this.parent.element);break;case o+"_insert_row_below":s=x(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Tt,{model:this.parent.getActiveSheet(),start:s[2]+1,end:s[2]+1+(s[2]-s[0]),modelType:"Row",isAction:!0,insertType:"below"}),Ct(this.parent.element);break;case o+"_insert_column_before":case o+"_delete_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[1],end:s[3],modelType:"Column",isAction:!0}),Ct(this.parent.element);break;case o+"_insert_column_after":s=x(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Tt,{model:this.parent.getActiveSheet(),start:s[3]+1,end:s[3]+1+(s[3]-s[1]),modelType:"Column",isAction:!0}),Ct(this.parent.element);break;case o+"_hyperlink":this.parent.notify("initiateHyperlink",null);break;case o+"_editHyperlink":this.parent.notify("editHyperlink",null);break;case o+"_openHyperlink":this.parent.notify("openHyperlink",null);break;case o+"_removeHyperlink":this.parent.removeHyperlink(this.parent.getActiveSheet().selectedRange);break;case o+"_protect":i=this.parent.getActiveSheet(),this.parent.setSheetPropertyOnMute(i,"isProtected",!i.isProtected),a=!i.isProtected,this.parent.notify("applyProtect",{isActive:a})}}},e.prototype.getInsertModel=function(e,t){for(var r=[],n=e;n<=t;n++)n===e?r.push({index:n}):r.push({});return r},e.prototype.beforeOpenHandler=function(e){var r,n=this.getTarget(e.event.target);if(e.element.classList.contains("e-contextmenu")?(r=this.getDataSource(n),this.contextMenuInstance.items=r,this.contextMenuInstance.dataBind()):r=e.items,("ColumnHeader"===n||"RowHeader"===n)&&e.element&&e.element.childElementCount>0){var i="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),a="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row");this.parent.allowInsert&&i.classList.contains("e-disabled")?i.classList.remove("e-disabled"):this.parent.allowInsert||i.classList.contains("e-disabled")||i.classList.add("e-disabled"),this.parent.allowDelete&&a.classList.contains("e-disabled")?a.classList.remove("e-disabled"):this.parent.allowDelete||a.classList.contains("e-disabled")||a.classList.add("e-disabled")}this.parent.trigger("contextMenuBeforeOpen",e),this.parent.notify(Kt,t.extend(e,{target:n,items:r}))},e.prototype.getTarget=function(e){return t.closest(e,".e-sheet-content")?"Content":t.closest(e,".e-column-header")?e.classList.contains("e-header-cell")?"ColumnHeader":"Content":t.closest(e,".e-row-header")?e.classList.contains("e-header-cell")?"RowHeader":"Content":t.closest(e,".e-sheet-tabs-items")?"Footer":t.closest(e,".e-selectall-container")?e.classList.contains("e-header-cell")?t.closest(e,".e-header-row")?"ColumnHeader":"RowHeader":t.closest(e,".e-select-all-cell")?"SelectAll":"Content":""},e.prototype.getDataSource=function(e){var t=this.parent.serviceLocator.getService(ki),r=[],n=this.parent.element.id+"_cmenu";if("Content"===e)this.setClipboardData(r,t,n),r.push({separator:!0}),this.setFilterItems(r,n),this.setSortItems(r,n),r.push({separator:!0}),this.setHyperLink(r,n);else if("RowHeader"===e){this.setClipboardData(r,t,n);a=c((i=this.parent.getActiveSheet()).selectedRange);this.setInsertDeleteItems(r,t,"Row",n,[a[0],a[2]],["Above","Below"]),i.frozenRows||i.frozenColumns||this.setHideShowItems(r,t,"Row",n,[a[0],a[2]])}else if("ColumnHeader"===e){this.setClipboardData(r,t,n);var i=this.parent.getActiveSheet(),a=c(i.selectedRange);this.setInsertDeleteItems(r,t,"Column",n,[a[1],a[3]],["Before","After"]),i.frozenRows||i.frozenColumns||this.setHideShowItems(r,t,"Column",n,[a[1],a[3]])}else"SelectAll"===e?(this.setClipboardData(r,t,n),this.setFilterItems(r,n),this.setSortItems(r,n)):"Footer"===e&&(r.push({text:t.getConstant("Insert"),id:n+"_insert_sheet"}),r.push({text:t.getConstant("Delete"),iconCss:"e-icons e-delete",id:n+"_delete_sheet"}),r.push({text:t.getConstant("Rename"),id:n+"_rename"}),r.push({text:t.getConstant("Hide"),id:n+"_hide_sheet"}),this.setProtectSheetItems(r,n));return r},e.prototype.setProtectSheetItems=function(e,t){var r=this.parent.serviceLocator.getService(ki);this.parent.getActiveSheet().isProtected?e.push({text:r.getConstant("UnprotectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"}):e.push({text:r.getConstant("ProtectSheet"),id:t+"_protect",iconCss:"e-icons e-protect-icon"})},e.prototype.setFilterItems=function(e,t){if(this.parent.allowFiltering){var r=this.parent.serviceLocator.getService(ki),n={clearFilterText:null,isFiltered:!1};this.parent.notify("getFilteredColumn",n),e.push({text:r.getConstant("Filter"),id:t+"_filter",iconCss:"",items:[{text:n.clearFilterText,iconCss:"e-icons e-filter-clear",id:t+"_clearfilter"},{text:r.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:t+"_reapplyfilter"},{separator:!0},{text:r.getConstant("FilterCellValue"),iconCss:"",id:t+"_filtercellvalue"}]})}},e.prototype.setSortItems=function(e,t){var r=this.parent.serviceLocator.getService(ki);this.parent.allowSorting&&e.push({text:r.getConstant("Sort"),id:t+"_sort",iconCss:"e-icons e-sort-icon",items:[{text:r.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc",id:t+"_ascending"},{text:r.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc",id:t+"_descending"},{text:r.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom",id:t+"_customsort"}]})},e.prototype.setHyperLink=function(e,t){var r=this.parent.getActiveSheet();if(this.parent.allowHyperlink){var n=this.parent.serviceLocator.getService(ki);!document.activeElement.getElementsByClassName("e-hyperlink")[0]&&!document.activeElement.classList.contains("e-hyperlink")||r.isProtected&&!r.protectSettings.insertLink?e.push({text:n.getConstant("Hyperlink"),iconCss:"e-icons e-hyperlink-icon",id:t+"_hyperlink"}):e.push({text:n.getConstant("EditHyperlink"),iconCss:"e-icons e-edithyperlink-icon",id:t+"_editHyperlink"},{text:n.getConstant("OpenHyperlink"),iconCss:"e-icons e-openhyperlink-icon",id:t+"_openHyperlink"},{text:n.getConstant("RemoveHyperlink"),iconCss:"e-icons e-removehyperlink-icon",id:t+"_removeHyperlink"})}},e.prototype.setClipboardData=function(e,t,r){this.parent.enableClipboard&&(e.push({text:t.getConstant("Cut"),iconCss:"e-icons e-cut-icon",id:r+"_cut"}),e.push({text:t.getConstant("Copy"),iconCss:"e-icons e-copy-icon",id:r+"_copy"}),e.push({text:t.getConstant("Paste"),iconCss:"e-icons e-paste-icon",id:r+"_paste"}),e.push({text:t.getConstant("PasteSpecial"),id:r+"_pastespecial",items:[{text:t.getConstant("Values"),id:r+"_pastevalues"},{text:t.getConstant("Formats"),id:r+"_pasteformats"}]}))},e.prototype.setInsertDeleteItems=function(e,t,r,n,i,a){e.push({separator:!0}),["Insert","Delete"].forEach(function(o){i[0]===i[1]?e.push({text:t.getConstant(""+o+r),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}):e.push({text:t.getConstant(""+o+r+"s"),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}),"Insert"===o&&(e[e.length-1].items=[],a.forEach(function(r){e[e.length-1].items.push({text:t.getConstant(r),id:e[e.length-1].id+"_"+r.toLowerCase()})}))})},e.prototype.setHideShowItems=function(e,t,r,n,i){if(i[0]===i[1])e.push({text:t.getConstant("Hide"+r),id:n+"_hide_"+r.toLowerCase()});else{var a=i[0];i[0]=i[0]>i[1]?i[1]:i[0],i[1]=i[1]>a?i[1]:a,e.push({text:t.getConstant("Hide"+r+"s"),id:n+"_hide_"+r.toLowerCase()})}this.parent.hiddenCount(i[0],i[1],r.toLowerCase()+"s")&&e.push({text:t.getConstant("UnHide"+r+"s"),id:n+"_unhide_"+r.toLowerCase()})},e.prototype.addEventListener=function(){this.parent.on("addContextMenuItems",this.addItemsHandler,this),this.parent.on("removeContextMenuItems",this.removeItemsHandler,this),this.parent.on("enableContextMenuItems",this.enableItemsHandler,this)},e.prototype.addItemsHandler=function(e){e.insertAfter?this.contextMenuInstance.insertAfter(e.items,e.text,e.isUniqueId):this.contextMenuInstance.insertBefore(e.items,e.text,e.isUniqueId)},e.prototype.removeItemsHandler=function(e){this.contextMenuInstance.removeItems(e.items,e.isUniqueId)},e.prototype.enableItemsHandler=function(e){this.contextMenuInstance.enableItems(e.items,e.enable,e.isUniqueId)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("addContextMenuItems",this.addItemsHandler),this.parent.off("removeContextMenuItems",this.removeItemsHandler),this.parent.off("enableContextMenuItems",this.enableItemsHandler))},e.prototype.getModuleName=function(){return"contextMenu"},e.prototype.destroy=function(){this.removeEventListener(),this.contextMenuInstance.destroy();var e=document.getElementById(this.parent.element.id+"_contextmenu");e&&t.detach(e),this.parent=null},e}(),gi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshCellElement=function(e){var r=this.parent.getCell(e.rowIndex,e.colIndex);t.isNullOrUndefined(r)||this.parent.refreshNode(r,e)},e.prototype.addEventListener=function(){this.parent.on("refreshCellElem",this.refreshCellElement,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("refreshCellElem",this.refreshCellElement)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"numberFormat"},e}(),mi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("applySort",this.applySortHandler,this),this.parent.on("sortComplete",this.sortCompleteHandler,this),this.parent.on("initiateCustomSort",this.initiateCustomSortHandler,this),this.parent.on("sortImport",this.sortImport,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applySort",this.applySortHandler),this.parent.off("sortComplete",this.sortCompleteHandler),this.parent.off("initiateCustomSort",this.initiateCustomSortHandler),this.parent.off("sortImport",this.sortImport))},e.prototype.getModuleName=function(){return"sort"},e.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=x(y(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},e.prototype.sortImport=function(e){for(var t,r=this.parent.sortCollection,n=this.parent.getActiveSheet().usedRange.rowIndex-1,i=e?e.sheetIdx:this.parent.activeSheetIndex,a=0;a<r.length;a++)if(r[a].sheetIndex===i)for(var o=0;o<n;o++)if((t=this.parent.getCell(o,r[a].columnIndex))&&t.querySelector(".e-filter-icon"))return void("Ascending"===r[a].order||"OnTop"===r[a].order?t.querySelector(".e-filter-icon").classList.contains("e-sortasc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortasc-filter"):t.querySelector(".e-filter-icon").classList.contains("e-sortdesc-filter")||t.querySelector(".e-filter-icon").classList.add("e-sortdesc-filter"))},e.prototype.sortRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(Ai).show({height:180,width:400,isModal:!0,showCloseIcon:!0,content:e.error,beforeOpen:function(e){var r={dialogName:"SortRangeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),this.parent.hideSpinner()},e.prototype.initiateCustomSortHandler=function(){var e=this,r=this.parent.serviceLocator.getService(ki);if(!this.isValidSortRange())return void this.sortRangeAlertHandler({error:r.getConstant("SortOutOfRangeError")});var n=this.parent.serviceLocator.getService(Ai);n.show({height:400,width:560,isModal:!0,showCloseIcon:!0,cssClass:"e-customsort-dlg",header:r.getConstant("CustomSort"),beforeOpen:function(t){var r={dialogName:"CustomSortDialog",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",r),r.cancel&&(t.cancel=!0),n.dialogInstance.content=e.customSortContent(),n.dialogInstance.dataBind(),Ct(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){var r=n.dialogInstance.content,i=r.getElementsByClassName("e-list-sort e-listview e-lib")[0],a=t.getComponent(i,"listview").dataSource;e.clearError();var o=r.getElementsByClassName("e-sort-error")[0];if(o.style.display="block",!e.validateError(a,r,o)){n.hide();var s=r.getElementsByClassName("e-sort-checkheader")[0],l=t.getComponent(s,"checkbox"),h=t.getComponent(r.getElementsByClassName("e-sort-checkcase")[0],"checkbox"),d=l.checked;e.applySortHandler({sortOptions:{sortDescriptors:a,containsHeader:d,caseSensitive:h.checked}})}}}]})},e.prototype.validateError=function(e,r,n){var i=this.parent.serviceLocator.getService(ki);if(e.some(function(e){return""===e.field.toString()}))return Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),function(e){var r=!t.getComponent(e,"dropdownlist").value;return r&&e.parentElement.classList.add("e-error"),r}),n.innerText=i.getConstant("SortEmptyFieldError"),!0;var a=new Set,o="",s="";if(e.some(function(e){return o=e.field.toString(),a.size===a.add(e.field).size})){var l=0;return Array.prototype.some.call(r.getElementsByClassName("e-sort-field"),function(e){var r=t.getComponent(e,"dropdownlist");return r.value===o&&(e.parentElement.classList.add("e-error"),s=r.text,l++),2===l}),n.innerHTML="<strong>"+s+"</strong>"+i.getConstant("SortDuplicateFieldError"),!0}return!1},e.prototype.customSortContent=function(){var e=this.parent.createElement("div",{className:"e-sort-dialog"}),r=this.getFields(),n=t.getUniqueID("customSort"),i=this.getCustomListview(n);this.setHeaderTab(e,i,r);var a=this.parent.createElement("div",{className:"e-sort-listsection",styles:""});e.appendChild(a);var o=this.parent.createElement("div",{className:"e-list-sort",styles:""});a.appendChild(o),i.createElement=this.parent.createElement,i.appendTo(o),this.renderListItem(n,i,!0,r);var s=this.parent.createElement("div",{className:"e-sort-error"});return e.appendChild(s),e},e.prototype.getFields=function(){var e=this.parent.getActiveSheet(),t=x(y(e.selectedRange));if(t[0]===t[2]&&t[2]-t[0]==0){t[0]=0,t[1]=0,t[3]=e.usedRange.colIndex;var r={filterRange:[],hasFilter:!1};this.parent.notify("getFilterRange",r),r.hasFilter&&r.filterRange&&(t[0]=r.filterRange[0])}var n,i=[];for(t[1];t[1]<=t[3];t[1]++){var a=$(t[0],t[1],e);if(a&&a.value){var o={formattedText:a.value,value:a.value,format:a.format,onLoad:!0};a.format&&this.parent.notify("getFormattedCell",o),n=o.formattedText}else n="Column "+v(t[1]+1);i.push({text:n,value:"Column "+v(t[1]+1)})}return i},e.prototype.setHeaderTab=function(e,r,n){var i=this,o=this.parent.serviceLocator.getService(ki),s=this.parent.createElement("div",{className:"e-sort-header",styles:"",innerHTML:""});e.appendChild(s);var l=this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",innerHTML:o.getConstant("AddColumn")}),h=this.parent.element.querySelector(".e-customsort-dlg .e-footer-content");h.insertBefore(l,h.firstElementChild),l.addEventListener("click",function(){if(r){var e=t.getUniqueID("customSort");r.addItem([{id:e,text:o.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(e,r,d.checked,n,!0)}});var d=new a.CheckBox({label:o.getConstant("ContainsHeader"),checked:!0,change:function(r){var i=r.checked?{text:"text",value:"value"}:{text:"value"};Array.prototype.forEach.call(e.getElementsByClassName("e-sort-field e-dropdownlist e-lib"),function(e){var r=t.getComponent(e,"dropdownlist");r.dataSource=null,r.dataSource=n,r.fields=i,r.dataBind()})},cssClass:"e-sort-headercheckbox"}),p=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}});s.appendChild(p),d.createElement=this.parent.createElement,d.appendTo(p);var c=new a.CheckBox({label:o.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"}),u=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});s.appendChild(u),c.createElement=this.parent.createElement,c.appendTo(u)},e.prototype.getCustomListview=function(e){var r=[{id:e,text:this.parent.serviceLocator.getService(ki).getConstant("SortBy"),field:"",order:"ascending"}];return t.enableRipple(!1),new s.ListView({dataSource:r,fields:{id:"id"},height:"100%",template:'<div class="e-sort-listwrapper"><span class="text">${text}</span><div class="e-sort-row"><div class="e-sort-field"></div><div class="e-sort-order"><span class="e-sort-ordertxt" style="display:none;">${order}</span></div><span class="e-icons e-sort-delete"></span></div>',cssClass:"e-sort-template"})},e.prototype.deleteHandler=function(e,t){e.getElementsByClassName("e-sort-delete")[0].addEventListener("click",function(){e&&t.removeItem(e)})},e.prototype.renderListItem=function(e,t,r,n,i){var s=this,l=this.parent.serviceLocator.getService(ki),h=t.element.querySelector("li[data-uid="+e+"]"),d=r?{text:"text",value:"value"}:{text:"value"},p=h.getElementsByClassName("e-sort-field")[0],c=new o.DropDownList({dataSource:n,width:"auto",cssClass:"e-sort-field-ddl",fields:d,placeholder:l.getConstant("SelectAColumn"),change:function(r){r.value&&(Array.prototype.some.call(t.dataSource,function(t){return t.id===e&&(t.field=r.value.toString().replace("Column ","")),t.id===e}),s.clearError())}});c.createElement=this.parent.createElement,c.appendTo(p),i||(c.index=0);var u=h.getElementsByClassName("e-sort-order")[0],f="ascending"===u.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),g=new a.RadioButton({label:l.getConstant("SortAscending"),name:"sortAZ_"+e,value:"ascending",checked:f,cssClass:"e-sort-radiobutton",change:function(r){s.setRadioBtnValue(t,e,r.value)}}),m=this.parent.createElement("input",{id:"orderAsc_"+e,className:"e-sort-radioasc",styles:"",attrs:{type:"radio"}});u.appendChild(m),g.createElement=this.parent.createElement,g.appendTo(m);var v=new a.RadioButton({label:l.getConstant("SortDescending"),name:"sortAZ_"+e,value:"descending",checked:!f,cssClass:"e-sort-radiobutton",change:function(r){s.setRadioBtnValue(t,e,r.value)}}),y=this.parent.createElement("input",{id:"orderDesc_"+e,className:"e-sort-radiodesc",styles:"",attrs:{type:"radio"}});u.appendChild(y),v.createElement=this.parent.createElement,v.appendTo(y),this.deleteHandler(h,t)},e.prototype.setRadioBtnValue=function(e,t,r){r&&Array.prototype.some.call(e.dataSource,function(e){return e.id===t&&(e.order=r),e.id===t})},e.prototype.clearError=function(){var e=document.getElementsByClassName("e-sort-dialog")[0],t=e.getElementsByClassName("e-sort-error")[0];"none"!==t.style.display&&""!==t.innerHTML&&(t.style.display="none",Array.prototype.forEach.call(e.getElementsByClassName("e-error"),function(e){e.classList.remove("e-error")}))},e.prototype.applySortHandler=function(e){var t=this,r=this.parent.getActiveSheet(),n={range:e&&e.range||r.selectedRange,sortOptions:e&&e.sortOptions||{sortDescriptors:{}},cancel:!1};if(this.parent.trigger("beforeSort",n),!n.cancel){this.parent.notify(ir,{eventArgs:n,action:"beforeSort"}),this.parent.showSpinner();var i=x(y(n.range)),a={filterRange:[],hasFilter:!1};i[0]===i[2]&&i[2]-i[0]==0&&(this.parent.notify("getFilterRange",a),a.hasFilter&&G(a.filterRange,i[0],i[1])&&(i[0]=a.filterRange[0],i[1]=0,i[2]=r.usedRange.rowIndex,i[3]=r.usedRange.colIndex,n.sortOptions.containsHeader=!0)),this.parent.sort(n.sortOptions,m(i)).then(function(e){return t.parent.trigger("sortComplete",e),t.parent.notify(nr,{eventArgs:e,action:"sorting"}),Promise.resolve(e)}).catch(function(e){return t.sortRangeAlertHandler({error:e}),Promise.reject(e)})}},e.prototype.sortCompleteHandler=function(e){var t=y(e.range);this.parent.serviceLocator.getService("cell").refreshRange(t),this.parent.hideSpinner()},e}(),vi=function(){function e(e){this.parent=e,this.filterCollection=new Map,this.filterClassList=new Map,this.filterRange=new Map,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener(),this.filterRange=null,this.filterCollection=null,this.filterClassList=null,this.parent=null},e.prototype.addEventListener=function(){this.parent.on("filterRangeAlert",this.filterRangeAlertHandler,this),this.parent.on(rr,this.initiateFilterUIHandler,this),this.parent.on("mouseDown",this.filterMouseDownHandler,this),this.parent.on("renderFilterCell",this.renderFilterCellHandler,this),this.parent.on("clearAllFilter",this.clearAllFilterHandler,this),this.parent.on(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(d.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler,this),this.parent.on("reapplyFilter",this.reapplyFilterHandler,this),this.parent.on("filterByCellValue",this.filterByCellValueHandler,this),this.parent.on("clearFilter",this.clearFilterHandler,this),this.parent.on("getFilteredColumn",this.getFilteredColumnHandler,this),this.parent.on(Kt,this.cMenuBeforeOpenHandler,this),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on("getFilterRange",this.getFilterRangeHandler,this),this.parent.on("filterCellKeyDown",this.filterCellKeyDownHandler,this),this.parent.on("getFilteredCollection",this.getFilteredCollection,this),this.parent.on("contentLoaded",this.updateFilter,this),this.parent.on("updateFilter",this.updateFilter,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("filterRangeAlert",this.filterRangeAlertHandler),this.parent.off(rr,this.initiateFilterUIHandler),this.parent.off("mouseDown",this.filterMouseDownHandler),this.parent.off("renderFilterCell",this.renderFilterCellHandler),this.parent.off("clearAllFilter",this.clearAllFilterHandler),this.parent.off(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(d.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler),this.parent.off("reapplyFilter",this.reapplyFilterHandler),this.parent.off("filterByCellValue",this.filterByCellValueHandler),this.parent.off("clearFilter",this.clearFilterHandler),this.parent.off("getFilteredColumn",this.getFilteredColumnHandler),this.parent.off(Kt,this.cMenuBeforeOpenHandler),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler),this.parent.off("getFilterRange",this.getFilterRangeHandler),this.parent.off("filterCellKeyDown",this.filterCellKeyDownHandler),this.parent.off("getFilteredCollection",this.getFilteredCollection),this.parent.off("contentLoaded",this.updateFilter),this.parent.off("updateFilter",this.updateFilter))},e.prototype.getModuleName=function(){return"filter"},e.prototype.isInValidFilterRange=function(e,t){var r=x(t?y(t):y(e.selectedRange));return r[0]>e.usedRange.rowIndex||r[1]>e.usedRange.colIndex},e.prototype.filterRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(Ai).show({content:e.error,isModal:!0,height:180,width:400,showCloseIcon:!0,beforeOpen:function(e){var r={dialogName:"FilterRangeDialog",element:e.element,target:e.target,cancel:e.cancel};t.parent.trigger("dialogBeforeOpen",r),r.cancel&&(e.cancel=!0)}}),this.parent.hideSpinner()},e.prototype.beforeFilterMenuOpenHandler=function(e){var t=this.parent.serviceLocator.getService(ki);e.element.classList.add("e-spreadsheet-contextmenu");var r=e.element.querySelector("ul");this.addMenuItem(r,t.getConstant("SortDescending"),"e-filter-sortdesc","e-sort-desc"),this.addMenuItem(r,t.getConstant("SortAscending"),"e-filter-sortasc","e-sort-asc"),e.element.appendChild(r)},e.prototype.addMenuItem=function(e,t,r,n){var i=this.parent.createElement("li",{className:r+" e-menu-item"});i.innerHTML=t,i.insertBefore(this.parent.createElement("span",{className:"e-menu-icon e-icons "+n}),i.firstChild),e.insertBefore(i,e.firstChild)},e.prototype.initiateFilterUIHandler=function(e){var t=this,n=e?e.predicates:null,i=e.sIdx;if(i||0===i||(i=this.parent.activeSheetIndex),!(this.filterRange.size>0&&this.filterRange.has(i))||(this.removeFilter(i),n)){var a=ce(this.parent,i);if(this.isInValidFilterRange(a,e.range)){var o=this.parent.serviceLocator.getService(ki);return void this.filterRangeAlertHandler({error:o.getConstant("FilterOutOfRangeError")})}var s=a.selectedRange,l=c(s);l[0]===l[2]&&l[1]===l[3]&&(l[0]=0,l[1]=0,l[2]=a.usedRange.rowIndex,l[3]=a.usedRange.colIndex,s=m(l));var h={range:e.range?e.range:s,filterOptions:{predicates:e.predicates},cancel:!1};if(e.isCut||this.parent.notify(ir,{action:"filter",eventArgs:h}),this.processRange(a,i,e?e.range:null),n){var d=this.filterRange.get(i).slice();d[0]=d[0]+1,d[2]=a.usedRange.rowIndex,ee(this.parent,a.name+"!"+m(d),!0,!0).then(function(a){t.filterSuccessHandler(new r.DataManager(a),{action:"filtering",filterCollection:n,field:n[0]?n[0].field:null,sIdx:e.sIdx}),n.forEach(function(e){t.filterClassList.get(i)[e.field]&&t.filterClassList.get(i)[e.field].indexOf(" e-filtered")<0&&(t.filterClassList.get(i)[e.field]+=" e-filtered")}),t.refreshFilterRange(null,!1,e.sIdx)})}e.isCut||this.parent.notify(nr,{action:"filter",eventArgs:h})}},e.prototype.processRange=function(e,t,r){var n=x(y(r||e.selectedRange));n[0]===n[2]&&n[1]===n[3]&&(n[0]=0,n[1]=0,n[2]=e.usedRange.rowIndex,n[3]=e.usedRange.colIndex),this.filterRange.set(t,n),this.filterCollection.set(t,[]),this.filterClassList.set(t,{}),this.refreshFilterRange(n,!1,t)},e.prototype.removeFilter=function(e){this.filterCollection.get(e).length&&this.parent.clearFilter();var t=this.filterRange.get(e).slice();this.filterRange.delete(e),this.filterCollection.delete(e),this.filterClassList.delete(e),this.refreshFilterRange(t,!0,e)},e.prototype.filterByCellValueHandler=function(){var e=this,t=this.parent.activeSheetIndex,n=this.parent.getActiveSheet();if(this.isInValidFilterRange(n)){var i=this.parent.serviceLocator.getService(ki);return void this.filterRangeAlertHandler({error:i.getConstant("FilterOutOfRangeError")})}var a=u(n.activeCell);this.isFilterRange(t,a[0],a[1])||this.processRange(n,t);var o=this.filterRange.get(t).slice();o[0]=o[0]+1,o[2]=n.usedRange.rowIndex;var s=v(a[1]+1),l=this.getColumnType(n,a[1]+1,o),h=[{field:s,operator:"date"===l||"datetime"===l||"boolean"===l?"equal":"contains",value:$(a[0],a[1],n).value,matchCase:!1,type:l}];ee(this.parent,n.name+"!"+m(o),!0,!0).then(function(t){e.filterSuccessHandler(new r.DataManager(t),{action:"filtering",filterCollection:h,field:s})})},e.prototype.renderFilterCellHandler=function(e){var r=e.sIdx;if(r||0===r||(r=this.parent.activeSheetIndex),this.filterRange.has(r)&&this.isFilterCell(r,e.rowIndex,e.colIndex)){if(!e.td)return;var n=v(e.colIndex+1);if(this.filterClassList.has(r)&&!this.filterClassList.get(r)[n]&&(this.filterClassList.get(r)[n]=""),e.td.querySelector(".e-filter-btn")){var i=e.td.querySelector(".e-filter-iconbtn");(s=t.getComponent(i,"btn")).iconCss="e-icons e-filter-icon"+this.filterClassList.get(r)[n]}else{var o=this.parent.createElement("div",{className:"e-filter-btn"}),s=new a.Button({iconCss:"e-icons e-filter-icon"+this.filterClassList.get(r)[n],cssClass:"e-filter-iconbtn"});e.td.insertBefore(o,e.td.firstChild),s.createElement=this.parent.createElement,s.appendTo(o)}}this.parent.sortCollection&&this.parent.notify("sortImport",{sheetIdx:r})},e.prototype.refreshFilterRange=function(e,t,r){var n=r;n||0===n||(n=this.parent.activeSheetIndex);for(var i=e||this.filterRange.get(n).slice(),a=i[1];a<=i[3];a++){var o=this.parent.getCell(i[0],a);if(t){if(o&&o.hasChildNodes()){var s=o.querySelector(".e-filter-btn");s&&o.removeChild(s)}}else this.renderFilterCellHandler({td:o,rowIndex:i[0],colIndex:a,sIdx:n})}this.parent.sortCollection&&this.parent.notify("sortImport",null)},e.prototype.isFilterCell=function(e,t,r){var n=this.filterRange.get(e);return n&&n[0]===t&&n[1]<=r&&n[3]>=r},e.prototype.isFilterRange=function(e,t,r){var n=this.filterRange.get(e);return n&&n[0]<=t&&n[2]>=t&&n[1]<=r&&n[3]>=r},e.prototype.getFilteredColumnHandler=function(e){var t=this.parent.activeSheetIndex,r=this.parent.serviceLocator.getService(ki);if(e.clearFilterText=r.getConstant("ClearFilter"),this.filterRange.has(t)){var n=this.filterCollection.get(t);if(e.isClearAll)return void(e.isFiltered=n&&n.length>0);var i=this.filterRange.get(t).slice(),a=this.parent.getActiveSheet(),o=u(a.activeCell);if(this.isFilterRange(t,o[0],o[1])){e.field=v(o[1]+1);var s=$(i[0],o[1],a),l=this.parent.getDisplayText(s);e.clearFilterText=r.getConstant("ClearFilterFrom")+'"'+(l?l.toString():"Column "+e.field)+'"',n.some(function(t){return e.isFiltered=t.field===e.field,e.isFiltered})}}},e.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.element.id+"_cmenu";if(e.parentItem&&e.parentItem.id===t+"_filter"&&""===e.target){var r={isFiltered:!1};this.getFilteredColumnHandler(r),this.parent.enableContextMenuItems([t+"_clearfilter",t+"_reapplyfilter"],!!r.isFiltered,!0)}},e.prototype.closeDialog=function(){var e=document.querySelector(".e-filter-popup");if(e&&e.id.includes(this.parent.element.id)){var r=t.getComponent(e,"dialog");t.EventHandler.remove(e,qe(),this.filterMouseDownHandler),r&&r.hide()}},e.prototype.isPopupOpened=function(){var e=document.querySelector(".e-filter-popup");return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},e.prototype.filterCellKeyDownHandler=function(e){var t=this.parent.activeSheetIndex,r=this.parent.getActiveSheet(),n=u(r.activeCell);if(this.isFilterCell(t,n[0],n[1])){e.isFilterCell=!0;var i=Pe(r,n),a=this.parent.getCell(n[0],n[1]);this.isPopupOpened()&&this.closeDialog(),this.openDialog(a,i.left,i.top)}else e.isFilterCell=!1},e.prototype.filterMouseDownHandler=function(e){var t=e.target;if(t.classList.contains("e-filter-icon")){if(this.isPopupOpened())return void this.closeDialog();this.openDialog(t,e.x,e.y)}else this.isPopupOpened()&&(t.classList.contains("e-searchinput")||t.classList.contains("e-searchclear")||!t.offsetParent||t.offsetParent.classList.contains("e-filter-popup")?this.selectSortItemHandler(t):this.closeDialog())},e.prototype.openDialog=function(e,n,i){var a=this,o=d.parentsUntil(e,"e-cell"),s=parseInt(o.getAttribute("aria-colindex"),10),l=v(s);this.parent.showSpinner();var h=this.parent.activeSheetIndex,p=this.filterRange.get(h).slice(),c=this.parent.getActiveSheet(),u=$(p[0],s-1,c),f=this.parent.getDisplayText(u);p[0]=p[0]+1,p[2]=c.usedRange.rowIndex,ee(this.parent,c.name+"!"+m(p),!0,!0,null,!0).then(function(o){var u;o.some(function(e,t){return e&&(u=new r.DataManager(o.slice(t))),!!e});var g={type:a.getColumnType(c,s,p),field:l,displayName:f||"Column "+l,dataSource:u,height:a.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:a.filterCollection.get(h),column:{field:l,filter:{}},handler:a.filterSuccessHandler.bind(a,new r.DataManager(o)),target:e,position:{X:n,Y:i},localeObj:a.parent.serviceLocator.getService(ki)};new d.ExcelFilterBase(a.parent,a.getLocalizedCustomOperators()).openDialog(g);var m=document.querySelector(".e-filter-popup");m&&m.id.includes(a.parent.element.id)&&t.EventHandler.add(m,qe(),a.filterMouseDownHandler,a),a.parent.hideSpinner()})},e.prototype.filterCboxValueHandler=function(e){if(e.column&&e.data){var t=e.column.field;if(e.value){var r=u(t+e.data.dataObj.__rowIndex),n=$(r[0],r[1],this.parent.getActiveSheet());n&&n.format&&(e.value=this.parent.getDisplayText(n))}}},e.prototype.selectSortItemHandler=function(e){var t=e.classList.contains("e-filter-sortasc")?"Ascending":e.classList.contains("e-filter-sortdesc")?"Descending":null;if(t){var r=this.parent.getActiveSheet(),n=this.parent.activeSheetIndex,i=this.filterRange.get(n).slice();i[0]=i[0]+1,i[2]=r.usedRange.rowIndex,this.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:t}},range:m(i)});for(var a=y(r.activeCell),o=v(a[1]+1),s=0,l=Object.keys(this.filterClassList.get(n));s<l.length;s++){var h=l[s],d=this.filterClassList.get(n)[h].replace(/\se-sortasc-filter|\se-sortdesc-filter/gi,"");h===o&&(d+="Ascending"===t?" e-sortasc-filter":" e-sortdesc-filter"),this.filterClassList.get(n)[h]=d}this.refreshFilterRange(),this.parent.sortCollection=this.parent.sortCollection?this.parent.sortCollection:[];for(var p=0;p<this.parent.sortCollection.length;p++)this.parent.sortCollection[p]&&this.parent.sortCollection[p].sheetIndex===n&&this.parent.sortCollection.splice(p,1);this.parent.sortCollection.push({sortRange:m(i),columnIndex:a[1],order:t,sheetIndex:n}),this.closeDialog()}},e.prototype.filterSuccessHandler=function(e,t){var n=t.sIdx;n||0===n||(n=this.parent.activeSheetIndex);for(var i=this.filterCollection.get(n),a=new r.DataManager(i),o=new r.Query,s=a.executeLocal(o.where("field","equal",t.field)),l=0;l<s.length;l++){for(var h=-1,d=0;d<i.length;d++)if(i[d].field===s[l].field){h=d;break}-1!==h&&i.splice(h,1)}if("filtering"===t.action){if((i=i.concat(t.filterCollection)).length)for(var p=0;p<i.length;p++)t.field=i[p].field,i.length&&this.filterClassList.get(n)[t.field].indexOf(" e-filtered")<0&&(this.filterClassList.get(n)[t.field]+=" e-filtered")}else this.filterClassList.get(n)[t.field]=this.filterClassList.get(n)[t.field].replace(" e-filtered","");this.filterCollection.set(n,i);var c={datasource:e,predicates:this.getPredicates(n)};this.filterRange.get(n)[2]=ce(this.parent,n).usedRange.rowIndex,this.applyFilter(c,m(this.filterRange.get(n)))},e.prototype.applyFilter=function(e,t){var r=this,n={range:t,filterOptions:e,cancel:!1};this.parent.trigger("beforeFilter",n),n.cancel||(this.parent.showSpinner(),this.parent.filter(e,t).then(function(e){return r.refreshFilterRange(),r.parent.notify("getFilteredCollection",null),r.parent.hideSpinner(),r.parent.trigger("filterComplete",e),Promise.resolve(e)}).catch(function(e){return r.filterRangeAlertHandler({error:e}),Promise.reject(e)}))},e.prototype.getPredicates=function(e){for(var t=[],r=d.CheckBoxFilterBase.getPredicate(this.filterCollection.get(e)),n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];t.push(r[a])}return t},e.prototype.getColumnType=function(e,t,r){for(var n=0,i=0,a=0,o=r[0];o<=e.usedRange.rowIndex;o++){var s=$(o,t-1,e);if(s)if(s.format)switch(H(s.format).toLowerCase()){case"number":case"currency":case"accounting":case"percentage":n++;break;case"shortdate":case"longdate":a++;break;case"time":n++;break;default:i++}else"string"==typeof s.value?i++:n++;else i++}return n>i&&n>a&&n>0?"number":i>n&&i>a&&i>0?"string":a>n&&a>i&&a>0?"date":"datetime"},e.prototype.beforeCustomFilterOpenHandler=function(){this.closeDialog()},e.prototype.clearAllFilterHandler=function(){if(this.filterRange.has(this.parent.activeSheetIndex)){this.filterCollection.set(this.parent.activeSheetIndex,[]);for(var e=0,t=Object.keys(this.filterClassList.get(this.parent.activeSheetIndex));e<t.length;e++){var r=t[e];this.filterClassList.get(this.parent.activeSheetIndex)[r]=""}this.refreshFilterRange()}},e.prototype.clearFilterHandler=function(e){this.filterSuccessHandler(null,{action:"clear-filter",filterCollection:[],field:e.field})},e.prototype.reapplyFilterHandler=function(){var e=this.parent.activeSheetIndex;this.filterRange.has(e)&&this.applyFilter({predicates:this.getPredicates(e)},m(this.filterRange.get(e)))},e.prototype.getFilterRangeHandler=function(e){var t=e.sheetIdx;this.filterRange&&this.filterRange.has(t)?(e.hasFilter=!0,e.filterRange=this.filterRange.get(t)):(e.hasFilter=!1,e.filterRange=null)},e.prototype.getLocalizedCustomOperators=function(){var e=this.parent.serviceLocator.getService(ki),t=[{value:"equal",text:e.getConstant("Equal")},{value:"greaterthan",text:e.getConstant("GreaterThan")},{value:"greaterthanorequal",text:e.getConstant("GreaterThanOrEqual")},{value:"lessthan",text:e.getConstant("LessThan")},{value:"lessthanorequal",text:e.getConstant("LessThanOrEqual")},{value:"notequal",text:e.getConstant("NotEqual")}];return{stringOperator:[{value:"startswith",text:e.getConstant("StartsWith")},{value:"endswith",text:e.getConstant("EndsWith")},{value:"contains",text:e.getConstant("Contains")},{value:"equal",text:e.getConstant("Equal")},{value:"notequal",text:e.getConstant("NotEqual")}],numberOperator:t,dateOperator:t,datetimeOperator:t,booleanOperator:[{value:"equal",text:e.getConstant("Equal")},{value:"notequal",text:e.getConstant("NotEqual")}]}},e.prototype.getFilteredCollection=function(){for(var e,t=this.parent.sheets.length,r=[],n=0;n<t;n++){var i={sheetIdx:n,filterRange:void 0,hasFilter:void 0};if(this.getFilterRangeHandler(i),i.hasFilter){for(var a=[],o=[],s=[],l=[],h=[],d=this.filterCollection.get(i.sheetIdx),p=0;p<d.length;p++)if(d[p].field&&d[p].operator){var c=u(d[p].field+"1")[1];a.push(c),o.push(d[p].operator),s.push(d[p].value),l.push(d[p].type),h.push(d[p].predicate)}var f=m(i.filterRange);e={sheetIndex:i.sheetIdx,filterRange:f,hasFilter:i.hasFilter,column:a,criteria:o,value:s,dataType:l},r.push(e)}}e&&(this.parent.filterCollection=r)},e.prototype.updateFilter=function(e){if(this.parent.filterCollection&&(e.initLoad||e.isOpen)){for(var t=0;t<this.parent.filterCollection.length;t++){var r=this.parent.filterCollection[t],n=r.sheetIndex;0===t&&(n=0);var i=[];if(r.column)for(var a=0;a<r.column.length;a++){var o={field:g(0,r.column[a]).charAt(0),operator:this.getFilterOperator(r.criteria[a]),value:r.value[a].toString().split("*").join("")};i.push(o)}for(var s=0;s<i.length-1;s++)i[s].field===i[s+1].field&&(i[s].predicate||(i[s].predicate="or"),i[s+1].predicate="or");this.parent.notify(rr,{predicates:i!==[]?i:null,range:r.filterRange,sIdx:n})}this.parent.sortCollection&&this.parent.notify("sortImport",null)}},e.prototype.getFilterOperator=function(e){switch(e){case"BeginsWith":e="startswith";break;case"Less":e="lessthan";break;case"EndsWith":e="endswith";break;case"Equal":e="equal";break;case"Notequal":e="notEqual";break;case"Greater":e="greaterthan";break;case"Contains":e="contains";break;case"LessOrEqual":e="lessthanorequal";break;case"GreaterOrEqual":e="greaterthanorequal"}return e},e}(),yi=function(){function e(e){this.pictureCount=1,this.parent=e,this.addEventListener(),this.renderImageUpload()}return e.prototype.addEventListener=function(){this.parent.on("insertImage",this.insertImage,this),this.parent.on("refreshImgElem",this.refreshImgElem,this),this.parent.on(hr,this.refreshImgCellObj,this),this.parent.on(dr,this.createImageElement,this),this.parent.on(pr,this.deleteImage,this),this.parent.on("refreshImagePosition",this.refreshInsDelImagePosition,this)},e.prototype.renderImageUpload=function(){var e=this.parent.element.id+"_imageUpload";this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".image, .jpg, .png, .gif ,jpeg",name:"fileUpload"}}));var t=document.getElementById(e);t.onchange=this.imageSelect.bind(this),t.style.display="none"},e.prototype.imageSelect=function(e){var t=e.target.files[0];if(!(t&&t.length<1)){var r={file:t};0===r.file.type.indexOf("image")?this.insertImage(r):this.parent.serviceLocator.getService(Ai).show({content:this.parent.serviceLocator.getService("spreadsheetLocale").getConstant("UnsupportedFile"),width:"300"}),document.getElementById(this.parent.element.id+"_imageUpload").value=""}},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("insertImage",this.insertImage),this.parent.off(hr,this.refreshImgCellObj),this.parent.off(dr,this.createImageElement),this.parent.off(pr,this.deleteImage),this.parent.off("refreshImagePosition",this.refreshInsDelImagePosition))},e.prototype.insertImage=function(e,t){var r=this;this.binaryStringVal(e).then(function(e){return r.createImageElement({options:{src:e},range:t,isPublic:!0})})},e.prototype.binaryStringVal=function(e){return new Promise(function(t,r){var n=new FileReader;n.readAsDataURL(e.file),n.onload=function(){return t(n.result)},n.onerror=function(e){return r(e)}})},e.prototype.createImageElement=function(e){var t=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,r=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,n=this.parent.serviceLocator.getService(Ti),i=e.options.imageId?e.options.imageId:this.parent.element.id+"_overlay_picture_"+this.pictureCount,a=c(t),o=r?this.parent.sheets[r]:this.parent.getActiveSheet();if(!document.getElementById(i)){var s={requestType:"beforeInsertImage",range:o.name+"!"+t,imageData:e.options.src,sheetIndex:r};if(e.isPublic&&this.parent.notify("actionBegin",{eventArgs:s,action:"beforeInsertImage"}),!s.cancel){var l=n.insertOverlayElement(i,t,r);l.style.backgroundImage="url('"+e.options.src+"')",(e.options.height||e.options.left)&&(l.style.height=e.options.height+"px",l.style.width=e.options.width+"px",l.style.top=e.options.top+"px",l.style.left=e.options.left+"px"),e.options.imageId||this.pictureCount++;var h={src:e.options.src,id:i,height:parseFloat(l.style.height.replace("px","")),width:parseFloat(l.style.width.replace("px","")),top:o.frozenRows||o.frozenColumns?a[0]?we(o,0,a[0]-1):0:parseFloat(l.style.top.replace("px","")),left:o.frozenRows||o.frozenColumns?a[1]?ke(o,0,a[1]-1):0:parseFloat(l.style.left.replace("px",""))};this.parent.setUsedRange(a[0],a[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify("setImage",{options:[h],range:o.name+"!"+t});var d=$(a[0],a[1],o);d.image[d.image.length-1].id||(d.image[d.image.length-1].id=h.id),s={requestType:"insertImage",range:o.name+"!"+t,imageHeight:e.options.height?e.options.height:300,imageWidth:e.options.width?e.options.width:400,imageData:e.options.src,id:i,sheetIndex:r},!e.isUndoRedo&&e.isPublic&&this.parent.notify("actionComplete",{eventArgs:s,action:"insertImage"})}}},e.prototype.refreshImgElem=function(){var e=document.getElementsByClassName("e-ss-overlay-active")[0];e&&t.removeClass([e],"e-ss-overlay-active")},e.prototype.refreshInsDelImagePosition=function(e){for(var t,r,n,i=e.count,a=e.sheetIdx,o=this.parent.sheets[a],s=$(e.rowIdx,e.colIdx,o),l=s.image.length,h=0;h<l;h++)t=document.getElementById(s.image[h].id),r="Row"===e.type?"insert"===e.status?s.image[h].top+20*i:s.image[h].top-20*i:s.image[h].top,n="Column"===e.type?"insert"===e.status?s.image[h].left+64*i:s.image[h].left-64*i:s.image[h].left,s.image[h].top=r,s.image[h].left=n,t.style.top=r+"px",t.style.left=n+"px"},e.prototype.refreshImgCellObj=function(e){var t,r,n=this.parent.getActiveSheet(),i=$(e.prevRowIdx,e.prevColIdx,n),a=$(e.currentRowIdx,e.currentColIdx,n),o=i?i.image:[],s=o&&o.length?o.length:0;if(i&&i.image&&o.length>0){for(var l=0;l<s;l++)o[l]&&o[l].id===e.id&&((t=o[l]).height=e.currentHeight,t.width=e.currentWidth,t.top=e.currentTop,t.left=e.currentLeft,o.splice(l,1));if(a&&a.image&&(r=a.image,t&&r.push(t)),r?Z(e.currentRowIdx,e.currentColIdx,n,{image:r},!0):Z(e.currentRowIdx,e.currentColIdx,n,{image:[t]},!0),"imageRefresh"===e.requestType&&!e.isUndoRedo){var h={requestType:"imageRefresh",currentRowIdx:e.currentRowIdx,currentColIdx:e.currentColIdx,prevRowIdx:e.prevRowIdx,prevColIdx:e.prevColIdx,prevTop:e.prevTop,prevLeft:e.prevLeft,currentTop:e.currentTop,currentLeft:e.currentLeft,currentHeight:e.currentHeight,currentWidth:e.currentWidth,prevHeight:e.prevHeight,prevWidth:e.prevWidth,id:e.id,sheetIdx:this.parent.activeSheetIndex};this.parent.notify("actionComplete",{eventArgs:h,action:"imageRefresh"})}}},e.prototype.deleteImage=function(e){var t,r,n=this.parent.getActiveSheet(),i=document.getElementById(e.id);if(i){var a=void 0,o=void 0;if(n.frozenRows||n.frozenColumns){var s=i.getBoundingClientRect();a={clientY:s.top},o={clientX:s.left},s.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(a.target=this.parent.getColumnHeaderContent()),s.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(o.target=this.parent.getRowHeaderTable())}else a={clientY:i.offsetTop,isImage:!0},o={clientX:i.offsetLeft,isImage:!0};this.parent.notify("getRowIdxFromClientY",a),this.parent.notify("getColIdxFromClientX",o),document.getElementById(e.id).remove(),t=a.clientY,r=o.clientX,n=this.parent.sheets[this.parent.activeSheetIndex]}else{var l=e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,h=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,d=c(l);t=d[0],r=d[1],n=this.parent.sheets[h]}for(var p=$(t,r,n).image,u=p.length,f=0;f<u;f++)p[f].id===e.id&&p.splice(f,1);Z(t,r,n,{image:p},!0)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"spreadsheetImage"},e}();p.Chart.Inject(p.ColumnSeries,p.LineSeries,p.BarSeries,p.AreaSeries,p.StackingColumnSeries,p.StackingLineSeries,p.StackingBarSeries,p.ScatterSeries),p.Chart.Inject(p.StackingAreaSeries,p.Category,p.Legend,h.Tooltip,p.DataLabel),p.AccumulationChart.Inject(p.PieSeries,p.AccumulationTooltip,p.AccumulationDataLabel,p.AccumulationLegend);var Ci=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("initiateChart",this.initiateChartHandler,this),this.parent.on("refreshChartCellObj",this.refreshChartCellObj,this),this.parent.on("updateChart",this.updateChartHandler,this),this.parent.on(cr,this.deleteChart,this),this.parent.on("clearChartBorder",this.clearBorder,this),this.parent.on("insertChart",this.insertChartHandler,this),this.parent.on("chartRangeSelection",this.chartRangeHandler,this),this.parent.on("chartDesignTab",this.chartDesignTabHandler,this),this.parent.on("addChartEle",this.updateChartElement,this)},e.prototype.insertChartHandler=function(e){var t="Column";switch(e.id){case"clusteredColumn":t="Column";break;case"stackedColumn":t="StackingColumn";break;case"stackedColumn100":t="StackingColumn100";break;case"clusteredBar":t="Bar";break;case"stackedBar":t="StackingBar";break;case"stackedBar100":t="StackingBar100";break;case"area":t="Area";break;case"stackedArea":t="StackingArea";break;case"stackedArea100":t="StackingArea100";break;case"line":t="Line";break;case"stackedLine":t="StackingLine";break;case"stackedLine100":t="StackingLine100";break;case"pie":t="Pie";break;case"doughnut":t="Doughnut";break;case"scatter":t="Scatter"}var r=[{type:t}];e.isChart?this.parent.notify(Ut,{chart:r}):this.parent.notify("chartDesignTab",{chartType:t})},e.prototype.chartRangeHandler=function(){var e=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(e)for(var t=e.getElementsByClassName("e-control")[0].id,r=this.parent.chartColl,n=r.length,i=0;i<n;i++){var a=document.getElementById(r[i].id);e&&a&&r[i].id===t&&this.parent.notify("initiateChart",{option:r[i],chartCount:this.parent.chartCount,isRefresh:!0})}},e.prototype.getPropertyValue=function(e,r,n){var i=this.parent.sheets;if(i[n]&&i[n].rows[e]&&i[n].rows[e].cells[r]){var a=$(e,r,this.parent.sheets[n]),o="";if(a.format){var s={type:H(a.format),value:a&&a.value,format:a&&a.format?a.format:"General",formattedText:a&&a.value,onLoad:!0,isRightAlign:!1,cell:a,rowIdx:e.toString(),colIdx:r.toString()};if(a)if(this.parent.notify("getFormattedCell",s),"number"==typeof s.value){var l=new RegExp("[!@#$%^&()+=';,{}|\":<>~_-]","g");s.formattedText=s.formattedText.toString().replace(l,""),o=parseInt(s.formattedText.toString(),10)}else o=s.formattedText.toString()}else o=this.parent.sheets[n].rows[e].cells[r].value;return o=t.isNullOrUndefined(o)?"":o}return""},e.prototype.updateChartHandler=function(e){var r=this.initiateChartHandler({option:e.chart,isRefresh:!0}),n=this.parent.element.querySelector("."+e.chart.id);if(n){var i=t.getComponent(n,"chart");t.isNullOrUndefined(i)&&(i=t.getComponent(n,"accumulationchart")),i.series=r,i.refresh()}},e.prototype.refreshChartCellObj=function(e){var r,n,i=this.parent.sheets[this.parent.activeSheetIndex],a=$(e.prevRowIdx,e.prevColIdx,i),o=$(e.currentRowIdx,e.currentColIdx,i),s=a?a.chart:[],l=s&&s.length?s.length:0;if(a&&a.chart){for(var h=0;h<l;h++){var d=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active")[0],p=document.getElementById(s[h].id);if(t.closest(p,"."+d.classList[1])===d){(r=s[h]).height=e.currentHeight,r.width=e.currentWidth,r.top=e.currentTop,r.left=e.currentLeft,s.splice(h,1);for(var c=0,u=this.parent.chartColl.length;c<u;c++)r.id===this.parent.chartColl[c].id&&(r.height=e.currentHeight,this.parent.chartColl[c].width=e.currentWidth,this.parent.chartColl[c].top=e.currentTop,this.parent.chartColl[c].left=e.currentLeft)}}if(o&&o.chart&&(n=o.chart,r&&n.push(r)),n?Z(e.currentRowIdx,e.currentColIdx,i,{chart:n},!0):Z(e.currentRowIdx,e.currentColIdx,i,{chart:[r]},!0),"chartRefresh"===e.requestType&&!e.isUndoRedo){var f={requestType:"chartRefresh",currentRowIdx:e.currentRowIdx,currentColIdx:e.currentColIdx,currentWidth:e.currentWidth,prevHeight:e.prevHeight,prevWidth:e.prevWidth,prevRowIdx:e.prevRowIdx,prevColIdx:e.prevColIdx,prevTop:e.prevTop,prevLeft:e.prevLeft,currentTop:e.currentTop,currentLeft:e.currentLeft,currentHeight:e.currentHeight,id:e.id,sheetIdx:this.parent.activeSheetIndex};this.parent.notify("actionComplete",{eventArgs:f,action:"chartRefresh"})}}},e.prototype.processChartRange=function(e,r,n){var i,a,o,s=e[0],l=e[1],h=!1,d=e[2],p=e[3],c=s===d,u=l===p,f=this.getPropertyValue(s,p,r),g=this.getPropertyValue(d,l,r),m=this.getPropertyValue(s,l,r);return L(g)&&m||(h=!0),t.isNullOrUndefined(m)&&!c&&!u||"Scatter"===n.type&&e[3]-e[1]==1?(i=[s+1,l,d,l],a=[s+1,l+1,d,p],o=[s,l+1,s,p]):t.isNullOrUndefined(g)||!h||c||u?(a=[s,l,d,p],t.isNullOrUndefined(f)||L(f)||F(f)?t.isNullOrUndefined(m)&&(c||u)&&(o=[s,l,s,p],c?(a[1]=a[1]+1,o[3]=o[1]):a[0]=a[0]+1):(o=[s,l,s,p],a[0]=a[0]+1)):t.isNullOrUndefined(f)||L(f)&&m?(i=[s,l,d,l],a=[s,l+1,d,p]):(i=[s+1,l,d,l],a=[s+1,l+1,d,p],o=[s,l+1,s,p]),{xRange:i,yRange:a,lRange:o}},e.prototype.toIntrnlRange=function(e,t){return e?"string"==typeof e&&(e=c[e]):e=c[this.parent.sheets[t].selectedRange],e},e.prototype.getRangeData=function(e){e.sheetIdx=t.isNullOrUndefined(e.sheetIdx)?this.parent.getActiveSheet().index:e.sheetIdx;var r=this.parent.sheets[e.sheetIdx];e.range=this.toIntrnlRange(e.range,e.sheetIdx);var n,i,a=[],o=[],s=e.range[0];i=e.range[2];var l=e.range[3],h=be(r,s);return h||(n=e.range[1],this.pushRowData(e,s,n,i,l,o,a,!0,e.isYvalue)),o},e.prototype.pushRowData=function(e,r,n,i,a,o,s,l,h){for(var d=n;r<=i;){for(n=d;n<=a;){var p="",c=$(r,n,this.parent.sheets[e.sheetIdx]);if(c&&c.format&&!h){var u={value:c&&c.value,format:c&&c.format?c.format:"General",formattedText:c&&c.value,onLoad:!0,type:c&&H(c.format),rowIdx:r.toString(),colIdx:n.toString(),isRightAlign:!1,cell:c};this.parent.notify("getFormattedCell",u),p=u.formattedText.toString()}else p=c?t.isNullOrUndefined(c.value)?"":c.value:"";o.push({value:p}),n++}r++}s.push(r)},e.prototype.toArrayData=function(e){for(var t,r=0,n=[],i=e.length;r<i;)t=e[r],Object.keys(t).length?"value"in t&&n.push(t.value):n.push(""),r++;return n},e.prototype.getVirtualXValues=function(e){for(var t=1,r=[];t<e;)r.push(t.toString()),t++;return r},e.prototype.processChartSeries=function(e,r,n,i,a){e=e||{};var o,s,l,h,d,p,c,u="",f={},g={},m=0,v=0,y=[],C=this.getRangeData({range:i,sheetIdx:r,skipFormula:!0,isYvalue:!0}),b=i[2]-i[0]+1,S=i[3]-i[1]+1;e.isSeriesInRows?(s=a?this.toArrayData(this.getRangeData({range:a,sheetIdx:r,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(S+1),n&&(l=this.toArrayData(this.getRangeData({range:n,sheetIdx:r,skipFormula:!1,isYvalue:!1}))),h=b):(s=n?this.toArrayData(this.getRangeData({range:n,sheetIdx:r,skipFormula:!1,isYvalue:!1})):this.getVirtualXValues(b+1),a&&(l=this.toArrayData(this.getRangeData({range:a,sheetIdx:r,skipFormula:!1,isYvalue:!1}))),h=S);var x=s.length,w=e.isSeriesInRows?1:h;for(t.isNullOrUndefined(e.dataLabelSettings)||(f.visible=e.dataLabelSettings.visible,f.position=e.dataLabelSettings.position);m<h;){for(p=0,d=[],v=e.isSeriesInRows?v:m;p<x;)C[v]&&(L(o=C[v].value)?o=Number(o):(c=T(o),o=isNaN(c)?0:c),d.push({x:s[p],y:o})),v+=w,p++;if(u=l&&l.length>0?l[m]:"series"+m,e.type){var I=e.type;if("Line"===I||"StackingLine"===I||"StackingLine100"===I)g={dataSource:d,type:e.type,xName:"x",yName:"y",name:u.toString(),marker:{visible:!0,width:10,height:10,dataLabel:f}};else if("Scatter"===I)g={dataSource:d,type:e.type,xName:"x",yName:"y",name:u.toString(),marker:{visible:!1,width:12,height:12,shape:"Circle",dataLabel:f}};else if("Pie"===I||"Doughnut"===I){var E="Pie"===e.type?"0%":"40%",R=f.visible,k=t.isNullOrUndefined(f.position)?"Inside":"Outer"===f.position?"Outside":"Inside";g={dataSource:d,dataLabel:{visible:!t.isNullOrUndefined(R)&&R,position:k,name:"text",font:{fontWeight:"600"}},radius:"100%",xName:"x",yName:"y",innerRadius:E}}else g={dataSource:d,type:e.type,xName:"x",yName:"y",name:u.toString(),marker:{dataLabel:f}}}y.push(g),m++}var A;return e.type&&(A={series:y,xRange:e.isSeriesInRows?a:n,yRange:i,lRange:e.isSeriesInRows?n:a}),A},e.prototype.primaryYAxisFormat=function(e){if(t.isNullOrUndefined(e))return"{value}";var r,n=$(e[0],e[1],this.parent.getActiveSheet());if(n&&n.format){if("Accounting"===(r=H(n.format)))return"${value}";if("Currency"===r)return"${value}";if("Percentage"===r)return"{value}%"}return"{value}"},e.prototype.focusChartRange=function(e,t,r){var n=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"];this.clearBorder();var i,a=this.parent.getActiveSheet(),o=!(!a.frozenRows&&!a.frozenColumns);r&&(o?i=r:this.parent.notify("focusBorder",{startcell:{rowIndex:r[0],colIndex:r[1]},endcell:{rowIndex:r[2],colIndex:r[3]},classes:[n[0],n[1]]})),e&&(o?i?(i[0]=Math.min(r[0],e[0]),i[1]=Math.min(r[1],e[1]),i[2]=Math.max(r[2],e[2]),i[3]=Math.max(r[3],e[3])):i=e:this.parent.notify("focusBorder",{startcell:{rowIndex:e[0],colIndex:e[1]},endcell:{rowIndex:e[2],colIndex:e[3]},classes:[n[2],n[3]]})),o&&i?this.parent.notify("focusBorder",{startcell:{rowIndex:Math.min(i[0],t[0]),colIndex:Math.min(i[1],t[1])},endcell:{rowIndex:Math.max(i[2],t[2]),colIndex:Math.max(i[3],t[3])},classes:[n[4],n[5]]}):this.parent.notify("focusBorder",{startcell:{rowIndex:t[0],colIndex:t[1]},endcell:{rowIndex:t[2],colIndex:t[3]},classes:[n[4],n[5]]})},e.prototype.clearBorder=function(){var e=this.parent.getActiveSheet();if(e.frozenColumns||e.frozenRows)return void[].slice.call(this.parent.element.getElementsByClassName("e-chart-range")).forEach(function(e){t.detach(e)});for(var r=this.parent.getMainContent(),n=["e-rcborderright","e-rcborderbottom","e-vcborderright","e-vcborderbottom","e-bcborderright","e-bcborderbottom"],i=0,a=n.length;i<a;i++)for(var o=r.querySelectorAll("."+n[i]),s=0,l=o.length;s<l;s++)o[s].classList.remove(n[i])},e.prototype.initiateChartHandler=function(e){var r=e.option,n=!0;n=!!t.isNullOrUndefined(e.isInitCell)||!e.isInitCell,e.isUndoRedo=!!t.isNullOrUndefined(e.isUndoRedo)||e.isUndoRedo;e.isRefresh=!t.isNullOrUndefined(e.isRefresh)&&e.isRefresh;var i,a,o=this.parent.getActiveSheet(),s=r.range?r.range.indexOf("!")>0?r.range.split("!")[1]:r.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,l=c(s),h={};if(this.parent.allowChart||!o.isProtected){var d=r.range&&r.range.indexOf("!")>0?ae(this.parent,r.range.split("!")[0]):this.parent.activeSheetIndex,f={sheetIndex:d,reqType:"shape",type:"actionBegin",shapeType:"chart",action:"create",options:r,range:s,operation:"create"};h=f.options,s=f.range,h=h||{},l.length>0&&l[2]-l[0]<l[3]-l[1]&&(i=!0),h.isSeriesInRows=!!i||!!h.isSeriesInRows&&h.isSeriesInRows,e.dataSheetIdx=t.isNullOrUndefined(e.dataSheetIdx)?d:e.dataSheetIdx;var g=this.processChartRange(l,e.dataSheetIdx,h),m=g.xRange,v=g.yRange,y=g.lRange;d===this.parent.activeSheetIndex&&n&&this.focusChartRange(m,v,y);var C=this.processChartSeries(h,e.dataSheetIdx,m,v,y),b={majorGridLines:r.primaryXAxis&&r.primaryXAxis.majorGridLines&&!t.isNullOrUndefined(r.primaryXAxis.majorGridLines.width)?{width:r.primaryXAxis.majorGridLines.width}:{width:0},minorGridLines:r.primaryXAxis&&r.primaryXAxis.minorGridLines&&!t.isNullOrUndefined(r.primaryXAxis.minorGridLines.width)?{width:r.primaryXAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:r.primaryXAxis&&r.primaryXAxis.minorGridLines&&r.primaryXAxis.minorGridLines.width>0?5:0,lineStyle:{width:0},valueType:"Category",visible:!r.primaryXAxis||r.primaryXAxis.visible,title:r.primaryXAxis?r.primaryXAxis.title:""},S={lineStyle:{width:0},majorGridLines:r.primaryYAxis&&r.primaryYAxis.majorGridLines&&!t.isNullOrUndefined(r.primaryYAxis.majorGridLines.width)?{width:r.primaryYAxis.majorGridLines.width}:{width:1},minorGridLines:r.primaryYAxis&&r.primaryYAxis.minorGridLines&&!t.isNullOrUndefined(r.primaryYAxis.minorGridLines.width)?{width:r.primaryYAxis.minorGridLines.width}:{width:0},minorTicksPerInterval:r.primaryYAxis&&r.primaryYAxis.minorGridLines&&r.primaryYAxis.minorGridLines.width>0?5:0,labelFormat:this.primaryYAxisFormat(v),visible:!r.primaryYAxis||r.primaryYAxis.visible,title:r.primaryYAxis?r.primaryYAxis.title:""};if(e.isRefresh)return C.series;if(e.isUndoRedo){if(a={type:r.type,theme:r.theme,isSeriesInRows:r.isSeriesInRows,range:r.range,id:r.id,height:r.height,width:r.width,posRange:e.range,isInitCell:e.isInitCell,cancel:!1},this.parent.notify(ir,{eventArgs:a,action:"beforeInsertChart"}),a.cancel)return[];r.type=a.type,r.theme=a.theme,r.isSeriesInRows=a.isSeriesInRows,r.range=a.range,r.id=a.id,r.height=a.height,r.width=a.width}var x=r.id+"_overlay",w=e.isPaste?this.parent.getActiveSheet().index:e.option.range&&e.option.range.indexOf("!")>0?ae(this.parent,e.option.range.split("!")[0]):this.parent.activeSheetIndex,I=this.parent.serviceLocator.getService(Ti),E=!t.isNullOrUndefined(e.isInitCell)&&e.isInitCell?e.range:s,R=I.insertOverlayElement(x,E,w);if(R.classList.add("e-datavisualization-chart"),R.style.width=r.width+"px",R.style.height=r.height+"px",o.frozenRows||o.frozenColumns){var k=c(E),A=this.parent.frozenRowCount(o),T=this.parent.frozenColCount(o);if(k[0]<A||k[1]<T?(t.isNullOrUndefined(r.top)||(R.style.top=r.top+(o.showHeaders?31:0)-this.parent.viewport.beforeFreezeHeight+"px"),t.isNullOrUndefined(r.left)||(R.style.left=r.left+this.parent.sheetModule.getRowHeaderWidth(o,!0)-this.parent.viewport.beforeFreezeWidth+"px")):(t.isNullOrUndefined(r.top)||(R.style.top=r.top-this.parent.viewport.beforeFreezeHeight-(A?we(o,u(o.topLeftCell)[0],A-1):0)+"px"),t.isNullOrUndefined(r.left)||(R.style.left=r.left-this.parent.viewport.beforeFreezeWidth-(T?ke(o,u(o.topLeftCell)[1],T-1):0)+"px")),t.isNullOrUndefined(r.top)){var F=u(o.topLeftCell)[0];r.top=this.parent.viewport.beforeFreezeHeight+(A&&F===k[0]?0:we(o,A?F:0,k[0]-1))}if(t.isNullOrUndefined(r.left)){var L=u(o.topLeftCell)[1];r.left=this.parent.viewport.beforeFreezeWidth+(T&&L===k[1]?0:ke(o,T?L:0,k[1]-1))}}else R.style.top=t.isNullOrUndefined(r.top)?R.style.top:r.top+"px",R.style.left=t.isNullOrUndefined(r.left)?R.style.left:r.left+"px",r.top=parseInt(R.style.top.replace("px",""),10),r.left=parseInt(R.style.left.replace("px",""),10);this.parent.notify("overlayEleSize",{height:r.height,width:r.width});var N="Pie"===r.type||"Doughnut"===r.type?{position:"Bottom",visible:!0}:{};t.isNullOrUndefined(r.legendSettings)||(N.visible=r.legendSettings.visible,N.position=r.legendSettings.position);var D=this.parent.createElement("div",{id:r.id,className:r.id});"Pie"!==r.type&&"Doughnut"!==r.type?(this.chart=new p.Chart({primaryXAxis:b,primaryYAxis:S,chartArea:{border:{width:0}},title:r.title,legendSettings:N,theme:r.theme,series:C.series,tooltip:{enable:!0},width:R.style.width,height:R.style.height,load:function(e){var t=r.theme;t=t||"Material",e.chart.theme=t},beforeResize:function(e){e.cancelResizedEvent=!0}}),this.chart.appendTo(D)):(this.chart=new p.AccumulationChart({title:r.title,legendSettings:N,theme:r.theme,series:C.series,width:R.style.width,height:R.style.height,center:{x:"50%",y:"50%"},enableSmartLabels:!0,enableAnimation:!0,load:function(e){var t=r.theme;t=t||"Material",e.chart.theme=t},beforeResize:function(e){e.cancelResizedEvent=!0}}),this.chart.appendTo(D)),R.appendChild(D),e.isUndoRedo&&this.parent.notify(nr,{eventArgs:a,action:"insertChart"})}},e.prototype.deleteChart=function(e){this.clearBorder();var r=null,n=this.parent.getActiveSheet();if(t.isNullOrUndefined(e.id)?(r=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active"),e.id=r?r.getElementsByClassName("e-control")[0].id:null):(e.id=e.id.includes("overlay")?e.id:e.id+"_overlay",r=document.getElementById(e.id)),!t.isNullOrUndefined(e.id)&&!t.isNullOrUndefined(r)){e.id=e.id.includes("overlay")?e.id:e.id+"_overlay";for(var i,a,o,s,l=!1,h=0,d=this.parent.chartColl.length;h<d;h++)if(this.parent.chartColl[h].id===e.id.split("_overlay")[0]){s=this.parent.chartColl[h];break}var p={id:s.id,range:s.range,type:s.type,theme:s.theme,height:s.height,width:s.width,isSeriesInRows:s.isSeriesInRows,isInitCell:!0,posRange:null,top:s.top,left:s.left,cancel:!1};if(r){var u=void 0,f=void 0;if(n.frozenRows||n.frozenColumns){var m=r.getBoundingClientRect();u={clientY:m.top},f={clientX:m.left},m.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(u.target=this.parent.getColumnHeaderContent()),m.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(f.target=this.parent.getRowHeaderTable())}else u={clientY:r.offsetTop,isImage:!0},f={clientX:r.offsetLeft,isImage:!0};this.parent.notify("deleteChartColl",{id:e.id}),this.parent.notify("getRowIdxFromClientY",u),this.parent.notify("getColIdxFromClientX",f),l=!0,i=u.clientY,a=f.clientX,n=this.parent.sheets[this.parent.activeSheetIndex]}else{this.parent.notify("deleteChartColl",{id:e.id});var v=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,y=c(e.range?e.range.indexOf("!")>0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange);i=y[0],a=y[1],n=this.parent.sheets[v]}var C=$(i,a,n);C&&(o=C.chart);for(var b=o?o.length:null,h=0;h<b;h++){var S=document.getElementById(e.id),x=document.getElementById(o[h].id);t.closest(x,"."+S.classList[1])===S&&o.splice(h,1)}l&&(document.getElementById(e.id).remove(),this.parent.notify("removeDesignChart",{})),Z(i,a,n,{chart:o},!0),p.posRange=g(i,a),e.isUndoRedo||this.parent.notify(nr,{eventArgs:p,action:"deleteChart"})}},e.prototype.updateChartModel=function(e,r,n,i,a){var o=r;r=r;var s=this.parent.chartColl[i].id;if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)>-1))for(var l=0,h=n.chart.length;l<h;l++)if(n.chart[l].id===s)switch(e){case"PHAxes":case"PHAxisTitle":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),"PHAxes"===e?(n.chart[l].primaryXAxis.visible=r.primaryXAxis.visible,this.parent.chartColl[i].primaryXAxis.visible=r.primaryXAxis.visible):"PHAxisTitle"===e&&(n.chart[l].primaryXAxis.title=r.primaryXAxis.title,this.parent.chartColl[i].primaryXAxis.title=r.primaryXAxis.title);break;case"PVAxes":case"PVAxisTitle":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),"PVAxes"===e?(n.chart[l].primaryYAxis.visible=r.primaryYAxis.visible,this.parent.chartColl[i].primaryYAxis.visible=r.primaryYAxis.visible):"PVAxisTitle"===e&&(n.chart[l].primaryYAxis.title=r.primaryYAxis.title,this.parent.chartColl[i].primaryYAxis.title=r.primaryYAxis.title);break;case"ChartTitleNone":case"ChartTitleAbove":n.chart[l].title=r.title,this.parent.chartColl[i].title=r.title;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":if(t.isNullOrUndefined(n.chart[l].dataLabelSettings)&&(n.chart[l].dataLabelSettings={},this.parent.chartColl[i].dataLabelSettings={}),"DLNone"===e)n.chart[l].dataLabelSettings.visible=!1,this.parent.chartColl[i].dataLabelSettings.visible=!1;else{n.chart[l].dataLabelSettings.visible=!0,this.parent.chartColl[i].dataLabelSettings.visible=!0;var d=void 0;d=a?"Outside"===o.series[0].dataLabel.position?"Outer":"Middle":r.series[0].marker.dataLabel.position,n.chart[l].dataLabelSettings.position=d,this.parent.chartColl[i].dataLabelSettings.position=d}break;case"GLMajorHorizontal":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),t.isNullOrUndefined(n.chart[l].primaryYAxis.majorGridLines)&&(n.chart[l].primaryYAxis.majorGridLines={},this.parent.chartColl[i].primaryYAxis.majorGridLines={}),n.chart[l].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width,this.parent.chartColl[i].primaryYAxis.majorGridLines.width=r.primaryYAxis.majorGridLines.width;break;case"GLMajorVertical":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),t.isNullOrUndefined(n.chart[l].primaryXAxis.majorGridLines)&&(n.chart[l].primaryXAxis.majorGridLines={},this.parent.chartColl[i].primaryXAxis.majorGridLines={}),n.chart[l].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width,this.parent.chartColl[i].primaryXAxis.majorGridLines.width=r.primaryXAxis.majorGridLines.width;break;case"GLMinorHorizontal":t.isNullOrUndefined(n.chart[l].primaryYAxis)&&(n.chart[l].primaryYAxis={},this.parent.chartColl[i].primaryYAxis={}),t.isNullOrUndefined(n.chart[l].primaryYAxis.minorGridLines)&&(n.chart[l].primaryYAxis.minorGridLines={},this.parent.chartColl[i].primaryYAxis.minorGridLines={}),n.chart[l].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width,this.parent.chartColl[i].primaryYAxis.minorGridLines.width=r.primaryYAxis.minorGridLines.width;break;case"GLMinorVertical":t.isNullOrUndefined(n.chart[l].primaryXAxis)&&(n.chart[l].primaryXAxis={},this.parent.chartColl[i].primaryXAxis={}),t.isNullOrUndefined(n.chart[l].primaryXAxis.minorGridLines)&&(n.chart[l].primaryXAxis.minorGridLines={},this.parent.chartColl[i].primaryXAxis.minorGridLines={}),n.chart[l].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width,this.parent.chartColl[i].primaryXAxis.minorGridLines.width=r.primaryXAxis.minorGridLines.width;break;case"LegendNone":case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":if(t.isNullOrUndefined(n.chart[l].legendSettings)&&(n.chart[l].legendSettings={},this.parent.chartColl[i].legendSettings={}),n.chart[l].legendSettings.visible=r.legendSettings.visible,this.parent.chartColl[i].legendSettings.visible=r.legendSettings.visible,"LegendNone"!==e){n.chart[l].legendSettings.position=r.legendSettings.position,this.parent.chartColl[i].legendSettings.position=r.legendSettings.position;break}}},e.prototype.updateChartElement=function(e,t,r,n,i,a){if(!(a&&["PHAxes","PVAxes","PHAxisTitle","PVAxisTitle","GLMajorHorizontal","GLMajorVertical","GLMinorHorizontal","GLMinorVertical"].indexOf(e)>-1)){var o;switch(e){case"PHAxes":(t=t).primaryXAxis.visible=!t.primaryXAxis.visible;break;case"PVAxes":(t=t).primaryYAxis.visible=!t.primaryYAxis.visible;break;case"PHAxisTitle":(t=t).primaryXAxis.title=i;break;case"PVAxisTitle":(t=t).primaryYAxis.title=i;break;case"ChartTitleNone":t.title="";break;case"ChartTitleAbove":t.title=i;break;case"DLNone":case"DLCenter":case"DLInsideend":case"DLInsidebase":case"DLOutsideend":if(t=t,o=t.series,"DLNone"===e)for(var s=0,l=o.length;s<l;s++)a?o[s].dataLabel.visible=!1:o[s].marker.dataLabel.visible=!1;else for(var s=0,l=o.length;s<l;s++)if(a){h="DLOutsideend"===e?"Outside":"Inside";o[s].dataLabel.visible=!0,o[s].dataLabel.position=h}else{var h="DLCenter"===e?"Middle":"DLInsideend"===e?"Top":"DLInsidebase"===e?"Bottom":"DLOutsideend"===e?"Outer":o[0].marker.dataLabel.position;o[s].marker.dataLabel.visible=!0,o[s].marker.dataLabel.position=h}t.series=o,a&&t.refresh();break;case"GLMajorHorizontal":(t=t).primaryYAxis.majorGridLines.width=0===t.primaryYAxis.majorGridLines.width?1:0;break;case"GLMajorVertical":(t=t).primaryXAxis.majorGridLines.width=0===t.primaryXAxis.majorGridLines.width?1:0;break;case"GLMinorHorizontal":(t=t).primaryYAxis.minorTicksPerInterval=0===t.primaryYAxis.minorGridLines.width?5:0,t.primaryYAxis.minorGridLines.width=0===t.primaryYAxis.minorGridLines.width?1:0;break;case"GLMinorVertical":(t=t).primaryXAxis.minorTicksPerInterval=0===t.primaryXAxis.minorGridLines.width?5:0,t.primaryXAxis.minorGridLines.width=0===t.primaryXAxis.minorGridLines.width?1:0;break;case"LegendNone":t.legendSettings.visible=!1;break;case"LegendsRight":case"LegendsLeft":case"LegendsBottom":case"LegendsTop":t.legendSettings.visible=!0,t.legendSettings.position="LegendsRight"===e?"Right":"LegendsLeft"===e?"Left":"LegendsBottom"===e?"Bottom":"LegendsTop"===e?"Top":t.legendSettings.position}this.updateChartModel(e,t,r,n,a)}},e.prototype.chartDesignTabHandler=function(e){var r,n=!1,i=this.parent.sheets[this.parent.activeSheetIndex],a=e.switchRowColumn,o=e.chartType,s=e.chartTheme,l=e.addChartEle,h=null,d=document.querySelector(".e-datavisualization-chart.e-ss-overlay-active");if(d){var p,c;if(i.frozenRows||i.frozenColumns){var u=d.getBoundingClientRect();p={clientY:u.top},c={clientX:u.left},u.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(p.target=this.parent.getColumnHeaderContent()),u.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(c.target=this.parent.getRowHeaderTable())}else p={clientY:d.offsetTop,isImage:!0},c={clientX:d.offsetLeft,isImage:!0};this.parent.notify("getRowIdxFromClientY",p),this.parent.notify("getColIdxFromClientX",c);var f=$(p.clientY,c.clientX,i),g=d.querySelector(".e-chart");t.isNullOrUndefined(g)&&(g=d.querySelector(".e-accumulationchart"));for(var m=g.getAttribute("id"),v=0,y=this.parent.chartColl.length;v<y;v++)m===this.parent.chartColl[v].id&&(r=v);if(g&&(h=t.getComponent(g,"chart"),t.isNullOrUndefined(h)&&(h=t.getComponent(g,"accumulationchart"),n=!0)),a&&!n){this.parent.chartColl[r].isSeriesInRows=!!t.isNullOrUndefined(this.parent.chartColl[r].isSeriesInRows)||!this.parent.chartColl[r].isSeriesInRows;for(var v=0,C=f.chart.length;v<C;v++)f.chart[v].id===m&&(f.chart[v].isSeriesInRows=!!t.isNullOrUndefined(f.chart[v].isSeriesInRows)||!f.chart[v].isSeriesInRows);var b=this.initiateChartHandler({option:this.parent.chartColl[r],isRefresh:!0});h.series=b}if(o){var S=this.parent.chartColl[r].type;this.parent.chartColl[r].type=o;for(var v=0,C=f.chart.length;v<C;v++)f.chart[v].id===m&&(f.chart[v].type=o);if("Pie"!==o&&"Doughnut"!==o)if("Pie"===S||"Doughnut"===S)this.changeCharType(r);else{for(var v=0,x=(b=h.series).length;v<x;v++)b[v].type=o;h.series=b,h.refresh()}else if("Pie"===S||"Doughnut"===S){for(var v=0,x=(b=h.series).length;v<x;v++)b[v].innerRadius="Pie"===o?"0%":"40%";h.series=b,h.refresh()}else this.changeCharType(r)}if(s){this.parent.chartColl[r].theme=s;for(var v=0,C=f.chart.length;v<C;v++)f.chart[v].id===m&&(f.chart[v].theme=s);h.theme=s,h.refresh()}if(l)if("ChartTitleAbove"===l||"PHAxisTitle"===l||"PVAxisTitle"===l){if(this.parent.element.getElementsByClassName("e-title-dlg").length>0)return;this.titleDlgHandler(l,h,f,r,n)}else this.updateChartElement(l,h,f,r,"",n)}},e.prototype.changeCharType=function(e){var r=document.getElementById(this.parent.chartColl[e].id),n=t.closest(r,".e-datavisualization-chart");n.remove(),this.parent.notify("initiateChart",{option:this.parent.chartColl[e],isInitCell:!1,isUndoRedo:!0,isPaste:!1}),r=document.getElementById(this.parent.chartColl[e].id),(n=t.closest(r,".e-datavisualization-chart")).classList.contains("e-ss-overlay-active")||n.classList.add("e-ss-overlay-active")},e.prototype.titleDlgHandler=function(e,t,r,n,i){var a=this,o="";if(!i||"PHAxisTitle"!==e&&"PVAxisTitle"!==e){var s=this.parent.serviceLocator.getService(ki),l=this.parent.serviceLocator.getService(Ai);l.show({width:375,showCloseIcon:!0,isModal:!0,cssClass:"e-title-dlg",header:"chart_abovechart"===e?s.getConstant("ChartTitle"):"PHAxisTitle"===e?s.getConstant("HorizontalAxisTitle"):s.getConstant("VerticalAxisTitle"),target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(){l.dialogInstance.content=a.titleDlgContent(e,t),l.dialogInstance.dataBind(),a.parent.element.focus()},buttons:[{buttonModel:{content:s.getConstant("Ok"),isPrimary:!0,cssClass:"e-btn e-clearall-btn e-flat"},click:function(){var i=a.parent.element.querySelector(".e-title-dlg").getElementsByClassName("e-title-dlg-content")[0];o=i.getElementsByTagName("input")[0].value,l.hide(),a.updateChartElement(e,t,r,n,o)}}]}),l.dialogInstance.refresh()}},e.prototype.titleDlgContent=function(e,t){var r=this.parent.serviceLocator.getService(ki).getConstant("EnterTitle"),n=this.parent.createElement("div",{className:"e-title-dlg-content"}),i=this.parent.createElement("span",{className:"e-header e-top-header",innerHTML:r}),a=this.parent.createElement("input",{className:"e-input",id:"titleInput",attrs:{type:"text"}});return n.appendChild(i),n.appendChild(a),t&&(a.value="PHAxisTitle"===e?t.primaryXAxis.title?t.primaryXAxis.title:a.value:"PVAxisTitle"===e?t.primaryYAxis.title?t.primaryYAxis.title:a.value:t.title?t.title:a.value),n},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiateChart",this.initiateChartHandler),this.parent.off("refreshChartCellObj",this.refreshChartCellObj),this.parent.off("updateChart",this.updateChartHandler),this.parent.off(cr,this.deleteChart),this.parent.off("clearChartBorder",this.clearBorder),this.parent.off("insertChart",this.insertChartHandler),this.parent.off("chartRangeSelection",this.chartRangeHandler),this.parent.off("chartDesignTab",this.chartDesignTabHandler),this.parent.off("addChartEle",this.updateChartElement))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null;var e=null;this.chart&&(e=this.chart.element,this.chart.destroy()),e&&t.detach(e),this.chart=null},e.prototype.getModuleName=function(){return"spreadsheetChart"},e}(),bi=function(){function e(){zi.Inject(li,hi,pi,Bn,Hn,_n,Un,On,qt,ci,fi,ui,gi,Vn,di,mi,qn,Gn,zn,vi,Wn,Yn,Xn,Kn,Zn,$n,Jn,Qn,ei,yi,Ci)}return e.prototype.getModuleName=function(){return"basic"},e.prototype.destroy=function(){},e}(),Si=function(){function e(){zi.Inject(li,hi,pi,Bn,Hn,_n,Un,On,qt,ci,ui,gi,Vn,di,mi,zn,qn,Gn,vi,Wn,Yn,Xn,Kn,$n,Zn,Jn,Qn,yi,ei,Ci)}return e.prototype.getModuleName=function(){return"all"},e.prototype.destroy=function(){},e}(),xi=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),wi=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Ii=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return xi(r,e),wi([t.Property(!1)],r.prototype,"isFinite",void 0),wi([t.Property(!0)],r.prototype,"enableVirtualization",void 0),r}(t.ChildProperty),Ei=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return xi(r,e),wi([t.Property("Multiple")],r.prototype,"mode",void 0),r}(t.ChildProperty),Ri="e-wraptext",ki="spreadsheetLocale",Ai="dialog",Ti="shape",Fi={Custom:["#ffffff","#000000","#e7e6e6","#44546a","#4472c4","#ed7d31","#a5a5a5","#ffc000","#70ad47","#ff0000","#f2f2f2","#808080","#cfcdcd","#d5dce4","#d9e2f3","#fbe4d5","#ededed","#fff2cc","#e2efd9","#ffcccc","#d9d9d9","#595959","#aeaaaa","#acb9ca","#b4c6e7","#f7caac","#dbdbdb","#ffe599","#c5e0b3","#ff8080","#bfbfbf","#404040","#747070","#8496b0","#8eaadb","#f4b083","#c9c9c9","#ffd966","#a8d08d","#ff3333","#a6a6a6","#262626","#3b3838","#323e4f","#2f5496","#c45911","#7b7b7b","#bf8f00","#538135","#b30000","#7f7f7f","#0d0d0d","#161616","#212934","#1f3763","#823b0b","#525252","#7f5f00","#375623","#660000"]},Li={Custom:["#ffffff","#000000","#ffff00","#00ff00","#00ffff","#0000ff","#ff0000","#000080","#800080","#996633","#f2f2f2","#808080","#ffffcc","#b3ffb3","#ccffff","#ccccff","#ffcccc","#ccccff","#ff80ff","#f2e6d9","#d9d9d9","#595959","#ffff80","#80ff80","#b3ffff","#8080ff","#ff8080","#8080ff","#ff00ff","#dfbf9f","#bfbfbf","#404040","#ffff33","#33ff33","#33ffff","#3333ff","#ff3333","#0000b3","#b300b3","#c68c53","#a6a6a6","#262626","#e6e600","#00b300","#009999","#000099","#b30000","#000066","#660066","#86592d","#7f7f7f","#0d0d0d","#999900","#006600","#006666","#000066","#660000","#00004d","#4d004d","#734d26"]},Ni={FindValue:"Find value",ReplaceValue:"Replace value",FindReplaceTooltip:"Find & Replace",InsertingEmptyValue:"Reference value is not valid.",ReplaceAllEnd:" matches replaced with ",ByRow:"By Rows",ByColumn:"By Columns",MatchCase:"Match case ",MatchExactCellElements:"Match exact cell contents",Replace:"Replace...",Find:"Find and Replace...",Goto:"Goto...",EntercellAddress:"Enter cell address",GotoSpecial:"GotoSpecial...",FindAndReplace:"Find and Replace",FindNextBtn:"Find Next",FindPreviousBtn:"Find Previous",ReplaceBtn:"Replace",ReplaceAllBtn:"Replace All",GotoHeader:"Go To",GotoSpecialHeader:"Go To Special",Sheet:"Sheet",Workbook:"Workbook",NoElements:"We couldn't find what you were looking for.",FindWhat:"Find what",ReplaceWith:"Replace with",Cut:"Cut",Copy:"Copy",Paste:"Paste",PasteSpecial:"Paste Special",Link:"Link",SpreadsheetHyperlink:"SpreadsheetHyperlink",Hyperlink:"Hyperlink",EditHyperlink:"Edit Hyperlink",OpenHyperlink:"Open Hyperlink",RemoveHyperlink:"Remove Hyperlink",InvalidHyperlinkAlert:"The address of this site is not valid. Check the address and try again.",InsertLink:"Insert Link",EditLink:"Edit Link",All:"All",Values:"Values",Formats:"Formats",Bold:"Bold",Font:"Font",FontSize:"Font Size",Italic:"Italic",Underline:"Underline",Strikethrough:"Strikethrough",TextColor:"Text Color",FillColor:"Fill Color",HorizontalAlignment:"Horizontal Alignment",AlignLeft:"Align Left",AlignCenter:"Center",AlignRight:"Align Right",VerticalAlignment:"Vertical Alignment",AlignTop:"Align Top",AlignMiddle:"Align Middle",AlignBottom:"Align Bottom",WrapText:"Wrap Text",MergeCells:"Merge Cells",MergeAll:"Merge All",MergeHorizontally:"Merge Horizontally",MergeVertically:"Merge Vertically",Unmerge:"Unmerge",UnmergeCells:"Unmerge Cells",SelectMergeType:"Select Merge Type",MergeCellsAlert:"Merging cells will only preserve the top-leftmost(Uppermost) value. Merge anyway?",PasteMergeAlert:'We can"t do that to a merge cell.',Borders:"Borders",TopBorders:"Top Borders",LeftBorders:"Left Borders",RightBorders:"Right Borders",BottomBorders:"Bottom Borders",AllBorders:"All Borders",HorizontalBorders:"Horizontal Borders",VerticalBorders:"Vertical Borders",OutsideBorders:"Outside Borders",InsideBorders:"Inside Borders",NoBorders:"No Borders",BorderColor:"Border Color",BorderStyle:"Border Style",InsertFunction:"Insert Function",Insert:"Insert",Delete:"Delete",Rename:"Rename",Hide:"Hide",Unhide:"Unhide",NameBox:"Name Box",ShowHeaders:"Show Headers",HideHeaders:"Hide Headers",ShowGridLines:"Show Gridlines",HideGridLines:"Hide Gridlines",FreezePanes:"Freeze Panes",FreezeRows:"Freeze Rows",FreezeColumns:"Freeze Columns",UnfreezePanes:"Unfreeze Panes",UnfreezeRows:"Unfreeze Rows",UnfreezeColumns:"Unfreeze Columns",AddSheet:"Add Sheet",ListAllSheets:"List All Sheets",FullScreen:"Full Screen",CollapseToolbar:"Collapse Toolbar",ExpandToolbar:"Expand Toolbar",CollapseFormulaBar:"Collapse Formula Bar",ExpandFormulaBar:"Expand Formula Bar",File:"File",Home:"Home",Formulas:"Formulas",View:"View",New:"New",Open:"Open",SaveAs:"Save As",Update:"Update",ExcelXlsx:"Microsoft Excel",ExcelXls:"Microsoft Excel 97-2003",CSV:"Comma-separated values",FormulaBar:"Formula Bar",Sort:"Sort",SortAscending:"Ascending",SortDescending:"Descending",CustomSort:"Custom Sort",AddColumn:"Add Column",ContainsHeader:"Data contains header",CaseSensitive:"Case sensitive",SortBy:"Sort by",ThenBy:"Then by",SelectAColumn:"Select a column",SortEmptyFieldError:"Sort criteria column should not be empty.",SortDuplicateFieldError:" is mentioned more than once. Duplicate columns must be removed.",SortOutOfRangeError:"Select a cell or range inside the used range and try again.",SortAndFilter:"Sort & Filter",Filter:"Filter",ClearAllFilter:"Clear",ClearFilterFrom:"Clear Filter From ",ReapplyFilter:"Reapply",FilterCellValue:"Filter by Value of Selected Cell",FilterOutOfRangeError:"Select a cell or range inside the used range and try again.",HideRow:"Hide Row",HideRows:"Hide Rows",UnHideRows:"UnHide Rows",HideColumn:"Hide Column",HideColumns:"Hide Columns",UnHideColumns:"UnHide Columns",InsertRow:"Insert Row",InsertRows:"Insert Rows",Above:"Above",Below:"Below",InsertColumn:"Insert Column",InsertColumns:"Insert Columns",Before:"Before",After:"After",DeleteRow:"Delete Row",DeleteRows:"Delete Rows",DeleteColumn:"Delete Column",DeleteColumns:"Delete Columns",Ok:"Ok",Close:"Close",Cancel:"Cancel",Apply:"Apply",MoreColors:"More Colors",StandardColors:"Standard Colors",General:"General",Number:"Number",Currency:"Currency",Accounting:"Accounting",ShortDate:"Short Date",LongDate:"Long Date",Time:"Time",Percentage:"Percentage",Fraction:"Fraction",Scientific:"Scientific",Text:"Text",MobileFormulaBarPlaceHolder:"Enter value or Formula",NumberFormat:"Number Format",PasteAlert:"You can't paste this here, because the copy area and paste area aren't in the same size. Please try pasting in a different range.",DestroyAlert:"Are you sure you want to destroy the current workbook without saving and create a new workbook?",SheetRenameInvalidAlert:"Sheet name contains invalid character.",SheetRenameEmptyAlert:"Sheet name cannot be empty.",SheetRenameAlreadyExistsAlert:"Sheet name already exists. Please enter another name.",DeleteSheetAlert:"You can't undo deleting sheets, and you might be removing some data. If you don't need it, click OK to delete.",DeleteSingleLastSheetAlert:"A Workbook must contain at least one visible worksheet.",PickACategory:"Pick a category",Description:"Description",UnsupportedFile:"Unsupported File",InvalidUrl:"Invalid URL",SUM:"Adds a series of numbers and/or cells.",SUMIF:"Adds the cells based on specified condition.",SUMIFS:"Adds the cells based on specified conditions.",ABS:"Returns the value of a number without its sign.",RAND:"Returns a random number between 0 and 1.",RANDBETWEEN:"Returns a random integer based on specified values.",FLOOR:"Rounds a number down to the nearest multiple of a given factor.",CEILING:"Rounds a number up to the nearest multiple of a given factor.",PRODUCT:"Multiplies a series of numbers and/or cells.",INT:"Returns a number to the nearest integer.",ROUNDUP:"Rounds a number away from zero.",SUMPRODUCT:"Returns sum of the product of given ranges of arrays.",SORT:"Sorts a range of an array",TODAY:"Returns the current date as date value.",AVERAGE:"Calculates average for the series of numbers and/or cells excluding text.",AVERAGEIF:"Calculates average for the cells based on specified criterion.",AVERAGEIFS:"Calculates average for the cells based on specified conditions.",AVERAGEA:"Calculates the average for the cells evaluating TRUE as 1, text and FALSE as 0.",COUNT:"Counts the cells that contain numeric values in a range.",COUNTIF:"Counts the cells based on specified condition.",COUNTIFS:"Counts the cells based on specified conditions.",COUNTA:"Counts the cells that contains values in a range.",MIN:"Returns the smallest number of the given arguments.",MAX:"Returns the largest number of the given arguments.",DATE:"Returns the date based on given year, month, and day.",DAY:"Returns the day from the given date.",DAYS:"Returns the number of days between two dates.",IF:"Returns value based on the given expression.",IFS:"Returns value based on the given multiple expressions.",CalculateAND:"Returns TRUE if all the arguments are TRUE, otherwise returns FALSE.",CalculateOR:"Returns TRUE if any of the arguments are TRUE, otherwise returns FALSE.",IFERROR:"Returns value if no error found else it will return specified value.",CHOOSE:"Returns a value from list of values, based on index number.",INDEX:"Returns a value of the cell in a given range based on row and column number.",FIND:"Returns the position of a string within another string, which is case sensitive",TEXT:"Converts a value to text in specified number format.",CONCATENATE:"Combines two or more strings together.",CONCAT:"Concatenates a list or a range of text strings.",SUBTOTAL:"Returns subtotal for a range using the given function number.",RADIANS:"Converts degrees into radians.",MATCH:"Returns the relative position of a specified value in given range.",LN:"Returns the natural logarithm of a number.",INTERCEPT:"Calculates the point of the Y-intercept line via linear regression.",SLOPE:"Returns the slope of the line from linear regression of the data points.",DefineNameExists:"This name already exists, try different name.",DefineNameInValid:"The name that you entered is not valid.",CircularReference:"When a formula refers to one or more circular references, this may result in an incorrect calculation.",ShowRowsWhere:"Show rows where:",OR:"OR",AND:"AND",CustomFilterDatePlaceHolder:"Choose a date",CustomFilterPlaceHolder:"Enter the value",CustomFilter:"Custom Filter",Between:"Between",DateTimeFilter:"DateTime Filters",Undo:"Undo",Redo:"Redo",DateFilter:"Date Filters",TextFilter:"Text Filters",NumberFilter:"Number Filters",ClearFilter:"Clear Filter",NoResult:"No Matches Found",FilterFalse:"False",FilterTrue:"True",Blanks:"Blanks",SelectAll:"Select All",GreaterThanOrEqual:"Greater Than Or Equal",GreaterThan:"Greater Than",LessThanOrEqual:"Less Than Or Equal",LessThan:"Less Than",NotEqual:"Not Equal",Equal:"Equal",Contains:"Contains",EndsWith:"Ends With",StartsWith:"Starts With",ClearButton:"Clear",FilterButton:"Filter",CancelButton:"Cancel",OKButton:"OK",Search:"Search",ProtectSheet:"Protect Sheet",UnprotectSheet:"Unprotect Sheet",LockCells:"Lock Cells",SelectCells:"Select cells",FormatCells:"Format cells",FormatRows:"Format rows",FormatColumns:"Format columns",InsertLinks:"Insert links",ProtectContent:"Protect the contents of locked cells",ProtectAllowUser:" Allow all users of this worksheet to:",EditAlert:"The cell you're trying to change is protected. To make change, unprotect the sheet.",SearchWithin:"Search within",SearchBy:"Search by",Reference:"Reference",DataValidation:"Data Validation",CLEARALL:"CLEAR ALL",APPLY:"APPLY",CellRange:"Cell Range",Allow:"Allow",Data:"Data",Minimum:"Minimum",Maximum:"Maximum",IgnoreBlank:"Ignore blank",WholeNumber:"Whole Number",Decimal:"Decimal",Date:"Date",TextLength:"Text Length",List:"List",NotBetween:"Not between",EqualTo:"Equal to",NotEqualTo:"Not equal to",Greaterthan:"Greater than",Lessthan:"Less than",GreaterThanOrEqualTo:"Greater than or equal to",LessThanOrEqualTo:"Less than or equal to",InCellDropDown:"In-cell-dropdown",Sources:"Sources",Value:"Value",Retry:"Retry",EnterValue:"Enter value",DialogError:"The list source must be a reference to single row or column.",ListLengthError:"The list values allows only upto 256 charcters",ValidationError:"This value doesn't match the data validation restrictions defined for the cell.",EmptyError:"You must enter a value",ClearHighlight:"Clear Highlight",HighlightInvalidData:"Highlight Invalid Data",ClearValidation:"Clear Validation",HighlightCellsRules:"Highlight Cells Rules",CFEqualTo:"Equal To",TextThatContains:"Text that Contains",ADateOccuring:"A Date Occuring",DuplicateValues:"Duplicate Values",TopBottomRules:"Top/Bottom Rules",Top10Items:"Top 10 Items",Top10:"Top 10",Bottom10Items:"Bottom 10 Items",Bottom10:"Bottom 10",AboveAverage:"Above Average",BelowAverage:"Below Average",FormatCellsGreaterThan:"Format cells that are GREATER THAN:",FormatCellsLessThan:"Format cells that are LESS THAN:",FormatCellsBetween:"Format cells that are BETWEEN:",FormatCellsEqualTo:"Format cells that are EQUAL TO:",FormatCellsThatContainTheText:"Format cells that contain the text:",FormatCellsThatContainADateOccurring:"Format cells that contain a date occurring:",FormatCellsDuplicate:"Format cells that contain:",FormatCellsTop:"Format cells that rank in the TOP:",FormatCellsBottom:"Format cells that rank in the BOTTOM:",FormatCellsAbove:"Format cells that are ABOVE AVERAGE:",FormatCellsBelow:"Format cells that are BELOW AVERAGE:",With:"with",DataBars:"Data Bars",ColorScales:"Color Scales",IconSets:"Icon Sets",ClearRules:"Clear Rules",SelectedCells:"Clear Rules from Selected Cells",EntireSheet:"Clear Rules from Entire Sheet",ISNUMBER:"Returns true when the value parses as a numeric value.",ROUND:"Rounds a number to a specified number of digits.",GEOMEAN:"Returns the geometric mean of an array or range of positive data.",POWER:"Returns the result of a number raised to power",LOG:"Returns the logarithm of a number to the base that you specify.",TRUNC:"Returns the truncated value of a number to a specified number of decimal places.",EXP:"Returns e raised to the power of the given number.",Clear:"Clear",ClearContents:"Clear Contents",ClearAll:"Clear All",ClearFormats:"Clear Formats",ClearHyperlinks:"Clear Hyperlinks",LightRedFillWithDarkRedText:"Light Red Fill with Dark Red Text",YellowFillWithDarkYellowText:"Yellow Fill with Dark Yellow Text",GreenFillWithDarkGreenText:"Green Fill with Dark Green Text",RedFill:"Red Fill",RedText:"Red Text",Duplicate:"Duplicate",Unique:"Unique",And:"and",WebPage:"WEB PAGE",ThisDocument:"THIS DOCUMENT",DisplayText:"Display Text",Url:"URL",CellReference:"Cell Reference",DefinedNames:"Defined Names",EnterTheTextToDisplay:"Enter the text to display",EnterTheUrl:"Enter the URL",Image:"Image",ConditionalFormatting:"Conditional Formatting",BlueDataBar:"Blue Data Bar",GreenDataBar:"Green Data Bar",RedDataBar:"Red Data Bar",OrangeDataBar:"Orange Data Bar",LightblueDataBar:"Light blue Data Bar",PurpleDataBar:"Purple Data Bar",GYRColorScale:"Green - Yellow - Red Color Scale",RYGColorScale:"Red - Yellow - Green Color Scale",GWRColorScale:"Green - White - Red Color Scale",RWGColorScale:"Red - White - Green Color Scale",BWRColorScale:"Blue - White - Red Color Scale",RWBColorScale:"Red - White - Blue Color Scale",WRColorScale:"White - Red Color Scale",RWColorScale:"Red - White Color Scale",GWColorScale:"Green - White Color Scale",WGColorScale:"White - Green Color Scale",GYColorScale:"Green - Yellow Color Scale",YGColorScale:"Yellow - Green Color Scale",ThreeArrowsColor:"3 Arrows (Colored)",ThreeArrowsGray:"3 Arrows (Gray)",ThreeTriangles:"3 Triangles",FourArrowsColor:"4 Arrows (Gray)",FourArrowsGray:"4 Arrows (Colored)",FiveArrowsColor:"5 Arrows (Gray)",FiveArrowsGray:"5 Arrows (Colored)",ThreeTrafficLights1:"3 Traffic Lights (Unrimmed)",ThreeTrafficLights2:"3 Traffic Lights (Rimmed)",ThreeSigns:"3 Signs",FourTrafficLights:"4 Traffic Lights",RedToBlack:"Red To Black",ThreeSymbols1:"3 Symbols (Circled)",ThreeSymbols2:"3 Symbols (Uncircled)",ThreeFlags:"3 Flags",ThreeStars:"3 Stars",FourRatings:"4 Ratings",FiveQuarters:"5 Quarters",FiveRatings:"5 Ratings",FiveBoxes:"5 Boxes",Chart:"Chart",Column:"Column",Bar:"Bar",Area:"Area",Pie:"Pie",Doughnut:"Doughnut",PieAndDoughnut:"Pie/Doughnut",Line:"Line",Radar:"Radar",Scatter:"Scatter",ChartDesign:"Chart Design",ClusteredColumn:"Clustered Column",StackedColumn:"Stacked Column",StackedColumn100:"100% Stacked Column",ClusteredBar:"Clustered Bar",StackedBar:"Stacked Bar",StackedBar100:"100% Stacked Bar",StackedArea:"Stacked Area",StackedArea100:"100% Stacked Area",StackedLine:"Stacked Line",StackedLine100:"100% Stacked Line",AddChartElement:"Add Chart Element",Axes:"Axes",AxisTitle:"Axis Title",ChartTitle:"Chart Title",DataLabels:"Data Labels",Gridlines:"Gridlines",Legends:"Legends",PrimaryHorizontal:"Primary Horizontal",PrimaryVertical:"Primary Vertical",None:"None",AboveChart:"Above Chart",Center:"Center",InsideEnd:"Inside End",InsideBase:"Inside Base",OutsideEnd:"OutSide End",PrimaryMajorHorizontal:"Primary Major Horizontal",PrimaryMajorVertical:"Primary Major Vertical",PrimaryMinorHorizontal:"Primary Minor Horizontal",PrimaryMinorVertical:"Primary Minor Vertical",Right:"Right",Left:"Left",Bottom:"Bottom",Top:"Top",SwitchRowColumn:"Switch Row/Column",ChartTheme:"Chart Theme",ChartType:"Chart Type",Material:"Material",Fabric:"Fabric",Bootstrap:"Bootstrap",HighContrastLight:"HighContrast Light",MaterialDark:"Material Dark",FabricDark:"Fabric Dark",HighContrast:"HighContrast",BootstrapDark:"Bootstrap Dark",Bootstrap4:"Bootstrap4",VerticalAxisTitle:"Vertical Axis Title",HorizontalAxisTitle:"Horizontal Axis Title",EnterTitle:"Enter Title",ProtectWorkbook:"Protect Workbook",Password:"Password (optional):",unProtectPassword:"Password",EnterThePassword:"Enter the password",ConfirmPassword:"Confirm Password",EnterTheConfirmPassword:"Re-enter your password",PasswordAlert:"Confirmation password is not identical",UnProtectWorkbook:"Unprotect Workbook",UnProtectPasswordAlert:"The password you supplied is not correct.",InCorrectPassword:"Unable to open the file or worksheet with the given password",PasswordAlertMsg:"Please enter the password",ConfirmPasswordAlertMsg:"Please enter the confirm password",IsProtected:"is protected",PDF:"PDF document"},Di=function(){function e(e){this.colGroupWidth=30,this.parent=e,this.col=e.createElement("col"),this.rowRenderer=e.serviceLocator.getService("row"),this.cellRenderer=e.serviceLocator.getService("cell"),this.addEventListener()}return e.prototype.refreshSelectALLContent=function(){var e,t=this.parent.getActiveSheet();if(t.frozenColumns||t.frozenRows){var r=this.getSelectAllTable().querySelector("thead"),n=this.rowRenderer.render();r.appendChild(n),e=this.parent.createElement("th",{className:"e-select-all-cell"}),n.appendChild(e)}else(e=this.headerPanel.firstElementChild).classList.add("e-select-all-cell");e.appendChild(this.parent.createElement("button",{className:"e-selectall e-icons",id:this.parent.element.id+"_select_all"}))},e.prototype.updateLeftColGroup=function(e,t){e&&(this.colGroupWidth=e),t||(t=this.getRowHeaderPanel());var r,n=t.querySelector("table"),i=this.parent.getActiveSheet();if(e)n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px";else{r=this.parent.createElement("colgroup");var a=this.col.cloneNode();a.style.width=this.colGroupWidth+"px",r.appendChild(a),n.insertBefore(r,n.querySelector("tbody"))}(i.frozenRows||i.frozenColumns)&&(n=this.getSelectAllTable(),e?n.querySelector("colgroup").firstElementChild.style.width=this.colGroupWidth+"px":n.insertBefore(r.cloneNode(!0),n.querySelector("thead"))),this.setPanelWidth(i,t),this.setPanelHeight(i)},e.prototype.setPanelWidth=function(e,r){var n=this.getScrollSize(),i=this.getRowHeaderWidth(e),a=this.parent.enableRtl?"right":"left";if(e.frozenColumns){var o=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-column")[0];o.style.height="calc(100% - "+n+"px)",o.style[a]=i-et(1)+"Px",o.style.display=""}this.setHeaderPanelWidth(this.getSelectAllContent(),i),this.getColHeaderPanel().style.width="calc(100% - "+i+"px)",this.getColHeaderPanel().style[a]=i+"px",this.setHeaderPanelWidth(r,i),this.getContentPanel().style.width="calc(100% - "+i+"px)",this.getContentPanel().style[a]=i+"px";var s=this.contentPanel.nextElementSibling?this.contentPanel.nextElementSibling:null;s&&(n?s.style.height=n+2+"px":(s.style.height="1px",s.style.borderTopWidth="0px"),(s=s.firstElementChild).style[a]=i+"px",s.style.width="calc(100% - "+i+"px)",t.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===t.Browser.info.name&&(s.style.height="7px",s.style.top="-7px"))},e.prototype.getScrollSize=function(){var e=this.parent.enableRtl?"margin-left":"margin-right";return parseInt(this.headerPanel.style[e],10)?parseInt(this.headerPanel.style[e],10):0},e.prototype.setHeaderPanelWidth=function(e,t){[].slice.call(e.querySelectorAll("col.e-empty")).forEach(function(e){t+=parseInt(e.style.width,10)}),e.style.width=t+"px"},e.prototype.setPanelHeight=function(e){var r=this.getScrollSize();if(e.frozenRows){var n=u(e.topLeftCell)[0],i=(e.showHeaders?et(31):0)+we(e,n,n+e.frozenRows-1,!0);e.showHeaders||e.frozenColumns?this.headerPanel.style.height="":this.headerPanel.style.height=i+"px",this.contentPanel.style.height="calc(100% - "+(i+r)+"px)";var a=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0];a.style.width=t.Browser.isDevice?"100%":"calc(100% - "+r+"px)",a.style.top=i-1-(e.showHeaders?1:0)+"px",a.style.display=""}else this.contentPanel.style.height="calc(100% - "+((e.showHeaders?31:0)+r)+"px)"},e.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel"});var e=this.parent.getActiveSheet(),r=this.parent.element.id;this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-row-header",id:r+"_row_header"})),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding();var n=document.getElementById(this.parent.element.id+"_sheet");e.frozenColumns&&n.classList.add("e-frozen-columns"),e.frozenRows&&n.classList.add("e-frozen-rows"),this.updateHideHeaders(e,n),e.showGridLines||n.classList.add("e-hide-gridlines");var i=this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-sheet-content",id:r+"_main_content"}));this.parent.allowScrolling||(i.style.overflow="hidden"),e.frozenRows&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),e.frozenColumns&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),t.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===t.Browser.info.name&&n.classList.add("e-mac-safari")},e.prototype.initHeaderPanel=function(){var e=this.parent.element.id;this.headerPanel=this.parent.createElement("div",{className:"e-header-panel"}),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-selectall-container",id:e+"_selectall"})),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-column-header",id:e+"_col_header"}))},e.prototype.createHeaderTable=function(){var e=this.contentPanel.querySelector(".e-row-header"),t=this.parent.getActiveSheet();(t.frozenRows||t.frozenColumns)&&this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"selectall",this.headerPanel.querySelector(".e-selectall-container")),this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"colhdr",this.headerPanel.querySelector(".e-column-header")),this.updateTable(["tbody"],"rowhdr",e),this.updateLeftColGroup(null,e)},e.prototype.updateTable=function(e,t,r){var n=this,i=this.parent.createElement("table",{className:"e-table",attrs:{role:"grid"}});i.classList.add("e-"+t+"-table"),r.appendChild(i),e.forEach(function(e){i.appendChild(n.parent.createElement(e))})},e.prototype.renderTable=function(e){var r,n,i,a=this,o=this.parent.getActiveSheet(),s=document.createDocumentFragment();if(s.appendChild(this.headerPanel),s.appendChild(this.contentPanel),this.parent.allowScrolling){var l=this.parent.createElement("div",{className:"e-scrollbar"});l.appendChild(this.parent.createElement("div",{className:"e-scroller"})),s.appendChild(l)}this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild);var h,d=this.parent.createElement("colgroup"),p=this.contentPanel.querySelector(".e-sheet-content tbody");this.refreshSelectALLContent();var u=this.getSelectAllContent().querySelector("colgroup"),f=this.getRowHeaderPanel().querySelector("colgroup"),g=this.getSelectAllContent().querySelector("thead .e-header-row"),m=this.contentPanel.querySelector(".e-row-header tbody"),v=this.getSelectAllContent().querySelector("tbody"),y=this.headerPanel.querySelector(".e-column-header thead"),C=this.headerPanel.querySelector(".e-column-header tbody"),b=this.rowRenderer.render();y.appendChild(b),this.getColHeaderTable().insertBefore(d,y);var S=this.parent.frozenRowCount(o),x=this.parent.frozenColCount(o);this.parent.notify("beforeContentLoaded",{top:e.top,left:e.left});var w=o.colCount.toString(),I=o.colCount.toString(),E=e.top&&e.left?"RowColumn":e.top?"Row":e.left?"Column":"";this.parent.getColHeaderTable().setAttribute("aria-colcount",w),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",I);var R;t.attributes(this.parent.getContentTable(),{"aria-rowcount":I,"aria-colcount":w}),e.cells.forEach(function(t,s){if((r=c(s))[1]!==e.indexes[1]&&n||(i=a.rowRenderer.render(r[0],!0),x&&S&&r[1]<x&&r[0]<S?((R=v.querySelector(".e-empty"))?v.insertBefore(i,R):v.appendChild(i),n=i):x&&r[1]<x?(m.appendChild(i),n=i):(n=a.rowRenderer.render(r[0]),S&&r[0]<S?(R=C.querySelector(".e-empty"))?C.insertBefore(n,R):C.appendChild(n):p.appendChild(n),r[1]===e.indexes[1]&&(S&&r[0]<S?v.appendChild(i):m.appendChild(i))),r[1]===e.indexes[1]&&i.appendChild(a.cellRenderer.renderRowHeader(r[0]))),n.appendChild(a.cellRenderer.render({colIdx:r[1],rowIdx:r[0],cell:t,address:s,lastCell:r[1]===e.indexes[3],isHeightCheckNeeded:!0,row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isRefreshing:e.isRefreshing,first:E?E.includes("Row")?r[0]===e.indexes[0]?"Row":E.includes("Column")&&r[1]===e.indexes[1]?"Column":"":r[1]===e.indexes[1]?"Column":"":""})),x&&r[1]===x-1&&(n=null),r[0]===e.indexes[0])if(x&&r[1]<x){h=a.updateCol(o,r[1],u);var l=f.querySelector(".e-empty");l?f.insertBefore(h.cloneNode(!0),l):f.appendChild(h.cloneNode(!0)),g.appendChild(a.cellRenderer.renderColHeader(r[1]))}else a.updateCol(o,r[1],d),b.appendChild(a.cellRenderer.renderColHeader(r[1]))}),this.parent.isReact&&this.parent.renderReactTemplates(),p.parentElement.insertBefore(d.cloneNode(!0),p),Le(function(){var t=a.parent.getMainContent(),r=document.getElementById(a.parent.element.id+"_sheet");if(r.appendChild(s),r.style.backgroundColor="",e.top&&(t.parentElement.scrollTop=e.top),e.left&&(t.scrollLeft=e.left,a.parent.getColumnHeaderContent().scrollLeft=e.left,a.parent.allowScrolling&&(a.parent.getScrollElement().scrollLeft=e.left)),a.parent.notify("contentLoaded",e),a.checkTableWidth(o),a.parent.notify(Wt,{action:"renderEditor"}),e.initLoad||a.parent.isOpen||a.parent.hideSpinner(),tt(t,{busy:!1}),a.parent.trigger("dataBound",{}),a.parent.isEdit&&a.parent.notify("initiateEdit",null),e.initLoad){var n=!0;if(a.parent.scrollSettings.enableVirtualization)for(var i=0;i<o.ranges.length;i++)if(o.ranges[i].info.count-1>a.parent.viewport.bottomIndex){n=!1;break}n&&a.triggerCreatedEvent()}})},e.prototype.triggerCreatedEvent=function(){this.parent.isOpen||this.parent.hideSpinner(),this.parent.createdHandler&&(this.parent.createdHandler.observers?this.parent.created.observers=this.parent.createdHandler.observers:this.parent.setProperties({created:this.parent.createdHandler},!0),this.parent.createdHandler=void 0,this.parent.trigger("created",null),this.parent.notify("clearUndoRedoCollection",null))},e.prototype.checkTableWidth=function(e){if(this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex){var t=ke(e,this.parent.viewport.leftIndex+this.parent.frozenColCount(e),this.parent.viewport.rightIndex),r=this.getRowHeaderWidth(e),n=this.getScrollSize();t<this.contentPanel.getBoundingClientRect().width-r-n?(this.getContentPanel().style.width=t+"px",this.getColHeaderPanel().style.width=t+"px"):this.getContentPanel().style.width.includes("calc")||(this.getContentPanel().style.width="calc(100% - "+r+"px)",this.getColHeaderPanel().style.width="calc(100% - "+r+"px)")}},e.prototype.refreshColumnContent=function(e){var t,r,n,i,a,o=this,s=0,l=this.parent.getActiveSheet(),h=document.createDocumentFragment(),d=document.createDocumentFragment(),p=this.parent.element.querySelector(".e-sheet-content tbody"),u=this.parent.element.querySelector(".e-column-header tbody"),f=this.parent.element.querySelector(".e-sheet-content colgroup");f=f.cloneNode(),h.appendChild(f),p=h.appendChild(p.cloneNode(!0));var g=f.cloneNode();d.appendChild(g);var m;m=this.parent.element.querySelector(".e-column-header thead");var v=(m=d.appendChild(m.cloneNode(!0))).querySelector("tr");v.innerHTML="";var y=this.parent.frozenRowCount(l),C=this.parent.frozenColCount(l);y&&(u=d.appendChild(u.cloneNode(!0))),e.cells.forEach(function(n,h){if((t=c(h))[0]===e.indexes[0]&&(a=o.updateCol(l,t[1],g),f.appendChild(a.cloneNode()),v.appendChild(o.cellRenderer.renderColHeader(t[1]))),t[1]-C===e.indexes[1]){if(!(r=t[0]<y?u.children[s]:p.children[s]))return;r.innerHTML="",s++}i=r.appendChild(o.cellRenderer.render({colIdx:t[1],rowIdx:t[0],cell:n,address:h,row:r,pRow:r.previousSibling,first:e.skipUpdateOnFirst||t[1]!==e.indexes[1]?o.parent.scrollSettings.enableVirtualization&&t[0]===e.indexes[0]&&o.parent.viewport.topIndex!==yt(l,0,!0)?"Row":"":"Column"})),o.checkColMerge(t,e.indexes,i,n),y&&t[0]===y-1&&(s=0)}),Le(function(){Ne(n=o.getColHeaderTable()),n.appendChild(d),Ne(n=o.getContentTable()),n.appendChild(h),o.parent.notify("virtualContentLoaded",{refresh:"Column",prevRowColCnt:e.prevRowColCnt}),o.parent.isEdit&&o.parent.notify("forRefSelRender",{}),o.parent.allowChart&&o.parent.notify("chartRangeSelection",null),o.parent.isOpen||o.parent.hideSpinner(),tt(o.parent.getMainContent(),{busy:!1})})},e.prototype.refreshRowContent=function(e){var r,n,i,a,o=this,s=this.colGroupWidth,l=this.parent.getActiveSheet(),h=document.createDocumentFragment(),d=this.parent.createElement("tbody"),p=document.createDocumentFragment(),u=d.cloneNode();p.appendChild(u),h.appendChild(d);var f=this.parent.frozenColCount(l);e.cells.forEach(function(t,h){(r=c(h))[1]!==e.indexes[1]&&n||(i=o.rowRenderer.render(r[0],!0),f&&r[1]<f?(u.appendChild(i),n=i):(r[1]===e.indexes[1]&&u.appendChild(i),n=o.rowRenderer.render(r[0]),d.appendChild(n)),r[1]===e.indexes[1]&&(i.appendChild(o.cellRenderer.renderRowHeader(r[0])),s=De(r[0]+1))),a=n.appendChild(o.cellRenderer.render({rowIdx:r[0],colIdx:r[1],cell:t,address:h,lastCell:r[1]===e.indexes[3],row:n,hRow:i,pRow:n.previousSibling,pHRow:i.previousSibling,isHeightCheckNeeded:!0,first:e.skipUpdateOnFirst||r[0]!==e.indexes[0]?o.parent.scrollSettings.enableVirtualization&&r[1]===e.indexes[1]&&o.parent.viewport.leftIndex!==yt(l,0,!0,"columns")?"Column":"":"Row"})),o.checkRowMerge(r,e.indexes,a,t),f&&r[1]===f-1&&(n=null)}),this.colGroupWidth!==s&&this.updateLeftColGroup(s),this.contentPanel.querySelector(".e-row-header tbody")&&(t.detach(this.contentPanel.querySelector(".e-row-header tbody")),this.getRowHeaderTable().appendChild(p)),this.contentPanel.querySelector(".e-sheet-content tbody")&&(t.detach(this.contentPanel.querySelector(".e-sheet-content tbody")),this.getContentTable().appendChild(h)),this.parent.notify("virtualContentLoaded",{refresh:"Row",prevRowColCnt:e.prevRowColCnt}),this.parent.allowChart&&this.parent.notify("chartRangeSelection",{}),this.parent.isEdit&&this.parent.notify("forRefSelRender",null),this.parent.isOpen||this.parent.hideSpinner(),tt(this.parent.getMainContent(),{busy:!1})},e.prototype.updateCol=function(e,r,n){var i=this.col.cloneNode();if(i.style.width=t.formatUnit(Re(e,r,null,!0)),n){var a=n.querySelector(".e-empty");return a?n.insertBefore(i,a):n.appendChild(i)}return i},e.prototype.updateColContent=function(e){var r=this;Le(function(){var n,i,a,o,s,l,h=0,d=r.parent.getActiveSheet(),p=r.parent.element.querySelector(".e-column-header .e-header-row"),u=p.firstElementChild,f=r.parent.element.querySelector(".e-sheet-content colgroup"),g=r.parent.element.querySelector(".e-column-header colgroup"),m=f.firstElementChild,v=g.firstElementChild,y=r.parent.element.querySelector(".e-sheet-content tbody"),C=r.parent.element.querySelector(".e-column-header tbody"),b=r.parent.frozenRowCount(d),S=r.parent.frozenColCount(d);e.cells.forEach(function(x,w){if(!l){if(n=c(w),"first"===e.direction&&n[1]===e.indexes[1]&&r.checkColMerge([n[0],r.parent.viewport.leftIndex+S],e.indexes,((n[0]<b?C:y).rows[h]||{cells:[]}).cells[e.indexes[3]-e.indexes[1]+1],$(n[0],r.parent.viewport.leftIndex+S,d)||{}),n[0]===e.indexes[0]&&("last"===e.direction?((s=r.col.cloneNode()).style.width=t.formatUnit(Re(d,n[1],null,!0)),f.insertBefore(s,m),g.insertBefore(s.cloneNode(),v),p.insertBefore(r.cellRenderer.renderColHeader(n[1]),u)):(s=r.updateCol(d,n[1],f),g.appendChild(s.cloneNode()),p.appendChild(r.cellRenderer.renderColHeader(n[1]))),r.parent.scrollSettings.enableVirtualization&&e.direction&&(t.detach(f[e.direction+"ElementChild"]),t.detach(g[e.direction+"ElementChild"]),t.detach(p[e.direction+"ElementChild"]))),n[1]===e.indexes[1]){if(n[0]<b)i=C.children[h];else if(!(i=y.children[h]))return void(l=!0);h++,a=i.firstElementChild}o=r.cellRenderer.render({colIdx:n[1],rowIdx:n[0],cell:x,address:w,lastCell:n[1]===e.indexes[3],isHeightCheckNeeded:"first"===e.direction,first:"last"!==e.direction||e.skipUpdateOnFirst||n[1]!==e.indexes[1]?"":"Column",checkNextBorder:"last"===e.direction&&n[3]===e.indexes[3]?"Column":""}),"last"===e.direction?(r.checkColMerge(n,e.indexes,o,x,((n[0]<b?C:y).rows[h-1]||{cells:[]}).cells[0]),i.insertBefore(o,a)):i.appendChild(o),r.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(i[e.direction+"ElementChild"]),b&&n[0]===b-1&&(h=0)}}),r.parent.notify("virtualContentLoaded",{refresh:"Column",prevRowColCnt:e.prevRowColCnt}),r.parent.allowChart&&r.parent.notify("chartRangeSelection",null),r.parent.isEdit&&r.parent.notify("forRefSelRender",{}),r.parent.isOpen||r.parent.hideSpinner(),tt(r.parent.getMainContent(),{busy:!1})})},e.prototype.updateRowContent=function(e){var r,n,i,a,o=this,s=this.colGroupWidth,l=this.parent.getActiveSheet(),h=0,d=this.parent.getMainContent().querySelector("tbody"),p=this.parent.getRowHeaderContent().querySelector("tbody"),u=document.createDocumentFragment(),f=document.createDocumentFragment();this.parent.showSpinner();var g,m=this.parent.frozenColCount(l),v=this.parent.frozenRowCount(l);e.cells.forEach(function(y,C){a=c(C),"first"===e.direction&&a[0]===e.indexes[0]&&(void 0===g&&(g=(a[1]<m?p:d).rows[e.indexes[2]-e.indexes[0]+1]||null),o.checkRowMerge([o.parent.viewport.topIndex+v,a[1]],e.indexes,(g||{cells:[]}).cells[a[1]<m?h+1:h],$(o.parent.viewport.topIndex+v,a[1],l)||{})),a[1]!==e.indexes[1]&&r||(n=o.rowRenderer.render(a[0],!0),m&&a[1]<m?(u.appendChild(n),r=n):(r=o.rowRenderer.render(a[0]),f.appendChild(r),a[1]===e.indexes[1]&&u.appendChild(n),o.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(d[e.direction+"ElementChild"])),a[1]===e.indexes[1]&&(n.appendChild(o.cellRenderer.renderRowHeader(a[0])),s=De(a[0]+1),o.parent.scrollSettings.enableVirtualization&&e.direction&&t.detach(p[e.direction+"ElementChild"]))),i=r.appendChild(o.cellRenderer.render({colIdx:a[1],rowIdx:a[2],cell:y,address:C,lastCell:a[1]===e.indexes[3],row:r,pHRow:n.previousSibling,checkNextBorder:"last"===e.direction&&a[2]===e.indexes[2]?"Row":"",pRow:r.previousSibling,isHeightCheckNeeded:"first"===e.direction||""===e.direction,hRow:n,first:"last"!==e.direction||e.skipUpdateOnFirst||a[0]!==e.indexes[0]?"":"Row"})),"last"===e.direction&&d.rows.length&&o.checkRowMerge(a,e.indexes,i,y,(a[1]<m?p:d).rows[0].cells[a[1]<m?h+1:h]),h++,m&&a[1]===m-1&&(r=null,g=void 0,h=0)}),this.colGroupWidth!==s&&this.updateLeftColGroup(s),"last"===e.direction?(p.insertBefore(u,p.firstElementChild),d.insertBefore(f,d.firstElementChild)):(p.appendChild(u),d.appendChild(f)),this.parent.scrollSettings.enableVirtualization&&this.parent.notify("virtualContentLoaded",{refresh:"Row",prevRowColCnt:e.prevRowColCnt}),this.parent.isEdit&&this.parent.notify("forRefSelRender",null),this.parent.allowChart&&this.parent.notify("chartRangeSelection",{}),this.parent.isOpen||this.parent.hideSpinner(),tt(this.parent.getMainContent(),{busy:!1})},e.prototype.checkRowMerge=function(e,r,n,i,a){if(this.parent.scrollSettings.enableVirtualization&&n&&(!t.isNullOrUndefined(i.rowSpan)||!t.isNullOrUndefined(i.colSpan))){var o=this.parent.frozenRowCount(this.parent.getActiveSheet());if(e[0]===this.parent.viewport.topIndex+o){if(i.rowSpan<0){var s={td:n,rowIdx:e[0],colIdx:e[1],isRow:!0,isFreezePane:!0};if(this.parent.notify("checkMerge",s),s.insideFreezePane)return;this.parent.viewport.topIndex+o>=r[0]&&this.refreshPrevMerge(r[0]+1,e[1])}a&&(a.colSpan>1||a.rowSpan>1)&&this.cellRenderer.refresh(e[0]+(r[2]-r[0])+1,e[1],null,a)}else if(i.rowSpan>1){var l=r[2]+1;e[0]+i.rowSpan-1>l&&e[0]<l&&this.refreshPrevMerge(l,e[1],this.parent.viewport.topIndex+o)}}},e.prototype.refreshPrevMerge=function(e,t,r){var n=this.parent.getCell(e,t,this.parent.getRow(r||0,null,t));n&&n.rowSpan>1&&this.cellRenderer.refresh(e,t,null,n)},e.prototype.checkColMerge=function(e,r,n,i,a){if(this.parent.scrollSettings.enableVirtualization&&n&&e[1]===this.parent.viewport.leftIndex+this.parent.frozenColCount(this.parent.getActiveSheet())&&(!t.isNullOrUndefined(i.rowSpan)||!t.isNullOrUndefined(i.colSpan))){if(i.colSpan<0){var o={td:n,colIdx:e[1],rowIdx:e[0],isFreezePane:!0};if(this.parent.notify("checkMerge",o),o.insideFreezePane)return}a&&(a.colSpan>1||a.rowSpan>1)&&this.cellRenderer.refresh(e[0],e[1]+(r[3]-r[1])+1,null,a)}},e.prototype.showHideHeaders=function(){var e=this,t=this.parent.getActiveSheet();Le(function(){if(t.showHeaders){var r=e.getContentPanel();e.setPanelWidth(t,e.getRowHeaderPanel()),e.setPanelHeight(t),document.getElementById(e.parent.element.id+"_sheet").classList.remove("e-hide-headers"),e.getColHeaderPanel().scrollLeft=r.scrollLeft,e.parent.selectRange(t.selectedRange)}else{if(e.updateHideHeaders(t,document.getElementById(e.parent.element.id+"_sheet")),e.setPanelHeight(t),e.parent.frozenColCount(t)||e.parent.frozenRowCount(t))e.setPanelWidth(t,e.getRowHeaderPanel()),e.parent.selectRange(t.selectedRange);else{e.getContentPanel().style.width="";var n=e.parent.enableRtl?"right":"left";e.getContentPanel().style[n]=""}e.getScrollElement().style.left=e.getRowHeaderWidth(t)+"px"}})},e.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},e.prototype.rowHeightChange=function(e){if(e.threshold){var t=this.parent.getActiveSheet();e.rowIdx<this.parent.frozenRowCount(t)&&this.setPanelHeight(t)}},e.prototype.colWidthChange=function(e){if(e.threshold){var t=this.parent.getActiveSheet();e.colIdx<this.parent.frozenColCount(t)&&this.setPanelWidth(t,this.getRowHeaderPanel()),this.checkTableWidth(t)}},e.prototype.getRowHeaderWidth=function(e,t){var r=0;if(!t&&e.frozenColumns){var n=u(e.topLeftCell)[1];r=ke(e,n,n+e.frozenColumns-1,!0)}return r+=e.showHeaders?et(this.colGroupWidth):0},e.prototype.getColHeaderHeight=function(e,t){var r=u(e.topLeftCell)[0];return(e.showHeaders&&!t?31:0)+we(e,r,r+e.frozenRows-1,!0)},e.prototype.getSelectAllContent=function(){return this.headerPanel.getElementsByClassName("e-selectall-container")[0]},e.prototype.getScrollElement=function(){return(this.contentPanel.parentElement||this.contentPanel.nextElementSibling).querySelector(".e-scroller")},e.prototype.getSelectAllTable=function(){return this.headerPanel.getElementsByClassName("e-selectall-table")[0]},e.prototype.getColHeaderTable=function(){return this.headerPanel.getElementsByClassName("e-colhdr-table")[0]},e.prototype.getRowHeaderTable=function(){return this.contentPanel.getElementsByClassName("e-rowhdr-table")[0]},e.prototype.getContentTable=function(){return this.contentPanel.getElementsByClassName("e-content-table")[0]},e.prototype.getRowHeaderPanel=function(){return this.contentPanel.getElementsByClassName("e-row-header")[0]},e.prototype.getColHeaderPanel=function(){return this.headerPanel.getElementsByClassName("e-column-header")[0]},e.prototype.getContentPanel=function(){return this.contentPanel.getElementsByClassName("e-sheet-content")[0]},e.prototype.addEventListener=function(){this.parent.on("created",this.triggerCreatedEvent,this),this.parent.on(Qt,this.rowHeightChange,this),this.parent.on("colWidthChanged",this.colWidthChange,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off("created",this.triggerCreatedEvent),this.parent.off(Qt,this.rowHeightChange),this.parent.off("colWidthChanged",this.colWidthChange),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),Oi=function(){function e(e){this.parent=e,this.element=this.parent.createElement("tr",{attrs:{role:"row"}}),this.cellRenderer=e.serviceLocator.getService("cell")}return e.prototype.render=function(e,r,n){var i=this.element.cloneNode();if(void 0===e)return i.classList.add("e-header-row"),i;i.classList.add("e-row");var a=this.parent.getActiveSheet();return t.attributes(i,{"aria-rowindex":(e+1).toString()}),i.style.height=Se(a,e,!0)+"px",r&&!n&&(be(a,e+1)&&!be(a,e-1)&&i.classList.add("e-hide-start"),0!==e&&be(a,e-1)&&!be(a,e+1)&&i.classList.add("e-hide-end")),i},e.prototype.refresh=function(e,t,r,n){var i,a=this.parent.getActiveSheet();if(n)(i=this.render(e,!0,!0)).appendChild(this.cellRenderer.renderRowHeader(e));else{i=this.render(e);for(var o=this.parent.viewport.leftIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),s=this.parent.viewport.leftIndex;s<=o;s++)i.appendChild(this.cellRenderer.render({colIdx:s,rowIdx:e,cell:$(e,s,a),address:g(e,s),lastCell:s===o,row:i,hRow:r,isHeightCheckNeeded:!0,pRow:t,first:e===this.parent.viewport.topIndex&&yt(a,e,!0)!==yt(a,0,!0)?"Row":""}))}return i},e}(),Hi=function(){function e(e){this.parent=e,this.element=this.parent.createElement("td"),this.th=this.parent.createElement("th",{className:"e-header-cell"}),this.tableRow=e.createElement("tr",{className:"e-row"}),this.parent.on("updateView",this.updateView,this),this.parent.on("calculateFormula",this.calculateFormula,this)}return e.prototype.renderColHeader=function(e){var r=this.th.cloneNode();t.attributes(r,{role:"columnheader","aria-colindex":(e+1).toString(),tabindex:"-1"}),r.innerHTML=v(e+1);var n=this.parent.getActiveSheet();return Ae(n,e+1)&&r.classList.add("e-hide-start"),0!==e&&Ae(n,e-1)&&r.classList.add("e-hide-end"),r},e.prototype.renderRowHeader=function(e){var r=this.element.cloneNode();return t.addClass([r],"e-header-cell"),t.attributes(r,{role:"rowheader",tabindex:"-1"}),r.innerHTML=(e+1).toString(),r},e.prototype.render=function(e){var r,n=this.parent.getActiveSheet(),i=$(e.rowIdx,e.colIdx,n),a=Ie(n,e.colIdx);if(i&&i.validation?r=i.validation:a&&a.validation&&(r=a.validation),e.td=this.element.cloneNode(),e.td.className="e-cell",t.attributes(e.td,{role:"gridcell","aria-colindex":(e.colIdx+1).toString(),tabindex:"-1"}),this.checkMerged(e))return e.td;var o=this.processTemplates(e.cell,e.rowIdx,e.colIdx);"string"==typeof o?e.td.innerHTML=o:e.td.appendChild(o),e.isRefresh=!1,this.update(e),e.cell&&e.td&&(r&&r.isHighlighted&&this.parent.notify("addHighlight",{range:m([e.rowIdx,e.colIdx]),td:e.td}),this.parent.notify("cFRender",{rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell,td:e.td,isChecked:!1}),e.td&&e.td.children[0]&&"e-cf-databar"===e.td.children[0].className&&(e.cell.style&&e.cell.style.fontSize&&(e.td.children[0].querySelector(".e-databar-value").style.fontSize=e.cell.style.fontSize),e.td.children[0].style.height="100%",e.td.children[0].firstElementChild.nextElementSibling.style.height="100%")),st(this.parent,e.rowIdx,e.colIdx,this.parent.activeSheetIndex)||this.parent.notify("renderFilterCell",{td:e.td,rowIndex:e.rowIdx,colIndex:e.colIdx});var s={cell:e.cell,element:e.td,address:e.address};this.parent.trigger("beforeCellRender",s),this.updateRowHeight({rowIdx:e.rowIdx,cell:s.element,lastCell:e.lastCell,rowHgt:20,row:e.row,hRow:e.hRow});var l=e.td.classList.contains("e-wraptext"),h=e.td.innerHTML;return h.indexOf("\n")>-1&&!l&&h.split("\n").length>1&&this.parent.notify(At,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:!0,initial:!0,sheet:this.parent.getActiveSheet(),td:e.td,row:e.row,hRow:e.hRow}),s.element},e.prototype.update=function(e){var r=this.parent.getActiveSheet();if(e.isRefresh){if(e.td.rowSpan&&(this.mergeFreezeRow(r,e.rowIdx,e.colIdx,e.td.rowSpan,e.row,!0),e.td.removeAttribute("rowSpan")),e.td.colSpan&&(this.mergeFreezeCol(r,e.rowIdx,e.colIdx,e.td.colSpan,!0),e.td.removeAttribute("colSpan")),this.checkMerged(e))return;e.cell&&!e.cell.hyperlink&&e.td.querySelector(".e-hyperlink")&&e.td.removeChild(e.td.querySelector(".e-hyperlink"))}e.cell&&e.cell.formula&&(!e.cell.value||e.isRefreshing)&&this.calculateFormula(e);var n={type:e.cell&&H(e.cell.format),value:e.cell&&e.cell.value,format:e.cell&&e.cell.format?e.cell.format:"General",formattedText:e.cell&&e.cell.value,onLoad:!0,isRightAlign:!1,cell:e.cell,rowIdx:e.rowIdx.toString(),colIdx:e.colIdx.toString()};e.cell&&this.parent.notify("getFormattedCell",n),t.isNullOrUndefined(e.td)||this.parent.refreshNode(e.td,{type:n.type,result:n.formattedText,curSymbol:t.getNumberDependable(this.parent.locale,"USD"),isRightAlign:n.isRightAlign,value:n.value||""});var i={};if(e.cell){if(e.cell.style&&(i=e.cell.style.properties?J(e.cell.style,!0):e.cell.style),e.cell.chart&&e.cell.chart.length>0&&this.parent.notify(Ut,{chart:e.cell.chart,isInitCell:!0,range:g(e.rowIdx,e.colIdx)}),e.cell.hyperlink&&this.parent.notify("createHyperlinkElement",{cell:e.cell,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx}),e.cell.rowSpan>1){var a=e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1));a>1&&(e.td.rowSpan=a,this.mergeFreezeRow(r,e.rowIdx,e.colIdx,a,e.row))}if(e.cell.colSpan>1){var o=e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns");o>1&&(e.td.colSpan=o,this.mergeFreezeCol(r,e.rowIdx,e.colIdx,o))}if(e.cell.image)for(var s=0;s<e.cell.image.length;s++)e.cell.image[s]&&this.parent.notify(dr,{options:{src:e.cell.image[s].src,imageId:e.cell.image[s].id,height:e.cell.image[s].height,width:e.cell.image[s].width,top:e.cell.image[s].top,left:e.cell.image[s].left},range:m([e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]),isPublic:!1})}if(e.isRefresh&&this.removeStyle(e.td,e.rowIdx,e.colIdx),this.parent.allowChart&&e.lastCell&&this.parent.notify("refreshChart",{cell:e.cell,rIdx:e.rowIdx,cIdx:e.colIdx,sheetIdx:this.parent.activeSheetIndex}),(Object.keys(i).length||Object.keys(this.parent.commonCellStyle).length||e.lastCell)&&this.parent.notify(It,{style:t.extend({},this.parent.commonCellStyle,i),rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td,first:e.first,row:e.row,lastCell:e.lastCell,hRow:e.hRow,pRow:e.pRow,isHeightCheckNeeded:e.isHeightCheckNeeded,manualUpdate:e.manualUpdate}),this.parent.allowConditionalFormat&&e.lastCell&&this.parent.notify("checkConditionalFormat",{rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.cell}),"Row"===e.checkNextBorder){var l=this.parent.getCellStyleValue(["borderTop"],[Number(this.parent.getContentTable().rows[0].getAttribute("aria-rowindex"))-1,e.colIdx]).borderTop;""===l||e.cell&&e.cell.style&&e.cell.style.bottomPriority||this.parent.notify(It,{style:{borderBottom:l},rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td})}if("Column"===e.checkNextBorder){var h=this.parent.getCellStyleValue(["borderLeft"],[e.rowIdx,e.colIdx+1]).borderLeft;""===h||e.cell&&e.cell.style&&(e.cell.style.borderRight||e.cell.style.border)||this.parent.notify(It,{style:{borderRight:h},rowIdx:e.rowIdx,colIdx:e.colIdx,cell:e.td})}if(e.cell&&e.cell.hyperlink&&!st(this.parent,e.rowIdx,e.colIdx,this.parent.activeSheetIndex)){var d=void 0;"string"==typeof e.cell.hyperlink?0!==(d=e.cell.hyperlink).indexOf("http://")&&0!==d.indexOf("https://")&&0!==d.indexOf("ftp://")&&(e.cell.hyperlink=0===d.toLowerCase().indexOf("www.")?"http://"+d:d):0!==(d=e.cell.hyperlink.address).indexOf("http://")&&0!==d.indexOf("https://")&&0!==d.indexOf("ftp://")&&(e.cell.hyperlink.address=0===d.toLowerCase().indexOf("www.")?"http://"+d:d),this.parent.notify("createHyperlinkElement",{cell:e.cell,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx})}if(e.cell&&e.cell.wrap){var p=Se(r,e.rowIdx);this.parent.notify(At,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:!0,sheet:r,initial:!0,td:e.td,row:e.row,hRow:e.hRow,isCustomHgt:!e.isRefresh&&p>20})}},e.prototype.calculateFormula=function(e){var r=q(e.cell.formula),n={action:"refreshCalculate",value:e.cell.formula,rowIndex:e.rowIdx,colIndex:e.colIdx,isFormula:r,sheetIndex:e.sheetIndex};this.parent.notify(Et,n),e.cell.value=$(e.rowIdx,e.colIdx,t.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():ce(this.parent,e.sheetIndex)).value},e.prototype.checkMerged=function(e){if(e.cell&&(e.cell.colSpan<0||e.cell.rowSpan<0)){var t=this.parent.getActiveSheet();if(t.frozenRows||t.frozenColumns){var r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify("activeCellMergedRange",r);var n=this.parent.frozenRowCount(t),i=this.parent.frozenColCount(t);(t.frozenRows&&t.frozenColumns?r.range[0]<n&&r.range[1]<i?e.rowIdx<n&&e.colIdx<i:r.range[0]<n?e.rowIdx<n:!(r.range[1]<i)||e.colIdx<i:n?r.range[0]>=n||e.rowIdx<n:r.range[1]>=i||e.colIdx<i)&&(e.td.style.display="none")}else e.td.style.display="none";if(e.cell.colSpan<0&&this.parent.notify("checkPrevMerge",e),e.cell.rowSpan<0&&(e.isRow=!0,this.parent.notify("checkPrevMerge",e),e.cell&&e.cell.rowSpan&&e.cell.rowSpan<0)){var a=this.parent.getCell(e.rowIdx,e.colIdx-1,e.row),o="none";o=e.cell&&e.cell.style&&e.cell.style.borderLeft?e.cell.style.borderLeft:"none",a&&o&&(a.style.borderRight="none"===o?a.style.borderRight:o)}return!0}return!1},e.prototype.mergeFreezeRow=function(e,r,n,i,a,o){var s=this.parent.frozenRowCount(e);if(s&&r<s&&r+(i-1)>=s){var l=void 0,h=0,d=void 0,p=this.parent.frozenColCount(e),c=a||this.parent.getRow(r,null,n),f=[].slice.call(c.parentElement.querySelectorAll(".e-empty"));if(o){var g=r+i-s;if(g<f.length)return;var m=0;if(g===f.length){var v=void 0,y=void 0,C=void 0;for(p&&n<p?(y=u(e.topLeftCell)[1],C=p):(y=this.parent.viewport.leftIndex+p,C=this.parent.viewport.rightIndex),y;y<C;y++)y!==n&&(v=$(r,y,e,!1,!0)).rowSpan&&r+v.rowSpan-s>m&&(m=r+v.rowSpan-s);if(m===g)return}else m=g;for(var b=r+(i-1),y=m,C=f.length;y<C;y++)h+=Se(e,b),b--,t.detach(f.pop());return this.updateSpanTop(n,p,h,!0),void(f.length||this.updateColZIndex(n,p,!0))}this.updateColZIndex(n,p);for(var y=s,C=r+(i-1);y<=C;y++)h+=-(d=Se(e,y)),s+f.length>y||((l=c.cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",l.style.height=d+"px",c.parentElement.appendChild(l));this.updateSpanTop(n,p,h)}},e.prototype.updateSpanTop=function(e,t,r,n){var i=this.parent.serviceLocator.getService("sheet").contentPanel;if(n){if(!parseInt(i.style.top,10))return;r=parseInt(i.style.top,10)+r}if(t&&e<t&&(n||!parseInt(i.style.top,10)||r<parseInt(i.style.top,10))){i.style.top=r+"px";var a=i.nextElementSibling;a&&(a.style.top=r+"px")}},e.prototype.mergeFreezeCol=function(e,r,n,i,a){var o=this.parent.frozenColCount(e);if(o&&n<o&&n+(i-1)>=o){var s=void 0,l=void 0,h=this.parent.frozenRowCount(e),d=(r<h?this.parent.getSelectAllContent():this.parent.getRowHeaderContent()).querySelector("colgroup"),p=[].slice.call(d.querySelectorAll(".e-empty"));if(a){var c=n+i-o;if(c<p.length)return;var f=0;if(c===p.length){var g=void 0,m=void 0,v=void 0;for(h&&r<o?(m=h,v=u(e.topLeftCell)[0]):(m=this.parent.viewport.bottomIndex,v=this.parent.viewport.topIndex+h),v;v<m;v++)v!==r&&(g=$(v,n,e,!1,!0)).colSpan&&n+g.colSpan-o>f&&(f=n+g.colSpan-o);if(f===c)return}else f=c;for(var v=f,m=p.length;v<m;v++)t.detach(p.pop());return this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()),void(p.length||this.updateRowZIndex(r,h,!0))}this.updateRowZIndex(r,h);for(var v=o,m=n+(i-1);v<=m;v++)o+p.length>v||((s=d.childNodes[0].cloneNode()).classList.add("e-empty"),s.style.visibility="hidden",l=Re(e,v,null,!0),s.style.width=l+"px",d.appendChild(s),v===m&&this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()))}},e.prototype.updateColZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getColumnHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},e.prototype.updateSelectAllZIndex=function(e){var t=this.parent.element.querySelector(".e-frozen-row"),r=this.parent.element.querySelector(".e-frozen-column");e?(this.parent.getSelectAllContent().style.zIndex="",t&&(t.style.zIndex=""),r&&(r.style.zIndex="")):this.parent.getRowHeaderContent().style.zIndex||this.parent.getColumnHeaderContent().style.zIndex?(this.parent.getSelectAllContent().style.zIndex="3",t&&(t.style.zIndex="4"),r&&(r.style.zIndex="4")):this.parent.getSelectAllContent().style.zIndex="2"},e.prototype.updatedHeaderZIndex=function(e){if(!e&&"2"===this.parent.getSelectAllContent().style.zIndex){this.parent.getSelectAllContent().style.zIndex="3";var t=this.parent.element.querySelector(".e-frozen-row"),r=this.parent.element.querySelector(".e-frozen-column");r&&(r.style.zIndex="4"),t&&(t.style.zIndex="4")}},e.prototype.updateRowZIndex=function(e,t,r){e<t?this.updateSelectAllZIndex(r):(this.parent.getRowHeaderContent().style.zIndex=r?"":"2",this.updatedHeaderZIndex(r))},e.prototype.processTemplates=function(e,t,r){for(var n,i=this.parent.getActiveSheet(),a=i.ranges,o=0,s=a.length;o<s;o++)if(a[o].template&&(n=c(a[o].address.length?a[o].address:a[o].startCell))[0]<=t&&n[1]<=r&&n[2]>=t&&n[3]>=r){if(e)return this.compileCellTemplate(a[o].template);if(!$(t,r,i,!0))return this.compileCellTemplate(a[o].template)}return""},e.prototype.compileCellTemplate=function(e){if("string"==typeof e){var r=void 0;return r=0===e.trim().indexOf("#")?document.querySelector(e).innerHTML.trim():e,t.compile(r)({},null,null,"",!0)[0].outerHTML}return t.compile(e)({},this.parent,"ranges","")[0]},e.prototype.updateRowHeight=function(e){if(e.cell&&e.cell.children.length){var t=e.cell.cloneNode(!0);this.tableRow.appendChild(t)}if(e.lastCell&&this.tableRow.childElementCount){var r=this.parent.getActiveSheet(),n=e.row||this.parent.getRow(e.rowIdx),i=Se(r,e.rowIdx),a=this.getRowHeightOnInit();if(a>i){var o=et(a);n.style.height=o+"px",(e.hRow||this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable())).style.height=o+"px",xe(r,e.rowIdx,a)}this.tableRow.innerHTML=""}},e.prototype.getRowHeightOnInit=function(){var e=this.parent.createElement("table",{className:"e-table e-test-table"});e.appendChild(this.parent.createElement("tbody")).appendChild(this.tableRow),this.parent.element.appendChild(e);var t=Math.round(this.tableRow.getBoundingClientRect().height);return this.parent.element.removeChild(e),t<20?20:t},e.prototype.removeStyle=function(e,t,r){var n;if(e.style.length){var i=(n=this.parent.getCellStyleValue(["borderLeft","border"],[t,r+1])).borderLeft||n.border,a=(n=this.parent.getCellStyleValue(["borderTop","border"],[t+1,r])).borderTop||n.border;i||a?[].slice.call(e.style).forEach(function(t){(!i||t.indexOf("border-right")>-1||a)&&(!a||t.indexOf("border-bottom")>-1||i)||e.style.removeProperty(t)}):e.removeAttribute("style")}var o=this.parent.getCell(t-1,r);if(o&&o.style.borderBottom){var s=Number(o.parentElement.getAttribute("aria-rowindex"))-1;(n=this.parent.getCellStyleValue(["borderBottom","border"],[s,r])).borderBottom||n.border||(o.style.borderBottom="")}var l=e.previousElementSibling;l&&l.style.borderRight&&(r=Number(l.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[t,r])).borderRight||n.border||(l.style.borderRight=""))},e.prototype.refreshRange=function(e,t){var r=this.parent.getActiveSheet(),n=e.slice();if(Me(this.parent,n,!0))for(var i=n[0];i<=n[2];i++)if(!be(r,i))for(var a=n[1];a<=n[3];a++){var o=this.parent.getCell(i,a);o&&(this.update({rowIdx:i,colIdx:a,td:o,cell:$(i,a,r),isRefreshing:t,lastCell:a===n[3],isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify("renderFilterCell",{td:o,rowIndex:i,colIndex:a}))}},e.prototype.refresh=function(e,t,r,n){var i=this.parent.getActiveSheet();if((n||!be(i,e)&&!Ae(i,t))&&(n||!this.parent.scrollSettings.enableVirtualization||this.parent.insideViewport(e,t))){var a=n||this.parent.getCell(e,t);this.update({rowIdx:e,colIdx:t,td:a,cell:$(e,t,i),lastCell:r,isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify("renderFilterCell",{td:a,rowIndex:e,colIndex:t})}},e.prototype.updateView=function(e){t.isNullOrUndefined(e.sheetIndex)||e.sheetIndex===this.parent.activeSheetIndex?this.refreshRange(e.indexes,e.refreshing):e.refreshing&&this.calculateFormula({cell:$(e.indexes[0],e.indexes[1],ce(this.parent,e.sheetIndex),!0),rowIdx:e.indexes[0],colIdx:e.indexes[1],sheetIndex:e.sheetIndex})},e}(),Bi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.render=function(e){this.parent.activeSheetIndex=this.parent.skipHiddenSheets(this.parent.activeSheetIndex),this.parent.isMobileView()||(this.parent.notify("ribbon",null),this.parent.notify("formulaBar",null));var t=this.parent.createElement("div",{id:this.parent.element.id+"_sheet_panel",className:"e-sheet-panel"});if(this.parent.enableRtl&&t.classList.add("e-rtl"),this.parent.element.appendChild(t),this.parent.showSheetTabs)this.parent.notify("sheetTabs",null);else{var r={action:"addSheet",sheetName:"Sheet1",index:1,visibleName:ve(this.parent,0)};this.parent.notify(Et,r),this.parent.notify(Et,{action:"initiateDefinedNames"})}this.parent.isMobileView()&&(this.parent.notify("formulaBar",null),this.parent.notify("ribbon",null)),(this.parent.password.length>0||this.parent.isProtected)&&(this.parent.isProtected=!0,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"))),this.setSheetPanelSize(),this.renderSheet(t),this.checkTopLeftCell(!0,e)},e.prototype.checkTopLeftCell=function(e,t){var r=this.parent.getActiveSheet();this.parent.showSpinner();var n,i="A1"===r.topLeftCell,a=u(r.topLeftCell);if(r.topLeftCell!==r.paneTopLeftCell&&(r.frozenRows||r.frozenColumns)){var o=u(r.paneTopLeftCell);n=this.parent.scrollSettings.enableVirtualization,i=r.frozenRows&&r.frozenColumns?a[0]+r.frozenRows===o[0]&&a[1]+r.frozenColumns===o[1]:r.frozenRows?a[0]+r.frozenRows===o[0]&&0===a[1]:a[1]+r.frozenColumns===o[1]&&0===a[0],a[0]&&o[0]>a[0]?this.parent.viewport.beforeFreezeHeight=we(r,0,a[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,a[1]&&o[1]>a[1]?this.parent.viewport.beforeFreezeWidth=ke(r,0,a[1]-1,!0):this.parent.viewport.beforeFreezeWidth=0}else this.parent.viewport.beforeFreezeHeight=this.parent.viewport.beforeFreezeWidth=0;if(!this.parent.scrollSettings.enableVirtualization||i)this.refreshUI({rowIndex:a[0],colIndex:a[1],refresh:"All"},null,e,t),n&&(this.parent.viewport.topIndex=yt(r,0,!0),this.parent.viewport.leftIndex=yt(r,0,!0,"columns"));else{var s=r.paneTopLeftCell===r.topLeftCell?a:u(r.paneTopLeftCell),l=this.parent.frozenRowCount(r),h=this.parent.frozenColCount(r),d={preventScroll:!0};d.scrollTop=s[0]>l?we(r,l||0,s[0]-1):0,d.scrollLeft=s[1]>h?ke(r,h||0,s[1]-1):0,this.parent.notify("onContentScroll",d);var p=this.parent.getThreshold("row"),c=r.frozenRows?a[0]:a[0]>p?yt(r,a[0]-p,!0):0,f=[];r.frozenRows&&f.push(s[0]-p>l?s[0]-p:l),p=this.parent.getThreshold("col");var g=r.frozenColumns?a[1]:a[1]>p?yt(r,a[1]-p,!0,"columns"):0;r.frozenColumns?(f.length||f.push(l),f.push(s[1]-p>h?s[1]-p:h)):f.length&&f.push(h),this.refreshUI({rowIndex:c,colIndex:g,refresh:"All",top:d.scrollTop,left:d.scrollLeft,frozenIndexes:f},null,e,t),n&&(f[0]>=l&&(this.parent.viewport.topIndex=yt(r,f[0]-l,!0)),f[1]>=h&&(this.parent.viewport.leftIndex=yt(r,f[1]-h,!0,"columns")))}},e.prototype.renderSheet=function(e){void 0===e&&(e=document.getElementById(this.parent.element.id+"_sheet_panel")),e.appendChild(this.parent.createElement("div",{className:"e-sheet",id:this.parent.element.id+"_sheet",styles:"background-color: #fff"})),this.parent.serviceLocator.getService("sheet").renderPanel()},e.prototype.refreshUI=function(e,t,r,n){var i=this;"All"!==e.refresh&&this.parent.showSpinner();var a=this.parent.serviceLocator.getService("sheet"),o=this.parent.getActiveSheet(),s=ve(this.parent),l={rowCount:o.rowCount,colCount:o.colCount};if(e.frozenIndexes=e.frozenIndexes?e.frozenIndexes:[],!t)if(this.parent.scrollSettings.enableVirtualization){var h=e.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),d=e.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),p=this.parent.frozenRowCount(o),c=this.parent.frozenColCount(o);e.frozenIndexes.length&&(h+=e.frozenIndexes[0]-p,d+=e.frozenIndexes[1]-c),h+=o.frozenRows,d+=o.frozenColumns;var f=o.rowCount-1;this.parent.scrollSettings.isFinite&&h>f&&(h=f),f=o.colCount-1,this.parent.scrollSettings.isFinite&&d>f&&(d=f);var m=this.parent.skipHidden(e.rowIndex,h);if(e.rowIndex!==m[0]){var v=u(o.topLeftCell);v[0]===e.rowIndex&&this.parent.updateTopLeftCell(m[0],v[1],"row"),e.rowIndex=m[0]}var y=e.rowIndex;h=m[1];var C=u(o.topLeftCell);m=this.parent.skipHidden(e.colIndex,d,"columns"),e.colIndex!==m[0]&&(C[1]===e.colIndex&&this.parent.updateTopLeftCell(C[0],m[0],"col"),e.colIndex=m[0]);var b=e.colIndex;d=m[1],"Row"===e.refresh&&(y+=p,p&&(h+=C[0])),"Column"===e.refresh&&(b+=c,c&&(d+=C[1])),this.parent.viewport.topIndex=e.rowIndex,this.parent.viewport.bottomIndex=h,this.parent.viewport.leftIndex=e.colIndex,this.parent.viewport.rightIndex=d,t=g(y,b)+":"+g(h,d)}else this.parent.viewport.bottomIndex=o.rowCount-1,this.parent.viewport.rightIndex=o.colCount-1,t=g(o.frozenRows?u(o.topLeftCell)[0]:0,o.frozenColumns?u(o.topLeftCell)[1]:0)+":"+g(this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex);"All"===e.refresh&&this.parent.trigger("beforeDataBound",{}),tt(this.parent.getMainContent(),{busy:!0});var S=this.parent.sheets.length;ee(this.parent,s+"!"+t,null,null,e.frozenIndexes).then(function(s){if(!(S<i.parent.sheets.length)){var h=i.parent.sheets.indexOf(o);if(-1===h||h!==i.parent.activeSheetIndex)return void(h>-1&&i.checkTopLeftCell());var d,p=[e.rowIndex,e.colIndex].concat(u(t.split(":")[1]));switch(e.refresh){case"All":a.renderTable({cells:s,indexes:p,top:e.top,left:e.left,initLoad:r,isRefreshing:n});break;case"Row":a.refreshRowContent({cells:s,indexes:p,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l}),d={isEdit:!1},i.parent.notify("isFormulaBarEdit",d),d.isEdit&&i.parent.notify(Wt,{action:"startEdit",refreshCurPos:!1});break;case"Column":a.refreshColumnContent({cells:s,indexes:p,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l});break;case"RowPart":a.updateRowContent({cells:s,indexes:p,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l});break;case"ColumnPart":a.updateColContent({cells:s,indexes:p,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l})}i.parent.isReact&&i.parent.renderReactTemplates()}}),this.parent.notify("beforeVirtualContentLoaded",{refresh:e.refresh})},e.prototype.removeSheet=function(){t.remove(document.getElementById(this.parent.element.id+"_sheet"))},e.prototype.refreshSheet=function(e){this.removeSheet(),this.renderSheet(),this.parent.notify("deInitProperties",{}),this.checkTopLeftCell(!1,e)},e.prototype.setSheetPanelSize=function(){var e,t=document.getElementById(this.parent.element.id+"_sheet_panel"),r=this.parent.element.getBoundingClientRect();"auto"===this.parent.height?(t.style.height="260px",e=230):(e=r.height-He(t),t.style.height=e+"px",e-=32),this.parent.viewport.height=e,this.parent.viewport.width=r.width-32,this.parent.viewport.rowCount=this.roundValue(e,20),this.parent.viewport.colCount=this.roundValue(r.width,64)},e.prototype.roundValue=function(e,t){var r=e/t,n=Math.round(r);return Math.abs(r-n)<.5?n:n-1},e.prototype.instantiateRenderer=function(){this.parent.serviceLocator.register("cell",new Hi(this.parent)),this.parent.serviceLocator.register("row",new Oi(this.parent)),this.parent.serviceLocator.register("sheet",new Di(this.parent))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(jt,this.instantiateRenderer,this),this.parent.on("dataRefresh",this.refreshSheet,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off(jt,this.instantiateRenderer),this.parent.off("dataRefresh",this.refreshSheet),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),Mi=function(){function e(e){this.parent=e}return e.prototype.show=function(e,r){var n,i=this;r=!!t.isNullOrUndefined(r);var a=e.close||null,o={header:"Spreadsheet",cssClass:this.parent.cssClass,target:this.parent.element,buttons:[]};e.close=function(){i.dialogInstance.destroy(),t.remove(i.dialogInstance.element),i.dialogInstance=null,a&&a()},t.extend(o,e),r&&(n=this.parent.serviceLocator.getService(ki).getConstant(o.buttons.length?"Cancel":"Ok"),o.buttons.push({buttonModel:{content:n,isPrimary:0===o.buttons.length},click:this.hide.bind(this)}));var s=this.parent.createElement("div");document.body.appendChild(s),this.dialogInstance=new h.Dialog(o),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(s),this.dialogInstance.refreshPosition()},e.prototype.hide=function(){this.dialogInstance&&this.dialogInstance.hide()},e.prototype.destroy=function(){this.parent=null},e}(),Pi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.initializeActionBegin=function(){var e=this,t=this.parent.beforeCellFormat;this.parent.beforeCellFormat=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"begin",eventType:"format"})};var r=this.parent.beforeOpen;this.parent.beforeOpen=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"begin",eventType:"beforeOpen"})};var n=this.parent.beforeSave;this.parent.beforeSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:n,actionType:"begin",eventType:"beforeSave"})};var i=this.parent.beforeSort;this.parent.beforeSort=function(t){e.actionEventHandler({evtArgs:t,evtFunc:i,actionType:"begin",eventType:"beforeSort"})}},e.prototype.initializeActionComplete=function(){var e=this,t=this.parent.sortComplete;this.parent.sortComplete=function(r){e.actionEventHandler({evtArgs:r,evtFunc:t,actionType:"complete",eventType:"sorting"})};var r=this.parent.cellSave;this.parent.cellSave=function(t){e.actionEventHandler({evtArgs:t,evtFunc:r,actionType:"complete",eventType:"cellSave"})}},e.prototype.actionEventHandler=function(e){e.evtFunc&&e.evtFunc.apply(this,[e]),"begin"===e.actionType?this.actionBeginHandler({eventArgs:e.evtArgs,action:e.eventType}):this.actionCompleteHandler({eventArgs:e.evtArgs,action:e.eventType})},e.prototype.actionBeginHandler=function(e){this.parent.trigger("actionBegin",{action:e.action,args:e}),"clipboard"!==e.action&&"beforeSort"!==e.action&&"format"!==e.action&&"cellSave"!==e.action&&"beforeWrap"!==e.action&&"beforeReplace"!==e.action&&"beforeClear"!==e.action&&"beforeInsertImage"!==e.action&&"beforeInsertChart"!==e.action&&"filter"!==e.action&&"cellDelete"!==e.action||this.parent.notify("setActionData",{args:e})},e.prototype.actionCompleteHandler=function(e){this.parent.notify("triggerDataChange",e),this.parent.trigger("actionComplete",e),"undoRedo"!==e.action&&"gotoSheet"!==e.action&&this.parent.notify("updateUndoRedoCollection",{args:e})},e.prototype.addEventListener=function(){this.parent.on(nr,this.actionCompleteHandler,this),this.parent.on(ir,this.actionBeginHandler,this)},e.prototype.removeEventListener=function(){this.parent.off(nr,this.actionCompleteHandler),this.parent.off(ir,this.actionBeginHandler)},e}(),_i=function(){function e(e){this.minHeight="300px",this.minWidth="400px",this.isOverlayClicked=!1,this.isResizerClicked=!1,this.currentWidth=400,this.currenHeight=300,this.parent=e}return e.prototype.insertOverlayElement=function(e,t,r){var n=this.parent.createElement("div",{id:e,attrs:{class:"e-ss-overlay"},styles:"width: "+this.minWidth+"; height: "+this.minHeight}),i=c(t),a=this.parent.sheets[r],o=this.parent.frozenRowCount(a),s=this.parent.frozenColCount(a),l=Pe(a,i,o,s,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);if(i[0]>=o&&i[1]<s){var h=this.parent.sheetModule.contentPanel;h.scrollTop&&(l.top-=h.scrollTop,l.top+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height)}if(i[1]>=s&&i[0]<o){var d=this.parent.getScrollElement();d.scrollLeft&&(l.left-=d.scrollLeft,l.left+=this.parent.sheetModule.getRowHeaderWidth(a))}var p;return i[0]<o||i[1]<s?(p=document.getElementById(this.parent.element.id+"_sheet"),o&&(i[0]>=o?l.top+=(a.showHeaders?31:0)+we(a,u(a.topLeftCell)[0],o-1):s||(l.left+=this.parent.sheetModule.getRowHeaderWidth(a,!0))),s&&(i[1]>=s?l.left+=this.parent.sheetModule.getRowHeaderWidth(a):o||(l.left+=a.showHeaders?31:0))):p=this.parent.getMainContent(),n.style.top=l.top+"px",n.style.left=l.left+"px",p.appendChild(n),this.renderResizeHandles(n),this.addEventListener(n),this.originalWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px","")),n},e.prototype.addEventListener=function(e){var r=e;t.EventHandler.add(r,"mousedown",this.overlayClickHandler,this),t.EventHandler.add(r,"mousemove",this.overlayMouseMoveHandler,this),t.EventHandler.add(document.getElementById(this.parent.element.id+"_sheet"),"mousemove",this.overlayMouseMoveHandler,this),t.EventHandler.add(document,"mouseup",this.overlayMouseUpHandler,this),this.parent.on("overlayEleSize",this.setOriginalSize,this)},e.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},e.prototype.overlayMouseMoveHandler=function(e){var r,n,i,a,o,s,l=e.target,h=document.getElementsByClassName("e-ss-overlay-active")[0],d=this.parent.getActiveSheet(),p=d.frozenRows||d.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(d,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-e.clientY+this.originalHeight,20),n=e.clientY-(this.originalMouseY-this.originalResizeTop),r>180&&n>p[0]&&(h.style.height=r+"px",h.style.top=n+"px",this.resizedReorderTop=n,this.currenHeight=r,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-r":(i=this.originalWidth+(e.pageX-this.originalMouseX))>180&&(h.style.width=i+"px",this.currentWidth=i,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-b":(a=this.originalHeight+(e.pageY-this.originalMouseY))>180&&(h.style.height=a+"px",this.currenHeight=a,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-l":o=Math.max(this.originalMouseX-e.clientX+this.originalWidth,20),s=e.clientX-(this.originalMouseX-this.originalResizeLeft),o>180&&s>p[1]&&(h.style.width=o+"px",h.style.left=s+"px",this.resizedReorderLeft=s,this.currentWidth=o,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}))}else if(this.isOverlayClicked)if(t.closest(l,".e-sheet")&&!l.classList.contains("e-sheet-content")||l.classList.contains("e-cell")){if(!h)return;var c=e.clientX-this.diffX,u=e.clientY-this.diffY;c>p[1]&&(h.style.left=c+"px"),u>p[0]&&(h.style.top=u+"px"),this.resizedReorderLeft=c,this.resizedReorderTop=u}else this.overlayMouseUpHandler(e,!0)},e.prototype.overlayMouseUpHandler=function(e,r){if(!this.parent.getActiveSheet().isProtected){this.isResizerClicked=!1;var n=e.target,i=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active");n.classList.contains("e-ss-overlay")||(n=t.closest(e.target,".e-datavisualization-chart")?t.closest(e.target,".e-datavisualization-chart"):n);var a=this.parent.getActiveSheet(),o={prevTop:a.frozenRows||a.frozenColumns?this.prevY:this.originalReorderTop,prevLeft:a.frozenRows||a.frozenColumns?this.prevX:this.originalReorderLeft,currentTop:this.resizedReorderTop?this.resizedReorderTop:this.originalReorderTop,currentLeft:this.resizedReorderLeft?this.resizedReorderLeft:this.originalReorderLeft,id:n.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};if(this.isOverlayClicked||r){var s=void 0,l=void 0,h={clientY:o.prevTop,isImage:!0},d={clientX:o.prevLeft,isImage:!0},p=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(a.frozenRows||a.frozenColumns){if(!p)return;h.isImage=!1,d.isImage=!1,h.target=p,d.target=p,o.prevTop<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(h.target=this.parent.getColumnHeaderContent()),o.prevLeft<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(d.target=this.parent.getRowHeaderTable());var c=p.getBoundingClientRect();s={clientY:c.top},l={clientX:c.left},c.top<this.parent.getColumnHeaderContent().getBoundingClientRect().bottom&&(s.target=this.parent.getColumnHeaderContent()),c.left<this.parent.getRowHeaderContent().getBoundingClientRect().right&&(l.target=this.parent.getRowHeaderTable())}else s={clientY:o.currentTop,isImage:!0},l={clientX:o.currentLeft,isImage:!0};if(this.parent.notify("getRowIdxFromClientY",h),this.parent.notify("getRowIdxFromClientY",s),this.parent.notify("getColIdxFromClientX",d),this.parent.notify("getColIdxFromClientX",l),s.size&&(o.currentTop=s.size),l.size&&(o.currentLeft=l.size),o.prevRowIdx=h.clientY,o.prevColIdx=d.clientX,o.currentRowIdx=s.clientY,o.currentColIdx=l.clientX,(a.frozenColumns||a.frozenRows)&&!t.closest(p,".e-sheet-content")){var u=this.parent.frozenColCount(a),f=this.parent.frozenRowCount(a);if(o.currentRowIdx>=f&&o.currentColIdx>=u){var g=parseInt(p.style.top,10),m=parseInt(p.style.left,10);g+=this.parent.sheetModule.contentPanel.scrollTop,g-=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,m+=this.parent.getScrollElement().scrollLeft,m-=this.parent.sheetModule.getRowHeaderWidth(a),p.style.top=g+"px",p.style.left=m+"px",this.parent.getMainContent().appendChild(p)}}i&&i[0]&&i[0].querySelector(".e-control")&&(o.id=i[0].id),this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(o.id=n.id,i&&i[0]?(o.requestType="chartRefresh",this.parent.notify("refreshChartCellObj",o)):this.parent.notify(hr,o),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(o.id=n.id.indexOf("overlay")>0?n.id:n.parentElement?n.parentElement.id:"",i&&i[0]?(o.requestType="chartRefresh",this.parent.notify("refreshChartCellObj",o)):this.parent.notify(hr,o),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},e.prototype.overlayClickHandler=function(e){if(!this.parent.getActiveSheet().isProtected){this.isOverlayClicked=!0;var r=e.target,n=e.target;r.classList.contains("e-ss-overlay")||(n=r.parentElement,t.closest(e.target,".e-datavisualization-chart")&&(n=t.closest(e.target,".e-datavisualization-chart"),this.currentWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.currenHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px",""))));var i=this.parent.getActiveSheet();if((i.frozenColumns||i.frozenRows)&&t.closest(n,".e-sheet-content")){var a=parseInt(n.style.top,10),o=parseInt(n.style.left,10);a-=this.parent.sheetModule.contentPanel.scrollTop,a+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,o-=this.parent.getScrollElement().scrollLeft,o+=this.parent.sheetModule.getRowHeaderWidth(i),n.style.top=a+"px",n.style.left=o+"px",document.getElementById(this.parent.element.id+"_sheet").appendChild(n)}this.originalReorderLeft=parseInt(n.style.left,10),this.originalReorderTop=parseInt(n.style.top,10),this.resizedReorderLeft=parseInt(n.style.left,10),this.resizedReorderTop=parseInt(n.style.top,10),this.originalResizeTop=this.originalReorderTop,this.originalResizeLeft=this.originalReorderLeft,this.originalMouseX=e.clientX,this.originalMouseY=e.clientY,this.diffX=this.originalMouseX-this.originalReorderLeft,this.diffY=this.originalMouseY-this.originalReorderTop;var s=document.getElementsByClassName("e-ss-overlay-active")[0];s&&t.removeClass([s],"e-ss-overlay-active"),document.getElementById(n.id).classList.add("e-ss-overlay-active"),r.classList.contains("e-ss-resizer")&&(this.resizer=r.classList[0],this.originalWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.originalHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px","")),this.isResizerClicked=!0),n.classList.contains("e-datavisualization-chart")&&(this.parent.notify("focusChartBorder",{id:n.id}),s||this.parent.notify("insertDesignChart",{id:n.id}));var l=n.getBoundingClientRect();this.prevX=l.left,this.prevY=l.top}},e.prototype.renderResizeHandles=function(e){for(var t,r=["e-ss-overlay-t","e-ss-overlay-r","e-ss-overlay-b","e-ss-overlay-l"],n=0,i=e;r.length>n;)t=this.parent.createElement("div",{attrs:{class:r[n]+" e-ss-resizer"},styles:"width: 8px; height: 8px; border-radius: 4px;"}),i.appendChild(t),n++},e.prototype.removeEventListener=function(){var e=document.getElementById(this.parent.element.id+"_overlay");e&&(t.EventHandler.remove(e,"mousedown",this.overlayClickHandler),t.EventHandler.remove(e,"mousemove",this.overlayMouseMoveHandler)),t.EventHandler.remove(document.getElementById(this.parent.element.id+"_sheet"),"mousemove",this.overlayMouseMoveHandler),t.EventHandler.remove(document,"mouseup",this.overlayMouseUpHandler),this.parent.off("overlayEleSize",this.setOriginalSize)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Ui=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Vi=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},zi=function(e){function r(t,r){var i=e.call(this,t)||this;return i.viewport={rowCount:0,colCount:0,height:0,topIndex:0,leftIndex:0,width:0,bottomIndex:0,rightIndex:0,beforeFreezeHeight:0,beforeFreezeWidth:0},i.needsID=!0,n.Inject(li,hi,pi,Bn,Hn,_n,Un,On,qt,ci,fi,ui,gi,Vn,di,Yn,Or,ur,mr,Dr,zt,Ar,mi,Tr,zn,Gn,Fr,vi,Wn,Hr,Xn,Kn,Br,Mr,$n,Pr,Zn,Ur,Jn,_r,Qn,Vr,yi,ei,Lr,zr,Ci,Nr),r&&i.appendTo(r),i}Ui(r,e),n=r,r.prototype.getCell=function(e,t,r){return r||(r=this.getRow(e,null,t)),t=this.getViewportIndex(t,!0),r?r.cells[t]:r},r.prototype.getRow=function(e,r,n){if(!r){var i=this.getActiveSheet(),a=this.frozenRowCount(i),o=this.frozenColCount(i);r=t.isNullOrUndefined(n)||e>a-1&&n>o-1?this.getContentTable():e<a&&n<o?this.sheetModule.getSelectAllTable():e<a?this.getColHeaderTable():this.getRowHeaderTable()}return e=this.getViewportIndex(e),r?r.rows[e]:null},r.prototype.hiddenCount=function(e,t,r){void 0===r&&(r="rows");for(var n=this.getActiveSheet(),i=0,a=e;a<=t;a++)n[r][a]&&n[r][a].hidden&&i++;return i},r.prototype.getViewportIndex=function(e,t){var r=this.getActiveSheet();if(t){var n=this.frozenColCount(r);if(n){var i=u(r.topLeftCell)[1];if(e<n)return(e-=i)+1;e-=n}}else{var a=this.frozenRowCount(r);if(a){var o=u(r.topLeftCell)[0];if(e<a)return(e-=o)+1;e-=a}}return this.scrollSettings.enableVirtualization&&(t?(e-=this.hiddenCount(this.viewport.leftIndex,e,"columns"),e-=this.viewport.leftIndex):(e-=this.hiddenCount(this.viewport.topIndex,e),e-=this.viewport.topIndex)),e},r.prototype.preRender=function(){e.prototype.preRender.call(this),this.serviceLocator=new bn,this.initServices()},r.prototype.initServices=function(){this.serviceLocator.register(ki,new t.L10n(this.getModuleName(),Ni,this.locale)),this.serviceLocator.register(Ai,new Mi(this)),this.serviceLocator.register("actionEvents",new Pi(this)),this.serviceLocator.register(Ti,new _i(this))},r.prototype.render=function(){e.prototype.render.call(this),this.element.setAttribute("tabindex","0"),tt(this.element,{role:"grid"}),this.renderModule=new Bi(this),this.notify(jt,null),this.renderSpreadsheet(),this.wireEvents(),this.created&&(this.created.observers?this.created.observers.length>0&&(this.createdHandler={observers:this.created.observers},this.created.observers=[]):(this.createdHandler=this.created,this.setProperties({created:void 0},!0)))},r.prototype.renderSpreadsheet=function(){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),this.setHeight(),this.setWidth(),h.createSpinner({target:this.element},this.createElement),this.isMobileView()&&-1===this.cssClass.indexOf("e-mobile-view")&&this.element.classList.add("e-mobile-view"),this.sheetModule=this.serviceLocator.getService("sheet"),this.allowScrolling&&(this.scrollModule=new Mn(this)),this.scrollSettings.enableVirtualization&&new Pn(this),this.renderModule.render(this.refreshing),new jn(this)},r.prototype.showSpinner=function(){h.showSpinner(this.element)},r.prototype.hideSpinner=function(){h.hideSpinner(this.element)},r.prototype.protectSheet=function(t,r){"string"==typeof t&&(t=ae(this,t)),t&&(this.setSheetPropertyOnMute(this.sheets[t],"isProtected",!0),this.setSheetPropertyOnMute(this.sheets[t],"protectSettings",r)),t=this.getActiveSheet().index,this.setSheetPropertyOnMute(this.getActiveSheet(),"isProtected",!0),e.prototype.protectSheet.call(this,t,r)},r.prototype.unprotectSheet=function(t){"string"==typeof t&&(t=ae(this,t)),t?this.sheets[t].isProtected=!1:this.getActiveSheet().isProtected=!1,e.prototype.unprotectSheet.call(this,t)},r.prototype.find=function(t){e.prototype.findHandler.call(this,t)},r.prototype.replace=function(t){t={value:t.value,mode:t.mode?t.mode:"Sheet",isCSen:!!t.isCSen&&t.isCSen,isEMatch:!!t.isEMatch&&t.isEMatch,searchBy:t.searchBy?t.searchBy:"By Row",replaceValue:t.replaceValue,replaceBy:t.replaceBy,sheetIndex:t.sheetIndex?t.sheetIndex:this.activeSheetIndex,findOpt:t.findOpt?t.findOpt:""},e.prototype.replaceHandler.call(this,t)},r.prototype.findAll=function(e,t,r,n,i){var a=[],o={value:e,mode:t=t||"Sheet",sheetIndex:i=i||this.activeSheetIndex,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:a};return this.notify("findAllValues",o),a},r.prototype.goTo=function(e){if(e.includes("!")){var t=e.split("!"),r=ae(this,t[0]);if(void 0===r)return;if(r!==this.activeSheetIndex){var n=t[1].split(":")[0],i=this.sheets[r];this.setSheetPropertyOnMute(i,"activeCell",n),this.setSheetPropertyOnMute(i,"selectedRange",t[1]);var a=u(n);if(i.frozenColumns||i.frozenRows){var o=u(i.topLeftCell);if(!(i.frozenRows&&a[0]<o[0]||i.frozenColumns&&a[1]<o[1])){var s=this.frozenRowCount(i),l=this.frozenColCount(i),h=[],d=[],p=u(i.paneTopLeftCell);s?(h.push(o[0]),a[0]>=s?d.push(a[0]):d.push(p[0])):(h.push(a[0]),d.push(a[0])),l?(h.push(o[1]),a[1]>=l?d.push(a[1]):d.push(p[1])):(h.push(a[1]),d.push(a[1])),this.setSheetPropertyOnMute(i,"topLeftCell",g(h[0],h[1])),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(d[0],d[1]))}}else a[0]<this.viewport.rowCount&&(a[0]=0),a[1]<this.viewport.colCount&&(a[1]=0),this.updateTopLeftCell(a[0],a[1],null,i);return this.activeSheetIndex=r,void this.dataBind()}}var f=c(e),m=this.getActiveSheet(),v=this.frozenRowCount(m),y=this.frozenColCount(m),C=this.insideViewport(f[0],f[1]);if(C){this.selectRange(e);var b=u(m.paneTopLeftCell),S=b[0]-v+(this.viewport.rowCount-1-m.frozenRows);if(b[2]=S,b[3]=b[1]-y+(this.viewport.colCount-1-m.frozenColumns),f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return;if(v||y){if(b=[].concat(u(m.topLeftCell),[v,b[3]]),f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return;if(b[2]=S,b[3]=y,f[0]>=b[0]&&f[0]<b[2]&&f[1]>=b[1]&&f[1]<b[3])return}}var x,w,I,E,R,k,A=this.getMainContent().parentElement;f[0]===v?I=0:(I=we(m,v,f[0]-1,!0),this.scrollSettings.enableVirtualization&&(k=I+this.getContentTable().getBoundingClientRect().height)>(R=parseFloat(A.querySelector(".e-virtualtrack").style.height))&&(k+=10,(x=A.querySelector(".e-virtualtrack")).style.height=k+"px",Le(function(){x.style.height=R+"px"}))),A.scrollTop=I,A=this.element.getElementsByClassName("e-scroller")[0],f[1]===y?I=0:(I=ke(m,y,f[1]-1,!0),this.scrollSettings.enableVirtualization&&(k=I+this.getContentTable().getBoundingClientRect().width)>(E=parseFloat(A.querySelector(".e-virtualtrack").style.width))&&(k+=10,(x=A.querySelector(".e-virtualtrack")).style.width=k+"px",(w=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=k+"px",(x=this.getMainContent().querySelector(".e-virtualtrack")).style.width=k+"px",Le(function(){x.style.width=E+"px",w.style.width=E+"px"}))),A.scrollLeft=I,C||this.selectRange(e)},r.prototype.insideViewport=function(e,t){var r=this.getActiveSheet();if(r.frozenRows||r.frozenColumns){var n=this.frozenRowCount(r),i=this.frozenColCount(r),a=u(r.topLeftCell);return(e>=a[0]&&e<n||e>=this.viewport.topIndex+n&&e<=this.viewport.bottomIndex)&&(t>=a[1]&&t<i||t>=this.viewport.leftIndex+i&&t<=this.viewport.rightIndex)}return e>=this.viewport.topIndex&&e<=this.viewport.bottomIndex&&t>=this.viewport.leftIndex&&t<=this.viewport.rightIndex},r.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet()},r.prototype.cut=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify(Zt,e?{range:y(e),sId:this.sheets[ae(this,se(e))].id,promise:t}:{promise:t}),t},r.prototype.copy=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify("copy",e?{range:y(e),sId:this.sheets[ae(this,se(e))]?this.sheets[ae(this,se(e))].id:this.activeSheetIndex,promise:t}:{promise:t}),t},r.prototype.paste=function(e,t){this.notify(Jt,{range:e?y(e):e,sIdx:e?ae(this,se(e)):e,type:t,isAction:!1,isInternal:!0})},r.prototype.updateAction=function(e){ot(e,this)},r.prototype.setHeight=function(){this.height.toString().indexOf("%")>-1&&(this.element.style.minHeight="400px"),this.element.style.height=t.formatUnit(this.height)},r.prototype.setWidth=function(){(this.width.toString().indexOf("%")>-1||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=t.formatUnit(this.width)},r.prototype.setColWidth=function(e,r,n){void 0===e&&(e=64),void 0===r&&(r=0);var i=this.getThreshold("col"),a=this.viewport.leftIndex+this.viewport.colCount+2*i,o=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n];if(o){var s=r,l="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?u(o.activeCell)[1]:r,o===this.getActiveSheet())if(r>=this.viewport.leftIndex&&r<=a){this.scrollSettings.enableVirtualization&&(r-=this.viewport.leftIndex);var h=void 0;h=o.showHeaders?this.getColumnHeaderContent().getElementsByClassName("e-header-cell")[r]:this.getContentTable().getElementsByClassName("e-row")[0].getElementsByClassName("e-cell")[r];var d=Re(o,r,null,!0);(f=et(parseInt(l,10))-d)<0&&d<-f&&(u(o.activeCell),f=-d);var p=parseInt(h.getAttribute("aria-colindex"),10)-1;this.getActiveSheet()===o&&(this.notify("colWidthChanged",{threshold:f,colIdx:p}),nt(r,r,l,!0,this))}else{var c=Re(o,r),f=void 0;f=parseInt(l,10)>0?-(c-parseInt(l,10)):-c,this.notify("colWidthChanged",{threshold:f,colIdx:r})}Ie(o,s).width=parseInt(l,10)>0?parseInt(l,10):0,o.columns[s].customWidth=!0}},r.prototype.setRowHeight=function(e,r,n,i){void 0===e&&(e=20),void 0===r&&(r=0);var a=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n-1];if(a){var o=r,s="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?u(a.activeCell)[0]:r,a===this.getActiveSheet())if(r<=this.viewport.bottomIndex&&r>=this.viewport.topIndex){this.scrollSettings.enableVirtualization&&(r-=this.viewport.topIndex);var l=void 0;l=a.showHeaders?this.getRowHeaderContent().getElementsByClassName("e-header-cell")[r].parentElement:this.getContentTable().getElementsByClassName("e-row")[r];var h=Se(a,r,!0);(c=et(parseInt(s,10))-h)<0&&h<-c&&(c=-h);var d=parseInt(l.getAttribute("aria-rowindex"),10)-1;this.getActiveSheet()===a&&(this.notify(Qt,{threshold:c,rowIdx:d}),t.isNullOrUndefined(i)&&(i=!1),i||(nt(r,r,s,!1,this),i=!1))}else{var p=Se(a,r),c=void 0;c=parseInt(s,10)>0?-(p-parseInt(s,10)):-p,this.notify(Qt,{threshold:c,rowIdx:r})}xe(a,o,parseInt(s,10)>0?parseInt(s,10):0),a.rows[o].customHeight=!0}},r.prototype.autoFit=function(e){var t=this.getIndexes(e),r=t.startIdx,n=t.endIdx,i=t.isCol,a=i?f("XFD"):1048576;if(r<=a)for(n>a&&(n=a),r;r<=n;r++)this.notify("setAutoFit",{idx:r,isCol:i})},r.prototype.getIndexes=function(e){var r,n,i,a;if(-1!==e.indexOf(":")){var o=e.split(":");i=o[0],a=o[1]}else i=e,a=e;if(!t.isNullOrUndefined(i)){var s=this.getAddress(i);i=s.address,r=s.isCol}if(!t.isNullOrUndefined(a)){var l=this.getAddress(a);a=l.address,n=l.isCol}var h=!0===r&&!0===n;return{startIdx:h?f(i.toUpperCase()):parseInt(i,10),endIdx:h?f(a.toUpperCase()):parseInt(a,10),isCol:h}},r.prototype.getAddress=function(e){var t;return e.substring(0,1).match(/\D/g)?(t=!0,e=e.replace(/[0-9]/g,""),{address:e,isCol:t}):e.substring(0,1).match(/[0-9]/g)&&e.match(/\D/g)?{address:"",isCol:!1}:(e=(parseInt(e,10)-1).toString(),{address:e,isCol:t})},r.prototype.addHyperlink=function(e,t){this.insertHyperlink(e,t,"",!0)},r.prototype.removeHyperlink=function(e){var t,r,n=this.getActiveSheet();if(e&&-1!==e.indexOf("!")){t=e.split("!");for(var i=this.sheets,a=0;a<i.length;a++)i[a].name===t[0]&&(r=a);n=this.sheets[r],e=t[1]}for(var o,s=c(e?e:this.getActiveSheet().activeCell),l=s[0];l<=s[2];l++)for(var h=s[1];h<=s[3];h++)if(n&&n.rows[l]&&n.rows[l].cells[h]&&(o=n.rows[l].cells[h])&&o.hyperlink&&("string"==typeof o.hyperlink?o.value=o.value?o.value:o.hyperlink:o.value=o.value?o.value:o.hyperlink.address,delete o.hyperlink,o.style&&n===this.getActiveSheet()&&(this.serviceLocator.getService("cell").refreshRange([l,h,l,h]),this.notify("refreshRibbonIcons",null)),n===this.getActiveSheet())){var d=void 0,p=void 0;this.scrollSettings.enableVirtualization&&(d=l-this.viewport.topIndex,p=h-this.viewport.leftIndex);var u=this.element.getElementsByClassName("e-sheet-content")[0].getElementsByClassName("e-row")[d].getElementsByClassName("e-cell")[p];u.getElementsByClassName("e-hyperlink")[0]&&(u.innerText=u.getElementsByClassName("e-hyperlink")[0].innerHTML)}},r.prototype.insertHyperlink=function(r,n,i,a){if(this.allowHyperlink){var o=void 0,s=void 0,l=void 0,h=this.getActiveSheet(),d={hyperlink:r,cell:n=n||this.getActiveSheet().activeCell,cancel:!1},p={hyperlink:r,cell:n};if(a||this.trigger("beforeHyperlinkCreate",d),!d.cancel){if(r=d.hyperlink,n=d.cell,e.prototype.addHyperlink.call(this,r,n),n&&-1!==n.indexOf("!")){o=n.split("!");for(var u=this.sheets,f=0;f<u.length;f++)u[f].name===o[0]&&(s=f);h=this.sheets[s],n=o[1]}if(!h)return;l=c(n=n||this.getActiveSheet().activeCell);var g=h.rows[l[0]].cells[l[1]];t.isNullOrUndefined(g.value)||""===g.value?t.isNullOrUndefined(i)||""===i||(g.value=i):g.value!==i&&(g.value=i),a||this.trigger("afterHyperlinkCreate",p),h===this.getActiveSheet()&&(this.serviceLocator.getService("cell").refreshRange(l),this.notify("refreshRibbonIcons",null))}}},r.prototype.addDataValidation=function(t,r){e.prototype.addDataValidation.call(this,t,r)},r.prototype.removeDataValidation=function(t){e.prototype.removeDataValidation.call(this,t)},r.prototype.addInvalidHighlight=function(t){e.prototype.addInvalidHighlight.call(this,t)},r.prototype.removeInvalidHighlight=function(t){e.prototype.removeInvalidHighlight.call(this,t)},r.prototype.conditionalFormat=function(t){e.prototype.conditionalFormat.call(this,t)},r.prototype.clearConditionalFormat=function(t){t=t||this.getActiveSheet().selectedRange,e.prototype.clearConditionalFormat.call(this,t)},r.prototype.setPanelSize=function(){if("auto"!==this.height){var e=document.getElementById(this.element.id+"_sheet_panel");e.style.height=this.element.getBoundingClientRect().height-He(e)+"px"}},r.prototype.open=function(t){this.isOpen=!0,e.prototype.open.call(this,t),this.isOpen&&this.showSpinner()},r.prototype.hideRow=function(t,r,n){void 0===r&&(r=t),void 0===n&&(n=!0);var i=this.getActiveSheet();!this.renderModule||i.frozenRows||i.frozenColumns?e.prototype.hideRow.call(this,t,r,n):this.notify(er,{startIndex:t,endIndex:r,hide:n})},r.prototype.hideColumn=function(t,r,n){void 0===r&&(r=t),void 0===n&&(n=!0);var i=this.getActiveSheet();!this.renderModule||i.frozenRows||i.frozenColumns?e.prototype.hideColumn.call(this,t,r,n):this.notify(er,{startIndex:t,endIndex:r,hide:n,isCol:!0})},r.prototype.clear=function(e){this.notify(lr,{options:e,isPublic:!0})},r.prototype.refresh=function(t){this.isReact&&this.clearTemplate(),t?this.notify("blankWorkbook",{}):e.prototype.refresh.call(this)},r.prototype.insertImage=function(e,t){var r;for(r=0;r<e.length;r++)this.notify(dr,{options:e[r],range:t||this.getActiveSheet().selectedRange,isPublic:!0})},r.prototype.deleteImage=function(e,t){this.notify(pr,{id:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.getRowHeaderContent=function(){return this.sheetModule.getRowHeaderPanel()},r.prototype.getColumnHeaderContent=function(){return this.sheetModule.getColHeaderPanel()},r.prototype.getMainContent=function(){return this.sheetModule.getContentPanel()},r.prototype.getSelectAllContent=function(){return this.sheetModule.getSelectAllContent()},r.prototype.getScrollElement=function(){return this.sheetModule.getScrollElement()},r.prototype.getContentTable=function(){return this.sheetModule.getContentTable()},r.prototype.getRowHeaderTable=function(){return this.sheetModule.getRowHeaderTable()},r.prototype.getColHeaderTable=function(){return this.sheetModule.getColHeaderTable()},r.prototype.getThreshold=function(e){var t=Math.round((this.viewport[e+"Count"]+1)/2);return t<15?15:t},r.prototype.isMobileView=function(){return(this.cssClass.indexOf("e-mobile-view")>-1||t.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},r.prototype.getValueRowCol=function(t,r,n,i){return e.prototype.getValueRowCol.call(this,t,r,n,i)},r.prototype.updateCell=function(t,r){r=r||this.getActiveSheet().activeCell,e.prototype.updateCell.call(this,t,r),this.serviceLocator.getService("cell").refreshRange(y(r)),this.notify("activeCellChanged",null)},r.prototype.sort=function(t,r){var n=this;return this.allowSorting?e.prototype.sort.call(this,t,r).then(function(e){return n.notify("sortComplete",e),Promise.resolve(e)}):Promise.reject()},r.prototype.setValueRowCol=function(t,r,n,i){if("circular reference: "===r){var a={action:"isCircularReference",argValue:r};this.notify("formulaOperation",a),r=a.argValue}e.prototype.setValueRowCol.call(this,t,r,n,i),t=oe(this,t),this.notify(Wt,{action:"refreshDependentCellValue",rowIdx:n,colIdx:i,sheetIdx:t})},r.prototype.getModuleName=function(){return"spreadsheet"},r.prototype.refreshNode=function(e,r){var n;if(e){var i=t.select("#"+this.element.id+"_currency",e),a="e-right-align";if(r){if(r.result=t.isNullOrUndefined(r.result)?"":r.result.toString(),i&&t.detach(i),"Accounting"===r.type&&L(r.value))return e.querySelector("a")?e.querySelector("a").textContent=r.result.split(r.curSymbol).join(""):e.innerHTML="",e.appendChild(this.createElement("span",{id:this.element.id+"_currency",innerHTML:""+r.curSymbol,styles:"float: left"})),e.querySelector("a")||(e.innerHTML+=r.result.split(r.curSymbol).join("")),void e.classList.add(a);!r.result||"true"!==r.result.toLowerCase()&&"false"!==r.result.toLowerCase()||(r.result=r.result.toUpperCase(),a="e-center-align",r.isRightAlign=!0),n=r.result,r.isRightAlign?e.classList.add(a):e.classList.remove(a)}if(n=t.isNullOrUndefined(n)?"":n,!t.isNullOrUndefined(e)){var o=e.lastChild;e.querySelector(".e-databar-value")&&(o=e.querySelector(".e-databar-value").lastChild),e.querySelector(".e-hyperlink")&&(o=e.querySelector(".e-hyperlink").lastChild),e.querySelector(".e-wrap-content")&&(o=e.querySelector(".e-wrap-content").lastChild),!o||3!==o.nodeType&&1!==o.nodeType?e.appendChild(document.createTextNode(n)):o.nodeValue=n}}},r.prototype.calculateHeight=function(e,t,r){void 0===t&&(t=1),void 0===r&&(r=1);var n=e&&e.fontSize||this.cellStyle.fontSize,i="Arial Black"===e.fontFamily?1.44:1.24;return(n.indexOf("pt")>-1?1.33*parseInt(n,10):parseInt(n,10))*i*t+r*i},r.prototype.skipHidden=function(e,t,r){void 0===r&&(r="rows");var n,i=this.getActiveSheet();this.scrollSettings.isFinite&&(n=("rows"===r?i.rowCount:i.colCount)-1);for(var a=e;a<=t;a++)if(i[r][a]&&i[r][a].hidden){if(i.frozenColumns||i.frozenRows){"rows"===r?Ce(i,a,{hidden:!1}):Ee(i,a,{hidden:!1});continue}if(e===a&&e++,t++,n&&t>n){t=n;break}}return[e,t]},r.prototype.updateActiveBorder=function(e,r){void 0===r&&(r=".e-ribbon");var n=t.select(r+" .e-tab-header .e-indicator",this.element);n.style.display="none",t.setStyleAttribute(n,{left:"",right:""}),t.setStyleAttribute(n,{left:e.offsetLeft+"px",right:e.parentElement.offsetWidth-(e.offsetLeft+e.offsetWidth)+"px"}),n.style.display=""},r.prototype.undo=function(){this.notify("performUndoRedo",{isUndo:!0,isPublic:!0})},r.prototype.redo=function(){this.notify("performUndoRedo",{isUndo:!1,isPublic:!0})},r.prototype.updateUndoRedoCollection=function(e){this.notify("updateUndoRedoCollection",{args:e,isPublic:!0})},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify("formulaOperation",t),t.isAdded},r.prototype.removeDefinedName=function(t,r){return e.prototype.removeDefinedName.call(this,t,r)},r.prototype.mouseClickHandler=function(e){this.notify(Gt,e)},r.prototype.mouseDownHandler=function(e){this.notify("mouseDown",e)},r.prototype.keyUpHandler=function(e){t.closest(e.target,".e-find-dlg")?this.notify("findKeyUp",e):this.notify(Yt,e)},r.prototype.keyDownHandler=function(e){t.closest(e.target,".e-findtool-dlg")||this.notify(Xt,e)},r.prototype.freeze=function(e){var t={row:e.row,column:e.column,cancel:!1,sheetIndex:this.activeSheetIndex};if(this.notify(ir,{eventArgs:t,action:"freezePanes"}),!t.cancel){if(this.on("contentLoaded",this.freezePaneUpdated,this),e.row||e.column){var r=!1;if(this.notify("getFilteredCollection",null),this.filterCollection)for(var n=0,i=this.filterCollection.length;n<i;n++)if(this.filterCollection[n].sheetIndex===this.activeSheetIndex){r=!0;break}r&&this.clearFilter()}this.freezePanes(e.row,e.column),this.notify("refreshRibbonIcons",null)}},r.prototype.freezePaneUpdated=function(){this.off("contentLoaded",this.freezePaneUpdated);var e=this.getActiveSheet();this.notify(nr,{eventArgs:{row:e.frozenRows,column:e.frozenColumns,sheetIndex:this.activeSheetIndex},action:"freezePanes"})},r.prototype.wireEvents=function(){t.EventHandler.add(this.element,"click",this.mouseClickHandler,this),t.EventHandler.add(this.element,qe(),this.mouseDownHandler,this),t.EventHandler.add(this.element,"keyup",this.keyUpHandler,this),t.EventHandler.add(this.element,"keydown",this.keyDownHandler,this),t.EventHandler.add(this.element,"noderefresh",this.refreshNode,this),this.on("freeze",this.freeze,this)},r.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unwireEvents(),this.notify("spreadsheetDestroyed",null),e.prototype.destroy.call(this),this.element.innerHTML="",this.element.removeAttribute("tabindex"),this.element.removeAttribute("role"),this.element.style.removeProperty("height"),this.element.style.removeProperty("width"),this.element.style.removeProperty("min-height"),this.element.style.removeProperty("min-width")},r.prototype.unwireEvents=function(){t.EventHandler.remove(this.element,"click",this.mouseClickHandler),t.EventHandler.remove(this.element,qe(),this.mouseDownHandler),t.EventHandler.remove(this.element,"keyup",this.keyUpHandler),t.EventHandler.remove(this.element,"keydown",this.keyDownHandler),t.EventHandler.remove(this.element,"noderefresh",this.refreshNode),this.off("freeze",this.freeze)},r.prototype.addContextMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify("addContextMenuItems",{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.removeContextMenuItems=function(e,t){this.notify("removeContextMenuItems",{items:e,isUniqueId:t})},r.prototype.enableContextMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify("enableContextMenuItems",{items:e,enable:t,isUniqueId:r})},r.prototype.enableFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify("enableFileMenuItems",{items:e,enable:t,isUniqueId:r})},r.prototype.hideFileMenuItems=function(e,t,r){void 0===t&&(t=!0),this.notify("hideFileMenuItems",{items:e,hide:t,isUniqueId:r})},r.prototype.addFileMenuItems=function(e,t,r,n){void 0===r&&(r=!0),this.notify("addFileMenuItems",{items:e,text:t,insertAfter:r,isUniqueId:n})},r.prototype.hideRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify("hideRibbonTabs",{tabs:e,hide:t})},r.prototype.enableRibbonTabs=function(e,t){void 0===t&&(t=!0),this.notify("enableRibbonTabs",{tabs:e,enable:t})},r.prototype.addRibbonTabs=function(e,t){this.notify("addRibbonTabs",{items:e,insertBefore:t})},r.prototype.enableToolbarItems=function(e,t,r){this.notify("enableToolbarItems",[{tab:e,items:t,enable:void 0===r||r}])},r.prototype.hideToolbarItems=function(e,t,r){void 0===r&&(r=!0),this.notify("hideToolbarItems",{tab:e,indexes:t,hide:r})},r.prototype.addToolbarItems=function(e,t,r){this.notify("addToolbarItems",{tab:e,items:t,index:r})},r.prototype.selectRange=function(e){this.notify("selectRange",{address:e})},r.prototype.startEdit=function(){this.notify(Wt,{action:"startEdit",isNewValueEdit:!1})},r.prototype.closeEdit=function(){this.notify(Wt,{action:"cancelEdit"})},r.prototype.endEdit=function(){this.notify(Wt,{action:"endEdit"})},r.prototype.onPropertyChanged=function(r,n){var i=this;e.prototype.onPropertyChanged.call(this,r,n);for(var a=0,o=Object.keys(r);a<o.length;a++){var s=void 0,l=void 0;switch(o[a]){case"enableRtl":if((s=this.getColumnHeaderContent())&&(s=s.parentElement),!s)break;r.enableRtl?(s.style.marginLeft=Oe()+"px",s.style.marginRight="",document.getElementById(this.element.id+"_sheet_panel").classList.add("e-rtl")):(s.style.marginRight=Oe()+"px",s.style.marginLeft="",document.getElementById(this.element.id+"_sheet_panel").classList.remove("e-rtl")),this.renderModule.refreshSheet();break;case"cssClass":n.cssClass&&t.removeClass([this.element],n.cssClass.split(" ")),r.cssClass&&t.addClass([this.element],r.cssClass.split(" "));break;case"activeSheetIndex":this.renderModule.refreshSheet(),this.notify("activeSheetChanged",{idx:r.activeSheetIndex});break;case"width":this.setWidth(),this.resize();break;case"height":this.setHeight(),this.resize();break;case"showRibbon":this.notify("ribbon",{uiUpdate:!0});break;case"showFormulaBar":this.notify("formulaBar",{uiUpdate:!0});break;case"showSheetTabs":this.notify("sheetTabs",null);break;case"cellStyle":this.renderModule.refreshSheet();break;case"allowEditing":this.allowEditing&&this.notify(Wt,{action:"renderEditor"});break;case"allowInsert":(l=this.element.getElementsByClassName("e-add-sheet-tab")[0])&&(l.disabled=!this.allowInsert,this.allowInsert?l.classList.contains("e-disabled")&&l.classList.remove("e-disabled"):l.classList.contains("e-disabled")||l.classList.add("e-disabled"));break;case"sheets":if(r.sheets===this.sheets){this.renderModule.refreshSheet(),this.notify("refreshSheetTabs",null);break}Object.keys(r.sheets).forEach(function(e,n){var a=r.sheets[e];if(a.ranges&&Object.keys(a.ranges).length){var o,s=Object.keys(a.ranges);s.forEach(function(e,t){a.ranges[e].info||(o=t)}),s.forEach(function(r,n){a.ranges[r].dataSource&&(t.isUndefined(o)||!t.isUndefined(o)&&o===n)&&i.notify("dataSourceChanged",{sheetIdx:e,rangeIdx:r,isLastRange:s.length-1===n})})}else 0===n&&i.renderModule.refreshSheet(),i.showSheetTabs&&a.name&&i.notify("sheetNameUpdate",{items:i.element.querySelector(".e-sheet-tabs-items").children[e],value:a.name,idx:e})});break;case"locale":this.refresh();break;case"password":this.password.length>0&&this.showSheetTabs&&(this.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"));break;case"isProtected":if(this.isProtected){var h=this.element.getElementsByClassName("e-add-sheet-tab")[0];h&&(h.disabled=this.isProtected,this.isProtected?h.classList.contains("e-disabled")&&h.classList.add("e-disabled"):h.classList.contains("e-disabled")||h.classList.remove("e-disabled"))}}}},r.prototype.requiredModules=function(){return Te(this)},r.prototype.appendTo=function(t){e.prototype.appendTo.call(this,t)},r.prototype.filter=function(t,r){return this.allowFiltering?(r=r||this.getActiveSheet().selectedRange,e.prototype.filter.call(this,t,r)):Promise.reject()},r.prototype.clearFilter=function(t){t?this.notify("clearFilter",{field:t}):e.prototype.clearFilter.call(this)},r.prototype.applyFilter=function(e,t){this.notify(rr,{predicates:e,range:t})},r.prototype.addCustomFunction=function(t,r){e.prototype.addCustomFunction.call(this,t,r),this.notify("refreshFormulaDatasource",null)};var n;return Vi([t.Property("")],r.prototype,"cssClass",void 0),Vi([t.Property(!0)],r.prototype,"allowScrolling",void 0),Vi([t.Property(!0)],r.prototype,"allowResizing",void 0),Vi([t.Property(!0)],r.prototype,"enableClipboard",void 0),Vi([t.Property(!0)],r.prototype,"enableContextMenu",void 0),Vi([t.Property(!0)],r.prototype,"enableKeyboardNavigation",void 0),Vi([t.Property(!0)],r.prototype,"enableKeyboardShortcut",void 0),Vi([t.Property(!0)],r.prototype,"allowUndoRedo",void 0),Vi([t.Property(!0)],r.prototype,"allowWrap",void 0),Vi([t.Complex({},Ei)],r.prototype,"selectionSettings",void 0),Vi([t.Complex({},Ii)],r.prototype,"scrollSettings",void 0),Vi([t.Event()],r.prototype,"beforeCellRender",void 0),Vi([t.Event()],r.prototype,"beforeSelect",void 0),Vi([t.Event()],r.prototype,"select",void 0),Vi([t.Event()],r.prototype,"contextMenuBeforeOpen",void 0),Vi([t.Event()],r.prototype,"fileMenuBeforeOpen",void 0),Vi([t.Event()],r.prototype,"contextMenuBeforeClose",void 0),Vi([t.Event()],r.prototype,"dialogBeforeOpen",void 0),Vi([t.Event()],r.prototype,"fileMenuBeforeClose",void 0),Vi([t.Event()],r.prototype,"contextMenuItemSelect",void 0),Vi([t.Event()],r.prototype,"fileMenuItemSelect",void 0),Vi([t.Event()],r.prototype,"beforeDataBound",void 0),Vi([t.Event()],r.prototype,"dataBound",void 0),Vi([t.Event()],r.prototype,"dataSourceChanged",void 0),Vi([t.Event()],r.prototype,"cellEdit",void 0),Vi([t.Event()],r.prototype,"cellEditing",void 0),Vi([t.Event()],r.prototype,"cellSave",void 0),Vi([t.Event()],r.prototype,"beforeCellSave",void 0),Vi([t.Event()],r.prototype,"created",void 0),Vi([t.Event()],r.prototype,"beforeSort",void 0),Vi([t.Event()],r.prototype,"beforeHyperlinkCreate",void 0),Vi([t.Event()],r.prototype,"afterHyperlinkCreate",void 0),Vi([t.Event()],r.prototype,"beforeHyperlinkClick",void 0),Vi([t.Event()],r.prototype,"afterHyperlinkClick",void 0),Vi([t.Event()],r.prototype,"actionBegin",void 0),Vi([t.Event()],r.prototype,"actionComplete",void 0),Vi([t.Event()],r.prototype,"openComplete",void 0),Vi([t.Event()],r.prototype,"sortComplete",void 0),r=n=Vi([t.NotifyPropertyChanges],r)}(In);return zi.Inject(On,Hn,_n,Un,qn,Bn,fi,hi,li,ui,ci,pi,qt,Si,bi,Vn,gi,di),e.Workbook=In,e.Range=vn,e.UsedRange=yn,e.Sheet=Cn,e.getSheetIndex=ae,e.getSheetIndexFromId=oe,e.getSheetNameFromAddress=se,e.getSheetIndexByName=le,e.updateSelectedRange=he,e.getSelectedRange=de,e.getSingleSelectedRange=pe,e.getSheet=ce,e.getSheetNameCount=ue,e.getMaxSheetId=fe,e.initSheet=ge,e.getSheetName=ve,e.Row=kn,e.getRow=ye,e.setRow=Ce,e.isHiddenRow=be,e.getRowHeight=Se,e.setRowHeight=xe,e.getRowsHeight=we,e.Column=Fn,e.getColumn=Ie,e.setColumn=Ee,e.getColumnWidth=Re,e.getColumnsWidth=ke,e.isHiddenCol=Ae,e.Cell=fn,e.getCell=$,e.setCell=Z,e.skipDefaultValue=J,e.wrap=Q,e.getData=ee,e.getModel=re,e.processIdx=ne,e.clearRange=ie,e.getRangeIndexes=c,e.getCellIndexes=u,e.getColIndex=f,e.getCellAddress=g,e.getRangeAddress=m,e.getColumnHeaderText=v,e.getIndexesFromAddress=y,e.getRangeFromAddress=C,e.getAddressFromSelectedRange=b,e.getAddressInfo=S,e.getSwapRange=x,e.isSingleCell=I,e.executeTaskAsync=E,e.WorkbookBasicModule=qr,e.WorkbookAllModule=jr,e.getWorkbookRequiredModules=z,e.CellStyle=Yr,e.FilterCollection=Xr,e.SortCollection=Kr,e.DefineName=$r,e.ProtectSettings=Zr,e.Hyperlink=Jr,e.Validation=Qr,e.Format=en,e.ConditionalFormat=tn,e.LegendSettings=rn,e.DataLabelSettings=nn,e.MajorGridLines=an,e.MinorGridLines=on,e.Axis=sn,e.Chart=ln,e.Image=hn,e.workbookDestroyed="workbookDestroyed",e.updateSheetFromDataSource=xt,e.dataSourceChanged="dataSourceChanged",e.dataChanged="dataChanged",e.triggerDataChange="triggerDataChange",e.workbookOpen="workbookOpen",e.beginSave="beginSave",e.sortImport="sortImport",e.ribbonFind="ribbonFind",e.getFilteredCollection="getFilteredCollection",e.saveCompleted="saveCompleted",e.applyNumberFormatting="applyNumber",e.getFormattedCellObject="getFormattedCell",e.refreshCellElement="refreshCellElem",e.setCellFormat=wt,e.findAllValues="findAllValues",e.textDecorationUpdate="textDecorationUpdate",e.applyCellFormat=It,e.updateUsedRange="updateUsedRange",e.workbookFormulaOperation=Et,e.workbookEditOperation="workbookEditOperation",e.checkDateFormat=Rt,e.getFormattedBarText="getFormattedBarText",e.activeCellChanged="activeCellChanged",e.openSuccess="openSuccess",e.openFailure="openFailure",e.sheetCreated="sheetCreated",e.sheetsDestroyed="sheetsDestroyed",e.aggregateComputation="aggregateComputation",e.beforeSort="beforeSort",e.initiateSort=kt,e.sortComplete="sortComplete",e.sortRangeAlert="sortRangeAlert",e.initiatelink="initiatelink",e.beforeHyperlinkCreate="beforeHyperlinkCreate",e.afterHyperlinkCreate="afterHyperlinkCreate",e.beforeHyperlinkClick="beforeHyperlinkClick",e.afterHyperlinkClick="afterHyperlinkClick",e.addHyperlink="addHyperlink",e.setLinkModel="setLinkModel",e.beforeFilter="beforeFilter",e.initiateFilter="initiateFilter",e.filterComplete="filterComplete",e.filterRangeAlert="filterRangeAlert",e.clearAllFilter="clearAllFilter",e.wrapEvent=At,e.onSave="onSave",e.insert="insert",e.deleteAction="delete",e.insertModel=Tt,e.deleteModel="deleteModel",e.isValidation="isValidation",e.setValidation=Ft,e.addHighlight="addHighlight",e.dataValidate="dataValidate",e.findNext="findNext",e.findPrevious="findPrevious",e.goto=Lt,e.findWorkbookHandler="findHandler",e.replaceHandler="replace",e.replaceAllHandler="replaceAll",e.showDialog=Nt,e.findUndoRedo="findUndoRedo",e.findKeyUp="findKeyUp",e.removeValidation=Dt,e.removeHighlight="removeHighlight",e.queryCellInfo=Ot,e.count="count",e.findCount="findCount",e.protectSheetWorkBook="protectSheet",e.updateToggle="updateToggleItem",e.protectsheetHandler="protectsheetHandler",e.replaceAllDialog="replaceAllDialog",e.unprotectsheetHandler="unprotectsheetHandler",e.workBookeditAlert="editAlert",e.setLockCells="setLockCells",e.applyLockCells="applyLockCells",e.setMerge=Ht,e.applyMerge="applyMerge",e.mergedRange="mergedRange",e.activeCellMergedRange="activeCellMergedRange",e.insertMerge="insertMerge",e.pasteMerge="pasteMerge",e.setCFRule=Bt,e.cFInitialCheck="cFInitialCheck",e.clearCFRule=Mt,e.initiateClearCFRule="initiateClearCFRule",e.cFRender="cFRender",e.cFDelete=Pt,e.clear="clear",e.clearCF="clearCF",e.clearCells=_t,e.setImage="setImage",e.setChart=Ut,e.initiateChart="initiateChart",e.refreshRibbonIcons="refreshRibbonIcons",e.refreshChart="refreshChart",e.refreshChartSize=Vt,e.updateChart="updateChart",e.deleteChartColl="deleteChartColl",e.initiateChartModel="initiateChartModel",e.focusChartBorder="focusChartBorder",e.saveError="saveError",e.validationHighlight="validationHighlight",e.dataRefresh="dataRefresh",e.updateFilter="updateFilter",e.checkIsFormula=q,e.isCellReference=j,e.isChar=W,e.inRange=G,e.isInRange=Y,e.isLocked=X,e.isValidCellReference=K,e.toFraction=R,e.getGcd=k,e.intToDate=A,e.dateToInt=T,e.isDateTime=F,e.isNumber=L,e.toDate=N,e.parseIntValue=D,e.workbookLocale=dn,e.localeData=pn,e.DataBind=qt,e.WorkbookOpen=ur,e.WorkbookSave=mr,e.WorkbookFormula=Ar,e.WorkbookNumberFormat=zt,e.getFormatFromType=O,e.getTypeFromFormat=H,e.WorkbookSort=Tr,e.WorkbookFilter=Fr,e.WorkbookImage=Lr,e.WorkbookChart=Nr,e.WorkbookCellFormat=Dr,e.WorkbookEdit=Or,e.WorkbookHyperlink=Hr,e.WorkbookInsert=Br,e.WorkbookDelete=Mr,e.WorkbookDataValidation=Pr,e.WorkbookFindAndReplace=_r,e.WorkbookProtectSheet=Ur,e.WorkbookMerge=Vr,e.WorkbookConditionalFormat=zr,e.getRequiredModules=Te,e.ribbon="ribbon",e.formulaBar="formulaBar",e.sheetTabs="sheetTabs",e.refreshSheetTabs="refreshSheetTabs",e.isFormulaBarEdit="isFormulaBarEdit",e.initialLoad=jt,e.contentLoaded="contentLoaded",e.mouseDown="mouseDown",e.spreadsheetDestroyed="spreadsheetDestroyed",e.editOperation=Wt,e.formulaOperation="formulaOperation",e.formulaBarOperation="formulaBarOperation",e.click=Gt,e.keyUp=Yt,e.keyDown=Xt,e.formulaKeyUp="formulaKeyUp",e.formulaBarUpdate="formulaBarUpdate",e.onVerticalScroll="verticalScroll",e.onHorizontalScroll="horizontalScroll",e.beforeContentLoaded="beforeContentLoaded",e.beforeVirtualContentLoaded="beforeVirtualContentLoaded",e.virtualContentLoaded="virtualContentLoaded",e.contextMenuOpen="contextMenuOpen",e.cellNavigate="cellNavigate",e.mouseUpAfterSelection="mouseUpAfterSelection",e.selectionComplete="selectionComplete",e.cMenuBeforeOpen=Kt,e.insertSheetTab="insertSheetTab",e.removeSheetTab=$t,e.renameSheetTab="renameSheetTab",e.ribbonClick="ribboClick",e.refreshRibbon="ribbonRefresh",e.enableToolbarItems="enableToolbarItems",e.tabSwitch="tabSwitch",e.selectRange="selectRange",e.cut=Zt,e.copy="copy",e.paste=Jt,e.clearCopy="clearCopy",e.dataBound="dataBound",e.beforeDataBound="beforeDataBound",e.addContextMenuItems="addContextMenuItems",e.removeContextMenuItems="removeContextMenuItems",e.enableContextMenuItems="enableContextMenuItems",e.enableFileMenuItems="enableFileMenuItems",e.hideFileMenuItems="hideFileMenuItems",e.addFileMenuItems="addFileMenuItems",e.hideRibbonTabs="hideRibbonTabs",e.enableRibbonTabs="enableRibbonTabs",e.addRibbonTabs="addRibbonTabs",e.addToolbarItems="addToolbarItems",e.hideToolbarItems="hideToolbarItems",e.beforeRibbonCreate="beforeRibbonCreate",e.rowHeightChanged=Qt,e.colWidthChanged="colWidthChanged",e.onContentScroll="onContentScroll",e.deInitProperties="deInitProperties",e.activeSheetChanged="activeSheetChanged",e.renameSheet="renameSheet",e.initiateCustomSort="initiateCustomSort",e.applySort="applySort",e.collaborativeUpdate="collaborativeUpdate",e.hideShow=er,e.autoFit=tr,e.updateToggleItem="updateToggleItem",e.initiateHyperlink="initiateHyperlink",e.editHyperlink="editHyperlink",e.openHyperlink="openHyperlink",e.removeHyperlink="removeHyperlink",e.createHyperlinkElement="createHyperlinkElement",e.sheetNameUpdate="sheetNameUpdate",e.hideSheet="hideSheet",e.performUndoRedo="performUndoRedo",e.updateUndoRedoCollection="updateUndoRedoCollection",e.setActionData="setActionData",e.getBeforeActionData="getBeforeActionData",e.clearUndoRedoCollection="clearUndoRedoCollection",e.initiateFilterUI=rr,e.renderFilterCell="renderFilterCell",e.reapplyFilter="reapplyFilter",e.filterByCellValue="filterByCellValue",e.clearFilter="clearFilter",e.getFilteredColumn="getFilteredColumn",e.completeAction=nr,e.beginAction=ir,e.filterCellKeyDown="filterCellKeyDown",e.getFilterRange="getFilterRange",e.setAutoFit="setAutoFit",e.refreshFormulaDatasource="refreshFormulaDatasource",e.setScrollEvent="setScrollEvent",e.initiateDataValidation="initiatedatavalidation",e.validationError="validationError",e.startEdit="startEdit",e.invalidData="invalidData",e.clearInvalid="clearInvalid",e.protectSheet="protectSheet",e.applyProtect="applyProtect",e.unprotectSheet="unprotectSheet",e.protectCellFormat="protectCellFormat",e.gotoDlg=ar,e.findDlg=or,e.findHandler="findHandler",e.replace=sr,e.created="created",e.editAlert="editAlert",e.setUndoRedo="setUndoRedo",e.enableFormulaInput="enableFormulaInput",e.protectSelection="protectSelection",e.hiddenMerge="hiddenMerge",e.checkPrevMerge="checkPrevMerge",e.checkMerge="checkMerge",e.removeDataValidation="removeDataValidation",e.showAggregate="showAggregate",e.initiateConditionalFormat="initiateConditionalFormat",e.checkConditionalFormat="checkConditionalFormat",e.setCF="setCF",e.clearViewer=lr,e.initiateFormulaReference="initiateFormulaReference",e.initiateCur="initiateCur",e.clearCellRef="clearCellRef",e.editValue="editValue",e.addressHandle="addressHandle",e.initiateEdit="initiateEdit",e.forRefSelRender="forRefSelRender",e.blankWorkbook="blankWorkbook",e.insertImage="insertImage",e.refreshImgElem="refreshImgElem",e.refreshImgCellObj=hr,e.getRowIdxFromClientY="getRowIdxFromClientY",e.getColIdxFromClientX="getColIdxFromClientX",e.createImageElement=dr,e.deleteImage=pr,e.deleteChart=cr,e.refreshChartCellObj="refreshChartCellObj",e.refreshImagePosition="refreshImagePosition",e.updateTableWidth="updateTableWidth",e.focusBorder="focusBorder",e.clearChartBorder="clearChartBorder",e.insertChart="insertChart",e.chartRangeSelection="chartRangeSelection",e.insertDesignChart="insertDesignChart",e.removeDesignChart="removeDesignChart",e.chartDesignTab="chartDesignTab",e.addChartEle="addChartEle",e.isReact="isReact",e.renderReactTemplates="renderReactTemplates",e.clearTemplate="clearTemplate",e.protectWorkbook="protectWorkbook",e.unProtectWorkbook="unProtectWorkbook",e.getPassWord="getPassWord",e.importProtectWorkbook="importProtectWorkbook",e.selectionStatus="selectionStatus",e.freeze="freeze",e.overlayEleSize="overlayEleSize",e.getUpdateUsingRaf=Le,e.removeAllChildren=Ne,e.getColGroupWidth=De,e.getScrollBarWidth=Oe,e.getSiblingsHeight=He,e.inView=Me,e.getCellPosition=Pe,e.setPosition=_e,e.removeRangeEle=Ue,e.locateElem=Ve,e.setStyleAttribute=ze,e.getStartEvent=qe,e.getMoveEvent=je,e.getEndEvent=We,e.isTouchStart=Ge,e.isTouchMove=Ye,e.isTouchEnd=Xe,e.isMouseDown=Ke,e.isMouseMove=$e,e.isMouseUp=Ze,e.getClientX=Je,e.getClientY=Qe,e.getDPRValue=et,e.setAriaOptions=tt,e.destroyComponent=rt,e.setResize=nt,e.setWidthAndHeight=it,e.findMaxValue=at,e.updateAction=ot,e.hasTemplate=st,e.setRowEleHeight=lt,e.getTextHeight=ht,e.getTextWidth=dt,e.getLines=pt,e.getBorderHeight=ut,e.getExcludedColumnWidth=ft,e.getTextHeightWithBorder=gt,e.setMaxHgt=mt,e.getMaxHgt=vt,e.skipHiddenIdx=yt,e.focus=Ct,e.isLockedCells=bt,e.BasicModule=bi,e.AllModule=Si,e.ScrollSettings=Ii,e.SelectionSettings=Ei,e.DISABLED="e-disabled",e.WRAPTEXT=Ri,e.locale=ki,e.dialog=Ai,e.actionEvents="actionEvents",e.overlay=Ti,e.fontColor=Fi,e.fillColor=Li,e.defaultLocale=Ni,e.Spreadsheet=zi,e.Clipboard=On,e.Edit=Hn,e.Selection=Bn,e.Scroll=Mn,e.VirtualScroll=Pn,e.KeyboardNavigation=_n,e.KeyboardShortcut=Un,e.CellFormat=Vn,e.Resize=zn,e.CollaborativeEditing=qn,e.ShowHide=jn,e.SpreadsheetHyperlink=Wn,e.UndoRedo=Gn,e.WrapText=Yn,e.Insert=Xn,e.Delete=Kn,e.DataValidation=$n,e.ProtectSheet=Zn,e.FindAndReplace=Jn,e.Merge=Qn,e.ConditionalFormatting=ei,e.Ribbon=li,e.FormulaBar=hi,e.Formula=di,e.SheetTabs=pi,e.Open=ci,e.Save=ui,e.ContextMenu=fi,e.NumberFormat=gi,e.Sort=mi,e.Filter=vi,e.SpreadsheetImage=yi,e.SpreadsheetChart=Ci,e.Render=Bi,e.SheetRender=Di,e.RowRenderer=Oi,e.CellRenderer=Hi,e.Calculate=wr,e.FormulaError=Ir,e.FormulaInfo=Er,e.CalcSheetFamilyItem=Rr,e.getAlphalabel=V,e.ValueChangedArgs=kr,e.Parser=br,e.CalculateCommon=vr,e.isUndefined=B,e.getSkeletonVal=M,e.getModules=P,e.getValue=_,e.setValue=U,e.ModuleLoader=yr,e.BasicFormulas=Cr,e}({},ej.base,ej.data,ej.navigations,ej.inputs,ej.buttons,ej.dropdowns,ej.lists,ej.splitbuttons,ej.popups,ej.grids,ej.charts),this.ejs=ej;
|