From 2d416de638c23de4623688d62be1a37b55fde1e6 Mon Sep 17 00:00:00 2001 From: Marcin Warpechowski Date: Wed, 31 Jul 2013 09:26:47 +0200 Subject: [PATCH] angular-ui-handsontable 0.3.14 --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/angular-ui-handsontable.full.css | 4 ++-- dist/angular-ui-handsontable.full.js | 6 +++--- dist/angular-ui-handsontable.full.min.css | 4 ++-- dist/angular-ui-handsontable.full.min.js | 12 ++++++------ package.json | 2 +- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c85284..ae4dab93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.14 (Jul 31, 2013) + +Allow all Handsontable options introduced in few recent versions, e.g. `fragmentSelection` (see [Options](https://github.com/warpech/jquery-handsontable/wiki/Options)) + ## 0.3.13 (Jul 29, 2013) Other: diff --git a/bower.json b/bower.json index 8613eaa1..ca5ab46f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ng-datagrid", - "version": "0.3.13", + "version": "0.3.14", "devDependencies": { "handsontable": "~0.9.11" }, diff --git a/dist/angular-ui-handsontable.full.css b/dist/angular-ui-handsontable.full.css index 3052e493..e13edd71 100644 --- a/dist/angular-ui-handsontable.full.css +++ b/dist/angular-ui-handsontable.full.css @@ -1,7 +1,7 @@ /** - * angular-ui-handsontable 0.3.13 + * angular-ui-handsontable 0.3.14 * - * Date: Mon Jul 29 2013 09:04:01 GMT+0200 (Central European Daylight Time) + * Date: Wed Jul 31 2013 09:26:22 GMT+0200 (Central European Daylight Time) */ /** diff --git a/dist/angular-ui-handsontable.full.js b/dist/angular-ui-handsontable.full.js index a667febb..330a722c 100644 --- a/dist/angular-ui-handsontable.full.js +++ b/dist/angular-ui-handsontable.full.js @@ -1,7 +1,7 @@ /** - * angular-ui-handsontable 0.3.13 + * angular-ui-handsontable 0.3.14 * - * Date: Mon Jul 29 2013 09:04:01 GMT+0200 (Central European Daylight Time) + * Date: Wed Jul 31 2013 09:26:22 GMT+0200 (Central European Daylight Time) */ /** @@ -57,7 +57,7 @@ angular.module('uiHandsontable', []) }) .directive('uiHandsontable', function ($compile, $rootScope, getHandsontableSettings) { - var htOptions = ['data', 'width', 'height', 'rowHeaders', 'colHeaders', 'colWidths', 'columns', 'cells', 'dataSchema', 'contextMenu', 'onSelection', 'onSelectionByProp', 'onBeforeChange', 'onChange', 'onCopyLimit', 'startRows', 'startCols', 'minRows', 'minCols', 'maxRows', 'maxCols', 'minSpareRows', 'minSpareCols', 'multiSelect', 'fillHandle', 'undo', 'outsideClickDeselects', 'enterBeginsEditing', 'enterMoves', 'tabMoves', 'autoWrapRow', 'autoWrapCol', 'copyRowsLimit', 'copyColsLimit', 'currentRowClassName', 'currentColClassName', 'asyncRendering', 'stretchH', 'columnSorting', 'manualColumnMove', 'manualColumnResize']; + var htOptions = ["data", "width", "height", "startRows", "startCols", "minRows", "minCols", "maxRows", "maxCols", "minSpareRows", "minSpareCols", "multiSelect", "fillHandle", "fixedRowsTop", "fixedColumnsLeft", "undo", "outsideClickDeselects", "enterBeginsEditing", "enterMoves", "tabMoves", "autoWrapRow", "autoWrapCol", "copyRowsLimit", "copyColsLimit", "pasteMode", "currentRowClassName", "currentColClassName", "stretchH", "isEmptyRow", "isEmptyCol", "observeDOMVisibility", "allowInvalid", "invalidCellClassName", "fragmentSelection", "readOnly"]; var scopeDef = { selectedIndex: '=selectedindex' diff --git a/dist/angular-ui-handsontable.full.min.css b/dist/angular-ui-handsontable.full.min.css index 0ca9667e..2e09e25a 100644 --- a/dist/angular-ui-handsontable.full.min.css +++ b/dist/angular-ui-handsontable.full.min.css @@ -1,7 +1,7 @@ /** - * angular-ui-handsontable 0.3.13 + * angular-ui-handsontable 0.3.14 * - * Date: Mon Jul 29 2013 09:04:18 GMT+0200 (Central European Daylight Time) + * Date: Wed Jul 31 2013 09:26:38 GMT+0200 (Central European Daylight Time) */ diff --git a/dist/angular-ui-handsontable.full.min.js b/dist/angular-ui-handsontable.full.min.js index dd8ed043..80425d81 100644 --- a/dist/angular-ui-handsontable.full.min.js +++ b/dist/angular-ui-handsontable.full.min.js @@ -1,12 +1,12 @@ /** - * angular-ui-handsontable 0.3.13 + * angular-ui-handsontable 0.3.14 * - * Date: Mon Jul 29 2013 09:04:01 GMT+0200 (Central European Daylight Time) + * Date: Wed Jul 31 2013 09:26:22 GMT+0200 (Central European Daylight Time) */ -document.all&&!document.addEventListener&&(document.createElement("ui-handsontable"),document.createElement("datacolumn"),document.createElement("optionlist")),angular.module("uiHandsontable",[]).factory("getHandsontableSettings",function(){return function(t){var e=t.data("uiDatagrid");return e||(e={settings:{columns:[],colHeaders:!0,outsideClickDeselects:!0,autoComplete:[]},$container:$('
')},t.data("uiDatagrid",e)),e}}).factory("getDatacolumnSettings",function(){return function(t){var e=t.data("uiDatagridDatacolumn");return e||(e={},t.data("uiDatagridDatacolumn",e)),e}}).directive("uiHandsontable",function(t,e,n){for(var i=["data","width","height","rowHeaders","colHeaders","colWidths","columns","cells","dataSchema","contextMenu","onSelection","onSelectionByProp","onBeforeChange","onChange","onCopyLimit","startRows","startCols","minRows","minCols","maxRows","maxCols","minSpareRows","minSpareCols","multiSelect","fillHandle","undo","outsideClickDeselects","enterBeginsEditing","enterMoves","tabMoves","autoWrapRow","autoWrapCol","copyRowsLimit","copyColsLimit","currentRowClassName","currentColClassName","asyncRendering","stretchH","columnSorting","manualColumnMove","manualColumnResize"],o={selectedIndex:"=selectedindex"},s=0,r=i.length;r>s;s++)o[i[s]]="="+i[s].toLowerCase();var a={restrict:"EA",scope:o,priority:490,compile:function(o,s){var r,a,l,c=function(e,n,i){var o=n.optionList,s=o.match(/^\s*(.+)\s+in\s+(.*)\s*$/);if(!s)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+o+"'.");var r,a,l,c=s[1],u=s[2],h=e.$new();i.$container.on("blur","textarea",function(){l&&l()}),n.source=function(t,o){l&&l();var s=function(){var t=i.$container.data("handsontable"),n=t.getSelected()[0];return h[i.lhs]=e.$parent.$eval(i.rhs)[n],h.$eval(u)};r=s(),h.$$phase||h.$apply(),o(r),a.$apply(),l=e.$parent.$watch(s,function(e,i){e!==i&&setTimeout(function(){n.source(t,o)},0)}),n.saveOnBlur||(h.$eval(n.value+' = "'+$.trim(t).replace(/"/g,'"')+'"'),h.$apply())},n.sorter=function(t){return t},n.highlighter=function(e){var i,o=h.$new();return o[c]=e,a=o,n.transclude?n.transclude(o,function(t){i=t[0]}):i=t(""+n.optionTemplate+"")(o),i},n.onSelect=function(t,e,i,o,s){h[c]=r[s],h.$eval(n.clickrow),h.$apply()}},u=s.datarows;if(u&&(r=u.match(/^\s*(.+)\s+in\s+(.*)\s*$/)),!r)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+u+"'.");return a=r[1],l=r[2],function(t,o,s){var r,u,h=n(o);h.lhs=a,h.rhs=l,h.settings=angular.extend(h.settings,t.$parent.$eval(s.uiHandsontable||s.settings));for(r in i)i.hasOwnProperty(r)&&t[i[r]]!==void 0&&(h.settings[i[r]]=t[i[r]]);$(o).append(h.$container);var d=t.$parent.$eval(l);if(d!==void 0&&(h.settings.data=d),h.settings.columns){var p=RegExp("^("+a+"\\.)");for(r=0,u=h.settings.columns.length;u>r;r++)h.settings.columns[r].data=h.settings.columns[r].value.replace(p,""),"autocomplete"===h.settings.columns[r].type&&c(t,h.settings.columns[r],h)}h.settings.afterChange=function(){e.$$phase||t.$apply()},h.settings.afterSelectionByProp=function(e,n,i,o){t.$emit("datagridSelection",h.$container,e,n,i,o)},h.$container.handsontable(h.settings);var f=0;for(t.$watch(function(){if(t.$parent.$eval(l)!==h.$container.handsontable("getData"))return!0;var e=h.$container.data("handsontable"),n=e.countRows();if(f!==n)return f=n;for(var i="",o=e.countCols(),s=e.rowOffset(),r=s+e.countVisibleRows();r>s;s++)for(var a=0;o>a;a++)i+=e.getDataAtCell(s,a);return i},function(e,n){1==e?h.$container.handsontable("loadData",t.$parent.$eval(l)):e!==n&&h.$container.handsontable("render")},!1),r=0,u=i.length;u>r;r++)(function(e){t.$watch(e,function(n,i){if(n!==i){if("columns"===e)for(var o=RegExp("^("+a+"\\.)"),s=0,r=n.length;r>s;s++)n[s].data=n[s].value.replace(o,""),"autocomplete"===n[s].type&&c(t,n[s],h);var l={};l[e]=n,h.$container.handsontable("updateSettings",l)}},!0)})(i[r])}}};return a}).directive("datacolumn",function(t,e){var n={restrict:"E",priority:500,compile:function(n,i){return function(n,o,s){var r,a=t(o.parent()),l=e(o),c=n.$parent.$eval(s.title),u=n.$parent.$eval(s.width),h=n.$parent.$eval(s.type),d=s.options,p=[];for(r in s)i.hasOwnProperty(r)&&p.push(r);l.value=s.value,l.source=null,l.saveOnBlur=-1!==$.inArray("saveonblur",p),l.strict=-1!==$.inArray("strict",p);var f=n.$new(),m=n.$parent.$eval(d)||{};switch(m.value=s.value,m.type=h,m.title=c,m.width=u,h){case"autocomplete":for(r in l)l.hasOwnProperty(r)&&(m[r]=l[r]);break;case"checkbox":s.checkedtemplate!==void 0&&(m.checkedTemplate=n.$parent.$eval(s.checkedtemplate)),s.uncheckedtemplate!==void 0&&(m.uncheckedTemplate=n.$parent.$eval(s.uncheckedtemplate))}s.readonly!==void 0&&(m.readOnly=!0);for(r in s)s.hasOwnProperty(r)&&"$"!==r.charAt(0)&&m[r]===void 0&&(m[r]=f.$eval(s[r]));a.settings.columns.push(m)}}};return n}).directive("optionlist",function(t){var e={restrict:"E",transclude:"element",priority:510,compile:function(e,n,i){return function(e,n,o){var s=t(n.parent());s.optionList=o.datarows,s.clickrow=o.clickrow,s.transclude=i}}};return e}).directive("selectedindex",function(t){var e={restrict:"A",priority:491,compile:function(){return function(e,n){var i,o,s,r=t(n).$container;t(n).settings.afterSelection=function(t,n){i=!0,o=t,s=n,e.$$phase||void 0===e.selectedIndex||e.selectedIndex==t||e.$apply(function(){e.selectedIndex=t})},t(n).settings.afterDeselect=function(){i=!1,o=null,e.$$phase||void 0===e.selectedIndex||null==e.selectedIndex||e.$apply(function(){e.selectedIndex=null})},e.$watch("selectedIndex",function(t){var e=parseInt(t,10);if(t!==void 0&&null!==t&&e!==o){var n=s||0;r.handsontable("selectCell",e,n,e,n,!0)}},!1)}}};return e}),Array.prototype.filter||(Array.prototype.filter=function(t,e){"use strict";if(this===void 0||null===this)throw new TypeError;if("function"!=typeof t)throw new TypeError;e=e||this;var n,i,o=this.length,s=[];for(n=0;o>n;n+=1)this.hasOwnProperty(n)&&(i=this[n],t.call(e,i,n,this)&&s.push(i));return s});var Handsontable={extension:{},helper:{}};(function(t,e,n){"use strict";function i(t){this.instance=t,this.createElements(),this.bindEvents()}function o(t){this.instance=t,this.createElements(),this.bindEvents(),this.emptyStringLabel="   "}function s(t,e,i,o){n.helper.stringify(t.getDataAtRowProp(e,i))===n.helper.stringify(o.checkedTemplate)?t.setDataAtRowProp(e,i,o.uncheckedTemplate):t.setDataAtRowProp(e,i,o.checkedTemplate)}function r(e){if(!t.datepicker)throw Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?");this.isCellEdited=!1,this.instance=e,this.createElements(),this.bindEvents()}function a(t){this.instance=t,this.createElements(),this.bindEvents()}function l(){var t,e=this,i=5;this.beforeInit=function(){this.autoColumnWidths=[],this.autoColumnSizeTmp={thead:null,theadTh:null,theadStyle:null,tbody:null,tbodyTd:null,noRenderer:null,noRendererTd:null,renderer:null,rendererTd:null,container:null,containerStyle:null}},this.determineColumnWidth=function(e){var o,s=t.autoColumnSizeTmp;s.container||(o=document,s.thead=o.createElement("table"),s.thead.appendChild(o.createElement("thead")).appendChild(o.createElement("tr")).appendChild(o.createElement("th")),s.theadTh=s.thead.getElementsByTagName("th")[0],s.thead.className="htTable",s.theadStyle=s.thead.style,s.theadStyle.tableLayout="auto",s.theadStyle.width="auto",s.tbody=s.thead.cloneNode(!1),s.tbody.appendChild(o.createElement("tbody")).appendChild(o.createElement("tr")).appendChild(o.createElement("td")),s.tbodyTd=s.tbody.getElementsByTagName("td")[0],s.noRenderer=s.tbody.cloneNode(!0),s.noRendererTd=s.noRenderer.getElementsByTagName("td")[0],s.renderer=s.tbody.cloneNode(!0),s.rendererTd=s.renderer.getElementsByTagName("td")[0],s.container=o.createElement("div"),s.container.className=t.rootElement[0].className+" hidden",s.containerStyle=s.container.style,s.container.appendChild(s.thead),s.container.appendChild(s.tbody),s.container.appendChild(s.noRenderer),s.container.appendChild(s.renderer),t.rootElement[0].parentNode.appendChild(s.container)),s.container.className=t.rootElement[0].className+" hidden";var r=t.$table[0].className;s.thead.className=r,s.tbody.className=r;for(var a=t.countRows(),l={},c=0,u=0;a>u;u++){var h=n.helper.stringify(t.getDataAtCell(u,e)),d=h.length;d>c&&(c=d),l[d]||(l[d]={needed:i,strings:[]}),l[d].needed&&(l[d].strings.push(h),l[d].needed--)}var p=t.getSettings();p.colHeaders&&t.view.appendColHeader(e,s.theadTh);var f="";for(var m in l)if(l.hasOwnProperty(m))for(var g=0,w=l[m].strings.length;w>g;g++)f+=l[m].strings[g]+"
";s.tbodyTd.innerHTML=f,t.view.wt.wtDom.empty(s.rendererTd),t.view.wt.wtDom.empty(s.noRendererTd),s.containerStyle.display="block";var v=t.view.wt.wtDom.outerWidth(s.container),y=t.getCellMeta(0,e);if(y.renderer){var b=9999999999;s.noRendererTd.appendChild(document.createTextNode(b));var C=n.helper.getCellMethod("renderer",y.renderer);C(t,s.rendererTd,0,e,t.colToProp(e),b,y),v+=t.view.wt.wtDom.outerWidth(s.renderer)-t.view.wt.wtDom.outerWidth(s.noRenderer)}var S=t.view.wt.wtViewport.getViewportWidth()-2;return v>S&&(v=S),s.containerStyle.display="none",v},this.determineColumnsWidth=function(){t=this;var n=this.getSettings();if(n.autoColumnSize||!n.colWidths)for(var i=this.countCols(),o=0;i>o;o++)t._getColWidthFromSettings(o)||(this.autoColumnWidths[o]=e.determineColumnWidth(o))},this.getColWidth=function(t,e){this.autoColumnWidths[t]&&this.autoColumnWidths[t]>e.width&&(e.width=this.autoColumnWidths[t])},this.afterDestroy=function(){t=this,t.autoColumnSizeTmp.container&&t.autoColumnSizeTmp.container.parentNode.removeChild(t.autoColumnSizeTmp.container)}}function c(){function t(t){return function(e,n){return e[1]===n[1]?0:null===e[1]?1:null===n[1]?-1:e[1]n[1]?t?1:-1:0}}function e(t){return function(e,n){if(e[1]===n[1])return 0;if(null===e[1])return 1;if(null===n[1])return-1;var i=new Date(e[1]),o=new Date(n[1]);return o>i?t?-1:1:i>o?t?1:-1:0}}var n,i=this;this.init=function(t){var e,o,a=this,l=a.getSettings().columnSorting;if(n=Boolean(l)){a.sortIndex=[];var c=s.call(a);c!==void 0?(e=c.sortColumn,o=c.sortOrder):(e=l.column,o=l.sortOrder),i.sortByColumn.call(a,e,o),"afterInit"==t&&r.call(a)}},this.setSortingColumn=function(t,e){var n=this;return t===void 0?(delete n.sortColumn,delete n.sortOrder,void 0):(n.sortOrder=n.sortColumn===t&&e===void 0?!n.sortOrder:e!==void 0?e:!0,n.sortColumn=t,void 0)},this.sortByColumn=function(t,e){var n=this;i.setSortingColumn.call(n,t,e),i.sort.call(n),n.render(),o.call(n),n.PluginHooks.run("afterSorting")};var o=function(){var t=this,e={};t.sortColumn!==void 0&&(e.sortColumn=t.sortColumn),t.sortOrder!==void 0&&(e.sortOrder=t.sortOrder),(e.hasOwnProperty("sortColumn")||e.hasOwnProperty("sortOrder"))&&t.PluginHooks.run("persistentStateSave","columnSorting",e)},s=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","columnSorting",e),e.value},r=function(){function t(){var t=n.view.TBODY.querySelector("tr").querySelectorAll("th");return t.length}function e(e){var i=n.view.wt.wtDom.closest(e,"TH");return n.view.wt.wtDom.index(i)-t()}var n=this;n.rootElement.on("click.handsontable",".columnSorting",function(t){if(n.view.wt.wtDom.hasClass(t.target,"columnSorting")){var o=e(t.target);i.sortByColumn.call(n,o)}})};this.sort=function(){var i=this;if(void 0!==i.sortOrder){n=!1,i.sortIndex.length=0;for(var o=this.colOffset(),s=0,r=this.countRows()-i.getSettings().minSpareRows;r>s;s++)this.sortIndex.push([s,i.getDataAtCell(s,this.sortColumn+o)]);var a,l=i.getCellMeta(0,i.sortColumn);switch(l.type){case"date":a=e;break;default:a=t}this.sortIndex.sort(a(i.sortOrder));for(var s=this.sortIndex.length;i.countRows()>s;s++)this.sortIndex.push([s,i.getDataAtCell(s,this.sortColumn+o)]);n=!0}},this.translateRow=function(t){return n&&this.sortIndex&&this.sortIndex.length?this.sortIndex[t][0]:t},this.onBeforeGetSet=function(t){var e=this;t.row=i.translateRow.call(e,t.row)},this.untranslateRow=function(t){if(n&&this.sortIndex&&this.sortIndex.length)for(var e=0;this.sortIndex.length>e;e++)if(this.sortIndex[e][0]==t)return e},this.getColHeader=function(t,e){this.getSettings().columnSorting&&this.view.wt.wtDom.addClass(e.querySelector(".colHeader"),"columnSorting")},this.afterChangeSort=function(t){var e=this,n=!1,o={};if(t){for(var s=0;t.length>s;s++)if(t[s][1]==e.sortColumn){n=!0,o.row=i.translateRow.call(e,t[s][0]),o.col=t[s][1];break}n&&setTimeout(function(){i.sort.call(e),e.render(),e.selectCell(i.untranslateRow.call(e,o.row),o.col)},0)}}}function u(){function e(t){var e=s.getSelected();if(e)switch(t){case"row_above":s.alter("insert_row",e[0]);break;case"row_below":s.alter("insert_row",e[2]+1);break;case"col_left":s.alter("insert_col",e[1]);break;case"col_right":s.alter("insert_col",e[3]+1);break;case"remove_row":s.alter(t,e[0],e[2]-e[0]+1);break;case"remove_col":s.alter(t,e[1],e[3]-e[1]+1);break;case"undo":s.undo();break;case"redo":s.redo()}}function n(t){return s.countRows()>=s.getSettings().maxRows&&("row_above"===t||"row_below"===t)?!0:s.countCols()>=s.getSettings().maxCols&&("col_left"===t||"col_right"===t)?!0:!1}var i,o,s=this,r=s.rootElement[0].id,a={row_above:{name:"Insert row above",disabled:n},row_below:{name:"Insert row below",disabled:n},hsep1:"---------",col_left:{name:"Insert column on the left",disabled:n},col_right:{name:"Insert column on the right",disabled:n},hsep2:"---------",remove_row:{name:"Remove row",disabled:n},remove_col:{name:"Remove column",disabled:n},hsep3:"---------",undo:{name:"Undo",disabled:function(){return!s.isUndoAvailable()}},redo:{name:"Redo",disabled:function(){return!s.isRedoAvailable()}}},l={selector:"#"+r+" table, #"+r+" div",trigger:"right",callback:e},c={},u=s.getSettings();if(u.contextMenu){if(u.contextMenu===!0)c.items=a;else if("[object Array]"===Object.prototype.toString.apply(u.contextMenu))for(c.items={},i=0,o=u.contextMenu.length;o>i;i++){var h=u.contextMenu[i];if(a[h]===void 0)throw Error('Context menu key "'+h+'" is not recognised');c.items[h]=a[h]}else if("[object Object]"===Object.prototype.toString.apply(u.contextMenu)){if(c=u.contextMenu,c.items)for(i in c.items)c.items.hasOwnProperty(i)&&a[i]&&(c.items[i]="string"==typeof c.items[i]?a[i]:t.extend(!0,a[i],c.items[i]));else c.items=a;if(c.callback){var d=l.callback,p=c.callback;c.callback=function(t,e){d(t,e),p(t,e)}}}if(!r)throw Error("Handsontable container must have an id");t.contextMenu(t.extend(!0,l,c))}}function h(){var e=this.rootElement[0].id;t.contextMenu("destroy","#"+e+" table, #"+e+" div")}function d(){var e,n,i,o,s,r,a=document.createElement("DIV"),l=a.style;a.className="ghost",l.position="absolute",l.top="25px",l.left=0,l.width="10px",l.height="10px",l.backgroundColor="#CCC",l.opacity=.7,t(document).mousemove(function(t){n&&(l.left=r+t.pageX-s+6+"px","none"===l.display&&(l.display="block"))}),t(document).mouseup(function(){n&&(o>i&&o--,e.getSettings().rowHeaders&&(i--,o--),e.manualColumnPositions.splice(o,0,e.manualColumnPositions.splice(i,1)[0]),t(".manualColumnMover.active").removeClass("active"),n=!1,e.forceFullRender=!0,e.view.render(),l.display="none",c.call(e),e.PluginHooks.run("afterColumnMove",i,o))});var c=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnPositions",t.manualColumnPositions)},u=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnPositions",e),e.value},h=function(){var t=this;this.rootElement.on("mousedown.handsontable",".manualColumnMover",function(o){e=t;var c=o.currentTarget,u=e.view.wt.wtDom.closest(c,"TH");i=e.view.wt.wtDom.index(u),n=!0,s=o.pageX;var h=e.$table[0];h.parentNode.appendChild(a),l.width=e.view.wt.wtDom.outerWidth(u)+"px",l.height=e.view.wt.wtDom.outerHeight(h)+"px",r=parseInt(e.view.wt.wtDom.offset(u).left-e.view.wt.wtDom.offset(h).left,10),l.left=r+6+"px"}),this.rootElement.on("mouseenter.handsontable","td, th",function(){if(n){var t=e.view.THEAD.querySelector(".manualColumnMover.active");t&&e.view.wt.wtDom.removeClass(t,"active"),o=e.view.wt.wtDom.index(this);var i=e.view.THEAD.querySelectorAll("th"),s=i[o].querySelector(".manualColumnMover");e.view.wt.wtDom.addClass(s,"active")}})};this.beforeInit=function(){this.manualColumnPositions=[]},this.init=function(t){var e=this,n=Boolean(this.getSettings().manualColumnMove);if(n){var i=this.getSettings().manualColumnMove,o=u.call(e);this.manualColumnPositions=o!==void 0?o:i instanceof Array?i:[],e.forceFullRender=!0,"afterInit"==t&&(h.call(this),this.manualColumnPositions.length>0&&(this.forceFullRender=!0,this.render()))}else this.manualColumnPositions=[]},this.modifyCol=function(t){return this.getSettings().manualColumnMove?(this.manualColumnPositions[t]===void 0&&(this.manualColumnPositions[t]=t),this.manualColumnPositions[t]):t},this.getColHeader=function(t,e){if(this.getSettings().manualColumnMove){var n=document.createElement("DIV");n.className="manualColumnMover",e.firstChild.appendChild(n)}}}function p(){function e(t){c=this,s=t;var e=this.view.wt.wtTable.getCoords(t)[1];if(e>=0){r=e;var i=this.view.wt.wtDom.offset(this.rootElement[0]).left,o=this.view.wt.wtDom.offset(t).left;p=o-i-6,m.style.left=p+n.call(c,t)+"px",this.rootElement[0].appendChild(m)}}function n(t){var e=this,n=e.view.wt.wtDom.offset(t).left-e.view.wt.wtDom.offset(t).left,i=e.view.wt.wtDom.offset(e.rootElement[0]).left,o=e.view.wt.wtTable.getCoords(t)[1],s=e.getColWidth(o),r=e.view.maximumVisibleElementWidth(n-i);return Math.min(s,r)}function i(){d=n.call(this,s),this.view.wt.wtDom.addClass(m,"active"),v.height=this.view.wt.wtDom.outerHeight(this.$table[0])+"px",o=!0}var o,s,r,a,l,c,u,h,d,p,f=0,m=document.createElement("DIV"),g=document.createElement("DIV"),w=document.createElement("DIV"),v=w.style;m.className="manualColumnResizer",g.className="manualColumnResizerHandle",m.appendChild(g),w.className="manualColumnResizerLine",m.appendChild(w);var y=t(document);y.mousemove(function(t){o&&(a=d+(t.pageX-h),u=T(r,a),m.style.left=p+a+"px")}),y.mouseup(function(){o&&(c.view.wt.wtDom.removeClass(m,"active"),o=!1,c.forceFullRender=!0,c.view.render(),b.call(c),c.PluginHooks.run("afterColumnResize",r,u),e.call(c,s))});var b=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnWidths",t.manualColumnWidths)},C=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnWidths",e),e.value},S=function(){var t=this;this.rootElement.on("mouseenter.handsontable","th",function(n){o||e.call(t,n.currentTarget)}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(){null==l&&(l=setTimeout(function(){f>=2&&(T(r,W.determineColumnWidth.call(t,r)),t.forceFullRender=!0,t.view.render(),t.PluginHooks.run("afterColumnResize",r,u)),f=0,l=null},500)),f++}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(e){h=e.pageX,i.call(t)})};this.beforeInit=function(){this.manualColumnWidths=[]},this.init=function(t){var e=this,n=Boolean(this.getSettings().manualColumnResize);if(n){var i=this.getSettings().manualColumnResize,o=C.call(e);this.manualColumnWidths=o!==void 0?o:i instanceof Array?i:[],"afterInit"==t&&(S.call(this),e.forceFullRender=!0,e.render())}};var T=function(t,e){return e=Math.max(e,20),t=c.PluginHooks.execute("modifyCol",t),c.manualColumnWidths[t]=e,e};this.getColWidth=function(t,e){this.getSettings().manualColumnResize&&this.manualColumnWidths[t]&&(e.width=this.manualColumnWidths[t])}}function f(){function t(e,n){for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];o instanceof Object&&(Object.unobserve(o,e),o.____Path=n.____Path+"/"+i,t(e,o))}}function n(t,e){delete e.____Path,Object.observe(e,t);for(var i=0,o=e.length;o>i;i++){var s=e[i];s instanceof Object&&n(t,s)}}function i(i,r){var h=[],d=i;if(Object.observe)var p=function(e){if(!d.___Path){Object.unobserve(d,p),d.____Path="",t(p,d);for(var i=0,o=e.length;o>m;m++){var s=e[i];"____Path"!=s.name&&l[s.type].call(s,h,s.object.____Path)}n(p,d)}r&&r.call(h)};else{p={};for(var f,m=0,g=c.length;g>m;m++)if(c[m].obj===i){f=c[m];break}if(f||(f={obj:i},c.push(f)),f.value=a(i),r){u.push(r);var w,v=[100],y=0,b=function(){var t=s(p);t.length>0&&(p.patches=[],r.call(null,t))},C=function(){clearTimeout(w),w=setTimeout(function(){b(),y=0,w=setTimeout(S,v[y++])},0)},S=function(){b(),y==v.length&&(y=v.length-1),w=setTimeout(S,v[y++])};e.addEventListener?(e.addEventListener("mousedown",C),e.addEventListener("mouseup",C),e.addEventListener("keydown",C)):(e.attachEvent("onmousedown",C),e.attachEvent("onmouseup",C),e.attachEvent("onkeydown",C)),w=setTimeout(S,v[y++])}}return p.patches=h,p.object=i,o(p,i,h)}function o(t,e,n){Object.observe&&Object.observe(e,t);for(var i in e)if(e.hasOwnProperty(i)){var s=e[i];s&&"object"==typeof s&&o(t,s,n)}return t}function s(t){if(Object.observe)Object.deliverChangeRecords(t);else{for(var e,n=0,i=c.length;i>n;n++)if(c[n].obj===t.object){e=c[n];break}r(e.value,t.object,t.patches,"")}return t.patches}function r(t,e,n,i){var o,s=[],a=[];for(o in e)e.hasOwnProperty(o)&&s.push(o);for(o in t)t.hasOwnProperty(o)&&a.push(o);var l,c=!1,u=!1;for(l=0;a.length>l;l++){o=a[l];var h=t[o];if(e.hasOwnProperty(o)){var d=e[o];h instanceof Object?r(h,d,n,i+"/"+o):h!=d&&(c=!0,n.push({op:"replace",path:i+"/"+o,value:d}),t[o]=d)}else n.push({op:"remove",path:i+"/"+o}),u=!0}if(u||s.length!=a.length)for(l=0;s.length>l;l++)o=s[l],t.hasOwnProperty(o)||n.push({op:"add",path:i+"/"+o,value:e[o]})}function a(t){if(null===t||!(t instanceof Object))return t;var e,n=t.constructor;e=new n;for(var i in t)t.hasOwnProperty(i)&&(e[i]=a(t[i]));return e}var l={"new":function(t,e){var n={op:"add",path:e+"/"+this.name,value:this.object[this.name]};t.push(n)},deleted:function(t,e){var n={op:"remove",path:e+"/"+this.name};t.push(n)},updated:function(t,e){var n={op:"replace",path:e+"/"+this.name,value:this.object[this.name]};t.push(n)}},c=[],u=[];this.afterLoadData=function(){if(!this.observer&&this.getSettings().observeChanges){var t=this;this.observer=i(this.getData(),function(){t.render()})}}}function m(t){var n,i=function(){e.localStorage[t+"__"+"persistentStateKeys"]=JSON.stringify(n)},o=function(){var i=e.localStorage[t+"__"+"persistentStateKeys"],o="string"==typeof i?JSON.parse(i):void 0;n=o?o:[]},s=function(){n=[],i()};o(),this.saveValue=function(o,s){e.localStorage[t+"_"+o]=JSON.stringify(s),-1==n.indexOf(o)&&(n.push(o),i())},this.loadValue=function(n,i){n=n!==void 0?n:i;var o=e.localStorage[t+"_"+n];return o===void 0?void 0:JSON.parse(o)},this.reset=function(n){e.localStorage.removeItem(t+"_"+n)},this.resetAll=function(){for(var i=0;n.length>i;i++)e.localStorage.removeItem(t+"_"+n[i]);s()}}function g(){var t,e,n=this;this.copyCallbacks=[],this.cutCallbacks=[],this.pasteCallbacks=[];var i=document.documentElement;e=document.body,document.getElementById("CopyPasteDiv")?(this.elDiv=document.getElementById("CopyPasteDiv"),this.elTextarea=this.elDiv.firstChild):(this.elDiv=document.createElement("DIV"),this.elDiv.id="CopyPasteDiv",t=this.elDiv.style,t.position="fixed",t.top=0,t.left=0,e.appendChild(this.elDiv),this.elTextarea=document.createElement("TEXTAREA"),this.elTextarea.className="copyPaste",t=this.elTextarea.style,t.width="1px",t.height="1px",this.elDiv.appendChild(this.elTextarea),t.opacity!==void 0&&(t.opacity=0)),this._bindEvent(i,"keydown",function(t){var e=!1;if(t.metaKey?e=!0:t.ctrlKey&&-1===navigator.userAgent.indexOf("Mac")&&(e=!0),e){if(document.activeElement!==n.elTextarea&&(""!=n.getSelectionText()||-1!=["INPUT","SELECT","TEXTAREA"].indexOf(document.activeElement.nodeName)))return;n.selectNodeText(n.elTextarea),setTimeout(function(){n.selectNodeText(n.elTextarea)},0)}!e||67!==t.keyCode&&86!==t.keyCode&&88!==t.keyCode||(88===t.keyCode?setTimeout(function(){n.triggerCut(t)},0):86===t.keyCode&&setTimeout(function(){n.triggerPaste(t)},0))})}function w(e,n){var i;this.instance=e,this.settings=n,this.wtDom=this.instance.wtDom,this.main=document.createElement("div"),i=this.main.style,i.position="absolute",i.top=0,i.left=0;for(var o=0;5>o;o++){var s=document.createElement("DIV");s.className="wtBorder "+(n.className||""),i=s.style,i.backgroundColor=n.border.color,i.height=n.border.width+"px",i.width=n.border.width+"px",this.main.appendChild(s)}this.top=this.main.childNodes[0],this.left=this.main.childNodes[1],this.bottom=this.main.childNodes[2],this.right=this.main.childNodes[3],this.topStyle=this.top.style,this.leftStyle=this.left.style,this.bottomStyle=this.bottom.style,this.rightStyle=this.right.style,this.corner=this.main.childNodes[4],this.corner.className+=" corner",this.cornerStyle=this.corner.style,this.cornerStyle.width="5px",this.cornerStyle.height="5px",this.cornerStyle.border="2px solid #FFF",this.disappear(),e.wtTable.bordersHolder||(e.wtTable.bordersHolder=document.createElement("div"),e.wtTable.bordersHolder.className="htBorders",e.wtTable.hider.appendChild(e.wtTable.bordersHolder)),e.wtTable.bordersHolder.appendChild(this.main);var r=!1,a=t(document.body);a.on("mousedown.walkontable."+e.guid,function(){r=!0}),a.on("mouseup.walkontable."+e.guid,function(){r=!1}),t(this.main.childNodes).on("mouseenter",function(n){if(r&&e.getSetting("hideBorderOnMouseDownOver")){n.preventDefault(),n.stopImmediatePropagation();var i=this.getBoundingClientRect(),o=t(this);o.hide();var s=function(t){return t.clientYMath.ceil(i.top+i.height)?!0:t.clientXMath.ceil(i.left+i.width)?!0:void 0};a.on("mousemove.border."+e.guid,function(t){s(t)&&(a.off("mousemove.border."+e.guid),o.show())})}})}function v(){this.offset=0,this.total=0,this.fixedCount=0}function y(){}function b(){this.cache=[]}function C(){this.countTH=0}function S(t,e,n){var i,o=0;for(this.containerSizeFn=t,this.cellSizesSum=0,this.cellSizes=[],this.cellStretch=[],this.cellCount=0,this.remainingSize=0,this.strategy=n;;){if(i=e(o),void 0===i)break;if(this.cellSizesSum>=this.getContainerSize(this.cellSizesSum+i))break;this.cellSizes.push(i),this.cellSizesSum+=i,this.cellCount++,o++}var s=this.getContainerSize(this.cellSizesSum);this.remainingSize=this.cellSizesSum-s}function T(t){var i=this,o=[];if(this.guid="wt_"+(e.Handsontable?n.helper.randomString():""),this.wtSettings=new O(this,t),this.wtDom=new x,this.wtTable=new $(this),this.wtScroll=new D(this),this.wtScrollbars=new A(this),this.wtViewport=new I(this),this.wtWheel=new V(this),this.wtEvent=new E(this),this.wtTable.THEAD.childNodes.length&&this.wtTable.THEAD.childNodes[0].childNodes.length){for(var s=0,r=this.wtTable.THEAD.childNodes[0].childNodes.length;r>s;s++)o.push(this.wtTable.THEAD.childNodes[0].childNodes[s].innerHTML);this.getSetting("columnHeaders").length||this.update("columnHeaders",[function(t,e){i.wtDom.fastInnerText(e,o[t])}])}this.selections={};var a=this.getSetting("selections");if(a)for(var l in a)a.hasOwnProperty(l)&&(this.selections[l]=new M(this,a[l]));this.drawn=!1,this.drawInterrupted=!1}function x(){}function E(e){var n=this;this.instance=e,this.wtDom=this.instance.wtDom;var i=[null,null,null,null];this.instance.dblClickTimeout=null;var o,s=function(t){var e=n.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?n.instance.hasSetting("onCellMouseDown")&&n.instance.getSetting("onCellMouseDown",t,e.coords,e.TD):n.wtDom.hasClass(t.target,"corner")&&n.instance.getSetting("onCellCornerMouseDown",t,t.target),2!==t.button&&(e.TD&&"TD"===e.TD.nodeName?(i.shift(),i.push(e.TD)):n.wtDom.hasClass(t.target,"corner")&&(i.shift(),i.push(t.target)))},r=function(t){if(n.instance.hasSetting("onCellMouseOver")){var e=n.instance.wtTable.TABLE,i=n.wtDom.closest(t.target,["TD","TH"],e);i&&i!==o&&n.wtDom.isChildOf(i,e)&&(o=i,"TD"===i.nodeName&&n.instance.getSetting("onCellMouseOver",t,n.instance.wtTable.getCoords(i),i))}},a=function(t){if(2!==t.button){var e=n.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?(i.shift(),i.push(e.TD)):(i.shift(),i.push(t.target)),null!==i[3]&&i[3]===i[2]&&(n.instance.dblClickTimeout&&i[2]===i[1]&&i[1]===i[0]?(e.TD?n.instance.getSetting("onCellDblClick",t,e.coords,e.TD):n.wtDom.hasClass(t.target,"corner")&&n.instance.getSetting("onCellCornerDblClick",t,e.coords,e.TD),clearTimeout(n.instance.dblClickTimeout),n.instance.dblClickTimeout=null):(clearTimeout(n.instance.dblClickTimeout),n.instance.dblClickTimeout=setTimeout(function(){n.instance.dblClickTimeout=null},500)))}};t(this.instance.wtTable.parent).on("mousedown",s),t(this.instance.wtTable.TABLE).on("mouseover",r),t(this.instance.wtTable.parent).on("mouseup",a)}function k(){}function R(t,e){this.containerSizeFn=t,this.sizeAtIndex=e,this.cellSizesSum=0,this.cellSizes=[],this.cellCount=0,this.remainingSize=-1/0}function D(t){this.instance=t}function P(){}function H(){this.lastWindowScrollPosition=0/0}function A(t){switch(t.getSetting("scrollbarModelV")){case"dragdealer":this.vertical=new K(t);break;case"native":this.vertical=new q(t)}switch(t.getSetting("scrollbarModelH")){case"dragdealer":this.horizontal=new U(t);break;case"native":this.horizontal=new Q(t)}}function M(t,e){this.instance=t,this.settings=e,this.selected=[],e.border&&(this.border=new w(t,e))}function O(t,e){var n=this;this.instance=t,this.defaults={table:void 0,scrollH:"auto",scrollV:"auto",scrollbarModelH:"dragdealer",scrollbarModelV:"dragdealer",stretchH:"hybrid",currentRowClassName:null,currentColumnClassName:null,data:void 0,offsetRow:0,offsetColumn:0,fixedColumnsLeft:0,fixedRowsTop:0,rowHeaders:function(){return[]},columnHeaders:function(){return[]},totalRows:void 0,totalColumns:void 0,width:null,height:null,cellRenderer:function(t,e,i){var o=n.getSetting("data",t,e);n.instance.wtDom.fastInnerText(i,void 0===o||null===o?"":o)},columnWidth:50,selections:null,hideBorderOnMouseDownOver:!1,onCellMouseDown:null,onCellMouseOver:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,beforeDraw:null,onDraw:null,scrollbarWidth:10,scrollbarHeight:10},this.settings={};for(var i in this.defaults)if(this.defaults.hasOwnProperty(i))if(void 0!==e[i])this.settings[i]=e[i];else{if(void 0===this.defaults[i])throw Error('A required setting "'+i+'" was not provided');this.settings[i]=this.defaults[i]}}function $(t){this.instance=t,this.TABLE=this.instance.getSetting("table"),this.wtDom=this.instance.wtDom,this.wtDom.removeTextNodes(this.TABLE);var e=this.TABLE.parentNode;if(!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var n=document.createElement("DIV");n.className="wtSpreader",e&&e.insertBefore(n,this.TABLE),n.appendChild(this.TABLE)}if(this.spreader=this.TABLE.parentNode,e=this.spreader.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var i=document.createElement("DIV");i.className="wtHider",e&&e.insertBefore(i,this.spreader),i.appendChild(this.spreader)}if(this.hider=this.spreader.parentNode,this.hiderStyle=this.hider.style,this.hiderStyle.position="relative",e=this.hider.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var o=document.createElement("DIV");o.style.position="relative",o.className="wtHolder",e&&e.insertBefore(o,this.hider),o.appendChild(this.hider)}if(this.parent=this.hider.parentNode,this.TBODY=this.TABLE.getElementsByTagName("TBODY")[0],this.TBODY||(this.TBODY=document.createElement("TBODY"),this.TABLE.appendChild(this.TBODY)),this.THEAD=this.TABLE.getElementsByTagName("THEAD")[0],this.THEAD||(this.THEAD=document.createElement("THEAD"),this.TABLE.insertBefore(this.THEAD,this.TBODY)),this.COLGROUP=this.TABLE.getElementsByTagName("COLGROUP")[0],this.COLGROUP||(this.COLGROUP=document.createElement("COLGROUP"),this.TABLE.insertBefore(this.COLGROUP,this.THEAD)),this.instance.getSetting("columnHeaders").length&&!this.THEAD.childNodes.length){var s=document.createElement("TR");this.THEAD.appendChild(s)}this.colgroupChildrenLength=this.COLGROUP.childNodes.length,this.theadChildrenLength=this.THEAD.firstChild?this.THEAD.firstChild.childNodes.length:0,this.tbodyChildrenLength=this.TBODY.childNodes.length,this.oldCellCache=new b,this.currentCellCache=new b,this.rowFilter=new k,this.columnFilter=new C,this.verticalRenderReverse=!1 -}function I(t){this.instance=t,this.resetSettings()}function V(e){"native"!==e.getSetting("scrollbarModelV")&&"native"!==e.getSetting("scrollbarModelH")&&t(e.wtTable.TABLE).on("mousewheel",function(t,n,i,o){i||o||!n||(o=n),(i||o)&&(o>0&&0===e.getSetting("offsetRow")||0>o&&e.wtTable.isLastRowFullyVisible()||0>i&&0===e.getSetting("offsetColumn")||i>0&&e.wtTable.isLastColumnFullyVisible()||(clearTimeout(e.wheelTimeout),e.wheelTimeout=setTimeout(function(){o?e.wtScrollbars.vertical.visible&&e.scrollVertical(-Math.ceil(o)).draw():i&&e.wtScrollbars.horizontal.visible&&e.scrollHorizontal(Math.ceil(i)).draw()},0),t.preventDefault()))})}n.activeGuid=null,n.Core=function(i,o){function s(){var t=!1;return{validatorsInQueue:0,addValidatorToQueue:function(){this.validatorsInQueue++,t=!1},removeValidatorFormQueue:function(){this.validatorsInQueue=0>this.validatorsInQueue-1?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty:function(){},checkIfQueueIsEmpty:function(){0==this.validatorsInQueue&&0==t&&(t=!0,this.onQueueEmpty())}}}function r(e,n,i){function o(){var o;e.length&&(o=m.PluginHooks.execute("beforeChange",e,n),"function"==typeof o?t.when(result).then(function(){i()}):o===!1&&e.splice(0,e.length)),"function"!=typeof o&&i()}var r=new s;r.onQueueEmpty=o;for(var a=e.length-1;a>=0;a--)if(null===e[a])e.splice(a,1);else{var l=m.getCellMeta(e[a][0],u.propToCol(e[a][1]));"number"===l.dataType&&"string"==typeof e[a][3]&&e[a][3].length>0&&/^-?[\d\s]*\.?\d*$/.test(e[a][3])&&(e[a][3]=numeral().unformat(e[a][3]||"0")),l.validator&&(r.addValidatorToQueue(),m.validateCell(e[a][3],l,function(t,n){return function(i){if("boolean"!=typeof i)throw Error("Validation error: result is not boolean");i===!1&&n.allowInvalid===!1&&(e.splice(t,1),--t),r.removeValidatorFormQueue()}}(a,l),n))}r.checkIfQueueIsEmpty()}function a(t,e){var n=t.length-1;if(!(0>n)){for(;n>=0;n--)if(null!==t[n]){if(c.settings.minSpareRows)for(;t[n][0]>m.countRows()-1;)u.createRow();if("array"===c.dataType&&c.settings.minSpareCols)for(;u.propToCol(t[n][1])>m.countCols()-1;)u.createCol();u.set(t[n][0],t[n][1],t[n][3])}else t.splice(n,1);m.forceFullRender=!0,h.adjustRowsAndCols(),d.refreshBorders(null,!0),m.PluginHooks.run("afterChange",t,e||"edit")}}function l(e,n,i){return"object"==typeof e?e:t.isPlainObject(i)?i:[[e,n,i]]}var c,u,h,d,p,f,m=this,g=function(){};n.helper.inherit(g,N),n.helper.extend(g.prototype,o),this.rootElement=i;var w=t(document.documentElement),v=t(document.body);this.guid="ht_"+n.helper.randomString(),this.rootElement[0].id||(this.rootElement[0].id=this.guid),c={cellSettings:[],columnSettings:[],columnsSettingConflicts:["data","width"],settings:new g,settingsFromDOM:{},selStart:new n.SelectionPoint,selEnd:new n.SelectionPoint,editProxy:!1,isPopulated:null,scrollable:null,undoRedo:null,extensions:{},colToProp:null,propToCol:null,dataSchema:null,dataType:"array",firstRun:!0},u={recursiveDuckSchema:function(e){var n;if(t.isPlainObject(e)){n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t.isPlainObject(e[i])?u.recursiveDuckSchema(e[i]):null)}else n=[];return n},recursiveDuckColumns:function(e,n,i){var o,s;if(n===void 0&&(n=0,i=""),t.isPlainObject(e))for(s in e)e.hasOwnProperty(s)&&(null===e[s]?(o=i+s,c.colToProp.push(o),c.propToCol[o]=n,n++):n=u.recursiveDuckColumns(e[s],n,s+"."));return n},createMap:function(){if(u.getSchema()===void 0)throw Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");var t,e,n=u.getSchema();if(c.colToProp=[],c.propToCol={},c.settings.columns)for(t=0,e=c.settings.columns.length;e>t;t++)c.colToProp[t]=c.settings.columns[t].data,c.propToCol[c.settings.columns[t].data]=t;else u.recursiveDuckColumns(n)},colToProp:function(t){return t=n.PluginHooks.execute(m,"modifyCol",t),c.colToProp&&c.colToProp[t]!==void 0?c.colToProp[t]:t},propToCol:function(t){var e;return e=c.propToCol[t]!==void 0?c.propToCol[t]:t,e=n.PluginHooks.execute(m,"modifyCol",e)},getSchema:function(){return c.settings.dataSchema?"function"==typeof c.settings.dataSchema?c.settings.dataSchema():c.settings.dataSchema:c.duckDataSchema},createRow:function(e){var n,i=m.countRows();if(("number"!=typeof e||e>=i)&&(e=i),"array"===c.dataType){n=[];for(var o=0,s=m.countCols();s>o;o++)n.push(null)}else n="function"===c.dataType?c.settings.dataSchema(e):t.extend(!0,{},u.getSchema());e===i?g.prototype.data.push(n):g.prototype.data.splice(e,0,n),m.PluginHooks.run("afterCreateRow",e),m.forceFullRender=!0},createCol:function(t){if("object"===c.dataType||c.settings.columns)throw Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting");var e=0,i=m.countRows(),o=g.prototype.data,s=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell);if("number"!=typeof t||t>=m.countCols()){for(;i>e;e++)o[e]===void 0&&(o[e]=[]),o[e].push(null);c.columnSettings.push(s)}else{for(;i>e;e++)o[e].splice(t,0,null);c.columnSettings.splice(t,0,s)}m.PluginHooks.run("afterCreateCol",t),m.forceFullRender=!0},removeRow:function(t,e){e||(e=1),"number"!=typeof t&&(t=-e);var n=this.physicalRowsToLogical(t,e);g.prototype.data=g.prototype.data.filter(function(t,e){return-1==n.indexOf(e)}),m.PluginHooks.run("afterRemoveRow",t,e),m.forceFullRender=!0},removeCol:function(t,e){if("object"===c.dataType||c.settings.columns)throw Error("cannot remove column with object data source or columns option specified");e||(e=1),"number"!=typeof t&&(t=-e);for(var n=g.prototype.data,i=0,o=m.countRows();o>i;i++)n[i].splice(t,e);m.PluginHooks.run("afterRemoveCol",t,e),c.columnSettings.splice(t,e),m.forceFullRender=!0},spliceCol:function(t,e,i){var o=arguments.length>=4?[].slice.call(arguments,3):[],s=m.getDataAtCol(t),r=s.slice(e,e+i),a=s.slice(e+i);n.helper.extendArray(o,a);for(var l=0;i>l;)o.push(null),l++;return n.helper.to2dArray(o),m.populateFromArray(e,t,o,null,null,"spliceCol"),r},spliceRow:function(t,e,i){var o=arguments.length>=4?[].slice.call(arguments,3):[],s=m.getDataAtRow(t),r=s.slice(e,e+i),a=s.slice(e+i);n.helper.extendArray(o,a);for(var l=0;i>l;)o.push(null),l++;return m.populateFromArray(t,e,[o],null,null,"spliceRow"),r},getVars:{},get:function(t,e){if(u.getVars.row=t,u.getVars.prop=e,m.PluginHooks.run("beforeGet",u.getVars),"string"==typeof u.getVars.prop&&u.getVars.prop.indexOf(".")>-1){var n=u.getVars.prop.split("."),i=c.settings.data[u.getVars.row];if(!i)return null;for(var o=0,s=n.length;s>o;o++)if(i=i[n[o]],i===void 0)return null;return i}return"function"==typeof u.getVars.prop?u.getVars.prop(c.settings.data.slice(u.getVars.row,u.getVars.row+1)[0]):c.settings.data[u.getVars.row]?c.settings.data[u.getVars.row][u.getVars.prop]:null},setVars:{},set:function(t,e,n,i){if(u.setVars.row=t,u.setVars.prop=e,u.setVars.value=n,m.PluginHooks.run("beforeSet",u.setVars,i||"datamapGet"),"string"==typeof u.setVars.prop&&u.setVars.prop.indexOf(".")>-1){for(var o=u.setVars.prop.split("."),s=c.settings.data[u.setVars.row],r=0,a=o.length-1;a>r;r++)s=s[o[r]];s[o[r]]=u.setVars.value}else"function"==typeof u.setVars.prop?u.setVars.prop(c.settings.data.slice(u.setVars.row,u.setVars.row+1)[0],u.setVars.value):c.settings.data[u.setVars.row][u.setVars.prop]=u.setVars.value},physicalRowsToLogical:function(t,e){for(var n=(g.prototype.data.length+t)%g.prototype.data.length,i=[],o=e;g.prototype.data.length>n&&o;)this.get(n,0),i.push(this.getVars.row),o--,n++;return i},clear:function(){for(var t=0;m.countRows()>t;t++)for(var e=0;m.countCols()>e;e++)u.set(t,u.colToProp(e),"")},getAll:function(){return c.settings.data},getRange:function(t,e){var n,i,o,s,r,a=[];for(i=Math.max(t.row,e.row),s=Math.max(t.col,e.col),n=Math.min(t.row,e.row);i>=n;n++){for(r=[],o=Math.min(t.col,e.col);s>=o;o++)r.push(u.get(n,u.colToProp(o)));a.push(r)}return a},getText:function(t,e){return SheetClip.stringify(u.getRange(t,e))}},h={alter:function(e,n,i,o,s){var r,a,l,p,f,g,w,v;switch(r=t.extend(!0,[],u.getAll()),e){case"insert_row":for(i||(i=1),v=0;i>v&&m.countRows()=n?(c.selStart.row(c.selStart.row()+v),d.transformEnd(v,0)):d.refreshBorders());break;case"insert_col":for(i||(i=1),v=0;i>v&&m.countCols()=n?(c.selStart.col(c.selStart.col()+v),d.transformEnd(0,v)):d.refreshBorders());break;case"remove_row":u.removeRow(n,i),h.adjustRowsAndCols(),d.refreshBorders();break;case"remove_col":u.removeCol(n,i),h.adjustRowsAndCols(),d.refreshBorders();break;default:throw Error('There is no such action "'+e+'"')}for(l=[],a=u.getAll(),p=0,f=a.length;f>p;p++)for(g=0,w=a[p].length;w>g;g++)l.push([p,g,r[p]?r[p][g]:null,a[p][g]]);m.PluginHooks.run("afterChange",l,o||e),s||h.adjustRowsAndCols()},adjustRowsAndCols:function(){var t,e,n,i=m.countEmptyRows(!0);if(e=m.countRows(),c.settings.minRows>e)for(t=0;c.settings.minRows-e>t;t++)u.createRow();if(c.settings.minSpareRows>i)for(;c.settings.minSpareRows>i&&m.countRows()n)for(;c.settings.minSpareCols>n&&m.countCols()c.settings.minRows&&c.settings.minSpareRows&&i>c.settings.minSpareRows;i--)u.removeRow();if(c.settings.enterBeginsEditing&&!c.settings.columns)for(;(c.settings.minCols||c.settings.minSpareCols)&&m.countCols()>c.settings.minCols&&c.settings.minSpareCols&&n>c.settings.minSpareCols;n--)u.removeCol();var o=m.countRows(),s=m.countCols();if((0===o||0===s)&&d.deselect(),c.selStart.exists()){var r,a=c.selStart.row(),l=c.selStart.col(),h=c.selEnd.row(),p=c.selEnd.col();a>o-1?(a=o-1,r=!0,h>a&&(h=a)):h>o-1&&(h=o-1,r=!0,a>h&&(a=h)),l>s-1?(l=s-1,r=!0,p>l&&(p=l)):p>s-1&&(p=s-1,r=!0,l>p&&(l=p)),r&&m.selectCell(a,l,h,p)}},populateFromArray:function(t,e,i,o,s){var r,a,l,u,h=[],d={};if(a=e.length,0===a)return!1;var p,f,g,w;switch(s){case"shift_down":for(p=i?i.col-t.col+1:0,f=i?i.row-t.row+1:0,e=n.helper.translateRowsToColumns(e),l=0,u=e.length,g=Math.max(u,p);g>l;l++)if(u>l){for(r=0,a=e[l].length;f-a>r;r++)e[l].push(e[l][r%a]);e[l].unshift(t.col+l,t.row,0),m.spliceCol.apply(m,e[l])}else e[l%u][0]=t.col+l,m.spliceCol.apply(m,e[l%u]);break;case"shift_right":for(p=i?i.col-t.col+1:0,f=i?i.row-t.row+1:0,r=0,a=e.length,w=Math.max(a,f);w>r;r++)if(a>r){for(l=0,u=e[r].length;p-u>l;l++)e[r].push(e[r][l%u]);e[r].unshift(t.row+r,t.col,0),m.spliceRow.apply(m,e[r])}else e[r%a][0]=t.row+r,m.spliceRow.apply(m,e[r%a]);break;case"overwrite":default:for(d.row=t.row,d.col=t.col,r=0;a>r&&!(i&&d.row>i.row||!c.settings.minSpareRows&&d.row>m.countRows()-1||d.row>=c.settings.maxRows);r++){for(d.col=t.col,u=e[r]?e[r].length:0,l=0;u>l&&!(i&&d.col>i.col||!c.settings.minSpareCols&&d.col>m.countCols()-1||d.col>=c.settings.maxCols);l++)m.getCellMeta(d.row,d.col).readOnly||h.push([d.row,d.col,e[r][l]]),d.col++,i&&l===u-1&&(l=-1);d.row++,i&&r===a-1&&(r=-1)}m.setDataAtCell(h,null,null,o||"populateFromArray")}},getCornerCoords:function(e){function n(e,n,i){function o(t){return t[i]}return Array.prototype.map?e.apply(Math,n.map(o)):e.apply(Math,t.map(n,o))}return{TL:{row:n(Math.min,e,"row"),col:n(Math.min,e,"col")},BR:{row:n(Math.max,e,"row"),col:n(Math.max,e,"col")}}},getCellsAtCoords:function(t,e){var n,i,o=h.getCornerCoords([t,e]),s=[];for(n=o.TL.row;o.BR.row>=n;n++)for(i=o.TL.col;o.BR.col>=i;i++)s.push(m.view.getCellAtCoords({row:n,col:i}));return s}},this.selection=d={inProgress:!1,begin:function(){m.selection.inProgress=!0},finish:function(){var t=m.getSelected();m.PluginHooks.run("afterSelectionEnd",t[0],t[1],t[2],t[3]),m.PluginHooks.run("afterSelectionEndByProp",t[0],m.colToProp(t[1]),t[2],m.colToProp(t[3])),m.selection.inProgress=!1},isInProgress:function(){return m.selection.inProgress},setRangeStart:function(t){c.selStart.coords(t),d.setRangeEnd(t)},setRangeEnd:function(t,e){m.selection.begin(),c.selEnd.coords(t),c.settings.multiSelect||c.selStart.coords(t),m.view.wt.selections.current.clear(),m.view.wt.selections.current.add(c.selStart.arr()),m.view.wt.selections.area.clear(),d.isMultiple()&&(m.view.wt.selections.area.add(c.selStart.arr()),m.view.wt.selections.area.add(c.selEnd.arr())),(c.settings.currentRowClassName||c.settings.currentColClassName)&&(m.view.wt.selections.highlight.clear(),m.view.wt.selections.highlight.add(c.selStart.arr()),m.view.wt.selections.highlight.add(c.selEnd.arr())),m.PluginHooks.run("afterSelection",c.selStart.row(),c.selStart.col(),c.selEnd.row(),c.selEnd.col()),m.PluginHooks.run("afterSelectionByProp",c.selStart.row(),u.colToProp(c.selStart.col()),c.selEnd.row(),u.colToProp(c.selEnd.col())),e!==!1&&m.view.scrollViewport(t),d.refreshBorders()},refreshBorders:function(t,e){e||p.destroy(t),m.view.render(),d.isSelected()&&!e&&p.prepare()},isMultiple:function(){return!(c.selEnd.col()===c.selStart.col()&&c.selEnd.row()===c.selStart.row())},transformStart:function(t,e,n){c.selStart.row()+t>m.countRows()-1?n&&c.settings.minSpareRows>0?m.alter("insert_row",m.countRows()):c.settings.autoWrapCol&&c.selStart.col()+ec.selStart.row()+t&&c.selStart.col()+e>=0&&(t=m.countRows()-1,e=-1),c.selStart.col()+e>m.countCols()-1?n&&c.settings.minSpareCols>0?m.alter("insert_col",m.countCols()):c.settings.autoWrapRow&&c.selStart.row()+tc.selStart.col()+e&&c.selStart.row()+t>=0&&(t=-1,e=m.countCols()-1);var i=m.countRows(),o=m.countCols(),s={row:c.selStart.row()+t,col:c.selStart.col()+e};0>s.row?s.row=0:s.row>0&&s.row>=i&&(s.row=i-1),0>s.col?s.col=0:s.col>0&&s.col>=o&&(s.col=o-1),d.setRangeStart(s)},transformEnd:function(t,e){if(c.selEnd.exists()){var n=m.countRows(),i=m.countCols(),o={row:c.selEnd.row()+t,col:c.selEnd.col()+e};0>o.row?o.row=0:o.row>0&&o.row>=n&&(o.row=n-1),0>o.col?o.col=0:o.col>0&&o.col>=i&&(o.col=i-1),d.setRangeEnd(o)}},isSelected:function(){return c.selEnd.exists()},inInSelection:function(t){if(!d.isSelected())return!1;var e=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]);return e.TL.row<=t.row&&e.BR.row>=t.row&&e.TL.col<=t.col&&e.BR.col>=t.col},deselect:function(){d.isSelected()&&(m.selection.inProgress=!1,c.selEnd=new n.SelectionPoint,m.view.wt.selections.current.clear(),m.view.wt.selections.area.clear(),p.destroy(),d.refreshBorders(),m.PluginHooks.run("afterDeselect"))},selectAll:function(){c.settings.multiSelect&&(d.setRangeStart({row:0,col:0}),d.setRangeEnd({row:m.countRows()-1,col:m.countCols()-1},!1))},empty:function(){if(d.isSelected()){var t,e,n=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]),i=[];for(t=n.TL.row;n.BR.row>=t;t++)for(e=n.TL.col;n.BR.col>=e;e++)m.getCellMeta(t,e).readOnly||i.push([t,e,""]);m.setDataAtCell(i)}}},this.autofill=f={handle:null,init:function(){f.handle?f.handle.disabled=!1:f.handle={}},disable:function(){f.handle.disabled=!0},selectAdjacent:function(){var t,e,n,i,o;t=d.isMultiple()?m.view.wt.selections.area.getCorners():m.view.wt.selections.current.getCorners(),e=u.getAll();t:for(n=t[2]+1;m.countRows()>n;n++){for(o=t[1];t[3]>=o;o++)if(e[n][o])break t;(e[n][t[1]-1]||e[n][t[3]+1])&&(i=n)}i&&(m.view.wt.selections.fill.clear(),m.view.wt.selections.fill.add([t[0],t[1]]),m.view.wt.selections.fill.add([i,t[3]]),f.apply())},apply:function(){var t,e,n,i,o;f.handle.isDragged=0,t=m.view.wt.selections.fill.getCorners(),t&&(m.view.wt.selections.fill.clear(),e=d.isMultiple()?m.view.wt.selections.area.getCorners():m.view.wt.selections.current.getCorners(),t[0]===e[0]&&t[1]e[3]?(n={row:t[0],col:e[3]+1},i={row:t[2],col:t[3]}):t[0]e[2]&&t[1]===e[1]&&(n={row:e[2]+1,col:t[1]},i={row:t[2],col:t[3]}),n&&(o=SheetClip.parse(u.getText(c.selStart.coords(),c.selEnd.coords())),m.PluginHooks.run("beforeAutofill",n,i,o),h.populateFromArray(n,o,i,"autofill"),d.setRangeStart({row:t[0],col:t[1]}),d.setRangeEnd({row:t[2],col:t[3]})))},showBorder:function(t){t.row=t[0],t.col=t[1];var e=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]);if("horizontal"!==c.settings.fillHandle&&(e.BR.rowt.row))t=[t.row,e.BR.col];else{if("vertical"===c.settings.fillHandle)return;t=[e.BR.row,t.col]}m.view.wt.selections.fill.clear(),m.view.wt.selections.fill.add([c.selStart.coords().row,c.selStart.coords().col]),m.view.wt.selections.fill.add([c.selEnd.coords().row,c.selEnd.coords().col]),m.view.wt.selections.fill.add(t),m.view.render()}},p={init:function(){function t(t){if(m.isListening()&&(c.settings.beforeOnKeyDown&&c.settings.beforeOnKeyDown.call(m,t),!Array.prototype.filter.call(document.body.querySelectorAll(".context-menu-list"),m.view.wt.wtDom.isVisible).length)){if(17===t.keyCode||224===t.keyCode||91===t.keyCode||93===t.keyCode)return p.setCopyableText(),void 0;if(c.lastKeyCode=t.keyCode,d.isSelected()){var e=(t.ctrlKey||t.metaKey)&&!t.altKey;if(n.helper.isPrintableChar(t.keyCode)&&e)return 65===t.keyCode?(d.selectAll(),p.setCopyableText(),t.preventDefault()):89===t.keyCode||t.shiftKey&&90===t.keyCode?c.undoRedo&&c.undoRedo.redo():90===t.keyCode&&c.undoRedo&&c.undoRedo.undo(),void 0;var i=t.shiftKey?d.setRangeEnd:d.setRangeStart;if(m.PluginHooks.run("beforeKeyDown",t),!t.isImmediatePropagationStopped())switch(t.keyCode){case 38:t.shiftKey?d.transformEnd(-1,0):d.transformStart(-1,0),t.preventDefault(),t.stopPropagation();break;case 9:var o="function"==typeof c.settings.tabMoves?c.settings.tabMoves(t):c.settings.tabMoves;t.shiftKey?d.transformStart(-o.row,-o.col):d.transformStart(o.row,o.col,!0),t.preventDefault(),t.stopPropagation();break;case 39:t.shiftKey?d.transformEnd(0,1):d.transformStart(0,1),t.preventDefault(),t.stopPropagation();break;case 37:t.shiftKey?d.transformEnd(0,-1):d.transformStart(0,-1),t.preventDefault(),t.stopPropagation();break;case 8:case 46:d.empty(t),t.preventDefault();break;case 40:t.shiftKey?d.transformEnd(1,0):d.transformStart(1,0),t.preventDefault(),t.stopPropagation();break;case 113:t.preventDefault();break;case 13:var s="function"==typeof c.settings.enterMoves?c.settings.enterMoves(t):c.settings.enterMoves;t.shiftKey?d.transformStart(-s.row,-s.col):d.transformStart(s.row,s.col,!0),t.preventDefault();break;case 36:t.ctrlKey||t.metaKey?i({row:0,col:c.selStart.col()}):i({row:c.selStart.row(),col:0}),t.preventDefault(),t.stopPropagation();break;case 35:t.ctrlKey||t.metaKey?i({row:m.countRows()-1,col:c.selStart.col()}):i({row:c.selStart.row(),col:m.countCols()-1}),t.preventDefault(),t.stopPropagation();break;case 33:d.transformStart(-m.countVisibleRows(),0),m.view.wt.scrollVertical(-m.countVisibleRows()),m.view.render(),t.preventDefault(),t.stopPropagation();break;case 34:d.transformStart(m.countVisibleRows(),0),m.view.wt.scrollVertical(m.countVisibleRows()),m.view.render(),t.preventDefault(),t.stopPropagation();break;default:}}}}c.onCut=function(){m.isListening()&&d.empty()},c.onPaste=function(t){if(m.isListening()){var e=t.replace(/^[\r\n]*/g,"").replace(/[\r\n]*$/g,""),n=SheetClip.parse(e),i=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]),o=i.TL,s={row:Math.max(i.BR.row,n.length-1+i.TL.row),col:Math.max(i.BR.col,n[0].length-1+i.TL.col)};m.PluginHooks.once("afterChange",function(t){t&&t.length&&m.selectCell(o.row,o.col,s.row,s.col)}),h.populateFromArray(o,n,s,"paste",c.settings.pasteMode)}},m.copyPaste=G.getInstance(),m.copyPaste.onCut(c.onCut),m.copyPaste.onPaste(c.onPaste),w.on("keydown.handsontable."+m.guid,t)},destroy:function(t){if("function"==typeof c.editorDestroyer){var e=c.editorDestroyer;c.editorDestroyer=null,e(t)}},setCopyableText:function(){var t=Math.min(c.selStart.row(),c.selEnd.row()),e=Math.min(c.selStart.col(),c.selEnd.col()),n=Math.max(c.selStart.row(),c.selEnd.row()),i=Math.max(c.selStart.col(),c.selEnd.col()),o=Math.min(n,t+c.settings.copyRowsLimit-1),s=Math.min(i,e+c.settings.copyColsLimit-1);m.copyPaste.copyable(u.getText({row:t,col:e},{row:o,col:s})),(n!==o||i!==s)&&m.PluginHooks.run("afterCopyLimit",n-t+1,i-e+1,c.settings.copyRowsLimit,c.settings.copyColsLimit)},prepare:function(){if(!m.getCellMeta(c.selStart.row(),c.selStart.col()).readOnly){var t=m.view.getCellAtCoords(c.selStart.coords());c.editorDestroyer=m.view.applyCellTypeMethod("editor",t,c.selStart.row(),c.selStart.col())}}},this.init=function(){m.PluginHooks.run("beforeInit"),p.init(),this.updateSettings(c.settings,!0),this.parseSettingsFromDOM(),this.view=new n.TableView(this),this.forceFullRender=!0,this.view.render(),"object"==typeof c.firstRun&&(m.PluginHooks.run("afterChange",c.firstRun[0],c.firstRun[1]),c.firstRun=!1),m.PluginHooks.run("afterInit")},this.validateCell=function(t,e,n,i){var o=e.validator;"[object RegExp]"===Object.prototype.toString.call(o)&&(o=function(t){return function(e,n){n(t.test(e))}}(o)),"function"==typeof o?(t=m.PluginHooks.execute("beforeValidate",t,e.row,e.prop,i),o.call(e,t,function(o){e.valid=o,o=m.PluginHooks.execute("afterValidate",o,t,e.row,e.prop,i),n(o)})):(e.valid=!0,n(!0))},this.setDataAtCell=function(t,e,n,i){var o,s,c,h=l(t,e,n),d=[];for(o=0,s=h.length;s>o;o++){if("object"!=typeof h[o])throw Error("Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter");if("number"!=typeof h[o][1])throw Error("Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`");c=u.colToProp(h[o][1]),d.push([h[o][0],c,u.get(h[o][0],c),h[o][2]])}i||"object"!=typeof t||(i=e),r(d,i,function(){a(d,i)})},this.setDataAtRowProp=function(t,e,n,i){var o,s,c=l(t,e,n),h=[];for(o=0,s=c.length;s>o;o++)h.push([c[o][0],c[o][1],u.get(c[o][0],c[o][1]),c[o][2]]);i||"object"!=typeof t||(i=e),r(h,i,function(){a(h,i)})},this.listen=function(){n.activeGuid=m.guid,document.activeElement&&document.activeElement!==document.body?document.activeElement.blur():document.activeElement||document.body.focus()},this.unlisten=function(){n.activeGuid=null},this.isListening=function(){return n.activeGuid===m.guid},this.destroyEditor=function(t){d.refreshBorders(t)},this.populateFromArray=function(t,e,n,i,o,s,r){if("object"!=typeof n)throw Error("populateFromArray parameter `input` must be an array");return h.populateFromArray({row:t,col:e},n,"number"==typeof i?{row:i,col:o}:null,s,r)},this.spliceCol=function(){return u.spliceCol.apply(null,arguments)},this.spliceRow=function(){return u.spliceRow.apply(null,arguments)},this.getCornerCoords=function(t){return h.getCornerCoords(t)},this.getSelected=function(){return d.isSelected()?[c.selStart.row(),c.selStart.col(),c.selEnd.row(),c.selEnd.col()]:void 0},this.parseSettingsFromDOM=function(){var t=this.rootElement.css("overflow");if("scroll"===t||"auto"===t?(this.rootElement[0].style.overflow="visible",c.settingsFromDOM.overflow=t):(void 0===c.settings.width||void 0===c.settings.height)&&(c.settingsFromDOM.overflow="auto"),c.settingsFromDOM.width=void 0===c.settings.width?this.rootElement.width():void 0,c.settingsFromDOM.height=void 0,void 0===c.settings.height&&("scroll"===c.settingsFromDOM.overflow||"auto"===c.settingsFromDOM.overflow)){var n=this.rootElement[0].cloneNode(!1),i=this.rootElement[0].parentNode;if(i){n.removeAttribute("id"),i.appendChild(n);var o=parseInt(e.getComputedStyle(n,null).getPropertyValue("height"),10);o>0&&(c.settingsFromDOM.height=o),i.removeChild(n)}}},this.render=function(){m.view&&(m.forceFullRender=!0,m.parseSettingsFromDOM(),d.refreshBorders(null,!0))},this.loadData=function(e){if(!e.push||!e.splice)throw Error("loadData only accepts array of objects or array of arrays ("+typeof e+" given)");c.isPopulated=!1,g.prototype.data=e,c.dataType=c.settings.dataSchema instanceof Array||e[0]instanceof Array?"array":t.isFunction(c.settings.dataSchema)?"function":"object",c.duckDataSchema=e[0]?u.recursiveDuckSchema(e[0]):{},u.createMap(),h.adjustRowsAndCols(),m.PluginHooks.run("afterLoadData"),c.firstRun?c.firstRun=[null,"loadData"]:(m.PluginHooks.run("afterChange",null,"loadData"),m.render()),c.isPopulated=!0,m.clearUndo()},this.getData=function(t,e,n,i){return t===void 0?u.getAll():u.getRange({row:t,col:e},{row:n,col:i})},this.updateSettings=function(t,e){var i,o,s,r,a;if(t.rows!==void 0)throw Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");if(t.cols!==void 0)throw Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");t.undo!==void 0&&(c.undoRedo&&t.undo===!1?c.undoRedo=null:c.undoRedo||t.undo!==!0||(c.undoRedo=new n.UndoRedo(m)));for(i in t)"data"!==i&&(void 0!==m.PluginHooks.hooks.persistent[i]||void 0!==m.PluginHooks.legacy[i]?m.PluginHooks.add(i,t[i]):(!e&&t.hasOwnProperty(i)&&(g.prototype[i]=t[i]),n.extension[i]&&(c.extensions[i]=new n.extension[i](m,t[i]))));if(void 0===t.data&&void 0===c.settings.data){var l,p=[];for(o=0,s=c.settings.startRows;s>o;o++){for(l=[],r=0,a=c.settings.startCols;a>r;r++)l.push(null);p.push(l)}m.loadData(p)}else void 0!==t.data?m.loadData(t.data):void 0!==t.columns&&u.createMap();if(a=m.countCols(),c.cellSettings.length=0,a>0){var w,v,y;for(i=0;a>i;i++)if(c.columnSettings[i]=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell),v=c.columnSettings[i].prototype,g.prototype.columns){y=g.prototype.columns[i];for(w in y)y.hasOwnProperty(w)&&(v[w]=y[w])}}t.fillHandle!==void 0&&(f.handle&&t.fillHandle===!1?f.disable():f.handle||t.fillHandle===!1||f.init()),e||m.PluginHooks.run("afterUpdateSettings"),h.adjustRowsAndCols(),m.view&&(m.forceFullRender=!0,d.refreshBorders(null,!0))},this.getSettings=function(){return c.settings},this.getSettingsFromDOM=function(){return c.settingsFromDOM},this.clear=function(){d.selectAll(),d.empty()},this.isUndoAvailable=function(){return c.undoRedo&&c.undoRedo.isUndoAvailable()},this.isRedoAvailable=function(){return c.undoRedo&&c.undoRedo.isRedoAvailable()},this.undo=function(){c.undoRedo&&c.undoRedo.undo()},this.redo=function(){c.undoRedo&&c.undoRedo.redo()},this.clearUndo=function(){c.undoRedo&&c.undoRedo.clear()},this.alter=function(t,e,n,i,o){h.alter(t,e,n,i,o)},this.getCell=function(t,e){return m.view.getCellAtCoords({row:t,col:e})},this.colToProp=function(t){return u.colToProp(t)},this.propToCol=function(t){return u.propToCol(t)},this.getDataAtCell=function(t,e){return u.get(t,u.colToProp(e))},this.getDataAtRowProp=function(t,e){return u.get(t,e)},this.getDataAtCol=function(t){return[].concat.apply([],u.getRange({row:0,col:t},{row:c.settings.data.length-1,col:t}))},this.getDataAtProp=function(t){return[].concat.apply([],u.getRange({row:0,col:u.propToCol(t)},{row:c.settings.data.length-1,col:u.propToCol(t)}))},this.getDataAtRow=function(t){return c.settings.data[t]},this.getCellMeta=function(t,e){var i,o,s,r=u.colToProp(e);if(e=n.PluginHooks.execute(m,"modifyCol",e),c.columnSettings[e]===void 0&&(c.columnSettings[e]=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell)),c.cellSettings[t]||(c.cellSettings[t]={}),c.cellSettings[t][e]||(c.cellSettings[t][e]=new c.columnSettings[e]),i=c.cellSettings[t][e],i.row=t,i.col=e,i.prop=r,i.instance=m,i.cells){var a,l=i.cells.call(i,t,e,r)||{};for(a in l)l.hasOwnProperty(a)&&(i[a]=l[a])}if(m.PluginHooks.run("beforeGetCellMeta",t,e,i),"string"==typeof i.type&&"text"!==i.type){if(o=n.cellTypes[i.type],void 0===o)throw Error('You declared cell type "'+i.type+'" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes')}else"object"==typeof i.type&&(o=i.type);if(o)for(s in o)o.hasOwnProperty(s)&&i[s]===n.cellTypes.text[s]&&(i[s]=o[s]);return m.PluginHooks.run("afterGetCellMeta",t,e,i),i},this.validateCells=function(t){var e=new s;e.onQueueEmpty=t;for(var n=m.countRows()-1;n>=0;){for(var i=m.countCols()-1;i>=0;)e.addValidatorToQueue(),m.validateCell(m.getDataAtCell(n,i),m.getCellMeta(n,i),function(){e.removeValidatorFormQueue()},"validateCells"),i--;n--}e.checkIfQueueIsEmpty()},this.getRowHeader=function(t){if(void 0===t){for(var e=[],n=0,i=m.countRows();i>n;n++)e.push(m.getRowHeader(n));return e}return"[object Array]"===Object.prototype.toString.call(c.settings.rowHeaders)&&void 0!==c.settings.rowHeaders[t]?c.settings.rowHeaders[t]:"function"==typeof c.settings.rowHeaders?c.settings.rowHeaders(t):c.settings.rowHeaders&&"string"!=typeof c.settings.rowHeaders&&"number"!=typeof c.settings.rowHeaders?t+1:c.settings.rowHeaders},this.getColHeader=function(t){if(void 0===t){for(var e=[],i=0,o=m.countCols();o>i;i++)e.push(m.getColHeader(i));return e}return t=n.PluginHooks.execute(m,"modifyCol",t),c.settings.columns&&c.settings.columns[t]&&c.settings.columns[t].title?c.settings.columns[t].title:"[object Array]"===Object.prototype.toString.call(c.settings.colHeaders)&&void 0!==c.settings.colHeaders[t]?c.settings.colHeaders[t]:"function"==typeof c.settings.colHeaders?c.settings.colHeaders(t):c.settings.colHeaders&&"string"!=typeof c.settings.colHeaders&&"number"!=typeof c.settings.colHeaders?n.helper.spreadsheetColumnLabel(t):c.settings.colHeaders},this._getColWidthFromSettings=function(t){return c.settings.columns&&c.settings.columns[t]&&c.settings.columns[t].width?c.settings.columns[t].width:"[object Array]"===Object.prototype.toString.call(c.settings.colWidths)&&void 0!==c.settings.colWidths[t]?c.settings.colWidths[t]:void 0},this.getColWidth=function(t){t=n.PluginHooks.execute(m,"modifyCol",t);var e={width:m._getColWidthFromSettings(t)};return e.width||(e.width=50),m.PluginHooks.run("afterGetColWidth",t,e),e.width},this.countRows=function(){return c.settings.data.length},this.countCols=function(){return"object"===c.dataType||"function"===c.dataType?c.settings.columns&&c.settings.columns.length?c.settings.columns.length:c.colToProp.length:"array"===c.dataType?c.settings.columns&&c.settings.columns.length?c.settings.columns.length:c.settings.data&&c.settings.data[0]&&c.settings.data[0].length?c.settings.data[0].length:0:void 0},this.rowOffset=function(){return m.view.wt.getSetting("offsetRow")},this.colOffset=function(){return m.view.wt.getSetting("offsetColumn")},this.countVisibleRows=function(){return m.view.wt.drawn?m.view.wt.wtTable.rowStrategy.countVisible():-1},this.countVisibleCols=function(){return m.view.wt.drawn?m.view.wt.wtTable.columnStrategy.countVisible():-1},this.countEmptyRows=function(t){for(var e=m.countRows()-1,n=0;e>=0;){if(u.get(e,0),m.isEmptyRow(u.getVars.row))n++;else if(t)break;e--}return n},this.countEmptyCols=function(t){if(1>m.countRows())return 0;for(var e=m.countCols()-1,n=0;e>=0;){if(m.isEmptyCol(e))n++;else if(t)break;e--}return n},this.isEmptyRow=function(t){if(c.settings.isEmptyRow)return c.settings.isEmptyRow.call(m,t);for(var e,n=0,i=m.countCols();i>n;n++)if(e=m.getDataAtCell(t,n),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.isEmptyCol=function(t){if(c.settings.isEmptyCol)return c.settings.isEmptyCol.call(m,t);for(var e,n=0,i=m.countRows();i>n;n++)if(e=m.getDataAtCell(n,t),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.selectCell=function(t,e,n,i,o){if("number"!=typeof t||0>t||t>=m.countRows())return!1;if("number"!=typeof e||0>e||e>=m.countCols())return!1;if(n!==void 0){if("number"!=typeof n||0>n||n>=m.countRows())return!1;if("number"!=typeof i||0>i||i>=m.countCols())return!1}return c.selStart.coords({row:t,col:e}),document.activeElement&&document.activeElement!==document.documentElement&&document.activeElement!==document.body&&document.activeElement.blur(),m.listen(),n===void 0?d.setRangeEnd({row:t,col:e},o):d.setRangeEnd({row:n,col:i},o),m.selection.finish(),!0},this.selectCellByProp=function(){return arguments[1]=u.propToCol(arguments[1]),arguments[3]!==void 0&&(arguments[3]=u.propToCol(arguments[3])),m.selectCell.apply(m,arguments) -},this.deselectCell=function(){d.deselect()},this.destroy=function(){m.clearTimeouts(),m.view&&m.view.wt.destroy(),m.rootElement.empty(),m.rootElement.removeData("handsontable"),m.rootElement.off(".handsontable"),t(e).off("."+m.guid),w.off("."+m.guid),v.off("."+m.guid),m.copyPaste.removeCallback(c.onCut),m.copyPaste.removeCallback(c.onPaste),m.PluginHooks.run("afterDestroy")},this.getInstance=function(){return m.rootElement.data("handsontable")},function(){m.PluginHooks=new n.PluginHookClass;var t=m.PluginHooks.run,e=m.PluginHooks.execute;m.PluginHooks.run=function(e,i,o,s,r,a){t.call(this,m,e,i,o,s,r,a),n.PluginHooks.run(m,e,i,o,s,r,a)},m.PluginHooks.execute=function(t,i,o,s,r,a){var l=n.PluginHooks.execute(m,t,i,o,s,r,a),c=e.call(this,m,t,l,o,s,r,a);return c===void 0?l:c},m.addHook=function(){m.PluginHooks.add.apply(m.PluginHooks,arguments)},m.addHookOnce=function(){m.PluginHooks.once.apply(m.PluginHooks,arguments)},m.removeHook=function(){m.PluginHooks.remove.apply(m.PluginHooks,arguments)},m.runHooks=function(){m.PluginHooks.run.apply(m.PluginHooks,arguments)},m.runHooksAndReturn=function(){return m.PluginHooks.execute.apply(m.PluginHooks,arguments)}}(),this.timeouts={},this.registerTimeout=function(t,e,n){clearTimeout(this.timeouts[t]),this.timeouts[t]=setTimeout(e,n||0)},this.clearTimeouts=function(){for(var t in this.timeouts)this.timeouts.hasOwnProperty(t)&&clearTimeout(this.timeouts[t])},this.version="0.9.11"};var N=function(){};N.prototype={data:void 0,width:void 0,height:void 0,startRows:5,startCols:5,minRows:0,minCols:0,maxRows:1/0,maxCols:1/0,minSpareRows:0,minSpareCols:0,multiSelect:!0,fillHandle:!0,fixedRowsTop:0,fixedColumnsLeft:0,undo:!0,outsideClickDeselects:!0,enterBeginsEditing:!0,enterMoves:{row:1,col:0},tabMoves:{row:0,col:1},autoWrapRow:!1,autoWrapCol:!1,copyRowsLimit:1e3,copyColsLimit:1e3,pasteMode:"overwrite",currentRowClassName:void 0,currentColClassName:void 0,stretchH:"hybrid",isEmptyRow:void 0,isEmptyCol:void 0,observeDOMVisibility:!0,allowInvalid:!0,invalidCellClassName:"htInvalid",fragmentSelection:!1,readOnly:!1},t.fn.handsontable=function(t){var e,i,o,s,r,a=this.first(),l=a.data("handsontable");if("string"!=typeof t)return r=t||{},l?l.updateSettings(r):(l=new n.Core(a,r),a.data("handsontable",l),l.init()),a;if(o=[],arguments.length>1)for(e=1,i=arguments.length;i>e;e++)o.push(arguments[e]);if(l){if(void 0===l[t])throw Error("Handsontable do not provide action: "+t);s=l[t].apply(l,o)}return s},n.TableView=function(i){var o=this,s=t(e),r=t(document.documentElement);this.instance=i,this.settings=i.getSettings(),this.settingsFromDOM=i.getSettingsFromDOM(),i.rootElement.data("originalStyle",i.rootElement.attr("style")),i.rootElement.addClass("handsontable");var a=document.createElement("TABLE");a.className="htCore",this.THEAD=document.createElement("THEAD"),a.appendChild(this.THEAD),this.TBODY=document.createElement("TBODY"),a.appendChild(this.TBODY),i.$table=t(a),i.rootElement.prepend(i.$table),i.rootElement.on("mousedown.handsontable",function(t){o.isTextSelectionAllowed(t.target)||(t.preventDefault(),u())}),r.on("keyup."+i.guid,function(t){i.selection.isInProgress()&&!t.shiftKey&&i.selection.finish()});var l,c;r.on("mouseup."+i.guid,function(t){i.selection.isInProgress()&&1===t.which&&i.selection.finish(),l=!1,clearInterval(c),c=null,i.autofill.handle&&i.autofill.handle.isDragged&&(i.autofill.handle.isDragged>1&&i.autofill.apply(),i.autofill.handle.isDragged=0),n.helper.isOutsideInput(document.activeElement)&&i.unlisten()}),r.on("mousedown."+i.guid,function(e){var n=e.target;if(n!==o.wt.wtTable.spreader)for(;n!==document.documentElement;){if(null===n)return;if(n===i.rootElement[0]||"X-HANDSONTABLE"===n.nodeName||"context-menu-layer"===n.id||t(n).is(".context-menu-list")||t(n).is(".typeahead li"))return;n=n.parentNode}o.settings.outsideClickDeselects?i.deselectCell():i.destroyEditor()}),i.$table.on("selectstart",function(t){o.settings.fragmentSelection||t.preventDefault()}),i.$table.on("mouseenter",function(){c&&(clearInterval(c),c=null)}),i.$table.on("mouseleave",function(t){if(l||i.autofill.handle&&i.autofill.handle.isDragged){var e,n,s=1,r=o.wt.wtDom.offset(a),u=r.top+s,h=r.left+s,d=o.containerWidth-o.wt.getSetting("scrollbarWidth")-2*s,p=o.containerHeight-o.wt.getSetting("scrollbarHeight")-2*s,f=0,m=0;u>t.pageY?(f=-1,e="scrollVertical"):t.pageY>=u+p?(f=1,e="scrollVertical"):h>t.pageX?(m=-1,e="scrollHorizontal"):t.pageX>=h+d&&(m=1,e="scrollHorizontal"),e&&(n=function(){(l||i.autofill.handle&&i.autofill.handle.isDragged)&&o.wt[e](f+m).draw()},n(),c=setInterval(n,100))}});var u=function(){e.getSelection?e.getSelection().empty?e.getSelection().empty():e.getSelection().removeAllRanges&&e.getSelection().removeAllRanges():document.selection&&document.selection.empty()},h={table:a,stretchH:this.settings.stretchH,data:i.getDataAtCell,totalRows:i.countRows,totalColumns:i.countCols,scrollbarModelV:this.settings.scrollbarModelV,scrollbarModelH:this.settings.scrollbarModelH,offsetRow:0,offsetColumn:0,width:this.getWidth(),height:this.getHeight(),fixedColumnsLeft:function(){return o.settings.fixedColumnsLeft},fixedRowsTop:function(){return o.settings.fixedRowsTop},rowHeaders:function(){return o.settings.rowHeaders?[function(t,e){o.appendRowHeader(t,e)}]:[]},columnHeaders:function(){return o.settings.colHeaders?[function(t,e){o.appendColHeader(t,e)}]:[]},columnWidth:i.getColWidth,cellRenderer:function(t,e,n){o.applyCellTypeMethod("renderer",n,t,e)},selections:{current:{className:"current",border:{width:2,color:"#5292F7",style:"solid",cornerVisible:function(){return o.settings.fillHandle&&!o.isCellEdited()&&!i.selection.isMultiple()}}},area:{className:"area",border:{width:1,color:"#89AFF9",style:"solid",cornerVisible:function(){return o.settings.fillHandle&&!o.isCellEdited()&&i.selection.isMultiple()}}},highlight:{highlightRowClassName:o.settings.currentRowClassName,highlightColumnClassName:o.settings.currentColClassName},fill:{className:"fill",border:{width:1,color:"red",style:"solid"}}},hideBorderOnMouseDownOver:function(){return o.settings.fragmentSelection},onCellMouseDown:function(t,e,n){i.listen(),l=!0;var s={row:e[0],col:e[1]};2===t.button&&i.selection.inInSelection(s)||(t.shiftKey?i.selection.setRangeEnd(s):i.selection.setRangeStart(s)),o.settings.afterOnCellMouseDown&&o.settings.afterOnCellMouseDown.call(i,t,e,n)},onCellMouseOver:function(t,e){var n={row:e[0],col:e[1]};l?i.selection.setRangeEnd(n):i.autofill.handle&&i.autofill.handle.isDragged&&(i.autofill.handle.isDragged++,i.autofill.showBorder(e))},onCellCornerMouseDown:function(t){i.autofill.handle.isDragged=1,t.preventDefault()},onCellCornerDblClick:function(){i.autofill.selectAdjacent()},beforeDraw:function(t){o.beforeRender(t)}};i.PluginHooks.run("beforeInitWalkontable",h),this.wt=new T(h),s.on("resize."+i.guid,function(){i.registerTimeout("resizeTimeout",function(){i.parseSettingsFromDOM();var t=o.getWidth(),e=o.getHeight();(h.width!==t||h.height!==e)&&(i.forceFullRender=!0,o.render(),h.width=t,h.height=e)},60)}),t(o.wt.wtTable.spreader).on("mousedown.handsontable, contextmenu.handsontable",function(t){t.target===o.wt.wtTable.spreader&&3===t.which&&t.stopPropagation()}),r.on("click."+i.guid,function(){o.settings.observeDOMVisibility&&o.wt.drawInterrupted&&(o.instance.forceFullRender=!0,o.render())})},n.TableView.prototype.isTextSelectionAllowed=function(t){return"TEXTAREA"===t.nodeName?!0:this.settings.fragmentSelection&&this.wt.wtDom.isChildOf(t,this.TBODY)?!0:!1},n.TableView.prototype.isCellEdited=function(){return document.activeElement!==document.body},n.TableView.prototype.getWidth=function(){var t=void 0!==this.settings.width?this.settings.width:this.settingsFromDOM.width;return"function"==typeof t?t():t},n.TableView.prototype.getHeight=function(){var t=void 0!==this.settings.height?this.settings.height:this.settingsFromDOM.height;return"function"==typeof t?t():t},n.TableView.prototype.beforeRender=function(t){t&&(this.instance.PluginHooks.run("beforeRender"),this.wt.update("width",this.getWidth()),this.wt.update("height",this.getHeight()))},n.TableView.prototype.render=function(){this.wt.draw(!this.instance.forceFullRender),this.instance.rootElement.triggerHandler("render.handsontable"),this.instance.forceFullRender&&this.instance.PluginHooks.run("afterRender"),this.instance.forceFullRender=!1},n.TableView.prototype.applyCellTypeMethod=function(t,e,i,o){var s=this.instance.colToProp(o),r=this.instance.getCellMeta(i,o),a=n.helper.getCellMethod(t,r[t]);return a(this.instance,e,i,o,s,this.instance.getDataAtRowProp(i,s),r)},n.TableView.prototype.getCellAtCoords=function(t){var e=this.wt.wtTable.getCell([t.row,t.col]);return 0>e?null:e},n.TableView.prototype.scrollViewport=function(t){this.wt.scrollViewport([t.row,t.col])},n.TableView.prototype.appendRowHeader=function(t,e){t>-1?this.wt.wtDom.fastInnerHTML(e,this.instance.getRowHeader(t)):this.wt.wtDom.empty(e)},n.TableView.prototype.appendColHeader=function(t,e){var n=document.createElement("DIV"),i=document.createElement("SPAN");for(n.className="relative",i.className="colHeader",this.wt.wtDom.fastInnerHTML(i,this.instance.getColHeader(t)),n.appendChild(i);e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),this.instance.PluginHooks.run("afterGetColHeader",t,e)},n.TableView.prototype.maximumVisibleElementWidth=function(t){var e=this.wt.wtViewport.getWorkspaceWidth();return e-t},n.TableView.prototype.maximumVisibleElementHeight=function(t){var e=this.wt.wtViewport.getWorkspaceHeight();return e-t},n.helper.isPrintableChar=function(t){return 32==t||t>=48&&57>=t||t>=96&&111>=t||t>=186&&192>=t||t>=219&&222>=t||t>=226||t>=65&&90>=t},n.helper.stringify=function(t){switch(typeof t){case"string":case"number":return t+"";case"object":return null===t?"":""+t;case"undefined":return"";default:return""+t}},n.helper.spreadsheetColumnLabel=function(t){for(var e,n=t+1,i="";n>0;)e=(n-1)%26,i=String.fromCharCode(65+e)+i,n=parseInt((n-e)/26,10);return i},n.helper.isNumeric=function(t){var e=typeof t;return"number"==e?!isNaN(t)&&isFinite(t):"string"==e?t.length?1==t.length?/\d/.test(t):/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(t):!1:"object"==e?!(!t||"number"!=typeof t.valueOf()||t instanceof Date):!1},n.helper.isDescendant=function(t,e){for(var n=e.parentNode;null!=n;){if(n==t)return!0;n=n.parentNode}return!1},n.helper.randomString=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},n.helper.inherit=function(t,e){function n(){}return n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t},n.helper.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n.helper.columnFactory=function(t,e,n){var i=0,o=e.length,s=function(){};for(s.prototype=new t;o>i;i++)s.prototype[e[i]]=void 0;for(i in n)n.hasOwnProperty(i)&&(s.prototype[i]=n[i]);return s},n.helper.translateRowsToColumns=function(t){var e,n,i,o,s=[],r=0;for(e=0,n=t.length;n>e;e++)for(i=0,o=t[e].length;o>i;i++)i==r&&(s.push([]),r++),s[i].push(t[e][i]);return s},n.helper.to2dArray=function(t){for(var e=0,n=t.length;n>e;)t[e]=[t[e]],e++},n.helper.extendArray=function(t,e){for(var n=0,i=e.length;i>n;)t.push(e[n]),n++},n.helper.getCellMethod=function(t,e){if("string"==typeof e){var i=n.cellLookup[t][e];if(void 0===i)throw Error("You declared cell "+t+' "'+e+'" as a string that is not mapped to a known function. Cell '+t+" must be a function or a string mapped to a function in Handsontable.cellLookup."+t+" lookup object");return i}return e},n.helper.isOutsideInput=function(t){var e=["INPUT","SELECT","TEXTAREA"];return e.indexOf(t.nodeName)>-1&&-1==t.className.indexOf("handsontableInput")},n.UndoRedo=function(t){var e=this;this.instance=t,this.clear(),n.PluginHooks.add("afterChange",function(t,n){"undo"!==n&&"redo"!==n&&e.add(t,n)})},n.UndoRedo.prototype.undo=function(){var e,n;if(this.isUndoAvailable()){var i=t.extend(!0,[],this.data[this.rev]);for(e=0,n=i.length;n>e;e++)i[e].splice(3,1);this.instance.setDataAtRowProp(i,null,null,"undo"),this.rev--}},n.UndoRedo.prototype.redo=function(){var e,n;if(this.isRedoAvailable()){this.rev++;var i=t.extend(!0,[],this.data[this.rev]);for(e=0,n=i.length;n>e;e++)i[e].splice(2,1);this.instance.setDataAtRowProp(i,null,null,"redo")}},n.UndoRedo.prototype.isUndoAvailable=function(){return this.rev>=0},n.UndoRedo.prototype.isRedoAvailable=function(){return this.revr&&(r=0),0>a&&(a=0),c>0&&parseInt(e.css("border-top-width"),10)>0&&(r+=1),u>0&&parseInt(e.css("border-left-width"),10)>0&&(a+=1),t.browser.msie&&7>=parseInt(t.browser.version,10)&&(r-=1),this.textareaParentStyle.top=r+"px",this.textareaParentStyle.left=a+"px";var h=e.width(),d=this.instance.view.maximumVisibleElementWidth(a)-10,p=e.outerHeight()-4,f=this.instance.view.maximumVisibleElementHeight(r)-5;parseInt(e.css("border-top-width"),10)>0&&(p-=1),parseInt(e.css("border-left-width"),10)>0&&c>0&&(h-=1),this.$textarea.autoResize({minHeight:Math.min(p,f),maxHeight:f,minWidth:Math.min(h,d),maxWidth:d,animate:!1,extraSpace:0}),this.textareaParentStyle.display="block"}},i.prototype.saveValue=function(t,e){if(e){var n=this.instance.getSelected();this.instance.populateFromArray(n[0],n[1],t,n[2],n[3],"edit")}else this.instance.populateFromArray(this.row,this.col,t,null,null,"edit")},i.prototype.finishEditing=function(e,n){var i=!1;if(this.state!=this.STATE_WAITING&&this.state!=this.STATE_FINISHED){if(this.state==this.STATE_EDITING){var o;if(o=e?[[this.originalValue]]:[[t.trim(this.TEXTAREA.value)]],i=this.instance.getCellMeta(this.row,this.col).validator){this.state=this.STATE_WAITING;var s=this;this.instance.addHookOnce("afterValidate",function(t){s.state=s.STATE_FINISHED,s.discardEditor(t)})}this.saveValue(o,n)}i||(this.state=this.STATE_FINISHED,this.discardEditor())}},i.prototype.discardEditor=function(e){if(this.state===this.STATE_FINISHED)if(e===!1&&this.cellProperties.allowInvalid!==!0)this.state=this.STATE_EDITING,this.instance.view.wt.wtDom.isVisible(this.TEXTAREA)&&(this.TEXTAREA.focus(),this.setCaretPosition(this.TEXTAREA,this.TEXTAREA.value.length));else if(this.state=this.STATE_FINISHED,document.activeElement===this.TEXTAREA&&this.instance.listen(),this.unbindTemporaryEvents(),this.textareaParentStyle.display="none",this.waitingEvent){var n=t.Event(this.waitingEvent.type);n.keyCode=this.waitingEvent.keyCode,this.waitingEvent=null,t(document.activeElement).trigger(n)}},n.TextEditor=function(t,e,n,o,s,r,a){return t.textEditor||(t.textEditor=new i(t)),(t.textEditor.state===t.textEditor.STATE_VIRGIN||t.textEditor.state===t.textEditor.STATE_FINISHED)&&t.textEditor.bindTemporaryEvents(e,n,o,s,r,a),function(e){t.textEditor.finishEditing(e)}},n.helper.inherit(o,i),o.prototype.createElements=function(){i.prototype.createElements.call(this),this.$textarea.typeahead(),this.typeahead=this.$textarea.data("typeahead"),this.typeahead._render=this.typeahead.render,this.typeahead.minLength=0,this.typeahead.lookup=function(){var e;return this.query=this.$element.val(),e=t.isFunction(this.source)?this.source(this.query,t.proxy(this.process,this)):this.source,e?this.process(e):this},this.typeahead.matcher=function(){return!0};var e=this.typeahead.process,n=this;this.typeahead.process=function(i){for(var o=!1,s=0,r=i.length;r>s;s++)""===i[s]&&(o||(i=t.extend([],i),o=!0),i[s]=n.emptyStringLabel);return e.call(this,i)}},o.prototype.bindEvents=function(){var t=this;this.$textarea.off("keydown").off("keyup").off("keypress"),this.$textarea.off(".acEditor").on("keydown.acEditor",function(e){switch(e.keyCode){case 38:t.typeahead.prev(),e.stopImmediatePropagation();break;case 40:t.typeahead.next(),e.stopImmediatePropagation();break;case 13:e.preventDefault()}}),this.$textarea.on("keyup.acEditor",function(e){(n.helper.isPrintableChar(e.keyCode)||113===e.keyCode||13===e.keyCode||8===e.keyCode||46===e.keyCode)&&t.typeahead.lookup()}),i.prototype.bindEvents.call(this)},o.prototype.bindTemporaryEvents=function(e,n,o,s,r,a){function l(){h.beginEditing(n,o,s,!0),h.instance.registerTimeout("IE9_align_fix",function(){h.typeahead.lookup()},1)}var c,u,h=this;this.typeahead.select=function(){var e=this.hide();h.instance.destroyEditor(!0);var i=this.$menu[0].querySelector(".active"),r=t(i).attr("data-value");return r===h.emptyStringLabel&&(r=""),"function"==typeof a.onSelect?a.onSelect(n,o,s,r,h.instance.view.wt.wtDom.index(i)):h.instance.setDataAtRowProp(n,s,r),e},this.typeahead.render=function(t){if(h.typeahead._render.call(this,t),!a.strict){var e=this.$menu[0].querySelector(".active");e&&h.instance.view.wt.wtDom.removeClass(e,"active")}return this};for(c in a)if("options"===c)for(u in a.options)this.typeahead.options[u]=a.options[u];else this.typeahead[c]=a[c];i.prototype.bindTemporaryEvents.call(this,e,n,o,s,r,a),this.instance.view.wt.update("onCellDblClick",l)},o.prototype.finishEditing=function(t,e){t||(this.isMenuExpanded()&&this.typeahead.$menu[0].querySelector(".active")?(this.typeahead.select(),this.state=this.STATE_FINISHED):this.cellProperties.strict&&(this.state=this.STATE_FINISHED)),i.prototype.finishEditing.call(this,t,e)},o.prototype.isMenuExpanded=function(){return this.instance.view.wt.wtDom.isVisible(this.typeahead.$menu[0])?this.typeahead:!1},n.AutocompleteEditor=function(t,e,n,i,s,r,a){return t.autocompleteEditor||(t.autocompleteEditor=new o(t)),t.autocompleteEditor.bindTemporaryEvents(e,n,i,s,r,a),function(e){t.autocompleteEditor.finishEditing(e)}},n.CheckboxEditor=function(t,e,i,o,r,a,l){return l===void 0&&(l={}),l.checkedTemplate===void 0&&(l.checkedTemplate=!0),l.uncheckedTemplate===void 0&&(l.uncheckedTemplate=!1),t.$table.on("keydown.editor",function(e){var o=(e.ctrlKey||e.metaKey)&&!e.altKey;!o&&n.helper.isPrintableChar(e.keyCode)&&(s(t,i,r,l),e.stopImmediatePropagation(),e.preventDefault())}),t.view.wt.update("onCellDblClick",function(){s(t,i,r,l)}),function(){t.$table.off(".editor"),t.view.wt.update("onCellDblClick",null)}},n.helper.inherit(r,i),r.prototype.createElements=function(){i.prototype.createElements.call(this),this.datePicker=document.createElement("DIV"),this.datePickerStyle=this.datePicker.style,this.datePickerStyle.position="absolute",this.datePickerStyle.top=0,this.datePickerStyle.left=0,this.datePickerStyle.zIndex=99,this.instance.rootElement[0].appendChild(this.datePicker),this.$datePicker=t(this.datePicker);var e=this,n={dateFormat:"yy-mm-dd",showButtonPanel:!0,changeMonth:!0,changeYear:!0,altField:this.$textarea,onSelect:function(){e.finishEditing(!1)}};this.$datePicker.datepicker(n),this.hideDatepicker()},r.prototype.beginEditing=function(t,e,n,o,s){i.prototype.beginEditing.call(this,t,e,n,o,s),this.showDatepicker()},r.prototype.finishEditing=function(t,e){this.hideDatepicker(),i.prototype.finishEditing.call(this,t,e)},r.prototype.showDatepicker=function(){var e=t(this.instance.dateEditor.TD),n=e.position();this.datePickerStyle.top=n.top+e.height()+"px",this.datePickerStyle.left=n.left+"px";var i={defaultDate:this.originalValue||void 0};t.extend(i,this.cellProperties),this.$datePicker.datepicker("option",i),this.originalValue&&this.$datePicker.datepicker("setDate",this.originalValue),this.datePickerStyle.display="block"},r.prototype.hideDatepicker=function(){this.datePickerStyle.display="none"},n.DateEditor=function(t,e,n,i,o,s,a){return t.dateEditor||(t.dateEditor=new r(t)),t.dateEditor.bindTemporaryEvents(e,n,i,o,s,a),function(e){t.dateEditor.finishEditing(e)}},n.helper.inherit(a,i),a.prototype.createElements=function(){i.prototype.createElements.call(this);var e=document.createElement("DIV");e.className="handsontableEditor",this.TEXTAREA_PARENT.appendChild(e),this.$htContainer=t(e)},a.prototype.bindTemporaryEvents=function(e,n,o,s,r,a){var l=this,c={colHeaders:!0,cells:function(){return{readOnly:!0}},fillHandle:!1,width:2e3,afterOnCellMouseDown:function(){var t=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(t[0],t[1]),l.instance.destroyEditor()},beforeOnKeyDown:function(t){switch(t.keyCode){case 27:l.instance.destroyEditor(!0);break;case 13:var e=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(e[0],e[1]),l.instance.destroyEditor()}}};a.handsontable&&(c=t.extend(c,a.handsontable)),this.$htContainer.handsontable(c),i.prototype.bindTemporaryEvents.call(this,e,n,o,s,r,a)},a.prototype.beginEditing=function(t,e,n,o,s){var r=this.instance.getSettings().onBeginEditing;r&&r()===!1||(i.prototype.beginEditing.call(this,t,e,n,o,s),this.$htContainer.handsontable("render"),this.$htContainer.handsontable("selectCell",0,0))},a.prototype.finishEditing=function(t,e){this.$htContainer.handsontable("isListening")&&this.instance.listen(),this.$htContainer.handsontable("destroy"),i.prototype.finishEditing.call(this,t,e)},n.HandsontableEditor=function(t,e,n,i,o,s,r){return t.handsontableEditor||(t.handsontableEditor=new a(t)),t.handsontableEditor.bindTemporaryEvents(e,n,i,o,s,r),t.registerEditor=t.handsontableEditor,function(e){t.handsontableEditor.finishEditing(e)}},n.NumericValidator=function(t,e){e(/^-?\d*\.?\d*$/.test(t))};var z=function(t,e){var n=t,i="string"==typeof n?n.toLowerCase():null;return function(t){for(var o=!1,s=0,r=t.length;r>s;s++){if(n===t[s]){o=!0;break}if(i===t[s].toLowerCase()){o=!0;break}}e(o)}};n.AutocompleteValidator=function(e,n){this.strict&&this.source?t.isFunction(this.source)?this.source(e,z(e,n)):z(e,n)(this.source):n(!0)},n.AutocompleteCell={editor:n.AutocompleteEditor,renderer:n.AutocompleteRenderer,validator:n.AutocompleteValidator},n.CheckboxCell={editor:n.CheckboxEditor,renderer:n.CheckboxRenderer},n.TextCell={editor:n.TextEditor,renderer:n.TextRenderer},n.NumericCell={editor:n.TextEditor,renderer:n.NumericRenderer,validator:n.NumericValidator,dataType:"number"},n.DateCell={editor:n.DateEditor,renderer:n.AutocompleteRenderer},n.HandsontableCell={editor:n.HandsontableEditor,renderer:n.AutocompleteRenderer},n.cellTypes={text:n.TextCell,date:n.DateCell,numeric:n.NumericCell,checkbox:n.CheckboxCell,autocomplete:n.AutocompleteCell,handsontable:n.HandsontableCell},n.cellLookup={renderer:{text:n.TextRenderer,numeric:n.NumericRenderer,checkbox:n.CheckboxRenderer,autocomplete:n.AutocompleteRenderer},editor:{text:n.TextEditor,date:n.DateEditor,checkbox:n.CheckboxEditor,autocomplete:n.AutocompleteEditor,handsontable:n.HandsontableEditor},validator:{numeric:n.NumericValidator,autocomplete:n.AutocompleteValidator}},n.PluginHookClass=function(){function t(){this.hooks={once:e(),persistent:e()},this.legacy=n}var e=function(){return{beforeInitWalkontable:[],beforeInit:[],beforeRender:[],beforeChange:[],beforeValidate:[],beforeGet:[],beforeSet:[],beforeGetCellMeta:[],beforeAutofill:[],beforeKeyDown:[],afterInit:[],afterLoadData:[],afterUpdateSettings:[],afterRender:[],afterChange:[],afterValidate:[],afterGetCellMeta:[],afterGetColHeader:[],afterGetColWidth:[],afterDestroy:[],afterRemoveRow:[],afterCreateRow:[],afterRemoveCol:[],afterCreateCol:[],afterColumnResize:[],afterColumnMove:[],afterDeselect:[],afterSelection:[],afterSelectionByProp:[],afterSelectionEnd:[],afterSelectionEndByProp:[],afterCopyLimit:[],modifyCol:[]}},n={onBeforeChange:"beforeChange",onChange:"afterChange",onCreateRow:"afterCreateRow",onCreateCol:"afterCreateCol",onSelection:"afterSelection",onCopyLimit:"afterCopyLimit",onSelectionEnd:"afterSelectionEnd",onSelectionByProp:"afterSelectionByProp",onSelectionEndByProp:"afterSelectionEndByProp"},i=function(t){return function(e,i){if(e in n&&(e=n[e]),this.hooks[t][e]===void 0&&(this.hooks[t][e]=[]),i instanceof Array)for(var o=0,s=i.length;s>o;o++)this.hooks[t][e].push(i[o]);else this.hooks[t][e].push(i);return this}};return t.prototype.add=i("persistent"),t.prototype.once=i("once"),t.prototype.remove=function(t,e){var i,o,s,r,a,l=!1,c=["persistent","once"];t in n&&(t=n[t]);for(o=0,s=c.length;s>o;o++)if(i=c[o],this.hooks[i][t]!==void 0)for(r=0,a=this.hooks[i][t].length;a>r;r++)if(this.hooks[i][t][r]==e){this.hooks[i][t].splice(r,1),l=!0;break}return l},t.prototype.run=function(t,e,i,o,s,r,a){var l,c,u,h,d,p=["persistent","once"];e in n&&(e=n[e]);for(c=0,u=p.length;u>c;c++)if(l=p[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)this.hooks[l][e][h].call(t,i,o,s,r,a),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--)},t.prototype.execute=function(t,e,i,o,s,r,a){var l,c,u,h,d,p,f=["persistent","once"];e in n&&(e=n[e]);for(c=0,u=f.length;u>c;c++)if(l=f[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)p=this.hooks[l][e][h].call(t,i,o,s,r,a),void 0!==p&&(i=p),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--); -return i},t}(),n.PluginHooks=new n.PluginHookClass;var W=new l;n.PluginHooks.add("beforeInit",W.beforeInit),n.PluginHooks.add("beforeRender",W.determineColumnsWidth),n.PluginHooks.add("afterGetColWidth",W.getColWidth),n.PluginHooks.add("afterDestroy",W.afterDestroy);var F=new c;n.PluginHooks.add("afterInit",function(){F.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){F.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("beforeGet",F.onBeforeGetSet),n.PluginHooks.add("beforeSet",F.onBeforeGetSet),n.PluginHooks.add("afterGetColHeader",F.getColHeader),n.PluginHooks.add("afterCreateRow",F.sort),n.PluginHooks.add("afterRemoveRow",F.sort),n.PluginHooks.add("afterChange",F.afterChangeSort),n.PluginHooks.add("afterInit",u),n.PluginHooks.add("afterDestroy",h),n.PluginHooks.add("beforeGetCellMeta",function(t,e,i){var o,s,r,a=this.getSettings(),l=this.getData();if(i.isWritable=!i.readOnly,a.autoComplete)for(o=0,s=a.autoComplete.length;s>o;o++)if(a.autoComplete[o].match(t,e,l)){i.type===void 0?i.type=n.AutocompleteCell:(i.type.renderer===void 0&&(i.type.renderer=n.AutocompleteCell.renderer),i.type.editor===void 0&&(i.type.editor=n.AutocompleteCell.editor));for(r in a.autoComplete[o])a.autoComplete[o].hasOwnProperty(r)&&"match"!==r&&i[o]===void 0&&(i[r]="source"===r?a.autoComplete[o][r](t,e):a.autoComplete[o][r]);break}});var j=new d;n.PluginHooks.add("beforeInit",j.beforeInit),n.PluginHooks.add("afterInit",function(){j.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){j.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("afterGetColHeader",j.getColHeader),n.PluginHooks.add("modifyCol",j.modifyCol);var X=new p;n.PluginHooks.add("beforeInit",X.beforeInit),n.PluginHooks.add("afterInit",function(){X.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){X.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("afterGetColWidth",X.getColWidth);var Y=new f;n.PluginHooks.add("afterLoadData",Y.afterLoadData),function(t){function e(){function e(){var t=this;for(var e in s)s.hasOwnProperty(e)&&!i.call(t,e)&&t.PluginHooks.add(e,s[e])}function n(){var t=this;for(var e in s)s.hasOwnProperty(e)&&i.call(t,e)&&t.PluginHooks.remove(e,s[e])}function i(t){var e=this;return e.PluginHooks.hooks.persistent.hasOwnProperty(t)}var o=this;this.init=function(){var i=this,s=i.getSettings().persistentState;return o.enabled=Boolean(s),o.enabled?(i.storage||(i.storage=new t(i.rootElement[0].id)),i.resetState=o.resetValue,e.call(i),void 0):(n.call(i),void 0)},this.saveValue=function(t,e){var n=this;n.storage.saveValue(t,e)},this.loadValue=function(t,e){var n=this;e.value=n.storage.loadValue(t)},this.resetValue=function(t){var e=this;t!==void 0?e.storage.reset(t):e.storage.resetAll()};var s={persistentStateSave:o.saveValue,persistentStateLoad:o.loadValue,persistentStateReset:o.resetValue}}var i=new e;n.PluginHooks.add("beforeInit",i.init),n.PluginHooks.add("afterUpdateSettings",i.init)}(m),function(t){function e(i){return this.filter(e.resizableFilterSelector).each(function(){new n(t(this),i)}),this}function n(n,i){this.clones||(this.config=t.extend({},e.defaults,i),this.el=n,this.nodeName=n[0].nodeName.toLowerCase(),this.previousScrollTop=null,"original"===i.maxWidth&&(i.maxWidth=n.width()),"original"===i.minWidth&&(i.minWidth=n.width()),"original"===i.maxHeight&&(i.maxHeight=n.height()),"original"===i.minHeight&&(i.minHeight=n.height()),"textarea"===this.nodeName&&n.css({resize:"none",overflowY:"none"}),n.data("AutoResizer",this),this.createClone(),this.injectClone(),this.bind())}e.defaults={onResize:function(){},animate:{duration:200,complete:function(){}},extraSpace:50,minHeight:"original",maxHeight:500,minWidth:"original",maxWidth:500},e.cloneCSSProperties=["lineHeight","textDecoration","letterSpacing","fontSize","fontFamily","fontStyle","fontWeight","textTransform","textAlign","direction","wordSpacing","fontSizeAdjust","padding"],e.cloneCSSValues={position:"absolute",top:-9999,left:-9999,opacity:0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden",border:"1px solid black",padding:"0.49em"},e.resizableFilterSelector="textarea,input:not(input[type]),input[type=text],input[type=password]",e.AutoResizer=n,t.fn.autoResize=e,n.prototype={bind:function(){var e=t.proxy(function(){return this.check(),!0},this);this.unbind(),this.el.bind("keyup.autoResize",e).bind("change.autoResize",e),this.check(null,!0)},unbind:function(){this.el.unbind(".autoResize")},createClone:function(){var n=this.el,i=this,o=this.config;this.clones=t(),("original"!==o.minHeight||"original"!==o.maxHeight)&&(this.hClone=n.clone().height("auto"),this.clones=this.clones.add(this.hClone)),("original"!==o.minWidth||"original"!==o.maxWidth)&&(this.wClone=t("
").width("auto").css({whiteSpace:"nowrap","float":"left"}),this.clones=this.clones.add(this.wClone)),t.each(e.cloneCSSProperties,function(t,e){i.clones.css(e,n.css(e))}),this.clones.removeAttr("name").removeAttr("id").attr("tabIndex",-1).css(e.cloneCSSValues).css("overflowY","scroll")},check:function(t,e){var n=this.config,i=this.wClone,o=this.hClone,s=this.el,r=s.val();if(i){i.text(r);var a=i.outerWidth(),l=a+n.extraSpace>=n.minWidth?a+n.extraSpace:n.minWidth,c=s.width();l=Math.min(l,n.maxWidth),(c>l&&l>=n.minWidth||l>=n.minWidth&&n.maxWidth>=l)&&(n.onResize.call(s),s.scrollLeft(0),n.animate&&!e?s.stop(1,1).animate({width:l},n.animate):s.width(l))}if(o){l&&o.width(l),o.height(0).val(r).scrollTop(1e4);var u=o[0].scrollTop+n.extraSpace;if(this.previousScrollTop===u)return;this.previousScrollTop=u,u>=n.maxHeight&&(u=n.maxHeight),n.minHeight>u&&(u=n.minHeight),u==n.maxHeight&&l==n.maxWidth?s.css("overflowY","scroll"):s.css("overflowY","hidden"),n.onResize.call(s),n.animate&&!e?s.stop(1,1).animate({height:u},n.animate):s.height(u)}},destroy:function(){this.unbind(),this.el.removeData("AutoResizer"),this.clones.remove(),delete this.el,delete this.hClone,delete this.wClone,delete this.clones},injectClone:function(){(e.cloneContainer||(e.cloneContainer=t("").appendTo("body"))).empty().append(this.clones)}}}(jQuery),function(t){function e(t){return t.split('"').length-1}t.SheetClip={parse:function(t){var n,i,o,s,r,a,l,c=[],u=0;for(o=t.split("\n"),o.length>1&&""===o[o.length-1]&&o.pop(),n=0,i=o.length;i>n;n+=1){for(o[n]=o[n].split(" "),s=0,r=o[n].length;r>s;s+=1)c[u]||(c[u]=[]),a&&0===s?(l=c[u].length-1,c[u][l]=c[u][l]+"\n"+o[n][0],a&&1&e(o[n][0])&&(a=!1,c[u][l]=c[u][l].substring(0,c[u][l].length-1).replace(/""/g,'"'))):s===r-1&&0===o[n][s].indexOf('"')?(c[u].push(o[n][s].substring(1).replace(/""/g,'"')),a=!0):(c[u].push(o[n][s].replace(/""/g,'"')),a=!1);a||(u+=1)}return c},stringify:function(t){var e,n,i,o,s,r="";for(e=0,n=t.length;n>e;e+=1){for(i=0,o=t[e].length;o>i;i+=1)i>0&&(r+=" "),s=t[e][i],r+="string"==typeof s?s.indexOf("\n")>-1?'"'+s.replace(/"/g,'""')+'"':s:null===s||void 0===s?"":s;r+="\n"}return r}}}(e);var G=function(){var t;return{getInstance:function(){return t||(t=new g),t}}}();g.prototype.selectNodeText=function(t){t.select()},g.prototype.getSelectionText=function(){var t="";return e.getSelection?t=""+e.getSelection():document.selection&&"Control"!=document.selection.type&&(t=document.selection.createRange().text),t},g.prototype.copyable=function(t){if("string"!=typeof t&&void 0===t.toString)throw Error("copyable requires string parameter");this.elTextarea.value=t},g.prototype.onCut=function(t){this.cutCallbacks.push(t)},g.prototype.onPaste=function(t){this.pasteCallbacks.push(t)},g.prototype.removeCallback=function(t){var e,n;for(e=0,n=this.copyCallbacks.length;n>e;e++)if(this.copyCallbacks[e]===t)return this.copyCallbacks.splice(e,1),!0;for(e=0,n=this.cutCallbacks.length;n>e;e++)if(this.cutCallbacks[e]===t)return this.cutCallbacks.splice(e,1),!0;for(e=0,n=this.pasteCallbacks.length;n>e;e++)if(this.pasteCallbacks[e]===t)return this.pasteCallbacks.splice(e,1),!0;return!1},g.prototype.triggerCut=function(t){var e=this;e.cutCallbacks&&setTimeout(function(){for(var n=0,i=e.cutCallbacks.length;i>n;n++)e.cutCallbacks[n](t)},50)},g.prototype.triggerPaste=function(t,e){var n=this;n.pasteCallbacks&&setTimeout(function(){for(var i=(e||n.elTextarea.value).replace(/\n$/,""),o=0,s=n.pasteCallbacks.length;s>o;o++)n.pasteCallbacks[o](i,t)},50)},g.prototype._bindEvent=function(){return e.jQuery?function(e,n,i){t(e).on(n+".copypaste",i)}:function(t,e,n){t.addEventListener(e,n,!1)}}(),w.prototype.appear=function(t){var e,n,i,o,s,r,a,l,c,u,h,d;if(!this.disabled){var p,f,m,g,w,v,y,b=this.instance,C=!1,S=!1,T=!1,x=!1;for(b.wtTable.isRowInViewport(t[0])||(C=!0),b.wtTable.isRowInViewport(t[2])||(T=!0),v=b.wtTable.rowStrategy.countVisible(),w=0;v>w;w++)if(y=b.wtTable.rowFilter.visibleToSource(w),y>=t[0]&&t[2]>=y){p=y;break}for(w=v-1;w>=0;w--)if(y=b.wtTable.rowFilter.visibleToSource(w),y>=t[0]&&t[2]>=y){m=y;break}if(C&&T)S=!0,x=!0;else{for(b.wtTable.isColumnInViewport(t[1])||(S=!0),b.wtTable.isColumnInViewport(t[3])||(x=!0),v=b.wtTable.columnStrategy.countVisible(),w=0;v>w;w++)if(y=b.wtTable.columnFilter.visibleToSource(w),y>=t[1]&&t[3]>=y){f=y;break}for(w=v-1;w>=0;w--)if(y=b.wtTable.columnFilter.visibleToSource(w),y>=t[1]&&t[3]>=y){g=y;break}}if(void 0===p||void 0===f)return this.disappear(),void 0;e=p!==m||f!==g,n=b.wtTable.getCell([p,f]),i=e?b.wtTable.getCell([m,g]):n,o=this.wtDom.offset(n),s=e?this.wtDom.offset(i):o,r=this.wtDom.offset(b.wtTable.TABLE),l=o.top,h=s.top+this.wtDom.outerHeight(i)-l,u=o.left,d=s.left+this.wtDom.outerWidth(i)-u,a=l-r.top-1,c=u-r.left-1;var E=this.wtDom.getComputedStyle(n);parseInt(E.borderTopWidth,10)>0&&(a+=1,h-=1),parseInt(E.borderLeftWidth,10)>0&&(c+=1,d-=1),C?this.topStyle.display="none":(this.topStyle.top=a+"px",this.topStyle.left=c+"px",this.topStyle.width=d+"px",this.topStyle.display="block"),S?this.leftStyle.display="none":(this.leftStyle.top=a+"px",this.leftStyle.left=c+"px",this.leftStyle.height=h+"px",this.leftStyle.display="block");var k=Math.floor(this.settings.border.width/2);T?this.bottomStyle.display="none":(this.bottomStyle.top=a+h-k+"px",this.bottomStyle.left=c+"px",this.bottomStyle.width=d+"px",this.bottomStyle.display="block"),x?this.rightStyle.display="none":(this.rightStyle.top=a+"px",this.rightStyle.left=c+d-k+"px",this.rightStyle.height=h+1+"px",this.rightStyle.display="block"),T||x||!this.hasSetting(this.settings.border.cornerVisible)?this.cornerStyle.display="none":(this.cornerStyle.top=a+h-4+"px",this.cornerStyle.left=c+d-4+"px",this.cornerStyle.display="block")}},w.prototype.disappear=function(){this.topStyle.display="none",this.leftStyle.display="none",this.bottomStyle.display="none",this.rightStyle.display="none",this.cornerStyle.display="none"},w.prototype.hasSetting=function(t){return"function"==typeof t?t():!!t},v.prototype.source=function(t){return t},v.prototype.offsetted=function(t){return t+this.offset},v.prototype.unOffsetted=function(t){return t-this.offset},v.prototype.fixed=function(t){return this.fixedCount>t?t-this.offset:t},v.prototype.unFixed=function(t){return this.fixedCount>t?t+this.offset:t},v.prototype.visibleToSource=function(t){return this.source(this.offsetted(this.fixed(t)))},v.prototype.sourceToVisible=function(t){return this.source(this.unOffsetted(this.unFixed(t)))},y.prototype.getSize=function(t){return this.cellSizes[t]},y.prototype.getContainerSize=function(t){return"function"==typeof this.containerSizeFn?this.containerSizeFn(t):this.containerSizeFn},y.prototype.countVisible=function(){return this.cellCount},y.prototype.isLastIncomplete=function(){return this.remainingSize>0},b.prototype.add=function(t,e,n){this.cache[t]||(this.cache[t]=[]),this.cache[t][e]||(this.cache[t][e]=[]),this.cache[t][e][n]=!0},b.prototype.test=function(t,e,n){return this.cache[t]&&this.cache[t][e]&&this.cache[t][e][n]},C.prototype=new v,C.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetColumn,this.total=t.getSetting("totalColumns"),this.fixedCount=t.getSetting("fixedColumnsLeft"),this.countTH=t.getSetting("rowHeaders").length},C.prototype.offsettedTH=function(t){return t-this.countTH},C.prototype.unOffsettedTH=function(t){return t+this.countTH},C.prototype.visibleRowHeadedColumnToSourceColumn=function(t){return this.visibleToSource(this.offsettedTH(t))},C.prototype.sourceColumnToVisibleRowHeadedColumn=function(t){return this.unOffsettedTH(this.sourceToVisible(t))},S.prototype=new y,S.prototype.getSize=function(t){return this.cellSizes[t]+(this.cellStretch[t]||0)},S.prototype.stretch=function(){var t=this.getContainerSize(this.cellSizesSum),e=0;if(this.remainingSize=this.cellSizesSum-t,this.cellStretch.length=0,"all"===this.strategy){if(0>this.remainingSize){for(var n,i=t/this.cellSizesSum;this.cellCount-1>e;)n=Math.floor(i*this.cellSizes[e]),this.remainingSize+=n-this.cellSizes[e],this.cellStretch[e]=n-this.cellSizes[e],e++;this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0}}else"last"===this.strategy&&0>this.remainingSize&&(this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0)},T.prototype.draw=function(t){return this.drawInterrupted=!1,t||this.wtDom.isVisible(this.wtTable.TABLE)?(this.getSetting("beforeDraw",!t),t=t&&this.getSetting("offsetRow")===this.lastOffsetRow&&this.getSetting("offsetColumn")===this.lastOffsetColumn,this.drawn&&(this.scrollVertical(0),this.scrollHorizontal(0)),this.lastOffsetRow=this.getSetting("offsetRow"),this.lastOffsetColumn=this.getSetting("offsetColumn"),this.wtTable.draw(t),this.getSetting("onDraw"),this):(this.drawInterrupted=!0,void 0)},T.prototype.update=function(t,e){return this.wtSettings.update(t,e)},T.prototype.scrollVertical=function(t){return this.wtScroll.scrollVertical(t)},T.prototype.scrollHorizontal=function(t){return this.wtScroll.scrollHorizontal(t)},T.prototype.scrollViewport=function(t){return this.wtScroll.scrollViewport(t),this},T.prototype.getViewport=function(){return[this.wtTable.rowFilter.visibleToSource(0),this.wtTable.columnFilter.visibleToSource(0),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]},T.prototype.getSetting=function(t,e,n,i){return this.wtSettings.getSetting(t,e,n,i)},T.prototype.hasSetting=function(t){return this.wtSettings.has(t)},T.prototype.destroy=function(){t(document.body).off("."+this.guid),this.wtScrollbars.destroy(),clearTimeout(this.wheelTimeout),clearTimeout(this.dblClickTimeout)},x.prototype.closest=function(t,e,n){for(;null!=t&&t!==n;){if(1===t.nodeType&&e.indexOf(t.nodeName)>-1)return t;t=t.parentNode}return null},x.prototype.isChildOf=function(t,e){for(var n=t.parentNode;null!=n;){if(n==e)return!0;n=n.parentNode}return!1},x.prototype.index=function(t){for(var e=0;t=t.previousSibling;)++e;return e},document.documentElement.classList?(x.prototype.hasClass=function(t,e){return t.classList.contains(e)},x.prototype.addClass=function(t,e){t.classList.add(e)},x.prototype.removeClass=function(t,e){t.classList.remove(e)}):(x.prototype.hasClass=function(t,e){return t.className.match(RegExp("(\\s|^)"+e+"(\\s|$)"))},x.prototype.addClass=function(t,e){this.hasClass(t,e)||(t.className+=" "+e)},x.prototype.removeClass=function(t,e){if(this.hasClass(t,e)){var n=RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}),x.prototype.removeTextNodes=function(t,e){if(3===t.nodeType)e.removeChild(t);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(t.nodeName)>-1)for(var n=t.childNodes,i=n.length-1;i>=0;i--)this.removeTextNodes(n[i],t)},x.prototype.empty=function(t){for(var e;e=t.lastChild;)t.removeChild(e)},x.prototype.HTML_CHARACTERS=/(<(.*)>|&(.*);)/,x.prototype.fastInnerHTML=function(t,e){this.HTML_CHARACTERS.test(e)?t.innerHTML=e:this.fastInnerText(t,e)},x.prototype.fastInnerText=document.createTextNode("test").textContent?function(t,e){var n=t.firstChild;n&&3===n.nodeType&&null===n.nextSibling?n.textContent=e:(this.empty(t),t.appendChild(document.createTextNode(e)))}:function(t,e){var n=t.firstChild;n&&3===n.nodeType&&null===n.nextSibling?n.data=e:(this.empty(t),t.appendChild(document.createTextNode(e)))},x.prototype.isVisible=function(t){try{if(!t.offsetParent)return!1}catch(e){return!1}if(t.offsetWidth>0)return!0;for(var n=t;n!==document.documentElement;){if(null===n)return!1;if(11===n.nodeType)return!0;if("none"===n.style.display)return!1;n=n.parentNode}return!0},x.prototype.offset=function(t){if(this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName){var n=t.getBoundingClientRect();return{top:n.top+(e.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0),left:n.left+(e.pageXOffset||document.documentElement.scrollLeft)-(document.documentElement.clientLeft||0)}}for(var i=t.offsetLeft,o=t.offsetTop,s=t;(t=t.offsetParent)&&t!==document.body;)i+=t.offsetLeft,o+=t.offsetTop,s=t;return s&&"fixed"===s.style.position&&(i+=e.pageXOffset||document.documentElement.scrollLeft,o+=e.pageYOffset||document.documentElement.scrollTop),{left:i,top:o}},x.prototype.getComputedStyle=function(t){return t.currentStyle||document.defaultView.getComputedStyle(t)},x.prototype.outerWidth=function(t){return t.offsetWidth},x.prototype.outerHeight=function(t){return this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName?t.offsetHeight+t.firstChild.offsetHeight:t.offsetHeight},function(){function t(){var t=document.createElement("TABLE");t.style.borderSpacing=0,t.style.borderWidth=0,t.style.padding=0;var n=document.createElement("TBODY");t.appendChild(n),n.appendChild(document.createElement("TR")),n.firstChild.appendChild(document.createElement("TD")),n.firstChild.firstChild.innerHTML="t
t";var i=document.createElement("CAPTION");i.innerHTML="c
c
c
c",i.style.padding=0,i.style.margin=0,t.insertBefore(i,n),document.body.appendChild(t),e=t.offsetHeight<2*t.lastChild.offsetHeight,document.body.removeChild(t)}var e;x.prototype.hasCaptionProblem=function(){return void 0===e&&t(),e}}(),E.prototype.parentCell=function(t){var e={},n=this.instance.wtTable.TABLE,i=this.wtDom.closest(t,["TD","TH"],n);return i&&this.wtDom.isChildOf(i,n)?(e.coords=this.instance.wtTable.getCoords(i),e.TD=i):this.wtDom.hasClass(t,"wtBorder")&&this.wtDom.hasClass(t,"current")&&!this.wtDom.hasClass(t,"corner")&&(e.coords=this.instance.selections.current.selected[0],e.TD=this.instance.wtTable.getCell(e.coords)),e},Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,n=Number(arguments[1])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=e);e>n;n++)if(n in this&&this[n]===t)return n;return-1}),e.requestAnimFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){return e.setTimeout(t,1e3/60)}}(),e.cancelRequestAnimFrame=function(){return e.cancelAnimationFrame||e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}(),e.getComputedStyle||function(){var t,n={getPropertyValue:function(e){return"float"==e&&(e="styleFloat"),t.currentStyle[e.toUpperCase()]||null}};e.getComputedStyle=function(e){return t=e,n}}(),k.prototype=new v,k.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetRow,this.total=t.getSetting("totalRows"),this.fixedCount=t.getSetting("fixedRowsTop")},R.prototype=new y,R.prototype.add=function(t,e,n){if(0>this.remainingSize){var i=this.sizeAtIndex(t,e);if(void 0===i)return;var o=this.getContainerSize(this.cellSizesSum+i);if(n?this.cellSizes.unshift(i):this.cellSizes.push(i),this.cellSizesSum+=i,this.cellCount++,this.remainingSize=this.cellSizesSum-o,n&&this.remainingSize>0)for(;this.cellCount>0&&this.cellSizes[this.cellCount-1]0?this.scrollLogicVertical(t,i,s,o,r,function(t){return o>t-i&&t-i>=0?n.getSetting("rowHeight",t-i):n.getSetting("rowHeight",t)},function(t){n.wtTable.verticalRenderReverse=t}):0,e!==i&&this.instance.wtScrollbars.vertical.scrollTo(e),n},D.prototype.scrollHorizontal=function(t){if(!this.instance.drawn)throw Error("scrollHorizontal can only be called after table was drawn to DOM");var e,n=this.instance,i=n.getSetting("offsetColumn"),o=n.getSetting("fixedColumnsLeft"),s=n.getSetting("totalColumns"),r=n.wtViewport.getViewportWidth();return e=s>0?this.scrollLogicHorizontal(t,i,s,o,r,function(t){return o>t-i&&t-i>=0?n.getSetting("columnWidth",t-i):n.getSetting("columnWidth",t)}):0,e!==i&&this.instance.wtScrollbars.horizontal.scrollTo(e),n},D.prototype.scrollLogicVertical=function(t,e,n,i,o,s,r){var a=e+t;return a>=n-i&&(a=n-i-1,r(!0)),0>a&&(a=0),a},D.prototype.scrollLogicHorizontal=function(t,e,n,i,o,s){var r,a=e+t,l=0;if(a>i){for(a>=n-i&&(a=n-i-1),r=a;o>l&&n>r;)l+=s(r),r++;if(o>l)for(;a>0&&(l+=s(a-1),o>l);)a--}else 0>a&&(a=0);return a},D.prototype.scrollViewport=function(t){var e=this.instance.getSetting("offsetRow"),n=(this.instance.getSetting("offsetColumn"),this.instance.wtTable.getLastVisibleRow()),i=this.instance.getSetting("totalRows"),o=this.instance.getSetting("totalColumns"),s=this.instance.getSetting("fixedRowsTop"),r=this.instance.getSetting("fixedColumnsLeft");if(0>t[0]||t[0]>i-1)throw Error("row "+t[0]+" does not exist");if(0>t[1]||t[1]>o-1)throw Error("column "+t[1]+" does not exist");if(t[0]>n?(this.scrollVertical(t[0]-s-e),this.instance.wtTable.verticalRenderReverse=!0):t[0]===n&&this.instance.wtTable.rowStrategy.isLastIncomplete()?(this.scrollVertical(t[0]-s-e),this.instance.wtTable.verticalRenderReverse=!0):e>t[0]-s?this.scrollVertical(t[0]-s-e):this.scrollVertical(0),this.instance.wtTable.isColumnBeforeViewport(t[1]))this.instance.wtScrollbars.horizontal.scrollTo(t[1]-r);else if(this.instance.wtTable.isColumnAfterViewport(t[1])||this.instance.wtTable.getLastVisibleColumn()===t[1]&&!this.instance.wtTable.isLastColumnFullyVisible()){for(var a=0,l=0;r>l;l++)a+=this.instance.getSetting("columnWidth",l);var c=t[1];a+=this.instance.getSetting("columnWidth",c);var u=this.instance.wtViewport.getViewportWidth();if(u>a)for(var h=this.instance.getSetting("columnWidth",c-1);u>a+h&&c>=r;)c--,a+=h;this.instance.wtScrollbars.horizontal.scrollTo(c-r)}return this.instance},P.prototype.init=function(){var e=this;this.$table=t(this.instance.wtTable.TABLE),this.slider=document.createElement("DIV"),this.sliderStyle=this.slider.style,this.sliderStyle.position="absolute",this.sliderStyle.top="0",this.sliderStyle.left="0",this.sliderStyle.display="none",this.slider.className="dragdealer "+this.type,this.handle=document.createElement("DIV"),this.handleStyle=this.handle.style,this.handle.className="handle",this.slider.appendChild(this.handle),this.container=this.instance.wtTable.parent,this.container.appendChild(this.slider);var n=!0;this.dragTimeout=null;var i,o=function(){e.onScroll(i)};this.dragdealer=new te(this.slider,{vertical:"vertical"===this.type,horizontal:"horizontal"===this.type,slide:!1,speed:100,animationCallback:function(t,s){return n?(n=!1,void 0):(e.skipRefresh=!0,i="vertical"===e.type?s:t,null===e.dragTimeout&&(e.dragTimeout=setInterval(o,100),o()),void 0)},callback:function(t,n){e.skipRefresh=!1,clearInterval(e.dragTimeout),e.dragTimeout=null,i="vertical"===e.type?n:t,e.onScroll(i)}}),this.skipRefresh=!1},P.prototype.onScroll=function(t){if(this.instance.drawn&&(this.readSettings(),this.total>this.visibleCount)){var e=Math.round(this.handlePosition*this.total/this.sliderSize);1===t?"vertical"===this.type?this.instance.scrollVertical(1/0).draw():this.instance.scrollHorizontal(1/0).draw():e!==this.offset?"vertical"===this.type?this.instance.scrollVertical(e-this.offset).draw():this.instance.scrollHorizontal(e-this.offset).draw():this.refresh()}},P.prototype.getHandleSizeRatio=function(t,e){return!e||t>e||t==e?1:1/e},P.prototype.prepare=function(){if(!this.skipRefresh){var t=this.getHandleSizeRatio(this.visibleCount,this.total);this.visible=(1===t||isNaN(t))&&"auto"===this.scrollMode||"none"===this.scrollMode?!1:!0}},P.prototype.refresh=function(){if(!this.skipRefresh){if(!this.visible)return this.sliderStyle.display="none",void 0;var t,e,n,i,o=this.visibleCount,s=this.instance.wtViewport.getWorkspaceWidth(),r=this.instance.wtViewport.getWorkspaceHeight();1/0===s&&(s=this.instance.wtViewport.getWorkspaceActualWidth()),1/0===r&&(r=this.instance.wtViewport.getWorkspaceActualHeight()),"vertical"===this.type?(this.instance.wtTable.rowStrategy.isLastIncomplete()&&o--,e=r-2,this.sliderStyle.top=this.instance.wtDom.offset(this.$table[0]).top-this.instance.wtDom.offset(this.container).top+"px",this.sliderStyle.left=s-1+"px",this.sliderStyle.height=Math.max(e,0)+"px"):(this.instance.wtTable.columnStrategy.isLastIncomplete()&&o--,e=s-2,this.sliderStyle.left=this.instance.wtDom.offset(this.$table[0]).left-this.instance.wtDom.offset(this.container).left+"px",this.sliderStyle.top=r-1+"px",this.sliderStyle.width=Math.max(e,0)+"px"),t=this.getHandleSizeRatio(o,this.total),n=Math.round(e*t),10>n&&(n=15),i=Math.floor(e*(this.offset/this.total)),n+i>e&&(i=e-n),"vertical"===this.type?(this.handleStyle.height=n+"px",this.handleStyle.top=i+"px"):(this.handleStyle.width=n+"px",this.handleStyle.left=i+"px"),this.sliderStyle.display="block"}},P.prototype.destroy=function(){clearInterval(this.dragdealer.interval)};var K=function(t){this.instance=t,this.type="vertical",this.init()};K.prototype=new P,K.prototype.scrollTo=function(t){this.instance.update("offsetRow",t)},K.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollV"),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows"),this.visibleCount=this.instance.wtTable.rowStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.rowStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.top,10),this.sliderSize=parseInt(this.sliderStyle.height,10),this.fixedCount=this.instance.getSetting("fixedRowsTop")};var U=function(t){this.instance=t,this.type="horizontal",this.init()};U.prototype=new P,U.prototype.scrollTo=function(t){this.instance.update("offsetColumn",t)},U.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollH"),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns"),this.visibleCount=this.instance.wtTable.columnStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.columnStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.left,10),this.sliderSize=parseInt(this.sliderStyle.width,10),this.fixedCount=this.instance.getSetting("fixedColumnsLeft")},H.prototype.init=function(){this.fixedContainer=this.instance.wtTable.TABLE.parentNode.parentNode.parentNode,this.fixed=this.instance.wtTable.TABLE.parentNode.parentNode,this.TABLE=this.instance.wtTable.TABLE,this.$scrollHandler=t(e);var n=this;this.$scrollHandler.on("scroll.walkontable",function(){return n.instance.wtTable.parent.parentNode?(n.onScroll(),void 0):(n.destroy(),void 0)}),this.readSettings()},H.prototype.onScroll=function(){if(this.readSettings(),this.windowScrollPosition!==this.lastWindowScrollPosition){this.lastWindowScrollPosition=this.windowScrollPosition;var t,e=0;this.windowScrollPosition>this.tableParentOffset&&(t=this.windowScrollPosition-this.tableParentOffset,e=Math.ceil(t/20,10),e=Math.min(e,this.total)),this.instance.update("offsetRow",e),this.instance.draw()}},H.prototype.prepare=function(){},H.prototype.availableSize=function(){var t;return t=this.windowScrollPosition>this.tableParentOffset?this.instance.wtTable.getLastVisibleRow()===this.total-1?this.instance.wtDom.outerHeight(this.TABLE):this.windowSize:this.windowSize-(this.tableParentOffset-this.windowScrollPosition)},H.prototype.refresh=function(){var t=this.getLastCell();this.measureBefore=this.offset*this.cellSize,this.measureInside=this.getTableSize(),this.measureAfter=-1===t?0:(this.total-t-1)*this.cellSize,this.applyToDOM()},H.prototype.destroy=function(){this.$scrollHandler.off("scroll.walkontable")};var q=function(t){this.instance=t,this.type="vertical",this.cellSize=20,this.init()};q.prototype=new H,q.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleRow()},q.prototype.getTableSize=function(){return this.instance.wtDom.outerHeight(this.TABLE)},q.prototype.applyToDOM=function(){this.windowScrollPosition>this.tableParentOffset?(this.fixed.style.position="fixed",this.fixed.style.top="0",this.fixed.style.left=this.tableParentOtherOffset):this.fixed.style.position="relative";var t=!1;t||(this.fixedContainer.style.paddingTop=this.measureBefore+"px",this.fixedContainer.style.paddingBottom=this.measureInside+this.measureAfter+"px")},q.prototype.scrollTo=function(t){this.$scrollHandler.scrollTop(this.tableParentOffset+t*this.cellSize)},q.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.top,this.tableParentOtherOffset=t.left,this.windowSize=this.$scrollHandler.height(),this.windowScrollPosition=this.$scrollHandler.scrollTop(),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows")};var Q=function(t){this.instance=t,this.type="horizontal",this.cellSize=50,this.init()};Q.prototype=new H,Q.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleColumn()},Q.prototype.getTableSize=function(){return this.instance.wtDom.outerWidth(this.TABLE)},Q.prototype.applyToDOM=function(){this.windowScrollPosition>this.tableParentOffset?(this.fixed.style.position="fixed",this.fixed.style.left="0",this.fixed.style.top=this.tableParentOtherOffset):this.fixed.style.position="relative";var t=!1;t||(this.fixedContainer.style.paddingLeft=this.measureBefore+"px",this.fixedContainer.style.paddingRight=this.measureInside+this.measureAfter+"px")},Q.prototype.scrollTo=function(t){this.$scrollHandler.scrollLeft(this.tableParentOffset+t*this.cellSize)},Q.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.left,this.tableParentOtherOffset=t.top,this.windowSize=this.$scrollHandler.width(),this.windowScrollPosition=this.$scrollHandler.scrollLeft(),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns")},A.prototype.destroy=function(){this.vertical.destroy(),this.horizontal.destroy()},A.prototype.refresh=function(){this.horizontal.readSettings(),this.vertical.readSettings(),this.horizontal.prepare(),this.vertical.prepare(),this.horizontal.refresh(),this.vertical.refresh()},M.prototype.add=function(t){this.selected.push(t)},M.prototype.clear=function(){this.selected.length=0},M.prototype.getCorners=function(){var t,e,n,i,o,s=this.selected.length;if(s>0&&(t=n=this.selected[0][0],e=i=this.selected[0][1],s>1))for(o=1;s>o;o++)t>this.selected[o][0]?t=this.selected[o][0]:this.selected[o][0]>n&&(n=this.selected[o][0]),e>this.selected[o][1]?e=this.selected[o][1]:this.selected[o][1]>i&&(i=this.selected[o][1]);return[t,e,n,i]},M.prototype.draw=function(){var t,e,n,i,o,s=this.instance.wtTable.rowStrategy.countVisible(),r=this.instance.wtTable.columnStrategy.countVisible();if(this.selected.length){for(t=this.getCorners(),e=0;s>e;e++)for(n=0;r>n;n++)i=this.instance.wtTable.rowFilter.visibleToSource(e),o=this.instance.wtTable.columnFilter.visibleToSource(n),i>=t[0]&&t[2]>=i&&o>=t[1]&&t[3]>=o?this.instance.wtTable.currentCellCache.add(e,n,this.settings.className):i>=t[0]&&t[2]>=i?this.instance.wtTable.currentCellCache.add(e,n,this.settings.highlightRowClassName):o>=t[1]&&t[3]>=o&&this.instance.wtTable.currentCellCache.add(e,n,this.settings.highlightColumnClassName); +document.all&&!document.addEventListener&&(document.createElement("ui-handsontable"),document.createElement("datacolumn"),document.createElement("optionlist")),angular.module("uiHandsontable",[]).factory("getHandsontableSettings",function(){return function(t){var e=t.data("uiDatagrid");return e||(e={settings:{columns:[],colHeaders:!0,outsideClickDeselects:!0,autoComplete:[]},$container:$('
')},t.data("uiDatagrid",e)),e}}).factory("getDatacolumnSettings",function(){return function(t){var e=t.data("uiDatagridDatacolumn");return e||(e={},t.data("uiDatagridDatacolumn",e)),e}}).directive("uiHandsontable",function(t,e,n){for(var i=["data","width","height","startRows","startCols","minRows","minCols","maxRows","maxCols","minSpareRows","minSpareCols","multiSelect","fillHandle","fixedRowsTop","fixedColumnsLeft","undo","outsideClickDeselects","enterBeginsEditing","enterMoves","tabMoves","autoWrapRow","autoWrapCol","copyRowsLimit","copyColsLimit","pasteMode","currentRowClassName","currentColClassName","stretchH","isEmptyRow","isEmptyCol","observeDOMVisibility","allowInvalid","invalidCellClassName","fragmentSelection","readOnly"],o={selectedIndex:"=selectedindex"},s=0,r=i.length;r>s;s++)o[i[s]]="="+i[s].toLowerCase();var a={restrict:"EA",scope:o,priority:490,compile:function(o,s){var r,a,l,c=function(e,n,i){var o=n.optionList,s=o.match(/^\s*(.+)\s+in\s+(.*)\s*$/);if(!s)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+o+"'.");var r,a,l,c=s[1],u=s[2],h=e.$new();i.$container.on("blur","textarea",function(){l&&l()}),n.source=function(t,o){l&&l();var s=function(){var t=i.$container.data("handsontable"),n=t.getSelected()[0];return h[i.lhs]=e.$parent.$eval(i.rhs)[n],h.$eval(u)};r=s(),h.$$phase||h.$apply(),o(r),a.$apply(),l=e.$parent.$watch(s,function(e,i){e!==i&&setTimeout(function(){n.source(t,o)},0)}),n.saveOnBlur||(h.$eval(n.value+' = "'+$.trim(t).replace(/"/g,'"')+'"'),h.$apply())},n.sorter=function(t){return t},n.highlighter=function(e){var i,o=h.$new();return o[c]=e,a=o,n.transclude?n.transclude(o,function(t){i=t[0]}):i=t(""+n.optionTemplate+"")(o),i},n.onSelect=function(t,e,i,o,s){h[c]=r[s],h.$eval(n.clickrow),h.$apply()}},u=s.datarows;if(u&&(r=u.match(/^\s*(.+)\s+in\s+(.*)\s*$/)),!r)throw Error("Expected datarows in form of '_item_ in _collection_' but got '"+u+"'.");return a=r[1],l=r[2],function(t,o,s){var r,u,h=n(o);h.lhs=a,h.rhs=l,h.settings=angular.extend(h.settings,t.$parent.$eval(s.uiHandsontable||s.settings));for(r in i)i.hasOwnProperty(r)&&t[i[r]]!==void 0&&(h.settings[i[r]]=t[i[r]]);$(o).append(h.$container);var d=t.$parent.$eval(l);if(d!==void 0&&(h.settings.data=d),h.settings.columns){var p=RegExp("^("+a+"\\.)");for(r=0,u=h.settings.columns.length;u>r;r++)h.settings.columns[r].data=h.settings.columns[r].value.replace(p,""),"autocomplete"===h.settings.columns[r].type&&c(t,h.settings.columns[r],h)}h.settings.afterChange=function(){e.$$phase||t.$apply()},h.settings.afterSelectionByProp=function(e,n,i,o){t.$emit("datagridSelection",h.$container,e,n,i,o)},h.$container.handsontable(h.settings);var f=0;for(t.$watch(function(){if(t.$parent.$eval(l)!==h.$container.handsontable("getData"))return!0;var e=h.$container.data("handsontable"),n=e.countRows();if(f!==n)return f=n;for(var i="",o=e.countCols(),s=e.rowOffset(),r=s+e.countVisibleRows();r>s;s++)for(var a=0;o>a;a++)i+=e.getDataAtCell(s,a);return i},function(e,n){1==e?h.$container.handsontable("loadData",t.$parent.$eval(l)):e!==n&&h.$container.handsontable("render")},!1),r=0,u=i.length;u>r;r++)(function(e){t.$watch(e,function(n,i){if(n!==i){if("columns"===e)for(var o=RegExp("^("+a+"\\.)"),s=0,r=n.length;r>s;s++)n[s].data=n[s].value.replace(o,""),"autocomplete"===n[s].type&&c(t,n[s],h);var l={};l[e]=n,h.$container.handsontable("updateSettings",l)}},!0)})(i[r])}}};return a}).directive("datacolumn",function(t,e){var n={restrict:"E",priority:500,compile:function(n,i){return function(n,o,s){var r,a=t(o.parent()),l=e(o),c=n.$parent.$eval(s.title),u=n.$parent.$eval(s.width),h=n.$parent.$eval(s.type),d=s.options,p=[];for(r in s)i.hasOwnProperty(r)&&p.push(r);l.value=s.value,l.source=null,l.saveOnBlur=-1!==$.inArray("saveonblur",p),l.strict=-1!==$.inArray("strict",p);var f=n.$new(),m=n.$parent.$eval(d)||{};switch(m.value=s.value,m.type=h,m.title=c,m.width=u,h){case"autocomplete":for(r in l)l.hasOwnProperty(r)&&(m[r]=l[r]);break;case"checkbox":s.checkedtemplate!==void 0&&(m.checkedTemplate=n.$parent.$eval(s.checkedtemplate)),s.uncheckedtemplate!==void 0&&(m.uncheckedTemplate=n.$parent.$eval(s.uncheckedtemplate))}s.readonly!==void 0&&(m.readOnly=!0);for(r in s)s.hasOwnProperty(r)&&"$"!==r.charAt(0)&&m[r]===void 0&&(m[r]=f.$eval(s[r]));a.settings.columns.push(m)}}};return n}).directive("optionlist",function(t){var e={restrict:"E",transclude:"element",priority:510,compile:function(e,n,i){return function(e,n,o){var s=t(n.parent());s.optionList=o.datarows,s.clickrow=o.clickrow,s.transclude=i}}};return e}).directive("selectedindex",function(t){var e={restrict:"A",priority:491,compile:function(){return function(e,n){var i,o,s,r=t(n).$container;t(n).settings.afterSelection=function(t,n){i=!0,o=t,s=n,e.$$phase||void 0===e.selectedIndex||e.selectedIndex==t||e.$apply(function(){e.selectedIndex=t})},t(n).settings.afterDeselect=function(){i=!1,o=null,e.$$phase||void 0===e.selectedIndex||null==e.selectedIndex||e.$apply(function(){e.selectedIndex=null})},e.$watch("selectedIndex",function(t){var e=parseInt(t,10);if(t!==void 0&&null!==t&&e!==o){var n=s||0;r.handsontable("selectCell",e,n,e,n,!0)}},!1)}}};return e}),Array.prototype.filter||(Array.prototype.filter=function(t,e){"use strict";if(this===void 0||null===this)throw new TypeError;if("function"!=typeof t)throw new TypeError;e=e||this;var n,i,o=this.length,s=[];for(n=0;o>n;n+=1)this.hasOwnProperty(n)&&(i=this[n],t.call(e,i,n,this)&&s.push(i));return s});var Handsontable={extension:{},helper:{}};(function(t,e,n){"use strict";function i(t){this.instance=t,this.createElements(),this.bindEvents()}function o(t){this.instance=t,this.createElements(),this.bindEvents(),this.emptyStringLabel="   "}function s(t,e,i,o){n.helper.stringify(t.getDataAtRowProp(e,i))===n.helper.stringify(o.checkedTemplate)?t.setDataAtRowProp(e,i,o.uncheckedTemplate):t.setDataAtRowProp(e,i,o.checkedTemplate)}function r(e){if(!t.datepicker)throw Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?");this.isCellEdited=!1,this.instance=e,this.createElements(),this.bindEvents()}function a(t){this.instance=t,this.createElements(),this.bindEvents()}function l(){var t,e=this,i=5;this.beforeInit=function(){this.autoColumnWidths=[],this.autoColumnSizeTmp={thead:null,theadTh:null,theadStyle:null,tbody:null,tbodyTd:null,noRenderer:null,noRendererTd:null,renderer:null,rendererTd:null,container:null,containerStyle:null}},this.determineColumnWidth=function(e){var o,s=t.autoColumnSizeTmp;s.container||(o=document,s.thead=o.createElement("table"),s.thead.appendChild(o.createElement("thead")).appendChild(o.createElement("tr")).appendChild(o.createElement("th")),s.theadTh=s.thead.getElementsByTagName("th")[0],s.thead.className="htTable",s.theadStyle=s.thead.style,s.theadStyle.tableLayout="auto",s.theadStyle.width="auto",s.tbody=s.thead.cloneNode(!1),s.tbody.appendChild(o.createElement("tbody")).appendChild(o.createElement("tr")).appendChild(o.createElement("td")),s.tbodyTd=s.tbody.getElementsByTagName("td")[0],s.noRenderer=s.tbody.cloneNode(!0),s.noRendererTd=s.noRenderer.getElementsByTagName("td")[0],s.renderer=s.tbody.cloneNode(!0),s.rendererTd=s.renderer.getElementsByTagName("td")[0],s.container=o.createElement("div"),s.container.className=t.rootElement[0].className+" hidden",s.containerStyle=s.container.style,s.container.appendChild(s.thead),s.container.appendChild(s.tbody),s.container.appendChild(s.noRenderer),s.container.appendChild(s.renderer),t.rootElement[0].parentNode.appendChild(s.container)),s.container.className=t.rootElement[0].className+" hidden";var r=t.$table[0].className;s.thead.className=r,s.tbody.className=r;for(var a=t.countRows(),l={},c=0,u=0;a>u;u++){var h=n.helper.stringify(t.getDataAtCell(u,e)),d=h.length;d>c&&(c=d),l[d]||(l[d]={needed:i,strings:[]}),l[d].needed&&(l[d].strings.push(h),l[d].needed--)}var p=t.getSettings();p.colHeaders&&t.view.appendColHeader(e,s.theadTh);var f="";for(var m in l)if(l.hasOwnProperty(m))for(var g=0,w=l[m].strings.length;w>g;g++)f+=l[m].strings[g]+"
";s.tbodyTd.innerHTML=f,t.view.wt.wtDom.empty(s.rendererTd),t.view.wt.wtDom.empty(s.noRendererTd),s.containerStyle.display="block";var v=t.view.wt.wtDom.outerWidth(s.container),y=t.getCellMeta(0,e);if(y.renderer){var b=9999999999;s.noRendererTd.appendChild(document.createTextNode(b));var C=n.helper.getCellMethod("renderer",y.renderer);C(t,s.rendererTd,0,e,t.colToProp(e),b,y),v+=t.view.wt.wtDom.outerWidth(s.renderer)-t.view.wt.wtDom.outerWidth(s.noRenderer)}var S=t.view.wt.wtViewport.getViewportWidth()-2;return v>S&&(v=S),s.containerStyle.display="none",v},this.determineColumnsWidth=function(){t=this;var n=this.getSettings();if(n.autoColumnSize||!n.colWidths)for(var i=this.countCols(),o=0;i>o;o++)t._getColWidthFromSettings(o)||(this.autoColumnWidths[o]=e.determineColumnWidth(o))},this.getColWidth=function(t,e){this.autoColumnWidths[t]&&this.autoColumnWidths[t]>e.width&&(e.width=this.autoColumnWidths[t])},this.afterDestroy=function(){t=this,t.autoColumnSizeTmp.container&&t.autoColumnSizeTmp.container.parentNode.removeChild(t.autoColumnSizeTmp.container)}}function c(){function t(t){return function(e,n){return e[1]===n[1]?0:null===e[1]?1:null===n[1]?-1:e[1]n[1]?t?1:-1:0}}function e(t){return function(e,n){if(e[1]===n[1])return 0;if(null===e[1])return 1;if(null===n[1])return-1;var i=new Date(e[1]),o=new Date(n[1]);return o>i?t?-1:1:i>o?t?1:-1:0}}var n,i=this;this.init=function(t){var e,o,a=this,l=a.getSettings().columnSorting;if(n=Boolean(l)){a.sortIndex=[];var c=s.call(a);c!==void 0?(e=c.sortColumn,o=c.sortOrder):(e=l.column,o=l.sortOrder),i.sortByColumn.call(a,e,o),"afterInit"==t&&r.call(a)}},this.setSortingColumn=function(t,e){var n=this;return t===void 0?(delete n.sortColumn,delete n.sortOrder,void 0):(n.sortOrder=n.sortColumn===t&&e===void 0?!n.sortOrder:e!==void 0?e:!0,n.sortColumn=t,void 0)},this.sortByColumn=function(t,e){var n=this;i.setSortingColumn.call(n,t,e),i.sort.call(n),n.render(),o.call(n),n.PluginHooks.run("afterSorting")};var o=function(){var t=this,e={};t.sortColumn!==void 0&&(e.sortColumn=t.sortColumn),t.sortOrder!==void 0&&(e.sortOrder=t.sortOrder),(e.hasOwnProperty("sortColumn")||e.hasOwnProperty("sortOrder"))&&t.PluginHooks.run("persistentStateSave","columnSorting",e)},s=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","columnSorting",e),e.value},r=function(){function t(){var t=n.view.TBODY.querySelector("tr").querySelectorAll("th");return t.length}function e(e){var i=n.view.wt.wtDom.closest(e,"TH");return n.view.wt.wtDom.index(i)-t()}var n=this;n.rootElement.on("click.handsontable",".columnSorting",function(t){if(n.view.wt.wtDom.hasClass(t.target,"columnSorting")){var o=e(t.target);i.sortByColumn.call(n,o)}})};this.sort=function(){var i=this;if(void 0!==i.sortOrder){n=!1,i.sortIndex.length=0;for(var o=this.colOffset(),s=0,r=this.countRows()-i.getSettings().minSpareRows;r>s;s++)this.sortIndex.push([s,i.getDataAtCell(s,this.sortColumn+o)]);var a,l=i.getCellMeta(0,i.sortColumn);switch(l.type){case"date":a=e;break;default:a=t}this.sortIndex.sort(a(i.sortOrder));for(var s=this.sortIndex.length;i.countRows()>s;s++)this.sortIndex.push([s,i.getDataAtCell(s,this.sortColumn+o)]);n=!0}},this.translateRow=function(t){return n&&this.sortIndex&&this.sortIndex.length?this.sortIndex[t][0]:t},this.onBeforeGetSet=function(t){var e=this;t.row=i.translateRow.call(e,t.row)},this.untranslateRow=function(t){if(n&&this.sortIndex&&this.sortIndex.length)for(var e=0;this.sortIndex.length>e;e++)if(this.sortIndex[e][0]==t)return e},this.getColHeader=function(t,e){this.getSettings().columnSorting&&this.view.wt.wtDom.addClass(e.querySelector(".colHeader"),"columnSorting")},this.afterChangeSort=function(t){var e=this,n=!1,o={};if(t){for(var s=0;t.length>s;s++)if(t[s][1]==e.sortColumn){n=!0,o.row=i.translateRow.call(e,t[s][0]),o.col=t[s][1];break}n&&setTimeout(function(){i.sort.call(e),e.render(),e.selectCell(i.untranslateRow.call(e,o.row),o.col)},0)}}}function u(){function e(t){var e=s.getSelected();if(e)switch(t){case"row_above":s.alter("insert_row",e[0]);break;case"row_below":s.alter("insert_row",e[2]+1);break;case"col_left":s.alter("insert_col",e[1]);break;case"col_right":s.alter("insert_col",e[3]+1);break;case"remove_row":s.alter(t,e[0],e[2]-e[0]+1);break;case"remove_col":s.alter(t,e[1],e[3]-e[1]+1);break;case"undo":s.undo();break;case"redo":s.redo()}}function n(t){return s.countRows()>=s.getSettings().maxRows&&("row_above"===t||"row_below"===t)?!0:s.countCols()>=s.getSettings().maxCols&&("col_left"===t||"col_right"===t)?!0:!1}var i,o,s=this,r=s.rootElement[0].id,a={row_above:{name:"Insert row above",disabled:n},row_below:{name:"Insert row below",disabled:n},hsep1:"---------",col_left:{name:"Insert column on the left",disabled:n},col_right:{name:"Insert column on the right",disabled:n},hsep2:"---------",remove_row:{name:"Remove row",disabled:n},remove_col:{name:"Remove column",disabled:n},hsep3:"---------",undo:{name:"Undo",disabled:function(){return!s.isUndoAvailable()}},redo:{name:"Redo",disabled:function(){return!s.isRedoAvailable()}}},l={selector:"#"+r+" table, #"+r+" div",trigger:"right",callback:e},c={},u=s.getSettings();if(u.contextMenu){if(u.contextMenu===!0)c.items=a;else if("[object Array]"===Object.prototype.toString.apply(u.contextMenu))for(c.items={},i=0,o=u.contextMenu.length;o>i;i++){var h=u.contextMenu[i];if(a[h]===void 0)throw Error('Context menu key "'+h+'" is not recognised');c.items[h]=a[h]}else if("[object Object]"===Object.prototype.toString.apply(u.contextMenu)){if(c=u.contextMenu,c.items)for(i in c.items)c.items.hasOwnProperty(i)&&a[i]&&(c.items[i]="string"==typeof c.items[i]?a[i]:t.extend(!0,a[i],c.items[i]));else c.items=a;if(c.callback){var d=l.callback,p=c.callback;c.callback=function(t,e){d(t,e),p(t,e)}}}if(!r)throw Error("Handsontable container must have an id");t.contextMenu(t.extend(!0,l,c))}}function h(){var e=this.rootElement[0].id;t.contextMenu("destroy","#"+e+" table, #"+e+" div")}function d(){var e,n,i,o,s,r,a=document.createElement("DIV"),l=a.style;a.className="ghost",l.position="absolute",l.top="25px",l.left=0,l.width="10px",l.height="10px",l.backgroundColor="#CCC",l.opacity=.7,t(document).mousemove(function(t){n&&(l.left=r+t.pageX-s+6+"px","none"===l.display&&(l.display="block"))}),t(document).mouseup(function(){n&&(o>i&&o--,e.getSettings().rowHeaders&&(i--,o--),e.manualColumnPositions.splice(o,0,e.manualColumnPositions.splice(i,1)[0]),t(".manualColumnMover.active").removeClass("active"),n=!1,e.forceFullRender=!0,e.view.render(),l.display="none",c.call(e),e.PluginHooks.run("afterColumnMove",i,o))});var c=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnPositions",t.manualColumnPositions)},u=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnPositions",e),e.value},h=function(){var t=this;this.rootElement.on("mousedown.handsontable",".manualColumnMover",function(o){e=t;var c=o.currentTarget,u=e.view.wt.wtDom.closest(c,"TH");i=e.view.wt.wtDom.index(u),n=!0,s=o.pageX;var h=e.$table[0];h.parentNode.appendChild(a),l.width=e.view.wt.wtDom.outerWidth(u)+"px",l.height=e.view.wt.wtDom.outerHeight(h)+"px",r=parseInt(e.view.wt.wtDom.offset(u).left-e.view.wt.wtDom.offset(h).left,10),l.left=r+6+"px"}),this.rootElement.on("mouseenter.handsontable","td, th",function(){if(n){var t=e.view.THEAD.querySelector(".manualColumnMover.active");t&&e.view.wt.wtDom.removeClass(t,"active"),o=e.view.wt.wtDom.index(this);var i=e.view.THEAD.querySelectorAll("th"),s=i[o].querySelector(".manualColumnMover");e.view.wt.wtDom.addClass(s,"active")}})};this.beforeInit=function(){this.manualColumnPositions=[]},this.init=function(t){var e=this,n=Boolean(this.getSettings().manualColumnMove);if(n){var i=this.getSettings().manualColumnMove,o=u.call(e);this.manualColumnPositions=o!==void 0?o:i instanceof Array?i:[],e.forceFullRender=!0,"afterInit"==t&&(h.call(this),this.manualColumnPositions.length>0&&(this.forceFullRender=!0,this.render()))}else this.manualColumnPositions=[]},this.modifyCol=function(t){return this.getSettings().manualColumnMove?(this.manualColumnPositions[t]===void 0&&(this.manualColumnPositions[t]=t),this.manualColumnPositions[t]):t},this.getColHeader=function(t,e){if(this.getSettings().manualColumnMove){var n=document.createElement("DIV");n.className="manualColumnMover",e.firstChild.appendChild(n)}}}function p(){function e(t){c=this,s=t;var e=this.view.wt.wtTable.getCoords(t)[1];if(e>=0){r=e;var i=this.view.wt.wtDom.offset(this.rootElement[0]).left,o=this.view.wt.wtDom.offset(t).left;p=o-i-6,m.style.left=p+n.call(c,t)+"px",this.rootElement[0].appendChild(m)}}function n(t){var e=this,n=e.view.wt.wtDom.offset(t).left-e.view.wt.wtDom.offset(t).left,i=e.view.wt.wtDom.offset(e.rootElement[0]).left,o=e.view.wt.wtTable.getCoords(t)[1],s=e.getColWidth(o),r=e.view.maximumVisibleElementWidth(n-i);return Math.min(s,r)}function i(){d=n.call(this,s),this.view.wt.wtDom.addClass(m,"active"),v.height=this.view.wt.wtDom.outerHeight(this.$table[0])+"px",o=!0}var o,s,r,a,l,c,u,h,d,p,f=0,m=document.createElement("DIV"),g=document.createElement("DIV"),w=document.createElement("DIV"),v=w.style;m.className="manualColumnResizer",g.className="manualColumnResizerHandle",m.appendChild(g),w.className="manualColumnResizerLine",m.appendChild(w);var y=t(document);y.mousemove(function(t){o&&(a=d+(t.pageX-h),u=T(r,a),m.style.left=p+a+"px")}),y.mouseup(function(){o&&(c.view.wt.wtDom.removeClass(m,"active"),o=!1,c.forceFullRender=!0,c.view.render(),b.call(c),c.PluginHooks.run("afterColumnResize",r,u),e.call(c,s))});var b=function(){var t=this;t.PluginHooks.run("persistentStateSave","manualColumnWidths",t.manualColumnWidths)},C=function(){var t=this,e={};return t.PluginHooks.run("persistentStateLoad","manualColumnWidths",e),e.value},S=function(){var t=this;this.rootElement.on("mouseenter.handsontable","th",function(n){o||e.call(t,n.currentTarget)}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(){null==l&&(l=setTimeout(function(){f>=2&&(T(r,W.determineColumnWidth.call(t,r)),t.forceFullRender=!0,t.view.render(),t.PluginHooks.run("afterColumnResize",r,u)),f=0,l=null},500)),f++}),this.rootElement.on("mousedown.handsontable",".manualColumnResizer",function(e){h=e.pageX,i.call(t)})};this.beforeInit=function(){this.manualColumnWidths=[]},this.init=function(t){var e=this,n=Boolean(this.getSettings().manualColumnResize);if(n){var i=this.getSettings().manualColumnResize,o=C.call(e);this.manualColumnWidths=o!==void 0?o:i instanceof Array?i:[],"afterInit"==t&&(S.call(this),e.forceFullRender=!0,e.render())}};var T=function(t,e){return e=Math.max(e,20),t=c.PluginHooks.execute("modifyCol",t),c.manualColumnWidths[t]=e,e};this.getColWidth=function(t,e){this.getSettings().manualColumnResize&&this.manualColumnWidths[t]&&(e.width=this.manualColumnWidths[t])}}function f(){function t(e,n){for(var i in n)if(n.hasOwnProperty(i)){var o=n[i];o instanceof Object&&(Object.unobserve(o,e),o.____Path=n.____Path+"/"+i,t(e,o))}}function n(t,e){delete e.____Path,Object.observe(e,t);for(var i=0,o=e.length;o>i;i++){var s=e[i];s instanceof Object&&n(t,s)}}function i(i,r){var h=[],d=i;if(Object.observe)var p=function(e){if(!d.___Path){Object.unobserve(d,p),d.____Path="",t(p,d);for(var i=0,o=e.length;o>m;m++){var s=e[i];"____Path"!=s.name&&l[s.type].call(s,h,s.object.____Path)}n(p,d)}r&&r.call(h)};else{p={};for(var f,m=0,g=c.length;g>m;m++)if(c[m].obj===i){f=c[m];break}if(f||(f={obj:i},c.push(f)),f.value=a(i),r){u.push(r);var w,v=[100],y=0,b=function(){var t=s(p);t.length>0&&(p.patches=[],r.call(null,t))},C=function(){clearTimeout(w),w=setTimeout(function(){b(),y=0,w=setTimeout(S,v[y++])},0)},S=function(){b(),y==v.length&&(y=v.length-1),w=setTimeout(S,v[y++])};e.addEventListener?(e.addEventListener("mousedown",C),e.addEventListener("mouseup",C),e.addEventListener("keydown",C)):(e.attachEvent("onmousedown",C),e.attachEvent("onmouseup",C),e.attachEvent("onkeydown",C)),w=setTimeout(S,v[y++])}}return p.patches=h,p.object=i,o(p,i,h)}function o(t,e,n){Object.observe&&Object.observe(e,t);for(var i in e)if(e.hasOwnProperty(i)){var s=e[i];s&&"object"==typeof s&&o(t,s,n)}return t}function s(t){if(Object.observe)Object.deliverChangeRecords(t);else{for(var e,n=0,i=c.length;i>n;n++)if(c[n].obj===t.object){e=c[n];break}r(e.value,t.object,t.patches,"")}return t.patches}function r(t,e,n,i){var o,s=[],a=[];for(o in e)e.hasOwnProperty(o)&&s.push(o);for(o in t)t.hasOwnProperty(o)&&a.push(o);var l,c=!1,u=!1;for(l=0;a.length>l;l++){o=a[l];var h=t[o];if(e.hasOwnProperty(o)){var d=e[o];h instanceof Object?r(h,d,n,i+"/"+o):h!=d&&(c=!0,n.push({op:"replace",path:i+"/"+o,value:d}),t[o]=d)}else n.push({op:"remove",path:i+"/"+o}),u=!0}if(u||s.length!=a.length)for(l=0;s.length>l;l++)o=s[l],t.hasOwnProperty(o)||n.push({op:"add",path:i+"/"+o,value:e[o]})}function a(t){if(null===t||!(t instanceof Object))return t;var e,n=t.constructor;e=new n;for(var i in t)t.hasOwnProperty(i)&&(e[i]=a(t[i]));return e}var l={"new":function(t,e){var n={op:"add",path:e+"/"+this.name,value:this.object[this.name]};t.push(n)},deleted:function(t,e){var n={op:"remove",path:e+"/"+this.name};t.push(n)},updated:function(t,e){var n={op:"replace",path:e+"/"+this.name,value:this.object[this.name]};t.push(n)}},c=[],u=[];this.afterLoadData=function(){if(!this.observer&&this.getSettings().observeChanges){var t=this;this.observer=i(this.getData(),function(){t.render()})}}}function m(t){var n,i=function(){e.localStorage[t+"__"+"persistentStateKeys"]=JSON.stringify(n)},o=function(){var i=e.localStorage[t+"__"+"persistentStateKeys"],o="string"==typeof i?JSON.parse(i):void 0;n=o?o:[]},s=function(){n=[],i()};o(),this.saveValue=function(o,s){e.localStorage[t+"_"+o]=JSON.stringify(s),-1==n.indexOf(o)&&(n.push(o),i())},this.loadValue=function(n,i){n=n!==void 0?n:i;var o=e.localStorage[t+"_"+n];return o===void 0?void 0:JSON.parse(o)},this.reset=function(n){e.localStorage.removeItem(t+"_"+n)},this.resetAll=function(){for(var i=0;n.length>i;i++)e.localStorage.removeItem(t+"_"+n[i]);s()}}function g(){var t,e,n=this;this.copyCallbacks=[],this.cutCallbacks=[],this.pasteCallbacks=[];var i=document.documentElement;e=document.body,document.getElementById("CopyPasteDiv")?(this.elDiv=document.getElementById("CopyPasteDiv"),this.elTextarea=this.elDiv.firstChild):(this.elDiv=document.createElement("DIV"),this.elDiv.id="CopyPasteDiv",t=this.elDiv.style,t.position="fixed",t.top=0,t.left=0,e.appendChild(this.elDiv),this.elTextarea=document.createElement("TEXTAREA"),this.elTextarea.className="copyPaste",t=this.elTextarea.style,t.width="1px",t.height="1px",this.elDiv.appendChild(this.elTextarea),t.opacity!==void 0&&(t.opacity=0)),this._bindEvent(i,"keydown",function(t){var e=!1;if(t.metaKey?e=!0:t.ctrlKey&&-1===navigator.userAgent.indexOf("Mac")&&(e=!0),e){if(document.activeElement!==n.elTextarea&&(""!=n.getSelectionText()||-1!=["INPUT","SELECT","TEXTAREA"].indexOf(document.activeElement.nodeName)))return;n.selectNodeText(n.elTextarea),setTimeout(function(){n.selectNodeText(n.elTextarea)},0)}!e||67!==t.keyCode&&86!==t.keyCode&&88!==t.keyCode||(88===t.keyCode?setTimeout(function(){n.triggerCut(t)},0):86===t.keyCode&&setTimeout(function(){n.triggerPaste(t)},0))})}function w(e,n){var i;this.instance=e,this.settings=n,this.wtDom=this.instance.wtDom,this.main=document.createElement("div"),i=this.main.style,i.position="absolute",i.top=0,i.left=0;for(var o=0;5>o;o++){var s=document.createElement("DIV");s.className="wtBorder "+(n.className||""),i=s.style,i.backgroundColor=n.border.color,i.height=n.border.width+"px",i.width=n.border.width+"px",this.main.appendChild(s)}this.top=this.main.childNodes[0],this.left=this.main.childNodes[1],this.bottom=this.main.childNodes[2],this.right=this.main.childNodes[3],this.topStyle=this.top.style,this.leftStyle=this.left.style,this.bottomStyle=this.bottom.style,this.rightStyle=this.right.style,this.corner=this.main.childNodes[4],this.corner.className+=" corner",this.cornerStyle=this.corner.style,this.cornerStyle.width="5px",this.cornerStyle.height="5px",this.cornerStyle.border="2px solid #FFF",this.disappear(),e.wtTable.bordersHolder||(e.wtTable.bordersHolder=document.createElement("div"),e.wtTable.bordersHolder.className="htBorders",e.wtTable.hider.appendChild(e.wtTable.bordersHolder)),e.wtTable.bordersHolder.appendChild(this.main);var r=!1,a=t(document.body);a.on("mousedown.walkontable."+e.guid,function(){r=!0}),a.on("mouseup.walkontable."+e.guid,function(){r=!1}),t(this.main.childNodes).on("mouseenter",function(n){if(r&&e.getSetting("hideBorderOnMouseDownOver")){n.preventDefault(),n.stopImmediatePropagation();var i=this.getBoundingClientRect(),o=t(this);o.hide();var s=function(t){return t.clientYMath.ceil(i.top+i.height)?!0:t.clientXMath.ceil(i.left+i.width)?!0:void 0};a.on("mousemove.border."+e.guid,function(t){s(t)&&(a.off("mousemove.border."+e.guid),o.show())})}})}function v(){this.offset=0,this.total=0,this.fixedCount=0}function y(){}function b(){this.cache=[]}function C(){this.countTH=0}function S(t,e,n){var i,o=0;for(this.containerSizeFn=t,this.cellSizesSum=0,this.cellSizes=[],this.cellStretch=[],this.cellCount=0,this.remainingSize=0,this.strategy=n;;){if(i=e(o),void 0===i)break;if(this.cellSizesSum>=this.getContainerSize(this.cellSizesSum+i))break;this.cellSizes.push(i),this.cellSizesSum+=i,this.cellCount++,o++}var s=this.getContainerSize(this.cellSizesSum);this.remainingSize=this.cellSizesSum-s}function T(t){var i=this,o=[];if(this.guid="wt_"+(e.Handsontable?n.helper.randomString():""),this.wtSettings=new O(this,t),this.wtDom=new x,this.wtTable=new $(this),this.wtScroll=new D(this),this.wtScrollbars=new A(this),this.wtViewport=new I(this),this.wtWheel=new V(this),this.wtEvent=new E(this),this.wtTable.THEAD.childNodes.length&&this.wtTable.THEAD.childNodes[0].childNodes.length){for(var s=0,r=this.wtTable.THEAD.childNodes[0].childNodes.length;r>s;s++)o.push(this.wtTable.THEAD.childNodes[0].childNodes[s].innerHTML);this.getSetting("columnHeaders").length||this.update("columnHeaders",[function(t,e){i.wtDom.fastInnerText(e,o[t])}])}this.selections={};var a=this.getSetting("selections");if(a)for(var l in a)a.hasOwnProperty(l)&&(this.selections[l]=new M(this,a[l]));this.drawn=!1,this.drawInterrupted=!1}function x(){}function E(e){var n=this;this.instance=e,this.wtDom=this.instance.wtDom;var i=[null,null,null,null];this.instance.dblClickTimeout=null;var o,s=function(t){var e=n.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?n.instance.hasSetting("onCellMouseDown")&&n.instance.getSetting("onCellMouseDown",t,e.coords,e.TD):n.wtDom.hasClass(t.target,"corner")&&n.instance.getSetting("onCellCornerMouseDown",t,t.target),2!==t.button&&(e.TD&&"TD"===e.TD.nodeName?(i.shift(),i.push(e.TD)):n.wtDom.hasClass(t.target,"corner")&&(i.shift(),i.push(t.target)))},r=function(t){if(n.instance.hasSetting("onCellMouseOver")){var e=n.instance.wtTable.TABLE,i=n.wtDom.closest(t.target,["TD","TH"],e);i&&i!==o&&n.wtDom.isChildOf(i,e)&&(o=i,"TD"===i.nodeName&&n.instance.getSetting("onCellMouseOver",t,n.instance.wtTable.getCoords(i),i))}},a=function(t){if(2!==t.button){var e=n.parentCell(t.target);e.TD&&"TD"===e.TD.nodeName?(i.shift(),i.push(e.TD)):(i.shift(),i.push(t.target)),null!==i[3]&&i[3]===i[2]&&(n.instance.dblClickTimeout&&i[2]===i[1]&&i[1]===i[0]?(e.TD?n.instance.getSetting("onCellDblClick",t,e.coords,e.TD):n.wtDom.hasClass(t.target,"corner")&&n.instance.getSetting("onCellCornerDblClick",t,e.coords,e.TD),clearTimeout(n.instance.dblClickTimeout),n.instance.dblClickTimeout=null):(clearTimeout(n.instance.dblClickTimeout),n.instance.dblClickTimeout=setTimeout(function(){n.instance.dblClickTimeout=null},500)))}};t(this.instance.wtTable.parent).on("mousedown",s),t(this.instance.wtTable.TABLE).on("mouseover",r),t(this.instance.wtTable.parent).on("mouseup",a)}function k(){}function R(t,e){this.containerSizeFn=t,this.sizeAtIndex=e,this.cellSizesSum=0,this.cellSizes=[],this.cellCount=0,this.remainingSize=-1/0}function D(t){this.instance=t}function P(){}function H(){this.lastWindowScrollPosition=0/0}function A(t){switch(t.getSetting("scrollbarModelV")){case"dragdealer":this.vertical=new K(t);break;case"native":this.vertical=new q(t)}switch(t.getSetting("scrollbarModelH")){case"dragdealer":this.horizontal=new U(t);break;case"native":this.horizontal=new Q(t)}}function M(t,e){this.instance=t,this.settings=e,this.selected=[],e.border&&(this.border=new w(t,e))}function O(t,e){var n=this;this.instance=t,this.defaults={table:void 0,scrollH:"auto",scrollV:"auto",scrollbarModelH:"dragdealer",scrollbarModelV:"dragdealer",stretchH:"hybrid",currentRowClassName:null,currentColumnClassName:null,data:void 0,offsetRow:0,offsetColumn:0,fixedColumnsLeft:0,fixedRowsTop:0,rowHeaders:function(){return[]},columnHeaders:function(){return[]},totalRows:void 0,totalColumns:void 0,width:null,height:null,cellRenderer:function(t,e,i){var o=n.getSetting("data",t,e);n.instance.wtDom.fastInnerText(i,void 0===o||null===o?"":o)},columnWidth:50,selections:null,hideBorderOnMouseDownOver:!1,onCellMouseDown:null,onCellMouseOver:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,beforeDraw:null,onDraw:null,scrollbarWidth:10,scrollbarHeight:10},this.settings={};for(var i in this.defaults)if(this.defaults.hasOwnProperty(i))if(void 0!==e[i])this.settings[i]=e[i];else{if(void 0===this.defaults[i])throw Error('A required setting "'+i+'" was not provided');this.settings[i]=this.defaults[i]}}function $(t){this.instance=t,this.TABLE=this.instance.getSetting("table"),this.wtDom=this.instance.wtDom,this.wtDom.removeTextNodes(this.TABLE);var e=this.TABLE.parentNode;if(!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var n=document.createElement("DIV");n.className="wtSpreader",e&&e.insertBefore(n,this.TABLE),n.appendChild(this.TABLE)}if(this.spreader=this.TABLE.parentNode,e=this.spreader.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var i=document.createElement("DIV");i.className="wtHider",e&&e.insertBefore(i,this.spreader),i.appendChild(this.spreader)}if(this.hider=this.spreader.parentNode,this.hiderStyle=this.hider.style,this.hiderStyle.position="relative",e=this.hider.parentNode,!e||1!==e.nodeType||!this.wtDom.hasClass(e,"wtHolder")){var o=document.createElement("DIV");o.style.position="relative",o.className="wtHolder",e&&e.insertBefore(o,this.hider),o.appendChild(this.hider)}if(this.parent=this.hider.parentNode,this.TBODY=this.TABLE.getElementsByTagName("TBODY")[0],this.TBODY||(this.TBODY=document.createElement("TBODY"),this.TABLE.appendChild(this.TBODY)),this.THEAD=this.TABLE.getElementsByTagName("THEAD")[0],this.THEAD||(this.THEAD=document.createElement("THEAD"),this.TABLE.insertBefore(this.THEAD,this.TBODY)),this.COLGROUP=this.TABLE.getElementsByTagName("COLGROUP")[0],this.COLGROUP||(this.COLGROUP=document.createElement("COLGROUP"),this.TABLE.insertBefore(this.COLGROUP,this.THEAD)),this.instance.getSetting("columnHeaders").length&&!this.THEAD.childNodes.length){var s=document.createElement("TR");this.THEAD.appendChild(s)}this.colgroupChildrenLength=this.COLGROUP.childNodes.length,this.theadChildrenLength=this.THEAD.firstChild?this.THEAD.firstChild.childNodes.length:0,this.tbodyChildrenLength=this.TBODY.childNodes.length,this.oldCellCache=new b,this.currentCellCache=new b,this.rowFilter=new k,this.columnFilter=new C,this.verticalRenderReverse=!1}function I(t){this.instance=t,this.resetSettings() +}function V(e){"native"!==e.getSetting("scrollbarModelV")&&"native"!==e.getSetting("scrollbarModelH")&&t(e.wtTable.TABLE).on("mousewheel",function(t,n,i,o){i||o||!n||(o=n),(i||o)&&(o>0&&0===e.getSetting("offsetRow")||0>o&&e.wtTable.isLastRowFullyVisible()||0>i&&0===e.getSetting("offsetColumn")||i>0&&e.wtTable.isLastColumnFullyVisible()||(clearTimeout(e.wheelTimeout),e.wheelTimeout=setTimeout(function(){o?e.wtScrollbars.vertical.visible&&e.scrollVertical(-Math.ceil(o)).draw():i&&e.wtScrollbars.horizontal.visible&&e.scrollHorizontal(Math.ceil(i)).draw()},0),t.preventDefault()))})}n.activeGuid=null,n.Core=function(i,o){function s(){var t=!1;return{validatorsInQueue:0,addValidatorToQueue:function(){this.validatorsInQueue++,t=!1},removeValidatorFormQueue:function(){this.validatorsInQueue=0>this.validatorsInQueue-1?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty:function(){},checkIfQueueIsEmpty:function(){0==this.validatorsInQueue&&0==t&&(t=!0,this.onQueueEmpty())}}}function r(e,n,i){function o(){var o;e.length&&(o=m.PluginHooks.execute("beforeChange",e,n),"function"==typeof o?t.when(result).then(function(){i()}):o===!1&&e.splice(0,e.length)),"function"!=typeof o&&i()}var r=new s;r.onQueueEmpty=o;for(var a=e.length-1;a>=0;a--)if(null===e[a])e.splice(a,1);else{var l=m.getCellMeta(e[a][0],u.propToCol(e[a][1]));"number"===l.dataType&&"string"==typeof e[a][3]&&e[a][3].length>0&&/^-?[\d\s]*\.?\d*$/.test(e[a][3])&&(e[a][3]=numeral().unformat(e[a][3]||"0")),l.validator&&(r.addValidatorToQueue(),m.validateCell(e[a][3],l,function(t,n){return function(i){if("boolean"!=typeof i)throw Error("Validation error: result is not boolean");i===!1&&n.allowInvalid===!1&&(e.splice(t,1),--t),r.removeValidatorFormQueue()}}(a,l),n))}r.checkIfQueueIsEmpty()}function a(t,e){var n=t.length-1;if(!(0>n)){for(;n>=0;n--)if(null!==t[n]){if(c.settings.minSpareRows)for(;t[n][0]>m.countRows()-1;)u.createRow();if("array"===c.dataType&&c.settings.minSpareCols)for(;u.propToCol(t[n][1])>m.countCols()-1;)u.createCol();u.set(t[n][0],t[n][1],t[n][3])}else t.splice(n,1);m.forceFullRender=!0,h.adjustRowsAndCols(),d.refreshBorders(null,!0),m.PluginHooks.run("afterChange",t,e||"edit")}}function l(e,n,i){return"object"==typeof e?e:t.isPlainObject(i)?i:[[e,n,i]]}var c,u,h,d,p,f,m=this,g=function(){};n.helper.inherit(g,N),n.helper.extend(g.prototype,o),this.rootElement=i;var w=t(document.documentElement),v=t(document.body);this.guid="ht_"+n.helper.randomString(),this.rootElement[0].id||(this.rootElement[0].id=this.guid),c={cellSettings:[],columnSettings:[],columnsSettingConflicts:["data","width"],settings:new g,settingsFromDOM:{},selStart:new n.SelectionPoint,selEnd:new n.SelectionPoint,editProxy:!1,isPopulated:null,scrollable:null,undoRedo:null,extensions:{},colToProp:null,propToCol:null,dataSchema:null,dataType:"array",firstRun:!0},u={recursiveDuckSchema:function(e){var n;if(t.isPlainObject(e)){n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=t.isPlainObject(e[i])?u.recursiveDuckSchema(e[i]):null)}else n=[];return n},recursiveDuckColumns:function(e,n,i){var o,s;if(n===void 0&&(n=0,i=""),t.isPlainObject(e))for(s in e)e.hasOwnProperty(s)&&(null===e[s]?(o=i+s,c.colToProp.push(o),c.propToCol[o]=n,n++):n=u.recursiveDuckColumns(e[s],n,s+"."));return n},createMap:function(){if(u.getSchema()===void 0)throw Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");var t,e,n=u.getSchema();if(c.colToProp=[],c.propToCol={},c.settings.columns)for(t=0,e=c.settings.columns.length;e>t;t++)c.colToProp[t]=c.settings.columns[t].data,c.propToCol[c.settings.columns[t].data]=t;else u.recursiveDuckColumns(n)},colToProp:function(t){return t=n.PluginHooks.execute(m,"modifyCol",t),c.colToProp&&c.colToProp[t]!==void 0?c.colToProp[t]:t},propToCol:function(t){var e;return e=c.propToCol[t]!==void 0?c.propToCol[t]:t,e=n.PluginHooks.execute(m,"modifyCol",e)},getSchema:function(){return c.settings.dataSchema?"function"==typeof c.settings.dataSchema?c.settings.dataSchema():c.settings.dataSchema:c.duckDataSchema},createRow:function(e){var n,i=m.countRows();if(("number"!=typeof e||e>=i)&&(e=i),"array"===c.dataType){n=[];for(var o=0,s=m.countCols();s>o;o++)n.push(null)}else n="function"===c.dataType?c.settings.dataSchema(e):t.extend(!0,{},u.getSchema());e===i?g.prototype.data.push(n):g.prototype.data.splice(e,0,n),m.PluginHooks.run("afterCreateRow",e),m.forceFullRender=!0},createCol:function(t){if("object"===c.dataType||c.settings.columns)throw Error("Cannot create new column. When data source in an object, you can only have as much columns as defined in first data row, data schema or in the 'columns' setting");var e=0,i=m.countRows(),o=g.prototype.data,s=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell);if("number"!=typeof t||t>=m.countCols()){for(;i>e;e++)o[e]===void 0&&(o[e]=[]),o[e].push(null);c.columnSettings.push(s)}else{for(;i>e;e++)o[e].splice(t,0,null);c.columnSettings.splice(t,0,s)}m.PluginHooks.run("afterCreateCol",t),m.forceFullRender=!0},removeRow:function(t,e){e||(e=1),"number"!=typeof t&&(t=-e);var n=this.physicalRowsToLogical(t,e);g.prototype.data=g.prototype.data.filter(function(t,e){return-1==n.indexOf(e)}),m.PluginHooks.run("afterRemoveRow",t,e),m.forceFullRender=!0},removeCol:function(t,e){if("object"===c.dataType||c.settings.columns)throw Error("cannot remove column with object data source or columns option specified");e||(e=1),"number"!=typeof t&&(t=-e);for(var n=g.prototype.data,i=0,o=m.countRows();o>i;i++)n[i].splice(t,e);m.PluginHooks.run("afterRemoveCol",t,e),c.columnSettings.splice(t,e),m.forceFullRender=!0},spliceCol:function(t,e,i){var o=arguments.length>=4?[].slice.call(arguments,3):[],s=m.getDataAtCol(t),r=s.slice(e,e+i),a=s.slice(e+i);n.helper.extendArray(o,a);for(var l=0;i>l;)o.push(null),l++;return n.helper.to2dArray(o),m.populateFromArray(e,t,o,null,null,"spliceCol"),r},spliceRow:function(t,e,i){var o=arguments.length>=4?[].slice.call(arguments,3):[],s=m.getDataAtRow(t),r=s.slice(e,e+i),a=s.slice(e+i);n.helper.extendArray(o,a);for(var l=0;i>l;)o.push(null),l++;return m.populateFromArray(t,e,[o],null,null,"spliceRow"),r},getVars:{},get:function(t,e){if(u.getVars.row=t,u.getVars.prop=e,m.PluginHooks.run("beforeGet",u.getVars),"string"==typeof u.getVars.prop&&u.getVars.prop.indexOf(".")>-1){var n=u.getVars.prop.split("."),i=c.settings.data[u.getVars.row];if(!i)return null;for(var o=0,s=n.length;s>o;o++)if(i=i[n[o]],i===void 0)return null;return i}return"function"==typeof u.getVars.prop?u.getVars.prop(c.settings.data.slice(u.getVars.row,u.getVars.row+1)[0]):c.settings.data[u.getVars.row]?c.settings.data[u.getVars.row][u.getVars.prop]:null},setVars:{},set:function(t,e,n,i){if(u.setVars.row=t,u.setVars.prop=e,u.setVars.value=n,m.PluginHooks.run("beforeSet",u.setVars,i||"datamapGet"),"string"==typeof u.setVars.prop&&u.setVars.prop.indexOf(".")>-1){for(var o=u.setVars.prop.split("."),s=c.settings.data[u.setVars.row],r=0,a=o.length-1;a>r;r++)s=s[o[r]];s[o[r]]=u.setVars.value}else"function"==typeof u.setVars.prop?u.setVars.prop(c.settings.data.slice(u.setVars.row,u.setVars.row+1)[0],u.setVars.value):c.settings.data[u.setVars.row][u.setVars.prop]=u.setVars.value},physicalRowsToLogical:function(t,e){for(var n=(g.prototype.data.length+t)%g.prototype.data.length,i=[],o=e;g.prototype.data.length>n&&o;)this.get(n,0),i.push(this.getVars.row),o--,n++;return i},clear:function(){for(var t=0;m.countRows()>t;t++)for(var e=0;m.countCols()>e;e++)u.set(t,u.colToProp(e),"")},getAll:function(){return c.settings.data},getRange:function(t,e){var n,i,o,s,r,a=[];for(i=Math.max(t.row,e.row),s=Math.max(t.col,e.col),n=Math.min(t.row,e.row);i>=n;n++){for(r=[],o=Math.min(t.col,e.col);s>=o;o++)r.push(u.get(n,u.colToProp(o)));a.push(r)}return a},getText:function(t,e){return SheetClip.stringify(u.getRange(t,e))}},h={alter:function(e,n,i,o,s){var r,a,l,p,f,g,w,v;switch(r=t.extend(!0,[],u.getAll()),e){case"insert_row":for(i||(i=1),v=0;i>v&&m.countRows()=n?(c.selStart.row(c.selStart.row()+v),d.transformEnd(v,0)):d.refreshBorders());break;case"insert_col":for(i||(i=1),v=0;i>v&&m.countCols()=n?(c.selStart.col(c.selStart.col()+v),d.transformEnd(0,v)):d.refreshBorders());break;case"remove_row":u.removeRow(n,i),h.adjustRowsAndCols(),d.refreshBorders();break;case"remove_col":u.removeCol(n,i),h.adjustRowsAndCols(),d.refreshBorders();break;default:throw Error('There is no such action "'+e+'"')}for(l=[],a=u.getAll(),p=0,f=a.length;f>p;p++)for(g=0,w=a[p].length;w>g;g++)l.push([p,g,r[p]?r[p][g]:null,a[p][g]]);m.PluginHooks.run("afterChange",l,o||e),s||h.adjustRowsAndCols()},adjustRowsAndCols:function(){var t,e,n,i=m.countEmptyRows(!0);if(e=m.countRows(),c.settings.minRows>e)for(t=0;c.settings.minRows-e>t;t++)u.createRow();if(c.settings.minSpareRows>i)for(;c.settings.minSpareRows>i&&m.countRows()n)for(;c.settings.minSpareCols>n&&m.countCols()c.settings.minRows&&c.settings.minSpareRows&&i>c.settings.minSpareRows;i--)u.removeRow();if(c.settings.enterBeginsEditing&&!c.settings.columns)for(;(c.settings.minCols||c.settings.minSpareCols)&&m.countCols()>c.settings.minCols&&c.settings.minSpareCols&&n>c.settings.minSpareCols;n--)u.removeCol();var o=m.countRows(),s=m.countCols();if((0===o||0===s)&&d.deselect(),c.selStart.exists()){var r,a=c.selStart.row(),l=c.selStart.col(),h=c.selEnd.row(),p=c.selEnd.col();a>o-1?(a=o-1,r=!0,h>a&&(h=a)):h>o-1&&(h=o-1,r=!0,a>h&&(a=h)),l>s-1?(l=s-1,r=!0,p>l&&(p=l)):p>s-1&&(p=s-1,r=!0,l>p&&(l=p)),r&&m.selectCell(a,l,h,p)}},populateFromArray:function(t,e,i,o,s){var r,a,l,u,h=[],d={};if(a=e.length,0===a)return!1;var p,f,g,w;switch(s){case"shift_down":for(p=i?i.col-t.col+1:0,f=i?i.row-t.row+1:0,e=n.helper.translateRowsToColumns(e),l=0,u=e.length,g=Math.max(u,p);g>l;l++)if(u>l){for(r=0,a=e[l].length;f-a>r;r++)e[l].push(e[l][r%a]);e[l].unshift(t.col+l,t.row,0),m.spliceCol.apply(m,e[l])}else e[l%u][0]=t.col+l,m.spliceCol.apply(m,e[l%u]);break;case"shift_right":for(p=i?i.col-t.col+1:0,f=i?i.row-t.row+1:0,r=0,a=e.length,w=Math.max(a,f);w>r;r++)if(a>r){for(l=0,u=e[r].length;p-u>l;l++)e[r].push(e[r][l%u]);e[r].unshift(t.row+r,t.col,0),m.spliceRow.apply(m,e[r])}else e[r%a][0]=t.row+r,m.spliceRow.apply(m,e[r%a]);break;case"overwrite":default:for(d.row=t.row,d.col=t.col,r=0;a>r&&!(i&&d.row>i.row||!c.settings.minSpareRows&&d.row>m.countRows()-1||d.row>=c.settings.maxRows);r++){for(d.col=t.col,u=e[r]?e[r].length:0,l=0;u>l&&!(i&&d.col>i.col||!c.settings.minSpareCols&&d.col>m.countCols()-1||d.col>=c.settings.maxCols);l++)m.getCellMeta(d.row,d.col).readOnly||h.push([d.row,d.col,e[r][l]]),d.col++,i&&l===u-1&&(l=-1);d.row++,i&&r===a-1&&(r=-1)}m.setDataAtCell(h,null,null,o||"populateFromArray")}},getCornerCoords:function(e){function n(e,n,i){function o(t){return t[i]}return Array.prototype.map?e.apply(Math,n.map(o)):e.apply(Math,t.map(n,o))}return{TL:{row:n(Math.min,e,"row"),col:n(Math.min,e,"col")},BR:{row:n(Math.max,e,"row"),col:n(Math.max,e,"col")}}},getCellsAtCoords:function(t,e){var n,i,o=h.getCornerCoords([t,e]),s=[];for(n=o.TL.row;o.BR.row>=n;n++)for(i=o.TL.col;o.BR.col>=i;i++)s.push(m.view.getCellAtCoords({row:n,col:i}));return s}},this.selection=d={inProgress:!1,begin:function(){m.selection.inProgress=!0},finish:function(){var t=m.getSelected();m.PluginHooks.run("afterSelectionEnd",t[0],t[1],t[2],t[3]),m.PluginHooks.run("afterSelectionEndByProp",t[0],m.colToProp(t[1]),t[2],m.colToProp(t[3])),m.selection.inProgress=!1},isInProgress:function(){return m.selection.inProgress},setRangeStart:function(t){c.selStart.coords(t),d.setRangeEnd(t)},setRangeEnd:function(t,e){m.selection.begin(),c.selEnd.coords(t),c.settings.multiSelect||c.selStart.coords(t),m.view.wt.selections.current.clear(),m.view.wt.selections.current.add(c.selStart.arr()),m.view.wt.selections.area.clear(),d.isMultiple()&&(m.view.wt.selections.area.add(c.selStart.arr()),m.view.wt.selections.area.add(c.selEnd.arr())),(c.settings.currentRowClassName||c.settings.currentColClassName)&&(m.view.wt.selections.highlight.clear(),m.view.wt.selections.highlight.add(c.selStart.arr()),m.view.wt.selections.highlight.add(c.selEnd.arr())),m.PluginHooks.run("afterSelection",c.selStart.row(),c.selStart.col(),c.selEnd.row(),c.selEnd.col()),m.PluginHooks.run("afterSelectionByProp",c.selStart.row(),u.colToProp(c.selStart.col()),c.selEnd.row(),u.colToProp(c.selEnd.col())),e!==!1&&m.view.scrollViewport(t),d.refreshBorders()},refreshBorders:function(t,e){e||p.destroy(t),m.view.render(),d.isSelected()&&!e&&p.prepare()},isMultiple:function(){return!(c.selEnd.col()===c.selStart.col()&&c.selEnd.row()===c.selStart.row())},transformStart:function(t,e,n){c.selStart.row()+t>m.countRows()-1?n&&c.settings.minSpareRows>0?m.alter("insert_row",m.countRows()):c.settings.autoWrapCol&&c.selStart.col()+ec.selStart.row()+t&&c.selStart.col()+e>=0&&(t=m.countRows()-1,e=-1),c.selStart.col()+e>m.countCols()-1?n&&c.settings.minSpareCols>0?m.alter("insert_col",m.countCols()):c.settings.autoWrapRow&&c.selStart.row()+tc.selStart.col()+e&&c.selStart.row()+t>=0&&(t=-1,e=m.countCols()-1);var i=m.countRows(),o=m.countCols(),s={row:c.selStart.row()+t,col:c.selStart.col()+e};0>s.row?s.row=0:s.row>0&&s.row>=i&&(s.row=i-1),0>s.col?s.col=0:s.col>0&&s.col>=o&&(s.col=o-1),d.setRangeStart(s)},transformEnd:function(t,e){if(c.selEnd.exists()){var n=m.countRows(),i=m.countCols(),o={row:c.selEnd.row()+t,col:c.selEnd.col()+e};0>o.row?o.row=0:o.row>0&&o.row>=n&&(o.row=n-1),0>o.col?o.col=0:o.col>0&&o.col>=i&&(o.col=i-1),d.setRangeEnd(o)}},isSelected:function(){return c.selEnd.exists()},inInSelection:function(t){if(!d.isSelected())return!1;var e=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]);return e.TL.row<=t.row&&e.BR.row>=t.row&&e.TL.col<=t.col&&e.BR.col>=t.col},deselect:function(){d.isSelected()&&(m.selection.inProgress=!1,c.selEnd=new n.SelectionPoint,m.view.wt.selections.current.clear(),m.view.wt.selections.area.clear(),p.destroy(),d.refreshBorders(),m.PluginHooks.run("afterDeselect"))},selectAll:function(){c.settings.multiSelect&&(d.setRangeStart({row:0,col:0}),d.setRangeEnd({row:m.countRows()-1,col:m.countCols()-1},!1))},empty:function(){if(d.isSelected()){var t,e,n=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]),i=[];for(t=n.TL.row;n.BR.row>=t;t++)for(e=n.TL.col;n.BR.col>=e;e++)m.getCellMeta(t,e).readOnly||i.push([t,e,""]);m.setDataAtCell(i)}}},this.autofill=f={handle:null,init:function(){f.handle?f.handle.disabled=!1:f.handle={}},disable:function(){f.handle.disabled=!0},selectAdjacent:function(){var t,e,n,i,o;t=d.isMultiple()?m.view.wt.selections.area.getCorners():m.view.wt.selections.current.getCorners(),e=u.getAll();t:for(n=t[2]+1;m.countRows()>n;n++){for(o=t[1];t[3]>=o;o++)if(e[n][o])break t;(e[n][t[1]-1]||e[n][t[3]+1])&&(i=n)}i&&(m.view.wt.selections.fill.clear(),m.view.wt.selections.fill.add([t[0],t[1]]),m.view.wt.selections.fill.add([i,t[3]]),f.apply())},apply:function(){var t,e,n,i,o;f.handle.isDragged=0,t=m.view.wt.selections.fill.getCorners(),t&&(m.view.wt.selections.fill.clear(),e=d.isMultiple()?m.view.wt.selections.area.getCorners():m.view.wt.selections.current.getCorners(),t[0]===e[0]&&t[1]e[3]?(n={row:t[0],col:e[3]+1},i={row:t[2],col:t[3]}):t[0]e[2]&&t[1]===e[1]&&(n={row:e[2]+1,col:t[1]},i={row:t[2],col:t[3]}),n&&(o=SheetClip.parse(u.getText(c.selStart.coords(),c.selEnd.coords())),m.PluginHooks.run("beforeAutofill",n,i,o),h.populateFromArray(n,o,i,"autofill"),d.setRangeStart({row:t[0],col:t[1]}),d.setRangeEnd({row:t[2],col:t[3]})))},showBorder:function(t){t.row=t[0],t.col=t[1];var e=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]);if("horizontal"!==c.settings.fillHandle&&(e.BR.rowt.row))t=[t.row,e.BR.col];else{if("vertical"===c.settings.fillHandle)return;t=[e.BR.row,t.col]}m.view.wt.selections.fill.clear(),m.view.wt.selections.fill.add([c.selStart.coords().row,c.selStart.coords().col]),m.view.wt.selections.fill.add([c.selEnd.coords().row,c.selEnd.coords().col]),m.view.wt.selections.fill.add(t),m.view.render()}},p={init:function(){function t(t){if(m.isListening()&&(c.settings.beforeOnKeyDown&&c.settings.beforeOnKeyDown.call(m,t),!Array.prototype.filter.call(document.body.querySelectorAll(".context-menu-list"),m.view.wt.wtDom.isVisible).length)){if(17===t.keyCode||224===t.keyCode||91===t.keyCode||93===t.keyCode)return p.setCopyableText(),void 0;if(c.lastKeyCode=t.keyCode,d.isSelected()){var e=(t.ctrlKey||t.metaKey)&&!t.altKey;if(n.helper.isPrintableChar(t.keyCode)&&e)return 65===t.keyCode?(d.selectAll(),p.setCopyableText(),t.preventDefault()):89===t.keyCode||t.shiftKey&&90===t.keyCode?c.undoRedo&&c.undoRedo.redo():90===t.keyCode&&c.undoRedo&&c.undoRedo.undo(),void 0;var i=t.shiftKey?d.setRangeEnd:d.setRangeStart;if(m.PluginHooks.run("beforeKeyDown",t),!t.isImmediatePropagationStopped())switch(t.keyCode){case 38:t.shiftKey?d.transformEnd(-1,0):d.transformStart(-1,0),t.preventDefault(),t.stopPropagation();break;case 9:var o="function"==typeof c.settings.tabMoves?c.settings.tabMoves(t):c.settings.tabMoves;t.shiftKey?d.transformStart(-o.row,-o.col):d.transformStart(o.row,o.col,!0),t.preventDefault(),t.stopPropagation();break;case 39:t.shiftKey?d.transformEnd(0,1):d.transformStart(0,1),t.preventDefault(),t.stopPropagation();break;case 37:t.shiftKey?d.transformEnd(0,-1):d.transformStart(0,-1),t.preventDefault(),t.stopPropagation();break;case 8:case 46:d.empty(t),t.preventDefault();break;case 40:t.shiftKey?d.transformEnd(1,0):d.transformStart(1,0),t.preventDefault(),t.stopPropagation();break;case 113:t.preventDefault();break;case 13:var s="function"==typeof c.settings.enterMoves?c.settings.enterMoves(t):c.settings.enterMoves;t.shiftKey?d.transformStart(-s.row,-s.col):d.transformStart(s.row,s.col,!0),t.preventDefault();break;case 36:t.ctrlKey||t.metaKey?i({row:0,col:c.selStart.col()}):i({row:c.selStart.row(),col:0}),t.preventDefault(),t.stopPropagation();break;case 35:t.ctrlKey||t.metaKey?i({row:m.countRows()-1,col:c.selStart.col()}):i({row:c.selStart.row(),col:m.countCols()-1}),t.preventDefault(),t.stopPropagation();break;case 33:d.transformStart(-m.countVisibleRows(),0),m.view.wt.scrollVertical(-m.countVisibleRows()),m.view.render(),t.preventDefault(),t.stopPropagation();break;case 34:d.transformStart(m.countVisibleRows(),0),m.view.wt.scrollVertical(m.countVisibleRows()),m.view.render(),t.preventDefault(),t.stopPropagation();break;default:}}}}c.onCut=function(){m.isListening()&&d.empty()},c.onPaste=function(t){if(m.isListening()){var e=t.replace(/^[\r\n]*/g,"").replace(/[\r\n]*$/g,""),n=SheetClip.parse(e),i=h.getCornerCoords([c.selStart.coords(),c.selEnd.coords()]),o=i.TL,s={row:Math.max(i.BR.row,n.length-1+i.TL.row),col:Math.max(i.BR.col,n[0].length-1+i.TL.col)};m.PluginHooks.once("afterChange",function(t){t&&t.length&&m.selectCell(o.row,o.col,s.row,s.col)}),h.populateFromArray(o,n,s,"paste",c.settings.pasteMode)}},m.copyPaste=G.getInstance(),m.copyPaste.onCut(c.onCut),m.copyPaste.onPaste(c.onPaste),w.on("keydown.handsontable."+m.guid,t)},destroy:function(t){if("function"==typeof c.editorDestroyer){var e=c.editorDestroyer;c.editorDestroyer=null,e(t)}},setCopyableText:function(){var t=Math.min(c.selStart.row(),c.selEnd.row()),e=Math.min(c.selStart.col(),c.selEnd.col()),n=Math.max(c.selStart.row(),c.selEnd.row()),i=Math.max(c.selStart.col(),c.selEnd.col()),o=Math.min(n,t+c.settings.copyRowsLimit-1),s=Math.min(i,e+c.settings.copyColsLimit-1);m.copyPaste.copyable(u.getText({row:t,col:e},{row:o,col:s})),(n!==o||i!==s)&&m.PluginHooks.run("afterCopyLimit",n-t+1,i-e+1,c.settings.copyRowsLimit,c.settings.copyColsLimit)},prepare:function(){if(!m.getCellMeta(c.selStart.row(),c.selStart.col()).readOnly){var t=m.view.getCellAtCoords(c.selStart.coords());c.editorDestroyer=m.view.applyCellTypeMethod("editor",t,c.selStart.row(),c.selStart.col())}}},this.init=function(){m.PluginHooks.run("beforeInit"),p.init(),this.updateSettings(c.settings,!0),this.parseSettingsFromDOM(),this.view=new n.TableView(this),this.forceFullRender=!0,this.view.render(),"object"==typeof c.firstRun&&(m.PluginHooks.run("afterChange",c.firstRun[0],c.firstRun[1]),c.firstRun=!1),m.PluginHooks.run("afterInit")},this.validateCell=function(t,e,n,i){var o=e.validator;"[object RegExp]"===Object.prototype.toString.call(o)&&(o=function(t){return function(e,n){n(t.test(e))}}(o)),"function"==typeof o?(t=m.PluginHooks.execute("beforeValidate",t,e.row,e.prop,i),o.call(e,t,function(o){e.valid=o,o=m.PluginHooks.execute("afterValidate",o,t,e.row,e.prop,i),n(o)})):(e.valid=!0,n(!0))},this.setDataAtCell=function(t,e,n,i){var o,s,c,h=l(t,e,n),d=[];for(o=0,s=h.length;s>o;o++){if("object"!=typeof h[o])throw Error("Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter");if("number"!=typeof h[o][1])throw Error("Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`");c=u.colToProp(h[o][1]),d.push([h[o][0],c,u.get(h[o][0],c),h[o][2]])}i||"object"!=typeof t||(i=e),r(d,i,function(){a(d,i)})},this.setDataAtRowProp=function(t,e,n,i){var o,s,c=l(t,e,n),h=[];for(o=0,s=c.length;s>o;o++)h.push([c[o][0],c[o][1],u.get(c[o][0],c[o][1]),c[o][2]]);i||"object"!=typeof t||(i=e),r(h,i,function(){a(h,i)})},this.listen=function(){n.activeGuid=m.guid,document.activeElement&&document.activeElement!==document.body?document.activeElement.blur():document.activeElement||document.body.focus()},this.unlisten=function(){n.activeGuid=null},this.isListening=function(){return n.activeGuid===m.guid},this.destroyEditor=function(t){d.refreshBorders(t)},this.populateFromArray=function(t,e,n,i,o,s,r){if("object"!=typeof n)throw Error("populateFromArray parameter `input` must be an array");return h.populateFromArray({row:t,col:e},n,"number"==typeof i?{row:i,col:o}:null,s,r)},this.spliceCol=function(){return u.spliceCol.apply(null,arguments)},this.spliceRow=function(){return u.spliceRow.apply(null,arguments)},this.getCornerCoords=function(t){return h.getCornerCoords(t)},this.getSelected=function(){return d.isSelected()?[c.selStart.row(),c.selStart.col(),c.selEnd.row(),c.selEnd.col()]:void 0},this.parseSettingsFromDOM=function(){var t=this.rootElement.css("overflow");if("scroll"===t||"auto"===t?(this.rootElement[0].style.overflow="visible",c.settingsFromDOM.overflow=t):(void 0===c.settings.width||void 0===c.settings.height)&&(c.settingsFromDOM.overflow="auto"),c.settingsFromDOM.width=void 0===c.settings.width?this.rootElement.width():void 0,c.settingsFromDOM.height=void 0,void 0===c.settings.height&&("scroll"===c.settingsFromDOM.overflow||"auto"===c.settingsFromDOM.overflow)){var n=this.rootElement[0].cloneNode(!1),i=this.rootElement[0].parentNode;if(i){n.removeAttribute("id"),i.appendChild(n);var o=parseInt(e.getComputedStyle(n,null).getPropertyValue("height"),10);o>0&&(c.settingsFromDOM.height=o),i.removeChild(n)}}},this.render=function(){m.view&&(m.forceFullRender=!0,m.parseSettingsFromDOM(),d.refreshBorders(null,!0))},this.loadData=function(e){if(!e.push||!e.splice)throw Error("loadData only accepts array of objects or array of arrays ("+typeof e+" given)");c.isPopulated=!1,g.prototype.data=e,c.dataType=c.settings.dataSchema instanceof Array||e[0]instanceof Array?"array":t.isFunction(c.settings.dataSchema)?"function":"object",c.duckDataSchema=e[0]?u.recursiveDuckSchema(e[0]):{},u.createMap(),h.adjustRowsAndCols(),m.PluginHooks.run("afterLoadData"),c.firstRun?c.firstRun=[null,"loadData"]:(m.PluginHooks.run("afterChange",null,"loadData"),m.render()),c.isPopulated=!0,m.clearUndo()},this.getData=function(t,e,n,i){return t===void 0?u.getAll():u.getRange({row:t,col:e},{row:n,col:i})},this.updateSettings=function(t,e){var i,o,s,r,a;if(t.rows!==void 0)throw Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");if(t.cols!==void 0)throw Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");t.undo!==void 0&&(c.undoRedo&&t.undo===!1?c.undoRedo=null:c.undoRedo||t.undo!==!0||(c.undoRedo=new n.UndoRedo(m)));for(i in t)"data"!==i&&(void 0!==m.PluginHooks.hooks.persistent[i]||void 0!==m.PluginHooks.legacy[i]?m.PluginHooks.add(i,t[i]):(!e&&t.hasOwnProperty(i)&&(g.prototype[i]=t[i]),n.extension[i]&&(c.extensions[i]=new n.extension[i](m,t[i]))));if(void 0===t.data&&void 0===c.settings.data){var l,p=[];for(o=0,s=c.settings.startRows;s>o;o++){for(l=[],r=0,a=c.settings.startCols;a>r;r++)l.push(null);p.push(l)}m.loadData(p)}else void 0!==t.data?m.loadData(t.data):void 0!==t.columns&&u.createMap();if(a=m.countCols(),c.cellSettings.length=0,a>0){var w,v,y;for(i=0;a>i;i++)if(c.columnSettings[i]=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell),v=c.columnSettings[i].prototype,g.prototype.columns){y=g.prototype.columns[i];for(w in y)y.hasOwnProperty(w)&&(v[w]=y[w])}}t.fillHandle!==void 0&&(f.handle&&t.fillHandle===!1?f.disable():f.handle||t.fillHandle===!1||f.init()),e||m.PluginHooks.run("afterUpdateSettings"),h.adjustRowsAndCols(),m.view&&(m.forceFullRender=!0,d.refreshBorders(null,!0))},this.getSettings=function(){return c.settings},this.getSettingsFromDOM=function(){return c.settingsFromDOM},this.clear=function(){d.selectAll(),d.empty()},this.isUndoAvailable=function(){return c.undoRedo&&c.undoRedo.isUndoAvailable()},this.isRedoAvailable=function(){return c.undoRedo&&c.undoRedo.isRedoAvailable()},this.undo=function(){c.undoRedo&&c.undoRedo.undo()},this.redo=function(){c.undoRedo&&c.undoRedo.redo()},this.clearUndo=function(){c.undoRedo&&c.undoRedo.clear()},this.alter=function(t,e,n,i,o){h.alter(t,e,n,i,o)},this.getCell=function(t,e){return m.view.getCellAtCoords({row:t,col:e})},this.colToProp=function(t){return u.colToProp(t)},this.propToCol=function(t){return u.propToCol(t)},this.getDataAtCell=function(t,e){return u.get(t,u.colToProp(e))},this.getDataAtRowProp=function(t,e){return u.get(t,e)},this.getDataAtCol=function(t){return[].concat.apply([],u.getRange({row:0,col:t},{row:c.settings.data.length-1,col:t}))},this.getDataAtProp=function(t){return[].concat.apply([],u.getRange({row:0,col:u.propToCol(t)},{row:c.settings.data.length-1,col:u.propToCol(t)}))},this.getDataAtRow=function(t){return c.settings.data[t]},this.getCellMeta=function(t,e){var i,o,s,r=u.colToProp(e);if(e=n.PluginHooks.execute(m,"modifyCol",e),c.columnSettings[e]===void 0&&(c.columnSettings[e]=n.helper.columnFactory(g,c.columnsSettingConflicts,n.TextCell)),c.cellSettings[t]||(c.cellSettings[t]={}),c.cellSettings[t][e]||(c.cellSettings[t][e]=new c.columnSettings[e]),i=c.cellSettings[t][e],i.row=t,i.col=e,i.prop=r,i.instance=m,i.cells){var a,l=i.cells.call(i,t,e,r)||{};for(a in l)l.hasOwnProperty(a)&&(i[a]=l[a])}if(m.PluginHooks.run("beforeGetCellMeta",t,e,i),"string"==typeof i.type&&"text"!==i.type){if(o=n.cellTypes[i.type],void 0===o)throw Error('You declared cell type "'+i.type+'" as a string that is not mapped to a known object. Cell type must be an object or a string mapped to an object in Handsontable.cellTypes')}else"object"==typeof i.type&&(o=i.type);if(o)for(s in o)o.hasOwnProperty(s)&&i[s]===n.cellTypes.text[s]&&(i[s]=o[s]);return m.PluginHooks.run("afterGetCellMeta",t,e,i),i},this.validateCells=function(t){var e=new s;e.onQueueEmpty=t;for(var n=m.countRows()-1;n>=0;){for(var i=m.countCols()-1;i>=0;)e.addValidatorToQueue(),m.validateCell(m.getDataAtCell(n,i),m.getCellMeta(n,i),function(){e.removeValidatorFormQueue()},"validateCells"),i--;n--}e.checkIfQueueIsEmpty()},this.getRowHeader=function(t){if(void 0===t){for(var e=[],n=0,i=m.countRows();i>n;n++)e.push(m.getRowHeader(n));return e}return"[object Array]"===Object.prototype.toString.call(c.settings.rowHeaders)&&void 0!==c.settings.rowHeaders[t]?c.settings.rowHeaders[t]:"function"==typeof c.settings.rowHeaders?c.settings.rowHeaders(t):c.settings.rowHeaders&&"string"!=typeof c.settings.rowHeaders&&"number"!=typeof c.settings.rowHeaders?t+1:c.settings.rowHeaders},this.getColHeader=function(t){if(void 0===t){for(var e=[],i=0,o=m.countCols();o>i;i++)e.push(m.getColHeader(i));return e}return t=n.PluginHooks.execute(m,"modifyCol",t),c.settings.columns&&c.settings.columns[t]&&c.settings.columns[t].title?c.settings.columns[t].title:"[object Array]"===Object.prototype.toString.call(c.settings.colHeaders)&&void 0!==c.settings.colHeaders[t]?c.settings.colHeaders[t]:"function"==typeof c.settings.colHeaders?c.settings.colHeaders(t):c.settings.colHeaders&&"string"!=typeof c.settings.colHeaders&&"number"!=typeof c.settings.colHeaders?n.helper.spreadsheetColumnLabel(t):c.settings.colHeaders},this._getColWidthFromSettings=function(t){return c.settings.columns&&c.settings.columns[t]&&c.settings.columns[t].width?c.settings.columns[t].width:"[object Array]"===Object.prototype.toString.call(c.settings.colWidths)&&void 0!==c.settings.colWidths[t]?c.settings.colWidths[t]:void 0},this.getColWidth=function(t){t=n.PluginHooks.execute(m,"modifyCol",t);var e={width:m._getColWidthFromSettings(t)};return e.width||(e.width=50),m.PluginHooks.run("afterGetColWidth",t,e),e.width},this.countRows=function(){return c.settings.data.length},this.countCols=function(){return"object"===c.dataType||"function"===c.dataType?c.settings.columns&&c.settings.columns.length?c.settings.columns.length:c.colToProp.length:"array"===c.dataType?c.settings.columns&&c.settings.columns.length?c.settings.columns.length:c.settings.data&&c.settings.data[0]&&c.settings.data[0].length?c.settings.data[0].length:0:void 0},this.rowOffset=function(){return m.view.wt.getSetting("offsetRow")},this.colOffset=function(){return m.view.wt.getSetting("offsetColumn")},this.countVisibleRows=function(){return m.view.wt.drawn?m.view.wt.wtTable.rowStrategy.countVisible():-1},this.countVisibleCols=function(){return m.view.wt.drawn?m.view.wt.wtTable.columnStrategy.countVisible():-1},this.countEmptyRows=function(t){for(var e=m.countRows()-1,n=0;e>=0;){if(u.get(e,0),m.isEmptyRow(u.getVars.row))n++;else if(t)break;e--}return n},this.countEmptyCols=function(t){if(1>m.countRows())return 0;for(var e=m.countCols()-1,n=0;e>=0;){if(m.isEmptyCol(e))n++;else if(t)break;e--}return n},this.isEmptyRow=function(t){if(c.settings.isEmptyRow)return c.settings.isEmptyRow.call(m,t);for(var e,n=0,i=m.countCols();i>n;n++)if(e=m.getDataAtCell(t,n),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.isEmptyCol=function(t){if(c.settings.isEmptyCol)return c.settings.isEmptyCol.call(m,t);for(var e,n=0,i=m.countRows();i>n;n++)if(e=m.getDataAtCell(n,t),""!==e&&null!==e&&e!==void 0)return!1;return!0},this.selectCell=function(t,e,n,i,o){if("number"!=typeof t||0>t||t>=m.countRows())return!1;if("number"!=typeof e||0>e||e>=m.countCols())return!1;if(n!==void 0){if("number"!=typeof n||0>n||n>=m.countRows())return!1;if("number"!=typeof i||0>i||i>=m.countCols())return!1}return c.selStart.coords({row:t,col:e}),document.activeElement&&document.activeElement!==document.documentElement&&document.activeElement!==document.body&&document.activeElement.blur(),m.listen(),n===void 0?d.setRangeEnd({row:t,col:e},o):d.setRangeEnd({row:n,col:i},o),m.selection.finish(),!0},this.selectCellByProp=function(){return arguments[1]=u.propToCol(arguments[1]),arguments[3]!==void 0&&(arguments[3]=u.propToCol(arguments[3])),m.selectCell.apply(m,arguments)},this.deselectCell=function(){d.deselect() +},this.destroy=function(){m.clearTimeouts(),m.view&&m.view.wt.destroy(),m.rootElement.empty(),m.rootElement.removeData("handsontable"),m.rootElement.off(".handsontable"),t(e).off("."+m.guid),w.off("."+m.guid),v.off("."+m.guid),m.copyPaste.removeCallback(c.onCut),m.copyPaste.removeCallback(c.onPaste),m.PluginHooks.run("afterDestroy")},this.getInstance=function(){return m.rootElement.data("handsontable")},function(){m.PluginHooks=new n.PluginHookClass;var t=m.PluginHooks.run,e=m.PluginHooks.execute;m.PluginHooks.run=function(e,i,o,s,r,a){t.call(this,m,e,i,o,s,r,a),n.PluginHooks.run(m,e,i,o,s,r,a)},m.PluginHooks.execute=function(t,i,o,s,r,a){var l=n.PluginHooks.execute(m,t,i,o,s,r,a),c=e.call(this,m,t,l,o,s,r,a);return c===void 0?l:c},m.addHook=function(){m.PluginHooks.add.apply(m.PluginHooks,arguments)},m.addHookOnce=function(){m.PluginHooks.once.apply(m.PluginHooks,arguments)},m.removeHook=function(){m.PluginHooks.remove.apply(m.PluginHooks,arguments)},m.runHooks=function(){m.PluginHooks.run.apply(m.PluginHooks,arguments)},m.runHooksAndReturn=function(){return m.PluginHooks.execute.apply(m.PluginHooks,arguments)}}(),this.timeouts={},this.registerTimeout=function(t,e,n){clearTimeout(this.timeouts[t]),this.timeouts[t]=setTimeout(e,n||0)},this.clearTimeouts=function(){for(var t in this.timeouts)this.timeouts.hasOwnProperty(t)&&clearTimeout(this.timeouts[t])},this.version="0.9.11"};var N=function(){};N.prototype={data:void 0,width:void 0,height:void 0,startRows:5,startCols:5,minRows:0,minCols:0,maxRows:1/0,maxCols:1/0,minSpareRows:0,minSpareCols:0,multiSelect:!0,fillHandle:!0,fixedRowsTop:0,fixedColumnsLeft:0,undo:!0,outsideClickDeselects:!0,enterBeginsEditing:!0,enterMoves:{row:1,col:0},tabMoves:{row:0,col:1},autoWrapRow:!1,autoWrapCol:!1,copyRowsLimit:1e3,copyColsLimit:1e3,pasteMode:"overwrite",currentRowClassName:void 0,currentColClassName:void 0,stretchH:"hybrid",isEmptyRow:void 0,isEmptyCol:void 0,observeDOMVisibility:!0,allowInvalid:!0,invalidCellClassName:"htInvalid",fragmentSelection:!1,readOnly:!1},t.fn.handsontable=function(t){var e,i,o,s,r,a=this.first(),l=a.data("handsontable");if("string"!=typeof t)return r=t||{},l?l.updateSettings(r):(l=new n.Core(a,r),a.data("handsontable",l),l.init()),a;if(o=[],arguments.length>1)for(e=1,i=arguments.length;i>e;e++)o.push(arguments[e]);if(l){if(void 0===l[t])throw Error("Handsontable do not provide action: "+t);s=l[t].apply(l,o)}return s},n.TableView=function(i){var o=this,s=t(e),r=t(document.documentElement);this.instance=i,this.settings=i.getSettings(),this.settingsFromDOM=i.getSettingsFromDOM(),i.rootElement.data("originalStyle",i.rootElement.attr("style")),i.rootElement.addClass("handsontable");var a=document.createElement("TABLE");a.className="htCore",this.THEAD=document.createElement("THEAD"),a.appendChild(this.THEAD),this.TBODY=document.createElement("TBODY"),a.appendChild(this.TBODY),i.$table=t(a),i.rootElement.prepend(i.$table),i.rootElement.on("mousedown.handsontable",function(t){o.isTextSelectionAllowed(t.target)||(t.preventDefault(),u())}),r.on("keyup."+i.guid,function(t){i.selection.isInProgress()&&!t.shiftKey&&i.selection.finish()});var l,c;r.on("mouseup."+i.guid,function(t){i.selection.isInProgress()&&1===t.which&&i.selection.finish(),l=!1,clearInterval(c),c=null,i.autofill.handle&&i.autofill.handle.isDragged&&(i.autofill.handle.isDragged>1&&i.autofill.apply(),i.autofill.handle.isDragged=0),n.helper.isOutsideInput(document.activeElement)&&i.unlisten()}),r.on("mousedown."+i.guid,function(e){var n=e.target;if(n!==o.wt.wtTable.spreader)for(;n!==document.documentElement;){if(null===n)return;if(n===i.rootElement[0]||"X-HANDSONTABLE"===n.nodeName||"context-menu-layer"===n.id||t(n).is(".context-menu-list")||t(n).is(".typeahead li"))return;n=n.parentNode}o.settings.outsideClickDeselects?i.deselectCell():i.destroyEditor()}),i.$table.on("selectstart",function(t){o.settings.fragmentSelection||t.preventDefault()}),i.$table.on("mouseenter",function(){c&&(clearInterval(c),c=null)}),i.$table.on("mouseleave",function(t){if(l||i.autofill.handle&&i.autofill.handle.isDragged){var e,n,s=1,r=o.wt.wtDom.offset(a),u=r.top+s,h=r.left+s,d=o.containerWidth-o.wt.getSetting("scrollbarWidth")-2*s,p=o.containerHeight-o.wt.getSetting("scrollbarHeight")-2*s,f=0,m=0;u>t.pageY?(f=-1,e="scrollVertical"):t.pageY>=u+p?(f=1,e="scrollVertical"):h>t.pageX?(m=-1,e="scrollHorizontal"):t.pageX>=h+d&&(m=1,e="scrollHorizontal"),e&&(n=function(){(l||i.autofill.handle&&i.autofill.handle.isDragged)&&o.wt[e](f+m).draw()},n(),c=setInterval(n,100))}});var u=function(){e.getSelection?e.getSelection().empty?e.getSelection().empty():e.getSelection().removeAllRanges&&e.getSelection().removeAllRanges():document.selection&&document.selection.empty()},h={table:a,stretchH:this.settings.stretchH,data:i.getDataAtCell,totalRows:i.countRows,totalColumns:i.countCols,scrollbarModelV:this.settings.scrollbarModelV,scrollbarModelH:this.settings.scrollbarModelH,offsetRow:0,offsetColumn:0,width:this.getWidth(),height:this.getHeight(),fixedColumnsLeft:function(){return o.settings.fixedColumnsLeft},fixedRowsTop:function(){return o.settings.fixedRowsTop},rowHeaders:function(){return o.settings.rowHeaders?[function(t,e){o.appendRowHeader(t,e)}]:[]},columnHeaders:function(){return o.settings.colHeaders?[function(t,e){o.appendColHeader(t,e)}]:[]},columnWidth:i.getColWidth,cellRenderer:function(t,e,n){o.applyCellTypeMethod("renderer",n,t,e)},selections:{current:{className:"current",border:{width:2,color:"#5292F7",style:"solid",cornerVisible:function(){return o.settings.fillHandle&&!o.isCellEdited()&&!i.selection.isMultiple()}}},area:{className:"area",border:{width:1,color:"#89AFF9",style:"solid",cornerVisible:function(){return o.settings.fillHandle&&!o.isCellEdited()&&i.selection.isMultiple()}}},highlight:{highlightRowClassName:o.settings.currentRowClassName,highlightColumnClassName:o.settings.currentColClassName},fill:{className:"fill",border:{width:1,color:"red",style:"solid"}}},hideBorderOnMouseDownOver:function(){return o.settings.fragmentSelection},onCellMouseDown:function(t,e,n){i.listen(),l=!0;var s={row:e[0],col:e[1]};2===t.button&&i.selection.inInSelection(s)||(t.shiftKey?i.selection.setRangeEnd(s):i.selection.setRangeStart(s)),o.settings.afterOnCellMouseDown&&o.settings.afterOnCellMouseDown.call(i,t,e,n)},onCellMouseOver:function(t,e){var n={row:e[0],col:e[1]};l?i.selection.setRangeEnd(n):i.autofill.handle&&i.autofill.handle.isDragged&&(i.autofill.handle.isDragged++,i.autofill.showBorder(e))},onCellCornerMouseDown:function(t){i.autofill.handle.isDragged=1,t.preventDefault()},onCellCornerDblClick:function(){i.autofill.selectAdjacent()},beforeDraw:function(t){o.beforeRender(t)}};i.PluginHooks.run("beforeInitWalkontable",h),this.wt=new T(h),s.on("resize."+i.guid,function(){i.registerTimeout("resizeTimeout",function(){i.parseSettingsFromDOM();var t=o.getWidth(),e=o.getHeight();(h.width!==t||h.height!==e)&&(i.forceFullRender=!0,o.render(),h.width=t,h.height=e)},60)}),t(o.wt.wtTable.spreader).on("mousedown.handsontable, contextmenu.handsontable",function(t){t.target===o.wt.wtTable.spreader&&3===t.which&&t.stopPropagation()}),r.on("click."+i.guid,function(){o.settings.observeDOMVisibility&&o.wt.drawInterrupted&&(o.instance.forceFullRender=!0,o.render())})},n.TableView.prototype.isTextSelectionAllowed=function(t){return"TEXTAREA"===t.nodeName?!0:this.settings.fragmentSelection&&this.wt.wtDom.isChildOf(t,this.TBODY)?!0:!1},n.TableView.prototype.isCellEdited=function(){return document.activeElement!==document.body},n.TableView.prototype.getWidth=function(){var t=void 0!==this.settings.width?this.settings.width:this.settingsFromDOM.width;return"function"==typeof t?t():t},n.TableView.prototype.getHeight=function(){var t=void 0!==this.settings.height?this.settings.height:this.settingsFromDOM.height;return"function"==typeof t?t():t},n.TableView.prototype.beforeRender=function(t){t&&(this.instance.PluginHooks.run("beforeRender"),this.wt.update("width",this.getWidth()),this.wt.update("height",this.getHeight()))},n.TableView.prototype.render=function(){this.wt.draw(!this.instance.forceFullRender),this.instance.rootElement.triggerHandler("render.handsontable"),this.instance.forceFullRender&&this.instance.PluginHooks.run("afterRender"),this.instance.forceFullRender=!1},n.TableView.prototype.applyCellTypeMethod=function(t,e,i,o){var s=this.instance.colToProp(o),r=this.instance.getCellMeta(i,o),a=n.helper.getCellMethod(t,r[t]);return a(this.instance,e,i,o,s,this.instance.getDataAtRowProp(i,s),r)},n.TableView.prototype.getCellAtCoords=function(t){var e=this.wt.wtTable.getCell([t.row,t.col]);return 0>e?null:e},n.TableView.prototype.scrollViewport=function(t){this.wt.scrollViewport([t.row,t.col])},n.TableView.prototype.appendRowHeader=function(t,e){t>-1?this.wt.wtDom.fastInnerHTML(e,this.instance.getRowHeader(t)):this.wt.wtDom.empty(e)},n.TableView.prototype.appendColHeader=function(t,e){var n=document.createElement("DIV"),i=document.createElement("SPAN");for(n.className="relative",i.className="colHeader",this.wt.wtDom.fastInnerHTML(i,this.instance.getColHeader(t)),n.appendChild(i);e.firstChild;)e.removeChild(e.firstChild);e.appendChild(n),this.instance.PluginHooks.run("afterGetColHeader",t,e)},n.TableView.prototype.maximumVisibleElementWidth=function(t){var e=this.wt.wtViewport.getWorkspaceWidth();return e-t},n.TableView.prototype.maximumVisibleElementHeight=function(t){var e=this.wt.wtViewport.getWorkspaceHeight();return e-t},n.helper.isPrintableChar=function(t){return 32==t||t>=48&&57>=t||t>=96&&111>=t||t>=186&&192>=t||t>=219&&222>=t||t>=226||t>=65&&90>=t},n.helper.stringify=function(t){switch(typeof t){case"string":case"number":return t+"";case"object":return null===t?"":""+t;case"undefined":return"";default:return""+t}},n.helper.spreadsheetColumnLabel=function(t){for(var e,n=t+1,i="";n>0;)e=(n-1)%26,i=String.fromCharCode(65+e)+i,n=parseInt((n-e)/26,10);return i},n.helper.isNumeric=function(t){var e=typeof t;return"number"==e?!isNaN(t)&&isFinite(t):"string"==e?t.length?1==t.length?/\d/.test(t):/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(t):!1:"object"==e?!(!t||"number"!=typeof t.valueOf()||t instanceof Date):!1},n.helper.isDescendant=function(t,e){for(var n=e.parentNode;null!=n;){if(n==t)return!0;n=n.parentNode}return!1},n.helper.randomString=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},n.helper.inherit=function(t,e){function n(){}return n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t},n.helper.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},n.helper.columnFactory=function(t,e,n){var i=0,o=e.length,s=function(){};for(s.prototype=new t;o>i;i++)s.prototype[e[i]]=void 0;for(i in n)n.hasOwnProperty(i)&&(s.prototype[i]=n[i]);return s},n.helper.translateRowsToColumns=function(t){var e,n,i,o,s=[],r=0;for(e=0,n=t.length;n>e;e++)for(i=0,o=t[e].length;o>i;i++)i==r&&(s.push([]),r++),s[i].push(t[e][i]);return s},n.helper.to2dArray=function(t){for(var e=0,n=t.length;n>e;)t[e]=[t[e]],e++},n.helper.extendArray=function(t,e){for(var n=0,i=e.length;i>n;)t.push(e[n]),n++},n.helper.getCellMethod=function(t,e){if("string"==typeof e){var i=n.cellLookup[t][e];if(void 0===i)throw Error("You declared cell "+t+' "'+e+'" as a string that is not mapped to a known function. Cell '+t+" must be a function or a string mapped to a function in Handsontable.cellLookup."+t+" lookup object");return i}return e},n.helper.isOutsideInput=function(t){var e=["INPUT","SELECT","TEXTAREA"];return e.indexOf(t.nodeName)>-1&&-1==t.className.indexOf("handsontableInput")},n.UndoRedo=function(t){var e=this;this.instance=t,this.clear(),n.PluginHooks.add("afterChange",function(t,n){"undo"!==n&&"redo"!==n&&e.add(t,n)})},n.UndoRedo.prototype.undo=function(){var e,n;if(this.isUndoAvailable()){var i=t.extend(!0,[],this.data[this.rev]);for(e=0,n=i.length;n>e;e++)i[e].splice(3,1);this.instance.setDataAtRowProp(i,null,null,"undo"),this.rev--}},n.UndoRedo.prototype.redo=function(){var e,n;if(this.isRedoAvailable()){this.rev++;var i=t.extend(!0,[],this.data[this.rev]);for(e=0,n=i.length;n>e;e++)i[e].splice(2,1);this.instance.setDataAtRowProp(i,null,null,"redo")}},n.UndoRedo.prototype.isUndoAvailable=function(){return this.rev>=0},n.UndoRedo.prototype.isRedoAvailable=function(){return this.revr&&(r=0),0>a&&(a=0),c>0&&parseInt(e.css("border-top-width"),10)>0&&(r+=1),u>0&&parseInt(e.css("border-left-width"),10)>0&&(a+=1),t.browser.msie&&7>=parseInt(t.browser.version,10)&&(r-=1),this.textareaParentStyle.top=r+"px",this.textareaParentStyle.left=a+"px";var h=e.width(),d=this.instance.view.maximumVisibleElementWidth(a)-10,p=e.outerHeight()-4,f=this.instance.view.maximumVisibleElementHeight(r)-5;parseInt(e.css("border-top-width"),10)>0&&(p-=1),parseInt(e.css("border-left-width"),10)>0&&c>0&&(h-=1),this.$textarea.autoResize({minHeight:Math.min(p,f),maxHeight:f,minWidth:Math.min(h,d),maxWidth:d,animate:!1,extraSpace:0}),this.textareaParentStyle.display="block"}},i.prototype.saveValue=function(t,e){if(e){var n=this.instance.getSelected();this.instance.populateFromArray(n[0],n[1],t,n[2],n[3],"edit")}else this.instance.populateFromArray(this.row,this.col,t,null,null,"edit")},i.prototype.finishEditing=function(e,n){var i=!1;if(this.state!=this.STATE_WAITING&&this.state!=this.STATE_FINISHED){if(this.state==this.STATE_EDITING){var o;if(o=e?[[this.originalValue]]:[[t.trim(this.TEXTAREA.value)]],i=this.instance.getCellMeta(this.row,this.col).validator){this.state=this.STATE_WAITING;var s=this;this.instance.addHookOnce("afterValidate",function(t){s.state=s.STATE_FINISHED,s.discardEditor(t)})}this.saveValue(o,n)}i||(this.state=this.STATE_FINISHED,this.discardEditor())}},i.prototype.discardEditor=function(e){if(this.state===this.STATE_FINISHED)if(e===!1&&this.cellProperties.allowInvalid!==!0)this.state=this.STATE_EDITING,this.instance.view.wt.wtDom.isVisible(this.TEXTAREA)&&(this.TEXTAREA.focus(),this.setCaretPosition(this.TEXTAREA,this.TEXTAREA.value.length));else if(this.state=this.STATE_FINISHED,document.activeElement===this.TEXTAREA&&this.instance.listen(),this.unbindTemporaryEvents(),this.textareaParentStyle.display="none",this.waitingEvent){var n=t.Event(this.waitingEvent.type);n.keyCode=this.waitingEvent.keyCode,this.waitingEvent=null,t(document.activeElement).trigger(n)}},n.TextEditor=function(t,e,n,o,s,r,a){return t.textEditor||(t.textEditor=new i(t)),(t.textEditor.state===t.textEditor.STATE_VIRGIN||t.textEditor.state===t.textEditor.STATE_FINISHED)&&t.textEditor.bindTemporaryEvents(e,n,o,s,r,a),function(e){t.textEditor.finishEditing(e)}},n.helper.inherit(o,i),o.prototype.createElements=function(){i.prototype.createElements.call(this),this.$textarea.typeahead(),this.typeahead=this.$textarea.data("typeahead"),this.typeahead._render=this.typeahead.render,this.typeahead.minLength=0,this.typeahead.lookup=function(){var e;return this.query=this.$element.val(),e=t.isFunction(this.source)?this.source(this.query,t.proxy(this.process,this)):this.source,e?this.process(e):this},this.typeahead.matcher=function(){return!0};var e=this.typeahead.process,n=this;this.typeahead.process=function(i){for(var o=!1,s=0,r=i.length;r>s;s++)""===i[s]&&(o||(i=t.extend([],i),o=!0),i[s]=n.emptyStringLabel);return e.call(this,i)}},o.prototype.bindEvents=function(){var t=this;this.$textarea.off("keydown").off("keyup").off("keypress"),this.$textarea.off(".acEditor").on("keydown.acEditor",function(e){switch(e.keyCode){case 38:t.typeahead.prev(),e.stopImmediatePropagation();break;case 40:t.typeahead.next(),e.stopImmediatePropagation();break;case 13:e.preventDefault()}}),this.$textarea.on("keyup.acEditor",function(e){(n.helper.isPrintableChar(e.keyCode)||113===e.keyCode||13===e.keyCode||8===e.keyCode||46===e.keyCode)&&t.typeahead.lookup()}),i.prototype.bindEvents.call(this)},o.prototype.bindTemporaryEvents=function(e,n,o,s,r,a){function l(){h.beginEditing(n,o,s,!0),h.instance.registerTimeout("IE9_align_fix",function(){h.typeahead.lookup()},1)}var c,u,h=this;this.typeahead.select=function(){var e=this.hide();h.instance.destroyEditor(!0);var i=this.$menu[0].querySelector(".active"),r=t(i).attr("data-value");return r===h.emptyStringLabel&&(r=""),"function"==typeof a.onSelect?a.onSelect(n,o,s,r,h.instance.view.wt.wtDom.index(i)):h.instance.setDataAtRowProp(n,s,r),e},this.typeahead.render=function(t){if(h.typeahead._render.call(this,t),!a.strict){var e=this.$menu[0].querySelector(".active");e&&h.instance.view.wt.wtDom.removeClass(e,"active")}return this};for(c in a)if("options"===c)for(u in a.options)this.typeahead.options[u]=a.options[u];else this.typeahead[c]=a[c];i.prototype.bindTemporaryEvents.call(this,e,n,o,s,r,a),this.instance.view.wt.update("onCellDblClick",l)},o.prototype.finishEditing=function(t,e){t||(this.isMenuExpanded()&&this.typeahead.$menu[0].querySelector(".active")?(this.typeahead.select(),this.state=this.STATE_FINISHED):this.cellProperties.strict&&(this.state=this.STATE_FINISHED)),i.prototype.finishEditing.call(this,t,e)},o.prototype.isMenuExpanded=function(){return this.instance.view.wt.wtDom.isVisible(this.typeahead.$menu[0])?this.typeahead:!1},n.AutocompleteEditor=function(t,e,n,i,s,r,a){return t.autocompleteEditor||(t.autocompleteEditor=new o(t)),t.autocompleteEditor.bindTemporaryEvents(e,n,i,s,r,a),function(e){t.autocompleteEditor.finishEditing(e)}},n.CheckboxEditor=function(t,e,i,o,r,a,l){return l===void 0&&(l={}),l.checkedTemplate===void 0&&(l.checkedTemplate=!0),l.uncheckedTemplate===void 0&&(l.uncheckedTemplate=!1),t.$table.on("keydown.editor",function(e){var o=(e.ctrlKey||e.metaKey)&&!e.altKey;!o&&n.helper.isPrintableChar(e.keyCode)&&(s(t,i,r,l),e.stopImmediatePropagation(),e.preventDefault())}),t.view.wt.update("onCellDblClick",function(){s(t,i,r,l)}),function(){t.$table.off(".editor"),t.view.wt.update("onCellDblClick",null)}},n.helper.inherit(r,i),r.prototype.createElements=function(){i.prototype.createElements.call(this),this.datePicker=document.createElement("DIV"),this.datePickerStyle=this.datePicker.style,this.datePickerStyle.position="absolute",this.datePickerStyle.top=0,this.datePickerStyle.left=0,this.datePickerStyle.zIndex=99,this.instance.rootElement[0].appendChild(this.datePicker),this.$datePicker=t(this.datePicker);var e=this,n={dateFormat:"yy-mm-dd",showButtonPanel:!0,changeMonth:!0,changeYear:!0,altField:this.$textarea,onSelect:function(){e.finishEditing(!1)}};this.$datePicker.datepicker(n),this.hideDatepicker()},r.prototype.beginEditing=function(t,e,n,o,s){i.prototype.beginEditing.call(this,t,e,n,o,s),this.showDatepicker()},r.prototype.finishEditing=function(t,e){this.hideDatepicker(),i.prototype.finishEditing.call(this,t,e)},r.prototype.showDatepicker=function(){var e=t(this.instance.dateEditor.TD),n=e.position();this.datePickerStyle.top=n.top+e.height()+"px",this.datePickerStyle.left=n.left+"px";var i={defaultDate:this.originalValue||void 0};t.extend(i,this.cellProperties),this.$datePicker.datepicker("option",i),this.originalValue&&this.$datePicker.datepicker("setDate",this.originalValue),this.datePickerStyle.display="block"},r.prototype.hideDatepicker=function(){this.datePickerStyle.display="none"},n.DateEditor=function(t,e,n,i,o,s,a){return t.dateEditor||(t.dateEditor=new r(t)),t.dateEditor.bindTemporaryEvents(e,n,i,o,s,a),function(e){t.dateEditor.finishEditing(e)}},n.helper.inherit(a,i),a.prototype.createElements=function(){i.prototype.createElements.call(this);var e=document.createElement("DIV");e.className="handsontableEditor",this.TEXTAREA_PARENT.appendChild(e),this.$htContainer=t(e)},a.prototype.bindTemporaryEvents=function(e,n,o,s,r,a){var l=this,c={colHeaders:!0,cells:function(){return{readOnly:!0}},fillHandle:!1,width:2e3,afterOnCellMouseDown:function(){var t=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(t[0],t[1]),l.instance.destroyEditor()},beforeOnKeyDown:function(t){switch(t.keyCode){case 27:l.instance.destroyEditor(!0);break;case 13:var e=this.getSelected();l.TEXTAREA.value=this.getDataAtCell(e[0],e[1]),l.instance.destroyEditor()}}};a.handsontable&&(c=t.extend(c,a.handsontable)),this.$htContainer.handsontable(c),i.prototype.bindTemporaryEvents.call(this,e,n,o,s,r,a)},a.prototype.beginEditing=function(t,e,n,o,s){var r=this.instance.getSettings().onBeginEditing;r&&r()===!1||(i.prototype.beginEditing.call(this,t,e,n,o,s),this.$htContainer.handsontable("render"),this.$htContainer.handsontable("selectCell",0,0))},a.prototype.finishEditing=function(t,e){this.$htContainer.handsontable("isListening")&&this.instance.listen(),this.$htContainer.handsontable("destroy"),i.prototype.finishEditing.call(this,t,e)},n.HandsontableEditor=function(t,e,n,i,o,s,r){return t.handsontableEditor||(t.handsontableEditor=new a(t)),t.handsontableEditor.bindTemporaryEvents(e,n,i,o,s,r),t.registerEditor=t.handsontableEditor,function(e){t.handsontableEditor.finishEditing(e)}},n.NumericValidator=function(t,e){e(/^-?\d*\.?\d*$/.test(t))};var z=function(t,e){var n=t,i="string"==typeof n?n.toLowerCase():null;return function(t){for(var o=!1,s=0,r=t.length;r>s;s++){if(n===t[s]){o=!0;break}if(i===t[s].toLowerCase()){o=!0;break}}e(o)}};n.AutocompleteValidator=function(e,n){this.strict&&this.source?t.isFunction(this.source)?this.source(e,z(e,n)):z(e,n)(this.source):n(!0)},n.AutocompleteCell={editor:n.AutocompleteEditor,renderer:n.AutocompleteRenderer,validator:n.AutocompleteValidator},n.CheckboxCell={editor:n.CheckboxEditor,renderer:n.CheckboxRenderer},n.TextCell={editor:n.TextEditor,renderer:n.TextRenderer},n.NumericCell={editor:n.TextEditor,renderer:n.NumericRenderer,validator:n.NumericValidator,dataType:"number"},n.DateCell={editor:n.DateEditor,renderer:n.AutocompleteRenderer},n.HandsontableCell={editor:n.HandsontableEditor,renderer:n.AutocompleteRenderer},n.cellTypes={text:n.TextCell,date:n.DateCell,numeric:n.NumericCell,checkbox:n.CheckboxCell,autocomplete:n.AutocompleteCell,handsontable:n.HandsontableCell},n.cellLookup={renderer:{text:n.TextRenderer,numeric:n.NumericRenderer,checkbox:n.CheckboxRenderer,autocomplete:n.AutocompleteRenderer},editor:{text:n.TextEditor,date:n.DateEditor,checkbox:n.CheckboxEditor,autocomplete:n.AutocompleteEditor,handsontable:n.HandsontableEditor},validator:{numeric:n.NumericValidator,autocomplete:n.AutocompleteValidator}},n.PluginHookClass=function(){function t(){this.hooks={once:e(),persistent:e()},this.legacy=n}var e=function(){return{beforeInitWalkontable:[],beforeInit:[],beforeRender:[],beforeChange:[],beforeValidate:[],beforeGet:[],beforeSet:[],beforeGetCellMeta:[],beforeAutofill:[],beforeKeyDown:[],afterInit:[],afterLoadData:[],afterUpdateSettings:[],afterRender:[],afterChange:[],afterValidate:[],afterGetCellMeta:[],afterGetColHeader:[],afterGetColWidth:[],afterDestroy:[],afterRemoveRow:[],afterCreateRow:[],afterRemoveCol:[],afterCreateCol:[],afterColumnResize:[],afterColumnMove:[],afterDeselect:[],afterSelection:[],afterSelectionByProp:[],afterSelectionEnd:[],afterSelectionEndByProp:[],afterCopyLimit:[],modifyCol:[]}},n={onBeforeChange:"beforeChange",onChange:"afterChange",onCreateRow:"afterCreateRow",onCreateCol:"afterCreateCol",onSelection:"afterSelection",onCopyLimit:"afterCopyLimit",onSelectionEnd:"afterSelectionEnd",onSelectionByProp:"afterSelectionByProp",onSelectionEndByProp:"afterSelectionEndByProp"},i=function(t){return function(e,i){if(e in n&&(e=n[e]),this.hooks[t][e]===void 0&&(this.hooks[t][e]=[]),i instanceof Array)for(var o=0,s=i.length;s>o;o++)this.hooks[t][e].push(i[o]);else this.hooks[t][e].push(i);return this}};return t.prototype.add=i("persistent"),t.prototype.once=i("once"),t.prototype.remove=function(t,e){var i,o,s,r,a,l=!1,c=["persistent","once"];t in n&&(t=n[t]);for(o=0,s=c.length;s>o;o++)if(i=c[o],this.hooks[i][t]!==void 0)for(r=0,a=this.hooks[i][t].length;a>r;r++)if(this.hooks[i][t][r]==e){this.hooks[i][t].splice(r,1),l=!0;break}return l},t.prototype.run=function(t,e,i,o,s,r,a){var l,c,u,h,d,p=["persistent","once"];e in n&&(e=n[e]);for(c=0,u=p.length;u>c;c++)if(l=p[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)this.hooks[l][e][h].call(t,i,o,s,r,a),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--)},t.prototype.execute=function(t,e,i,o,s,r,a){var l,c,u,h,d,p,f=["persistent","once"];e in n&&(e=n[e]);for(c=0,u=f.length;u>c;c++)if(l=f[c],this.hooks[l][e]!==void 0)for(h=0,d=this.hooks[l][e].length;d>h;h++)p=this.hooks[l][e][h].call(t,i,o,s,r,a),void 0!==p&&(i=p),"once"===l&&(this.hooks[l][e].splice(h,1),d--,h--);return i},t}(),n.PluginHooks=new n.PluginHookClass; +var W=new l;n.PluginHooks.add("beforeInit",W.beforeInit),n.PluginHooks.add("beforeRender",W.determineColumnsWidth),n.PluginHooks.add("afterGetColWidth",W.getColWidth),n.PluginHooks.add("afterDestroy",W.afterDestroy);var F=new c;n.PluginHooks.add("afterInit",function(){F.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){F.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("beforeGet",F.onBeforeGetSet),n.PluginHooks.add("beforeSet",F.onBeforeGetSet),n.PluginHooks.add("afterGetColHeader",F.getColHeader),n.PluginHooks.add("afterCreateRow",F.sort),n.PluginHooks.add("afterRemoveRow",F.sort),n.PluginHooks.add("afterChange",F.afterChangeSort),n.PluginHooks.add("afterInit",u),n.PluginHooks.add("afterDestroy",h),n.PluginHooks.add("beforeGetCellMeta",function(t,e,i){var o,s,r,a=this.getSettings(),l=this.getData();if(i.isWritable=!i.readOnly,a.autoComplete)for(o=0,s=a.autoComplete.length;s>o;o++)if(a.autoComplete[o].match(t,e,l)){i.type===void 0?i.type=n.AutocompleteCell:(i.type.renderer===void 0&&(i.type.renderer=n.AutocompleteCell.renderer),i.type.editor===void 0&&(i.type.editor=n.AutocompleteCell.editor));for(r in a.autoComplete[o])a.autoComplete[o].hasOwnProperty(r)&&"match"!==r&&i[o]===void 0&&(i[r]="source"===r?a.autoComplete[o][r](t,e):a.autoComplete[o][r]);break}});var j=new d;n.PluginHooks.add("beforeInit",j.beforeInit),n.PluginHooks.add("afterInit",function(){j.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){j.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("afterGetColHeader",j.getColHeader),n.PluginHooks.add("modifyCol",j.modifyCol);var X=new p;n.PluginHooks.add("beforeInit",X.beforeInit),n.PluginHooks.add("afterInit",function(){X.init.call(this,"afterInit")}),n.PluginHooks.add("afterUpdateSettings",function(){X.init.call(this,"afterUpdateSettings")}),n.PluginHooks.add("afterGetColWidth",X.getColWidth);var Y=new f;n.PluginHooks.add("afterLoadData",Y.afterLoadData),function(t){function e(){function e(){var t=this;for(var e in s)s.hasOwnProperty(e)&&!i.call(t,e)&&t.PluginHooks.add(e,s[e])}function n(){var t=this;for(var e in s)s.hasOwnProperty(e)&&i.call(t,e)&&t.PluginHooks.remove(e,s[e])}function i(t){var e=this;return e.PluginHooks.hooks.persistent.hasOwnProperty(t)}var o=this;this.init=function(){var i=this,s=i.getSettings().persistentState;return o.enabled=Boolean(s),o.enabled?(i.storage||(i.storage=new t(i.rootElement[0].id)),i.resetState=o.resetValue,e.call(i),void 0):(n.call(i),void 0)},this.saveValue=function(t,e){var n=this;n.storage.saveValue(t,e)},this.loadValue=function(t,e){var n=this;e.value=n.storage.loadValue(t)},this.resetValue=function(t){var e=this;t!==void 0?e.storage.reset(t):e.storage.resetAll()};var s={persistentStateSave:o.saveValue,persistentStateLoad:o.loadValue,persistentStateReset:o.resetValue}}var i=new e;n.PluginHooks.add("beforeInit",i.init),n.PluginHooks.add("afterUpdateSettings",i.init)}(m),function(t){function e(i){return this.filter(e.resizableFilterSelector).each(function(){new n(t(this),i)}),this}function n(n,i){this.clones||(this.config=t.extend({},e.defaults,i),this.el=n,this.nodeName=n[0].nodeName.toLowerCase(),this.previousScrollTop=null,"original"===i.maxWidth&&(i.maxWidth=n.width()),"original"===i.minWidth&&(i.minWidth=n.width()),"original"===i.maxHeight&&(i.maxHeight=n.height()),"original"===i.minHeight&&(i.minHeight=n.height()),"textarea"===this.nodeName&&n.css({resize:"none",overflowY:"none"}),n.data("AutoResizer",this),this.createClone(),this.injectClone(),this.bind())}e.defaults={onResize:function(){},animate:{duration:200,complete:function(){}},extraSpace:50,minHeight:"original",maxHeight:500,minWidth:"original",maxWidth:500},e.cloneCSSProperties=["lineHeight","textDecoration","letterSpacing","fontSize","fontFamily","fontStyle","fontWeight","textTransform","textAlign","direction","wordSpacing","fontSizeAdjust","padding"],e.cloneCSSValues={position:"absolute",top:-9999,left:-9999,opacity:0,overflow:"hidden",overflowX:"hidden",overflowY:"hidden",border:"1px solid black",padding:"0.49em"},e.resizableFilterSelector="textarea,input:not(input[type]),input[type=text],input[type=password]",e.AutoResizer=n,t.fn.autoResize=e,n.prototype={bind:function(){var e=t.proxy(function(){return this.check(),!0},this);this.unbind(),this.el.bind("keyup.autoResize",e).bind("change.autoResize",e),this.check(null,!0)},unbind:function(){this.el.unbind(".autoResize")},createClone:function(){var n=this.el,i=this,o=this.config;this.clones=t(),("original"!==o.minHeight||"original"!==o.maxHeight)&&(this.hClone=n.clone().height("auto"),this.clones=this.clones.add(this.hClone)),("original"!==o.minWidth||"original"!==o.maxWidth)&&(this.wClone=t("
").width("auto").css({whiteSpace:"nowrap","float":"left"}),this.clones=this.clones.add(this.wClone)),t.each(e.cloneCSSProperties,function(t,e){i.clones.css(e,n.css(e))}),this.clones.removeAttr("name").removeAttr("id").attr("tabIndex",-1).css(e.cloneCSSValues).css("overflowY","scroll")},check:function(t,e){var n=this.config,i=this.wClone,o=this.hClone,s=this.el,r=s.val();if(i){i.text(r);var a=i.outerWidth(),l=a+n.extraSpace>=n.minWidth?a+n.extraSpace:n.minWidth,c=s.width();l=Math.min(l,n.maxWidth),(c>l&&l>=n.minWidth||l>=n.minWidth&&n.maxWidth>=l)&&(n.onResize.call(s),s.scrollLeft(0),n.animate&&!e?s.stop(1,1).animate({width:l},n.animate):s.width(l))}if(o){l&&o.width(l),o.height(0).val(r).scrollTop(1e4);var u=o[0].scrollTop+n.extraSpace;if(this.previousScrollTop===u)return;this.previousScrollTop=u,u>=n.maxHeight&&(u=n.maxHeight),n.minHeight>u&&(u=n.minHeight),u==n.maxHeight&&l==n.maxWidth?s.css("overflowY","scroll"):s.css("overflowY","hidden"),n.onResize.call(s),n.animate&&!e?s.stop(1,1).animate({height:u},n.animate):s.height(u)}},destroy:function(){this.unbind(),this.el.removeData("AutoResizer"),this.clones.remove(),delete this.el,delete this.hClone,delete this.wClone,delete this.clones},injectClone:function(){(e.cloneContainer||(e.cloneContainer=t("").appendTo("body"))).empty().append(this.clones)}}}(jQuery),function(t){function e(t){return t.split('"').length-1}t.SheetClip={parse:function(t){var n,i,o,s,r,a,l,c=[],u=0;for(o=t.split("\n"),o.length>1&&""===o[o.length-1]&&o.pop(),n=0,i=o.length;i>n;n+=1){for(o[n]=o[n].split(" "),s=0,r=o[n].length;r>s;s+=1)c[u]||(c[u]=[]),a&&0===s?(l=c[u].length-1,c[u][l]=c[u][l]+"\n"+o[n][0],a&&1&e(o[n][0])&&(a=!1,c[u][l]=c[u][l].substring(0,c[u][l].length-1).replace(/""/g,'"'))):s===r-1&&0===o[n][s].indexOf('"')?(c[u].push(o[n][s].substring(1).replace(/""/g,'"')),a=!0):(c[u].push(o[n][s].replace(/""/g,'"')),a=!1);a||(u+=1)}return c},stringify:function(t){var e,n,i,o,s,r="";for(e=0,n=t.length;n>e;e+=1){for(i=0,o=t[e].length;o>i;i+=1)i>0&&(r+=" "),s=t[e][i],r+="string"==typeof s?s.indexOf("\n")>-1?'"'+s.replace(/"/g,'""')+'"':s:null===s||void 0===s?"":s;r+="\n"}return r}}}(e);var G=function(){var t;return{getInstance:function(){return t||(t=new g),t}}}();g.prototype.selectNodeText=function(t){t.select()},g.prototype.getSelectionText=function(){var t="";return e.getSelection?t=""+e.getSelection():document.selection&&"Control"!=document.selection.type&&(t=document.selection.createRange().text),t},g.prototype.copyable=function(t){if("string"!=typeof t&&void 0===t.toString)throw Error("copyable requires string parameter");this.elTextarea.value=t},g.prototype.onCut=function(t){this.cutCallbacks.push(t)},g.prototype.onPaste=function(t){this.pasteCallbacks.push(t)},g.prototype.removeCallback=function(t){var e,n;for(e=0,n=this.copyCallbacks.length;n>e;e++)if(this.copyCallbacks[e]===t)return this.copyCallbacks.splice(e,1),!0;for(e=0,n=this.cutCallbacks.length;n>e;e++)if(this.cutCallbacks[e]===t)return this.cutCallbacks.splice(e,1),!0;for(e=0,n=this.pasteCallbacks.length;n>e;e++)if(this.pasteCallbacks[e]===t)return this.pasteCallbacks.splice(e,1),!0;return!1},g.prototype.triggerCut=function(t){var e=this;e.cutCallbacks&&setTimeout(function(){for(var n=0,i=e.cutCallbacks.length;i>n;n++)e.cutCallbacks[n](t)},50)},g.prototype.triggerPaste=function(t,e){var n=this;n.pasteCallbacks&&setTimeout(function(){for(var i=(e||n.elTextarea.value).replace(/\n$/,""),o=0,s=n.pasteCallbacks.length;s>o;o++)n.pasteCallbacks[o](i,t)},50)},g.prototype._bindEvent=function(){return e.jQuery?function(e,n,i){t(e).on(n+".copypaste",i)}:function(t,e,n){t.addEventListener(e,n,!1)}}(),w.prototype.appear=function(t){var e,n,i,o,s,r,a,l,c,u,h,d;if(!this.disabled){var p,f,m,g,w,v,y,b=this.instance,C=!1,S=!1,T=!1,x=!1;for(b.wtTable.isRowInViewport(t[0])||(C=!0),b.wtTable.isRowInViewport(t[2])||(T=!0),v=b.wtTable.rowStrategy.countVisible(),w=0;v>w;w++)if(y=b.wtTable.rowFilter.visibleToSource(w),y>=t[0]&&t[2]>=y){p=y;break}for(w=v-1;w>=0;w--)if(y=b.wtTable.rowFilter.visibleToSource(w),y>=t[0]&&t[2]>=y){m=y;break}if(C&&T)S=!0,x=!0;else{for(b.wtTable.isColumnInViewport(t[1])||(S=!0),b.wtTable.isColumnInViewport(t[3])||(x=!0),v=b.wtTable.columnStrategy.countVisible(),w=0;v>w;w++)if(y=b.wtTable.columnFilter.visibleToSource(w),y>=t[1]&&t[3]>=y){f=y;break}for(w=v-1;w>=0;w--)if(y=b.wtTable.columnFilter.visibleToSource(w),y>=t[1]&&t[3]>=y){g=y;break}}if(void 0===p||void 0===f)return this.disappear(),void 0;e=p!==m||f!==g,n=b.wtTable.getCell([p,f]),i=e?b.wtTable.getCell([m,g]):n,o=this.wtDom.offset(n),s=e?this.wtDom.offset(i):o,r=this.wtDom.offset(b.wtTable.TABLE),l=o.top,h=s.top+this.wtDom.outerHeight(i)-l,u=o.left,d=s.left+this.wtDom.outerWidth(i)-u,a=l-r.top-1,c=u-r.left-1;var E=this.wtDom.getComputedStyle(n);parseInt(E.borderTopWidth,10)>0&&(a+=1,h-=1),parseInt(E.borderLeftWidth,10)>0&&(c+=1,d-=1),C?this.topStyle.display="none":(this.topStyle.top=a+"px",this.topStyle.left=c+"px",this.topStyle.width=d+"px",this.topStyle.display="block"),S?this.leftStyle.display="none":(this.leftStyle.top=a+"px",this.leftStyle.left=c+"px",this.leftStyle.height=h+"px",this.leftStyle.display="block");var k=Math.floor(this.settings.border.width/2);T?this.bottomStyle.display="none":(this.bottomStyle.top=a+h-k+"px",this.bottomStyle.left=c+"px",this.bottomStyle.width=d+"px",this.bottomStyle.display="block"),x?this.rightStyle.display="none":(this.rightStyle.top=a+"px",this.rightStyle.left=c+d-k+"px",this.rightStyle.height=h+1+"px",this.rightStyle.display="block"),T||x||!this.hasSetting(this.settings.border.cornerVisible)?this.cornerStyle.display="none":(this.cornerStyle.top=a+h-4+"px",this.cornerStyle.left=c+d-4+"px",this.cornerStyle.display="block")}},w.prototype.disappear=function(){this.topStyle.display="none",this.leftStyle.display="none",this.bottomStyle.display="none",this.rightStyle.display="none",this.cornerStyle.display="none"},w.prototype.hasSetting=function(t){return"function"==typeof t?t():!!t},v.prototype.source=function(t){return t},v.prototype.offsetted=function(t){return t+this.offset},v.prototype.unOffsetted=function(t){return t-this.offset},v.prototype.fixed=function(t){return this.fixedCount>t?t-this.offset:t},v.prototype.unFixed=function(t){return this.fixedCount>t?t+this.offset:t},v.prototype.visibleToSource=function(t){return this.source(this.offsetted(this.fixed(t)))},v.prototype.sourceToVisible=function(t){return this.source(this.unOffsetted(this.unFixed(t)))},y.prototype.getSize=function(t){return this.cellSizes[t]},y.prototype.getContainerSize=function(t){return"function"==typeof this.containerSizeFn?this.containerSizeFn(t):this.containerSizeFn},y.prototype.countVisible=function(){return this.cellCount},y.prototype.isLastIncomplete=function(){return this.remainingSize>0},b.prototype.add=function(t,e,n){this.cache[t]||(this.cache[t]=[]),this.cache[t][e]||(this.cache[t][e]=[]),this.cache[t][e][n]=!0},b.prototype.test=function(t,e,n){return this.cache[t]&&this.cache[t][e]&&this.cache[t][e][n]},C.prototype=new v,C.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetColumn,this.total=t.getSetting("totalColumns"),this.fixedCount=t.getSetting("fixedColumnsLeft"),this.countTH=t.getSetting("rowHeaders").length},C.prototype.offsettedTH=function(t){return t-this.countTH},C.prototype.unOffsettedTH=function(t){return t+this.countTH},C.prototype.visibleRowHeadedColumnToSourceColumn=function(t){return this.visibleToSource(this.offsettedTH(t))},C.prototype.sourceColumnToVisibleRowHeadedColumn=function(t){return this.unOffsettedTH(this.sourceToVisible(t))},S.prototype=new y,S.prototype.getSize=function(t){return this.cellSizes[t]+(this.cellStretch[t]||0)},S.prototype.stretch=function(){var t=this.getContainerSize(this.cellSizesSum),e=0;if(this.remainingSize=this.cellSizesSum-t,this.cellStretch.length=0,"all"===this.strategy){if(0>this.remainingSize){for(var n,i=t/this.cellSizesSum;this.cellCount-1>e;)n=Math.floor(i*this.cellSizes[e]),this.remainingSize+=n-this.cellSizes[e],this.cellStretch[e]=n-this.cellSizes[e],e++;this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0}}else"last"===this.strategy&&0>this.remainingSize&&(this.cellStretch[this.cellCount-1]=-this.remainingSize,this.remainingSize=0)},T.prototype.draw=function(t){return this.drawInterrupted=!1,t||this.wtDom.isVisible(this.wtTable.TABLE)?(this.getSetting("beforeDraw",!t),t=t&&this.getSetting("offsetRow")===this.lastOffsetRow&&this.getSetting("offsetColumn")===this.lastOffsetColumn,this.drawn&&(this.scrollVertical(0),this.scrollHorizontal(0)),this.lastOffsetRow=this.getSetting("offsetRow"),this.lastOffsetColumn=this.getSetting("offsetColumn"),this.wtTable.draw(t),this.getSetting("onDraw"),this):(this.drawInterrupted=!0,void 0)},T.prototype.update=function(t,e){return this.wtSettings.update(t,e)},T.prototype.scrollVertical=function(t){return this.wtScroll.scrollVertical(t)},T.prototype.scrollHorizontal=function(t){return this.wtScroll.scrollHorizontal(t)},T.prototype.scrollViewport=function(t){return this.wtScroll.scrollViewport(t),this},T.prototype.getViewport=function(){return[this.wtTable.rowFilter.visibleToSource(0),this.wtTable.columnFilter.visibleToSource(0),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]},T.prototype.getSetting=function(t,e,n,i){return this.wtSettings.getSetting(t,e,n,i)},T.prototype.hasSetting=function(t){return this.wtSettings.has(t)},T.prototype.destroy=function(){t(document.body).off("."+this.guid),this.wtScrollbars.destroy(),clearTimeout(this.wheelTimeout),clearTimeout(this.dblClickTimeout)},x.prototype.closest=function(t,e,n){for(;null!=t&&t!==n;){if(1===t.nodeType&&e.indexOf(t.nodeName)>-1)return t;t=t.parentNode}return null},x.prototype.isChildOf=function(t,e){for(var n=t.parentNode;null!=n;){if(n==e)return!0;n=n.parentNode}return!1},x.prototype.index=function(t){for(var e=0;t=t.previousSibling;)++e;return e},document.documentElement.classList?(x.prototype.hasClass=function(t,e){return t.classList.contains(e)},x.prototype.addClass=function(t,e){t.classList.add(e)},x.prototype.removeClass=function(t,e){t.classList.remove(e)}):(x.prototype.hasClass=function(t,e){return t.className.match(RegExp("(\\s|^)"+e+"(\\s|$)"))},x.prototype.addClass=function(t,e){this.hasClass(t,e)||(t.className+=" "+e)},x.prototype.removeClass=function(t,e){if(this.hasClass(t,e)){var n=RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}),x.prototype.removeTextNodes=function(t,e){if(3===t.nodeType)e.removeChild(t);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(t.nodeName)>-1)for(var n=t.childNodes,i=n.length-1;i>=0;i--)this.removeTextNodes(n[i],t)},x.prototype.empty=function(t){for(var e;e=t.lastChild;)t.removeChild(e)},x.prototype.HTML_CHARACTERS=/(<(.*)>|&(.*);)/,x.prototype.fastInnerHTML=function(t,e){this.HTML_CHARACTERS.test(e)?t.innerHTML=e:this.fastInnerText(t,e)},x.prototype.fastInnerText=document.createTextNode("test").textContent?function(t,e){var n=t.firstChild;n&&3===n.nodeType&&null===n.nextSibling?n.textContent=e:(this.empty(t),t.appendChild(document.createTextNode(e)))}:function(t,e){var n=t.firstChild;n&&3===n.nodeType&&null===n.nextSibling?n.data=e:(this.empty(t),t.appendChild(document.createTextNode(e)))},x.prototype.isVisible=function(t){try{if(!t.offsetParent)return!1}catch(e){return!1}if(t.offsetWidth>0)return!0;for(var n=t;n!==document.documentElement;){if(null===n)return!1;if(11===n.nodeType)return!0;if("none"===n.style.display)return!1;n=n.parentNode}return!0},x.prototype.offset=function(t){if(this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName){var n=t.getBoundingClientRect();return{top:n.top+(e.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0),left:n.left+(e.pageXOffset||document.documentElement.scrollLeft)-(document.documentElement.clientLeft||0)}}for(var i=t.offsetLeft,o=t.offsetTop,s=t;(t=t.offsetParent)&&t!==document.body;)i+=t.offsetLeft,o+=t.offsetTop,s=t;return s&&"fixed"===s.style.position&&(i+=e.pageXOffset||document.documentElement.scrollLeft,o+=e.pageYOffset||document.documentElement.scrollTop),{left:i,top:o}},x.prototype.getComputedStyle=function(t){return t.currentStyle||document.defaultView.getComputedStyle(t)},x.prototype.outerWidth=function(t){return t.offsetWidth},x.prototype.outerHeight=function(t){return this.hasCaptionProblem()&&t.firstChild&&"CAPTION"===t.firstChild.nodeName?t.offsetHeight+t.firstChild.offsetHeight:t.offsetHeight},function(){function t(){var t=document.createElement("TABLE");t.style.borderSpacing=0,t.style.borderWidth=0,t.style.padding=0;var n=document.createElement("TBODY");t.appendChild(n),n.appendChild(document.createElement("TR")),n.firstChild.appendChild(document.createElement("TD")),n.firstChild.firstChild.innerHTML="t
t";var i=document.createElement("CAPTION");i.innerHTML="c
c
c
c",i.style.padding=0,i.style.margin=0,t.insertBefore(i,n),document.body.appendChild(t),e=t.offsetHeight<2*t.lastChild.offsetHeight,document.body.removeChild(t)}var e;x.prototype.hasCaptionProblem=function(){return void 0===e&&t(),e}}(),E.prototype.parentCell=function(t){var e={},n=this.instance.wtTable.TABLE,i=this.wtDom.closest(t,["TD","TH"],n);return i&&this.wtDom.isChildOf(i,n)?(e.coords=this.instance.wtTable.getCoords(i),e.TD=i):this.wtDom.hasClass(t,"wtBorder")&&this.wtDom.hasClass(t,"current")&&!this.wtDom.hasClass(t,"corner")&&(e.coords=this.instance.selections.current.selected[0],e.TD=this.instance.wtTable.getCell(e.coords)),e},Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,n=Number(arguments[1])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=e);e>n;n++)if(n in this&&this[n]===t)return n;return-1}),e.requestAnimFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){return e.setTimeout(t,1e3/60)}}(),e.cancelRequestAnimFrame=function(){return e.cancelAnimationFrame||e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}(),e.getComputedStyle||function(){var t,n={getPropertyValue:function(e){return"float"==e&&(e="styleFloat"),t.currentStyle[e.toUpperCase()]||null}};e.getComputedStyle=function(e){return t=e,n}}(),k.prototype=new v,k.prototype.readSettings=function(t){this.offset=t.wtSettings.settings.offsetRow,this.total=t.getSetting("totalRows"),this.fixedCount=t.getSetting("fixedRowsTop")},R.prototype=new y,R.prototype.add=function(t,e,n){if(0>this.remainingSize){var i=this.sizeAtIndex(t,e);if(void 0===i)return;var o=this.getContainerSize(this.cellSizesSum+i);if(n?this.cellSizes.unshift(i):this.cellSizes.push(i),this.cellSizesSum+=i,this.cellCount++,this.remainingSize=this.cellSizesSum-o,n&&this.remainingSize>0)for(;this.cellCount>0&&this.cellSizes[this.cellCount-1]0?this.scrollLogicVertical(t,i,s,o,r,function(t){return o>t-i&&t-i>=0?n.getSetting("rowHeight",t-i):n.getSetting("rowHeight",t)},function(t){n.wtTable.verticalRenderReverse=t}):0,e!==i&&this.instance.wtScrollbars.vertical.scrollTo(e),n},D.prototype.scrollHorizontal=function(t){if(!this.instance.drawn)throw Error("scrollHorizontal can only be called after table was drawn to DOM");var e,n=this.instance,i=n.getSetting("offsetColumn"),o=n.getSetting("fixedColumnsLeft"),s=n.getSetting("totalColumns"),r=n.wtViewport.getViewportWidth();return e=s>0?this.scrollLogicHorizontal(t,i,s,o,r,function(t){return o>t-i&&t-i>=0?n.getSetting("columnWidth",t-i):n.getSetting("columnWidth",t)}):0,e!==i&&this.instance.wtScrollbars.horizontal.scrollTo(e),n},D.prototype.scrollLogicVertical=function(t,e,n,i,o,s,r){var a=e+t;return a>=n-i&&(a=n-i-1,r(!0)),0>a&&(a=0),a},D.prototype.scrollLogicHorizontal=function(t,e,n,i,o,s){var r,a=e+t,l=0;if(a>i){for(a>=n-i&&(a=n-i-1),r=a;o>l&&n>r;)l+=s(r),r++;if(o>l)for(;a>0&&(l+=s(a-1),o>l);)a--}else 0>a&&(a=0);return a},D.prototype.scrollViewport=function(t){var e=this.instance.getSetting("offsetRow"),n=(this.instance.getSetting("offsetColumn"),this.instance.wtTable.getLastVisibleRow()),i=this.instance.getSetting("totalRows"),o=this.instance.getSetting("totalColumns"),s=this.instance.getSetting("fixedRowsTop"),r=this.instance.getSetting("fixedColumnsLeft");if(0>t[0]||t[0]>i-1)throw Error("row "+t[0]+" does not exist");if(0>t[1]||t[1]>o-1)throw Error("column "+t[1]+" does not exist");if(t[0]>n?(this.scrollVertical(t[0]-s-e),this.instance.wtTable.verticalRenderReverse=!0):t[0]===n&&this.instance.wtTable.rowStrategy.isLastIncomplete()?(this.scrollVertical(t[0]-s-e),this.instance.wtTable.verticalRenderReverse=!0):e>t[0]-s?this.scrollVertical(t[0]-s-e):this.scrollVertical(0),this.instance.wtTable.isColumnBeforeViewport(t[1]))this.instance.wtScrollbars.horizontal.scrollTo(t[1]-r);else if(this.instance.wtTable.isColumnAfterViewport(t[1])||this.instance.wtTable.getLastVisibleColumn()===t[1]&&!this.instance.wtTable.isLastColumnFullyVisible()){for(var a=0,l=0;r>l;l++)a+=this.instance.getSetting("columnWidth",l);var c=t[1];a+=this.instance.getSetting("columnWidth",c);var u=this.instance.wtViewport.getViewportWidth();if(u>a)for(var h=this.instance.getSetting("columnWidth",c-1);u>a+h&&c>=r;)c--,a+=h;this.instance.wtScrollbars.horizontal.scrollTo(c-r)}return this.instance},P.prototype.init=function(){var e=this;this.$table=t(this.instance.wtTable.TABLE),this.slider=document.createElement("DIV"),this.sliderStyle=this.slider.style,this.sliderStyle.position="absolute",this.sliderStyle.top="0",this.sliderStyle.left="0",this.sliderStyle.display="none",this.slider.className="dragdealer "+this.type,this.handle=document.createElement("DIV"),this.handleStyle=this.handle.style,this.handle.className="handle",this.slider.appendChild(this.handle),this.container=this.instance.wtTable.parent,this.container.appendChild(this.slider);var n=!0;this.dragTimeout=null;var i,o=function(){e.onScroll(i)};this.dragdealer=new te(this.slider,{vertical:"vertical"===this.type,horizontal:"horizontal"===this.type,slide:!1,speed:100,animationCallback:function(t,s){return n?(n=!1,void 0):(e.skipRefresh=!0,i="vertical"===e.type?s:t,null===e.dragTimeout&&(e.dragTimeout=setInterval(o,100),o()),void 0)},callback:function(t,n){e.skipRefresh=!1,clearInterval(e.dragTimeout),e.dragTimeout=null,i="vertical"===e.type?n:t,e.onScroll(i)}}),this.skipRefresh=!1},P.prototype.onScroll=function(t){if(this.instance.drawn&&(this.readSettings(),this.total>this.visibleCount)){var e=Math.round(this.handlePosition*this.total/this.sliderSize);1===t?"vertical"===this.type?this.instance.scrollVertical(1/0).draw():this.instance.scrollHorizontal(1/0).draw():e!==this.offset?"vertical"===this.type?this.instance.scrollVertical(e-this.offset).draw():this.instance.scrollHorizontal(e-this.offset).draw():this.refresh()}},P.prototype.getHandleSizeRatio=function(t,e){return!e||t>e||t==e?1:1/e},P.prototype.prepare=function(){if(!this.skipRefresh){var t=this.getHandleSizeRatio(this.visibleCount,this.total);this.visible=(1===t||isNaN(t))&&"auto"===this.scrollMode||"none"===this.scrollMode?!1:!0}},P.prototype.refresh=function(){if(!this.skipRefresh){if(!this.visible)return this.sliderStyle.display="none",void 0;var t,e,n,i,o=this.visibleCount,s=this.instance.wtViewport.getWorkspaceWidth(),r=this.instance.wtViewport.getWorkspaceHeight();1/0===s&&(s=this.instance.wtViewport.getWorkspaceActualWidth()),1/0===r&&(r=this.instance.wtViewport.getWorkspaceActualHeight()),"vertical"===this.type?(this.instance.wtTable.rowStrategy.isLastIncomplete()&&o--,e=r-2,this.sliderStyle.top=this.instance.wtDom.offset(this.$table[0]).top-this.instance.wtDom.offset(this.container).top+"px",this.sliderStyle.left=s-1+"px",this.sliderStyle.height=Math.max(e,0)+"px"):(this.instance.wtTable.columnStrategy.isLastIncomplete()&&o--,e=s-2,this.sliderStyle.left=this.instance.wtDom.offset(this.$table[0]).left-this.instance.wtDom.offset(this.container).left+"px",this.sliderStyle.top=r-1+"px",this.sliderStyle.width=Math.max(e,0)+"px"),t=this.getHandleSizeRatio(o,this.total),n=Math.round(e*t),10>n&&(n=15),i=Math.floor(e*(this.offset/this.total)),n+i>e&&(i=e-n),"vertical"===this.type?(this.handleStyle.height=n+"px",this.handleStyle.top=i+"px"):(this.handleStyle.width=n+"px",this.handleStyle.left=i+"px"),this.sliderStyle.display="block"}},P.prototype.destroy=function(){clearInterval(this.dragdealer.interval)};var K=function(t){this.instance=t,this.type="vertical",this.init()};K.prototype=new P,K.prototype.scrollTo=function(t){this.instance.update("offsetRow",t)},K.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollV"),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows"),this.visibleCount=this.instance.wtTable.rowStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.rowStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.top,10),this.sliderSize=parseInt(this.sliderStyle.height,10),this.fixedCount=this.instance.getSetting("fixedRowsTop")};var U=function(t){this.instance=t,this.type="horizontal",this.init()};U.prototype=new P,U.prototype.scrollTo=function(t){this.instance.update("offsetColumn",t)},U.prototype.readSettings=function(){this.scrollMode=this.instance.getSetting("scrollH"),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns"),this.visibleCount=this.instance.wtTable.columnStrategy.countVisible(),this.visibleCount>1&&this.instance.wtTable.columnStrategy.isLastIncomplete()&&this.visibleCount--,this.handlePosition=parseInt(this.handleStyle.left,10),this.sliderSize=parseInt(this.sliderStyle.width,10),this.fixedCount=this.instance.getSetting("fixedColumnsLeft")},H.prototype.init=function(){this.fixedContainer=this.instance.wtTable.TABLE.parentNode.parentNode.parentNode,this.fixed=this.instance.wtTable.TABLE.parentNode.parentNode,this.TABLE=this.instance.wtTable.TABLE,this.$scrollHandler=t(e);var n=this;this.$scrollHandler.on("scroll.walkontable",function(){return n.instance.wtTable.parent.parentNode?(n.onScroll(),void 0):(n.destroy(),void 0)}),this.readSettings()},H.prototype.onScroll=function(){if(this.readSettings(),this.windowScrollPosition!==this.lastWindowScrollPosition){this.lastWindowScrollPosition=this.windowScrollPosition;var t,e=0;this.windowScrollPosition>this.tableParentOffset&&(t=this.windowScrollPosition-this.tableParentOffset,e=Math.ceil(t/20,10),e=Math.min(e,this.total)),this.instance.update("offsetRow",e),this.instance.draw()}},H.prototype.prepare=function(){},H.prototype.availableSize=function(){var t;return t=this.windowScrollPosition>this.tableParentOffset?this.instance.wtTable.getLastVisibleRow()===this.total-1?this.instance.wtDom.outerHeight(this.TABLE):this.windowSize:this.windowSize-(this.tableParentOffset-this.windowScrollPosition)},H.prototype.refresh=function(){var t=this.getLastCell();this.measureBefore=this.offset*this.cellSize,this.measureInside=this.getTableSize(),this.measureAfter=-1===t?0:(this.total-t-1)*this.cellSize,this.applyToDOM()},H.prototype.destroy=function(){this.$scrollHandler.off("scroll.walkontable")};var q=function(t){this.instance=t,this.type="vertical",this.cellSize=20,this.init()};q.prototype=new H,q.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleRow()},q.prototype.getTableSize=function(){return this.instance.wtDom.outerHeight(this.TABLE)},q.prototype.applyToDOM=function(){this.windowScrollPosition>this.tableParentOffset?(this.fixed.style.position="fixed",this.fixed.style.top="0",this.fixed.style.left=this.tableParentOtherOffset):this.fixed.style.position="relative";var t=!1;t||(this.fixedContainer.style.paddingTop=this.measureBefore+"px",this.fixedContainer.style.paddingBottom=this.measureInside+this.measureAfter+"px")},q.prototype.scrollTo=function(t){this.$scrollHandler.scrollTop(this.tableParentOffset+t*this.cellSize)},q.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.top,this.tableParentOtherOffset=t.left,this.windowSize=this.$scrollHandler.height(),this.windowScrollPosition=this.$scrollHandler.scrollTop(),this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows")};var Q=function(t){this.instance=t,this.type="horizontal",this.cellSize=50,this.init()};Q.prototype=new H,Q.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleColumn()},Q.prototype.getTableSize=function(){return this.instance.wtDom.outerWidth(this.TABLE)},Q.prototype.applyToDOM=function(){this.windowScrollPosition>this.tableParentOffset?(this.fixed.style.position="fixed",this.fixed.style.left="0",this.fixed.style.top=this.tableParentOtherOffset):this.fixed.style.position="relative";var t=!1;t||(this.fixedContainer.style.paddingLeft=this.measureBefore+"px",this.fixedContainer.style.paddingRight=this.measureInside+this.measureAfter+"px")},Q.prototype.scrollTo=function(t){this.$scrollHandler.scrollLeft(this.tableParentOffset+t*this.cellSize)},Q.prototype.readSettings=function(){var t=this.instance.wtDom.offset(this.fixedContainer);this.tableParentOffset=t.left,this.tableParentOtherOffset=t.top,this.windowSize=this.$scrollHandler.width(),this.windowScrollPosition=this.$scrollHandler.scrollLeft(),this.offset=this.instance.getSetting("offsetColumn"),this.total=this.instance.getSetting("totalColumns")},A.prototype.destroy=function(){this.vertical.destroy(),this.horizontal.destroy()},A.prototype.refresh=function(){this.horizontal.readSettings(),this.vertical.readSettings(),this.horizontal.prepare(),this.vertical.prepare(),this.horizontal.refresh(),this.vertical.refresh()},M.prototype.add=function(t){this.selected.push(t)},M.prototype.clear=function(){this.selected.length=0},M.prototype.getCorners=function(){var t,e,n,i,o,s=this.selected.length;if(s>0&&(t=n=this.selected[0][0],e=i=this.selected[0][1],s>1))for(o=1;s>o;o++)t>this.selected[o][0]?t=this.selected[o][0]:this.selected[o][0]>n&&(n=this.selected[o][0]),e>this.selected[o][1]?e=this.selected[o][1]:this.selected[o][1]>i&&(i=this.selected[o][1]);return[t,e,n,i]},M.prototype.draw=function(){var t,e,n,i,o,s=this.instance.wtTable.rowStrategy.countVisible(),r=this.instance.wtTable.columnStrategy.countVisible();if(this.selected.length){for(t=this.getCorners(),e=0;s>e;e++)for(n=0;r>n;n++)i=this.instance.wtTable.rowFilter.visibleToSource(e),o=this.instance.wtTable.columnFilter.visibleToSource(n),i>=t[0]&&t[2]>=i&&o>=t[1]&&t[3]>=o?this.instance.wtTable.currentCellCache.add(e,n,this.settings.className):i>=t[0]&&t[2]>=i?this.instance.wtTable.currentCellCache.add(e,n,this.settings.highlightRowClassName):o>=t[1]&&t[3]>=o&&this.instance.wtTable.currentCellCache.add(e,n,this.settings.highlightColumnClassName); this.border&&this.border.appear(t)}else this.border&&this.border.disappear()},O.prototype.update=function(t,e){if(void 0===e)for(var n in t)t.hasOwnProperty(n)&&(this.settings[n]=t[n]);else this.settings[t]=e;return this.instance},O.prototype.getSetting=function(t,e,n,i){return this[t]?this[t](e,n,i):this._getSetting(t,e,n,i)},O.prototype._getSetting=function(t,e,n,i){return"function"==typeof this.settings[t]?this.settings[t](e,n,i):void 0!==e&&"[object Array]"===Object.prototype.toString.call(this.settings[t])?this.settings[t][e]:this.settings[t]},O.prototype.has=function(t){return!!this.settings[t]},O.prototype.rowHeight=function(t){var e=this.instance.wtTable.rowFilter.sourceToVisible(t),n=this.instance.wtTable.rowStrategy.getSize(e);return void 0!==n?n:20},$.prototype.refreshHiderDimensions=function(){var t=this.instance.wtViewport.getWorkspaceHeight(),e=this.instance.wtViewport.getWorkspaceWidth(),n=this.spreader.style;1/0!==t||1/0!==e?(1/0===t&&(t=this.instance.wtViewport.getWorkspaceActualHeight()),1/0===e&&(e=this.instance.wtViewport.getWorkspaceActualWidth()),this.hiderStyle.overflow="hidden",n.position="absolute",n.top="0",n.left="0","dragdealer"===this.instance.getSetting("scrollbarModelV")&&(n.height="4000px"),"dragdealer"===this.instance.getSetting("scrollbarModelH")&&(n.width="4000px"),0>t&&(t=0),this.hiderStyle.height=t+"px",this.hiderStyle.width=e+"px"):(n.position="relative",n.width="auto",n.height="auto")},$.prototype.refreshStretching=function(){var t=this.instance,e=t.getSetting("stretchH"),n=t.getSetting("totalRows"),i=t.getSetting("totalColumns"),o=t.getSetting("offsetColumn"),s=function(t){return r.instance.wtViewport.getViewportWidth(t)},r=this,a=function(e){var n=r.columnFilter.visibleToSource(e);return i>n?t.getSetting("columnWidth",n):void 0};"hybrid"===e&&(e=o>0?"last":"none");var l=function(t){return r.instance.wtViewport.getViewportHeight(t)},c=function(t,e){var i=r.rowFilter.visibleToSource(t);return n>i?r.verticalRenderReverse&&0===t?r.wtDom.outerHeight(e)-1:r.wtDom.outerHeight(e):void 0};this.columnStrategy=new S(s,a,e),this.rowStrategy=new R(l,c)},$.prototype.adjustAvailableNodes=function(){for(var t,e,n,i,o=this.instance.getSetting("rowHeaders"),s=o.length,r=this.instance.getSetting("columnHeaders");s>this.colgroupChildrenLength;)this.COLGROUP.appendChild(document.createElement("COL")),this.colgroupChildrenLength++;for(this.refreshStretching(),t=this.columnStrategy.cellCount;t+s>this.colgroupChildrenLength;)this.COLGROUP.appendChild(document.createElement("COL")),this.colgroupChildrenLength++;for(;this.colgroupChildrenLength>t+s;)this.COLGROUP.removeChild(this.COLGROUP.lastChild),this.colgroupChildrenLength--;if(e=this.THEAD.firstChild,r.length){for(e||(e=document.createElement("TR"),this.THEAD.appendChild(e)),this.theadChildrenLength=e.childNodes.length;t+s>this.theadChildrenLength;)e.appendChild(document.createElement("TH")),this.theadChildrenLength++;for(;this.theadChildrenLength>t+s;)e.removeChild(e.lastChild),this.theadChildrenLength--}else e&&this.wtDom.empty(e);for(i=0;this.colgroupChildrenLength>i;i++)s>i?this.wtDom.addClass(this.COLGROUP.childNodes[i],"rowHeader"):this.wtDom.removeClass(this.COLGROUP.childNodes[i],"rowHeader");if(r.length&&(e=this.THEAD.firstChild,s))for(n=e.firstChild,i=0;s>i;i++)o[i](-s+i,n),n=n.nextSibling;for(i=0;t>i;i++)r.length&&r[0](this.columnFilter.visibleToSource(i),e.childNodes[s+i])},$.prototype.adjustColumns=function(t,e){for(var n=t.childNodes.length;e>n;){var i=document.createElement("TD");t.appendChild(i),n++}for(;n>e;)t.removeChild(t.lastChild),n--},$.prototype.draw=function(t){return this.rowFilter.readSettings(this.instance),this.columnFilter.readSettings(this.instance),t?this.instance.wtScrollbars.refresh():(this.tableOffset=this.wtDom.offset(this.TABLE),this._doDraw()),this.refreshPositions(t),this.instance.drawn=!0,this},$.prototype._doDraw=function(){var t,e,n,i,o,s,r,a,l,c=0,u=this.instance.getSetting("offsetRow"),h=this.instance.getSetting("totalRows"),d=this.instance.getSetting("totalColumns"),p=this.instance.getSetting("rowHeaders"),f=p.length,m=!1;this.verticalRenderReverse&&(l=u),this.instance.wtViewport.resetSettings();var g=!1;if(this.verticalRenderReverse&&(u===h-this.rowFilter.fixedCount-1?g=!0:(this.instance.update("offsetRow",u+1),this.rowFilter.readSettings(this.instance))),d>0){t=this.rowFilter.visibleToSource(c);for(var w=!0;h>t&&t>=0;){if(c>=this.tbodyChildrenLength||this.verticalRenderReverse&&c>=this.rowFilter.fixedCount){for(o=document.createElement("TR"),e=0;f>e;e++)o.appendChild(document.createElement("TH"));this.verticalRenderReverse&&c>=this.rowFilter.fixedCount?this.TBODY.insertBefore(o,this.TBODY.childNodes[this.rowFilter.fixedCount]||this.TBODY.firstChild):this.TBODY.appendChild(o),this.tbodyChildrenLength++}else o=0===c?this.TBODY.firstChild:o.nextSibling;for(r=o.firstChild,e=0;f>e;e++)"TD"==r.nodeName&&(s=r,r=document.createElement("TH"),o.insertBefore(r,s),o.removeChild(s)),p[e](t,r),r=r.nextSibling;if(w)for(w=!1,this.adjustAvailableNodes(),m=!0,i=this.columnStrategy.cellCount,this.adjustColumns(o,i+f),a=this.instance.wtViewport.getWorkspaceWidth(),this.columnStrategy.stretch(),e=0;i>e;e++)this.COLGROUP.childNodes[e+f].style.width=this.columnStrategy.getSize(e)+"px";else this.adjustColumns(o,i+f);for(e=0;i>e;e++)n=this.columnFilter.visibleToSource(e),s=0===e?o.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(n)]:s.nextSibling,"TH"==s.nodeName&&(r=s,s=document.createElement("TD"),o.insertBefore(s,r),o.removeChild(r)),s.className="",s.removeAttribute("style"),this.instance.getSetting("cellRenderer",t,n,s);if(u=this.instance.getSetting("offsetRow"),this.verticalRenderReverse&&g){if(-this.wtDom.outerHeight(o.firstChild)=this.rowFilter.fixedCount){if(0===u)break;this.instance.update("offsetRow",u-1),this.rowFilter.readSettings(this.instance)}else c++;t=this.rowFilter.visibleToSource(c)}}for(m||this.adjustAvailableNodes(),c=this.rowStrategy.countVisible();this.tbodyChildrenLength>c;)this.TBODY.removeChild(this.TBODY.lastChild),this.tbodyChildrenLength--;if(this.instance.wtScrollbars.refresh(),a!==this.instance.wtViewport.getWorkspaceWidth())for(this.columnStrategy.stretch(),e=0;this.columnStrategy.cellCount>e;e++)this.COLGROUP.childNodes[e+f].style.width=this.columnStrategy.getSize(e)+"px";this.verticalRenderReverse=!1},$.prototype.refreshPositions=function(t){this.refreshHiderDimensions(),this.refreshSelections(t)},$.prototype.refreshSelections=function(t){var e,n,i,o,s,r,a=[],l=this.rowStrategy.countVisible(),c=this.columnStrategy.countVisible();if(this.oldCellCache=this.currentCellCache,this.currentCellCache=new b,this.instance.selections)for(n in this.instance.selections)this.instance.selections.hasOwnProperty(n)&&(this.instance.selections[n].draw(),this.instance.selections[n].settings.className&&a.push(this.instance.selections[n].settings.className),this.instance.selections[n].settings.highlightRowClassName&&a.push(this.instance.selections[n].settings.highlightRowClassName),this.instance.selections[n].settings.highlightColumnClassName&&a.push(this.instance.selections[n].settings.highlightColumnClassName));for(r=a.length,e=0;l>e;e++)for(i=0;c>i;i++)for(n=this.rowFilter.visibleToSource(e),o=this.columnFilter.visibleToSource(i),s=0;r>s;s++)this.currentCellCache.test(e,i,a[s])?this.wtDom.addClass(this.getCell([n,o]),a[s]):t&&this.oldCellCache.test(e,i,a[s])&&this.wtDom.removeClass(this.getCell([n,o]),a[s])},$.prototype.getCell=function(t){return this.isRowBeforeViewport(t[0])?-1:this.isRowAfterViewport(t[0])?-2:this.isColumnBeforeViewport(t[1])?-3:this.isColumnAfterViewport(t[1])?-4:this.TBODY.childNodes[this.rowFilter.sourceToVisible(t[0])].childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(t[1])]},$.prototype.getCoords=function(t){return[this.rowFilter.visibleToSource(this.wtDom.index(t.parentNode)),this.columnFilter.visibleRowHeadedColumnToSourceColumn(t.cellIndex)]},$.prototype.getLastVisibleRow=function(){return this.rowFilter.visibleToSource(this.rowStrategy.cellCount-1)},$.prototype.getLastVisibleColumn=function(){return this.columnFilter.visibleToSource(this.columnStrategy.cellCount-1)},$.prototype.isRowBeforeViewport=function(t){return this.rowFilter.sourceToVisible(t)=this.rowFilter.fixedCount},$.prototype.isRowAfterViewport=function(t){return t>this.getLastVisibleRow()},$.prototype.isColumnBeforeViewport=function(t){return this.columnFilter.sourceToVisible(t)=this.columnFilter.fixedCount},$.prototype.isColumnAfterViewport=function(t){return t>this.getLastVisibleColumn()},$.prototype.isRowInViewport=function(t){return!this.isRowBeforeViewport(t)&&!this.isRowAfterViewport(t)},$.prototype.isColumnInViewport=function(t){return!this.isColumnBeforeViewport(t)&&!this.isColumnAfterViewport(t)},$.prototype.isLastRowFullyVisible=function(){return this.getLastVisibleRow()===this.instance.getSetting("totalRows")-1&&!this.rowStrategy.isLastIncomplete()},$.prototype.isLastColumnFullyVisible=function(){return this.getLastVisibleColumn()===this.instance.getSetting("totalColumns")-1&&!this.columnStrategy.isLastIncomplete()},I.prototype.getWorkspaceHeight=function(t){var e=this.instance.getSetting("height");return(1/0===e||void 0===e||null===e||1>e)&&(e=this.instance.wtScrollbars.vertical instanceof H?this.instance.wtScrollbars.vertical.availableSize():1/0),1/0!==e&&(t>=e?e-=this.instance.getSetting("scrollbarHeight"):this.instance.wtScrollbars.horizontal.visible&&(e-=this.instance.getSetting("scrollbarHeight"))),e},I.prototype.getWorkspaceWidth=function(t){var e=this.instance.getSetting("width");return(1/0===e||void 0===e||null===e||1>e)&&(e=this.instance.wtScrollbars.horizontal instanceof H?this.instance.wtScrollbars.horizontal.availableSize():1/0),1/0!==e&&(t>=e?e-=this.instance.getSetting("scrollbarWidth"):this.instance.wtScrollbars.vertical.visible&&(e-=this.instance.getSetting("scrollbarWidth"))),e},I.prototype.getWorkspaceActualHeight=function(){return this.instance.wtDom.outerHeight(this.instance.wtTable.TABLE)},I.prototype.getWorkspaceActualWidth=function(){return this.instance.wtDom.outerWidth(this.instance.wtTable.TABLE)||this.instance.wtDom.outerWidth(this.instance.wtTable.TBODY)||this.instance.wtDom.outerWidth(this.instance.wtTable.THEAD)},I.prototype.getViewportHeight=function(t){var e=this.getWorkspaceHeight(t);if(1/0===e)return e;if(isNaN(this.columnHeaderHeight)){var n=this.instance.wtDom.offset(this.instance.wtTable.TBODY),i=this.instance.wtTable.tableOffset;this.columnHeaderHeight=n.top-i.top}return this.columnHeaderHeight>0?e-this.columnHeaderHeight:e},I.prototype.getViewportWidth=function(t){var e=this.getWorkspaceWidth(t);if(1/0===e)return e;if(isNaN(this.rowHeaderWidth)){var n=this.instance.wtTable.TBODY?this.instance.wtTable.TBODY.firstChild:null;if(n){var i=n.firstChild;for(this.rowHeaderWidth=0;i&&"TH"===i.nodeName;)this.rowHeaderWidth+=this.instance.wtDom.outerWidth(i),i=i.nextSibling}}return this.rowHeaderWidth>0?e-this.rowHeaderWidth:e},I.prototype.resetSettings=function(){this.rowHeaderWidth=0/0,this.columnHeaderHeight=0/0};var J={x:0,y:0,init:function(){this.setEvent("mouse"),this.setEvent("touch")},setEvent:function(t){var e=document["on"+t+"move"]||function(){};document["on"+t+"move"]=function(t){e(t),J.refresh(t)}},refresh:function(t){t||(t=e.event),"mousemove"==t.type?this.set(t):t.touches&&this.set(t.touches[0])},set:function(t){t.pageX||t.pageY?(this.x=t.pageX,this.y=t.pageY):(t.clientX||t.clientY)&&(this.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,this.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop)}};J.init();var Z={get:function(t){var e=0,n=0;if(t.offsetParent)do n+=t.offsetLeft,e+=t.offsetTop;while(t=t.offsetParent);return[n,e]}},te=function(t,e){if("string"==typeof t&&(t=document.getElementById(t)),t){var n=t.getElementsByTagName("div")[0];n&&-1!=n.className.search(/(^|\s)handle(\s|$)/)&&(this.init(t,n,e||{}),this.setup())}};te.prototype={init:function(t,e,n){this.wrapper=t,this.handle=e,this.options=n,this.disabled=this.getOption("disabled",!1),this.horizontal=this.getOption("horizontal",!0),this.vertical=this.getOption("vertical",!1),this.slide=this.getOption("slide",!0),this.steps=this.getOption("steps",0),this.snap=this.getOption("snap",!1),this.loose=this.getOption("loose",!1),this.speed=this.getOption("speed",10)/100,this.xPrecision=this.getOption("xPrecision",0),this.yPrecision=this.getOption("yPrecision",0),this.callback=n.callback||null,this.animationCallback=n.animationCallback||null,this.bounds={left:n.left||0,right:-(n.right||0),top:n.top||0,bottom:-(n.bottom||0),x0:0,x1:0,xRange:0,y0:0,y1:0,yRange:0},this.value={prev:[-1,-1],current:[n.x||0,n.y||0],target:[n.x||0,n.y||0]},this.offset={wrapper:[0,0],mouse:[0,0],prev:[-999999,-999999],current:[0,0],target:[0,0]},this.change=[0,0],this.activity=!1,this.dragging=!1,this.tapping=!1},getOption:function(t,e){return void 0!==this.options[t]?this.options[t]:e},setup:function(){this.setWrapperOffset(),this.setBoundsPadding(),this.setBounds(),this.setSteps(),this.addListeners()},setWrapperOffset:function(){this.offset.wrapper=Z.get(this.wrapper)},setBoundsPadding:function(){this.bounds.left||this.bounds.right||(this.bounds.left=Z.get(this.handle)[0]-this.offset.wrapper[0],this.bounds.right=-this.bounds.left),this.bounds.top||this.bounds.bottom||(this.bounds.top=Z.get(this.handle)[1]-this.offset.wrapper[1],this.bounds.bottom=-this.bounds.top)},setBounds:function(){this.bounds.x0=this.bounds.left,this.bounds.x1=this.wrapper.offsetWidth+this.bounds.right,this.bounds.xRange=this.bounds.x1-this.bounds.x0-this.handle.offsetWidth,this.bounds.y0=this.bounds.top,this.bounds.y1=this.wrapper.offsetHeight+this.bounds.bottom,this.bounds.yRange=this.bounds.y1-this.bounds.y0-this.handle.offsetHeight,this.bounds.xStep=1/(this.xPrecision||Math.max(this.wrapper.offsetWidth,this.handle.offsetWidth)),this.bounds.yStep=1/(this.yPrecision||Math.max(this.wrapper.offsetHeight,this.handle.offsetHeight))},setSteps:function(){if(this.steps>1){this.stepRatios=[];for(var t=0;this.steps-1>=t;t++)this.stepRatios[t]=t/(this.steps-1)}},addListeners:function(){var t=this;this.wrapper.onselectstart=function(){return!1},this.handle.onmousedown=this.handle.ontouchstart=function(e){t.handleDownHandler(e)},this.wrapper.onmousedown=this.wrapper.ontouchstart=function(e){t.wrapperDownHandler(e)};var n=document.onmouseup||function(){};document.onmouseup=function(e){n(e),t.documentUpHandler(e)};var i=document.ontouchend||function(){};document.ontouchend=function(e){i(e),t.documentUpHandler(e)};var o=e.onresize||function(){};e.onresize=function(e){o(e),t.documentResizeHandler(e)},this.wrapper.onmousemove=function(){t.activity=!0},this.wrapper.onclick=function(){return!t.activity},this.interval=setInterval(function(){t.animate()},25),t.animate(!1,!0)},handleDownHandler:function(t){this.activity=!1,J.refresh(t),this.preventDefaults(t,!0),this.startDrag(),this.cancelEvent(t)},wrapperDownHandler:function(t){J.refresh(t),this.preventDefaults(t,!0),this.startTap()},documentUpHandler:function(){this.stopDrag(),this.stopTap()},documentResizeHandler:function(){this.setWrapperOffset(),this.setBounds(),this.update()},enable:function(){this.disabled=!1,this.handle.className=this.handle.className.replace(/\s?disabled/g,"")},disable:function(){this.disabled=!0,this.handle.className+=" disabled"},setStep:function(t,e,n){this.setValue(this.steps&&t>1?(t-1)/(this.steps-1):0,this.steps&&e>1?(e-1)/(this.steps-1):0,n)},setValue:function(t,e,n){this.setTargetValue([t,e||0]),n&&this.groupCopy(this.value.current,this.value.target)},startTap:function(t){this.disabled||(this.tapping=!0,this.setWrapperOffset(),this.setBounds(),void 0===t&&(t=[J.x-this.offset.wrapper[0]-this.handle.offsetWidth/2,J.y-this.offset.wrapper[1]-this.handle.offsetHeight/2]),this.setTargetOffset(t))},stopTap:function(){!this.disabled&&this.tapping&&(this.tapping=!1,this.setTargetValue(this.value.current),this.result())},startDrag:function(){this.disabled||(this.setWrapperOffset(),this.setBounds(),this.offset.mouse=[J.x-Z.get(this.handle)[0],J.y-Z.get(this.handle)[1]],this.dragging=!0)},stopDrag:function(){if(!this.disabled&&this.dragging){this.dragging=!1;var t=this.groupClone(this.value.current);if(this.slide){var e=this.change;t[0]+=4*e[0],t[1]+=4*e[1]}this.setTargetValue(t),this.result()}},feedback:function(){var t=this.value.current;this.snap&&this.steps>1&&(t=this.getClosestSteps(t)),this.groupCompare(t,this.value.prev)||("function"==typeof this.animationCallback&&this.animationCallback(t[0],t[1]),this.groupCopy(this.value.prev,t))},result:function(){"function"==typeof this.callback&&this.callback(this.value.target[0],this.value.target[1])},animate:function(t,e){if(!t||this.dragging){if(this.dragging){var n=this.groupClone(this.value.target),i=[J.x-this.offset.wrapper[0]-this.offset.mouse[0],J.y-this.offset.wrapper[1]-this.offset.mouse[1]];this.setTargetOffset(i,this.loose),this.change=[this.value.target[0]-n[0],this.value.target[1]-n[1]]}(this.dragging||e)&&this.groupCopy(this.value.current,this.value.target),(this.dragging||this.glide()||e)&&(this.update(),this.feedback())}},glide:function(){var t=[this.value.target[0]-this.value.current[0],this.value.target[1]-this.value.current[1]];return t[0]||t[1]?(Math.abs(t[0])>this.bounds.xStep||Math.abs(t[1])>this.bounds.yStep?(this.value.current[0]+=t[0]*this.speed,this.value.current[1]+=t[1]*this.speed):this.groupCopy(this.value.current,this.value.target),!0):!1},update:function(){this.offset.current=this.snap?this.getOffsetsByRatios(this.getClosestSteps(this.value.current)):this.getOffsetsByRatios(this.value.current),this.show()},show:function(){this.groupCompare(this.offset.current,this.offset.prev)||(this.horizontal&&(this.handle.style.left=this.offset.current[0]+""+"px"),this.vertical&&(this.handle.style.top=this.offset.current[1]+""+"px"),this.groupCopy(this.offset.prev,this.offset.current))},setTargetValue:function(t,e){var n=e?this.getLooseValue(t):this.getProperValue(t);this.groupCopy(this.value.target,n),this.offset.target=this.getOffsetsByRatios(n)},setTargetOffset:function(t,e){var n=this.getRatiosByOffsets(t),i=e?this.getLooseValue(n):this.getProperValue(n);this.groupCopy(this.value.target,i),this.offset.target=this.getOffsetsByRatios(i)},getLooseValue:function(t){var e=this.getProperValue(t);return[e[0]+(t[0]-e[0])/4,e[1]+(t[1]-e[1])/4]},getProperValue:function(t){var e=this.groupClone(t);return e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0),e[0]=Math.min(e[0],1),e[1]=Math.min(e[1],1),(!this.dragging&&!this.tapping||this.snap)&&this.steps>1&&(e=this.getClosestSteps(e)),e},getRatiosByOffsets:function(t){return[this.getRatioByOffset(t[0],this.bounds.xRange,this.bounds.x0),this.getRatioByOffset(t[1],this.bounds.yRange,this.bounds.y0)]},getRatioByOffset:function(t,e,n){return e?(t-n)/e:0},getOffsetsByRatios:function(t){return[this.getOffsetByRatio(t[0],this.bounds.xRange,this.bounds.x0),this.getOffsetByRatio(t[1],this.bounds.yRange,this.bounds.y0)]},getOffsetByRatio:function(t,e,n){return Math.round(t*e)+n},getClosestSteps:function(t){return[this.getClosestStep(t[0]),this.getClosestStep(t[1])]},getClosestStep:function(t){for(var e=0,n=1,i=0;this.steps-1>=i;i++)n>Math.abs(this.stepRatios[i]-t)&&(n=Math.abs(this.stepRatios[i]-t),e=i);return this.stepRatios[e]},groupCompare:function(t,e){return t[0]==e[0]&&t[1]==e[1]},groupCopy:function(t,e){t[0]=e[0],t[1]=e[1]},groupClone:function(t){return[t[0],t[1]]},preventDefaults:function(t,n){t||(t=e.event),t.preventDefault&&t.preventDefault(),t.returnValue=!1,n&&document.selection&&document.selection.empty()},cancelEvent:function(t){t||(t=e.event),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}},jQuery.browser||function(){var t,e;jQuery.uaMatch=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||0>t.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},t=jQuery.uaMatch(navigator.userAgent),e={},t.browser&&(e[t.browser]=!0,e.version=t.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),jQuery.browser=e}(),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports?module.exports=t:t(jQuery)}(function(t){function n(n){var s,r=n||e.event,a=[].slice.call(arguments,1),l=0,c=0,u=0,h=0,d=0;return n=t.event.fix(r),n.type="mousewheel",r.wheelDelta&&(l=r.wheelDelta),r.detail&&(l=-1*r.detail),r.deltaY&&(u=-1*r.deltaY,l=u),r.deltaX&&(c=r.deltaX,l=-1*c),void 0!==r.wheelDeltaY&&(u=r.wheelDeltaY),void 0!==r.wheelDeltaX&&(c=-1*r.wheelDeltaX),h=Math.abs(l),(!i||i>h)&&(i=h),d=Math.max(Math.abs(u),Math.abs(c)),(!o||o>d)&&(o=d),s=l>0?"floor":"ceil",l=Math[s](l/i),c=Math[s](c/o),u=Math[s](u/o),a.unshift(n,l,c,u),(t.event.dispatch||t.event.handle).apply(this,a)}var i,o,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(t.event.fixHooks)for(var a=s.length;a;)t.event.fixHooks[s[--a]]=t.event.mouseHooks;t.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var t=r.length;t;)this.addEventListener(r[--t],n,!1);else this.onmousewheel=n},teardown:function(){if(this.removeEventListener)for(var t=r.length;t;)this.removeEventListener(r[--t],n,!1);else this.onmousewheel=null}},t.fn.extend({mousewheel:function(t){return t?this.bind("mousewheel",t):this.trigger("mousewheel")},unmousewheel:function(t){return this.unbind("mousewheel",t)}})})})(jQuery,window,Handsontable),!function(t){"use strict";var e=function(e,n){this.$element=t(e),this.options=t.extend({},t.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=t(this.options.menu),this.shown=!1,this.listen()};e.prototype={constructor:e,select:function(){var t=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var e=t.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:e.top+e.height,left:e.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var e;return this.query=this.$element.val(),!this.query||this.query.length"+e+""})},render:function(e){var n=this;return e=t(e).map(function(e,i){return e=t(n.options.item).attr("data-value",i),e.find("a").html(n.highlighter(i)),e[0]}),e.first().addClass("active"),this.$menu.html(e),this},next:function(){var e=this.$menu.find(".active").removeClass("active"),n=e.next();n.length||(n=t(this.$menu.find("li")[0])),n.addClass("active")},prev:function(){var t=this.$menu.find(".active").removeClass("active"),e=t.prev();e.length||(e=this.$menu.find("li").last()),e.addClass("active")},listen:function(){this.$element.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",t.proxy(this.keydown,this)),this.$menu.on("click",t.proxy(this.click,this)).on("mouseenter","li",t.proxy(this.mouseenter,this)).on("mouseleave","li",t.proxy(this.mouseleave,this))},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},move:function(t){if(this.shown){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next()}t.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~t.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.stopPropagation(),t.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(e){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),t(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=t.fn.typeahead;t.fn.typeahead=function(n){return this.each(function(){var i=t(this),o=i.data("typeahead"),s="object"==typeof n&&n;o||i.data("typeahead",o=new e(this,s)),"string"==typeof n&&o[n]()})},t.fn.typeahead.defaults={source:[],items:8,menu:'',item:'
  • ',minLength:1},t.fn.typeahead.Constructor=e,t.fn.typeahead.noConflict=function(){return t.fn.typeahead=n,this},t(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var e=t(this);e.data("typeahead")||e.typeahead(e.data())})}(window.jQuery),function(){function t(t){this._n=t}function e(t,e,n){var i,o=Math.pow(10,e);if(i=(Math.round(t*o)/o).toFixed(e),n){var s=RegExp("0{1,"+n+"}$");i=i.replace(s,"")}return i}function n(t,e){var n;return n=e.indexOf("$")>-1?o(t,e):e.indexOf("%")>-1?s(t,e):e.indexOf(":")>-1?r(t,e):l(t,e)}function i(t,e){if(e.indexOf(":")>-1)t._n=a(e);else if(e===f)t._n=0;else{var n=e;"."!==d[p].delimiters.decimal&&(e=e.replace(/\./g,"").replace(d[p].delimiters.decimal,"."));for(var i=RegExp(d[p].abbreviations.thousand+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),o=RegExp(d[p].abbreviations.million+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),s=RegExp(d[p].abbreviations.billion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),r=RegExp(d[p].abbreviations.trillion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),l=["KB","MB","GB","TB","PB","EB","ZB","YB"],c=!1,u=0;l.length>=u&&!(c=e.indexOf(l[u])>-1?Math.pow(1024,u+1):!1);u++);t._n=(c?c:1)*(n.match(i)?Math.pow(10,3):1)*(n.match(o)?Math.pow(10,6):1)*(n.match(s)?Math.pow(10,9):1)*(n.match(r)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*Number((e.indexOf("(")>-1?"-":"")+e.replace(/[^0-9\.-]+/g,"")),t._n=c?Math.ceil(t._n):t._n}return t._n}function o(t,e){var i=1>=e.indexOf("$")?!0:!1,o="";e.indexOf(" $")>-1?(o=" ",e=e.replace(" $","")):e.indexOf("$ ")>-1?(o=" ",e=e.replace("$ ","")):e=e.replace("$","");var s=n(t,e);return i?s.indexOf("(")>-1||s.indexOf("-")>-1?(s=s.split(""),s.splice(1,0,d[p].currency.symbol+o),s=s.join("")):s=d[p].currency.symbol+o+s:s.indexOf(")")>-1?(s=s.split(""),s.splice(-1,0,o+d[p].currency.symbol),s=s.join("")):s=s+o+d[p].currency.symbol,s}function s(t,e){var i="";e.indexOf(" %")>-1?(i=" ",e=e.replace(" %","")):e=e.replace("%",""),t._n=100*t._n;var o=n(t,e);return o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,i+"%"),o=o.join("")):o=o+i+"%",o}function r(t){var e=Math.floor(t._n/60/60),n=Math.floor((t._n-60*60*e)/60),i=Math.round(t._n-60*60*e-60*n);return e+":"+(10>n?"0"+n:n)+":"+(10>i?"0"+i:i)}function a(t){var e=t.split(":"),n=0;return 3===e.length?(n+=60*60*Number(e[0]),n+=60*Number(e[1]),n+=Number(e[2])):2===e.lenght&&(n+=60*Number(e[0]),n+=Number(e[1])),Number(n)}function l(t,n){var i=!1,o=!1,s="",r="",a="",l=Math.abs(t._n);if(0===t._n&&null!==f)return f;if(n.indexOf("(")>-1&&(i=!0,n=n.slice(1,-1)),n.indexOf("a")>-1&&(n.indexOf(" a")>-1?(s=" ",n=n.replace(" a","")):n=n.replace("a",""),l>=Math.pow(10,12)?(s+=d[p].abbreviations.trillion,t._n=t._n/Math.pow(10,12)):Math.pow(10,12)>l&&l>=Math.pow(10,9)?(s+=d[p].abbreviations.billion,t._n=t._n/Math.pow(10,9)):Math.pow(10,9)>l&&l>=Math.pow(10,6)?(s+=d[p].abbreviations.million,t._n=t._n/Math.pow(10,6)):Math.pow(10,6)>l&&l>=Math.pow(10,3)&&(s+=d[p].abbreviations.thousand,t._n=t._n/Math.pow(10,3))),n.indexOf("b")>-1){n.indexOf(" b")>-1?(r=" ",n=n.replace(" b","")):n=n.replace("b","");for(var c,u,h=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],m=0;h.length>=m;m++)if(c=Math.pow(1024,m),u=Math.pow(1024,m+1),t._n>=c&&u>t._n){r+=h[m],c>0&&(t._n=t._n/c);break}}n.indexOf("o")>-1&&(n.indexOf(" o")>-1?(a=" ",n=n.replace(" o","")):n=n.replace("o",""),a+=d[p].ordinal(t._n)),n.indexOf("[.]")>-1&&(o=!0,n=n.replace("[.]","."));var g=(""+t._n).split(".")[0],w=n.split(".")[1],v=n.indexOf(","),y="",b=!1;return w?(w.indexOf("[")>-1?(w=w.replace("]",""),w=w.split("["),y=e(t._n,w[0].length+w[1].length,w[1].length)):y=e(t._n,w.length),g=y.split(".")[0],y=y.split(".")[1].length?d[p].delimiters.decimal+y.split(".")[1]:"",o&&0===Number(y)&&(y="")):g=e(t._n,null),g.indexOf("-")>-1&&(g=g.slice(1),b=!0),v>-1&&(g=(""+g).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d[p].delimiters.thousands)),0===n.indexOf(".")&&(g=""),(i&&b?"(":"")+(!i&&b?"-":"")+g+y+(a?a:"")+(s?s:"")+(r?r:"")+(i&&b?")":"")}function c(t,e){d[t]=e}var u,h="1.4.7",d={},p="en",f=null,m="undefined"!=typeof module&&module.exports;u=function(e){return u.isNumeral(e)?e=e.value():Number(e)||(e=0),new t(Number(e))},u.version=h,u.isNumeral=function(e){return e instanceof t},u.language=function(t,e){return t?(t&&!e&&(p=t),(e||!d[t])&&c(t,e),u):p},u.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$"}}),u.zeroFormat=function(t){f="string"==typeof t?t:null},u.fn=t.prototype={clone:function(){return u(this)},format:function(t){return n(this,t?t:u.defaultFormat)},unformat:function(t){return i(this,t?t:u.defaultFormat)},value:function(){return this._n},valueOf:function(){return this._n},set:function(t){return this._n=Number(t),this},add:function(t){return this._n=this._n+Number(t),this},subtract:function(t){return this._n=this._n-Number(t),this},multiply:function(t){return this._n=this._n*Number(t),this},divide:function(t){return this._n=this._n/Number(t),this},difference:function(t){var e=this._n-Number(t);return 0>e&&(e=-e),e}},m&&(module.exports=u),"undefined"==typeof ender&&(this.numeral=u),"function"==typeof define&&define.amd&&define([],function(){return u})}.call(this),function(t,e){function n(t){for(var e,n=t.split(/\s+/),i=[],o=0;e=n[o];o++)e=e[0].toUpperCase(),i.push(e);return i}function i(e){return e.id&&t('label[for="'+e.id+'"]').val()||e.name}function o(n,s,r){return r||(r=0),s.each(function(){var s,a,l=t(this),c=this,u=this.nodeName.toLowerCase(); switch("label"==u&&l.find("input, textarea, select").length&&(s=l.text(),l=l.children().first(),c=l.get(0),u=c.nodeName.toLowerCase()),u){case"menu":a={name:l.attr("label"),items:{}},r=o(a.items,l.children(),r);break;case"a":case"button":a={name:l.text(),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"menuitem":case"command":switch(l.attr("type")){case e:case"command":case"menuitem":a={name:l.attr("label"),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"checkbox":a={type:"checkbox",disabled:!!l.attr("disabled"),name:l.attr("label"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",disabled:!!l.attr("disabled"),name:l.attr("label"),radio:l.attr("radiogroup"),value:l.attr("id"),selected:!!l.attr("checked")};break;default:a=e}break;case"hr":a="-------";break;case"input":switch(l.attr("type")){case"text":a={type:"text",name:s||i(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"checkbox":a={type:"checkbox",name:s||i(c),disabled:!!l.attr("disabled"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",name:s||i(c),disabled:!!l.attr("disabled"),radio:!!l.attr("name"),value:l.val(),selected:!!l.attr("checked")};break;default:a=e}break;case"select":a={type:"select",name:s||i(c),disabled:!!l.attr("disabled"),selected:l.val(),options:{}},l.children().each(function(){a.options[this.value]=t(this).text()});break;case"textarea":a={type:"textarea",name:s||i(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"label":break;default:a={type:"html",html:l.clone(!0)}}a&&(r++,n["key"+r]=a)}),r}if(t.support.htmlMenuitem="HTMLMenuItemElement"in window,t.support.htmlCommand="HTMLCommandElement"in window,t.support.eventSelectstart="onselectstart"in document.documentElement,!t.ui||!t.ui.widget){var s=t.cleanData;t.cleanData=function(e){for(var n,i=0;null!=(n=e[i]);i++)try{t(n).triggerHandler("remove")}catch(o){}s(e)}}var r=null,a=!1,l=t(window),c=0,u={},h={},d={},p={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,reposition:!0,determinePosition:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var n=this.offset();n.top+=this.outerHeight(),n.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(n)}},position:function(t,n,i){var o;if(!n&&!i)return t.determinePosition.call(this,t.$menu),e;o="maintain"===n&&"maintain"===i?t.$menu.position():{top:i,left:n};var s=l.scrollTop()+l.height(),r=l.scrollLeft()+l.width(),a=t.$menu.height(),c=t.$menu.width();o.top+a>s&&(o.top-=a),o.left+c>r&&(o.left-=c),t.$menu.css(o)},positionSubmenu:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"left top",at:"right top",of:this,collision:"flipfit fit"}).css("display","");else{var n={top:0,left:this.outerWidth()};e.css(n)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:t.noop,hide:t.noop},callback:null,items:{}},f={timer:null,pageX:null,pageY:null},m=function(t){for(var e=0,n=t;;)if(e=Math.max(e,parseInt(n.css("z-index"),10)||0),n=n.parent(),!n||!n.length||"html body".indexOf(n.prop("nodeName").toLowerCase())>-1)break;return e},g={abortevent:function(t){t.preventDefault(),t.stopImmediatePropagation()},contextmenu:function(e){var n=t(this);if(e.preventDefault(),e.stopImmediatePropagation(),!("right"!=e.data.trigger&&e.originalEvent||n.hasClass("context-menu-active")||n.hasClass("context-menu-disabled"))){if(r=n,e.data.build){var i=e.data.build(r,e);if(i===!1)return;if(e.data=t.extend(!0,{},p,e.data,i||{}),!e.data.items||t.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log)("No items specified to show in contextMenu"),Error("No Items sepcified");e.data.$trigger=r,w.create(e.data)}w.show.call(n,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),t(this).trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var n=t(this);r&&r.length&&!r.is(n)&&r.data("contextMenu").$menu.trigger("contextmenu:hide"),2==e.button&&(r=n.data("contextMenuActive",!0))},mouseup:function(e){var n=t(this);n.data("contextMenuActive")&&r&&r.length&&r.is(n)&&!n.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),r=n,n.trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),n.removeData("contextMenuActive")},mouseenter:function(e){var n=t(this),i=t(e.relatedTarget),o=t(document);i.is(".context-menu-list")||i.closest(".context-menu-list").length||r&&r.length||(f.pageX=e.pageX,f.pageY=e.pageY,f.data=e.data,o.on("mousemove.contextMenuShow",g.mousemove),f.timer=setTimeout(function(){f.timer=null,o.off("mousemove.contextMenuShow"),r=n,n.trigger(t.Event("contextmenu",{data:f.data,pageX:f.pageX,pageY:f.pageY}))},e.data.delay))},mousemove:function(t){f.pageX=t.pageX,f.pageY=t.pageY},mouseleave:function(e){var n=t(e.relatedTarget);if(!n.is(".context-menu-list")&&!n.closest(".context-menu-list").length){try{clearTimeout(f.timer)}catch(e){}f.timer=null}},layerClick:function(n){var i,o,s=t(this),r=s.data("contextMenuRoot"),a=n.button,c=n.pageX,u=n.pageY;n.preventDefault(),n.stopImmediatePropagation(),setTimeout(function(){var s,h="left"==r.trigger&&0===a||"right"==r.trigger&&2===a;if(document.elementFromPoint&&(r.$layer.hide(),i=document.elementFromPoint(c-l.scrollLeft(),u-l.scrollTop()),r.$layer.show()),r.reposition&&h)if(document.elementFromPoint){if(r.$trigger.is(i)||r.$trigger.has(i).length)return r.position.call(r.$trigger,r,c,u),e}else if(o=r.$trigger.offset(),s=t(window),o.top+=s.scrollTop(),o.top<=n.pageY&&(o.left+=s.scrollLeft(),o.left<=n.pageX&&(o.bottom=o.top+r.$trigger.outerHeight(),o.bottom>=n.pageY&&(o.right=o.left+r.$trigger.outerWidth(),o.right>=n.pageX))))return r.position.call(r.$trigger,r,c,u),e;i&&h&&r.$trigger.one("contextmenu:hidden",function(){t(i).contextMenu({x:c,y:u})}),r.$menu.trigger("contextmenu:hide")},50)},keyStop:function(t,e){e.isInput||t.preventDefault(),t.stopPropagation()},key:function(t){var n=r.data("contextMenu")||{};switch(t.keyCode){case 9:case 38:if(g.keyStop(t,n),n.isInput){if(9==t.keyCode&&t.shiftKey)return t.preventDefault(),n.$selected&&n.$selected.find("input, textarea, select").blur(),n.$menu.trigger("prevcommand"),e;if(38==t.keyCode&&"checkbox"==n.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e}else if(9!=t.keyCode||t.shiftKey)return n.$menu.trigger("prevcommand"),e;case 40:if(g.keyStop(t,n),!n.isInput)return n.$menu.trigger("nextcommand"),e;if(9==t.keyCode)return t.preventDefault(),n.$selected&&n.$selected.find("input, textarea, select").blur(),n.$menu.trigger("nextcommand"),e;if(40==t.keyCode&&"checkbox"==n.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e;break;case 37:if(g.keyStop(t,n),n.isInput||!n.$selected||!n.$selected.length)break;if(!n.$selected.parent().hasClass("context-menu-root")){var i=n.$selected.parent().parent();return n.$selected.trigger("contextmenu:blur"),n.$selected=i,e}break;case 39:if(g.keyStop(t,n),n.isInput||!n.$selected||!n.$selected.length)break;var o=n.$selected.data("contextMenu")||{};if(o.$menu&&n.$selected.hasClass("context-menu-submenu"))return n.$selected=null,o.$selected=null,o.$menu.trigger("nextcommand"),e;break;case 35:case 36:return n.$selected&&n.$selected.find("input, textarea, select").length?e:((n.$selected&&n.$selected.parent()||n.$menu).children(":not(.disabled, .not-selectable)")[36==t.keyCode?"first":"last"]().trigger("contextmenu:focus"),t.preventDefault(),e);case 13:if(g.keyStop(t,n),n.isInput){if(n.$selected&&!n.$selected.is("textarea, select"))return t.preventDefault(),e;break}return n.$selected&&n.$selected.trigger("mouseup"),e;case 32:case 33:case 34:return g.keyStop(t,n),e;case 27:return g.keyStop(t,n),n.$menu.trigger("contextmenu:hide"),e;default:var s=String.fromCharCode(t.keyCode).toUpperCase();if(n.accesskeys[s])return n.accesskeys[s].$node.trigger(n.accesskeys[s].$menu?"contextmenu:focus":"mouseup"),e}t.stopPropagation(),n.$selected&&n.$selected.trigger(t)},prevItem:function(e){e.stopPropagation();var n=t(this).data("contextMenu")||{};if(n.$selected){var i=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=i}for(var o=n.$menu.children(),s=n.$selected&&n.$selected.prev().length?n.$selected.prev():o.last(),r=s;s.hasClass("disabled")||s.hasClass("not-selectable");)if(s=s.prev().length?s.prev():o.last(),s.is(r))return;n.$selected&&g.itemMouseleave.call(n.$selected.get(0),e),g.itemMouseenter.call(s.get(0),e);var a=s.find("input, textarea, select");a.length&&a.focus()},nextItem:function(e){e.stopPropagation();var n=t(this).data("contextMenu")||{};if(n.$selected){var i=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=i}for(var o=n.$menu.children(),s=n.$selected&&n.$selected.next().length?n.$selected.next():o.first(),r=s;s.hasClass("disabled")||s.hasClass("not-selectable");)if(s=s.next().length?s.next():o.first(),s.is(r))return;n.$selected&&g.itemMouseleave.call(n.$selected.get(0),e),g.itemMouseenter.call(s.get(0),e);var a=s.find("input, textarea, select");a.length&&a.focus()},focusInput:function(){var e=t(this).closest(".context-menu-item"),n=e.data(),i=n.contextMenu,o=n.contextMenuRoot;o.$selected=i.$selected=e,o.isInput=i.isInput=!0},blurInput:function(){var e=t(this).closest(".context-menu-item"),n=e.data(),i=n.contextMenu,o=n.contextMenuRoot;o.isInput=i.isInput=!1},menuMouseenter:function(){var e=t(this).data().contextMenuRoot;e.hovering=!0},menuMouseleave:function(e){var n=t(this).data().contextMenuRoot;n.$layer&&n.$layer.is(e.relatedTarget)&&(n.hovering=!1)},itemMouseenter:function(n){var i=t(this),o=i.data(),s=o.contextMenu,r=o.contextMenuRoot;return r.hovering=!0,n&&r.$layer&&r.$layer.is(n.relatedTarget)&&(n.preventDefault(),n.stopImmediatePropagation()),(s.$menu?s:r).$menu.children(".hover").trigger("contextmenu:blur"),i.hasClass("disabled")||i.hasClass("not-selectable")?(s.$selected=null,e):(i.trigger("contextmenu:focus"),e)},itemMouseleave:function(n){var i=t(this),o=i.data(),s=o.contextMenu,r=o.contextMenuRoot;return r!==s&&r.$layer&&r.$layer.is(n.relatedTarget)?(r.$selected&&r.$selected.trigger("contextmenu:blur"),n.preventDefault(),n.stopImmediatePropagation(),r.$selected=s.$selected=s.$node,e):(i.trigger("contextmenu:blur"),e)},itemClick:function(e){var n,i=t(this),o=i.data(),s=o.contextMenu,r=o.contextMenuRoot,a=o.contextMenuKey;if(s.items[a]&&!i.is(".disabled, .context-menu-submenu, .context-menu-separator, .not-selectable")){if(e.preventDefault(),e.stopImmediatePropagation(),t.isFunction(r.callbacks[a])&&Object.prototype.hasOwnProperty.call(r.callbacks,a))n=r.callbacks[a];else{if(!t.isFunction(r.callback))return;n=r.callback}n.call(r.$trigger,a,r)!==!1?r.$menu.trigger("contextmenu:hide"):r.$menu.parent().length&&w.update.call(r.$trigger,r)}},inputClick:function(t){t.stopImmediatePropagation()},hideMenu:function(e,n){var i=t(this).data("contextMenuRoot");w.hide.call(i.$trigger,i,n&&n.force)},focusItem:function(e){e.stopPropagation();var n=t(this),i=n.data(),o=i.contextMenu,s=i.contextMenuRoot;n.addClass("hover").siblings(".hover").trigger("contextmenu:blur"),o.$selected=s.$selected=n,o.$node&&s.positionSubmenu.call(o.$node,o.$menu)},blurItem:function(e){e.stopPropagation();var n=t(this),i=n.data(),o=i.contextMenu;i.contextMenuRoot,n.removeClass("hover"),o.$selected=null}},w={show:function(n,i,o){var s=t(this),a={};return t("#context-menu-layer").trigger("mousedown"),n.$trigger=s,n.events.show.call(s,n)===!1?(r=null,e):(w.update.call(s,n),n.position.call(s,n,i,o),n.zIndex&&(a.zIndex=m(s)+n.zIndex),w.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration,function(){s.trigger("contextmenu:visible")}),s.data("contextMenu",n).addClass("context-menu-active"),t(document).off("keydown.contextMenu").on("keydown.contextMenu",g.key),n.autoHide&&t(document).on("mousemove.contextMenuAutoHide",function(t){var e=s.offset();e.right=e.left+s.outerWidth(),e.bottom=e.top+s.outerHeight(),!n.$layer||n.hovering||t.pageX>=e.left&&t.pageX<=e.right&&t.pageY>=e.top&&t.pageY<=e.bottom||n.$menu.trigger("contextmenu:hide")}),e)},hide:function(n,i){var o=t(this);if(n||(n=o.data("contextMenu")||{}),i||!n.events||n.events.hide.call(o,n)!==!1){if(o.removeData("contextMenu").removeClass("context-menu-active"),n.$layer){setTimeout(function(t){return function(){t.remove()}}(n.$layer),10);try{delete n.$layer}catch(s){n.$layer=null}}r=null,n.$menu.find(".hover").trigger("contextmenu:blur"),n.$selected=null,t(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),n.$menu&&n.$menu[n.animation.hide](n.animation.duration,function(){n.build&&(n.$menu.remove(),t.each(n,function(t){switch(t){case"ns":case"selector":case"build":case"trigger":return!0;default:n[t]=e;try{delete n[t]}catch(i){}return!0}})),setTimeout(function(){o.trigger("contextmenu:hidden")},10)})}},create:function(i,o){o===e&&(o=i),i.$menu=t('
      ').addClass(i.className||"").data({contextMenu:i,contextMenuRoot:o}),t.each(["callbacks","commands","inputs"],function(t,e){i[e]={},o[e]||(o[e]={})}),o.accesskeys||(o.accesskeys={}),t.each(i.items,function(e,s){var r=t('
    • ').addClass(s.className||""),a=null,l=null;if(r.on("click",t.noop),s.$node=r.data({contextMenu:i,contextMenuRoot:o,contextMenuKey:e}),s.accesskey)for(var c,u=n(s.accesskey),h=0;c=u[h];h++)if(!o.accesskeys[c]){o.accesskeys[c]=s,s._name=s.name.replace(RegExp("("+c+")","i"),'$1');break}if("string"==typeof s)r.addClass("context-menu-separator not-selectable");else if(s.type&&d[s.type])d[s.type].call(r,s,i,o),t.each([i,o],function(n,i){i.commands[e]=s,t.isFunction(s.callback)&&(i.callbacks[e]=s.callback)});else{switch("html"==s.type?r.addClass("context-menu-html not-selectable"):s.type?(a=t("").appendTo(r),t("").html(s._name||s.name).appendTo(a),r.addClass("context-menu-input"),i.hasTypes=!0,t.each([i,o],function(t,n){n.commands[e]=s,n.inputs[e]=s})):s.items&&(s.type="sub"),s.type){case"text":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a);break;case"textarea":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").appendTo(a),s.height&&l.height(s.height);break;case"checkbox":l=t('').attr("name","context-menu-input-"+e).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"radio":l=t('').attr("name","context-menu-input-"+s.radio).val(s.value||"").prop("checked",!!s.selected).prependTo(a);break;case"select":l=t('