From ab8aecd297efe7dab3e27ec67f8f8d3c18b3ed2c Mon Sep 17 00:00:00 2001 From: paulhodel Date: Thu, 7 Nov 2019 18:15:52 +0000 Subject: [PATCH] prepare extend to setDATA, fix insertColumn undo/redo --- dist/jexcel.js | 65 ++++++++++++++++++++++++--------------------- dist/jexcel.min.css | 1 - dist/jexcel.min.js | 1 - example.html | 4 +-- 4 files changed, 37 insertions(+), 34 deletions(-) delete mode 100644 dist/jexcel.min.css delete mode 100644 dist/jexcel.min.js diff --git a/dist/jexcel.js b/dist/jexcel.js index 487a2c2c..c30bf302 100644 --- a/dist/jexcel.js +++ b/dist/jexcel.js @@ -380,9 +380,6 @@ var jexcel = (function(el, options) { } obj.createTable = function() { - // Data - obj.prepareData(); - // Elements obj.table = document.createElement('table'); obj.thead = document.createElement('thead'); @@ -603,28 +600,6 @@ var jexcel = (function(el, options) { } } - /** - * Make sure the data is in the correct format (json/array) - * - * @param data - * @return void - */ - obj.prepareData = function() { - var data = []; - - if (obj.options.data) { - for (var j = 0; j < obj.options.data.length; j++) { - var row = []; - for (var i = 0; i < obj.options.columns.length; i++) { - row[i] = obj.options.data[j][obj.options.columns[i].name]; - } - data.push(row); - } - - obj.options.data = data; - } - } - /** * Set data * @@ -646,6 +621,20 @@ var jexcel = (function(el, options) { obj.options.data = []; } + // Prepare data + if (obj.options.data) { + var data = []; + for (var j = 0; j < obj.options.data.length; j++) { + var row = []; + for (var i = 0; i < obj.options.columns.length; i++) { + row[i] = obj.options.data[j][obj.options.columns[i].name]; + } + data.push(row); + } + + obj.options.data = data; + } + // Adjust minimal dimensions var j = 0; var i = 0; @@ -834,7 +823,9 @@ var jexcel = (function(el, options) { // Update cell var columnName = jexcel.getColumnNameFromId([ i, rowNumber ]); // Set value - obj.setValue(columnName, data[i]); + if (data[i] != null) { + obj.setValue(columnName, data[i]); + } } } @@ -850,6 +841,20 @@ var jexcel = (function(el, options) { return dataset; } + /** + * Set a column data by colNumber + */ + obj.setColumnData = function(colNumber, data) { + for (var j = 0; j < obj.rows.length; j++) { + // Update cell + var columnName = jexcel.getColumnNameFromId([ colNumber, j ]); + // Set value + if (data[j] != null) { + obj.setValue(columnName, data[j]); + } + } + } + /** * Create row */ @@ -2619,7 +2624,7 @@ var jexcel = (function(el, options) { if (height > 0) { // In case the column is an object if (typeof(row) == 'object') { - column = $(row).getAttribute('data-y'); + row = $(row).getAttribute('data-y'); } // Oldwidth @@ -3724,7 +3729,7 @@ var jexcel = (function(el, options) { columnNumber:columnNumber, numOfColumns:numOfColumns, insertBefore:insertBefore, - columns:properties.columns, + columns:properties, headers:historyHeaders, colgroup:historyColgroup, records:historyRecords, @@ -7171,9 +7176,9 @@ if (typeof(jQuery) != 'undefined') { $.fn.jexcel = function(method) { var spreadsheetContainer = $(this).get(0); if (! spreadsheetContainer.jexcel) { - jexcel($(this).get(0), arguments[0]); + return jexcel($(this).get(0), arguments[0]); } else { - spreadsheetContainer.jexcel[method].apply(this, Array.prototype.slice.call( arguments, 1 )); + return spreadsheetContainer.jexcel[method].apply(this, Array.prototype.slice.call( arguments, 1 )); } }; diff --git a/dist/jexcel.min.css b/dist/jexcel.min.css deleted file mode 100644 index 3ad9f415..00000000 --- a/dist/jexcel.min.css +++ /dev/null @@ -1 +0,0 @@ -:root{--jexcel-border-color:#000}.jexcel_container{display:inline-block;padding-right:2px;box-sizing:border-box;overscroll-behavior:contain}.jexcel_container.fullscreen{position:fixed;top:0;left:0;width:100%;height:100%;z-index:2001}.jexcel_container.fullscreen .jexcel_content{overflow:auto;width:100%;height:100%;background-color:#fff}.jexcel_container.fullscreen.with-toolbar{height:calc(100% - 46px)}.jexcel_content{display:inline-block;box-sizing:border-box;padding-right:2px;position:relative}.jexcel{border-collapse:separate;table-layout:fixed;white-space:nowrap;empty-cells:show;border:0;background-color:#fff;width:0;border-top:1px solid transparent;border-left:1px solid transparent;border-right:1px solid #ccc;border-bottom:1px solid #ccc}.jexcel>thead>tr>td{border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid transparent;border-bottom:1px solid transparent;background-color:#f3f3f3;padding:2px;cursor:pointer;box-sizing:border-box;overflow:hidden;position:sticky;top:0;z-index:2000}.jexcel>thead.draggable>tr>td::before{content:'\00a0';width:100%;height:3px;position:absolute;bottom:0;left:0;cursor:move}.jexcel>thead.resizable>tr>td::after{content:'\00a0';width:3px;height:100%;position:absolute;top:0;right:0;cursor:col-resize}.jexcel>thead>tr>td.dragging{background-color:#fff;opacity:.5}.jexcel>thead>tr.jexcel_nested>td::after,.jexcel>thead>tr.jexcel_nested>td::before,.jexcel>thead>tr>td:first-child:after{cursor:default}.jexcel>thead>tr>td.selected{background-color:#dcdcdc}.jexcel>thead>tr>td.arrow-up{background-repeat:no-repeat;background-position:center right 5px;background-image:url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath d='M7 14l5-5 5 5H7z' fill='gray'/%3E%3C/svg%3E");text-decoration:underline}.jexcel>thead>tr>td.arrow-down{background-repeat:no-repeat;background-position:center right 5px;background-image:url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath d='M7 10l5 5 5-5H7z' fill='gray'/%3E%3C/svg%3E");text-decoration:underline}.jexcel>tbody>tr>td:first-child{position:relative;background-color:#f3f3f3;text-align:center}.jexcel>tbody.resizable>tr>td:first-child::before{content:'\00a0';width:100%;height:3px;position:absolute;bottom:0;left:0;cursor:row-resize}.jexcel>tbody.draggable>tr>td:first-child::after{content:'\00a0';width:3px;height:100%;position:absolute;top:0;right:0;cursor:move}.jexcel>tbody>tr.dragging>td{background-color:#eee;opacity:.5}.jexcel>tbody>tr>td{border-top:1px solid #ccc;border-left:1px solid #ccc;border-right:1px solid transparent;border-bottom:1px solid transparent;padding:4px;white-space:nowrap;box-sizing:border-box;line-height:1em}.jexcel>tbody>tr>td:last-child{overflow:hidden}.jexcel>tbody>tr>td>img{display:inline-block;max-width:100px}.jexcel>tbody>tr>td.readonly{color:rgba(0,0,0,.3)}.jexcel>tbody>tr.selected>td:first-child{background-color:#dcdcdc}.jexcel>tbody>tr>td>input,.jexcel>tbody>tr>td>select,.jexcel>tbody>tr>td>textarea{border:0;border-radius:0;outline:0;width:100%;margin:0;padding:0;background-color:transparent;box-sizing:border-box}.jexcel>tbody>tr>td>textarea{resize:none;padding-top:6px!important}.jexcel>tbody>tr>td>input[type=checkbox]{width:12px;margin-top:2px}.jexcel>tbody>tr>td>input[type=radio]{width:12px;margin-top:2px}.jexcel>tbody>tr>td>select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-repeat:no-repeat;background-position-x:100%;background-position-y:40%;background-image:url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSdibGFjaycgaGVpZ2h0PScyNCcgdmlld0JveD0nMCAwIDI0IDI0JyB3aWR0aD0nMjQnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Zyc+PHBhdGggZD0nTTcgMTBsNSA1IDUtNXonLz48cGF0aCBkPSdNMCAwaDI0djI0SDB6JyBmaWxsPSdub25lJy8+PC9zdmc+)}.jexcel>tbody>tr>td.dropdown{background-repeat:no-repeat;background-position:top 50% right 5px;background-image:url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath d='M7 10l5 5 5-5H7z' fill='lightgray'/%3E%3C/svg%3E");text-overflow:ellipsis;overflow-x:hidden}.jexcel>tbody>tr>td.dropdown.jexcel_comments{background:url("data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='none' d='M0 0h24v24H0V0z'/%3E%3Cpath d='M7 10l5 5 5-5H7z' fill='lightgray'/%3E%3C/svg%3E") top 50% right 5px no-repeat,url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFuGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHhtcDpNb2RpZnlEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDphMTlhZDJmOC1kMDI2LTI1NDItODhjOS1iZTRkYjkyMmQ0MmQiIHhtcE1NOkRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpkOGI5NDUyMS00ZjEwLWQ5NDktYjUwNC0wZmU1N2I3Nzk1MDEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIHN0RXZ0OndoZW49IjIwMTktMDEtMzFUMTg6NTU6MDhaIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmExOWFkMmY4LWQwMjYtMjU0Mi04OGM5LWJlNGRiOTIyZDQyZCIgc3RFdnQ6d2hlbj0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4En6MDAAAAX0lEQVQYlX3KOw6AIBBAwS32RpJADXfx0pTET+ERZJ8F8RODFtONsG0QAoh0CSDM82dqodaBdQXnfoLZQM7gPai+wjNNE8R4pTuAYNZSKZASqL7CMy0LxNgJp30fKYUDi3+vIqb/+rUAAAAASUVORK5CYII=) top right no-repeat}.jexcel>tbody>tr>td>.color{width:90%;height:10px;margin:auto}.jexcel .highlight{background-color:rgba(0,0,0,.05)}.jexcel .highlight-top{border-top:1px solid #000;box-shadow:0 -1px #ccc}.jexcel .highlight-left{border-left:1px solid #000;box-shadow:-1px 0 #ccc}.jexcel .highlight-right{border-right:1px solid #000}.jexcel .highlight-bottom{border-bottom:1px solid #000}.jexcel .highlight-top.highlight-left{box-shadow:-1px -1px #ccc;-webkit-box-shadow:-1px -1px #ccc;-moz-box-shadow:-1px -1px #ccc}.jexcel .highlight-selected{background-color:rgba(0,0,0,0)}.jexcel .selection{background-color:rgba(0,0,0,.05)}.jexcel .selection-left{border-left:1px dotted #000}.jexcel .selection-right{border-right:1px dotted #000}.jexcel .selection-top{border-top:1px dotted #000}.jexcel .selection-bottom{border-bottom:1px dotted #000}.jexcel_corner{position:absolute;background-color:#000;height:1px;width:1px;border:1px solid #fff;top:-2000px;left:-2000px;cursor:crosshair;box-sizing:initial;z-index:7000;padding:2px}.jexcel .editor{outline:0 solid transparent;overflow:visible;white-space:nowrap;text-align:left;padding:0;box-sizing:border-box;overflow:visible!important}.jexcel .editor>input{padding-left:4px}.jexcel .editor .jupload{position:fixed;top:100%;z-index:8000;user-select:none;-webkit-font-smoothing:antialiased;font-size:.875rem;letter-spacing:.2px;-webkit-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2);box-shadow:0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12),0 5px 5px -3px rgba(0,0,0,.2);padding:10px;background-color:#fff;width:300px;min-height:225px;margin-top:2px}.jexcel .editor .jupload img{width:100%;height:auto}.jexcel .editor .jclose:after{position:absolute;top:0;right:0;margin:10px;content:'close';font-family:'Material icons';font-size:24px;width:24px;height:24px;line-height:24px;cursor:pointer;text-shadow:0 0 5px #fff}.jexcel,.jexcel td,.jexcel_corner{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;user-drag:none}.jexcel_textarea{position:absolute;top:-999px;left:-999px;width:1px;height:1px}.jexcel .dragline{position:absolute}.jexcel .dragline div{position:relative;top:-6px;height:5px;width:22px}.jexcel .dragline div:hover{cursor:move}.jexcel .onDrag{background-color:rgba(0,0,0,.6)}.jexcel .error{border:1px solid red}.jexcel thead td.resizing{border-right-style:dotted!important;border-right-color:red!important}.jexcel tbody tr.resizing>td{border-bottom-style:dotted!important;border-bottom-color:red!important}.jexcel tbody td.resizing{border-right-style:dotted!important;border-right-color:red!important}.jexcel .jdropdown-header{border:0!important;outline:0!important;width:100%!important;height:100%!important;padding:0!important;padding-left:8px!important}.jexcel .jdropdown-container{margin-top:1px}.jexcel .jdropdown-container-header{padding:0;margin:0;height:inherit}.jexcel .jdropdown-picker{border:0!important;padding:0!important;width:inherit;height:inherit}.jexcel .jexcel_comments{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFuGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdEV2dD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlRXZlbnQjIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHhtcDpNb2RpZnlEYXRlPSIyMDE5LTAxLTMxVDE4OjU1OjA4WiIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDphMTlhZDJmOC1kMDI2LTI1NDItODhjOS1iZTRkYjkyMmQ0MmQiIHhtcE1NOkRvY3VtZW50SUQ9ImFkb2JlOmRvY2lkOnBob3Rvc2hvcDpkOGI5NDUyMS00ZjEwLWQ5NDktYjUwNC0wZmU1N2I3Nzk1MDEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDplMzdjYmE1ZS1hYTMwLWNkNDUtYTAyNS1lOWYxZjk2MzUzOGUiIHN0RXZ0OndoZW49IjIwMTktMDEtMzFUMTg6NTU6MDhaIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmExOWFkMmY4LWQwMjYtMjU0Mi04OGM5LWJlNGRiOTIyZDQyZCIgc3RFdnQ6d2hlbj0iMjAxOS0wMS0zMVQxODo1NTowOFoiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE5IChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4En6MDAAAAX0lEQVQYlX3KOw6AIBBAwS32RpJADXfx0pTET+ERZJ8F8RODFtONsG0QAoh0CSDM82dqodaBdQXnfoLZQM7gPai+wjNNE8R4pTuAYNZSKZASqL7CMy0LxNgJp30fKYUDi3+vIqb/+rUAAAAASUVORK5CYII=);background-repeat:no-repeat;background-position:top right}.jexcel .sp-replacer{margin:2px;border:0}.jexcel>thead>tr.jexcel_filter>td>input{border:0;width:100%;outline:0}.jexcel_about{text-transform:uppercase;display:none;float:right;font-size:.7em;padding:2px}.jexcel_filter{display:flex;justify-content:space-between;margin-bottom:4px}.jexcel_filter>div{padding:8px;align-items:center}.jexcel_pagination{display:flex;justify-content:space-between;align-items:center}.jexcel_pagination>div{display:flex;padding:10px}.jexcel_pagination>div:last-child{padding-right:10px;padding-top:10px}.jexcel_pagination>div>div{text-align:center;width:36px;height:36px;line-height:34px;border:1px solid #ccc;box-sizing:border-box;margin-left:2px;cursor:pointer}.jexcel_page_selected{font-weight:700;background-color:#f3f3f3}.jexcel_toolbar{display:flex;background-color:#f3f3f3;border:1px solid #ccc;padding:4px;margin-bottom:4px}.jexcel_toolbar:empty{display:none}.jexcel_toolbar i.jexcel_toolbar_item{width:24px;height:24px;padding:4px;cursor:pointer;display:inline-block}.jexcel_toolbar i.jexcel_toolbar_item:hover{background-color:#ddd}.jexcel_toolbar select.jexcel_toolbar_item{margin-left:2px;margin-right:2px;display:inline-block;border:0;background-color:transparent;padding-right:10px}.jexcel .dragging-left{background-repeat:no-repeat;background-position:top 50% left 0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M14 7l-5 5 5 5V7z'/%3E%3Cpath fill='none' d='M24 0v24H0V0h24z'/%3E%3C/svg%3E")}.jexcel .dragging-right{background-repeat:no-repeat;background-position:top 50% right 0;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M10 17l5-5-5-5v10z'/%3E%3Cpath fill='none' d='M0 24V0h24v24H0z'/%3E%3C/svg%3E")}.jexcel_tabs>.jexcel_tab{display:none}.jexcel_tabs>.jexcel_tab_link{display:inline-block;padding:10px;padding-left:20px;padding-right:20px;margin-right:5px;margin-bottom:5px;background-color:#f3f3f3;cursor:pointer}.jexcel_tabs>.jexcel_tab_link.selected{background-color:#ddd}.jexcel_hidden_index colgroup>col:first-child,.jexcel_hidden_index tr>td:first-child{display:none}.jexcel_border{position:absolute;border:1px solid transparent;pointer-events:none}.jexcel_copying{border:1px solid transparent;border-image:url(data:image/gif;base64,R0lGODlhCgAKAJECAAAAAP///////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEI5RDc5MTFDNkE2MTFFM0JCMDZEODI2QTI4MzJBOTIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEI5RDc5MTBDNkE2MTFFM0JCMDZEODI2QTI4MzJBOTIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuZGlkOjAyODAxMTc0MDcyMDY4MTE4MDgzQzNDMjA5MzREQ0ZDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAyODAxMTc0MDcyMDY4MTE4MDgzQzNDMjA5MzREQ0ZDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEBQoAAgAsAAAAAAoACgAAAhWEERkn7W3ei7KlagMWF/dKgYeyGAUAIfkEBQoAAgAsAAAAAAoACgAAAg+UYwLJ7RnQm7QmsCyVKhUAIfkEBQoAAgAsAAAAAAoACgAAAhCUYgLJHdiinNSAVfOEKoUCACH5BAUKAAIALAAAAAAKAAoAAAIRVISAdusPo3RAzYtjaMIaUQAAIfkEBQoAAgAsAAAAAAoACgAAAg+MDiem7Q8bSLFaG5il6xQAIfkEBQoAAgAsAAAAAAoACgAAAg+UYRLJ7QnQm7SmsCyVKhUAIfkEBQoAAgAsAAAAAAoACgAAAhCUYBLJDdiinNSEVfOEKoECACH5BAUKAAIALAAAAAAKAAoAAAIRFISBdusPo3RBzYsjaMIaUQAAOw==) 8% repeat;pointer-events:none} \ No newline at end of file diff --git a/dist/jexcel.min.js b/dist/jexcel.min.js deleted file mode 100644 index 5913f3af..00000000 --- a/dist/jexcel.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";if(!jSuites&&"function"==typeof require){var jSuites=require("jsuites");require("jsuites/dist/jsuites.css")}var jexcel=function(el,options){var obj={options:{}},defaults={url:null,data:null,copyCompatibility:!1,rows:[],columns:[],colHeaders:[],colWidths:[],colAlignments:[],nestedHeaders:null,defaultColWidth:50,minSpareRows:0,minSpareCols:0,minDimensions:[0,0],allowExport:!0,columnSorting:!0,columnDrag:!1,columnResize:!0,rowResize:!1,rowDrag:!0,editable:!0,allowInsertRow:!0,allowManualInsertRow:!0,allowInsertColumn:!0,allowManualInsertColumn:!0,allowDeleteRow:!0,allowDeleteColumn:!0,allowRenameColumn:!0,allowComments:!1,wordWrap:!1,imageOptions:null,csv:null,csvFileName:"jexcel",csvHeaders:!0,csvDelimiter:",",selectionCopy:!0,mergeCells:{},toolbar:null,search:!1,pagination:!1,paginationOptions:null,fullscreen:!1,lazyLoading:!1,loadingSpin:!1,tableOverflow:!1,tableHeight:"300px",tableWidth:null,meta:null,style:null,parseFormulas:!0,autoIncrement:!0,onload:null,onchange:null,onbeforechange:null,onafterchanges:null,onbeforeinsertrow:null,oninsertrow:null,onbeforeinsertcolumn:null,oninsertcolumn:null,onbeforedeleterow:null,ondeleterow:null,onbeforedeletecolumn:null,ondeletecolumn:null,onmoverow:null,onmovecolumn:null,onresizerow:null,onresizecolumn:null,onsort:null,onselection:null,onpaste:null,onbeforepaste:null,onmerge:null,onfocus:null,onblur:null,onchangeheader:null,oneditionstart:null,oneditionend:null,onchangestyle:null,onchangemeta:null,updateTable:null,text:{noRecordsFound:"No records found",showingPage:"Showing page {0} of {1} entries",show:"Show ",search:"Search",entries:" entries",columnName:"Column name",insertANewColumnBefore:"Insert a new column before",insertANewColumnAfter:"Insert a new column after",deleteSelectedColumns:"Delete selected columns",renameThisColumn:"Rename this column",orderAscending:"Order ascending",orderDescending:"Order descending",insertANewRowBefore:"Insert a new row before",insertANewRowAfter:"Insert a new row after",deleteSelectedRows:"Delete selected rows",editComments:"Edit comments",addComments:"Add comments",comments:"Comments",clearComments:"Clear comments",copy:"Copy...",paste:"Paste...",saveAs:"Save as...",about:"About",areYouSureToDeleteTheSelectedRows:"Are you sure to delete the selected rows?",areYouSureToDeleteTheSelectedColumns:"Are you sure to delete the selected columns?",thisActionWillDestroyAnyExistingMergedCellsAreYouSure:"This action will destroy any existing merged cells. Are you sure?",thisActionWillClearYourSearchResultsAreYouSure:"This action will clear your search results. Are you sure?",thereIsAConflictWithAnotherMergedCell:"There is a conflict with another merged cell",invalidMergeProperties:"Invalid merged properties",cellAlreadyMerged:"Cell already merged",noCellsSelected:"No cells selected"},about:"jExcel CE Spreadsheet\nVersion 3.4.5\nAuthor: Paul Hodel \nWebsite: https://jexcel.net/v3"};for(var property in defaults)options&&options.hasOwnProperty(property)?obj.options[property]="text"==property?Object.assign(defaults[property],options[property]):options[property]:obj.options[property]=defaults[property];obj.el=el,obj.corner=null,obj.contextMenu=null,obj.textarea=null,obj.ads=null,obj.content=null,obj.table=null,obj.thead=null,obj.tbody=null,obj.rows=[],obj.results=null,obj.searchInput=null,obj.toolbar=null,obj.pagination=null,obj.pageNumber=null,obj.headerContainer=null,obj.colgroupContainer=null,obj.headers=[],obj.records=[],obj.history=[],obj.formula=[],obj.formulaStack=0,obj.colgroup=[],obj.selection=[],obj.highlighted=[],obj.selectedCell=null,obj.selectedContainer=null,obj.style=[],obj.meta=[],obj.data=null,obj.cursor=null,obj.historyIndex=-1,obj.ignoreEvents=!1,obj.ignoreHistory=!1,obj.edition=null,obj.hashString=null,obj.resizing=null,obj.dragging=null,1==obj.options.lazyLoading&&0==obj.options.tableOverflow&&0==obj.options.fullscreen&&(console.error("JEXCEL: The lazyloading only works when tableOverflow = yes or fullscreen = yes"),obj.options.lazyLoading=!1),obj.prepareTable=function(){var e=obj.options.columns.length;obj.options.data&&void 0!==obj.options.data[0]&&obj.options.data[0].length>e&&(e=obj.options.data[0].length),obj.options.minDimensions[0]>e&&(e=obj.options.minDimensions[0]);for(var t=[],o=0;o0&&obj.options.paginationOptions&&obj.options.paginationOptions.length>0){obj.paginationDropdown=document.createElement("select"),obj.paginationDropdown.classList.add("jexcel_pagination_dropdown"),obj.paginationDropdown.onchange=function(){obj.options.pagination=parseInt(this.value),obj.page(0)};for(var n=0;n0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var s=0;sr?l:r,a=s>n?s:n;for(t=0;t=u&&t0&&r++}return t},obj.getRowData=function(e){return obj.options.data[e]},obj.setRowData=function(e,t){for(var o=0;o200)&&(r.style.whiteSpace="pre-wrap"),e>0&&(o||r.innerHTML?obj.records[t][e-1].style.overflow="hidden":e==obj.options.columns.length-1&&(r.style.overflow="hidden")),r},obj.createCellHeader=function(e){var t=obj.options.columns[e].width?obj.options.columns[e].width:obj.options.defaultColWidth,o=obj.options.columns[e].align?obj.options.columns[e].align:"center";obj.headers[e]=document.createElement("td"),obj.headers[e].innerHTML=obj.options.columns[e].title?obj.options.columns[e].title:jexcel.getColumnName(e),obj.headers[e].setAttribute("data-x",e),obj.headers[e].style.textAlign=o,obj.options.columns[e].title&&obj.headers[e].setAttribute("title",obj.options.columns[e].title),obj.colgroup[e]=document.createElement("col"),obj.colgroup[e].setAttribute("width",t),"hidden"==obj.options.columns[e].type&&(obj.headers[e].style.display="none",obj.colgroup[e].style.display="none")},obj.createNestedHeader=function(e){var t=document.createElement("tr");t.classList.add("jexcel_nested");var o=document.createElement("td");t.appendChild(o);for(var r=0,n=0;n1?obj.records[u[1]][u[0]].setAttribute("colspan",t):t=1,o>1?obj.records[u[1]][u[0]].setAttribute("rowspan",o):o=1,obj.options.mergeCells[e]=[t,o,[]],obj.records[u[1]][u[0]].setAttribute("data-merged","true"),obj.records[u[1]][u[0]].style.overflow="hidden";for(var p=[],d=u[1];d0||i>0)&&(obj.records[r[1]+s][r[0]+i]=n[2][l],obj.records[r[1]+s][r[0]+i].style.display="",t&&t[l]&&obj.updateCell(r[0]+i,r[1]+s,t[l]),l++);obj.updateSelection(obj.records[r[1]][r[0]],obj.records[r[1]+s-1][r[0]+i-1]),o||delete obj.options.mergeCells[e]}},obj.destroyMerged=function(e){if(obj.options.mergeCells){obj.options.mergeCells;for(var t=Object.keys(obj.options.mergeCells),o=0;o1?s-1:0);null==t?i<=e&&a>=e&&o.push(r[n]):t?i=e&&o.push(r[n]):i<=e&&a>e&&o.push(r[n])}return o},obj.isRowMerged=function(e,t){var o=[];if(obj.options.mergeCells)for(var r=Object.keys(obj.options.mergeCells),n=0;n1?s-1:0);null==t?i<=e&&a>=e&&o.push(r[n]):t?i=e&&o.push(r[n]):i<=e&&a>e&&o.push(r[n])}return o},obj.openEditor=function(e,t,o){var r=e.getAttribute("data-y"),n=e.getAttribute("data-x");obj.ignoreEvents||"function"==typeof obj.options.oneditionstart&&obj.options.oneditionstart(el,e,n,r),n>0&&(obj.records[r][n-1].style.overflow="hidden");var l=function(t){var o=e.getBoundingClientRect(),r=document.createElement(t);return r.style.width=o.width+"px",r.style.height=o.height-2+"px",r.style.minHeight=o.height-2+"px",e.classList.add("editor"),e.innerHTML="",e.appendChild(r),r};if(1==e.classList.contains("readonly"));else if(obj.edition=[obj.records[r][n],obj.records[r][n].innerHTML,n,r],obj.options.columns[n].editor)obj.options.columns[n].editor.openEditor(e,el);else if("hidden"==obj.options.columns[n].type);else if("checkbox"==obj.options.columns[n].type||"radio"==obj.options.columns[n].type){var s=!e.children[0].checked;obj.setValue(e,s),obj.edition=null}else if("dropdown"==obj.options.columns[n].type||"autocomplete"==obj.options.columns[n].type){s=obj.options.data[r][n];if("function"==typeof obj.options.columns[n].filter)var i=obj.options.columns[n].filter(el,e,n,r,obj.options.columns[n].source);else i=obj.options.columns[n].source;var a=l("div"),u={data:i,multiple:!!obj.options.columns[n].multiple,autocomplete:!(!obj.options.columns[n].autocomplete&&"autocomplete"!=obj.options.columns[n].type),opened:!0,value:obj.options.columns[n].multiple?s.split(";"):s,width:"100%",height:a.style.minHeight,position:1==obj.options.tableOverflow||1==obj.options.fullscreen,onclose:function(){obj.closeEditor(e,!0)}};obj.options.columns[n].options&&obj.options.columns[n].options.type&&(u.type=obj.options.columns[n].options.type),jSuites.dropdown(a,u)}else if("calendar"==obj.options.columns[n].type||"color"==obj.options.columns[n].type){s=obj.options.data[r][n];if((a=l("input")).value=s,1!=obj.options.tableOverflow&&1!=obj.options.fullscreen||(obj.options.columns[n].options.position=!0),obj.options.columns[n].options.value=obj.options.data[r][n],obj.options.columns[n].options.onclose=function(t,o){obj.closeEditor(e,!0)},"color"==obj.options.columns[n].type)jSuites.color(a,obj.options.columns[n].options);else jSuites.calendar(a,obj.options.columns[n].options).setValue(s);a.focus()}else if("image"==obj.options.columns[n].type){var c=e.children[0];(a=l("div")).style.position="relative";var b=document.createElement("div");b.classList.add("jclose"),c&&c.src&&b.appendChild(c),a.appendChild(b),jSuites.image(b,obj.options.imageOptions);const t=e.getBoundingClientRect(),o=b.getBoundingClientRect();window.innerHeight0)for(var a=0;a200)?obj.records[t][e].style.whiteSpace="pre-wrap":obj.records[t][e].style.whiteSpace=""}e>0&&(obj.options.data[t][e]||"text"!=obj.options.columns[e].type&&"number"!=obj.options.columns[e].type?obj.records[t][e-1].style.overflow="hidden":obj.records[t][e-1].style.overflow=""),obj.ignoreEvents||"function"==typeof obj.options.onchange&&obj.options.onchange(el,obj.records[t][e],e,t,o,l.oldValue)}else;return l},obj.copyData=function(e,t){for(var o=obj.getData(!0),r=obj.selectedContainer[1],n=obj.selectedContainer[3],l=parseInt(e.getAttribute("data-x")),s=parseInt(e.getAttribute("data-y")),i=parseInt(t.getAttribute("data-x")),a=parseInt(t.getAttribute("data-y")),u=[],c=[],b=1,p=!1,d=0,j=0,f=s;f<=a;f++)if("none"!=obj.rows[f].style.display){null==o[j]&&(j=0),d=0;for(var g=l;g<=i;g++){if(obj.records[f][g]&&!obj.records[f][g].classList.contains("readonly")&&"none"!=obj.records[f][g].style.display&&0==p){if(!obj.selection.length&&obj.options.data[f][g]){p=!0;continue}if(null==o[j])d=0;else if(null==o[j][d])d=0;else var h=o[j][d];if(h&&r==n&&1==obj.options.autoIncrement)if("text"==obj.options.columns[g].type||"number"==obj.options.columns[g].type)if("="==(""+h).substr(0,1)){var m=h.match(/([A-Z]+[0-9]+)/g);if(m){for(var v=[],C=0;C=obj.selectedCell[1]&&t<=obj.selectedCell[3]||o>=obj.selectedCell[1]&&o<=obj.selectedCell[3]))return void obj.resetSelection()}else if(obj.selectedCell&&(t>=obj.selectedCell[0]&&t<=obj.selectedCell[2]||o>=obj.selectedCell[0]&&o<=obj.selectedCell[2]))return void obj.resetSelection()},obj.resetSelection=function(e){if(obj.highlighted.length){u=1;for(var t=0;t0?o+(n-1):o,i=l>0?r+(l-1):r;else s=o,i=r;for(var a=o;a<=s;a++)obj.headers[a]&&obj.headers[a].classList.remove("selected");for(a=r;a<=i;a++)obj.rows[a]&&obj.rows[a].classList.remove("selected")}}else var u=0;return obj.highlighted=[],obj.selectedCell=null,obj.corner.style.top="-2000px",obj.corner.style.left="-2000px",1!=obj.ignoreEvents&&1==e&&obj.options.onblur&&"function"==typeof obj.options.onblur&&1==u&&obj.options.onblur(el),u},obj.updateSelection=function(e,t,o){var r=e.getAttribute("data-x"),n=e.getAttribute("data-y");if(t)var l=t.getAttribute("data-x"),s=t.getAttribute("data-y");else l=r,s=n;obj.updateSelectionFromCoords(r,n,l,s,o)},obj.updateSelectionFromCoords=function(e,t,o,r,n){var l=obj.resetSelection();if(null==o&&(o=e),null==r&&(r=t),e>=obj.headers.length&&(e=obj.headers.length-1),t>=obj.rows.length&&(t=obj.rows.length-1),o>=obj.headers.length&&(o=obj.headers.length-1),r>=obj.rows.length&&(r=obj.rows.length-1),obj.selectedCell=[e,t,o,r],null!=e){if(obj.records[t][e].classList.add("highlight-selected"),parseInt(e)1&&(pi&&(i=p+j-1)),f&&(du&&(u=d+f-1))}var g=null,h=null,m=null,v=null;for(b=a;b<=u;b++)"none"!=obj.rows[b].style.display&&(null==m&&(m=b),v=b);for(c=s;c<=i;c++){for(b=a;b<=u;b++)"none"!=obj.rows[b].style.display&&"none"!=obj.records[b][c].style.display&&(obj.records[b][c].classList.add("highlight"),obj.highlighted.push(obj.records[b][c]));"hidden"!=obj.options.columns[c].type&&(null==g&&(g=c),h=c)}g||(g=0),h||(h=0);for(c=g;c<=h;c++)"hidden"!=obj.options.columns[c].type&&(obj.records[m][c].classList.add("highlight-top"),obj.records[v][c].classList.add("highlight-bottom"),obj.headers[c].classList.add("selected"));for(b=m;b<=v;b++)"none"!=obj.rows[b].style.display&&(obj.records[b][g].classList.add("highlight-left"),obj.records[b][h].classList.add("highlight-right"),obj.rows[b].classList.add("selected"));obj.selectedContainer=[g,m,h,v]}1!=obj.ignoreEvents&&(obj.options.onfocus&&"function"==typeof obj.options.onfocus&&0==l&&obj.options.onfocus(el),"function"==typeof obj.options.onselection&&obj.options.onselection(el,g,m,h,v,n)),obj.updateCornerPosition()},obj.removeCopySelection=function(){for(var e=0;e0)var s=parseInt(n)+1,i=parseInt(e);else s=parseInt(e),i=parseInt(o)-1;if(t-l>0)var a=parseInt(l)+1,u=parseInt(t);else a=parseInt(t),u=parseInt(r)-1;if(i-sobj.content.scrollTop+30&&bobj.content.scrollLeft&&c0&&("object"==typeof e&&(e=$(e).getAttribute("data-x")),o||obj.colgroup[e].getAttribute("width"),obj.colgroup[e].setAttribute("width",t),obj.options.columns[e].width=t,obj.setHistory({action:"setWidth",column:e,oldValue:o,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onresizecolumn&&obj.options.onresizecolumn(el,e,t,o),obj.updateCornerPosition())},obj.setHeight=function(e,t,o){t>0&&("object"==typeof e&&(column=$(e).getAttribute("data-y")),o||obj.rows[e].getAttribute("height"),obj.rows[e].setAttribute("height",t),obj.options.rows[e]||(obj.options.rows[e]={}),obj.options.rows[e].height=t,obj.setHistory({action:"setHeight",row:e,oldValue:o,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onresizerow&&obj.options.onresizerow(el,e,t,o),obj.updateCornerPosition())},obj.getHeight=function(e){if(e){"object"==typeof e&&(e=$(e).getAttribute("data-y"));t=obj.rows[e].style.height}else for(var t=[],o=0;o=0){if(Object.keys(obj.options.mergeCells).length>0){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}t=null==t?obj.headers[e].classList.contains("arrow-down")?1:0:t?1:0,Array.prototype.orderBy=function(e,t){return this.slice(0).sort(function(o,r){var n=""==o[e]?"":Number(o[e])==o[e]?Number(o[e]):o[e].toLowerCase(),l=""==r[e]?"":Number(r[e])==r[e]?Number(r[e]):r[e].toLowerCase();return t?""==n&&""!=l?1:""!=n&&""==l?-1:n>l?-1:nl?1:n0)obj.page(0);else if(1==obj.options.lazyLoading)obj.loadPage(0);else for(o=0;o0&&obj.isRowMerged(t).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if(1==obj.options.search){if(obj.results&&obj.results.length!=obj.rows.length){if(!confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))return!1;obj.resetSearch()}obj.results=null}o||(Array.prototype.indexOf.call(obj.tbody.children,obj.rows[t])>=0?e>t?obj.tbody.insertBefore(obj.rows[e],obj.rows[t]):obj.tbody.insertBefore(obj.rows[e],obj.rows[t].nextSibling):obj.tbody.removeChild(obj.rows[e])),obj.rows.splice(t,0,obj.rows.splice(e,1)[0]),obj.records.splice(t,0,obj.records.splice(e,1)[0]),obj.options.data.splice(t,0,obj.options.data.splice(e,1)[0]),obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.setHistory({action:"moveRow",oldValue:e,newValue:t}),obj.updateTableReferences(),1!=obj.ignoreEvents&&"function"==typeof obj.options.onmoverow&&obj.options.onmoverow(el,e,t)},obj.insertRow=function(e,t,o){if(1==obj.options.allowInsertRow){var r=[];if(e>0)var n=e;else{n=1;e&&(r=e)}o=!!o;var l=obj.options.data.length-1;if((null==t||t>=parseInt(l)||t<0)&&(t=l),"function"==typeof obj.options.onbeforeinsertrow&&!obj.options.onbeforeinsertrow(el,t,n,o))return console.log("onbeforeinsertrow returned false"),!1;if(Object.keys(obj.options.mergeCells).length>0&&obj.isRowMerged(t,o).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if(1==obj.options.search){if(obj.results&&obj.results.length!=obj.rows.length){if(!confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))return!1;obj.resetSearch()}obj.results=null}for(var s=o?t:t+1,i=obj.records.splice(s),a=obj.options.data.splice(s),u=obj.rows.splice(s),c=[],b=[],p=[],d=s;d=0)&&obj.tbody.insertBefore(f,u[0]),c.push(obj.records[d]),b.push(obj.options.data[d]),p.push(f)}Array.prototype.push.apply(obj.records,i),Array.prototype.push.apply(obj.options.data,a),Array.prototype.push.apply(obj.rows,u),obj.options.pagination>0&&obj.page(obj.pageNumber),obj.setHistory({action:"insertRow",rowNumber:t,numOfRows:n,insertBefore:o,rowRecords:c,rowData:b,rowNode:p}),obj.updateTableReferences(),1!=obj.ignoreEvents&&"function"==typeof obj.options.oninsertrow&&obj.options.oninsertrow(el,t,n,c,o)}},obj.deleteRow=function(e,t){if(1==obj.options.allowDeleteRow)if(obj.options.data.length>1){if(null==e){var o=obj.getSelectedRows();o[0]?(e=parseInt(o[0].getAttribute("data-y")),t=o.length):(e=obj.options.data.length-1,t=1)}var r=obj.options.data.length-1;if((null==e||e>r||e<0)&&(e=r),t||(t=1),e+t>=obj.options.data.length&&(t=obj.options.data.length-e),"function"==typeof obj.options.onbeforedeleterow&&!obj.options.onbeforedeleterow(el,e,t))return console.log("onbeforedeleterow returned false"),!1;if(parseInt(e)>-1){var n=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var l=e;l=0&&(obj.rows[l].className="",obj.rows[l].parentNode.removeChild(obj.rows[l]));var s=obj.records.splice(e,t),i=obj.options.data.splice(e,t),a=obj.rows.splice(e,t);obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.conditionalSelectionUpdate(1,e,e+t-1),obj.setHistory({action:"deleteRow",rowNumber:e,numOfRows:t,insertBefore:1,rowRecords:s,rowData:i,rowNode:a}),obj.updateTableReferences(),1!=obj.ignoreEvents&&"function"==typeof obj.options.ondeleterow&&obj.options.ondeleterow(el,e,t,s)}}else console.error("JEXCEL. It is not possible to delete the last row")},obj.moveColumn=function(e,t){if(Object.keys(obj.options.mergeCells).length>0&&obj.isColMerged(t).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if((e=parseInt(e))>(t=parseInt(t))){obj.headerContainer.insertBefore(obj.headers[e],obj.headers[t]),obj.colgroupContainer.insertBefore(obj.colgroup[e],obj.colgroup[t]);for(var o=0;o0)var l=e;else{l=1;e&&(n=e)}o=!!o;var s=obj.options.columns.length-1;if((null==t||t>=parseInt(s)||t<0)&&(t=s),"function"==typeof obj.options.onbeforeinsertcolumn&&!obj.options.onbeforeinsertcolumn(el,t,l,o))return console.log("onbeforeinsertcolumn returned false"),!1;if(Object.keys(obj.options.mergeCells).length>0&&obj.isColMerged(t,o).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}r||(r=[]);for(var i=0;i0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var x=0;x1){if(null==e){var o=obj.getSelectedColumns(!0);o.length?(e=parseInt(o[0]),t=parseInt(o.length)):(e=obj.headers.length-1,t=1)}var r=obj.options.data[0].length-1;if((null==e||e>r||e<0)&&(e=r),t||(t=1),t>obj.options.data[0].length-e&&(t=obj.options.data[0].length-e),"function"==typeof obj.options.onbeforedeletecolumn&&!obj.options.onbeforedeletecolumn(el,e,t))return console.log("onbeforedeletecolumn returned false"),!1;if(parseInt(e)>-1){var n=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var l=e;l0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var p=0;p0){for(var e=0,t=obj.rows.length-1;t>=0;t--){for(var o=!1,r=0;r0&&obj.insertRow(obj.options.minSpareRows-e)}if(obj.options.minSpareCols>0){var n=0;for(r=obj.headers.length-1;r>=0;r--){for(o=!1,t=0;t0&&obj.insertColumn(obj.options.minSpareCols-n)}if("function"==typeof obj.options.updateTable)for(t=0;t0)if(chainLoopProtection[r])obj.records[t][e].innerHTML="#ERROR",obj.formula[r]="";else{chainLoopProtection[r]=!0;for(var n=0;n5)return console.error("Too many executions..."),0;var parentId=jexcel.getColumnNameFromId([x,y]),tokensUpdate=function(e){for(var t=0;t=0)if(r[1])e=Number(r[0]+"."+r[1]);else var e=Number(r[0]+".00");else e=null;return e},obj.row=function(e){},obj.col=function(e){},obj.up=function(e,t){if(e?obj.selectedCell[3]>0&&obj.up.visible(1,t?0:1):(obj.selectedCell[1]>0&&obj.up.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),1==obj.options.lazyLoading)if(0==obj.selectedCell[1]||0==obj.selectedCell[3])obj.loadPage(0),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else if(obj.loadValidation())obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else{var o=parseInt(obj.tbody.firstChild.getAttribute("data-y"));obj.selectedCell[1]-o<30&&(obj.loadUp(),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]))}else if(obj.options.pagination>0){var r=obj.whichPage(obj.selectedCell[3]);r!=obj.pageNumber&&obj.page(r)}obj.updateScroll(1)},obj.up.visible=function(e,t){if(0==e)var o=parseInt(obj.selectedCell[0]),r=parseInt(obj.selectedCell[1]);else o=parseInt(obj.selectedCell[2]),r=parseInt(obj.selectedCell[3]);if(0==t){for(var n=0;n=0;o--)if("none"!=obj.records[o][e].style.display&&"none"!=obj.rows[o].style.display){if(obj.records[o][e].getAttribute("data-merged")&&obj.records[o][e]==obj.records[t][e])continue;t=o;break}return t},obj.down=function(e,t){if(e?obj.selectedCell[3]0){var o=obj.whichPage(obj.selectedCell[3]);o!=obj.pageNumber&&obj.page(o)}obj.updateScroll(3)},obj.down.visible=function(e,t){if(0==e)var o=parseInt(obj.selectedCell[0]),r=parseInt(obj.selectedCell[1]);else o=parseInt(obj.selectedCell[2]),r=parseInt(obj.selectedCell[3]);if(0==t){for(var n=obj.rows.length-1;n>r;n--)if("none"!=obj.records[n][o].style.display&&"none"!=obj.rows[n].style.display){r=n;break}}else r=obj.down.get(o,r);0==e?(obj.selectedCell[0]=o,obj.selectedCell[1]=r):(obj.selectedCell[2]=o,obj.selectedCell[3]=r)},obj.down.get=function(e,t){e=parseInt(e);for(var o=(t=parseInt(t))+1;oo;n--)if("none"!=obj.records[r][n].style.display){o=n;break}}else o=obj.right.get(o,r);0==e?(obj.selectedCell[0]=o,obj.selectedCell[1]=r):(obj.selectedCell[2]=o,obj.selectedCell[3]=r)},obj.right.get=function(e,t){e=parseInt(e),t=parseInt(t);for(var o=e+1;o0&&obj.left.visible(1,t?0:1):(obj.selectedCell[0]>0&&obj.left.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(0)},obj.left.visible=function(e,t){if(0==e)var o=parseInt(obj.selectedCell[0]),r=parseInt(obj.selectedCell[1]);else o=parseInt(obj.selectedCell[2]),r=parseInt(obj.selectedCell[3]);if(0==t){for(var n=0;n=0;o--)if("none"!=obj.records[t][o].style.display){if(obj.records[t][o].getAttribute("data-merged")&&obj.records[t][o]==obj.records[t][e])continue;e=o;break}return e},obj.first=function(e,t){if(e?t?obj.selectedCell[3]=0:obj.left.visible(1,0):(t?obj.selectedCell[1]=0:obj.left.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),1!=obj.options.lazyLoading||0!=obj.selectedCell[1]&&0!=obj.selectedCell[3]){if(obj.options.pagination>0){var o=obj.whichPage(obj.selectedCell[3]);o!=obj.pageNumber&&obj.page(o)}}else obj.loadPage(0);obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(1)},obj.last=function(e,t){if(e?t?obj.selectedCell[3]=obj.records.length-1:obj.right.visible(1,0):(t?obj.selectedCell[1]=obj.records.length-1:obj.right.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),1!=obj.options.lazyLoading||obj.selectedCell[1]!=obj.records.length-1&&obj.selectedCell[3]!=obj.records.length-1){if(obj.options.pagination>0){var o=obj.whichPage(obj.selectedCell[3]);o!=obj.pageNumber&&obj.page(o)}}else obj.loadPage(-1);obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(3)},obj.selectAll=function(){obj.selectedCell||(obj.selectedCell=[]),obj.selectedCell[0]=0,obj.selectedCell[1]=0,obj.selectedCell[2]=obj.headers.length-1,obj.selectedCell[3]=obj.records.length-1,obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])},obj.loadPage=function(e){if(1==obj.options.search&&obj.results)var t=obj.results;else t=obj.rows;null!=e&&-1!=e||(e=Math.ceil(t.length/100));var o=100*e,r=100*e+100;r>t.length&&(r=t.length),(o=r-100)<0&&(o=0);for(var n=o;n100&&obj.tbody.removeChild(obj.tbody.firstChild)},obj.loadUp=function(){if(1==obj.options.search&&obj.results)var e=obj.results;else e=obj.rows;var t=0;if(e.length>100){var o=parseInt(obj.tbody.firstChild.getAttribute("data-y"));if(1==obj.options.search&&obj.results&&(o=e.indexOf(o)),o>0)for(var r=0;r<30;r++)(o-=1)>-1&&(1==obj.options.search&&obj.results?obj.tbody.insertBefore(obj.rows[e[o]],obj.tbody.firstChild):obj.tbody.insertBefore(obj.rows[o],obj.tbody.firstChild),obj.tbody.children.length>100&&(obj.tbody.removeChild(obj.tbody.lastChild),t=1))}return t},obj.loadDown=function(){if(1==obj.options.search&&obj.results)var e=obj.results;else e=obj.rows;var t=0;if(e.length>100){var o=parseInt(obj.tbody.lastChild.getAttribute("data-y"));if(1==obj.options.search&&obj.results&&(o=e.indexOf(o)),o100&&(obj.tbody.removeChild(obj.tbody.firstChild),t=1)),o+=1}return t},obj.loadValidation=function(){if(obj.selectedCell){var e=parseInt(obj.tbody.firstChild.getAttribute("data-y"))/100,t=parseInt(obj.selectedCell[3]/100),o=parseInt(obj.rows.length/100);if(e!=t&&t<=o&&!Array.prototype.indexOf.call(obj.tbody.children,obj.rows[obj.selectedCell[3]]))return obj.loadPage(t),!0}return!1},obj.resetSearch=function(){obj.searchInput.value="",obj.search(""),obj.results=null},obj.search=function(e){if(e)e=e.toLowerCase();if(obj.resetSelection(),obj.pageNumber=0,obj.results=[],e){var t=function(e){-1==obj.results.indexOf(e)&&obj.results.push(e)};obj.options.data.filter(function(o,r){if(function(e,t,o){for(var r=0;r=0||(""+obj.records[o][r].innerHTML).toLowerCase().search(t)>=0)return!0;return!1}(o,e,r)){var n=obj.isRowMerged(r);if(n.length)for(var l=0;l0?obj.options.pagination:obj.results?obj.results.length:obj.rows.length;obj.tbody.firstChild;)obj.tbody.removeChild(obj.tbody.firstChild);for(var n=0;n-1?(r0&&obj.updatePagination(),o},obj.whichPage=function(e){return 1==obj.options.search&&obj.results&&(e=obj.results.indexOf(e)),Math.ceil((parseInt(e)+1)/parseInt(obj.options.pagination))-1},obj.page=function(e){if(1==obj.options.search&&obj.results)var t=obj.results;else t=obj.rows;var o=parseInt(obj.options.pagination);null!=e&&-1!=e||(e=Math.ceil(t.length/o)),obj.pageNumber=e;var r=e*o,n=e*o+o;n>t.length&&(n=t.length),r<0&&(r=0),obj.tbody.innerHTML="";for(var l=r;l0&&obj.updatePagination(),obj.updateCornerPosition()},obj.updatePagination=function(){if(obj.pagination.children[0].innerHTML="",obj.pagination.children[1].innerHTML="",obj.options.pagination){if(1==obj.options.search&&obj.results)var e=obj.results.length;else e=obj.rows.length;if(e){var t=Math.ceil(e/obj.options.pagination);if(obj.pageNumber<6)var o=1,r=t<10?t:10;else if(t-obj.pageNumber<5){r=t;(o=t-9)<1&&(o=1)}else o=obj.pageNumber-4,r=obj.pageNumber+5;if(o>1)(l=document.createElement("div")).className="jexcel_page",l.innerHTML="<",l.title=1,obj.pagination.children[1].appendChild(l);for(var n=o;n<=r;n++){var l;(l=document.createElement("div")).className="jexcel_page",l.innerHTML=n,obj.pagination.children[1].appendChild(l),obj.pageNumber==n-1&&l.classList.add("jexcel_page_selected")}if(r",l.title=t,obj.pagination.children[1].appendChild(l);obj.pagination.children[0].innerHTML=function(e){var t=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,o){return void 0!==t[o]?t[o]:e})}(obj.options.text.showingPage,obj.pageNumber+1,t)}else obj.pagination.children[0].innerHTML=obj.options.text.noRecordsFound}},obj.download=function(e){if(0==obj.options.allowExport)console.error("Export not allowed");else{var t="";1==e&&(t+=obj.getHeaders(),t+="\r\n"),t+=obj.copy(!1,obj.options.csvDelimiter,!0);var o=document.createElement("a"),r=new Blob([t],{type:"text/csv;charset=utf-8;"}),n=URL.createObjectURL(r);o.href=n,o.setAttribute("download",obj.options.csvFileName+".csv"),document.body.appendChild(o),o.click(),o.parentNode.removeChild(o)}},obj.setHistory=function(e){if(1!=obj.ignoreHistory){var t=++obj.historyIndex;obj.history=obj.history=obj.history.slice(0,t+1),obj.history[t]=e}},obj.copy=function(e,t,o){t||(t="\t");var r=[],n=[],l=[],s=[],i=obj.options.data[0].length,a=obj.options.data.length,u="";obj.style=[];for(var c=0;c=obj.headers.length-1&&obj.insertColumn(),b=obj.right.get(b,p))}if(o[++s]){p>=obj.rows.length-1&&obj.insertRow();p=obj.down.get(e,p)}}obj.updateSelectionFromCoords(e,t,b,p),obj.setHistory({action:"setValue",records:i,selection:obj.selectedCell,newStyle:a,oldStyle:u}),obj.updateTable(),"function"==typeof obj.options.onpaste&&obj.options.onpaste(el,i)}},obj.historyProcessRow=function(e,t){var o=t.insertBefore?t.rowNumber:t.rowNumber+1;if(1==obj.options.search&&obj.results&&obj.results.length!=obj.rows.length&&obj.resetSearch(),1==e){for(var r=t.numOfRows,n=o;n0&&obj.page(obj.pageNumber),obj.updateTableReferences()},obj.historyProcessColumn=function(e,t){var o=t.insertBefore?t.columnNumber:t.columnNumber+1;if(1==e){var r=t.numOfColumns;obj.options.columns.splice(o,r);for(var n=o;n0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(l=0;l=0){var r=obj.history[obj.historyIndex--];if("insertRow"==r.action)obj.historyProcessRow(1,r);else if("deleteRow"==r.action)obj.historyProcessRow(0,r);else if("insertColumn"==r.action)obj.historyProcessColumn(1,r);else if("deleteColumn"==r.action)obj.historyProcessColumn(0,r);else if("moveRow"==r.action)obj.moveRow(r.newValue,r.oldValue);else if("moveColumn"==r.action)obj.moveColumn(r.newValue,r.oldValue);else if("setMerge"==r.action)obj.removeMerge(r.column,r.data);else if("setStyle"==r.action)obj.setStyle(r.oldValue,null,null,1);else if("setWidth"==r.action)obj.setWidth(r.column,r.oldValue);else if("setHeight"==r.action)obj.setHeight(r.row,r.oldValue);else if("setHeader"==r.action)obj.setHeader(r.column,r.oldValue);else if("setComments"==r.action)obj.setComments(r.column,r.oldValue[0],r.oldValue[1]);else if("orderBy"==r.action){for(var n=[],l=0;l0?o.join("; "):""},obj.parseCSV=function(e,t){9==(e=e.replace(/\r?\n$|\r$|\n$/g,"")).charCodeAt(e.length-1)&&(e+="\0"),t=t||",";for(var o=[],r=!1,n=0,l=0,s=0;s0)for(var o=t.shift(),r=0;r=obj.content.scrollHeight?obj.loadDown()&&(obj.content.scrollTop+obj.content.clientHeight>obj.content.scrollHeight-10&&(obj.content.scrollTop=obj.content.scrollTop-obj.content.clientHeight),obj.updateCornerPosition()):obj.content.scrollTop<=obj.content.clientHeight&&obj.loadUp()&&(obj.content.scrollTop<10&&(obj.content.scrollTop=obj.content.scrollTop+obj.content.clientHeight),obj.updateCornerPosition()),jexcel.timeControlLoading=null},100)),1!=obj.options.lazyLoading&&1!=obj.options.tableOverflow||obj.edition&&"jdropdown"!=e.target.className.substr(0,9)&&obj.closeEditor(obj.edition[0],!0)},el.addEventListener("DOMMouseScroll",obj.scrollControls),el.addEventListener("mousewheel",obj.scrollControls),el.jexcel=obj,obj.init(),obj};jexcel.current=null,jexcel.timeControl=null,jexcel.timeControlLoading=null,jexcel.destroy=function(e,t){e.jexcel&&(e.jexcel=null,e.innerHTML="",t&&(document.removeEventListener("keydown",jexcel.keyDownControls),document.removeEventListener("mouseup",jexcel.mouseUpControls),document.removeEventListener("mousedown",jexcel.mouseDownControls),document.removeEventListener("mousemove",jexcel.mouseMoveControls),document.removeEventListener("mouseover",jexcel.mouseOverControls),document.removeEventListener("dblclick",jexcel.doubleClickControls),document.removeEventListener("paste",jexcel.pasteControls),document.removeEventListener("contextmenu",jexcel.contextMenuControls),document.removeEventListener("touchstart",jexcel.touchStartControls),document.removeEventListener("touchend",jexcel.touchEndControls),document.removeEventListener("touchcancel",jexcel.touchEndControls),jexcel=null))},jexcel.build=function(){document.addEventListener("keydown",jexcel.keyDownControls),document.addEventListener("mouseup",jexcel.mouseUpControls),document.addEventListener("mousedown",jexcel.mouseDownControls),document.addEventListener("mousemove",jexcel.mouseMoveControls),document.addEventListener("mouseover",jexcel.mouseOverControls),document.addEventListener("dblclick",jexcel.doubleClickControls),document.addEventListener("paste",jexcel.pasteControls),document.addEventListener("contextmenu",jexcel.contextMenuControls),document.addEventListener("touchstart",jexcel.touchStartControls),document.addEventListener("touchend",jexcel.touchEndControls),document.addEventListener("touchcancel",jexcel.touchEndControls),document.addEventListener("touchmove",jexcel.touchEndControls)},jexcel.validLetter=function(e){return e.match(/([\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+)/g)?1:0},jexcel.injectArray=function(e,t,o){return e.slice(0,t).concat(o).concat(e.slice(t))},jexcel.getColumnName=function(e){var t="";return e>701?(t+=String.fromCharCode(64+parseInt(e/676)),t+=String.fromCharCode(64+parseInt(e%676/26))):e>25&&(t+=String.fromCharCode(64+parseInt(e/26))),t+=String.fromCharCode(65+e%26)},jexcel.getIdFromColumnName=function(e,t){var o=/^[a-zA-Z]+/.exec(e);if(o){for(var r=0,n=0;n0&&l--,e=1==t?[r,l]:r+"-"+l}return e},jexcel.getColumnNameFromId=function(e){return Array.isArray(e)||(e=e.split("-")),jexcel.getColumnName(parseInt(e[0]))+(parseInt(e[1])+1)},jexcel.getElement=function(e){var t=0,o=0;return function e(r){r.className&&r.classList.contains("jexcel_container")&&(o=r),"THEAD"==r.tagName?t=1:"TBODY"==r.tagName&&(t=2),r.parentNode&&e(r.parentNode)}(e),[o,t]},jexcel.keyDownControls=function(e){if(jexcel.current){if(jexcel.current.edition)if(27==e.which)jexcel.current.edition&&jexcel.current.closeEditor(jexcel.current.edition[0],!1),e.preventDefault();else if(13==e.which)if("calendar"==jexcel.current.options.columns[jexcel.current.edition[2]].type)jexcel.current.editor[0].children[0].calendar.close(1);else if("dropdown"==jexcel.current.options.columns[jexcel.current.edition[2]].type||"autocomplete"==jexcel.current.options.columns[jexcel.current.edition[2]].type);else if((1==jexcel.current.options.wordWrap||1==jexcel.current.options.columns[jexcel.current.edition[2]].wordWrap||jexcel.current.options.data[jexcel.current.edition[3]][jexcel.current.edition[2]].length>200)&&e.altKey){var t=jexcel.current.edition[0].children[0],o=jexcel.current.edition[0].children[0].value,r=t.selectionStart;o=o.slice(0,r)+"\n"+o.slice(r),t.value=o,t.focus(),t.selectionStart=r+1,t.selectionEnd=r+1}else jexcel.current.edition[0].children[0].blur();else 9==e.which&&("calendar"==jexcel.current.options.columns[jexcel.current.edition[2]].type?jexcel.current.edition[0].children[0].calendar.close(1):jexcel.current.edition[0].children[0].blur());if(!jexcel.current.edition&&jexcel.current.selectedCell)if(37==e.which)jexcel.current.left(e.shiftKey,e.ctrlKey),e.preventDefault();else if(39==e.which)jexcel.current.right(e.shiftKey,e.ctrlKey),e.preventDefault();else if(38==e.which)jexcel.current.up(e.shiftKey,e.ctrlKey),e.preventDefault();else if(40==e.which)jexcel.current.down(e.shiftKey,e.ctrlKey),e.preventDefault();else if(36==e.which)jexcel.current.first(e.shiftKey,e.ctrlKey),e.preventDefault();else if(35==e.which)jexcel.current.last(e.shiftKey,e.ctrlKey),e.preventDefault();else if(32==e.which)1==jexcel.current.options.editable&&jexcel.current.setCheckRadioValue(),e.preventDefault();else if(46==e.which)1==jexcel.current.options.editable&&(jexcel.current.selectedRow?1==jexcel.current.options.allowDeleteRow&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedRows)&&jexcel.current.deleteRow():jexcel.current.selectedHeader?1==jexcel.current.options.allowDeleteColumn&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedColumns)&&jexcel.current.deleteColumn():jexcel.current.setValue(jexcel.current.highlighted,""));else if(13==e.which)e.shiftKey?jexcel.current.up():(1==jexcel.current.options.allowInsertRow&&1==jexcel.current.options.allowManualInsertRow&&jexcel.current.selectedCell[1]==jexcel.current.options.data.length-1&&jexcel.current.insertRow(),jexcel.current.down()),e.preventDefault();else if(9==e.which)e.shiftKey?jexcel.current.left():(1==jexcel.current.options.allowInsertColumn&&1==jexcel.current.options.allowManualInsertColumn&&jexcel.current.selectedCell[0]==jexcel.current.options.data[0].length-1&&jexcel.current.insertColumn(),jexcel.current.right()),e.preventDefault();else if(!e.ctrlKey&&!e.metaKey||e.shiftKey){if(jexcel.current.selectedCell&&1==jexcel.current.options.editable){var n=jexcel.current.selectedCell[1],l=jexcel.current.selectedCell[0];"readonly"!=jexcel.current.options.columns[l].type&&(32==e.keyCode?"checkbox"==jexcel.current.options.columns[l].type||"radio"==jexcel.current.options.columns[l].type?e.preventDefault():jexcel.current.openEditor(jexcel.current.records[n][l],!0):113==e.keyCode?jexcel.current.openEditor(jexcel.current.records[n][l],!1):(8==e.keyCode||e.keyCode>=48&&e.keyCode<=57||187==e.keyCode||jexcel.validLetter(String.fromCharCode(e.keyCode)))&&(jexcel.current.openEditor(jexcel.current.records[n][l],!0),"calendar"==jexcel.current.options.columns[l].type&&e.preventDefault()))}}else 65==e.which?(jexcel.current.selectAll(),e.preventDefault()):83==e.which?(jexcel.current.download(),e.preventDefault()):89==e.which?(jexcel.current.redo(),e.preventDefault()):90==e.which?(jexcel.current.undo(),e.preventDefault()):67==e.which?(jexcel.current.copy(!0),e.preventDefault()):67==e.which?(jexcel.current.copy(!0),e.preventDefault()):88==e.which?(1==jexcel.current.options.editable?jexcel.cutControls():jexcel.copyControls(),e.preventDefault()):86==e.which&&jexcel.pasteControls();else e.target.classList.contains("jexcel_search")&&(jexcel.timeControl&&clearTimeout(jexcel.timeControl),jexcel.timeControl=setTimeout(function(){jexcel.current.search(e.target.value)},200))}},jexcel.isMouseAction=!1,jexcel.mouseDownControls=function(e){if((e=e||window.event).buttons)var t=e.buttons;else if(e.button)t=e.button;else t=e.which;var o=jexcel.getElement(e.target);if(o[0]?jexcel.current!=o[0].jexcel&&(jexcel.current&&jexcel.current.resetSelection(),jexcel.current=o[0].jexcel):jexcel.current&&(jexcel.current.resetSelection(!0),jexcel.current=null),jexcel.current&&1==t){if(e.target.classList.contains("jexcel_selectall"))jexcel.current&&jexcel.current.selectAll();else if(e.target.classList.contains("jexcel_corner"))1==jexcel.current.options.editable&&(jexcel.current.selectedCorner=!0);else{if(1==o[1]){if(d=e.target.getAttribute("data-x")){var r=e.target.getBoundingClientRect();if(1==jexcel.current.options.columnResize&&r.width-e.offsetX<6){jexcel.current.resizing={mousePosition:e.pageX,column:d,width:r.width},jexcel.current.headers[d].classList.add("resizing");for(var n=0;n"==e.target.innerText?jexcel.current.page(e.target.getAttribute("title")-1):jexcel.current.page(e.target.innerText-1))}jexcel.current.edition?jexcel.isMouseAction=!1:jexcel.isMouseAction=!0}else jexcel.isMouseAction=!1},jexcel.mouseUpControls=function(e){if(jexcel.current)if(jexcel.current.resizing){if(jexcel.current.resizing.column){jexcel.current.headers[jexcel.current.resizing.column].classList.remove("resizing");var t=jexcel.current.colgroup[jexcel.current.resizing.column].getAttribute("width");jexcel.current.setWidth(jexcel.current.resizing.column,t,jexcel.current.resizing.width),jexcel.current.headers[jexcel.current.resizing.column].classList.remove("resizing");for(var o=0;o0&&(jexcel.current.copyData(jexcel.current.selection[0],jexcel.current.selection[jexcel.current.selection.length-1]),jexcel.current.removeCopySelection()));jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null),jexcel.isMouseAction=!1},jexcel.mouseMoveControls=function(e){if((e=e||window.event).buttons)var t=e.buttons;else if(e.button)t=e.button;else t=e.which;if(t||(jexcel.isMouseAction=!1),jexcel.current)if(1==jexcel.isMouseAction){if(jexcel.current.resizing)if(jexcel.current.resizing.column){var o=e.pageX-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.width+o>0){var r=jexcel.current.resizing.width+o;jexcel.current.colgroup[jexcel.current.resizing.column].setAttribute("width",r),jexcel.current.updateCornerPosition()}}else{var n=e.pageY-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.height+n>0){var l=jexcel.current.resizing.height+n;jexcel.current.rows[jexcel.current.resizing.row].setAttribute("height",l),jexcel.current.updateCornerPosition()}}}else{var s=e.target.getAttribute("data-x"),i=e.target.getAttribute("data-y"),a=e.target.getBoundingClientRect();e.target.style.cursor&&(e.target.style.cursor=""),e.target.parentNode.parentNode&&e.target.parentNode.parentNode.className&&(e.target.parentNode.parentNode.classList.contains("resizable")&&(e.target&&s&&!i&&a.width-(e.clientX-a.left)<6?e.target.style.cursor="col-resize":e.target&&!s&&i&&a.height-(e.clientY-a.top)<6&&(e.target.style.cursor="row-resize")),e.target.parentNode.parentNode.classList.contains("draggable")&&(e.target&&!s&&i&&a.width-(e.clientX-a.left)<6?e.target.style.cursor="move":e.target&&s&&!i&&a.height-(e.clientY-a.top)<6&&(e.target.style.cursor="move")))}},jexcel.mouseOverControls=function(e){if((e=e||window.event).buttons)var t=e.buttons;else if(e.button)t=e.button;else t=e.which;if(t||(jexcel.isMouseAction=!1),jexcel.current&&1==jexcel.isMouseAction){var o=jexcel.getElement(e.target);if(o[0]){if(jexcel.current!=o[0].jexcel&&jexcel.current)return!1;var r=e.target.getAttribute("data-x"),n=e.target.getAttribute("data-y");if(jexcel.current.dragging){if(jexcel.current.dragging.column){if(r)if(jexcel.current.isColMerged(r).length)console.error("JEXCEL: This column is part of a merged cell.");else{for(var l=0;le.offsetX?(jexcel.current.dragging.columne.offsetY?e.target.parentNode.nextSibling:e.target.parentNode;e.target.parentNode.parentNode.insertBefore(jexcel.current.dragging.element,s)}}else if(jexcel.current.resizing);else{if(1==o[1]&&jexcel.current.selectedHeader){r=e.target.getAttribute("data-x");var i=jexcel.current.selectedHeader,a=r;jexcel.current.updateSelectionFromCoords(i,0,a,jexcel.current.options.data.length-1)}if(2==o[1])if(e.target.classList.contains("jexcel_row")){if(jexcel.current.selectedRow){i=jexcel.current.selectedRow,a=n;jexcel.current.updateSelectionFromCoords(0,i,jexcel.current.options.data[0].length-1,a)}}else jexcel.current.edition||r&&n&&(jexcel.current.selectedCorner?jexcel.current.updateCopySelection(r,n):jexcel.current.selectedCell&&jexcel.current.updateSelectionFromCoords(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],r,n))}}}jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null)},jexcel.doubleClickControls=function(e){if(jexcel.current)if(e.target.classList.contains("jexcel_corner")){if(jexcel.current.highlighted.length>0){var t=jexcel.current.highlighted[0].getAttribute("data-x"),o=parseInt(jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-y"))+1,r=jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-x"),n=jexcel.current.records.length-1;jexcel.current.copyData(jexcel.current.records[o][t],jexcel.current.records[n][r])}}else{var l=jexcel.getElement(e.target);if(1==l[1]&&1==jexcel.current.options.columnSorting){var s=e.target.getAttribute("data-x");s&&jexcel.current.orderBy(s)}if(2==l[1]&&1==jexcel.current.options.editable&&!jexcel.current.edition){var i=function(e){if(e.parentNode){var t=e.getAttribute("data-x"),o=e.getAttribute("data-y");return t&&o?e:i(e.parentNode)}},a=i(e.target);a&&a.classList.contains("highlight")&&jexcel.current.openEditor(a)}}},jexcel.copyControls=function(e){jexcel.current&&jexcel.copyControls.enabled&&(jexcel.current.edition||jexcel.current.copy(!0))},jexcel.cutControls=function(e){jexcel.current&&(jexcel.current.edition||(jexcel.current.copy(!0),1==jexcel.current.options.editable&&jexcel.current.setValue(jexcel.current.highlighted,"")))},jexcel.pasteControls=function(e){jexcel.current&&jexcel.current.selectedCell&&(jexcel.current.edition||1==jexcel.current.options.editable&&(e&&e.clipboardData?(jexcel.current.paste(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],e.clipboardData.getData("text")),e.preventDefault()):window.clipboardData&&jexcel.current.paste(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],window.clipboardData.getData("text"))))},jexcel.contextMenuControls=function(e){if("buttons"in(e=e||window.event))e.buttons;else e.which||e.button;if(jexcel.current)if(jexcel.current.edition)e.preventDefault();else if(jexcel.current.options.contextMenu&&(jexcel.current.contextMenu.contextmenu.close(),jexcel.current)){var t=e.target.getAttribute("data-x"),o=e.target.getAttribute("data-y");if(t||o){var r=jexcel.current.options.contextMenu(jexcel.current,t,o,e);jexcel.current.contextMenu.contextmenu.open(e,r),e.preventDefault()}}},jexcel.touchStartControls=function(e){var t=jexcel.getElement(e.target);if(t[0]?jexcel.current!=t[0].jexcel&&(jexcel.current&&jexcel.current.resetSelection(),jexcel.current=t[0].jexcel):jexcel.current&&(jexcel.current.resetSelection(),jexcel.current=null),jexcel.current&&!jexcel.current.edition){var o=e.target.getAttribute("data-x"),r=e.target.getAttribute("data-y");o&&r&&(jexcel.current.updateSelectionFromCoords(o,r),jexcel.timeControl=setTimeout(function(){jexcel.current.openEditor(e.target,!1,e)},500))}},jexcel.touchEndControls=function(e){jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null)},"undefined"!=typeof jQuery&&function(e){var t={init:function(o){t=jexcel(e(this).get(0),o)}};e.fn.jexcel=function(o){return t[o]?t[o].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof o&&o?void e.error("Method "+o+" does not exist on jQuery.tooltip"):t.init.apply(this,arguments)}}(jQuery),jexcel.createTabs=function(e,t){e.innerHTML="",e.classList.add("jexcel_tabs");for(var o=[],r=[],n=0;n0){r.mergeCells=[];for(n=0;n0&&(r.style[p[n]]=d.style),d.s&&d.s.fgColor&&(r.style[p[n]]&&(r.style[p[n]]+=";"),r.style[p[n]]+="background-color:#"+d.s.fgColor.rgb)}for(var f=r.columns,g=0;g<=b;g++)for(n=0;n<=c;n++)r.data[g]||(r.data[g]=[]),r.data[g][n]||f-22038912e5?2:1)}return e.DATE=function(e,t,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:e<0||t<0||o<0?error.num:new Date(e,t-1,o)},e.DATEVALUE=function(e){if("string"!=typeof e)return error.value;var o=Date.parse(e);return isNaN(o)?error.value:o<=-22038912e5?(o-t)/864e5+1:(o-t)/864e5+2},e.DAY=function(e){var t=utils.parseDate(e);return t instanceof Error?t:t.getDate()},e.DAYS=function(e,t){return e=utils.parseDate(e),t=utils.parseDate(t),e instanceof Error?e:t instanceof Error?t:r(e)-r(t)},e.DAYS360=function(e,t,o){},e.EDATE=function(e,t){return(e=utils.parseDate(e))instanceof Error?e:isNaN(t)?error.value:(t=parseInt(t,10),e.setMonth(e.getMonth()+t),r(e))},e.EOMONTH=function(e,t){return(e=utils.parseDate(e))instanceof Error?e:isNaN(t)?error.value:(t=parseInt(t,10),r(new Date(e.getFullYear(),e.getMonth()+t+1,0)))},e.HOUR=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getHours()},e.INTERVAL=function(e){if("number"!=typeof e&&"string"!=typeof e)return error.value;e=parseInt(e,10);var t=Math.floor(e/94608e4);e%=94608e4;var o=Math.floor(e/2592e3);e%=2592e3;var r=Math.floor(e/86400);e%=86400;var n=Math.floor(e/3600);e%=3600;var l=Math.floor(e/60),s=e%=60;return"P"+(t=t>0?t+"Y":"")+(o=o>0?o+"M":"")+(r=r>0?r+"D":"")+"T"+(n=n>0?n+"H":"")+(l=l>0?l+"M":"")+(s=s>0?s+"S":"")},e.ISOWEEKNUM=function(e){if((e=utils.parseDate(e))instanceof Error)return e;e.setHours(0,0,0),e.setDate(e.getDate()+4-(e.getDay()||7));var t=new Date(e.getFullYear(),0,1);return Math.ceil(((e-t)/864e5+1)/7)},e.MINUTE=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getMinutes()},e.MONTH=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getMonth()+1},e.NETWORKDAYS=function(e,t,o){},e.NETWORKDAYS.INTL=function(e,t,o,r){},e.NOW=function(){return new Date},e.SECOND=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getSeconds()},e.TIME=function(e,t,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:e<0||t<0||o<0?error.num:(3600*e+60*t+o)/86400},e.TIMEVALUE=function(e){return(e=utils.parseDate(e))instanceof Error?e:(3600*e.getHours()+60*e.getMinutes()+e.getSeconds())/86400},e.TODAY=function(){return new Date},e.WEEKDAY=function(e,t){if((e=utils.parseDate(e))instanceof Error)return e;void 0===t&&(t=1);var r=e.getDay();return o[t][r]},e.WEEKNUM=function(e,t){},e.WORKDAY=function(e,t,o){},e.WORKDAY.INTL=function(e,t,o,r){},e.YEAR=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getFullYear()},e.YEARFRAC=function(e,t,o){},e}(),jexcel.methods.database=function(){var exports={};function compact(e){if(!e)return e;for(var t=[],o=0;omaxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;k1?error.num:n[r[0]]},exports.DMAX=function(e,t,o){if(isNaN(t)&&"string"!=typeof t)return error.value;var r=findResultIndex(e,o),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=n[r[0]],i=1;in[r[i]]&&(s=n[r[i]]);return s},exports.DPRODUCT=function(e,t,o){if(isNaN(t)&&"string"!=typeof t)return error.value;var r=findResultIndex(e,o),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=[],i=0;in&&(r=l+1,n=t[l]):(r=l+1,n=t[l]))}else if(0===o){if("string"==typeof e){if(e=e.replace(/\?/g,"."),t[l].toLowerCase().match(e.toLowerCase()))return l+1}else if(t[l]===e)return l+1}else if(-1===o){if(t[l]===e)return l+1;t[l]>e&&(n?t[l]=n.length?REPT("0",o-n.length)+n:error.num},e.BIN2OCT=function(e,o){if(!t(e))return error.num;var r=e.toString();if(10===r.length&&"1"===r.substring(0,1))return(1073741312+parseInt(r.substring(1),2)).toString(8);var n=parseInt(e,2).toString(8);return void 0===o?n:isNaN(o)?error.value:o<0?error.num:(o=Math.floor(o))>=n.length?REPT("0",o-n.length)+n:error.num},e.BITAND=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e&t},e.BITLSHIFT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0?error.num:Math.floor(e)!==e?error.num:e>0xffffffffffff?error.num:Math.abs(t)>53?error.num:t>=0?e<>-t},e.BITOR=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e|t},e.BITRSHIFT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0?error.num:Math.floor(e)!==e?error.num:e>0xffffffffffff?error.num:Math.abs(t)>53?error.num:t>=0?e>>t:e<<-t},e.BITXOR=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e^t},e.COMPLEX=function(e,t,o){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return e;if("i"!==(o=void 0===o?"i":o)&&"j"!==o)return error.value;if(0===e&&0===t)return 0;if(0===e)return 1===t?o:t.toString()+o;if(0===t)return e.toString();var r=t>0?"+":"";return e.toString()+r+(1===t?o:t.toString()+o)},e.CONVERT=function(e,t,o){if((e=utils.parseNumber(e))instanceof Error)return e;for(var r,n=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],l={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},i=null,a=null,u=t,c=o,b=1,p=1,d=0;d=0)&&(i=n[d]),(n[d][1]===c||r.indexOf(c)>=0)&&(a=n[d]);if(null===i){var j=l[t.substring(0,2)],f=s[t.substring(0,1)];"da"===t.substring(0,2)&&(f=["dekao",10,"da"]),j?(b=j[2],u=t.substring(2)):f&&(b=f[1],u=t.substring(f[2].length));for(var g=0;g=0)&&(i=n[g])}if(null===a){var h=l[o.substring(0,2)],m=s[o.substring(0,1)];"da"===o.substring(0,2)&&(m=["dekao",10,"da"]),h?(p=h[2],c=o.substring(2)):m&&(p=m[1],c=o.substring(m[2].length));for(var v=0;v=0)&&(a=n[v])}return null===i||null===a?error.na:i[3]!==a[3]?error.na:e*i[6]*b/(a[6]*p)},e.DEC2BIN=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,3}$/.test(e)||e<-512||e>511)return error.num;if(e<0)return"1"+REPT("0",9-(512+e).toString(2).length)+(512+e).toString(2);var o=parseInt(e,10).toString(2);return void 0===t?o:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=o.length?REPT("0",t-o.length)+o:error.num},e.DEC2HEX=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,12}$/.test(e)||e<-549755813888||e>549755813887)return error.num;if(e<0)return(1099511627776+e).toString(16);var o=parseInt(e,10).toString(16);return void 0===t?o:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=o.length?REPT("0",t-o.length)+o:error.num},e.DEC2OCT=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,9}$/.test(e)||e<-536870912||e>536870911)return error.num;if(e<0)return(1073741824+e).toString(8);var o=parseInt(e,10).toString(8);return void 0===t?o:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=o.length?REPT("0",t-o.length)+o:error.num},e.DELTA=function(e,t){return t=void 0===t?0:t,e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e===t?1:0},e.ERF=function(e,t){},e.ERF.PRECISE=function(){},e.ERFC=function(e){},e.ERFC.PRECISE=function(){},e.GESTEP=function(e,t){return t=t||0,e=utils.parseNumber(e),utils.anyIsError(t,e)?e:e>=t?1:0},e.HEX2BIN=function(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var o=10===e.length&&"f"===e.substring(0,1).toLowerCase(),r=o?parseInt(e,16)-1099511627776:parseInt(e,16);if(r<-512||r>511)return error.num;if(o)return"1"+REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var n=r.toString(2);return void 0===t?n:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=n.length?REPT("0",t-n.length)+n:error.num},e.HEX2DEC=function(e){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var t=parseInt(e,16);return t>=549755813888?t-1099511627776:t},e.HEX2OCT=function(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var o=parseInt(e,16);if(o>536870911&&o<0xffe0000000)return error.num;if(o>=0xffe0000000)return(o-0xffc0000000).toString(8);var r=o.toString(8);return void 0===t?r:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=r.length?REPT("0",t-r.length)+r:error.num},e.IMABS=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.value:Math.sqrt(Math.pow(o,2)+Math.pow(r,2))},e.IMAGINARY=function(e){if(void 0===e||!0===e||!1===e)return error.value;if(0===e||"0"===e)return 0;if(["i","j"].indexOf(e)>=0)return 1;var t=(e=e.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j")).indexOf("+"),o=e.indexOf("-");0===t&&(t=e.indexOf("+",1)),0===o&&(o=e.indexOf("-",1));var r=e.substring(e.length-1,e.length),n="i"===r||"j"===r;return t>=0||o>=0?n?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?error.num:Number(e.substring(t+1,e.length-1)):isNaN(e.substring(0,o))||isNaN(e.substring(o+1,e.length-1))?error.num:-Number(e.substring(o+1,e.length-1)):error.num:n?isNaN(e.substring(0,e.length-1))?error.num:e.substring(0,e.length-1):isNaN(e)?error.num:0},e.IMARGUMENT=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.value:0===o&&0===r?error.div0:0===o&&r>0?Math.PI/2:0===o&&r<0?-Math.PI/2:0===r&&o>0?0:0===r&&o<0?-Math.PI:o>0?Math.atan(r/o):o<0&&r>=0?Math.atan(r/o)+Math.PI:Math.atan(r/o)-Math.PI},e.IMCONJUGATE=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",0!==r?e.COMPLEX(o,-r,n):t},e.IMCOS=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(o)*(Math.exp(r)+Math.exp(-r))/2,-Math.sin(o)*(Math.exp(r)-Math.exp(-r))/2,n)},e.IMCOSH=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(r)*(Math.exp(o)+Math.exp(-o))/2,Math.sin(r)*(Math.exp(o)-Math.exp(-o))/2,n)},e.IMCOT=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.value:e.IMDIV(e.IMCOS(t),e.IMSIN(t))},e.IMDIV=function(t,o){var r=e.IMREAL(t),n=e.IMAGINARY(t),l=e.IMREAL(o),s=e.IMAGINARY(o);if(utils.anyIsError(r,n,l,s))return error.value;var i=t.substring(t.length-1),a=o.substring(o.length-1),u="i";if("j"===i?u="j":"j"===a&&(u="j"),0===l&&0===s)return error.num;var c=l*l+s*s;return e.COMPLEX((r*l+n*s)/c,(n*l-r*s)/c,u)},e.IMEXP=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);n="i"===n||"j"===n?n:"i";var l=Math.exp(o);return e.COMPLEX(l*Math.cos(r),l*Math.sin(r),n)},e.IMLN=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(o*o+r*r)),Math.atan(r/o),n)},e.IMLOG10=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(o*o+r*r))/Math.log(10),Math.atan(r/o)/Math.log(10),n)},e.IMLOG2=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(o*o+r*r))/Math.log(2),Math.atan(r/o)/Math.log(2),n)},e.IMPOWER=function(t,o){o=utils.parseNumber(o);var r=e.IMREAL(t),n=e.IMAGINARY(t);if(utils.anyIsError(o,r,n))return error.value;var l=t.substring(t.length-1);l="i"===l||"j"===l?l:"i";var s=Math.pow(e.IMABS(t),o),i=e.IMARGUMENT(t);return e.COMPLEX(s*Math.cos(o*i),s*Math.sin(o*i),l)},e.IMPRODUCT=function(){for(var t=arguments[0],o=1;o=0)return 0;var t=e.indexOf("+"),o=e.indexOf("-");0===t&&(t=e.indexOf("+",1)),0===o&&(o=e.indexOf("-",1));var r=e.substring(e.length-1,e.length),n="i"===r||"j"===r;return t>=0||o>=0?n?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?error.num:Number(e.substring(0,t)):isNaN(e.substring(0,o))||isNaN(e.substring(o+1,e.length-1))?error.num:Number(e.substring(0,o)):error.num:n?isNaN(e.substring(0,e.length-1))?error.num:0:isNaN(e)?error.num:e},e.IMSEC=function(t){if(!0===t||!1===t)return error.value;var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.value:e.IMDIV("1",e.IMCOS(t))},e.IMSECH=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.value:e.IMDIV("1",e.IMCOSH(t))},e.IMSIN=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.sin(o)*(Math.exp(r)+Math.exp(-r))/2,Math.cos(o)*(Math.exp(r)-Math.exp(-r))/2,n)},e.IMSINH=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(r)*(Math.exp(o)-Math.exp(-o))/2,Math.sin(r)*(Math.exp(o)+Math.exp(-o))/2,n)},e.IMSQRT=function(t){var o=e.IMREAL(t),r=e.IMAGINARY(t);if(utils.anyIsError(o,r))return error.value;var n=t.substring(t.length-1);n="i"===n||"j"===n?n:"i";var l=Math.sqrt(e.IMABS(t)),s=e.IMARGUMENT(t);return e.COMPLEX(l*Math.cos(s/2),l*Math.sin(s/2),n)},e.IMCSC=function(t){if(!0===t||!1===t)return error.value;var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.num:e.IMDIV("1",e.IMSIN(t))},e.IMCSCH=function(t){if(!0===t||!1===t)return error.value;var o=e.IMREAL(t),r=e.IMAGINARY(t);return utils.anyIsError(o,r)?error.num:e.IMDIV("1",e.IMSINH(t))},e.IMSUB=function(e,t){var o=this.IMREAL(e),r=this.IMAGINARY(e),n=this.IMREAL(t),l=this.IMAGINARY(t);if(utils.anyIsError(o,r,n,l))return error.value;var s=e.substring(e.length-1),i=t.substring(t.length-1),a="i";return"j"===s?a="j":"j"===i&&(a="j"),this.COMPLEX(o-n,r-l,a)},e.IMSUM=function(){for(var e=utils.flatten(arguments),t=e[0],o=1;o511)return error.num;if(o)return"1"+REPT("0",9-(512+r).toString(2).length)+(512+r).toString(2);var n=r.toString(2);return void 0===t?n:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=n.length?REPT("0",t-n.length)+n:error.num},e.OCT2DEC=function(e){if(!/^[0-7]{1,10}$/.test(e))return error.num;var t=parseInt(e,8);return t>=536870912?t-1073741824:t},e.OCT2HEX=function(e,t){if(!/^[0-7]{1,10}$/.test(e))return error.num;var o=parseInt(e,8);if(o>=536870912)return"ff"+(o+3221225472).toString(16);var r=o.toString(16);return void 0===t?r:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=r.length?REPT("0",t-r.length)+r:error.num},e}(),jexcel.methods.financial=function(){var e={};function t(e){return e&&e.getTime&&!isNaN(e.getTime())}function o(e){return e instanceof Date?e:new Date(e)}return e.ACCRINT=function(e,r,n,l,s,i,a){return e=o(e),r=o(r),n=o(n),t(e)&&t(r)&&t(n)?l<=0||s<=0?"#NUM!":-1===[1,2,4].indexOf(i)?"#NUM!":-1===[0,1,2,3,4].indexOf(a)?"#NUM!":n<=e?"#NUM!":(a=a||0,(s=s||0)*l*YEARFRAC(e,n,a)):"#VALUE!"},e.ACCRINTM=null,e.AMORDEGRC=null,e.AMORLINC=null,e.COUPDAYBS=null,e.COUPDAYS=null,e.COUPDAYSNC=null,e.COUPNCD=null,e.COUPNUM=null,e.COUPPCD=null,e.CUMIPMT=function(t,o,r,n,l,s){if(t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),utils.anyIsError(t,o,r))return error.value;if(t<=0||o<=0||r<=0)return error.num;if(n<1||l<1||n>l)return error.num;if(0!==s&&1!==s)return error.num;var i=e.PMT(t,o,r,0,s),a=0;1===n&&0===s&&(a=-r,n++);for(var u=n;u<=l;u++)a+=1===s?e.FV(t,u-2,i,r,1)-i:e.FV(t,u-1,i,r,0);return a*=t},e.CUMPRINC=function(t,o,r,n,l,s){if(t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),utils.anyIsError(t,o,r))return error.value;if(t<=0||o<=0||r<=0)return error.num;if(n<1||l<1||n>l)return error.num;if(0!==s&&1!==s)return error.num;var i=e.PMT(t,o,r,0,s),a=0;1===n&&(a=0===s?i+r*t:i,n++);for(var u=n;u<=l;u++)a+=s>0?i-(e.FV(t,u-2,i,r,1)-i)*t:i-e.FV(t,u-1,i,r,0)*t;return a},e.DB=function(e,t,o,r,n){if(n=void 0===n?12:n,e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),n=utils.parseNumber(n),utils.anyIsError(e,t,o,r,n))return error.value;if(e<0||t<0||o<0||r<0)return error.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(n))return error.num;if(r>o)return error.num;if(t>=e)return 0;for(var l=(1-Math.pow(t/e,1/o)).toFixed(3),s=e*l*n/12,i=s,a=0,u=r===o?o-1:r,c=2;c<=u;c++)i+=a=(e-i)*l;return 1===r?s:r===o?(e-i)*l:a},e.DDB=function(e,t,o,r,n){if(n=void 0===n?2:n,e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),n=utils.parseNumber(n),utils.anyIsError(e,t,o,r,n))return error.value;if(e<0||t<0||o<0||r<0||n<=0)return error.num;if(r>o)return error.num;if(t>=e)return 0;for(var l=0,s=0,i=1;i<=r;i++)l+=s=Math.min(n/o*(e-l),e-t-l);return s},e.DISC=null,e.DOLLARDE=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(t<0)return error.num;if(t>=0&&t<1)return error.div0;t=parseInt(t,10);var o=parseInt(e,10);o+=e%1*Math.pow(10,Math.ceil(Math.log(t)/Math.LN10))/t;var r=Math.pow(10,Math.ceil(Math.log(t)/Math.LN2)+1);return o=Math.round(o*r)/r},e.DOLLARFR=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(t<0)return error.num;if(t>=0&&t<1)return error.div0;t=parseInt(t,10);var o=parseInt(e,10);return o+=e%1*Math.pow(10,-Math.ceil(Math.log(t)/Math.LN10))*t},e.DURATION=null,e.EFFECT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<=0||t<1?error.num:(t=parseInt(t,10),Math.pow(1+e/t,t)-1)},e.FV=function(e,t,o,r,n){if(r=r||0,n=n||0,e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),n=utils.parseNumber(n),utils.anyIsError(e,t,o,r,n))return error.value;var l;if(0===e)l=r+o*t;else{var s=Math.pow(1+e,t);l=1===n?r*s+o*(1+e)*(s-1)/e:r*s+o*(s-1)/e}return-l},e.FVSCHEDULE=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var o=t.length,r=e,n=0;n0&&(l=!0),e[i]<0&&(s=!0);if(!l||!s)return error.num;var a,u,c,b=t=void 0===t?.1:t,p=!0;do{a=b-(c=o(e,n,b))/r(e,n,b),u=Math.abs(a-b),b=a,p=u>1e-10&&Math.abs(c)>1e-10}while(p);return b},e.ISPMT=function(e,t,o,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumber(r),utils.anyIsError(e,t,o,r)?error.value:r*e*(t/o-1)},e.MDURATION=null,e.MIRR=function(t,o,r){if(t=utils.parseNumberArray(utils.flatten(t)),o=utils.parseNumber(o),r=utils.parseNumber(r),utils.anyIsError(t,o,r))return error.value;for(var n=t.length,l=[],s=[],i=0;io?error.num:(e-t)*(o-(r=parseInt(r,10))+1)*2/(o*(o+1))},e.TBILLEQ=function(e,t,o){return e=utils.parseDate(e),t=utils.parseDate(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:o<=0?error.num:e>t?error.num:t-e>31536e6?error.num:365*o/(360-o*DAYS360(e,t,!1))},e.TBILLPRICE=function(e,t,o){return e=utils.parseDate(e),t=utils.parseDate(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:o<=0?error.num:e>t?error.num:t-e>31536e6?error.num:100*(1-o*DAYS360(e,t,!1)/360)},e.TBILLYIELD=function(e,t,o){return e=utils.parseDate(e),t=utils.parseDate(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:o<=0?error.num:e>t?error.num:t-e>31536e6?error.num:360*(100-o)/(o*DAYS360(e,t,!1))},e.VDB=null,e.XIRR=function(e,t,o){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseDateArray(utils.flatten(t)),o=utils.parseNumber(o),utils.anyIsError(e,t,o))return error.value;for(var r=function(e,t,o){for(var r=o+1,n=e[0],l=1;l0&&(l=!0),e[i]<0&&(s=!0);if(!l||!s)return error.num;var a,u,c,b=o=o||.1,p=!0;do{a=b-(c=r(e,t,b))/n(e,t,b),u=Math.abs(a-b),b=a,p=u>1e-10&&Math.abs(c)>1e-10}while(p);return b},e.XNPV=function(e,t,o){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),o=utils.parseDateArray(utils.flatten(o)),utils.anyIsError(e,t,o))return error.value;for(var r=0,n=0;n=0||"number"==typeof e&&(isNaN(e)||!isFinite(e))},e.ISERROR=function(t){return e.ISERR(t)||t===error.na},e.ISEVEN=function(e){return!(1&Math.floor(Math.abs(e)))},e.ISFORMULA=null,e.ISLOGICAL=function(e){return!0===e||!1===e},e.ISNA=function(e){return e===error.na},e.ISNONTEXT=function(e){return"string"!=typeof e},e.ISNUMBER=function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)},e.ISODD=function(e){return!!(1&Math.floor(Math.abs(e)))},e.ISREF=null,e.ISTEXT=function(e){return"string"==typeof e},e.N=function(e){return this.ISNUMBER(e)?e:e instanceof Date?e.getTime():!0===e?1:!1===e?0:this.ISERROR(e)?e:0},e.NA=function(){return error.na},e.SHEET=null,e.SHEETS=null,e.TYPE=function(e){return this.ISNUMBER(e)?1:this.ISTEXT(e)?2:this.ISLOGICAL(e)?4:this.ISERROR(e)?16:Array.isArray(e)?64:void 0},e}(),jexcel.methods.logical=function(){var e={AND:function(){for(var e=utils.flatten(arguments),t=!0,o=0;o254?error.value:arguments.length0){var t=arguments[0],o=arguments.length-1,r=Math.floor(o/2),n=!1,l=o%2==0?null:arguments[arguments.length-1];if(r)for(var s=0;s=0?Math.ceil(e/t)*t:0===o?-1*Math.floor(Math.abs(e)/t)*t:-1*Math.ceil(Math.abs(e)/t)*t)}};exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:exports.FACT(e)/(exports.FACT(t)*exports.FACT(e-t))},exports.COMBINA=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:0===e&&0===t?1:exports.COMBIN(e+t-1,e-1)},exports.COS=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.cos(e)},exports.COSH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:(Math.exp(e)+Math.exp(-e))/2},exports.COT=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.tan(e)},exports.COTH=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.exp(2*e);return(t+1)/(t-1)},exports.CSC=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.sin(e)},exports.CSCH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:2/(Math.exp(e)-Math.exp(-e))},exports.DECIMAL=function(e,t){return arguments.length<1?error.value:parseInt(e,t)},exports.DEGREES=function(e){return(e=utils.parseNumber(e))instanceof Error?e:180*e/Math.PI},exports.EVEN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:exports.CEILING(e,-2,-1)},exports.EXP=Math.exp;var MEMOIZED_FACT=[];return exports.FACT=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.floor(e);return 0===t||1===t?1:MEMOIZED_FACT[t]>0?MEMOIZED_FACT[t]:(MEMOIZED_FACT[t]=exports.FACT(t-1)*t,MEMOIZED_FACT[t])},exports.FACTDOUBLE=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.floor(e);return t<=0?1:t*exports.FACTDOUBLE(t-2)},exports.FLOOR=function(e,t,o){return t=void 0===t?1:t,o=void 0===o?0:o,e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:0===t?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:0===o?-1*Math.ceil(Math.abs(e)/t)*t:-1*Math.floor(Math.abs(e)/t)*t)},exports.FLOOR.MATH=exports.FLOOR,exports.GCD=null,exports.INT=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.floor(e)},exports.LCM=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t,o,r,n,l=1;void 0!==(r=e.pop());)for(;r>1;){if(r%2){for(t=3,o=Math.floor(Math.sqrt(r));t<=o&&r%t;t+=2);n=t<=o?t:r}else n=2;for(r/=n,l*=n,t=e.length;t;e[--t]%n==0&&1==(e[t]/=n)&&e.splice(t,1));}return l},exports.LN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e)},exports.LOG=function(e,t){return e=utils.parseNumber(e),t=void 0===t?10:utils.parseNumber(t),utils.anyIsError(e,t)?error.value:Math.log(e)/Math.log(t)},exports.LOG10=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e)/Math.log(10)},exports.MDETERM=null,exports.MINVERSE=null,exports.MMULT=null,exports.MOD=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(0===t)return error.div0;var o=Math.abs(e%t);return t>0?o:-o},exports.MROUND=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e*t<0?error.num:Math.round(e/t)*t},exports.MULTINOMIAL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=0,o=1,r=0;r0?t:-t},exports.PI=function(){return Math.PI},exports.POWER=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var o=Math.pow(e,t);return isNaN(o)?error.num:o},exports.PRODUCT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=1,o=0;o0?1:-1)*Math.floor(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports.ROUNDUP=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:(e>0?1:-1)*Math.ceil(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports.SEC=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.cos(e)},exports.SECH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:2/(Math.exp(e)+Math.exp(-e))},exports.SERIESSUM=function(e,t,o,r){if(e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),r=utils.parseNumberArray(r),utils.anyIsError(e,t,o,r))return error.value;for(var n=r[0]*Math.pow(e,t),l=1;l=t)},exports.LT=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.error:e0?1:-1)*Math.floor(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports}(),jexcel.methods.misc=function(){var e={UNIQUE:function(){for(var e=[],t=0;t-1;)e[t]="TRUE";for(var o=0;(o=e.indexOf(!1))>-1;)e[o]="FALSE";return e.join("")},DBCS:null,DOLLAR:null,EXACT:function(e,t){return e===t},FIND:function(e,t,o){return o=void 0===o?0:o,t?t.indexOf(e,o-1)+1:null},FIXED:null,HTML2TEXT:function(e){var t="";return e&&(e instanceof Array?e.forEach(function(e){""!==t&&(t+="\n"),t+=e.replace(/<(?:.|\n)*?>/gm,"")}):t=e.replace(/<(?:.|\n)*?>/gm,"")),t},LEFT:function(e,t){return t=void 0===t?1:t,(t=utils.parseNumber(t))instanceof Error||"string"!=typeof e?error.value:e?e.substring(0,t):null},LEN:function(e){return 0===arguments.length?error.error:"string"==typeof e?e?e.length:0:e.length?e.length:error.value},LOWER:function(e){return"string"!=typeof e?error.value:e?e.toLowerCase():e},MID:function(e,t,o){if(t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(t,o)||"string"!=typeof e)return o;var r=t-1,n=r+o;return e.substring(r,n)},NUMBERVALUE:null,PRONETIC:null,PROPER:function(e){return void 0===e||0===e.length?error.value:(!0===e&&(e="TRUE"),!1===e&&(e="FALSE"),isNaN(e)&&"number"==typeof e?error.value:("number"==typeof e&&(e=""+e),e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})))},REGEXEXTRACT:function(e,t){var o=e.match(new RegExp(t));return o?o[o.length>1?o.length-1:0]:null},REGEXMATCH:function(e,t,o){var r=e.match(new RegExp(t));return o?r:!!r},REGEXREPLACE:function(e,t,o){return e.replace(new RegExp(t),o)},REPLACE:function(e,t,o,r){return t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(t,o)||"string"!=typeof e||"string"!=typeof r?error.value:e.substr(0,t-1)+r+e.substr(t-1+o)},REPT:function(e,t){return(t=utils.parseNumber(t))instanceof Error?t:new Array(t+1).join(e)},RIGHT:function(e,t){return t=void 0===t?1:t,(t=utils.parseNumber(t))instanceof Error?t:e?e.substring(e.length-t):null},SEARCH:function(e,t,o){var r;return"string"!=typeof e||"string"!=typeof t?error.value:(o=void 0===o?0:o,0===(r=t.toLowerCase().indexOf(e.toLowerCase(),o-1)+1)?error.value:r)},SPLIT:function(e,t){return e.split(t)},SUBSTITUTE:function(e,t,o,r){if(!(e&&t&&o))return e;if(void 0===r)return e.replace(new RegExp(t,"g"),o);for(var n=0,l=0;e.indexOf(t,n)>0;)if(n=e.indexOf(t,n+1),++l===r)return e.substring(0,n)+o+e.substring(n+t.length)},T:function(e){return"string"==typeof e?e:""},TEXT:null,TRIM:function(e){return"string"!=typeof e?error.value:e.replace(/ +/g," ").trim()}};return e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(e){return"string"!=typeof e?error.value:e.toUpperCase()},e.VALUE=null,e}(),jexcel.methods.stats=function(){var exports={},SQRT2PI=2.5066282746310002;return exports.AVEDEV=null,exports.AVERAGE=function(){for(var e=utils.numbers(utils.flatten(arguments)),t=e.length,o=0,r=0,n=0;n=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;i=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;jt[l-1]&&e[s]<=t[l]&&(n[l]+=1):l===r&&e[s]>t[r-1]&&(n[r]+=1)}return n},exports.LARGE=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t)?e:e.sort(function(e,t){return t-e})[t-1]},exports.MAX=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MAXA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MIN=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MINA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MODE={},exports.MODE.MULT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t,o=e.length,r={},n=[],l=0,s=0;sl&&(l=r[t],n=[]),r[t]===l&&(n[n.length]=t);return n},exports.MODE.SNGL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));return e instanceof Error?e:exports.MODE.MULT(e).sort(function(e,t){return e-t})[0]},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var o=(e=e.sort(function(e,t){return e-t})).length;if(t<1/(o+1)||t>1-1/(o+1))return error.num;var r=t*(o+1)-1,n=Math.floor(r);return utils.cleanFloat(r===n?e[r]:e[n]+(r-n)*(e[n+1]-e[n]))},exports.PERCENTILE.INC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var o=t*((e=e.sort(function(e,t){return e-t})).length-1),r=Math.floor(o);return utils.cleanFloat(o===r?e[o]:e[r]+(o-r)*(e[r+1]-e[r]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(e,t,o){if(o=void 0===o?3:o,e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o))return error.value;e=e.sort(function(e,t){return e-t});for(var r=UNIQUE.apply(null,e),n=e.length,l=r.length,s=Math.pow(10,o),i=0,a=!1,u=0;!a&&u=r[u]&&(t=r[u]&&(t=0?t[e.indexOf(o)]:0;for(var n=e.sort(function(e,t){return e-t}),l=n.length,s=0,i=0;i=o&&n[i]<=r&&(s+=t[e.indexOf(n[i])]);return s},exports.QUARTILE={},exports.QUARTILE.EXC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;switch(t){case 1:return exports.PERCENTILE.EXC(e,.25);case 2:return exports.PERCENTILE.EXC(e,.5);case 3:return exports.PERCENTILE.EXC(e,.75);default:return error.num}},exports.QUARTILE.INC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;switch(t){case 1:return exports.PERCENTILE.INC(e,.25);case 2:return exports.PERCENTILE.INC(e,.5);case 3:return exports.PERCENTILE.INC(e,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(e,t,o){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var r=(o=o||!1)?function(e,t){return e-t}:function(e,t){return t-e},n=(t=(t=utils.flatten(t)).sort(r)).length,l=0,s=0;s1?(2*t.indexOf(e)+l+1)/2:t.indexOf(e)+1},exports.RANK.EQ=function(e,t,o){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;var r=(o=o||!1)?function(e,t){return e-t}:function(e,t){return t-e};return(t=t.sort(r)).indexOf(e)+1},exports.RSQ=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t)?error.value:Math.pow(exports.PEARSON(e,t),2)},exports.SMALL=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t)?e:e.sort(function(e,t){return e-t})[t-1]},exports.STANDARDIZE=function(e,t,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),o=utils.parseNumber(o),utils.anyIsError(e,t,o)?error.value:(e-t)/o},exports.STDEV={},exports.STDEV.P=function(){var e=exports.VAR.P.apply(this,arguments);return Math.sqrt(e)},exports.STDEV.S=function(){var e=exports.VAR.S.apply(this,arguments);return Math.sqrt(e)},exports.STDEVA=function(){var e=exports.VARA.apply(this,arguments);return Math.sqrt(e)},exports.STDEVPA=function(){var e=exports.VARPA.apply(this,arguments);return Math.sqrt(e)},exports.VAR={},exports.VAR.P=function(){for(var e=utils.numbers(utils.flatten(arguments)),t=e.length,o=0,r=exports.AVERAGE(e),n=0;n