/*! * Handsontable 0.11.4 * Handsontable is a simple jQuery plugin for editable tables with basic copy-paste compatibility with Excel and Google Docs * * Copyright 2012-2014 Marcin Warpechowski * Licensed under the MIT license. * http://handsontable.com/ * * Date: Tue Oct 07 2014 21:47:07 GMT+0200 (CEST) */ var Handsontable={plugins:{},helper:{}};!function(a,b,c){"use strict";function d(){this.refCounter=0,this.init()}function e(){function a(){var a=this;a._registerTimeout(setTimeout(function(){a.updateSettings({observeChanges:!0})},0))}function b(a){return function(b,c){return"string"==typeof b[1]&&(b[1]=b[1].toLowerCase()),"string"==typeof c[1]&&(c[1]=c[1].toLowerCase()),b[1]===c[1]?0:null===b[1]||""===b[1]?1:null===c[1]||""===c[1]?-1:b[1]c[1]?a?1:-1:0}}function d(a){return function(b,c){if(b[1]===c[1])return 0;if(null===b[1])return 1;if(null===c[1])return-1;var d=new Date(b[1]),e=new Date(c[1]);return e>d?a?-1:1:d>e?a?1:-1:0}}function e(a){return"undefined"!=typeof a.sortColumn}var f=this;this.init=function(b){var c,d,e=this,g=e.getSettings().columnSorting;if(e.sortingEnabled=!!g,e.sortingEnabled){e.sortIndex=[];var j=h.call(e);"undefined"!=typeof j?(c=j.sortColumn,d=j.sortOrder):(c=g.column,d=g.sortOrder),f.sortByColumn.call(e,c,d),e.sort=function(){var a=Array.prototype.slice.call(arguments);return f.sortByColumn.apply(e,a)},"undefined"==typeof e.getSettings().observeChanges&&a.call(e),"afterInit"==b&&(i.call(e),e.addHook("afterCreateRow",f.afterCreateRow),e.addHook("afterRemoveRow",f.afterRemoveRow),e.addHook("afterLoadData",f.init))}else delete e.sort,e.removeHook("afterCreateRow",f.afterCreateRow),e.removeHook("afterRemoveRow",f.afterRemoveRow),e.removeHook("afterLoadData",f.init)},this.setSortingColumn=function(a,b){var c=this;return"undefined"==typeof a?(delete c.sortColumn,void delete c.sortOrder):(c.sortOrder=c.sortColumn===a&&"undefined"==typeof b?!c.sortOrder:"undefined"!=typeof b?b:!0,void(c.sortColumn=a))},this.sortByColumn=function(a,b){var d=this;f.setSortingColumn.call(d,a,b),"undefined"!=typeof d.sortColumn&&(c.hooks.run(d,"beforeColumnSort",d.sortColumn,d.sortOrder),f.sort.call(d),d.render(),g.call(d),c.hooks.run(d,"afterColumnSort",d.sortColumn,d.sortOrder))};var g=function(){var a=this,b={};"undefined"!=typeof a.sortColumn&&(b.sortColumn=a.sortColumn),"undefined"!=typeof a.sortOrder&&(b.sortOrder=a.sortOrder),(b.hasOwnProperty("sortColumn")||b.hasOwnProperty("sortOrder"))&&c.hooks.run(a,"persistentStateSave","columnSorting",b)},h=function(){var a=this,b={};return c.hooks.run(a,"persistentStateLoad","columnSorting",b),b.value},i=function(){function a(){var a=d.view.TBODY.querySelector("tr").querySelectorAll("th");return a.length}function b(b){var d=c.Dom.closest(b,"TH");return c.Dom.index(d)-a()}var d=this;d.rootElement.on("click.handsontable",".columnSorting",function(a){var c=b(a.target);f.sortByColumn.call(d,c)})};this.sort=function(){var a=this;if("undefined"!=typeof a.sortOrder){a.sortingEnabled=!1,a.sortIndex.length=0;for(var c=this.colOffset(),e=0,f=this.countRows()-a.getSettings().minSpareRows;f>e;e++)this.sortIndex.push([e,a.getDataAtCell(e,this.sortColumn+c)]);var g,h=a.getCellMeta(0,a.sortColumn);switch(h.type){case"date":g=d;break;default:g=b}this.sortIndex.sort(g(a.sortOrder));for(var e=this.sortIndex.length;e=0&&c.Dom.addClass(b.querySelector(".colHeader"),"columnSorting")},this.afterCreateRow=function(a,b){var c=this;if(e(c)){for(var d=0;d=a&&(c.sortIndex[d][0]+=b);for(var d=0;b>d;d++)c.sortIndex.splice(a+d,0,[a+d,c.getData()[a+d][c.sortColumn+c.colOffset()]]);g.call(c)}},this.afterRemoveRow=function(a,b){var c=this;if(e(c)){var d=f.translateRow.call(c,a);c.sortIndex.splice(a,b);for(var h=0;hd&&(c.sortIndex[h][0]-=b);g.call(c)}},this.afterChangeSort=function(a){var b=this,c=!1,d={};if(a){for(var e=0;e1&&e(d,g,b),h(),f()}}a(document).on("mousedown.htCommment",c.helper.proxy(g))},h=function(){a(document).off("mousedown.htCommment"),a(document).on("mouseover.htCommment",c.helper.proxy(k))},i=function(a,d){var e=b.view.wt.wtTable.getCell(a.from),f=c.Dom.offset(e),h=b.getColWidth(a.from.col);d.style.position="absolute",d.style.left=f.left+h+"px",d.style.top=f.top+"px",d.style.zIndex=2,g(a,d)},j=function(a){var b=document.getElementsByClassName("htComments")[0];if(!b){b=document.createElement("DIV");var d=document.createElement("TEXTAREA");c.Dom.addClass(d,"htCommentTextArea"),b.appendChild(d),c.Dom.addClass(b,"htComments"),document.getElementsByTagName("body")[0].appendChild(b)}return a=a||"",document.getElementsByClassName("htCommentTextArea")[0].value=a,b},k=function(a){if(-1!=a.target.className.indexOf("htCommentCell")){h();var d=b.view.wt.wtTable.getCoords(a.target),e={from:new n(d.row,d.col)};c.Comments.showComment(e)}else"htCommentTextArea"!=a.target.className&&f()};return{init:function(){a(document).on("mouseover.htCommment",c.helper.proxy(k))},showComment:function(a){var c=b.getCellMeta(a.from.row,a.from.col),d="";c.comment&&(d=c.comment);var e=j(d);e.style.display="block",i(a,e)},removeComment:function(a,c){b.removeCellMeta(a,c,"comment"),b.render()},checkSelectionCommentsConsistency:function(){var a=!1,c=b.getSelectedRange().from;return b.getCellMeta(c.row,c.col).comment&&(a=!0),a}}}function g(a){var c,d=function(){b.localStorage[a+"__persistentStateKeys"]=JSON.stringify(c)},e=function(){var d=b.localStorage[a+"__persistentStateKeys"],e="string"==typeof d?JSON.parse(d):void 0;c=e?e:[]},f=function(){c=[],d()};e(),this.saveValue=function(e,f){b.localStorage[a+"_"+e]=JSON.stringify(f),-1==c.indexOf(e)&&(c.push(e),d())},this.loadValue=function(c,d){c="undefined"!=typeof c?c:d;var e=b.localStorage[a+"_"+c];return"undefined"==typeof e?void 0:JSON.parse(e)},this.reset=function(c){b.localStorage.removeItem(a+"_"+c)},this.resetAll=function(){for(var d=0;dc;c++)if(this[c].row<=a&&this[c].row+this[c].rowspan-1>=a&&this[c].col<=b&&this[c].col+this[c].colspan-1>=b)return this[c]},a.setInfo=function(a){for(var b=0,c=this.length;c>b;b++)if(this[b].row===a.row&&this[b].col===a.col)return void(this[b]=a);this.push(a)},a.removeInfo=function(a,b){for(var c=0,d=this.length;d>c;c++)if(this[c].row===a&&this[c].col===b){this.splice(c,1);break}},a}function j(a){if(this.mergedCellInfoCollection=new i,c.helper.isArray(a))for(var b=0,d=a.length;d>b;b++)this.mergedCellInfoCollection.setInfo(a[b])}function k(){}function l(a){this.instance=a}function m(b,c){var d;if(c){this.instance=b,this.settings=c,this.main=document.createElement("div"),d=this.main.style,d.position="absolute",d.top=0,d.left=0;for(var e=["top","left","bottom","right","corner"],f=0;5>f;f++){var g=e[f],h=document.createElement("DIV");h.className="wtBorder "+(this.settings.className||""),this.settings[g]&&this.settings[g].hide&&(h.className+=" hidden"),d=h.style,d.backgroundColor=this.settings[g]&&this.settings[g].color?this.settings[g].color:c.border.color,d.height=this.settings[g]&&this.settings[g].width?this.settings[g].width+"px":c.border.width+"px",d.width=this.settings[g]&&this.settings[g].width?this.settings[g].width+"px":c.border.width+"px",this.main.appendChild(h)}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(),b.wtTable.bordersHolder||(b.wtTable.bordersHolder=document.createElement("div"),b.wtTable.bordersHolder.className="htBorders",b.wtTable.hider.appendChild(b.wtTable.bordersHolder)),b.wtTable.bordersHolder.insertBefore(this.main,b.wtTable.bordersHolder.firstChild);var i=!1,j=a(document.body);j.on("mousedown.walkontable."+b.guid,function(){i=!0}),j.on("mouseup.walkontable."+b.guid,function(){i=!1}),a(this.main.childNodes).on("mouseenter",function(c){if(i&&b.getSetting("hideBorderOnMouseDownOver")){c.preventDefault(),c.stopImmediatePropagation();var d=this.getBoundingClientRect(),e=a(this);e.hide();var f=function(a){return a.clientYMath.ceil(d.top+d.height)?!0:a.clientXMath.ceil(d.left+d.width)?!0:void 0};j.on("mousemove.border."+b.guid,function(a){f(a)&&(j.off("mousemove.border."+b.guid),e.show())})}})}}function n(a,b){"undefined"!=typeof a&&"undefined"!=typeof b?(this.row=a,this.col=b):(this.row=null,this.col=null)}function o(a,b,c){this.highlight=a,this.from=b,this.to=c}function p(a,b){this.total=a,this.countTH=b}function q(a,b,c,d){var e,f=0;for(l.apply(this,arguments),this.containerSizeFn=b,this.cellSizesSum=0,this.cellSizes=[],this.cellStretch=[],this.cellCount=0,this.visibleCellCount=0,this.remainingSize=0,this.strategy=d;;){if(e=c(f),void 0===e)break;this.cellSizesSumd;d++)b.push(this.wtTable.THEAD.childNodes[0].childNodes[d].innerHTML);this.getSetting("columnHeaders").length||this.update("columnHeaders",[function(a,d){c.Dom.fastInnerText(d,b[a])}])}this.drawn=!1,this.drawInterrupted=!1}function s(b){this.instance=b,this.init(),this.clone=this.makeClone("debug"),this.clone.wtTable.holder.style.opacity=.4,this.clone.wtTable.holder.style.textShadow="0 0 2px #ff0000",this.lastTimeout=null;var d=this,e=0,f=0,g=d.clone.wtTable.holder.parentNode;a(document.body).on("mousemove."+this.instance.guid,function(a){d.instance.wtTable.holder.parentNode&&(a.clientX-e>-5&&a.clientX-e<5&&a.clientY-f>-5&&a.clientY-f<5||(e=a.clientX,f=a.clientY,c.Dom.addClass(g,"wtDebugHidden"),c.Dom.removeClass(g,"wtDebugVisible"),clearTimeout(this.lastTimeout),this.lastTimeout=setTimeout(function(){c.Dom.removeClass(g,"wtDebugHidden"),c.Dom.addClass(g,"wtDebugVisible")},1e3)))})}function t(d){var e=this;this.instance=d;var f=[null,null];this.dblClickTimeout=[null,null];var g,h=function(a){var b=e.parentCell(a.target);c.Dom.hasClass(a.target,"corner")?e.instance.getSetting("onCellCornerMouseDown",a,a.target):b.TD&&e.instance.hasSetting("onCellMouseDown")&&e.instance.getSetting("onCellMouseDown",a,b.coords,b.TD,e.instance),2!==a.button&&b.TD&&(f[0]=b.TD,clearTimeout(e.dblClickTimeout[0]),e.dblClickTimeout[0]=setTimeout(function(){f[0]=null},1e3))},i=function(a){if(e.instance.hasSetting("onCellMouseOver")){var b=e.instance.wtTable.TABLE,d=c.Dom.closest(a.target,["TD","TH"],b);d&&d!==g&&c.Dom.isChildOf(d,b)&&(g=d,e.instance.getSetting("onCellMouseOver",a,e.instance.wtTable.getCoords(d),d,e.instance))}},j=function(a){if(2!==a.button){var b=e.parentCell(a.target);b.TD===f[0]&&b.TD===f[1]?(c.Dom.hasClass(a.target,"corner")?e.instance.getSetting("onCellCornerDblClick",a,b.coords,b.TD,e.instance):e.instance.getSetting("onCellDblClick",a,b.coords,b.TD,e.instance),f[0]=null,f[1]=null):b.TD===f[0]&&(f[1]=b.TD,clearTimeout(e.dblClickTimeout[1]),e.dblClickTimeout[1]=setTimeout(function(){f[1]=null},500))}};a(this.instance.wtTable.holder).on("mousedown",h),a(this.instance.wtTable.TABLE).on("mouseover",i),a(this.instance.wtTable.holder).on("mouseup",j),a(b).on("resize."+this.instance.guid,function(){e.instance.draw()})}function u(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+a()+a()}function v(a,b,c){this.offset=a,this.total=b,this.countTH=c}function w(a,b,c){l.apply(this,arguments),this.containerSizeFn=b,this.sizeAtIndex=c,this.cellSizesSum=0,this.cellSizes=[],this.cellCount=0,this.visiblCellCount=0,this.remainingSize=-1/0,this.maxOuts=10,this.curOuts=this.maxOuts}function x(a){this.instance=a}function y(a){this.instance=a,this.type="corner",this.init(),this.clone=this.makeClone("corner")}function z(a){this.instance=a,this.type="horizontal",this.cellSize=50,this.offset=0,this.init(),this.clone=this.makeClone("left")}function A(a){this.instance=a,this.type="vertical",this.cellSize=this.instance.wtSettings.settings.defaultRowHeight,this.offset,this.total,this.init(),this.clone=this.makeClone("top")}function B(a){this.instance=a,a.update("scrollbarWidth",c.Dom.getScrollbarWidth()),a.update("scrollbarHeight",c.Dom.getScrollbarWidth()),this.vertical=new A(a),this.horizontal=new z(a),this.corner=new y(a),a.getSetting("debug")&&(this.debug=new s(a)),this.registerListeners()}function C(a,b){this.settings=a,this.cellRange=b||null,this.instanceBorders={}}function D(a,b){var d=this;this.instance=a,this.defaults={table:void 0,debug:!1,stretchH:"none",currentRowClassName:null,currentColumnClassName:null,data:void 0,offsetRow:0,fixedColumnsLeft:0,fixedRowsTop:0,rowHeaders:function(){return[]},columnHeaders:function(){return[]},totalRows:void 0,totalColumns:void 0,width:null,height:null,cellRenderer:function(a,b,e){var f=d.getSetting("data",a,b);c.Dom.fastInnerText(e,void 0===f||null===f?"":f)},columnWidth:50,rowHeight:function(){return 23},defaultRowHeight:23,selections:null,hideBorderOnMouseDownOver:!1,onCellMouseDown:null,onCellMouseOver:null,onCellDblClick:null,onCellCornerMouseDown:null,onCellCornerDblClick:null,beforeDraw:null,onDraw:null,onBeforeDrawBorders:null,onScrollVertically:null,onScrollHorizontally:null,scrollbarWidth:10,scrollbarHeight:10,renderAllRows:!1,groups:!1},this.settings={};for(var e in this.defaults)if(this.defaults.hasOwnProperty(e))if(void 0!==b[e])this.settings[e]=b[e];else{if(void 0===this.defaults[e])throw new Error('A required setting "'+e+'" was not provided');this.settings[e]=this.defaults[e]}}function E(a,b){this.instance=a,this.TABLE=b,c.Dom.removeTextNodes(this.TABLE);var d=this.TABLE.parentNode;if(!d||1!==d.nodeType||!c.Dom.hasClass(d,"wtHolder")){var e=document.createElement("DIV");e.className="wtSpreader",d&&d.insertBefore(e,this.TABLE),e.appendChild(this.TABLE)}if(this.spreader=this.TABLE.parentNode,d=this.spreader.parentNode,!d||1!==d.nodeType||!c.Dom.hasClass(d,"wtHolder")){var f=document.createElement("DIV");f.className="wtHider",d&&d.insertBefore(f,this.spreader),f.appendChild(this.spreader)}if(this.hider=this.spreader.parentNode,this.hiderStyle=this.hider.style,this.hiderStyle.position="relative",d=this.hider.parentNode,!d||1!==d.nodeType||!c.Dom.hasClass(d,"wtHolder")){var g=document.createElement("DIV");g.style.position="relative",g.className="wtHolder",a.cloneSource||(g.className+=" ht_master"),d&&d.insertBefore(g,this.hider),g.appendChild(this.hider)}if(this.holder=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 h=document.createElement("TR");this.THEAD.appendChild(h)}this.colgroupChildrenLength=this.COLGROUP.childNodes.length,this.theadChildrenLength=this.THEAD.firstChild?this.THEAD.firstChild.childNodes.length:0,this.tbodyChildrenLength=this.TBODY.childNodes.length,this.rowFilter=null,this.columnFilter=null,this.columnWidthCache=[]}function F(a){this.wtTable=a,this.instance=a.instance,this.rowFilter=a.rowFilter,this.columnFilter=a.columnFilter,this.TABLE=a.TABLE,this.THEAD=a.THEAD,this.TBODY=a.TBODY,this.COLGROUP=a.COLGROUP,this.utils=F.utils}function G(c){this.instance=c,this.resetSettings();var d=this;a(b).on("resize.walkontable."+this.instance.guid,function(){d.clientHeight=d.getWorkspaceHeight()})}Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length>>>0,c=Number(arguments[1])||0;for(c=0>c?Math.ceil(c):Math.floor(c),0>c&&(c+=b);b>c;c++)if(c in this&&this[c]===a)return c;return-1}),Array.prototype.filter||(Array.prototype.filter=function(a,b){function c(a){return/NodeList/i.test(a.item)}function d(a){for(var b=[],c=0,d=a.length;d>c;c++)b[c]=a[c];return b}if("undefined"==typeof this||null===this)throw new TypeError;if("function"!=typeof a)throw new TypeError;b=b||this,c(b)&&(b=d(b));var e,f,g=b.length,h=[];for(e=0;g>e;e+=1)b.hasOwnProperty(e)&&(f=b[e],a.call(b,f,e,b)&&h.push(f));return h}),"undefined"==typeof WeakMap&&!function(){var a=Object.defineProperty;try{var c=!0;a(function(){},"foo",{})}catch(d){c=!1}var e=+new Date%1e9,f=function(){this.name="__st"+(1e9*Math.random()>>>0)+(e++ +"__"),c||(this._wmCache=[])};f.prototype=c?{set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){this.set(a,void 0)}}:{set:function(a,b){if("undefined"!=typeof a&&"undefined"!=typeof b){for(var c=0,d=this._wmCache.length;d>c;c++)if(this._wmCache[c].key==a)return void(this._wmCache[c].value=b);this._wmCache.push({key:a,value:b})}},get:function(a){if("undefined"!=typeof a)for(var b=0,c=this._wmCache.length;c>b;b++)if(this._wmCache[b].key==a)return this._wmCache[b].value},"delete":function(a){if("undefined"!=typeof a)for(var b=0,c=this._wmCache.length;c>b;b++)this._wmCache[b].key==a&&Array.prototype.slice.call(this._wmCache,b,1)}},b.WeakMap=f}(),c.activeGuid=null,c.Core=function(d,e){function f(){var a=!1;return{validatorsInQueue:0,addValidatorToQueue:function(){this.validatorsInQueue++,a=!1},removeValidatorFormQueue:function(){this.validatorsInQueue=this.validatorsInQueue-1<0?0:this.validatorsInQueue-1,this.checkIfQueueIsEmpty()},onQueueEmpty:function(){},checkIfQueueIsEmpty:function(){0==this.validatorsInQueue&&0==a&&(a=!0,this.onQueueEmpty())}}}function g(b,d,e){function g(){var f;b.length&&(f=c.hooks.execute(u,"beforeChange",b,d),"function"==typeof f?a.when(result).then(function(){e()}):f===!1&&b.splice(0,b.length)),"function"!=typeof f&&e()}var h=new f;h.onQueueEmpty=g;for(var i=b.length-1;i>=0;i--)if(null===b[i])b.splice(i,1);else{var j=b[i][0],k=q.propToCol(b[i][1]),l=u.runHooksAndReturn("modifyCol",k),m=u.getCellMeta(j,l);if("numeric"===m.type&&"string"==typeof b[i][3]&&b[i][3].length>0&&/^-?[\d\s]*(\.|\,)?\d*$/.test(b[i][3])){var n=b[i][3].length;numeral.language("undefined"==typeof m.language?"en":b[i][3].indexOf(".")===n-3&&-1===b[i][3].indexOf(",")?"en":m.language),b[i][3]=numeral().unformat(b[i][3]||"0")}u.getCellValidator(m)&&(h.addValidatorToQueue(),u.validateCell(b[i][3],m,function(a,c){return function(d){if("boolean"!=typeof d)throw new Error("Validation error: result is not boolean");d===!1&&c.allowInvalid===!1&&(b.splice(a,1),c.valid=!0,--a),h.removeValidatorFormQueue()}}(i,m),d))}h.checkIfQueueIsEmpty()}function h(a,b){var d=a.length-1;if(!(0>d)){for(;d>=0;d--)if(null!==a[d]){if(null!=a[d][2]||null!=a[d][3]){if(p.settings.minSpareRows)for(;a[d][0]>u.countRows()-1;)q.createRow();if("array"===u.dataType&&p.settings.minSpareCols)for(;q.propToCol(a[d][1])>u.countCols()-1;)q.createCol();q.set(a[d][0],a[d][1],a[d][3])}}else a.splice(d,1);u.forceFullRender=!0,r.adjustRowsAndCols(),c.hooks.run(u,"beforeChangeRender",a,b),s.refreshBorders(null,!0),c.hooks.run(u,"afterChange",a,b||"edit")}}function i(b,c,d){return"object"==typeof b?b:a.isPlainObject(d)?d:[[b,c,d]]}function j(a){if(a.hasOwnProperty("type")){var b,d={};if("object"==typeof a.type)b=a.type;else if("string"==typeof a.type&&(b=c.cellTypes[a.type],void 0===b))throw new Error('You declared cell type "'+a.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');for(var e in b)b.hasOwnProperty(e)&&!a.hasOwnProperty(e)&&(d[e]=b[e]);return d}}function k(a){return c.hooks.execute(u,"modifyRow",a)}function l(a){return c.hooks.execute(u,"modifyCol",a)}function m(){throw new Error("This method cannot be called because this Handsontable instance has been destroyed")}var p,q,r,s,t,u=this,v=function(){},w=a(document.documentElement),x=a(document.body);c.helper.extend(v.prototype,H.prototype),c.helper.extend(v.prototype,e),c.helper.extend(v.prototype,j(e)),this.rootElement=d,this.container=document.createElement("DIV"),this.container.className="htContainer",d.prepend(this.container),this.container=a(this.container),this.guid="ht_"+c.helper.randomString(),this.rootElement[0].id&&"ht_"!==this.rootElement[0].id.substring(0,3)||(this.rootElement[0].id=this.guid),p={cellSettings:[],columnSettings:[],columnsSettingConflicts:["data","width"],settings:new v,selRange:null,isPopulated:null,scrollable:null,firstRun:!0},r={alter:function(a,b,d,e,f){var g;switch(d=d||1,a){case"insert_row":g=q.createRow(b,d),g&&(s.isSelected()&&p.selRange.from.row>=b?(p.selRange.from.row=p.selRange.from.row+g,s.transformEnd(g,0)):s.refreshBorders());break;case"insert_col":if(g=q.createCol(b,d)){if(c.helper.isArray(u.getSettings().colHeaders)){var h=[b,0];h.length+=g,Array.prototype.splice.apply(u.getSettings().colHeaders,h)}s.isSelected()&&p.selRange.from.col>=b?(p.selRange.from.col=p.selRange.from.col+g,s.transformEnd(0,g)):s.refreshBorders()}break;case"remove_row":q.removeRow(b,d),p.cellSettings.splice(b,d),r.adjustRowsAndCols(),s.refreshBorders();break;case"remove_col":q.removeCol(b,d);for(var i=0,j=q.getAll().length;j>i;i++)i in p.cellSettings&&p.cellSettings[i].splice(b,d);c.helper.isArray(u.getSettings().colHeaders)&&("undefined"==typeof b&&(b=-1),u.getSettings().colHeaders.splice(b,d)),p.columnSettings.splice(b,d),r.adjustRowsAndCols(),s.refreshBorders();break;default:throw new Error('There is no such action "'+a+'"')}f||r.adjustRowsAndCols()},adjustRowsAndCols:function(){var a,b,c,d;if(b=u.countRows(),be-1?(h=e-1,g=!0,j>h&&(j=h)):j>e-1&&(j=e-1,g=!0,h>j&&(h=j)),i>f-1?(i=f-1,g=!0,k>i&&(k=i)):k>f-1&&(k=f-1,g=!0,i>k&&(i=k)),g&&u.selectCell(h,i,j,k)}},populateFromArray:function(a,b,d,e,f){var g,h,i,j,k=[],l={};if(h=b.length,0===h)return!1;var m,n,o,q;switch(f){case"shift_down":for(m=d?d.col-a.col+1:0,n=d?d.row-a.row+1:0,b=c.helper.translateRowsToColumns(b),i=0,j=b.length,o=Math.max(j,m);o>i;i++)if(j>i){for(g=0,h=b[i].length;n-h>g;g++)b[i].push(b[i][g%h]);b[i].unshift(a.col+i,a.row,0),u.spliceCol.apply(u,b[i])}else b[i%j][0]=a.col+i,u.spliceCol.apply(u,b[i%j]);break;case"shift_right":for(m=d?d.col-a.col+1:0,n=d?d.row-a.row+1:0,g=0,h=b.length,q=Math.max(h,n);q>g;g++)if(h>g){for(i=0,j=b[g].length;m-j>i;i++)b[g].push(b[g][i%j]);b[g].unshift(a.row+g,a.col,0),u.spliceRow.apply(u,b[g])}else b[g%h][0]=a.row+g,u.spliceRow.apply(u,b[g%h]);break;case"overwrite":default:for(l.row=a.row,l.col=a.col,g=0;h>g&&!(d&&l.row>d.row||!p.settings.minSpareRows&&l.row>u.countRows()-1||l.row>=p.settings.maxRows);g++){for(l.col=a.col,j=b[g]?b[g].length:0,i=0;j>i&&!(d&&l.col>d.col||!p.settings.minSpareCols&&l.col>u.countCols()-1||l.col>=p.settings.maxCols);i++)u.getCellMeta(l.row,l.col).readOnly||k.push([l.row,l.col,b[g][i]]),l.col++,d&&i===j-1&&(i=-1);l.row++,d&&g===h-1&&(g=-1)}u.setDataAtCell(k,null,null,e||"populateFromArray")}}},this.selection=s={inProgress:!1,selectedHeader:{cols:!1,rows:!1},setSelectedHeaders:function(a,b){u.selection.selectedHeader.rows=a,u.selection.selectedHeader.cols=b},begin:function(){u.selection.inProgress=!0},finish:function(){var a=u.getSelected();c.hooks.run(u,"afterSelectionEnd",a[0],a[1],a[2],a[3]),c.hooks.run(u,"afterSelectionEndByProp",a[0],u.colToProp(a[1]),a[2],u.colToProp(a[3])),u.selection.inProgress=!1},isInProgress:function(){return u.selection.inProgress},setRangeStart:function(a){c.hooks.run(u,"beforeSetRangeStart",a),p.selRange=new o(a,a,a),s.setRangeEnd(a)},setRangeEnd:function(a,b){c.hooks.run(u,"beforeSetRangeEnd",a),u.selection.begin(),p.selRange.to=new n(a.row,a.col),p.settings.multiSelect||(p.selRange.from=a),u.view.wt.selections.current.clear(),u.view.wt.selections.current.add(p.selRange.highlight),u.view.wt.selections.area.clear(),s.isMultiple()&&(u.view.wt.selections.area.add(p.selRange.from),u.view.wt.selections.area.add(p.selRange.to)),(p.settings.currentRowClassName||p.settings.currentColClassName)&&(u.view.wt.selections.highlight.clear(),u.view.wt.selections.highlight.add(p.selRange.from),u.view.wt.selections.highlight.add(p.selRange.to)),c.hooks.run(u,"afterSelection",p.selRange.from.row,p.selRange.from.col,p.selRange.to.row,p.selRange.to.col),c.hooks.run(u,"afterSelectionByProp",p.selRange.from.row,q.colToProp(p.selRange.from.col),p.selRange.to.row,q.colToProp(p.selRange.to.col)),b!==!1&&u.view.mainViewIsActive()&&u.view.scrollViewport(a),s.refreshBorders()},refreshBorders:function(a,b){b||t.destroyEditor(a),u.view.render(),s.isSelected()&&!b&&t.prepareEditor()},isMultiple:function(){var a=!(p.selRange.to.col===p.selRange.from.col&&p.selRange.to.row===p.selRange.from.row),b=c.hooks.execute(u,"afterIsMultipleSelection",a);return a?b:void 0},transformStart:function(a,b,c){var d=new n(a,b);u.runHooks("modifyTransformStart",d),p.selRange.highlight.row+a>u.countRows()-1?c&&p.settings.minSpareRows>0?u.alter("insert_row",u.countRows()):p.settings.autoWrapCol&&(d.row=1-u.countRows(),d.col=p.selRange.highlight.col+d.col==u.countCols()-1?1-u.countCols():1):p.settings.autoWrapCol&&p.selRange.highlight.row+d.row<0&&p.selRange.highlight.col+d.col>=0&&(d.row=u.countRows()-1,d.col=p.selRange.highlight.col+d.col==0?u.countCols()-1:-1),p.selRange.highlight.col+d.col>u.countCols()-1?c&&p.settings.minSpareCols>0?u.alter("insert_col",u.countCols()):p.settings.autoWrapRow&&(d.row=p.selRange.highlight.row+d.row==u.countRows()-1?1-u.countRows():1,d.col=1-u.countCols()):p.settings.autoWrapRow&&p.selRange.highlight.col+d.col<0&&p.selRange.highlight.row+d.row>=0&&(d.row=p.selRange.highlight.row+d.row==0?u.countRows()-1:-1,d.col=u.countCols()-1);var e=u.countRows(),f=u.countCols(),g=new n(p.selRange.highlight.row+d.row,p.selRange.highlight.col+d.col);g.row<0?g.row=0:g.row>0&&g.row>=e&&(g.row=e-1),g.col<0?g.col=0:g.col>0&&g.col>=f&&(g.col=f-1),s.setRangeStart(g)},transformEnd:function(a,b){var c=new n(a,b);u.runHooks("modifyTransformEnd",c);var d=u.countRows(),e=u.countCols(),f=new n(p.selRange.to.row+c.row,p.selRange.to.col+c.col);f.row<0?f.row=0:f.row>0&&f.row>=d&&(f.row=d-1),f.col<0?f.col=0:f.col>0&&f.col>=e&&(f.col=e-1),s.setRangeEnd(f)},isSelected:function(){return null!==p.selRange},inInSelection:function(a){return s.isSelected()?p.selRange.includes(a):!1},deselect:function(){s.isSelected()&&(u.selection.inProgress=!1,p.selRange=null,u.view.wt.selections.current.clear(),u.view.wt.selections.area.clear(),(p.settings.currentRowClassName||p.settings.currentColClassName)&&u.view.wt.selections.highlight.clear(),t.destroyEditor(),s.refreshBorders(),c.hooks.run(u,"afterDeselect"))},selectAll:function(){p.settings.multiSelect&&(s.setRangeStart(new n(0,0)),s.setRangeEnd(new n(u.countRows()-1,u.countCols()-1),!1))},empty:function(){if(s.isSelected()){var a,b,c=p.selRange.getTopLeftCorner(),d=p.selRange.getBottomRightCorner(),e=[];for(a=c.row;a<=d.row;a++)for(b=c.col;b<=d.col;b++)u.getCellMeta(a,b).readOnly||e.push([a,b,""]);u.setDataAtCell(e)}}},this.init=function(){c.hooks.run(u,"beforeInit"),this.updateSettings(p.settings,!0),this.view=new c.TableView(this),t=new c.EditorManager(u,p,s,q),this.forceFullRender=!0,this.view.render(),"object"==typeof p.firstRun&&(c.hooks.run(u,"afterChange",p.firstRun[0],p.firstRun[1]),p.firstRun=!1),c.hooks.run(u,"afterInit")},this.validateCell=function(a,b,d,e){var f=u.getCellValidator(b);"[object RegExp]"===Object.prototype.toString.call(f)&&(f=function(a){return function(b,c){c(a.test(b))}}(f)),"function"==typeof f?(a=c.hooks.execute(u,"beforeValidate",a,b.row,b.prop,e),u._registerTimeout(setTimeout(function(){return f.call(b,a,function(f){b.valid=f,f=c.hooks.execute(u,"afterValidate",f,a,b.row,b.prop,e),d(f)}),a},0))):(b.valid=!0,d(!0))},this.setDataAtCell=function(a,b,c,d){var e,f,j,k=i(a,b,c),l=[];for(e=0,f=k.length;f>e;e++){if("object"!=typeof k[e])throw new Error("Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter");if("number"!=typeof k[e][1])throw new Error("Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`");j=q.colToProp(k[e][1]),l.push([k[e][0],j,q.get(k[e][0],j),k[e][2]])}d||"object"!=typeof a||(d=b),g(l,d,function(){h(l,d)})},this.setDataAtRowProp=function(a,b,c,d){var e,f,j=i(a,b,c),k=[];for(e=0,f=j.length;f>e;e++)k.push([j[e][0],j[e][1],q.get(j[e][0],j[e][1]),j[e][2]]);d||"object"!=typeof a||(d=b),g(k,d,function(){h(k,d)})},this.listen=function(){c.activeGuid=u.guid,document.activeElement&&document.activeElement!==document.body?document.activeElement.blur():document.activeElement||document.body.focus()},this.unlisten=function(){c.activeGuid=null},this.isListening=function(){return c.activeGuid===u.guid},this.destroyEditor=function(a){s.refreshBorders(a)},this.populateFromArray=function(a,b,c,d,e,f,g){if("object"!=typeof c||"object"!=typeof c[0])throw new Error("populateFromArray parameter `input` must be an array of arrays");return r.populateFromArray(new n(a,b),c,"number"==typeof d?new n(d,e):null,f,g)},this.spliceCol=function(){return q.spliceCol.apply(q,arguments)},this.spliceRow=function(){return q.spliceRow.apply(q,arguments)},this.getSelected=function(){return s.isSelected()?[p.selRange.from.row,p.selRange.from.col,p.selRange.to.row,p.selRange.to.col]:void 0 },this.getSelectedRange=function(){return s.isSelected()?p.selRange:void 0},this.render=function(){u.view&&(u.forceFullRender=!0,s.refreshBorders(null,!0))},this.loadData=function(a){function b(){p.cellSettings.length=0}if("object"==typeof a&&null!==a)a.push&&a.splice||(a=[a]);else{if(null!==a)throw new Error("loadData only accepts array of objects or array of arrays ("+typeof a+" given)");a=[];for(var d,e=0,f=p.settings.startRows;f>e;e++){d=[];for(var g=0,h=p.settings.startCols;h>g;g++)d.push(null);a.push(d)}}p.isPopulated=!1,v.prototype.data=a,u.dataType=p.settings.dataSchema instanceof Array||a[0]instanceof Array?"array":"function"==typeof p.settings.dataSchema?"function":"object",q=new c.DataMap(u,p,v),b(),r.adjustRowsAndCols(),c.hooks.run(u,"afterLoadData"),p.firstRun?p.firstRun=[null,"loadData"]:(c.hooks.run(u,"afterChange",null,"loadData"),u.render()),p.isPopulated=!0},this.getData=function(a,b,c,d){return"undefined"==typeof a?q.getAll():q.getRange(new n(a,b),new n(c,d),q.DESTINATION_RENDERER)},this.getCopyableData=function(a,b,c,d){return q.getCopyableText(new n(a,b),new n(c,d))},this.updateSettings=function(a,b){var d,e;if("undefined"!=typeof a.rows)throw new Error("'rows' setting is no longer supported. do you mean startRows, minRows or maxRows?");if("undefined"!=typeof a.cols)throw new Error("'cols' setting is no longer supported. do you mean startCols, minCols or maxCols?");for(d in a)"data"!==d&&(void 0!==c.hooks.hooks[d]||void 0!==c.hooks.legacy[d]?("function"==typeof a[d]||c.helper.isArray(a[d]))&&u.addHook(d,a[d]):!b&&a.hasOwnProperty(d)&&(v.prototype[d]=a[d]));if(void 0===a.data&&void 0===p.settings.data?u.loadData(null):void 0!==a.data?u.loadData(a.data):void 0!==a.columns&&q.createMap(),e=u.countCols(),p.cellSettings.length=0,e>0){var f,g;for(d=0;e>d;d++)p.columnSettings[d]=c.helper.columnFactory(v,p.columnsSettingConflicts),f=p.columnSettings[d].prototype,v.prototype.columns&&(g=v.prototype.columns[d],c.helper.extend(f,g),c.helper.extend(f,j(g)))}if("undefined"!=typeof a.cell)for(d in a.cell){var h=a.cell[d];u.setCellMetaObject(h.row,h.col,h)}if(c.hooks.run(u,"afterCellMetaReset"),"undefined"!=typeof a.className&&(v.prototype.className&&u.rootElement.removeClass(v.prototype.className),a.className&&u.rootElement.addClass(a.className)),"undefined"!=typeof a.height){var i=a.height;"function"==typeof i&&(i=i()),u.rootElement[0].style.height=i+"px"}if("undefined"!=typeof a.width){var k=a.width;"function"==typeof k&&(k=k()),u.rootElement[0].style.width=k+"px"}i&&(u.rootElement[0].style.overflow="auto"),b||c.hooks.run(u,"afterUpdateSettings"),r.adjustRowsAndCols(),u.view&&!p.firstRun&&(u.forceFullRender=!0,s.refreshBorders(null,!0))},this.getValue=function(){var a=u.getSelected();if(v.prototype.getValue){if("function"==typeof v.prototype.getValue)return v.prototype.getValue.call(u);if(a)return u.getData()[a[0]][v.prototype.getValue]}else if(a)return u.getDataAtCell(a[0],a[1])},this.getSettings=function(){return p.settings},this.clear=function(){s.selectAll(),s.empty()},this.alter=function(a,b,c,d,e){r.alter(a,b,c,d,e)},this.getCell=function(a,b){return u.view.getCellAtCoords(new n(a,b))},this.colToProp=function(a){return q.colToProp(a)},this.propToCol=function(a){return q.propToCol(a)},this.getDataAtCell=function(a,b){return q.get(a,q.colToProp(b))},this.getDataAtRowProp=function(a,b){return q.get(a,b)},this.getDataAtCol=function(a){var b=[];return b.concat.apply(b,q.getRange(new n(0,a),new n(p.settings.data.length-1,a),q.DESTINATION_RENDERER))},this.getDataAtProp=function(a){var b=[];return b.concat.apply(b,q.getRange(new n(0,q.propToCol(a)),new n(p.settings.data.length-1,q.propToCol(a)),q.DESTINATION_RENDERER))},this.getSourceDataAtCol=function(a){for(var b=[],c=p.settings.data,d=0;d=0;){for(var d=u.countCols()-1;d>=0;)b.addValidatorToQueue(),u.validateCell(u.getDataAtCell(c,d),u.getCellMeta(c,d),function(){b.removeValidatorFormQueue()},"validateCells"),d--;c--}b.checkIfQueueIsEmpty()},this.getRowHeader=function(a){if(void 0===a){for(var b=[],c=0,d=u.countRows();d>c;c++)b.push(u.getRowHeader(c));return b}return"[object Array]"===Object.prototype.toString.call(p.settings.rowHeaders)&&void 0!==p.settings.rowHeaders[a]?p.settings.rowHeaders[a]:"function"==typeof p.settings.rowHeaders?p.settings.rowHeaders(a):p.settings.rowHeaders&&"string"!=typeof p.settings.rowHeaders&&"number"!=typeof p.settings.rowHeaders?a+1:p.settings.rowHeaders},this.hasRowHeaders=function(){return!!p.settings.rowHeaders},this.hasColHeaders=function(){if(void 0!==p.settings.colHeaders&&null!==p.settings.colHeaders)return!!p.settings.colHeaders;for(var a=0,b=u.countCols();b>a;a++)if(u.getColHeader(a))return!0;return!1},this.getColHeader=function(a){if(void 0===a){for(var b=[],d=0,e=u.countCols();e>d;d++)b.push(u.getColHeader(d));return b}var f=a;return a=c.hooks.execute(u,"modifyCol",a),p.settings.columns&&p.settings.columns[a]&&p.settings.columns[a].title?p.settings.columns[a].title:"[object Array]"===Object.prototype.toString.call(p.settings.colHeaders)&&void 0!==p.settings.colHeaders[a]?p.settings.colHeaders[a]:"function"==typeof p.settings.colHeaders?p.settings.colHeaders(a):p.settings.colHeaders&&"string"!=typeof p.settings.colHeaders&&"number"!=typeof p.settings.colHeaders?c.helper.spreadsheetColumnLabel(f):p.settings.colHeaders},this._getColWidthFromSettings=function(a){var b=u.getCellMeta(0,a),c=b.width;if((void 0===c||c===p.settings.width)&&(c=b.colWidths),void 0!==c&&null!==c){switch(typeof c){case"object":c=c[a];break;case"function":c=c(a)}"string"==typeof c&&(c=parseInt(c,10))}return c},this.getColWidth=function(a){var b=u._getColWidthFromSettings(a);return b||(b=50),b=c.hooks.execute(u,"modifyColWidth",b,a)},this._getRowHeightFromSettings=function(a){var b=p.settings.rowHeights;if(void 0!==b&&null!==b){switch(typeof b){case"object":b=b[a];break;case"function":b=b(a)}"string"==typeof b&&(b=parseInt(b,10))}return b},this.getRowHeight=function(a){var b=u._getRowHeightFromSettings(a),d=u.checkIfRowIsOversized(a);return b=c.hooks.execute(u,"modifyRowHeight",b,a),d&&(b=b?Math.max(b,d):d),b},this.checkIfRowIsOversized=function(a){return u.view.wt.wtTable.oversizedRows?u.view.wt.wtTable.oversizedRows[a]:void 0},this.countRows=function(){return p.settings.data.length},this.countCols=function(){return"object"===u.dataType||"function"===u.dataType?p.settings.columns&&p.settings.columns.length?p.settings.columns.length:q.colToPropCache.length:"array"===u.dataType?p.settings.columns&&p.settings.columns.length?p.settings.columns.length:p.settings.data&&p.settings.data[0]&&p.settings.data[0].length?p.settings.data[0].length:0:void 0},this.rowOffset=function(){return u.view.wt.getSetting("offsetRow")},this.colOffset=function(){return 0},this.countVisibleRows=function(){return u.view.wt.drawn?u.view.wt.wtTable.rowStrategy.countVisible():-1},this.countVisibleCols=function(){return u.view.wt.drawn?u.view.wt.wtTable.columnStrategy.countVisible():-1},this.countEmptyRows=function(a){for(var b,d=u.countRows()-1,e=0;d>=0;){if(b=c.hooks.execute(this,"modifyRow",d),u.isEmptyRow(b))e++;else if(a)break;d--}return e},this.countEmptyCols=function(a){if(u.countRows()<1)return 0;for(var b=u.countCols()-1,c=0;b>=0;){if(u.isEmptyCol(b))c++;else if(a)break;b--}return c},this.isEmptyRow=function(a){return p.settings.isEmptyRow.call(u,a)},this.isEmptyCol=function(a){return p.settings.isEmptyCol.call(u,a)},this.selectCell=function(a,b,c,d,e){if("number"!=typeof a||0>a||a>=u.countRows())return!1;if("number"!=typeof b||0>b||b>=u.countCols())return!1;if("undefined"!=typeof c){if("number"!=typeof c||0>c||c>=u.countRows())return!1;if("number"!=typeof d||0>d||d>=u.countCols())return!1}var f=new n(a,b);return p.selRange=new o(f,f,f),document.activeElement&&document.activeElement!==document.documentElement&&document.activeElement!==document.body&&document.activeElement.blur(),u.listen(),"undefined"==typeof c?s.setRangeEnd(p.selRange.from,e):s.setRangeEnd(new n(c,d),e),u.selection.finish(),!0},this.selectCellByProp=function(){return arguments[1]=q.propToCol(arguments[1]),"undefined"!=typeof arguments[3]&&(arguments[3]=q.propToCol(arguments[3])),u.selectCell.apply(u,arguments)},this.deselectCell=function(){s.deselect()},this.destroy=function(){u._clearTimeouts(),u.view&&u.view.wt.destroy(),u.rootElement.empty(),u.rootElement.removeData("handsontable"),u.rootElement.off(".handsontable"),a(b).off("."+u.guid),w.off("."+u.guid),x.off("."+u.guid),c.hooks.run(u,"afterDestroy"),c.hooks.destroy(u);for(var d in u)u.hasOwnProperty(d)&&("function"==typeof u[d]?"runHooks"!==d&&"runHooksAndReturn"!==d&&(u[d]=m):"guid"!==d&&(u[d]=null));p=null,q=null,r=null,s=null,t=null,u=null,v=null,w=null,x=null},this.getActiveEditor=function(){return t.getActiveEditor()},this.getInstance=function(){return u},this.addHook=function(a,b){c.hooks.add(a,b,u)},this.addHookOnce=function(a,b){c.hooks.once(a,b,u)},this.removeHook=function(a,b){c.hooks.remove(a,b,u)},this.runHooks=function(a,b,d,e,f,g,h){c.hooks.run(u,a,b,d,e,f,g,h)},this.runHooksAndReturn=function(a,b,d,e,f,g,h){return c.hooks.execute(u,a,b,d,e,f,g,h)},this.timeouts=[],this._registerTimeout=function(a){this.timeouts.push(a)},this._clearTimeouts=function(){for(var a=0,b=this.timeouts.length;b>a;a++)clearTimeout(this.timeouts[a])},this.version="0.11.4"};var H=function(){};if(H.prototype={data:void 0,dataSchema:void 0,width:void 0,height:void 0,startRows:5,startCols:5,rowHeaders:null,colHeaders:null,colWidths:void 0,columns:void 0,cells:void 0,cell:[],minRows:0,minCols:0,maxRows:1/0,maxCols:1/0,minSpareRows:0,minSpareCols:0,multiSelect:!0,fillHandle:!0,fixedRowsTop:0,fixedColumnsLeft: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:"none",isEmptyRow:function(a){for(var b,c=0,d=this.countCols();d>c;c++)if(b=this.getDataAtCell(a,c),""!==b&&null!==b&&"undefined"!=typeof b)return!1;return!0},isEmptyCol:function(a){for(var b,c=0,d=this.countRows();d>c;c++)if(b=this.getDataAtCell(c,a),""!==b&&null!==b&&"undefined"!=typeof b)return!1;return!0},observeDOMVisibility:!0,allowInvalid:!0,invalidCellClassName:"htInvalid",placeholder:!1,placeholderCellClassName:"htPlaceholder",readOnlyCellClassName:"htDimmed",commentedCellClassName:"htCommentCell",fragmentSelection:!1,readOnly:!1,type:"text",copyable:!0,debug:!1,wordWrap:!0,noWordWrapClassName:"htNoWrap",contextMenu:void 0,undo:void 0,columnSorting:void 0,manualColumnMove:void 0,manualColumnResize:void 0,manualRowMove:void 0,manualRowResize:void 0,groups:void 0},c.DefaultSettings=H,a.fn.handsontable=function(a){var b,d,e,f,g,h=this.first(),i=h.data("handsontable");if("string"!=typeof a)return g=a||{},i?i.updateSettings(g):(i=new c.Core(h,g),h.data("handsontable",i),i.init()),h;if(e=[],arguments.length>1)for(b=1,d=arguments.length;d>b;b++)e.push(arguments[b]);if(i){if("undefined"==typeof i[a])throw new Error("Handsontable do not provide action: "+a);f=i[a].apply(i,e)}return f},function(a){function b(){function a(a){return null!==a&&!c(a)&&("string"==typeof a||"number"==typeof a)}function b(a){return null!==a&&("object"==typeof a||"function"==typeof a)}function c(a){return a!==a}var d={arrayMap:[],weakMap:new WeakMap};return{get:function(c){return a(c)?d.arrayMap[c]:b(c)?d.weakMap.get(c):void 0},set:function(c,e){if(a(c))d.arrayMap[c]=e;else{if(!b(c))throw new Error("Invalid key type");d.weakMap.set(c,e)}},"delete":function(c){a(c)?delete d.arrayMap[c]:b(c)&&d.weakMap["delete"](c)}}}a.MultiMap||(a.MultiMap=b)}(b),!b.Handsontable)var c={};c.Dom={},c.Dom.closest=function(a,b,c){for(;null!=a&&a!==c;){if(1===a.nodeType&&b.indexOf(a.nodeName)>-1)return a;a=a.parentNode}return null},c.Dom.isChildOf=function(a,b){for(var c=a.parentNode;null!=c;){if(c==b)return!0;c=c.parentNode}return!1},c.Dom.index=function(a){for(var b=0;a=a.previousSibling;)++b;return b},document.documentElement.classList?(c.Dom.hasClass=function(a,b){return a.classList.contains(b)},c.Dom.addClass=function(a,b){a.classList.add(b)},c.Dom.removeClass=function(a,b){a.classList.remove(b)}):(c.Dom.hasClass=function(a,b){return a.className.match(new RegExp("(\\s|^)"+b+"(\\s|$)"))},c.Dom.addClass=function(a,b){""==a.className?a.className=b:this.hasClass(a,b)||(a.className+=" "+b)},c.Dom.removeClass=function(a,b){if(this.hasClass(a,b)){var c=new RegExp("(\\s|^)"+b+"(\\s|$)");a.className=a.className.replace(c," ").trim()}}),c.Dom.removeTextNodes=function(a,b){if(3===a.nodeType)b.removeChild(a);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(a.nodeName)>-1)for(var c=a.childNodes,d=c.length-1;d>=0;d--)this.removeTextNodes(c[d],a)},c.Dom.empty=function(a){for(var b;b=a.lastChild;)a.removeChild(b)},c.Dom.HTML_CHARACTERS=/(<(.*)>|&(.*);)/,c.Dom.fastInnerHTML=function(a,b){this.HTML_CHARACTERS.test(b)?a.innerHTML=b:this.fastInnerText(a,b)},c.Dom.fastInnerText=document.createTextNode("test").textContent?function(a,b){var c=a.firstChild;c&&3===c.nodeType&&null===c.nextSibling?c.textContent=b:(this.empty(a),a.appendChild(document.createTextNode(b)))}:function(a,b){var c=a.firstChild;c&&3===c.nodeType&&null===c.nextSibling?c.data=b:(this.empty(a),a.appendChild(document.createTextNode(b)))},c.Dom.isVisible=function(a){for(var b=a;b!==document.documentElement;){if(null===b)return!1;if(11===b.nodeType){if(b.host){if(b.host.impl)return c.Dom.isVisible(b.host.impl);if(b.host)return c.Dom.isVisible(b.host);throw new Error("Lost in Web Components world")}return!1}if("none"===b.style.display)return!1;b=b.parentNode}return!0},c.Dom.offset=function(a){if(this.hasCaptionProblem()&&a.firstChild&&"CAPTION"===a.firstChild.nodeName){var c=a.getBoundingClientRect();return{top:c.top+(b.pageYOffset||document.documentElement.scrollTop)-(document.documentElement.clientTop||0),left:c.left+(b.pageXOffset||document.documentElement.scrollLeft)-(document.documentElement.clientLeft||0)}}for(var d=a.offsetLeft,e=a.offsetTop,f=a;(a=a.offsetParent)&&a!==document.body;)d+=a.offsetLeft,e+=a.offsetTop,f=a;return f&&"fixed"===f.style.position&&(d+=b.pageXOffset||document.documentElement.scrollLeft,e+=b.pageYOffset||document.documentElement.scrollTop),{left:d,top:e}},c.Dom.getWindowScrollTop=function(){var a=b.scrollY;return void 0==a&&(a=document.documentElement.scrollTop),a},c.Dom.getWindowScrollLeft=function(){var a=b.scrollX;return void 0==a&&(a=document.documentElement.scrollLeft),a},c.Dom.getScrollTop=function(a){return a===b?c.Dom.getWindowScrollTop(a):a.scrollTop},c.Dom.getScrollLeft=function(a){return a===b?c.Dom.getWindowScrollLeft(a):a.scrollLeft},c.Dom.getComputedStyle=function(a){return a.currentStyle||document.defaultView.getComputedStyle(a)},c.Dom.outerWidth=function(a){return a.offsetWidth},c.Dom.outerHeight=function(a){return this.hasCaptionProblem()&&a.firstChild&&"CAPTION"===a.firstChild.nodeName?a.offsetHeight+a.firstChild.offsetHeight:a.offsetHeight},c.Dom.innerHeight=function(a){return a.clientHeight},c.Dom.innerWidth=function(a){return a.innerWidth},function(){function a(){var a=document.createElement("TABLE");a.style.borderSpacing=0,a.style.borderWidth=0,a.style.padding=0;var b=document.createElement("TBODY");a.appendChild(b),b.appendChild(document.createElement("TR")),b.firstChild.appendChild(document.createElement("TD")),b.firstChild.firstChild.innerHTML="t
t";var c=document.createElement("CAPTION");c.innerHTML="c
c
c
c",c.style.padding=0,c.style.margin=0,a.insertBefore(c,b),document.body.appendChild(a),d=a.offsetHeight<2*a.lastChild.offsetHeight,document.body.removeChild(a)}function b(){var a=document.createElement("p");a.style.width="100%",a.style.height="200px";var b=document.createElement("div");b.style.position="absolute",b.style.top="0px",b.style.left="0px",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.overflow="hidden",b.appendChild(a),(document.body||document.documentElement).appendChild(b);var c=a.offsetWidth;b.style.overflow="scroll";var d=a.offsetWidth;return c==d&&(d=b.clientWidth),(document.body||document.documentElement).removeChild(b),c-d}var d;c.Dom.hasCaptionProblem=function(){return void 0===d&&a(),d},c.Dom.getCaretPosition=function(a){if(a.selectionStart)return a.selectionStart;if(document.selection){a.focus();var b=document.selection.createRange();if(null==b)return 0;var c=a.createTextRange(),d=c.duplicate();return c.moveToBookmark(b.getBookmark()),d.setEndPoint("EndToStart",c),d.text.length}return 0},c.Dom.getSelectionEndPosition=function(a){if(a.selectionEnd)return a.selectionEnd;if(document.selection){var b=document.selection.createRange();if(null==b)return 0;var c=a.createTextRange();return c.text.indexOf(b.text)+b.text.length}},c.Dom.setCaretPosition=function(a,b,c){if(void 0===c&&(c=b),a.setSelectionRange)a.focus(),a.setSelectionRange(b,c);else if(a.createTextRange){var d=a.createTextRange();d.collapse(!0),d.moveEnd("character",c),d.moveStart("character",b),d.select()}};var e;c.Dom.getScrollbarWidth=function(){return void 0===e&&(e=b()),e}}(),c.TableView=function(d){var e=this,f=a(document.documentElement);this.instance=d,this.settings=d.getSettings(),d.rootElement.data("originalStyle",d.rootElement[0].getAttribute("style")),d.rootElement.addClass("handsontable");var g=document.createElement("TABLE");g.className="htCore",this.THEAD=document.createElement("THEAD"),g.appendChild(this.THEAD),this.TBODY=document.createElement("TBODY"),g.appendChild(this.TBODY),d.$table=a(g),d.container.prepend(d.$table),d.rootElement.on("mousedown.handsontable",function(a){e.isTextSelectionAllowed(a.target)||(i(),a.preventDefault(),b.focus())}),f.on("keyup."+d.guid,function(a){d.selection.isInProgress()&&!a.shiftKey&&d.selection.finish()});var h;this.isMouseDown=function(){return h},f.on("mouseup."+d.guid,function(a){d.selection.isInProgress()&&1===a.which&&d.selection.finish(),h=!1,c.helper.isOutsideInput(document.activeElement)&&d.unlisten()}),f.on("mousedown."+d.guid,function(a){var b=a.target;if(!h){if(b!==e.wt.wtTable.spreader)for(;b!==document.documentElement;){if(null===b)return;if(b===d.rootElement[0])return;b=b.parentNode}e.settings.outsideClickDeselects?d.deselectCell():d.destroyEditor()}}),d.$table.on("selectstart",function(a){e.settings.fragmentSelection||a.preventDefault()});var i=function(){b.getSelection?b.getSelection().empty?b.getSelection().empty():b.getSelection().removeAllRanges&&b.getSelection().removeAllRanges():document.selection&&document.selection.empty()},j=[new C({className:"current",border:{width:2,color:"#5292F7",cornerVisible:function(){return e.settings.fillHandle&&!e.isCellEdited()&&!d.selection.isMultiple()}}}),new C({className:"area",border:{width:1,color:"#89AFF9",cornerVisible:function(){return e.settings.fillHandle&&!e.isCellEdited()&&d.selection.isMultiple()}}}),new C({className:"highlight",highlightRowClassName:e.settings.currentRowClassName,highlightColumnClassName:e.settings.currentColClassName}),new C({className:"fill",border:{width:1,color:"red"}})];j.current=j[0],j.area=j[1],j.highlight=j[2],j.fill=j[3];var k={debug:function(){return e.settings.debug},table:g,stretchH:this.settings.stretchH,data:d.getDataAtCell,totalRows:d.countRows,totalColumns:d.countCols,offsetRow:0,fixedColumnsLeft:function(){return e.settings.fixedColumnsLeft},fixedRowsTop:function(){return e.settings.fixedRowsTop},renderAllRows:e.settings.renderAllRows,rowHeaders:function(){var a=[];return d.hasRowHeaders()&&a.push(function(a,b){e.appendRowHeader(a,b)}),c.hooks.run(d,"afterGetRowHeaderRenderers",a),a},columnHeaders:function(){var a=[];return d.hasColHeaders()&&a.push(function(a,b){e.appendColHeader(a,b)}),c.hooks.run(d,"afterGetColumnHeaderRenderers",a),a},columnWidth:d.getColWidth,rowHeight:d.getRowHeight,cellRenderer:function(a,b,d){var f=e.instance.colToProp(b),g=e.instance.getCellMeta(a,b),h=e.instance.getCellRenderer(g),i=e.instance.getDataAtRowProp(a,f);h(e.instance,d,a,b,f,i,g),c.hooks.run(e.instance,"afterRenderer",d,a,b,f,i,g)},selections:j,hideBorderOnMouseDownOver:function(){return e.settings.fragmentSelection},onCellMouseDown:function(a,b,f,g){d.listen(),e.activeWt=g,h=!0,c.hooks.run(d,"beforeOnCellMouseDown",a,b,f),a.isImmediatePropagationStopped()||(2===a.button&&d.selection.inInSelection(b)||(a.shiftKey?b.row>=0&&b.col>=0&&d.selection.setRangeEnd(b):b.row<0||b.col<0?(b.row<0&&(d.selectCell(0,b.col,d.countRows()-1,b.col),d.selection.setSelectedHeaders(!1,!0)),b.col<0&&(d.selectCell(b.row,0,b.row,d.countCols()-1),d.selection.setSelectedHeaders(!0,!1))):d.selection.setRangeStart(b)),c.hooks.run(d,"afterOnCellMouseDown",a,b,f),e.activeWt=e.wt)},onCellMouseOver:function(a,b,f,g){e.activeWt=g,b.row>=0&&b.col>=0?h&&d.selection.setRangeEnd(b):h&&(b.row<0&&(d.selection.setRangeEnd(new n(d.countRows()-1,b.col)),d.selection.setSelectedHeaders(!1,!0)),b.col<0&&(d.selection.setRangeEnd(new n(b.row,d.countCols()-1)),d.selection.setSelectedHeaders(!0,!1))),c.hooks.run(d,"afterOnCellMouseOver",a,b,f),e.activeWt=e.wt},onCellCornerMouseDown:function(a){a.preventDefault(),c.hooks.run(d,"afterOnCellCornerMouseDown",a)},beforeDraw:function(a){e.beforeRender(a)},onDraw:function(a){e.onDraw(a)},onScrollVertically:function(){d.runHooks("afterScrollVertically")},onScrollHorizontally:function(){d.runHooks("afterScrollHorizontally")},onBeforeDrawBorders:function(a,b){d.runHooks("beforeDrawBorders",a,b)}};c.hooks.run(d,"beforeInitWalkontable",k),this.wt=new r(k),this.activeWt=this.wt,a(e.wt.wtTable.spreader).on("mousedown.handsontable, contextmenu.handsontable",function(a){a.target===e.wt.wtTable.spreader&&3===a.which&&a.stopPropagation()}),f.on("click."+d.guid,function(){e.settings.observeDOMVisibility&&e.wt.drawInterrupted&&(e.instance.forceFullRender=!0,e.render())})},c.TableView.prototype.isTextSelectionAllowed=function(a){return c.helper.isInput(a)?!0:this.settings.fragmentSelection&&c.Dom.isChildOf(a,this.TBODY)?!0:!1},c.TableView.prototype.isCellEdited=function(){var a=this.instance.getActiveEditor();return a&&a.isOpened()},c.TableView.prototype.beforeRender=function(a){a&&c.hooks.run(this.instance,"beforeRender",this.instance.forceFullRender)},c.TableView.prototype.onDraw=function(a){a&&c.hooks.run(this.instance,"afterRender",this.instance.forceFullRender)},c.TableView.prototype.render=function(){this.wt.draw(!this.instance.forceFullRender),this.instance.forceFullRender=!1,this.instance.rootElement.triggerHandler("render.handsontable")},c.TableView.prototype.getCellAtCoords=function(a){var b=this.wt.wtTable.getCell(a);return 0>b?null:b},c.TableView.prototype.scrollViewport=function(a){this.wt.scrollViewport(a)},c.TableView.prototype.appendRowHeader=function(a,b){var d=document.createElement("DIV"),e=document.createElement("SPAN");d.className="relative",e.className="rowHeader",a>-1?c.Dom.fastInnerHTML(e,this.instance.getRowHeader(a)):c.Dom.fastInnerText(e," "),d.appendChild(e),c.Dom.empty(b),b.appendChild(d),c.hooks.run(this.instance,"afterGetRowHeader",a,b)},c.TableView.prototype.appendColHeader=function(a,b){var d=document.createElement("DIV"),e=document.createElement("SPAN");d.className="relative",e.className="colHeader",a>-1?c.Dom.fastInnerHTML(e,this.instance.getColHeader(a)):c.Dom.fastInnerText(e," "),d.appendChild(e),c.Dom.empty(b),b.appendChild(d),c.hooks.run(this.instance,"afterGetColHeader",a,b)},c.TableView.prototype.maximumVisibleElementWidth=function(a){var b=this.wt.wtViewport.getWorkspaceWidth(),c=b-a;return c>0?c:0},c.TableView.prototype.maximumVisibleElementHeight=function(a){var b=this.wt.wtViewport.getWorkspaceHeight(),c=b-a;return c>0?c:0},c.TableView.prototype.mainViewIsActive=function(){return this.wt===this.activeWt},function(a){function b(a){var b,c;c={},b=a,this.getInstance=function(a){return a.guid in c||(c[a.guid]=new b(a)),c[a.guid]}}var c={},d=new WeakMap;a.editors={registerEditor:function(a,e){var f=new b(e);"string"==typeof a&&(c[a]=f),d.set(e,f)},getEditor:function(a,b){var e;if("function"==typeof a)d.get(a)||this.registerEditor(null,a),e=d.get(a);else{if("string"!=typeof a)throw Error('Only strings and functions can be passed as "editor" parameter ');e=c[a]}if(!e)throw Error('No editor registered under name "'+a+'"');return e.getInstance(b)}}}(c),function(b){b.EditorManager=function(c,d,e){var f,g=this,h=a(document),i=b.helper.keyCode,j=!1,k=function(){function a(a){if(c.isListening()&&(b.hooks.run(c,"beforeKeyDown",a),!j&&!a.isImmediatePropagationStopped()&&(d.lastKeyCode=a.keyCode,e.isSelected()))){var h=(a.ctrlKey||a.metaKey)&&!a.altKey;if(!(f.isWaiting()||b.helper.isMetaKey(a.keyCode)||h||g.isEditorOpened()))return void g.openEditor("");var k=a.shiftKey?e.setRangeEnd:e.setRangeStart;switch(a.keyCode){case i.A:h&&(e.selectAll(),a.preventDefault(),a.stopPropagation());break;case i.ARROW_UP:g.isEditorOpened()&&!f.isWaiting()&&g.closeEditorAndSaveChanges(h),m(a.shiftKey),a.preventDefault(),a.stopPropagation();break;case i.ARROW_DOWN:g.isEditorOpened()&&!f.isWaiting()&&g.closeEditorAndSaveChanges(h),o(a.shiftKey),a.preventDefault(),a.stopPropagation();break;case i.ARROW_RIGHT:g.isEditorOpened()&&!f.isWaiting()&&g.closeEditorAndSaveChanges(h),p(a.shiftKey),a.preventDefault(),a.stopPropagation();break;case i.ARROW_LEFT:g.isEditorOpened()&&!f.isWaiting()&&g.closeEditorAndSaveChanges(h),q(a.shiftKey),a.preventDefault(),a.stopPropagation();break;case i.TAB:var r="function"==typeof d.settings.tabMoves?d.settings.tabMoves(a):d.settings.tabMoves;a.shiftKey?e.transformStart(-r.row,-r.col):e.transformStart(r.row,r.col,!0),a.preventDefault(),a.stopPropagation();break;case i.BACKSPACE:case i.DELETE:e.empty(a),g.prepareEditor(),a.preventDefault();break;case i.F2:g.openEditor(),a.preventDefault();break;case i.ENTER:g.isEditorOpened()?(f.state!==b.EditorState.WAITING&&g.closeEditorAndSaveChanges(h),l(a.shiftKey)):c.getSettings().enterBeginsEditing?g.openEditor():l(a.shiftKey),a.preventDefault(),a.stopImmediatePropagation();break;case i.ESCAPE:g.isEditorOpened()&&g.closeEditorAndRestoreOriginalValue(h),a.preventDefault();break;case i.HOME:k(a.ctrlKey||a.metaKey?new n(0,d.selRange.from.col):new n(d.selRange.from.row,0)),a.preventDefault(),a.stopPropagation();break;case i.END:k(a.ctrlKey||a.metaKey?new n(c.countRows()-1,d.selRange.from.col):new n(d.selRange.from.row,c.countCols()-1)),a.preventDefault(),a.stopPropagation();break;case i.PAGE_UP:e.transformStart(-c.countVisibleRows(),0),c.view.wt.scrollVertical(-c.countVisibleRows()),c.view.render(),a.preventDefault(),a.stopPropagation();break;case i.PAGE_DOWN:e.transformStart(c.countVisibleRows(),0),c.view.wt.scrollVertical(c.countVisibleRows()),c.view.render(),a.preventDefault(),a.stopPropagation()}}}function k(a,b,c){"TD"==c.nodeName&&g.openEditor()}function l(a){var b="function"==typeof d.settings.enterMoves?d.settings.enterMoves(event):d.settings.enterMoves;a?e.transformStart(-b.row,-b.col):e.transformStart(b.row,b.col,!0)}function m(a){a?e.transformEnd(-1,0):e.transformStart(-1,0)}function o(a){a?e.transformEnd(1,0):e.transformStart(1,0)}function p(a){a?e.transformEnd(0,1):e.transformStart(0,1)}function q(a){a?e.transformEnd(0,-1):e.transformStart(0,-1)}c.addHook("afterDocumentKeyDown",function(b){a(b)}),h.on("keydown."+c.guid,function(a){c.runHooks("afterDocumentKeyDown",a)}),c.view.wt.update("onCellDblClick",k),c.addHook("afterDestroy",function(){j=!0})};this.destroyEditor=function(a){this.closeEditor(a)},this.getActiveEditor=function(){return f},this.prepareEditor=function(){if(f&&f.isWaiting())return void this.closeEditor(!1,!1,function(a){a&&g.prepareEditor()});var a=d.selRange.highlight.row,e=d.selRange.highlight.col,h=c.colToProp(e),i=c.getCell(a,e),j=c.getDataAtCell(a,e),k=c.getCellMeta(a,e),l=c.getCellEditor(k);f=b.editors.getEditor(l,c),f.prepare(a,e,h,i,j,k)},this.isEditorOpened=function(){return f.isOpened()},this.openEditor=function(a){f.cellProperties.readOnly||f.beginEditing(a)},this.closeEditor=function(a,b,c){f?f.finishEditing(a,b,c):c&&c(!1)},this.closeEditorAndSaveChanges=function(a){return this.closeEditor(!1,a)},this.closeEditorAndRestoreOriginalValue=function(a){return this.closeEditor(!0,a)},k()}}(c),function(a){var b={};a.renderers={registerRenderer:function(a,c){b[a]=c},getRenderer:function(a){if("function"==typeof a)return a;if("string"!=typeof a)throw Error('Only strings and functions can be passed as "renderer" parameter ');if(!(a in b))throw Error('No editor registered under name "'+a+'"');return b[a]}}}(c),c.helper.isPrintableChar=function(a){return 32==a||a>=48&&57>=a||a>=96&&111>=a||a>=186&&192>=a||a>=219&&222>=a||a>=226||a>=65&&90>=a},c.helper.isMetaKey=function(a){var b=c.helper.keyCode,d=[b.ARROW_DOWN,b.ARROW_UP,b.ARROW_LEFT,b.ARROW_RIGHT,b.HOME,b.END,b.DELETE,b.BACKSPACE,b.F1,b.F2,b.F3,b.F4,b.F5,b.F6,b.F7,b.F8,b.F9,b.F10,b.F11,b.F12,b.TAB,b.PAGE_DOWN,b.PAGE_UP,b.ENTER,b.ESCAPE,b.SHIFT,b.CAPS_LOCK,b.ALT];return-1!=d.indexOf(a)},c.helper.isCtrlKey=function(a){var b=c.helper.keyCode;return-1!=[b.CONTROL_LEFT,224,b.COMMAND_LEFT,b.COMMAND_RIGHT].indexOf(a)},c.helper.stringify=function(a){switch(typeof a){case"string":case"number":return a+"";case"object":return null===a?"":a.toString();case"undefined":return"";default:return a.toString()}},c.helper.spreadsheetColumnLabel=function(a){for(var b,c=a+1,d="";c>0;)b=(c-1)%26,d=String.fromCharCode(65+b)+d,c=parseInt((c-b)/26,10);return d},c.helper.isNumeric=function(a){var b=typeof a;return"number"==b?!isNaN(a)&&isFinite(a):"string"==b?a.length?1==a.length?/\d/.test(a):/^\s*[+-]?\s*(?:(?:\d+(?:\.\d+)?(?:e[+-]?\d+)?)|(?:0x[a-f\d]+))\s*$/i.test(a):!1:"object"==b?!(!a||"number"!=typeof a.valueOf()||a instanceof Date):!1},c.helper.isDescendant=function(a,b){for(var c=b.parentNode;null!=c;){if(c==a)return!0;c=c.parentNode}return!1},c.helper.randomString=function(){return u()},c.helper.inherit=function(a,b){return b.prototype.constructor=b,a.prototype=new b,a.prototype.constructor=a,a},c.helper.extend=function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},c.helper.getPrototypeOf=function(a){var b;if("object"==typeof a.__proto__)b=a.__proto__;else{var c,d=a.constructor;"function"==typeof a.constructor&&(c=d,delete a.constructor&&(d=a.constructor,a.constructor=c)),b=d?d.prototype:null}return b},c.helper.columnFactory=function(a,b){function d(){}c.helper.inherit(d,a);for(var e=0,f=b.length;f>e;e++)d.prototype[b[e]]=void 0;return d},c.helper.translateRowsToColumns=function(a){var b,c,d,e,f=[],g=0; for(b=0,c=a.length;c>b;b++)for(d=0,e=a[b].length;e>d;d++)d==g&&(f.push([]),g++),f[d].push(a[b][d]);return f},c.helper.to2dArray=function(a){for(var b=0,c=a.length;c>b;)a[b]=[a[b]],b++},c.helper.extendArray=function(a,b){for(var c=0,d=b.length;d>c;)a.push(b[c]),c++},c.helper.isInput=function(a){var b=["INPUT","SELECT","TEXTAREA"];return b.indexOf(a.nodeName)>-1},c.helper.isOutsideInput=function(a){return c.helper.isInput(a)&&-1==a.className.indexOf("handsontableInput")},c.helper.keyCode={MOUSE_LEFT:1,MOUSE_RIGHT:3,MOUSE_MIDDLE:2,BACKSPACE:8,COMMA:188,INSERT:45,DELETE:46,END:35,ENTER:13,ESCAPE:27,CONTROL_LEFT:91,COMMAND_LEFT:17,COMMAND_RIGHT:93,ALT:18,HOME:36,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,SPACE:32,SHIFT:16,CAPS_LOCK:20,TAB:9,ARROW_RIGHT:39,ARROW_LEFT:37,ARROW_UP:38,ARROW_DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,A:65,X:88,C:67,V:86},c.helper.isObject=function(a){return"[object Object]"==Object.prototype.toString.call(a)},c.helper.isArray=function(a){return Array.isArray?Array.isArray(a):"[object Array]"==Object.prototype.toString.call(a)},c.helper.pivot=function(a){var b=[];if(!a||0==a.length||!a[0]||0==a[0].length)return b;for(var c=a.length,d=a[0].length,e=0;c>e;e++)for(var f=0;d>f;f++)b[f]||(b[f]=[]),b[f][e]=a[e][f];return b},c.helper.proxy=function(a,b){return function(){return a.apply(b,arguments)}},c.helper.cellMethodLookupFactory=function(a,b){function d(a){var b=c.cellTypes[a];if("undefined"==typeof b)throw new Error('You declared cell type "'+a+'" 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');return b}return b="undefined"==typeof b?!0:b,function(e,f){return function g(e){if(e){if(e.hasOwnProperty(a)&&void 0!==e[a])return e[a];if(e.hasOwnProperty("type")&&e.type){var f;if("string"!=typeof e.type)throw new Error("Cell type must be a string ");if(f=d(e.type),f.hasOwnProperty(a))return f[a];if(b)return}return g(c.helper.getPrototypeOf(e))}}("number"==typeof e?this.getCellMeta(e,f):e)}},c.helper.toString=function(a){return""+a},function(b){b.DataMap=function(a,b,c){this.instance=a,this.priv=b,this.GridSettings=c,this.dataSource=this.instance.getSettings().data,this.duckSchema=this.dataSource[0]?this.recursiveDuckSchema(this.dataSource[0]):{},this.createMap()},b.DataMap.prototype.DESTINATION_RENDERER=1,b.DataMap.prototype.DESTINATION_CLIPBOARD_GENERATOR=2,b.DataMap.prototype.recursiveDuckSchema=function(b){var c;if(a.isPlainObject(b)){c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=a.isPlainObject(b[d])?this.recursiveDuckSchema(b[d]):null)}else c=[];return c},b.DataMap.prototype.recursiveDuckColumns=function(b,c,d){var e,f;if("undefined"==typeof c&&(c=0,d=""),a.isPlainObject(b))for(f in b)b.hasOwnProperty(f)&&(null===b[f]?(e=d+f,this.colToPropCache.push(e),this.propToColCache.set(e,c),c++):c=this.recursiveDuckColumns(b[f],c,f+"."));return c},b.DataMap.prototype.createMap=function(){if("undefined"==typeof this.getSchema())throw new Error("trying to create `columns` definition but you didnt' provide `schema` nor `data`");var a,b,c=this.getSchema();this.colToPropCache=[],this.propToColCache=new MultiMap;var d=this.instance.getSettings().columns;if(d)for(a=0,b=d.length;b>a;a++)"undefined"!=typeof d[a].data&&(this.colToPropCache[a]=d[a].data,this.propToColCache.set(d[a].data,a));else this.recursiveDuckColumns(c)},b.DataMap.prototype.colToProp=function(a){return a=b.hooks.execute(this.instance,"modifyCol",a),this.colToPropCache&&"undefined"!=typeof this.colToPropCache[a]?this.colToPropCache[a]:a},b.DataMap.prototype.propToCol=function(a){var c;return c="undefined"!=typeof this.propToColCache.get(a)?this.propToColCache.get(a):a,c=b.hooks.execute(this.instance,"modifyCol",c)},b.DataMap.prototype.getSchema=function(){var a=this.instance.getSettings().dataSchema;return a?"function"==typeof a?a():a:this.duckSchema},b.DataMap.prototype.createRow=function(c,d,e){var f,g,h=this.instance.countCols(),i=0;d||(d=1),("number"!=typeof c||c>=this.instance.countRows())&&(c=this.instance.countRows()),g=c;for(var j=this.instance.getSettings().maxRows;d>i&&this.instance.countRows()k;k++)f.push(null)}else f="function"===this.instance.dataType?this.instance.getSettings().dataSchema(c):a.extend(!0,{},this.getSchema());c===this.instance.countRows()?this.dataSource.push(f):this.dataSource.splice(c,0,f),i++,g++}return b.hooks.run(this.instance,"afterCreateRow",c,i,e),this.instance.forceFullRender=!0,i},b.DataMap.prototype.createCol=function(a,c,d){if("object"===this.instance.dataType||this.instance.getSettings().columns)throw new 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.If you want to be able to add new columns, you have to use array datasource.");var e,f,g=this.instance.countRows(),h=this.dataSource,i=0;c||(c=1),f=a;for(var j=this.instance.getSettings().maxCols;c>i&&this.instance.countCols()=this.instance.countCols()){for(var k=0;g>k;k++)"undefined"==typeof h[k]&&(h[k]=[]),h[k].push(null);this.priv.columnSettings.push(e)}else{for(var k=0;g>k;k++)h[k].splice(f,0,null);this.priv.columnSettings.splice(f,0,e)}i++,f++}return b.hooks.run(this.instance,"afterCreateCol",a,i,d),this.instance.forceFullRender=!0,i},b.DataMap.prototype.removeRow=function(a,c){c||(c=1),"number"!=typeof a&&(a=-c),a=(this.instance.countRows()+a)%this.instance.countRows();var d=this.physicalRowsToLogical(a,c),e=b.hooks.execute(this.instance,"beforeRemoveRow",a,c);if(e!==!1){var f=this.dataSource,g=f.filter(function(a,b){return-1==d.indexOf(b)});f.length=0,Array.prototype.push.apply(f,g),b.hooks.run(this.instance,"afterRemoveRow",a,c),this.instance.forceFullRender=!0}},b.DataMap.prototype.removeCol=function(a,c){if("object"===this.instance.dataType||this.instance.getSettings().columns)throw new Error("cannot remove column with object data source or columns option specified");c||(c=1),"number"!=typeof a&&(a=-c),a=(this.instance.countCols()+a)%this.instance.countCols();var d=b.hooks.execute(this.instance,"beforeRemoveCol",a,c);if(d!==!1){for(var e=this.dataSource,f=0,g=this.instance.countRows();g>f;f++)e[f].splice(a,c);this.priv.columnSettings.splice(a,c),b.hooks.run(this.instance,"afterRemoveCol",a,c),this.instance.forceFullRender=!0}},b.DataMap.prototype.spliceCol=function(a,c,d){var e=4<=arguments.length?[].slice.call(arguments,3):[],f=this.instance.getDataAtCol(a),g=f.slice(c,c+d),h=f.slice(c+d);b.helper.extendArray(e,h);for(var i=0;d>i;)e.push(null),i++;return b.helper.to2dArray(e),this.instance.populateFromArray(c,a,e,null,null,"spliceCol"),g},b.DataMap.prototype.spliceRow=function(a,c,d){var e=4<=arguments.length?[].slice.call(arguments,3):[],f=this.instance.getSourceDataAtRow(a),g=f.slice(c,c+d),h=f.slice(c+d);b.helper.extendArray(e,h);for(var i=0;d>i;)e.push(null),i++;return this.instance.populateFromArray(a,c,[e],null,null,"spliceRow"),g},b.DataMap.prototype.get=function(a,c){if(a=b.hooks.execute(this.instance,"modifyRow",a),"string"==typeof c&&c.indexOf(".")>-1){var d=c.split("."),e=this.dataSource[a];if(!e)return null;for(var f=0,g=d.length;g>f;f++)if(e=e[d[f]],"undefined"==typeof e)return null;return e}return"function"==typeof c?c(this.dataSource.slice(a,a+1)[0]):this.dataSource[a]?this.dataSource[a][c]:null};var c=b.helper.cellMethodLookupFactory("copyable",!1);b.DataMap.prototype.getCopyable=function(a,b){return c.call(this.instance,a,this.propToCol(b))?this.get(a,b):""},b.DataMap.prototype.set=function(a,c,d,e){if(a=b.hooks.execute(this.instance,"modifyRow",a,e||"datamapGet"),"string"==typeof c&&c.indexOf(".")>-1){for(var f=c.split("."),g=this.dataSource[a],h=0,i=f.length-1;i>h;h++)"undefined"==typeof g[f[h]]&&(g[f[h]]={}),g=g[f[h]];g[f[h]]=d}else"function"==typeof c?c(this.dataSource.slice(a,a+1)[0],d):this.dataSource[a][c]=d},b.DataMap.prototype.physicalRowsToLogical=function(a,c){for(var d,e=this.instance.countRows(),f=(e+a)%e,g=[],h=c;e>f&&h;)d=b.hooks.execute(this.instance,"modifyRow",f),g.push(d),h--,f++;return g},b.DataMap.prototype.clear=function(){for(var a=0;a=d;d++){for(h=[],f=Math.min(a.col,b.col);g>=f;f++)h.push(j.call(this,d,this.colToProp(f)));i.push(h)}return i},b.DataMap.prototype.getText=function(a,b){return SheetClip.stringify(this.getRange(a,b,this.DESTINATION_RENDERER))},b.DataMap.prototype.getCopyableText=function(a,b){return SheetClip.stringify(this.getRange(a,b,this.DESTINATION_CLIPBOARD_GENERATOR))}}(c),function(a){a.renderers.cellDecorator=function(b,c,d,e,f,g,h){h.className&&(c.className=c.className?c.className+" "+h.className:h.className),h.readOnly&&a.Dom.addClass(c,h.readOnlyCellClassName),h.valid===!1&&h.invalidCellClassName&&a.Dom.addClass(c,h.invalidCellClassName),h.wordWrap===!1&&h.noWordWrapClassName&&a.Dom.addClass(c,h.noWordWrapClassName),!g&&h.placeholder&&a.Dom.addClass(c,h.placeholderCellClassName)}}(c),function(a){var b=function(b,c,d,e,f,g,h){a.renderers.cellDecorator.apply(this,arguments),!g&&h.placeholder&&(g=h.placeholder);var i=a.helper.stringify(g);if(h.rendererTemplate){a.Dom.empty(c);var j=document.createElement("TEMPLATE");j.setAttribute("bind","{{}}"),j.innerHTML=h.rendererTemplate,HTMLTemplateElement.decorate(j),j.model=b.getSourceDataAtRow(d),c.appendChild(j)}else a.Dom.fastInnerText(c,i)};a.renderers.TextRenderer=b,a.renderers.registerRenderer("text",b)}(c),function(a){var b=document.createElement("DIV");b.className="htAutocompleteWrapper";var c=document.createElement("DIV");c.className="htAutocompleteArrow",c.appendChild(document.createTextNode("▼"));var d=function(d,e,f,g,h,i,j){var k=(b.cloneNode(!0),c.cloneNode(!0));a.renderers.TextRenderer(d,e,f,g,h,i,j),e.appendChild(k),a.Dom.addClass(e,"htAutocomplete"),e.firstChild||e.appendChild(document.createTextNode(" ")),d.acArrowListener||(d.acArrowListener=function(){d.view.wt.getSetting("onCellDblClick",null,new n(f,g),e)},d.rootElement.on("mousedown.htAutocompleteArrow",".htAutocompleteArrow",d.acArrowListener),d.addHookOnce("afterDestroy",function(){this.rootElement.off("mousedown.htAutocompleteArrow")}))};a.AutocompleteRenderer=d,a.renderers.AutocompleteRenderer=d,a.renderers.registerRenderer("autocomplete",d)}(c),function(b){var c=document.createElement("INPUT");c.className="htCheckboxRendererInput",c.type="checkbox",c.setAttribute("autocomplete","off");var d=function(d,e,f,g,h,i,j){"undefined"==typeof j.checkedTemplate&&(j.checkedTemplate=!0),"undefined"==typeof j.uncheckedTemplate&&(j.uncheckedTemplate=!1),b.Dom.empty(e);var k=c.cloneNode(!1);i===j.checkedTemplate||i===b.helper.stringify(j.checkedTemplate)?(k.checked=!0,e.appendChild(k)):i===j.uncheckedTemplate||i===b.helper.stringify(j.uncheckedTemplate)?e.appendChild(k):null===i?(k.className+=" noValue",e.appendChild(k)):b.Dom.fastInnerText(e,"#bad value#");var l=a(k);j.readOnly?l.on("click",function(a){a.preventDefault()}):(l.on("mousedown",function(a){a.stopPropagation()}),l.on("mouseup",function(a){a.stopPropagation()}),l.on("change",function(){this.checked?d.setDataAtRowProp(f,h,j.checkedTemplate):d.setDataAtRowProp(f,h,j.uncheckedTemplate)})),d.CheckboxRenderer&&d.CheckboxRenderer.beforeKeyDownHookBound||(d.CheckboxRenderer={beforeKeyDownHookBound:!0},d.addHook("beforeKeyDown",function(c){if(c.keyCode==b.helper.keyCode.SPACE)for(var e,f,g,h=d.getSelectedRange(),i=h.getTopLeftCorner(),j=h.getBottomRightCorner(),k=i.row;k<=j.row;k++)for(var l=i.col;l<=j.col;l++)if(e=d.getCell(k,l),g=d.getCellMeta(k,l),f=e.querySelectorAll("input[type=checkbox]"),f.length>0&&!g.readOnly){c.isImmediatePropagationStopped()||(c.stopImmediatePropagation(),c.preventDefault());for(var m=0,n=f.length;n>m;m++)f[m].checked=!f[m].checked,a(f[m]).trigger("change")}}))};b.CheckboxRenderer=d,b.renderers.CheckboxRenderer=d,b.renderers.registerRenderer("checkbox",d)}(c),function(a){var b=function(b,c,d,e,f,g,h){a.helper.isNumeric(g)&&("undefined"!=typeof h.language&&numeral.language(h.language),g=numeral(g).format(h.format||"0"),a.Dom.addClass(c,"htNumeric")),a.renderers.TextRenderer(b,c,d,e,f,g,h)};a.NumericRenderer=b,a.renderers.NumericRenderer=b,a.renderers.registerRenderer("numeric",b)}(c),function(a){var b=function(a,b,d,e,f,g,h){c.renderers.TextRenderer.apply(this,arguments),g=b.innerHTML;var i,j=h.hashLength||g.length,k=h.hashSymbol||"*";for(i="";i.split(k).length-1d[2]&&(c=d[0],d[0]=d[2],d[2]=c),d[1]>d[3]&&(c=d[1],d[1]=d[3],d[3]=c),this.instance.populateFromArray(d[0],d[1],a,d[2],d[3],"edit")}else this.instance.populateFromArray(this.row,this.col,a,null,null,"edit")},b.prototype.beginEditing=function(b){this.state==a.EditorState.VIRGIN&&(this.instance.view.scrollViewport(new n(this.row,this.col)),this.instance.view.render(),this.state=a.EditorState.EDITING,b="string"==typeof b?b:this.originalValue,this.setValue(a.helper.stringify(b)),this.open(),this._opened=!0,this.focus(),this.instance.view.render())},b.prototype.finishEditing=function(b,c,d){if(d){var e=this._closeCallback;this._closeCallback=function(a){e&&e(a),d(a)}}if(!this.isWaiting()){if(this.state==a.EditorState.VIRGIN){var f=this;return void this.instance._registerTimeout(setTimeout(function(){f._fireCallbacks(!0)},0))}if(this.state==a.EditorState.EDITING){if(b)return void this.cancelChanges();var g=[[String.prototype.trim.call(this.getValue())]];if(this.state=a.EditorState.WAITING,this.saveValue(g,c),this.instance.getCellValidator(this.cellProperties)){var f=this;this.instance.addHookOnce("afterValidate",function(b){f.state=a.EditorState.FINISHED,f.discardEditor(b)})}else this.state=a.EditorState.FINISHED,this.discardEditor(!0)}}},b.prototype.cancelChanges=function(){this.state=a.EditorState.FINISHED,this.discardEditor()},b.prototype.discardEditor=function(b){this.state===a.EditorState.FINISHED&&(b===!1&&this.cellProperties.allowInvalid!==!0?(this.instance.selectCell(this.row,this.col),this.focus(),this.state=a.EditorState.EDITING,this._fireCallbacks(!1)):(this.close(),this._opened=!1,this.state=a.EditorState.VIRGIN,this._fireCallbacks(!0)))},b.prototype.isOpened=function(){return this._opened},b.prototype.isWaiting=function(){return this.state===a.EditorState.WAITING},a.editors.BaseEditor=b}(c),function(b){var c=b.editors.BaseEditor.prototype.extend();c.prototype.init=function(){this.createElements(),this.bindEvents(),this.autoResize=J()},c.prototype.getValue=function(){return this.TEXTAREA.value},c.prototype.setValue=function(a){this.TEXTAREA.value=a};var d=function(a){var c=this,d=c.getActiveEditor(),e=b.helper.keyCode,f=(a.ctrlKey||a.metaKey)&&!a.altKey;if(a.target===d.TEXTAREA&&!a.isImmediatePropagationStopped()){if(17===a.keyCode||224===a.keyCode||91===a.keyCode||93===a.keyCode)return void a.stopImmediatePropagation();switch(a.keyCode){case e.ARROW_RIGHT:b.Dom.getCaretPosition(d.TEXTAREA)!==d.TEXTAREA.value.length&&a.stopImmediatePropagation();break;case e.ARROW_LEFT:0!==b.Dom.getCaretPosition(d.TEXTAREA)&&a.stopImmediatePropagation();break;case e.ENTER:var g=d.instance.getSelected(),h=!(g[0]===g[2]&&g[1]===g[3]);(f&&!h||a.altKey)&&(d.isOpened()?(d.setValue(d.getValue()+"\n"),d.focus()):d.beginEditing(d.originalValue+"\n"),a.stopImmediatePropagation()),a.preventDefault();break;case e.A:case e.X:case e.C:case e.V:f&&a.stopImmediatePropagation();break;case e.BACKSPACE:case e.DELETE:case e.HOME:case e.END:a.stopImmediatePropagation()}}};c.prototype.open=function(){this.refreshDimensions(),this.instance.addHook("beforeKeyDown",d)},c.prototype.close=function(){this.textareaParentStyle.display="none",this.autoResize.unObserve(),document.activeElement===this.TEXTAREA&&this.instance.listen(),this.instance.removeHook("beforeKeyDown",d)},c.prototype.focus=function(){this.TEXTAREA.focus(),b.Dom.setCaretPosition(this.TEXTAREA,this.TEXTAREA.value.length)},c.prototype.createElements=function(){this.$body=a(document.body),this.TEXTAREA=document.createElement("TEXTAREA"),this.$textarea=a(this.TEXTAREA),b.Dom.addClass(this.TEXTAREA,"handsontableInput"),this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width=0,this.textareaStyle.height=0,this.TEXTAREA_PARENT=document.createElement("DIV"),b.Dom.addClass(this.TEXTAREA_PARENT,"handsontableInputHolder"),this.textareaParentStyle=this.TEXTAREA_PARENT.style,this.textareaParentStyle.top=0,this.textareaParentStyle.left=0,this.textareaParentStyle.display="none",this.TEXTAREA_PARENT.appendChild(this.TEXTAREA),this.instance.rootElement[0].appendChild(this.TEXTAREA_PARENT);var c=this;this.instance._registerTimeout(setTimeout(function(){c.refreshDimensions()},0))},c.prototype.checkEditorSection=function(){return this.rowf&&(f=0),0>g&&(g=0),i>0&&parseInt(c.css("border-top-width"),10)>0&&(f+=1),j>0&&parseInt(c.css("border-left-width"),10)>0&&(g+=1),this.textareaParentStyle.top=f+"px",this.textareaParentStyle.left=g+"px";var k=this.TD.offsetTop-this.instance.view.wt.wtScrollbars.vertical.getScrollPosition(),l=this.TD.offsetLeft-this.instance.view.wt.wtScrollbars.horizontal.getScrollPosition(),m=c.width(),n=this.instance.view.maximumVisibleElementWidth(l)-10,o=c.outerHeight()-4,p=this.instance.view.maximumVisibleElementHeight(k)-2;parseInt(c.css("border-top-width"),10)>0&&(o-=1),parseInt(c.css("border-left-width"),10)>0&&i>0&&(m-=1),this.TEXTAREA.style.fontSize=b.Dom.getComputedStyle(this.TD).fontSize,this.TEXTAREA.style.fontFamily=b.Dom.getComputedStyle(this.TD).fontFamily,this.autoResize.init(this.TEXTAREA,{minHeight:Math.min(o,p),maxHeight:p,minWidth:Math.min(m,n),maxWidth:n}),this.textareaParentStyle.display="block"}},c.prototype.bindEvents=function(){var a=this;this.$textarea.on("cut.editor",function(a){a.stopPropagation()}),this.$textarea.on("paste.editor",function(a){a.stopPropagation()}),this.instance.addHook("afterScrollVertically",function(){a.refreshDimensions()})},b.editors.TextEditor=c,b.editors.registerEditor("text",b.editors.TextEditor)}(c),function(b){var c=b.editors.BaseEditor.prototype.extend();c.prototype.beginEditing=function(){var b=this.TD.querySelector('input[type="checkbox"]');b&&a(b).trigger("click")},c.prototype.finishEditing=function(){},c.prototype.init=function(){},c.prototype.open=function(){},c.prototype.close=function(){},c.prototype.getValue=function(){},c.prototype.setValue=function(){},c.prototype.focus=function(){},b.editors.CheckboxEditor=c,b.editors.registerEditor("checkbox",c)}(c),function(b){var c=b.editors.TextEditor.prototype.extend();c.prototype.init=function(){if(!a.datepicker)throw new Error("jQuery UI Datepicker dependency not found. Did you forget to include jquery-ui.custom.js or its substitute?");b.editors.TextEditor.prototype.init.apply(this,arguments),this.isCellEdited=!1;var c=this;this.instance.addHook("afterDestroy",function(){c.destroyElements()})},c.prototype.createElements=function(){b.editors.TextEditor.prototype.createElements.apply(this,arguments),this.datePicker=document.createElement("DIV"),b.Dom.addClass(this.datePicker,"htDatepickerHolder"),this.datePickerStyle=this.datePicker.style,this.datePickerStyle.position="absolute",this.datePickerStyle.top=0,this.datePickerStyle.left=0,this.datePickerStyle.zIndex=99,document.body.appendChild(this.datePicker),this.$datePicker=a(this.datePicker);var c=this,d={dateFormat:"yy-mm-dd",showButtonPanel:!0,changeMonth:!0,changeYear:!0,onSelect:function(a){c.setValue(a),c.finishEditing(!1)}};this.$datePicker.datepicker(d),this.$datePicker.on("mousedown",function(a){a.stopPropagation()}),this.hideDatepicker()},c.prototype.destroyElements=function(){this.$datePicker.datepicker("destroy"),this.$datePicker.remove()},c.prototype.open=function(){b.editors.TextEditor.prototype.open.call(this),this.showDatepicker()},c.prototype.finishEditing=function(){this.hideDatepicker(),b.editors.TextEditor.prototype.finishEditing.apply(this,arguments)},c.prototype.showDatepicker=function(){var b=a(this.TD),c=b.offset();this.datePickerStyle.top=c.top+b.height()+"px",this.datePickerStyle.left=c.left+"px";var d={defaultDate:this.originalValue||void 0};a.extend(d,this.cellProperties),this.$datePicker.datepicker("option",d),this.originalValue&&this.$datePicker.datepicker("setDate",this.originalValue),this.datePickerStyle.display="block"},c.prototype.hideDatepicker=function(){this.datePickerStyle.display="none"},b.editors.DateEditor=c,b.editors.registerEditor("date",c)}(c),function(b){var c=b.editors.TextEditor.prototype.extend();c.prototype.createElements=function(){b.editors.TextEditor.prototype.createElements.apply(this,arguments);var c=document.createElement("DIV");c.className="handsontableEditor",this.TEXTAREA_PARENT.appendChild(c),this.$htContainer=a(c),this.$htContainer.handsontable()},c.prototype.prepare=function(c,d,e,f,g,h){b.editors.TextEditor.prototype.prepare.apply(this,arguments);var i=this,j={startRows:0,startCols:0,minRows:0,minCols:0,className:"listbox",copyPaste:!1,cells:function(){return{readOnly:!0}},fillHandle:!1,afterOnCellMouseDown:function(){var a=this.getValue();void 0!==a&&i.setValue(a),i.instance.destroyEditor()}};this.cellProperties.handsontable&&(j=a.extend(j,h.handsontable)),this.$htContainer.handsontable("destroy"),this.$htContainer.handsontable(j)};var d=function(a){if(!a.isImmediatePropagationStopped()){var c,d=this.getActiveEditor(),e=d.$htContainer.handsontable("getInstance");if(a.keyCode==b.helper.keyCode.ARROW_DOWN)if(e.getSelected()){var f=e.getSelected()[0],g=e.countRows()-1;c=Math.min(g,f+1)}else c=0;else if(a.keyCode==b.helper.keyCode.ARROW_UP&&e.getSelected()){var f=e.getSelected()[0];c=f-1}void 0!==c&&(0>c?e.deselectCell():e.selectCell(c,0),a.preventDefault(),a.stopImmediatePropagation(),d.instance.listen(),d.TEXTAREA.focus())}};c.prototype.open=function(){this.instance.addHook("beforeKeyDown",d),b.editors.TextEditor.prototype.open.apply(this,arguments),this.$htContainer.handsontable("render"),this.cellProperties.strict?(this.$htContainer.handsontable("selectCell",0,0),this.TEXTAREA.style.visibility="hidden"):(this.$htContainer.handsontable("deselectCell"),this.TEXTAREA.style.visibility="visible"),b.Dom.setCaretPosition(this.TEXTAREA,0,this.TEXTAREA.value.length)},c.prototype.close=function(){this.instance.removeHook("beforeKeyDown",d),this.instance.listen(),b.editors.TextEditor.prototype.close.apply(this,arguments)},c.prototype.focus=function(){this.instance.listen(),b.editors.TextEditor.prototype.focus.apply(this,arguments)},c.prototype.beginEditing=function(){var a=this.instance.getSettings().onBeginEditing;a&&a()===!1||b.editors.TextEditor.prototype.beginEditing.apply(this,arguments)},c.prototype.finishEditing=function(){if(this.$htContainer.handsontable("isListening")&&this.instance.listen(),this.$htContainer.handsontable("getSelected")){var a=this.$htContainer.handsontable("getInstance").getValue();void 0!==a&&this.setValue(a)}return b.editors.TextEditor.prototype.finishEditing.apply(this,arguments)},b.editors.HandsontableEditor=c,b.editors.registerEditor("handsontable",c)}(c),function(a){var c=a.editors.HandsontableEditor.prototype.extend();c.prototype.init=function(){a.editors.HandsontableEditor.prototype.init.apply(this,arguments);var b=this.$htContainer.handsontable("getInstance");b.updateSettings({height:1}),this.query=null,this.choices=[]},c.prototype.createElements=function(){a.editors.HandsontableEditor.prototype.createElements.apply(this,arguments);var c=function(){return-1!=b.navigator.platform.indexOf("Mac")?"htMacScroll":""};this.$htContainer.addClass("autocompleteEditor"),this.$htContainer.addClass(c())};var d=!1,e=function(b){d=!1;var c=this.getActiveEditor(),e=a.helper.keyCode;(a.helper.isPrintableChar(b.keyCode)||b.keyCode===e.BACKSPACE||b.keyCode===e.DELETE||b.keyCode===e.INSERT)&&c.instance._registerTimeout(setTimeout(function(){c.queryChoices(c.TEXTAREA.value),d=!0},0))};c.prototype.prepare=function(){this.instance.addHook("beforeKeyDown",e),a.editors.HandsontableEditor.prototype.prepare.apply(this,arguments)},c.prototype.open=function(){a.editors.HandsontableEditor.prototype.open.apply(this,arguments),this.TEXTAREA.style.visibility="visible",this.focus();var b=this.$htContainer.handsontable("getInstance"),c=this;b.updateSettings({colWidths:[a.Dom.outerWidth(this.TEXTAREA)-2],afterRenderer:function(a,b,d,e,f){var g=this.getCellMeta(b,d).filteringCaseSensitive===!0,h=g?f.indexOf(this.query):f.toLowerCase().indexOf(c.query.toLowerCase());if(-1!=h){var i=f.substr(h,c.query.length);a.innerHTML=f.replace(i,""+i+"")}}}),d&&(d=!1),c.instance._registerTimeout(setTimeout(function(){c.queryChoices(c.TEXTAREA.value)},0))},c.prototype.close=function(){a.editors.HandsontableEditor.prototype.close.apply(this,arguments)},c.prototype.queryChoices=function(b){if(this.query=b,"function"==typeof this.cellProperties.source){var c=this;this.cellProperties.source(b,function(a){c.updateChoicesList(a)})}else if(a.helper.isArray(this.cellProperties.source)){var d;if(b&&this.cellProperties.filter!==!1){var e=this.cellProperties.filteringCaseSensitive===!0,f=b.toLowerCase();d=this.cellProperties.source.filter(function(a){return e?-1!=a.indexOf(b):-1!=a.toLowerCase().indexOf(f)})}else d=this.cellProperties.source;this.updateChoicesList(d)}else this.updateChoicesList([])},c.prototype.updateChoicesList=function(b){var d,e=a.Dom.getCaretPosition(this.TEXTAREA),f=a.Dom.getSelectionEndPosition(this.TEXTAREA),g=c.sortByRelevance(this.getValue(),b,this.cellProperties.filteringCaseSensitive);if(0!=this.cellProperties.filter){for(var h=[],i=0,j=g.length;j>i;i++)h.push(b[g[i]]);d=0,b=h}else d=g[0];this.choices=b,this.$htContainer.handsontable("loadData",a.helper.pivot([b])),this.$htContainer.handsontable("updateSettings",{height:this.getDropdownHeight()}),this.cellProperties.strict===!0&&this.highlightBestMatchingChoice(d),this.instance.listen(),this.TEXTAREA.focus(),a.Dom.setCaretPosition(this.TEXTAREA,e,e!=f?f:void 0)},c.prototype.finishEditing=function(b){b||this.instance.removeHook("beforeKeyDown",e),a.editors.HandsontableEditor.prototype.finishEditing.apply(this,arguments)},c.prototype.highlightBestMatchingChoice=function(a){"number"==typeof a?this.$htContainer.handsontable("selectCell",a,0):this.$htContainer.handsontable("deselectCell")},c.sortByRelevance=function(a,b,c){var d,e,f,g,h,i=[],j=a.length,k=[];if(0===j){for(g=0,h=b.length;h>g;g++)k.push(g);return k}for(g=0,h=b.length;h>g;g++)d=b[g],e=c?d.indexOf(a):d.toLowerCase().indexOf(a.toLowerCase()),-1!=e&&(f=d.length-e-j,i.push({baseIndex:g,index:e,charsLeft:f,value:d}));for(i.sort(function(a,b){return-1===b.index?-1:-1===a.index?1:a.indexb.charsLeft?1:0:void 0}),g=0,h=i.length;h>g;g++)k.push(i[g].baseIndex);return k},c.prototype.getDropdownHeight=function(){var a=this.$htContainer.handsontable("getInstance").getRowHeight(0)||23;return this.choices.length>=10?10*a:this.choices.length*a+8},a.editors.AutocompleteEditor=c,a.editors.registerEditor("autocomplete",c)}(c),function(b){var c=b.editors.TextEditor.prototype.extend();c.prototype.createElements=function(){b.editors.TextEditor.prototype.createElements.apply(this,arguments),this.TEXTAREA=document.createElement("input"),this.TEXTAREA.setAttribute("type","password"),this.TEXTAREA.className="handsontableInput",this.textareaStyle=this.TEXTAREA.style,this.textareaStyle.width=0,this.textareaStyle.height=0,this.$textarea=a(this.TEXTAREA),b.Dom.empty(this.TEXTAREA_PARENT),this.TEXTAREA_PARENT.appendChild(this.TEXTAREA)},b.editors.PasswordEditor=c,b.editors.registerEditor("password",c)}(c),function(a){var b=a.editors.BaseEditor.prototype.extend();b.prototype.init=function(){this.select=document.createElement("SELECT"),a.Dom.addClass(this.select,"htSelectEditor"),this.select.style.display="none",this.instance.rootElement[0].appendChild(this.select)},b.prototype.prepare=function(){a.editors.BaseEditor.prototype.prepare.apply(this,arguments);var b,c=this.cellProperties.selectOptions;b=this.prepareOptions("function"==typeof c?c(this.row,this.col,this.prop):c),a.Dom.empty(this.select);for(var d in b)if(b.hasOwnProperty(d)){var e=document.createElement("OPTION");e.value=d,a.Dom.fastInnerHTML(e,b[d]),this.select.appendChild(e)}},b.prototype.prepareOptions=function(b){var c={};if(a.helper.isArray(b))for(var d=0,e=b.length;e>d;d++)c[b[d]]=b[d];else"object"==typeof b&&(c=b);return c},b.prototype.getValue=function(){return this.select.value},b.prototype.setValue=function(a){this.select.value=a};var c=function(b){var c=this,d=c.getActiveEditor();switch(b.keyCode){case a.helper.keyCode.ARROW_UP:var e=d.select.find("option:selected").prev();1==e.length&&e.prop("selected",!0),b.stopImmediatePropagation(),b.preventDefault();break;case a.helper.keyCode.ARROW_DOWN:var f=d.select.find("option:selected").next();1==f.length&&f.prop("selected",!0),b.stopImmediatePropagation(),b.preventDefault()}};b.prototype.open=function(){var b=a.Dom.outerWidth(this.TD),d=a.Dom.outerHeight(this.TD),e=a.Dom.offset(this.instance.rootElement[0]),f=a.Dom.offset(this.TD); this.select.style.height=d+"px",this.select.style.minWidth=b+"px",this.select.style.top=f.top-e.top+"px",this.select.style.left=f.left-e.left+"px",this.select.style.margin="0px",this.select.style.display="",this.instance.addHook("beforeKeyDown",c)},b.prototype.close=function(){this.select.style.display="none",this.instance.removeHook("beforeKeyDown",c)},b.prototype.focus=function(){this.select.focus()},a.editors.SelectEditor=b,a.editors.registerEditor("select",b)}(c),function(a){var b=a.editors.AutocompleteEditor.prototype.extend();b.prototype.prepare=function(){a.editors.AutocompleteEditor.prototype.prepare.apply(this,arguments),this.cellProperties.filter=!1,this.cellProperties.strict=!0},a.editors.DropdownEditor=b,a.editors.registerEditor("dropdown",b)}(c),c.NumericValidator=function(a,b){null===a&&(a=""),b(/^-?\d*(\.|\,)?\d*$/.test(a))};var I=function(a,b){var c=a,d="string"==typeof c?c.toLowerCase():null;return function(a){for(var e=!1,f=0,g=a.length;g>f;f++){if(c===a[f]){e=!0;break}if(d===a[f].toLowerCase()){e=!0;break}}b(e)}};c.AutocompleteValidator=function(a,b){this.strict&&this.source?"function"==typeof this.source?this.source(a,I(a,b)):I(a,b)(this.source):b(!0)},c.AutocompleteCell={editor:c.editors.AutocompleteEditor,renderer:c.renderers.AutocompleteRenderer,validator:c.AutocompleteValidator},c.CheckboxCell={editor:c.editors.CheckboxEditor,renderer:c.renderers.CheckboxRenderer},c.TextCell={editor:c.editors.TextEditor,renderer:c.renderers.TextRenderer},c.NumericCell={editor:c.editors.TextEditor,renderer:c.renderers.NumericRenderer,validator:c.NumericValidator,dataType:"number"},c.DateCell={editor:c.editors.DateEditor,renderer:c.renderers.AutocompleteRenderer},c.HandsontableCell={editor:c.editors.HandsontableEditor,renderer:c.renderers.AutocompleteRenderer},c.PasswordCell={editor:c.editors.PasswordEditor,renderer:c.renderers.PasswordRenderer,copyable:!1},c.DropdownCell={editor:c.editors.DropdownEditor,renderer:c.renderers.AutocompleteRenderer,validator:c.AutocompleteValidator},c.cellTypes={text:c.TextCell,date:c.DateCell,numeric:c.NumericCell,checkbox:c.CheckboxCell,autocomplete:c.AutocompleteCell,handsontable:c.HandsontableCell,password:c.PasswordCell,dropdown:c.DropdownCell},c.cellLookup={validator:{numeric:c.NumericValidator,autocomplete:c.AutocompleteValidator}};var J=function(){var a,d={minHeight:200,maxHeight:300,minWidth:100,maxWidth:300},e=document.body,f=document.createTextNode(""),g=document.createElement("SPAN"),h=function(a,c,d){b.attachEvent?a.attachEvent("on"+c,d):a.addEventListener(c,d,!1)},i=function(a,c,d){b.detachEvent?a.detachEvent("on"+c,d):a.removeEventListener(c,d,!1)},j=function(){void 0!==f.textContent?f.textContent=a.value:f.data=a.value,g.style.fontSize=c.Dom.getComputedStyle(a).fontSize,g.style.fontFamily=c.Dom.getComputedStyle(a).fontFamily,e.appendChild(g);var b=g.clientWidth;e.removeChild(g),a.style.height=d.minHeight+"px",a.style.width=d.minWidth>b?d.minWidth+"px":b>d.maxWidth?d.maxWidth+"px":b+"px";var h=a.scrollHeight;d.minHeight>h?a.style.height=d.minHeight+"px":d.maxHeight1&&""===e[e.length-1]&&e.pop(),c=0,d=e.length;d>c;c+=1){for(e[c]=e[c].split(" "),f=0,g=e[c].length;g>f;f+=1)j[k]||(j[k]=[]),h&&0===f?(i=j[k].length-1,j[k][i]=j[k][i]+"\n"+e[c][0],h&&1&b(e[c][0])&&(h=!1,j[k][i]=j[k][i].substring(0,j[k][i].length-1).replace(/""/g,'"'))):f===g-1&&0===e[c][f].indexOf('"')?(j[k].push(e[c][f].substring(1).replace(/""/g,'"')),h=!0):(j[k].push(e[c][f].replace(/""/g,'"')),h=!1);h||(k+=1)}return j},stringify:function(a){var b,c,d,e,f,g="";for(b=0,c=a.length;c>b;b+=1){for(d=0,e=a[b].length;e>d;d+=1)d>0&&(g+=" "),f=a[b][d],g+="string"==typeof f?f.indexOf("\n")>-1?'"'+f.replace(/"/g,'""')+'"':f:null===f||void 0===f?"":f;c-1>b&&(g+="\n")}return g}}}(b);var K=function(){var a;return{getInstance:function(){return a?a.hasBeenDestroyed()&&a.init():a=new d,a.refCounter++,a}}}();d.prototype.init=function(){var a,b,c=this;this.copyCallbacks=[],this.cutCallbacks=[],this.pasteCallbacks=[],this.listenerElement=document.documentElement,b=document.body,document.getElementById("CopyPasteDiv")?(this.elDiv=document.getElementById("CopyPasteDiv"),this.elTextarea=this.elDiv.firstChild):(this.elDiv=document.createElement("DIV"),this.elDiv.id="CopyPasteDiv",a=this.elDiv.style,a.position="fixed",a.top="-10000px",a.left="-10000px",b.appendChild(this.elDiv),this.elTextarea=document.createElement("TEXTAREA"),this.elTextarea.className="copyPaste",a=this.elTextarea.style,a.width="10000px",a.height="10000px",a.overflow="hidden",this.elDiv.appendChild(this.elTextarea),"undefined"!=typeof a.opacity&&(a.opacity=0)),this.keydownListener=function(a){var b=!1;if(a.metaKey?b=!0:a.ctrlKey&&-1===navigator.userAgent.indexOf("Mac")&&(b=!0),b){if(document.activeElement!==c.elTextarea&&(""!=c.getSelectionText()||-1!=["INPUT","SELECT","TEXTAREA"].indexOf(document.activeElement.nodeName)))return;c.selectNodeText(c.elTextarea),setTimeout(function(){c.selectNodeText(c.elTextarea)},0)}!b||67!==a.keyCode&&86!==a.keyCode&&88!==a.keyCode||(88===a.keyCode?setTimeout(function(){c.triggerCut(a)},0):86===a.keyCode&&setTimeout(function(){c.triggerPaste(a)},0))},this._bindEvent(this.listenerElement,"keydown",this.keydownListener)},d.prototype.selectNodeText=function(a){a.select()},d.prototype.getSelectionText=function(){var a="";return b.getSelection?a=b.getSelection().toString():document.selection&&"Control"!=document.selection.type&&(a=document.selection.createRange().text),a},d.prototype.copyable=function(a){if("string"!=typeof a&&void 0===a.toString)throw new Error("copyable requires string parameter");this.elTextarea.value=a},d.prototype.onCut=function(a){this.cutCallbacks.push(a)},d.prototype.onPaste=function(a){this.pasteCallbacks.push(a)},d.prototype.removeCallback=function(a){var b,c;for(b=0,c=this.copyCallbacks.length;c>b;b++)if(this.copyCallbacks[b]===a)return this.copyCallbacks.splice(b,1),!0;for(b=0,c=this.cutCallbacks.length;c>b;b++)if(this.cutCallbacks[b]===a)return this.cutCallbacks.splice(b,1),!0;for(b=0,c=this.pasteCallbacks.length;c>b;b++)if(this.pasteCallbacks[b]===a)return this.pasteCallbacks.splice(b,1),!0;return!1},d.prototype.triggerCut=function(a){var b=this;b.cutCallbacks&&setTimeout(function(){for(var c=0,d=b.cutCallbacks.length;d>c;c++)b.cutCallbacks[c](a)},50)},d.prototype.triggerPaste=function(a,b){var c=this;c.pasteCallbacks&&setTimeout(function(){for(var d=(b||c.elTextarea.value).replace(/\n$/,""),e=0,f=c.pasteCallbacks.length;f>e;e++)c.pasteCallbacks[e](d,a)},50)},d.prototype.destroy=function(){this.hasBeenDestroyed()||0!=--this.refCounter||(this.elDiv&&this.elDiv.parentNode&&(this.elDiv.parentNode.removeChild(this.elDiv),this.elDiv=null,this.elTextarea=null),this._unbindEvent(this.listenerElement,"keydown",this.keydownListener))},d.prototype.hasBeenDestroyed=function(){return!this.refCounter},d.prototype._bindEvent=function(){return b.jQuery?function(b,c,d){a(b).on(c+".copypaste",d)}:function(a,b,c){a.addEventListener(b,c,!1)}}(),d.prototype._unbindEvent=function(){return b.jQuery?function(b,c,d){a(b).off(c+".copypaste",d)}:function(a,b,c){a.removeEventListener(b,c,!1)}}();var L;!function(a){function c(a){return-1===a.indexOf("/")&&-1===a.indexOf("~")?a:a.replace(/~/g,"~0").replace(/\//g,"~1")}function d(a,b){var e;for(var f in a)if(a.hasOwnProperty(f)){if(a[f]===b)return c(f)+"/";if("object"==typeof a[f]&&(e=d(a[f],b),""!=e))return c(f)+"/"+e}return""}function e(a,b){if(a===b)return"/";var c=d(a,b);if(""===c)throw new Error("Object not found in root");return"/"+c}function f(a){for(var b=0,c=s.length;c>b;b++)if(s[b].obj===a)return s[b]}function g(a,b){for(var c=0,d=a.observers.length;d>c;c++)if(a.observers[c].callback===b)return a.observers[c].observer}function h(a,b){for(var c=0,d=a.observers.length;d>c;c++)if(a.observers[c].observer===b)return void a.observers.splice(c,1)}function i(a,b){m(b),Object.observe?l(b,a):clearTimeout(b.next);var c=f(a);h(c,b)}function j(a,c){var d,h=[],i=a,j=f(a);if(j?d=g(j,c):(j=new t(a),s.push(j)),d)return d;if(Object.observe)d=function(b){l(d,a),k(d,a);for(var f=0,g=b.length;g>f;){if(("length"!==b[f].name||!w(b[f].object))&&"__Jasmine_been_here_before__"!==b[f].name){var j=b[f].type;switch(j){case"new":j="add";break;case"deleted":j="delete";break;case"updated":j="update"}r[j].call(b[f],h,e(i,b[f].object))}f++}h&&c&&c(h),d.patches=h,h=[]};else if(d={},j.value=JSON.parse(JSON.stringify(a)),c){d.callback=c,d.next=null;var n=this.intervals||[100,1e3,1e4,6e4],o=0,p=function(){m(d)},q=function(){clearTimeout(d.next),d.next=setTimeout(function(){p(),o=0,d.next=setTimeout(v,n[o++])},0)},v=function(){p(),o==n.length&&(o=n.length-1),d.next=setTimeout(v,n[o++])};"undefined"!=typeof b&&(b.addEventListener?(b.addEventListener("mousedown",q),b.addEventListener("mouseup",q),b.addEventListener("keydown",q)):(b.attachEvent("onmousedown",q),b.attachEvent("onmouseup",q),b.attachEvent("onkeydown",q))),d.next=setTimeout(v,n[o++])}return d.patches=h,d.object=a,j.observers.push(new u(c,d)),k(d,a)}function k(a,b){if(Object.observe){Object.observe(b,a);for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];d&&"object"==typeof d&&k(a,d)}}return a}function l(a,b){if(Object.observe){Object.unobserve(b,a);for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];d&&"object"==typeof d&&l(a,d)}}return a}function m(a){if(Object.observe)Object.deliverChangeRecords(a);else{for(var b,c=0,d=s.length;d>c;c++)if(s[c].obj===a.object){b=s[c];break}n(b.value,a.object,a.patches,"")}var e=a.patches;return e.length>0&&(a.patches=[],a.callback&&a.callback(e)),e}function n(a,b,d,e){for(var f=v(b),g=v(a),h=!1,i=!1,j=g.length-1;j>=0;j--){var k=g[j],l=a[k];if(b.hasOwnProperty(k)){var m=b[k];l instanceof Object?n(l,m,d,e+"/"+c(k)):l!=m&&(h=!0,d.push({op:"replace",path:e+"/"+c(k),value:m}),a[k]=m)}else d.push({op:"remove",path:e+"/"+c(k)}),delete a[k],i=!0}if(i||f.length!=g.length)for(var j=0;je;){c=b[e];for(var g=c.path.split("/"),h=a,i=1,j=g.length;;)if(w(h)){var k=parseInt(g[i],10);if(i++,i>=j){d=q[c.op].call(c,h,k,a);break}h=h[k]}else{var l=g[i];if(-1!=l.indexOf("~")&&(l=l.replace(/~1/g,"/").replace(/~0/g,"~")),i++,i>=j){d=p[c.op].call(c,h,l,a);break}h=h[l]}e++}return d}var p={add:function(a,b){return a[b]=this.value,!0},remove:function(a,b){return delete a[b],!0},replace:function(a,b){return a[b]=this.value,!0},move:function(a,b,c){var d={op:"_get",path:this.from};return o(c,[d]),o(c,[{op:"remove",path:this.from}]),o(c,[{op:"add",path:this.path,value:d.value}]),!0},copy:function(a,b,c){var d={op:"_get",path:this.from};return o(c,[d]),o(c,[{op:"add",path:this.path,value:d.value}]),!0},test:function(a,b){return JSON.stringify(a[b])===JSON.stringify(this.value)},_get:function(a,b){this.value=a[b]}},q={add:function(a,b){return a.splice(b,0,this.value),!0},remove:function(a,b){return a.splice(b,1),!0},replace:function(a,b){return a[b]=this.value,!0},move:p.move,copy:p.copy,test:p.test,_get:p._get},r={add:function(a,b){var d={op:"add",path:b+c(this.name),value:this.object[this.name]};a.push(d)},"delete":function(a,b){var d={op:"remove",path:b+c(this.name)};a.push(d)},update:function(a,b){var d={op:"replace",path:b+c(this.name),value:this.object[this.name]};a.push(d)}},s=[];a.intervals;var t=function(){function a(a){this.observers=[],this.obj=a}return a}(),u=function(){function a(a,b){this.callback=a,this.observer=b}return a}();a.unobserve=i,a.observe=j,a.generate=m;var v;v=Object.keys?Object.keys:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b};var w;w=Array.isArray?Array.isArray:function(a){return a.push&&"number"==typeof a.length},a.apply=o}(L||(L={})),"undefined"!=typeof exports&&(exports.apply=L.apply,exports.observe=L.observe,exports.unobserve=L.unobserve,exports.generate=L.generate),c.PluginHookClass=function(){function a(){this.hooks=b(),this.globalBucket={},this.legacy=d}var b=function(){return{beforeInitWalkontable:[],beforeInit:[],beforeRender:[],beforeSetRangeEnd:[],beforeDrawBorders:[],beforeChange:[],beforeChangeRender:[],beforeRemoveCol:[],beforeRemoveRow:[],beforeValidate:[],beforeGetCellMeta:[],beforeAutofill:[],beforeKeyDown:[],beforeOnCellMouseDown:[],afterInit:[],afterLoadData:[],afterUpdateSettings:[],afterRender:[],afterRenderer:[],afterChange:[],afterValidate:[],afterGetCellMeta:[],afterSetCellMeta:[],afterGetColHeader:[],afterGetRowHeader:[],afterDestroy:[],afterRemoveRow:[],afterCreateRow:[],afterRemoveCol:[],afterCreateCol:[],afterDeselect:[],afterSelection:[],afterSelectionByProp:[],afterSelectionEnd:[],afterSelectionEndByProp:[],afterOnCellMouseDown:[],afterOnCellMouseOver:[],afterOnCellCornerMouseDown:[],afterScrollVertically:[],afterScrollHorizontally:[],afterCellMetaReset:[],afterIsMultipleSelectionCheck:[],afterDocumentKeyDown:[],modifyColWidth:[],modifyRowHeight:[],modifyRow:[],modifyCol:[]}},d={onBeforeChange:"beforeChange",onChange:"afterChange",onCreateRow:"afterCreateRow",onCreateCol:"afterCreateCol",onSelection:"afterSelection",onCopyLimit:"afterCopyLimit",onSelectionEnd:"afterSelectionEnd",onSelectionByProp:"afterSelectionByProp",onSelectionEndByProp:"afterSelectionEndByProp"};return a.prototype.getBucket=function(a){return a?(a.pluginHookBucket||(a.pluginHookBucket={}),a.pluginHookBucket):this.globalBucket},a.prototype.add=function(a,b,e){if(c.helper.isArray(b))for(var f=0,g=b.length;g>f;f++)this.add(a,b[f]);else{a in d&&(a=d[a]);var h=this.getBucket(e);"undefined"==typeof h[a]&&(h[a]=[]),b.skip=!1,-1==h[a].indexOf(b)&&h[a].push(b)}return this},a.prototype.once=function(a,b,d){if(c.helper.isArray(b))for(var e=0,f=b.length;f>e;e++)b[e].runOnce=!0,this.add(a,b[e],d);else b.runOnce=!0,this.add(a,b,d)},a.prototype.remove=function(a,b,c){var e=!1;a in d&&(a=d[a]);var f=this.getBucket(c);if("undefined"!=typeof f[a])for(var g=0,h=f[a].length;h>g;g++)if(f[a][g]==b){f[a][g].skip=!0,e=!0;break}return e},a.prototype.run=function(a,b,c,e,f,g,h,i){b in d&&(b=d[b]),this._runBucket(this.globalBucket,a,b,c,e,f,g,h,i),this._runBucket(this.getBucket(a),a,b,c,e,f,g,h,i)},a.prototype._runBucket=function(a,b,c,d,e,f,g,h,i){var j=a[c];if(j)for(var k=0,l=j.length;l>k;k++)j[k].skip||(j[k].call(b,d,e,f,g,h,i),j[k].runOnce&&this.remove(c,j[k],a===this.globalBucket?null:b))},a.prototype.destroy=function(a){var b=this.getBucket(a);for(var c in b)if(b.hasOwnProperty(c))for(var d=0,e=b[c].length;e>d;d++)this.remove(c,b[c],a)},a.prototype.execute=function(a,b,c,e,f,g,h,i){return b in d&&(b=d[b]),c=this._executeBucket(this.globalBucket,a,b,c,e,f,g,h,i),c=this._executeBucket(this.getBucket(a),a,b,c,e,f,g,h,i)},a.prototype._executeBucket=function(a,b,c,d,e,f,g,h,i){var j,k=a[c];if(k)for(var l=0,m=k.length;m>l;l++)if(!k[l].skip&&(j=k[l].call(b,d,e,f,g,h,i),void 0!==j&&(d=j),k[l].runOnce&&this.remove(c,k[l],a===this.globalBucket?null:b),j===!1))return!1;return d},a.prototype.register=function(a){this.isRegistered(a)||(this.hooks[a]=[])},a.prototype.deregister=function(a){delete this.hooks[a]},a.prototype.isRegistered=function(a){return"undefined"!=typeof this.hooks[a]},a.prototype.getRegistered=function(){return Object.keys(this.hooks)},a}(),c.hooks=new c.PluginHookClass,c.PluginHooks=c.hooks,function(a){function b(){function b(a){var b=document,c=this;c.table=b.createElement("table"),c.theadTh=b.createElement("th"),c.table.appendChild(b.createElement("thead")).appendChild(b.createElement("tr")).appendChild(c.theadTh),c.tableStyle=c.table.style,c.tableStyle.tableLayout="auto",c.tableStyle.width="auto",c.tbody=b.createElement("tbody"),c.table.appendChild(c.tbody),c.container=b.createElement("div"),c.container.className=a.rootElement[0].className+" hidden",c.containerStyle=c.container.style,c.container.appendChild(c.table)}var d=this,e=5;this.beforeInit=function(){var a=this;a.autoColumnWidths=[],a.getSettings().autoColumnSize!==!1?a.autoColumnSizeTmp||(a.autoColumnSizeTmp={table:null,tableStyle:null,theadTh:null,tbody:null,container:null,containerStyle:null,determineBeforeNextRender:!0},a.addHook("beforeRender",c.determineIfChanged),a.addHook("modifyColWidth",c.modifyColWidth),a.addHook("afterDestroy",c.afterDestroy),a.determineColumnWidth=d.determineColumnWidth):a.autoColumnSizeTmp&&(a.removeHook("beforeRender",c.determineIfChanged),a.removeHook("modifyColWidth",c.modifyColWidth),a.removeHook("afterDestroy",c.afterDestroy),delete a.determineColumnWidth,d.afterDestroy.call(a))},this.determineIfChanged=function(a){a&&c.determineColumnsWidth.apply(this,arguments)},this.determineColumnWidth=function(c){var d=this,f=d.autoColumnSizeTmp;f.container||b.call(f,d),f.container.className=d.rootElement[0].className+" htAutoColumnSize",f.table.className=d.$table[0].className;for(var g=d.countRows(),h={},i=0,j=0;g>j;j++){var k=a.helper.stringify(d.getDataAtCell(j,c)),l=k.length;l>i&&(i=l),h[l]||(h[l]={needed:e,strings:[]}),h[l].needed&&(h[l].strings.push({value:k,row:j}),h[l].needed--)}var m=d.getSettings();m.colHeaders&&d.view.appendColHeader(c,f.theadTh),a.Dom.empty(f.tbody);for(var n in h)if(h.hasOwnProperty(n))for(var o=0,p=h[n].strings.length;p>o;o++){var q=h[n].strings[o].row,r=d.getCellMeta(q,c);r.col=c,r.row=q;var s=d.getCellRenderer(r),t=document.createElement("tr"),u=document.createElement("td");s(d,u,q,c,d.colToProp(c),h[n].strings[o].value,r),j++,t.appendChild(u),f.tbody.appendChild(t)}var v=d.rootElement[0].parentNode;v.appendChild(f.container);var w=a.Dom.outerWidth(f.table);return v.removeChild(f.container),w},this.determineColumnsWidth=function(){var a=this,b=this.getSettings();if(b.autoColumnSize||!b.colWidths)for(var c=this.countCols(),e=0;c>e;e++)a._getColWidthFromSettings(e)||(this.autoColumnWidths[e]=d.determineColumnWidth.call(a,e))},this.modifyColWidth=function(a,b){return this.autoColumnWidths[b]&&this.autoColumnWidths[b]>a?this.autoColumnWidths[b]:a},this.afterDestroy=function(){var a=this;a.autoColumnSizeTmp&&a.autoColumnSizeTmp.container&&a.autoColumnSizeTmp.container.parentNode&&a.autoColumnSizeTmp.container.parentNode.removeChild(a.autoColumnSizeTmp.container),a.autoColumnSizeTmp=null}}var c=new b;a.hooks.add("beforeInit",c.beforeInit),a.hooks.add("afterUpdateSettings",c.beforeInit)}(c);var M=new e;c.hooks.add("afterInit",function(){M.init.call(this,"afterInit")}),c.hooks.add("afterUpdateSettings",function(){M.init.call(this,"afterUpdateSettings")}),c.hooks.add("modifyRow",M.translateRow),c.hooks.add("afterGetColHeader",M.getColHeader),c.hooks.register("beforeColumnSort"),c.hooks.register("afterColumnSort"),function(b){function c(a,b){return-1!=a.indexOf(b)?a:(a=a.replace("htTop","").replace("htMiddle","").replace("htBottom","").replace(" ",""),a+=" "+b)}function d(a,b){return-1!=a.indexOf(b)?a:(a=a.replace("htLeft","").replace("htCenter","").replace("htRight","").replace("htJustify","").replace(" ",""),a+=" "+b)}function e(a,b,e,f){var g=this.getCellMeta(a,b),h=f;g.className&&(h="vertical"===e?c(g.className,f):d(g.className,f)),this.setCellMeta(a,b,"className",h),this.render()}function f(a,b,c){if(a.from.row==a.to.row&&a.from.col==a.to.col)e.call(this,a.from.row,a.from.col,b,c);else for(var d=a.from.row;d<=a.to.row;d++)for(var f=a.from.col;f<=a.to.col;f++)e.call(this,d,f,b,c)}function g(a){this.instance=a;var c=this;c.menus=[],c.triggerRows=[],this.enabled=!0,this.instance.addHook("afterDestroy",function(){c.destroy()}),this.defaultOptions={items:[{key:"row_above",name:"Insert row above",callback:function(a,b){this.alter("insert_row",b.start.row)},disabled:function(){var a=this.getSelected(),b=[0,a[1],this.view.wt.wtTable.getRowStrategy().cellCount-1,a[1]],c=b.join(",")==a.join(",");return a[0]<0||this.countRows()>=this.getSettings().maxRows||c}},{key:"row_below",name:"Insert row below",callback:function(a,b){this.alter("insert_row",b.end.row+1)},disabled:function(){var a=this.getSelected(),b=[0,a[1],this.view.wt.wtTable.getRowStrategy().cellCount-1,a[1]],c=b.join(",")==a.join(",");return this.getSelected()[0]<0||this.countRows()>=this.getSettings().maxRows||c}},g.SEPARATOR,{key:"col_left",name:"Insert column on the left",callback:function(a,b){this.alter("insert_col",b.start.col)},disabled:function(){var a=this.getSelected(),b=[a[0],0,a[0],this.view.wt.wtTable.getColumnStrategy().cellCount-1],c=b.join(",")==a.join(",");return this.getSelected()[1]<0||this.countCols()>=this.getSettings().maxCols||c}},{key:"col_right",name:"Insert column on the right",callback:function(a,b){this.alter("insert_col",b.end.col+1)},disabled:function(){var a=this.getSelected(),b=[a[0],0,a[0],this.view.wt.wtTable.getColumnStrategy().cellCount-1],c=b.join(",")==a.join(",");return a[1]<0||this.countCols()>=this.getSettings().maxCols||c}},g.SEPARATOR,{key:"remove_row",name:"Remove row",callback:function(a,b){var c=b.end.row-b.start.row+1;this.alter("remove_row",b.start.row,c)},disabled:function(){var a=this.getSelected(),b=[0,a[1],this.view.wt.wtTable.getRowStrategy().cellCount-1,a[1]],c=b.join(",")==a.join(",");return a[0]<0||c}},{key:"remove_col",name:"Remove column",callback:function(a,b){var c=b.end.col-b.start.col+1;this.alter("remove_col",b.start.col,c)},disabled:function(){var a=this.getSelected(),b=[a[0],0,a[0],this.view.wt.wtTable.getColumnStrategy().cellCount-1],c=b.join(",")==a.join(",");return a[1]<0||c}},g.SEPARATOR,{key:"undo",name:"Undo",callback:function(){this.undo()},disabled:function(){return this.undoRedo&&!this.undoRedo.isUndoAvailable()}},{key:"redo",name:"Redo",callback:function(){this.redo()},disabled:function(){return this.undoRedo&&!this.undoRedo.isRedoAvailable()}},g.SEPARATOR,{key:"make_read_only",name:function(){var a="Read only",b=c.checkSelectionReadOnlyConsistency(this);return b&&(a=c.markSelected(a)),a},callback:function(){var a=c.checkSelectionReadOnlyConsistency(this),b=this;this.getSelectedRange().forAll(function(c,d){b.getCellMeta(c,d).readOnly=a?!1:!0}),this.render()}},g.SEPARATOR,{key:"alignment",name:"Alignment",submenu:{items:[{name:function(){var a="Left",b=c.checkSelectionAlignment(this,"htLeft");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"horizontal","htLeft")},disabled:!1},{name:function(){var a="Center",b=c.checkSelectionAlignment(this,"htCenter");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"horizontal","htCenter")},disabled:!1},{name:function(){var a="Right",b=c.checkSelectionAlignment(this,"htRight");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"horizontal","htRight")},disabled:!1},{name:function(){var a="Justify",b=c.checkSelectionAlignment(this,"htJustify");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"horizontal","htJustify")},disabled:!1},g.SEPARATOR,{name:function(){var a="Top",b=c.checkSelectionAlignment(this,"htTop");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"vertical","htTop")},disabled:!1},{name:function(){var a="Middle",b=c.checkSelectionAlignment(this,"htMiddle");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"vertical","htMiddle")},disabled:!1},{name:function(){var a="Bottom",b=c.checkSelectionAlignment(this,"htBottom");return b&&(a=c.markSelected(a)),a},callback:function(){f.call(this,this.getSelectedRange(),"vertical","htBottom")},disabled:!1}]}}]},c.options={},b.helper.extend(c.options,this.options),this.bindMouseEvents(),this.markSelected=function(a){return""+a},this.checkSelectionAlignment=function(a,b){var c=!1;return a.getSelectedRange().forAll(function(d,e){var f=a.getCellMeta(d,e).className;return f&&-1!=f.indexOf(b)?(c=!0,!1):void 0}),c},this.checkSelectionReadOnlyConsistency=function(a){var b=!1;return a.getSelectedRange().forAll(function(c,d){return a.getCellMeta(c,d).readOnly?(b=!0,!1):void 0}),b},b.hooks.run(a,"afterContextMenuDefaultOptions",this.defaultOptions)}function h(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c].key===b)return a[c]}function i(){if(!this.rootElement[0].className.indexOf("htContextMenu")){for(var a=0,b=0,c=this.getSettings().data.length,d=0;c>d;d++)this.getSettings().data[d].name==g.SEPARATOR.name?a+=2:b+=26;this.view.wt.wtScrollbars.vertical.fixedContainer.style.height=b+a+"px"}}function j(){var a=this,c=a.getSettings().contextMenu,d=b.helper.isObject(c)?c:{};c?(a.contextMenu||(a.contextMenu=new g(a,d)),a.contextMenu.enable()):a.contextMenu&&(a.contextMenu.destroy(),delete a.contextMenu)}g.prototype.createMenu=function(c,d){c&&(c=c.replace(/ /g,"_"),c="htContextSubMenu_"+c);var e;return e=c?a("body > .htContextMenu."+c)[0]:a("body > .htContextMenu")[0],e||(e=document.createElement("DIV"),b.Dom.addClass(e,"htContextMenu"),c&&b.Dom.addClass(e,c),document.getElementsByTagName("body")[0].appendChild(e)),this.menus.indexOf(e)<0&&(this.menus.push(e),d=d||0,this.triggerRows.push(d)),e},g.prototype.bindMouseEvents=function(){function c(c){var d=this.instance.getSettings();this.closeAll(),c.preventDefault(),c.stopPropagation();var e=this.instance.getSettings().rowHeaders,f=this.instance.getSettings().colHeaders;if(e||f||"TD"==c.target.nodeName||b.Dom.hasClass(c.target,"current")&&b.Dom.hasClass(c.target,"wtBorder")){var h=this.createMenu(),i=this.getItems(d.contextMenu);this.show(h,i),this.setMenuPosition(c,h),a(document).on("mousedown.htContextMenu",b.helper.proxy(g.prototype.closeAll,this))}}this.instance.rootElement.on("contextmenu.htContextMenu",b.helper.proxy(c,this))},g.prototype.bindTableEvents=function(){this._afterScrollCallback=function(){},this.instance.addHook("afterScrollVertically",this._afterScrollCallback),this.instance.addHook("afterScrollHorizontally",this._afterScrollCallback)},g.prototype.unbindTableEvents=function(){this._afterScrollCallback&&(this.instance.removeHook("afterScrollVertically",this._afterScrollCallback),this.instance.removeHook("afterScrollHorizontally",this._afterScrollCallback),this._afterScrollCallback=null)},g.prototype.performAction=function(b,c){var d=this,e=a(c).handsontable("getInstance"),f=e.getSelected()[0],h=e.getData()[f];if(h.disabled!==!0&&("function"!=typeof h.disabled||h.disabled.call(this.instance)!==!0)&&!h.hasOwnProperty("submenu")){if("function"!=typeof h.callback)return;var i=this.instance.getSelectedRange(),j=g.utils.normalizeSelection(i);h.callback.call(this.instance,h.key,j,b),d.closeAll()}},g.prototype.unbindMouseEvents=function(){this.instance.rootElement.off("contextmenu.htContextMenu"),a(document).off("mousedown.htContextMenu")},g.prototype.show=function(c,d){c.removeAttribute("style"),c.style.display="block";var e=this;a(c).off("mousedown.htContextMenu").on("mousedown.htContextMenu",function(a){e.performAction(a,c)}),a(c).handsontable({data:d,colHeaders:!1,colWidths:[200],readOnly:!0,copyPaste:!1,columns:[{data:"name",renderer:b.helper.proxy(this.renderer,this)}],beforeKeyDown:function(a){e.onBeforeKeyDown(a,c)},afterOnCellMouseOver:function(a,b,d){e.onCellMouseOver(a,b,d,c)},renderAllRows:!0}),this.bindTableEvents(),a(c).handsontable("listen")},g.prototype.close=function(b){this.hide(b),a(document).off("mousedown.htContextMenu"),this.unbindTableEvents(),this.instance.listen()},g.prototype.closeAll=function(){for(;this.menus.length>0;){var a=this.menus.pop();a&&this.close(a)}this.triggerRows=[]},g.prototype.closeLastOpenedSubMenu=function(){var a=this.menus.pop();a&&this.hide(a)},g.prototype.hide=function(b){b.style.display="none",a(b).handsontable("destroy")},g.prototype.renderer=function(c,d,e,f,h,i){function j(a){return a.hasOwnProperty("submenu")}function k(a){return new RegExp(g.SEPARATOR.name,"i").test(a.name)}function l(a){return a.disabled===!0||"function"==typeof a.disabled&&a.disabled.call(m.instance)===!0}var m=this,n=c.getData()[e],o=document.createElement("DIV");"function"==typeof i&&(i=i.call(this.instance)),b.Dom.empty(d),d.appendChild(o),k(n)?b.Dom.addClass(d,"htSeparator"):b.Dom.fastInnerHTML(o,i),l(n)?(b.Dom.addClass(d,"htDisabled"),a(o).on("mouseenter",function(){c.deselectCell()})):j(n)?(b.Dom.addClass(d,"htSubmenu"),a(o).on("mouseenter",function(){c.selectCell(e,f)})):(b.Dom.removeClass(d,"htSubmenu"),b.Dom.removeClass(d,"htDisabled"),a(o).on("mouseenter",function(){c.selectCell(e,f)}))},g.prototype.onCellMouseOver=function(b,c,d,e){var f=a(e).handsontable("getInstance"),g=this.menus.length;if(g>0){var h=this.menus[g-1];h.id!=e.id&&this.closeLastOpenedSubMenu()}else this.closeLastOpenedSubMenu();if(-1!=d.className.indexOf("htSubmenu")){var i=f.getData()[c.row],j=this.getItems(i.submenu),k=this.createMenu(i.name,c.row),l=d.getBoundingClientRect();this.show(k,j),this.setSubMenuPosition(l,k)}},g.prototype.onBeforeKeyDown=function(c,d){function e(a){var b=a.getCell(0,0);g.utils.isSeparator(b)||g.utils.isDisabled(b)?h(0,0,a):a.selectCell(0,0)}function f(a){var b=a.countRows()-1,c=a.getCell(b,0);g.utils.isSeparator(c)||g.utils.isDisabled(c)?i(b,0,a):a.selectCell(b,0)}function h(a,b,c){var d=a+1,e=d=0?c.getCell(d,b):null;e&&(g.utils.isSeparator(e)||g.utils.isDisabled(e)?i(d,b,c):c.selectCell(d,b))}function j(b,c,d,e){var f=b.getData()[e],g=c.getItems(f.submenu),h=c.createMenu(f.name,e),i=d.getBoundingClientRect();c.show(h,g),c.setSubMenuPosition(i,h);var j=a(h).handsontable("getInstance");j.selectCell(0,0)}var k=this,l=a(d).handsontable("getInstance"),m=l.getSelected();switch(c.keyCode){case b.helper.keyCode.ESCAPE:k.closeAll(),c.preventDefault(),c.stopImmediatePropagation();break;case b.helper.keyCode.ENTER:m&&k.performAction(c,d);break;case b.helper.keyCode.ARROW_DOWN:m?h(m[0],m[1],l,k):e(l,k),c.preventDefault(),c.stopImmediatePropagation();break;case b.helper.keyCode.ARROW_UP:m?i(m[0],m[1],l,k):f(l,k),c.preventDefault(),c.stopImmediatePropagation();break;case b.helper.keyCode.ARROW_RIGHT:if(m){var n=m[0],o=l.getCell(m[0],0);g.utils.hasSubMenu(o)&&j(l,k,o,n)}c.preventDefault(),c.stopImmediatePropagation();break;case b.helper.keyCode.ARROW_LEFT:if(m){if(-1!=d.className.indexOf("htContextSubMenu_")){k.closeLastOpenedSubMenu();var p=k.menus.length;if(p>0){d=k.menus[p-1];var q=k.triggerRows.pop();l=a(d).handsontable("getInstance"),l.selectCell(q,0)}}c.preventDefault(),c.stopImmediatePropagation()}}},g.prototype.getItems=function(a){function c(a){"string"==typeof a?this.name=a:b.helper.extend(this,a)}var d,e;c.prototype=a,a&&a.items&&(a=a.items),a===!0&&(a=this.defaultOptions.items),d=[];for(var f in a)a.hasOwnProperty(f)&&(e="string"==typeof a[f]?h(this.defaultOptions.items,a[f]):h(this.defaultOptions.items,f),e||(e=a[f]),e=new c(e),"object"==typeof a[f]&&b.helper.extend(e,a[f]),e.key||(e.key=f),d.push(e)); return d},g.prototype.setSubMenuPosition=function(a,c){var d=b.Dom.getWindowScrollTop(),e=b.Dom.getWindowScrollLeft(),f={top:d+a.top,topRelative:a.top,left:a.left,leftRelative:a.left-e,scrollTop:d,scrollLeft:e,cellHeight:a.height,cellWidth:a.width};this.menuFitsBelowCursor(f,c)?this.positionMenuBelowCursor(f,c,!0):this.menuFitsAboveCursor(f,c)?this.positionMenuAboveCursor(f,c,!0):this.positionMenuBelowCursor(f,c,!0),this.menuFitsOnRightOfCursor(f,c)?this.positionMenuOnRightOfCursor(f,c,!0):this.positionMenuOnLeftOfCursor(f,c,!0)},g.prototype.setMenuPosition=function(a,c){var d=a.pageY,e=a.pageX,f=b.Dom.getWindowScrollTop(),g=b.Dom.getWindowScrollLeft(),h={top:d,topRelative:d-f,left:e,leftRelative:e-g,scrollTop:f,scrollLeft:g,cellHeight:a.target.clientHeight,cellWidth:a.target.clientWidth};this.menuFitsBelowCursor(h,c)?this.positionMenuBelowCursor(h,c):this.menuFitsAboveCursor(h,c)?this.positionMenuAboveCursor(h,c):this.positionMenuBelowCursor(h,c),this.menuFitsOnRightOfCursor(h,c)?this.positionMenuOnRightOfCursor(h,c):this.positionMenuOnLeftOfCursor(h,c)},g.prototype.menuFitsAboveCursor=function(a,b){return a.topRelative>=b.offsetHeight},g.prototype.menuFitsBelowCursor=function(a,b){return a.topRelative+b.offsetHeight<=a.scrollTop+document.body.clientHeight},g.prototype.menuFitsOnRightOfCursor=function(a,b){return a.leftRelative+b.offsetWidth<=a.scrollLeft+document.body.clientWidth},g.prototype.positionMenuBelowCursor=function(a,b){b.style.top=a.top+"px"},g.prototype.positionMenuAboveCursor=function(a,b,c){b.style.top=c?a.top+a.cellHeight-b.offsetHeight+"px":a.top-b.offsetHeight+"px"},g.prototype.positionMenuOnRightOfCursor=function(a,b,c){b.style.left=c?1+a.left+a.cellWidth+"px":1+a.left+"px"},g.prototype.positionMenuOnLeftOfCursor=function(a,b,c){b.style.left=c?a.left-b.offsetWidth+"px":a.left-b.offsetWidth+"px"},g.utils={},g.utils.normalizeSelection=function(a){return{start:a.getTopLeftCorner(),end:a.getBottomRightCorner()}},g.utils.isSeparator=function(a){return b.Dom.hasClass(a,"htSeparator")},g.utils.hasSubMenu=function(a){return b.Dom.hasClass(a,"htSubmenu")},g.utils.isDisabled=function(a){return b.Dom.hasClass(a,"htDisabled")},g.prototype.enable=function(){this.enabled||(this.enabled=!0,this.bindMouseEvents())},g.prototype.disable=function(){this.enabled&&(this.enabled=!1,this.closeAll(),this.unbindMouseEvents(),this.unbindTableEvents())},g.prototype.destroy=function(){for(this.closeAll();this.menus.length>0;){var a=this.menus.pop();this.triggerRows.pop(),a&&(this.close(a),this.isMenuEnabledByOtherHotInstance()||this.removeMenu(a))}this.unbindMouseEvents(),this.unbindTableEvents()},g.prototype.isMenuEnabledByOtherHotInstance=function(){for(var b=a(".handsontable"),c=!1,d=0,e=b.length;e>d;d++){var f=a(b[d]).handsontable("getInstance");if(f&&f.getSettings().contextMenu){c=!0;break}}return c},g.prototype.removeMenu=function(a){a.parentNode&&this.menu.parentNode.removeChild(a)},g.SEPARATOR={name:"---------"},b.hooks.add("afterInit",j),b.hooks.add("afterUpdateSettings",j),b.hooks.add("afterInit",i),b.PluginHooks.register("afterContextMenuDefaultOptions"),b.ContextMenu=g}(c);var N=function(){var a=this,b=a.getSettings().comments;b&&(c.Comments=new f(a),c.Comments.init())},O=function(a,b,d,e,f,g){g.comment&&c.Dom.addClass(a,g.commentedCellClassName)},P=function(a){var b=this;b.getSettings().comments&&(a.items.push(c.ContextMenu.SEPARATOR),a.items.push({key:"commentsAddEdit",name:function(){var a=c.Comments.checkSelectionCommentsConsistency();return a?"Edit Comment":"Add Comment"},callback:function(){c.Comments.showComment(this.getSelectedRange())},disabled:function(){return!1}}),a.items.push({key:"commentsRemove",name:function(){return"Delete Comment"},callback:function(a,b){c.Comments.removeComment(b.start.row,b.start.col)},disabled:function(){var a=c.Comments.checkSelectionCommentsConsistency();return!a}}))};c.hooks.add("beforeInit",N),c.hooks.add("afterContextMenuDefaultOptions",P),c.hooks.add("afterRenderer",O),function(c){function d(){function d(a){n=this,o=a;var b=this.view.wt.wtTable.getCoords(a).col;if(b>=0){m=b;var c=o.getBoundingClientRect();l=c.left,p.style.top=c.top+"px",p.style.left=l+"px",n.rootElement[0].appendChild(p)}}function e(a){var b=a.getBoundingClientRect();p.style.left=b.left+"px"}function f(){var a=this;c.Dom.addClass(p,"active"),c.Dom.addClass(q,"active");var b=o.getBoundingClientRect();q.style.width=b.width+"px",q.style.height=a.view.maximumVisibleElementHeight(0)+"px",q.style.top=p.style.top,q.style.left=l+"px",a.rootElement[0].appendChild(q)}function g(a){q.style.left=l+a+"px"}function h(){c.Dom.removeClass(p,"active"),c.Dom.removeClass(q,"active")}var i,j,k,l,m,n,o,p=document.createElement("DIV"),q=document.createElement("DIV"),r=a(b);p.className="manualColumnMover",q.className="manualColumnMoverGuide";var s=function(){var a=this;c.hooks.run(a,"persistentStateSave","manualColumnPositions",a.manualColumnPositions)},t=function(){var a=this,b={};return c.hooks.run(a,"persistentStateLoad","manualColumnPositions",b),b.value},u=function(){var a,b=this;b.rootElement.on("mouseenter.manualColumnMove."+b.guid,"table thead tr > th",function(c){a?(j=b.view.wt.wtTable.getCoords(c.currentTarget).col,e(c.currentTarget)):d.call(b,c.currentTarget)}),b.rootElement.on("mousedown.manualColumnMove."+b.guid,".manualColumnMover",function(c){k=c.pageX,f.call(b),a=b,i=m,j=m}),r.on("mousemove.manualColumnMove."+b.guid,function(b){a&&g(b.pageX-k)}),r.on("mouseup.manualColumnMove."+b.guid,function(){a&&(h(),a=!1,j>i&&j--,w(b.manualColumnPositions,b.countCols()),b.manualColumnPositions.splice(j,0,b.manualColumnPositions.splice(i,1)[0]),b.forceFullRender=!0,b.view.render(),s.call(b),c.hooks.run(b,"afterColumnMove",i,j),d.call(b,o))}),b.addHook("afterDestroy",v)},v=function(){var a=this;a.rootElement.off("mouseenter.manualColumnMove."+a.guid,"table thead tr > th"),a.rootElement.off("mousedown.manualColumnMove."+a.guid,".manualColumnMover"),r.off("mousemove.manualColumnMove."+a.guid),r.off("mouseup.manualColumnMove."+a.guid)},w=function(a,b){if(a.lengthc;c++)a[c]=c};this.beforeInit=function(){this.manualColumnPositions=[]},this.init=function(a){var b=this,c=!!this.getSettings().manualColumnMove;if(c){var d=this.getSettings().manualColumnMove,e=t.call(b);this.manualColumnPositions="undefined"!=typeof e?e:d instanceof Array?d:[],"afterInit"==a&&(u.call(this),this.manualColumnPositions.length>0&&(this.forceFullRender=!0,this.render()))}else v.call(this),this.manualColumnPositions=[]},this.modifyCol=function(a){return this.getSettings().manualColumnMove?("undefined"==typeof this.manualColumnPositions[a]&&w(this.manualColumnPositions,a+1),this.manualColumnPositions[a]):a}}var e=new d;c.hooks.add("beforeInit",e.beforeInit),c.hooks.add("afterInit",function(){e.init.call(this,"afterInit")}),c.hooks.add("afterUpdateSettings",function(){e.init.call(this,"afterUpdateSettings")}),c.hooks.add("modifyCol",e.modifyCol),c.hooks.register("afterColumnMove")}(c),function(c){function d(){function d(a){l=this,i=a;var b=this.view.wt.wtTable.getCoords(a).col;if(b>=0){j=b;var c=i.getBoundingClientRect();p=c.left-6,o=parseInt(c.width,10),q.style.top=c.top+"px",q.style.left=p+o+"px",l.rootElement[0].appendChild(q)}}function e(){q.style.left=p+k+"px"}function f(){var a=this;c.Dom.addClass(q,"active"),c.Dom.addClass(r,"active"),r.style.top=q.style.top,r.style.left=q.style.left,r.style.height=a.view.maximumVisibleElementHeight(0)+"px",a.rootElement[0].appendChild(r)}function g(){r.style.left=q.style.left}function h(){c.Dom.removeClass(q,"active"),c.Dom.removeClass(r,"active")}var i,j,k,l,m,n,o,p,q=document.createElement("DIV"),r=document.createElement("DIV"),s=a(b);q.className="manualColumnResizer",r.className="manualColumnResizerGuide";var t=function(){var a=this;c.hooks.run(a,"persistentStateSave","manualColumnWidths",a.manualColumnWidths)},u=function(){var a=this,b={};return c.hooks.run(a,"persistentStateLoad","manualColumnWidths",b),b.value},v=function(){var a,b=this,l=0,p=null;b.rootElement.on("mouseenter.manualColumnResize."+b.guid,"table thead tr > th",function(c){a||d.call(b,c.currentTarget)}),b.rootElement.on("mousedown.manualColumnResize."+b.guid,".manualColumnResizer",function(d){f.call(b),a=b,null==p&&(p=setTimeout(function(){l>=2&&(m=b.determineColumnWidth.call(b,j),x(j,m),b.forceFullRender=!0,b.view.render(),c.hooks.run(b,"afterColumnResize",j,m)),l=0,p=null},500),b._registerTimeout(p)),l++,n=d.pageX,m=o}),s.on("mousemove.manualColumnResize."+b.guid,function(b){a&&(k=o+(b.pageX-n),m=x(j,k),e(),g())}),s.on("mouseup.manualColumnResize."+b.guid,function(){a&&(h(),a=!1,m!=o&&(b.forceFullRender=!0,b.view.render(),t.call(b),c.hooks.run(b,"afterColumnResize",j,m)),d.call(b,i))}),b.addHook("afterDestroy",w)},w=function(){var a=this;a.rootElement.off("mouseenter.manualColumnResize."+a.guid,"table thead tr > th"),a.rootElement.off("mousedown.manualColumnResize."+a.guid,".manualColumnResizer"),s.off("mousemove.manualColumnResize."+a.guid),s.off("mouseup.manualColumnResize."+a.guid)};this.beforeInit=function(){this.manualColumnWidths=[]},this.init=function(a){var b=this,c=!!this.getSettings().manualColumnResize;if(c){var d=this.getSettings().manualColumnResize,e=u.call(b);this.manualColumnWidths="undefined"!=typeof e?e:d instanceof Array?d:[],"afterInit"==a&&(v.call(this),this.manualColumnWidths.length>0&&(this.forceFullRender=!0,this.render()))}else w.call(this),this.manualColumnWidths=[]};var x=function(a,b){return b=Math.max(b,20),a=c.hooks.execute(l,"modifyCol",a),l.manualColumnWidths[a]=b,b};this.modifyColWidth=function(a,b){return b=this.runHooksAndReturn("modifyCol",b),this.getSettings().manualColumnResize&&this.manualColumnWidths[b]?this.manualColumnWidths[b]:a}}var e=new d;c.hooks.add("beforeInit",e.beforeInit),c.hooks.add("afterInit",function(){e.init.call(this,"afterInit")}),c.hooks.add("afterUpdateSettings",function(){e.init.call(this,"afterUpdateSettings")}),c.hooks.add("modifyColWidth",e.modifyColWidth),c.hooks.register("afterColumnResize")}(c),function(c){function d(){function d(a){l=this,i=a;var b=this.view.wt.wtTable.getCoords(a).row;if(b>=0){j=b;var c=i.getBoundingClientRect();p=c.top-6,o=parseInt(c.height,10),q.style.left=c.left+"px",q.style.top=p+o+"px",l.rootElement[0].appendChild(q)}}function e(){q.style.top=p+k+"px"}function f(){var a=this;c.Dom.addClass(q,"active"),c.Dom.addClass(r,"active"),r.style.top=q.style.top,r.style.left=q.style.left,r.style.width=a.view.maximumVisibleElementWidth(0)+"px",a.rootElement[0].appendChild(r)}function g(){r.style.top=q.style.top}function h(){c.Dom.removeClass(q,"active"),c.Dom.removeClass(r,"active")}var i,j,k,l,m,n,o,p,q=document.createElement("DIV"),r=document.createElement("DIV"),s=a(b);q.className="manualRowResizer",r.className="manualRowResizerGuide";var t=function(){var a=this;c.hooks.run(a,"persistentStateSave","manualRowHeights",a.manualRowHeights)},u=function(){var a=this,b={};return c.hooks.run(a,"persistentStateLoad","manualRowHeights",b),b.value},v=function(){var a,b=this,l=0,p=null;b.rootElement.on("mouseenter.manualRowResize."+b.guid,"table tbody tr > th",function(c){a||d.call(b,c.currentTarget)}),b.rootElement.on("mousedown.manualRowResize."+b.guid,".manualRowResizer",function(d){f.call(b),a=b,null==p&&(p=setTimeout(function(){l>=2&&(x(j,null),b.forceFullRender=!0,b.view.render(),c.hooks.run(b,"afterRowResize",j,m)),l=0,p=null},500),b._registerTimeout(p)),l++,n=d.pageY,m=o}),s.on("mousemove.manualRowResize."+b.guid,function(b){a&&(k=o+(b.pageY-n),m=x(j,k),e(),g())}),s.on("mouseup.manualRowResize."+b.guid,function(){a&&(h(),a=!1,m!=o&&(b.forceFullRender=!0,b.view.render(),t.call(b),c.hooks.run(b,"afterRowResize",j,m)),d.call(b,i))}),b.addHook("afterDestroy",w)},w=function(){var a=this;a.rootElement.off("mouseenter.manualRowResize."+a.guid,"table tbody tr > th"),a.rootElement.off("mousedown.manualRowResize."+a.guid,".manualRowResizer"),s.off("mousemove.manualRowResize."+a.guid),s.off("mouseup.manualRowResize."+a.guid)};this.beforeInit=function(){this.manualRowHeights=[]},this.init=function(a){var b=this,c=!!this.getSettings().manualRowResize;if(c){var d=this.getSettings().manualRowResize,e=u.call(b);this.manualRowHeights="undefined"!=typeof e?e:d instanceof Array?d:[],"afterInit"===a?(v.call(this),this.manualRowHeights.length>0&&(this.forceFullRender=!0,this.render())):(this.forceFullRender=!0,this.render())}else w.call(this),this.manualRowHeights=[]};var x=function(a,b){return a=c.hooks.execute(l,"modifyRow",a),l.manualRowHeights[a]=b,b};this.modifyRowHeight=function(a,b){return this.getSettings().manualRowResize&&(b=this.runHooksAndReturn("modifyRow",b),void 0!==this.manualRowHeights[b])?this.manualRowHeights[b]:a}}var e=new d;c.hooks.add("beforeInit",e.beforeInit),c.hooks.add("afterInit",function(){e.init.call(this,"afterInit")}),c.hooks.add("afterUpdateSettings",function(){e.init.call(this,"afterUpdateSettings")}),c.hooks.add("modifyRowHeight",e.modifyRowHeight),c.hooks.register("afterRowResize")}(c),function(){function a(){var a=this,c=a.getSettings().observeChanges;c?(a.observer&&e.call(a),b.call(a),g.call(a)):c||e.call(a)}function b(){var a=this;a.observeChangesActive=!0,a.pauseObservingChanges=function(){a.observeChangesActive=!1},a.resumeObservingChanges=function(){a.observeChangesActive=!0},a.observedData=a.getData(),a.observer=L.observe(a.observedData,function(b){a.observeChangesActive&&(d.call(a,b),a.render()),a.runHooks("afterChangesObserved")})}function d(a){function b(a){var b;return b=d(a),b=c(b)}function c(a){var b=[];return a.filter(function(a){var c=e(a.path);if(-1!=["add","remove"].indexOf(a.op)&&!isNaN(c.col)){if(-1!=b.indexOf(c.col))return!1;b.push(c.col)}return!0})}function d(a){return a.filter(function(a){return!/[/]length/gi.test(a.path)})}function e(a){var b=a.match(/^\/(\d+)\/?(.*)?$/);return{row:parseInt(b[1],10),col:/^\d*$/.test(b[2])?parseInt(b[2],10):b[2]}}for(var f=this,g=b(a),h=0,i=g.length;i>h;h++){var j=g[h],k=e(j.path);switch(j.op){case"add":isNaN(k.col)?f.runHooks("afterCreateRow",k.row):f.runHooks("afterCreateCol",k.col);break;case"remove":isNaN(k.col)?f.runHooks("afterRemoveRow",k.row,1):f.runHooks("afterRemoveCol",k.col,1);break;case"replace":f.runHooks("afterChange",[k.row,k.col,null,j.value],"external")}}}function e(){var a=this;a.observer&&(f.call(a),h.call(a))}function f(){var a=this;L.unobserve(a.observedData,a.observer),delete a.observeChangesActive,delete a.pauseObservingChanges,delete a.resumeObservingChanges}function g(){var a=this;a.addHook("afterDestroy",e),a.addHook("afterCreateRow",i),a.addHook("afterRemoveRow",i),a.addHook("afterCreateCol",i),a.addHook("afterRemoveCol",i),a.addHook("afterChange",function(a,b){"loadData"!=b&&i.call(this)})}function h(){var a=this;a.removeHook("afterDestroy",e),a.removeHook("afterCreateRow",i),a.removeHook("afterRemoveRow",i),a.removeHook("afterCreateCol",i),a.removeHook("afterRemoveCol",i),a.removeHook("afterChange",i)}function i(){var a=this;a.pauseObservingChanges(),a.addHookOnce("afterChangesObserved",function(){a.resumeObservingChanges()})}c.hooks.add("afterLoadData",a),c.hooks.add("afterUpdateSettings",a),c.hooks.register("afterChangesObserved")}(),function(a){function b(){function b(){var a=this;for(var b in f)f.hasOwnProperty(b)&&a.addHook(b,f[b])}function d(){var a=this;for(var b in f)f.hasOwnProperty(b)&&a.removeHook(b,f[b])}var e=this;this.init=function(){var c=this,f=c.getSettings().persistentState;return e.enabled=!!f,e.enabled?(c.storage||(c.storage=new a(c.rootElement[0].id)),c.resetState=e.resetValue,void b.call(c)):void d.call(c)},this.saveValue=function(a,b){var c=this;c.storage.saveValue(a,b)},this.loadValue=function(a,b){var c=this;b.value=c.storage.loadValue(a)},this.resetValue=function(a){var b=this;"undefined"!=typeof a?b.storage.reset(a):b.storage.resetAll()};var f={persistentStateSave:e.saveValue,persistentStateLoad:e.loadValue,persistentStateReset:e.resetValue};for(var g in f)f.hasOwnProperty(g)&&c.hooks.register(g)}var d=new b;c.hooks.add("beforeInit",d.init),c.hooks.add("afterUpdateSettings",d.init)}(g),function(b){b.UndoRedo=function(a){var c=this;this.instance=a,this.doneActions=[],this.undoneActions=[],this.ignoreNewActions=!1,a.addHook("afterChange",function(a){if(a){var d=new b.UndoRedo.ChangeAction(a);c.done(d)}}),a.addHook("afterCreateRow",function(a,d,e){if(!e){var f=new b.UndoRedo.CreateRowAction(a,d);c.done(f)}}),a.addHook("beforeRemoveRow",function(a,d){var e=c.instance.getData();a=(e.length+a)%e.length;var f=e.slice(a,a+d),g=new b.UndoRedo.RemoveRowAction(a,f);c.done(g)}),a.addHook("afterCreateCol",function(a,d,e){if(!e){var f=new b.UndoRedo.CreateColumnAction(a,d);c.done(f)}}),a.addHook("beforeRemoveCol",function(d,e){var f=c.instance.getData();d=(c.instance.countCols()+d)%c.instance.countCols();for(var g=[],h=0,i=f.length;i>h;h++)g[h]=f[h].slice(d,d+e);var j;b.helper.isArray(a.getSettings().colHeaders)&&(j=a.getSettings().colHeaders.slice(d,d+g.length));var k=new b.UndoRedo.RemoveColumnAction(d,g,j);c.done(k)})},b.UndoRedo.prototype.done=function(a){this.ignoreNewActions||(this.doneActions.push(a),this.undoneActions.length=0)},b.UndoRedo.prototype.undo=function(){if(this.isUndoAvailable()){var a=this.doneActions.pop();this.ignoreNewActions=!0;var b=this;a.undo(this.instance,function(){b.ignoreNewActions=!1,b.undoneActions.push(a)})}},b.UndoRedo.prototype.redo=function(){if(this.isRedoAvailable()){var a=this.undoneActions.pop();this.ignoreNewActions=!0;var b=this;a.redo(this.instance,function(){b.ignoreNewActions=!1,b.doneActions.push(a)})}},b.UndoRedo.prototype.isUndoAvailable=function(){return this.doneActions.length>0},b.UndoRedo.prototype.isRedoAvailable=function(){return this.undoneActions.length>0},b.UndoRedo.prototype.clear=function(){this.doneActions.length=0,this.undoneActions.length=0},b.UndoRedo.Action=function(){},b.UndoRedo.Action.prototype.undo=function(){},b.UndoRedo.Action.prototype.redo=function(){},b.UndoRedo.ChangeAction=function(a){this.changes=a},b.helper.inherit(b.UndoRedo.ChangeAction,b.UndoRedo.Action),b.UndoRedo.ChangeAction.prototype.undo=function(b,c){for(var d=a.extend(!0,[],this.changes),e=b.countEmptyRows(!0),f=b.countEmptyCols(!0),g=0,h=d.length;h>g;g++)d[g].splice(3,1);b.addHookOnce("afterChange",c),b.setDataAtRowProp(d,null,null,"undo");for(var g=0,h=d.length;h>g;g++)b.getSettings().minSpareRows&&d[g][0]+1+b.getSettings().minSpareRows===b.countRows()&&e==b.getSettings().minSpareRows&&(b.alter("remove_row",parseInt(d[g][0]+1,10),b.getSettings().minSpareRows),b.undoRedo.doneActions.pop()),b.getSettings().minSpareCols&&d[g][1]+1+b.getSettings().minSpareCols===b.countCols()&&f==b.getSettings().minSpareCols&&(b.alter("remove_col",parseInt(d[g][1]+1,10),b.getSettings().minSpareCols),b.undoRedo.doneActions.pop())},b.UndoRedo.ChangeAction.prototype.redo=function(b,c){for(var d=a.extend(!0,[],this.changes),e=0,f=d.length;f>e;e++)d[e].splice(2,1);b.addHookOnce("afterChange",c),b.setDataAtRowProp(d,null,null,"redo")},b.UndoRedo.CreateRowAction=function(a,b){this.index=a,this.amount=b},b.helper.inherit(b.UndoRedo.CreateRowAction,b.UndoRedo.Action),b.UndoRedo.CreateRowAction.prototype.undo=function(a,b){a.addHookOnce("afterRemoveRow",b),a.alter("remove_row",this.index,this.amount)},b.UndoRedo.CreateRowAction.prototype.redo=function(a,b){a.addHookOnce("afterCreateRow",b),a.alter("insert_row",this.index+1,this.amount)},b.UndoRedo.RemoveRowAction=function(a,b){this.index=a,this.data=b},b.helper.inherit(b.UndoRedo.RemoveRowAction,b.UndoRedo.Action),b.UndoRedo.RemoveRowAction.prototype.undo=function(a,b){var c=[this.index,0];Array.prototype.push.apply(c,this.data),Array.prototype.splice.apply(a.getData(),c),a.addHookOnce("afterRender",b),a.render()},b.UndoRedo.RemoveRowAction.prototype.redo=function(a,b){a.addHookOnce("afterRemoveRow",b),a.alter("remove_row",this.index,this.data.length)},b.UndoRedo.CreateColumnAction=function(a,b){this.index=a,this.amount=b},b.helper.inherit(b.UndoRedo.CreateColumnAction,b.UndoRedo.Action),b.UndoRedo.CreateColumnAction.prototype.undo=function(a,b){a.addHookOnce("afterRemoveCol",b),a.alter("remove_col",this.index,this.amount)},b.UndoRedo.CreateColumnAction.prototype.redo=function(a,b){a.addHookOnce("afterCreateCol",b),a.alter("insert_col",this.index+1,this.amount)},b.UndoRedo.RemoveColumnAction=function(a,b,c){this.index=a,this.data=b,this.amount=this.data[0].length,this.headers=c},b.helper.inherit(b.UndoRedo.RemoveColumnAction,b.UndoRedo.Action),b.UndoRedo.RemoveColumnAction.prototype.undo=function(a,b){for(var c,d,e=0,f=a.getData().length;f>e;e++)c=a.getSourceDataAtRow(e),d=[this.index,0],Array.prototype.push.apply(d,this.data[e]),Array.prototype.splice.apply(c,d);"undefined"!=typeof this.headers&&(d=[this.index,0],Array.prototype.push.apply(d,this.headers),Array.prototype.splice.apply(a.getSettings().colHeaders,d)),a.addHookOnce("afterRender",b),a.render()},b.UndoRedo.RemoveColumnAction.prototype.redo=function(a,b){a.addHookOnce("afterRemoveCol",b),a.alter("remove_col",this.index,this.amount)}}(c),function(a){function b(){var b=this,g="undefined"==typeof b.getSettings().undo||b.getSettings().undo;g?b.undoRedo||(b.undoRedo=new a.UndoRedo(b),e(b),b.addHook("beforeKeyDown",c),b.addHook("afterChange",d)):b.undoRedo&&(delete b.undoRedo,f(b),b.removeHook("beforeKeyDown",c),b.removeHook("afterChange",d))}function c(a){var b=this,c=(a.ctrlKey||a.metaKey)&&!a.altKey;c&&(89===a.keyCode||a.shiftKey&&90===a.keyCode?(b.undoRedo.redo(),a.stopImmediatePropagation()):90===a.keyCode&&(b.undoRedo.undo(),a.stopImmediatePropagation()))}function d(a,b){var c=this;return"loadData"==b?c.undoRedo.clear():void 0}function e(a){a.undo=function(){return a.undoRedo.undo()},a.redo=function(){return a.undoRedo.redo()},a.isUndoAvailable=function(){return a.undoRedo.isUndoAvailable()},a.isRedoAvailable=function(){return a.undoRedo.isRedoAvailable()},a.clearUndo=function(){return a.undoRedo.clear()}}function f(a){delete a.undo,delete a.redo,delete a.isUndoAvailable,delete a.isRedoAvailable,delete a.clearUndo}a.hooks.add("afterInit",b),a.hooks.add("afterUpdateSettings",b)}(c),h.prototype.setBoundaries=function(a){this.boundaries=a},h.prototype.setCallback=function(a){this.callback=a},h.prototype.check=function(a,b){var c=0,d=0;bthis.boundaries.bottom&&(d=b-this.boundaries.bottom),athis.boundaries.right&&(c=a-this.boundaries.right),this.callback(c,d)};var Q,R;if("undefined"!=typeof c){var S=function(a){a.dragToScrollListening=!1;var c=a.view.wt.wtScrollbars.vertical.scrollHandler;Q=new h,c!==b&&(Q.setBoundaries(c?c.getBoundingClientRect():a.$table[0].getBoundingClientRect()),Q.setCallback(function(b,d){0>b?c?c.scrollLeft-=50:a.view.wt.scrollHorizontal(-1).draw():b>0&&(c?c.scrollLeft+=50:a.view.wt.scrollHorizontal(1).draw()),0>d?c?c.scrollTop-=20:a.view.wt.scrollVertical(-1).draw():d>0&&(c?c.scrollTop+=20:a.view.wt.scrollVertical(1).draw())}),a.dragToScrollListening=!0)};c.hooks.add("afterInit",function(){var b=this;a(document).on("mouseup."+this.guid,function(){b.dragToScrollListening=!1}),a(document).on("mousemove."+this.guid,function(a){b.dragToScrollListening&&Q.check(a.clientX,a.clientY)})}),c.hooks.add("afterDestroy",function(){a(document).off("."+this.guid)}),c.hooks.add("afterOnCellMouseDown",function(){S(this)}),c.hooks.add("afterOnCellCornerMouseDown",function(){S(this)}),c.plugins.DragToScroll=h}if(function(a,b,c){function d(d){function e(){d.isListening()&&d.selection.empty()}function f(a){if(d.isListening()&&d.selection.isSelected()){var b=a.replace(/^[\r\n]*/g,"").replace(/[\r\n]*$/g,""),e=c.parse(b),f=d.getSelected(),g=new n(f[0],f[1]),h=new n(f[2],f[3]),i=new o(g,g,h),j=i.getTopLeftCorner(),k=i.getBottomRightCorner(),l=j,m=new n(Math.max(k.row,e.length-1+j.row),Math.max(k.col,e[0].length-1+j.col));d.addHookOnce("afterChange",function(a){a&&a.length&&this.selectCell(l.row,l.col,m.row,m.col)}),d.populateFromArray(l.row,l.col,e,m.row,m.col,"paste",d.getSettings().pasteMode)}}function g(b){if(d.getSelected()){if(a.helper.isCtrlKey(b.keyCode))return h.setCopyableText(),void b.stopImmediatePropagation();var c=(b.ctrlKey||b.metaKey)&&!b.altKey;b.keyCode==a.helper.keyCode.A&&c&&d._registerTimeout(setTimeout(a.helper.proxy(h.setCopyableText,h),0))}}this.copyPasteInstance=b.getInstance(),this.copyPasteInstance.onCut(e),this.copyPasteInstance.onPaste(f);var h=this;d.addHook("beforeKeyDown",g),this.destroy=function(){this.copyPasteInstance.removeCallback(e),this.copyPasteInstance.removeCallback(f),this.copyPasteInstance.destroy(),d.removeHook("beforeKeyDown",g)},d.addHook("afterDestroy",a.helper.proxy(this.destroy,this)),this.triggerPaste=a.helper.proxy(this.copyPasteInstance.triggerPaste,this.copyPasteInstance),this.triggerCut=a.helper.proxy(this.copyPasteInstance.triggerCut,this.copyPasteInstance),this.setCopyableText=function(){var b=d.getSettings(),c=b.copyRowsLimit,e=b.copyColsLimit,f=d.getSelectedRange(),g=f.getTopLeftCorner(),h=f.getBottomRightCorner(),i=g.row,j=g.col,k=h.row,l=h.col,m=Math.min(k,i+c-1),n=Math.min(l,j+e-1);d.copyPaste.copyPasteInstance.copyable(d.getCopyableData(i,j,m,n)),(k!==m||l!==n)&&a.hooks.run(d,"afterCopyLimit",k-i+1,l-j+1,c,e)}}function e(){var a=this,b=a.getSettings().copyPaste!==!1;b&&!a.copyPaste?a.copyPaste=new d(a):!b&&a.copyPaste&&(a.copyPaste.destroy(),delete a.copyPaste)}a.hooks.add("afterInit",e),a.hooks.add("afterUpdateSettings",e),a.hooks.register("afterCopyLimit")}(c,K,SheetClip),function(a){function b(){var b=this,c=!!b.getSettings().search;c?b.search=new a.Search(b):delete b.search}a.Search=function(b){this.query=function(c,d,e){var f=b.countRows(),g=b.countCols(),h=[];d||(d=a.Search.global.getDefaultCallback()),e||(e=a.Search.global.getDefaultQueryMethod());for(var i=0;f>i;i++)for(var j=0;g>j;j++){var k=b.getDataAtCell(i,j),l=b.getCellMeta(i,j),m=l.search.callback||d,n=l.search.queryMethod||e,o=n(c,k);if(o){var p={row:i,col:j,data:k};h.push(p)}m&&m(b,i,j,k,o)}return h}},a.Search.DEFAULT_CALLBACK=function(a,b,c,d,e){a.getCellMeta(b,c).isSearchResult=e},a.Search.DEFAULT_QUERY_METHOD=function(a,b){return"undefined"!=typeof a&&null!=a&&a.toLowerCase&&0!=a.length?"undefined"==typeof b||null==b?!1:-1!=b.toString().toLowerCase().indexOf(a.toLowerCase()):!1},a.Search.DEFAULT_SEARCH_RESULT_CLASS="htSearchResult",a.Search.global=function(){var b=a.Search.DEFAULT_CALLBACK,c=a.Search.DEFAULT_QUERY_METHOD,d=a.Search.DEFAULT_SEARCH_RESULT_CLASS;return{getDefaultCallback:function(){return b},setDefaultCallback:function(a){b=a},getDefaultQueryMethod:function(){return c},setDefaultQueryMethod:function(a){c=a},getDefaultSearchResultClass:function(){return d},setDefaultSearchResultClass:function(a){d=a}}}(),a.SearchCellDecorator=function(b,c,d,e,f,g,h){var i="object"==typeof h.search&&h.search.searchResultClass||a.Search.global.getDefaultSearchResultClass();h.isSearchResult?a.Dom.addClass(c,i):a.Dom.removeClass(c,i)};var c=a.renderers.cellDecorator;a.renderers.cellDecorator=function(){c.apply(this,arguments),a.SearchCellDecorator.apply(this,arguments)},a.hooks.add("afterInit",b),a.hooks.add("afterUpdateSettings",b)}(c),j.prototype.canMergeRange=function(a){return!a.isSingle()},j.prototype.mergeRange=function(a){if(this.canMergeRange(a)){var b=a.getTopLeftCorner(),c=a.getBottomRightCorner(),d={};d.row=b.row,d.col=b.col,d.rowspan=c.row-b.row+1,d.colspan=c.col-b.col+1,this.mergedCellInfoCollection.setInfo(d)}},j.prototype.mergeOrUnmergeSelection=function(a){var b=this.mergedCellInfoCollection.getInfo(a.from.row,a.from.col);b?this.unmergeSelection(a.from):this.mergeSelection(a)},j.prototype.mergeSelection=function(a){this.mergeRange(a)},j.prototype.unmergeSelection=function(a){var b=this.mergedCellInfoCollection.getInfo(a.row,a.col);this.mergedCellInfoCollection.removeInfo(b.row,b.col)},j.prototype.applySpanProperties=function(a,b,c){var d=this.mergedCellInfoCollection.getInfo(b,c);d?d.row===b&&d.col===c?(a.setAttribute("rowspan",d.rowspan),a.setAttribute("colspan",d.colspan)):a.style.display="none":(a.removeAttribute("rowspan"),a.removeAttribute("colspan"))},j.prototype.modifyTransform=function(a,b,c){var d=function(a,b){return b.row>=a.row&&b.row<=a.row+a.rowspan-1?!0:!1},e=function(a,b){return b.col>=a.col&&b.col<=a.col+a.colspan-1?!0:!1},f=function(a){return new n(b.to.row+a.row,b.to.col+a.col)},g={row:c.row,col:c.col};if("modifyTransformStart"==a){this.lastDesiredCoords||(this.lastDesiredCoords=new n(null,null));for(var h,i=new n(b.highlight.row,b.highlight.col),j=this.mergedCellInfoCollection.getInfo(i.row,i.col),k=0,l=this.mergedCellInfoCollection.length;l>k;k++){var m=this.mergedCellInfoCollection[k];if(m=new n(m.row+m.rowspan-1,m.col+m.colspan-1),b.includes(m)){h=!0;break}}if(j){var p=new n(j.row,j.col),q=new n(j.row+j.rowspan-1,j.col+j.colspan-1),r=new o(p,p,q);r.includes(this.lastDesiredCoords)||(this.lastDesiredCoords=new n(null,null)),g.row=this.lastDesiredCoords.row?this.lastDesiredCoords.row-i.row:g.row,g.col=this.lastDesiredCoords.col?this.lastDesiredCoords.col-i.col:g.col,c.row>0?g.row=j.row+j.rowspan-1-i.row+c.row:c.row<0&&(g.row=i.row-j.row+c.row),c.col>0?g.col=j.col+j.colspan-1-i.col+c.col:c.col<0&&(g.col=i.col-j.col+c.col)}var s=new n(b.highlight.row+g.row,b.highlight.col+g.col),t=this.mergedCellInfoCollection.getInfo(s.row,s.col);t&&(this.lastDesiredCoords=s,g={row:t.row-i.row,col:t.col-i.col})}else if("modifyTransformEnd"==a)for(var k=0,l=this.mergedCellInfoCollection.length;l>k;k++){var u=this.mergedCellInfoCollection[k],p=new n(u.row,u.col),q=new n(u.row+u.rowspan-1,u.col+u.colspan-1),v=new o(p,p,q),w=b.getBordersSharedWith(v);if(v.isEqual(b))b.setDirection("NW-SE");else if(w.length>0){var x=b.highlight.isEqual(v.from);w.indexOf("top")>-1?b.to.isSouthEastOf(v.from)&&x?b.setDirection("NW-SE"):b.to.isSouthWestOf(v.from)&&x&&b.setDirection("NE-SW"):w.indexOf("bottom")>-1&&(b.to.isNorthEastOf(v.from)&&x?b.setDirection("SW-NE"):b.to.isNorthWestOf(v.from)&&x&&b.setDirection("SE-NW"))}var s=f(g),y=d(u,s),z=e(u,s);b.includesRange(v)&&(v.includes(s)||y||z)&&(y&&(g.row<0?g.row-=u.rowspan-1:g.row>0&&(g.row+=u.rowspan-1)),z&&(g.col<0?g.col-=u.colspan-1:g.col>0&&(g.col+=u.colspan-1)))}0!=g.row&&(c.row=g.row),0!=g.col&&(c.col=g.col)},"undefined"==typeof c)throw new Error("Handsontable is not defined");var T=function(){var a=this,b=a.getSettings().mergeCells;b&&(a.mergeCells||(a.mergeCells=new j(b)))},U=function(){var a=this;a.mergeCells&&(a.view.wt.wtTable.getCell=function(b){if(a.getSettings().mergeCells){var c=a.mergeCells.mergedCellInfoCollection.getInfo(b.row,b.col);c&&(b=c)}return E.prototype.getCell.call(this,b)})},V=function(a){if(this.mergeCells){var b=(a.ctrlKey||a.metaKey)&&!a.altKey;b&&77===a.keyCode&&(this.mergeCells.mergeOrUnmergeSelection(this.getSelectedRange()),this.render(),a.stopImmediatePropagation())}},W=function(a){this.getSettings().mergeCells&&(a.items.push(c.ContextMenu.SEPARATOR),a.items.push({key:"mergeCells",name:function(){var a=this.getSelected(),b=this.mergeCells.mergedCellInfoCollection.getInfo(a[0],a[1]);return b?"Unmerge cells":"Merge cells"},callback:function(){this.mergeCells.mergeOrUnmergeSelection(this.getSelectedRange()),this.render()},disabled:function(){return!1}}))},O=function(a,b,c){this.mergeCells&&this.mergeCells.applySpanProperties(a,b,c)},X=function(a){return function(b){var c=this.getSettings().mergeCells;if(c){var d=this.getSelectedRange();if(this.mergeCells.modifyTransform(a,d,b),"modifyTransformEnd"===a){var e=this.countRows(),f=this.countCols();d.from.row<0?d.from.row=0:d.from.row>0&&d.from.row>=e&&(d.from.row=d.from-1),d.from.col<0?d.from.col=0:d.from.col>0&&d.from.col>=f&&(d.from.col=f-1)}}}},Y=function(a){this.lastDesiredCoords=null;var b=this.getSettings().mergeCells;if(b){var c=this.getSelectedRange();c.highlight=new n(c.highlight.row,c.highlight.col),c.to=a;var d=!1;do{d=!1;for(var e=0,f=this.mergeCells.mergedCellInfoCollection.length;f>e;e++){var g=this.mergeCells.mergedCellInfoCollection[e],h=new n(g.row,g.col),i=new n(g.row+g.rowspan-1,g.col+g.colspan-1),j=new o(h,h,i); c.expandByRange(j)&&(a.row=c.to.row,a.col=c.to.col,d=!0)}}while(d)}},Z=function(a,b){if(b&&"area"==b){var c=this.getSettings().mergeCells;if(c)for(var d=this.getSelectedRange(),e=new o(d.from,d.from,d.from),f=new o(d.to,d.to,d.to),g=0,h=this.mergeCells.mergedCellInfoCollection.length;h>g;g++){var i=this.mergeCells.mergedCellInfoCollection[g],j=new n(i.row,i.col),k=new n(i.row+i.rowspan-1,i.col+i.colspan-1),l=new o(j,j,k);e.expandByRange(l)&&(a[0]=e.from.row,a[1]=e.from.col),f.expandByRange(l)&&(a[2]=f.from.row,a[3]=f.from.col)}}},$=function(a,b,c){var d=this.getSettings().mergeCells;if(d){var e=this.mergeCells.mergedCellInfoCollection.getInfo(a,b);!e||e.row==a&&e.col==b||(c.copyable=!1)}},_=function(a){if(a&&this.mergeCells){var b=this.mergeCells.mergedCellInfoCollection,c=this.getSelectedRange();for(var d in b)if(c.highlight.row==b[d].row&&c.highlight.col==b[d].col&&c.to.row==b[d].row+b[d].rowspan-1&&c.to.col==b[d].col+b[d].colspan-1)return!1}return a};c.hooks.add("beforeInit",T),c.hooks.add("afterInit",U),c.hooks.add("beforeKeyDown",V),c.hooks.add("modifyTransformStart",X("modifyTransformStart")),c.hooks.add("modifyTransformEnd",X("modifyTransformEnd")),c.hooks.add("beforeSetRangeEnd",Y),c.hooks.add("beforeDrawBorders",Z),c.hooks.add("afterIsMultipleSelection",_),c.hooks.add("afterRenderer",O),c.hooks.add("afterContextMenuDefaultOptions",W),c.hooks.add("afterGetCellMeta",$),c.MergeCells=j,function(){function a(){}var b,d=function(a){return"boolean"==typeof a&&1==a?!0:"object"==typeof a&&a.length>0?!0:!1},e=function(){d(this.getSettings().customBorders)&&(this.customBorders||(b=this,this.customBorders=new a))},f=function(a){for(var c=0;c=0?b.view.wt.selections[e]=d:b.view.wt.selections.push(d)},h=function(a,b,c){var d=n(a,b);d=p(d,c),this.setCellMeta(a,b,"borders",d),g(d)},i=function(a){for(var b=a.range,c=b.from.row;c<=b.to.row;c++)for(var d=b.from.col;d<=b.to.col;d++){var e=n(c,d),f=0;c==b.from.row&&(f++,a.hasOwnProperty("top")&&(e.top=a.top)),c==b.to.row&&(f++,a.hasOwnProperty("bottom")&&(e.bottom=a.bottom)),d==b.from.col&&(f++,a.hasOwnProperty("left")&&(e.left=a.left)),d==b.to.col&&(f++,a.hasOwnProperty("right")&&(e.right=a.right)),f>0&&(this.setCellMeta(c,d,"borders",e),g(e))}},j=function(a,b){return"border_row"+a+"col"+b},k=function(){return{width:1,color:"#000"}},l=function(){return{hide:!0}},m=function(){return{width:1,color:"#000",cornerVisible:!1}},n=function(a,b){return{className:j(a,b),border:m(),row:a,col:b,top:l(),right:l(),bottom:l(),left:l()}},p=function(a,b){return b.hasOwnProperty("border")&&(a.border=b.border),b.hasOwnProperty("top")&&(a.top=b.top),b.hasOwnProperty("right")&&(a.right=b.right),b.hasOwnProperty("bottom")&&(a.bottom=b.bottom),b.hasOwnProperty("left")&&(a.left=b.left),a},q=function(a){for(var b=document.getElementsByClassName(a),c=0;c✓"+a},w=function(a){this.getSettings().customBorders&&(a.items.push(c.ContextMenu.SEPARATOR),a.items.push({key:"borders",name:"Borders",submenu:{items:{top:{name:function(){var a="Top",b=u(this,"top");return b&&(a=v(a)),a},callback:function(){var a=u(this,"top");t.call(this,this.getSelectedRange(),"top",a)},disabled:!1},right:{name:function(){var a="Right",b=u(this,"right");return b&&(a=v(a)),a},callback:function(){var a=u(this,"right");t.call(this,this.getSelectedRange(),"right",a)},disabled:!1},bottom:{name:function(){var a="Bottom",b=u(this,"bottom");return b&&(a=v(a)),a},callback:function(){var a=u(this,"bottom");t.call(this,this.getSelectedRange(),"bottom",a)},disabled:!1},left:{name:function(){var a="Left",b=u(this,"left");return b&&(a=v(a)),a},callback:function(){var a=u(this,"left");t.call(this,this.getSelectedRange(),"left",a)},disabled:!1},remove:{name:"Remove border(s)",callback:function(){t.call(this,this.getSelectedRange(),"noBorders")},disabled:function(){return!u(this)}}}}}))};c.hooks.add("beforeInit",e),c.hooks.add("afterContextMenuDefaultOptions",w),c.hooks.add("afterInit",function(){var a=this.getSettings().customBorders;if(a){for(var b=0;b=0){m=b;var c=n.getBoundingClientRect();l=c.top,o.style.top=l+"px",o.style.left=c.left+"px",R.rootElement[0].appendChild(o)}}function e(a){var b=a.getBoundingClientRect();o.style.top=b.top+"px"}function f(){var a=this;c.Dom.addClass(o,"active"),c.Dom.addClass(p,"active");var b=n.getBoundingClientRect();p.style.width=a.view.maximumVisibleElementWidth(0)+"px",p.style.height=b.height+"px",p.style.top=l+"px",p.style.left=o.style.left,a.rootElement[0].appendChild(p)}function g(a){p.style.top=l+a+"px"}function h(){c.Dom.removeClass(o,"active"),c.Dom.removeClass(p,"active")}var i,j,k,l,m,n,o=document.createElement("DIV"),p=document.createElement("DIV"),q=a(b);o.className="manualRowMover",p.className="manualRowMoverGuide";var r=function(){var a=this;c.hooks.run(a,"persistentStateSave","manualRowPositions",a.manualRowPositions)},s=function(){var a=this,b={};return c.hooks.run(a,"persistentStateLoad","manualRowPositions",b),b.value},t=function(){var a,b=this;b.rootElement.on("mouseenter.manualRowMove."+b.guid,"table tbody tr > th",function(c){a?(j=b.view.wt.wtTable.getCoords(c.currentTarget).row,e(c.currentTarget)):d.call(b,c.currentTarget)}),b.rootElement.on("mousedown.manualRowMove."+b.guid,".manualRowMover",function(c){k=c.pageY,f.call(b),a=b,i=m,j=m}),q.on("mousemove.manualRowMove."+b.guid,function(b){a&&g(b.pageY-k)}),q.on("mouseup.manualRowMove."+b.guid,function(){a&&(h(),a=!1,j>i&&j--,v(b.manualRowPositions,b.countRows()),b.manualRowPositions.splice(j,0,b.manualRowPositions.splice(i,1)[0]),b.forceFullRender=!0,b.view.render(),r.call(b),c.hooks.run(b,"afterRowMove",i,j),d.call(b,n))}),b.addHook("afterDestroy",u)},u=function(){var a=this;a.rootElement.off("mouseenter.manualRowMove."+a.guid,"table tbody tr > th"),a.rootElement.off("mousedown.manualRowMove."+a.guid,".manualRowMover"),q.off("mousemove.manualRowMove."+a.guid),q.off("mouseup.manualRowMove."+a.guid)},v=function(a,b){if(a.lengthc;c++)a[c]=c};this.beforeInit=function(){this.manualRowPositions=[]},this.init=function(a){var b=this,c=!!b.getSettings().manualRowMove;if(c){var d=b.getSettings().manualRowMove,e=s.call(b);this.manualRowPositions="undefined"!=typeof e?e:d instanceof Array?d:[],"afterInit"===a&&(t.call(this),this.manualRowPositions.length>0&&(b.forceFullRender=!0,b.render()))}else u.call(this),b.manualRowPositions=[]},this.modifyRow=function(a){var b=this;return b.getSettings().manualRowMove?("undefined"==typeof b.manualRowPositions[a]&&v(this.manualRowPositions,a+1),b.manualRowPositions[a]):a}}var e=new d;c.hooks.add("beforeInit",e.beforeInit),c.hooks.add("afterInit",function(){e.init.call(this,"afterInit")}),c.hooks.add("afterUpdateSettings",function(){e.init.call(this,"afterUpdateSettings")}),c.hooks.add("modifyRow",e.modifyRow),c.hooks.register("afterRowMove")}(c),function(c){function d(d){this.instance=d,this.addingStarted=!1;var e,f,g=(a(document),!1),h=this,i=function(){return d.autofill?void(d.autofill.handle&&d.autofill.handle.isDragged&&(d.autofill.handle.isDragged>1&&d.autofill.apply(),d.autofill.handle.isDragged=0,g=!1)):!0};a(document).off("mouseup.autofill."+d.guid,this.instance.rootElement).on("mouseup.autofill."+d.guid,this.instance.rootElement,function(a){i(a)}),a(document).off("mousemove.moveOutside_"+d.guid).on("mousemove.moveOutside_"+d.guid,function(a){if(!h.instance.autofill)return 0;var d=c.Dom.offset(h.instance.$table[0]).top-(b.pageYOffset||document.documentElement.scrollTop)+c.Dom.outerHeight(h.instance.$table[0]),e=c.Dom.offset(h.instance.$table[0]).left-(b.pageXOffset||document.documentElement.scrollLeft)+c.Dom.outerWidth(h.instance.$table[0]);h.addingStarted===!1&&h.instance.autofill.handle.isDragged>0&&a.clientY>d&&a.clientX<=e?(this.mouseDragOutside=!0,h.addingStarted=!0):this.mouseDragOutside=!1,this.mouseDragOutside&&setTimeout(function(){h.addingStarted=!1,h.instance.alter("insert_row")},200)}),e=this.instance.view.wt.wtSettings.settings.onCellCornerMouseDown,this.instance.view.wt.wtSettings.settings.onCellCornerMouseDown=function(a){d.autofill.handle.isDragged=1,g=!0,e(a)},f=this.instance.view.wt.wtSettings.settings.onCellMouseOver,this.instance.view.wt.wtSettings.settings.onCellMouseOver=function(a,b,c,e){d.autofill&&g&&!d.view.isMouseDown()&&d.autofill.handle&&d.autofill.handle.isDragged&&(d.autofill.handle.isDragged++,d.autofill.showBorder(b),d.autofill.checkIfNewRowNeeded()),f(a,b,c,e)},this.instance.view.wt.wtSettings.settings.onCellCornerDblClick=function(){d.autofill.selectAdjacent()}}d.prototype.init=function(){this.handle={}},d.prototype.disable=function(){this.handle.disabled=!0},d.prototype.selectAdjacent=function(){var a,b,c,d,e;a=this.instance.selection.isMultiple()?this.instance.view.wt.selections.area.getCorners():this.instance.view.wt.selections.current.getCorners(),b=this.instance.getData();a:for(c=a[2]+1;cb[3]?(d=new n(a[0],b[3]+1),e=new n(a[2],a[3])):a[0]b[2]&&a[1]===b[1]&&(d=new n(b[2]+1,a[1]),e=new n(a[2],a[3])),d&&d.row>-1&&d.col>-1){var g={from:this.instance.getSelectedRange().from,to:this.instance.getSelectedRange().to};f=this.instance.getData(g.from.row,g.from.col,g.to.row,g.to.col),c.hooks.run(this.instance,"beforeAutofill",d,e,f),this.instance.populateFromArray(d.row,d.col,f,e.row,e.col,"autofill"),this.instance.selection.setRangeStart(new n(a[0],a[1])),this.instance.selection.setRangeEnd(new n(a[2],a[3]))}else this.instance.selection.refreshBorders()},d.prototype.showBorder=function(a){var b=this.instance.getSelectedRange().getTopLeftCorner(),c=this.instance.getSelectedRange().getBottomRightCorner();if("horizontal"!==this.instance.getSettings().fillHandle&&(c.rowa.row))a=new n(a.row,c.col);else{if("vertical"===this.instance.getSettings().fillHandle)return;a=new n(c.row,a.col)}this.instance.view.wt.selections.fill.clear(),this.instance.view.wt.selections.fill.add(this.instance.getSelectedRange().from),this.instance.view.wt.selections.fill.add(this.instance.getSelectedRange().to),this.instance.view.wt.selections.fill.add(a),this.instance.view.render()},d.prototype.checkIfNewRowNeeded=function(){var a,b,c=this.instance.countRows(),d=this;this.instance.view.wt.selections.fill.cellRange&&this.addingStarted===!1&&(b=this.instance.getSelected(),a=this.instance.view.wt.selections.fill.getCorners(),b[2]=a;)c.push(a++);return c},k=function(a,b,c){var d=[],e={row:null,col:null};if("cols"==a)for(;c>=b;)e={row:-1,col:b++},d.push(e);else for(;c>=b;)e={row:b++,col:-1},d.push(e);for(var f=l(d),g=0,h=0,i=0;ic;c++)if(b[c].id==a)return b[c];return!1},p=function(a,c){for(var d=0,e=b.length;e>d;d++)if(b[d].level==c&&b[d].rows&&b[d].rows.indexOf(a)>-1)return b[d];return!1},q=function(a,c){for(var d=0,e=b.length;e>d;d++)if(b[d].level==c&&b[d].cols&&b[d].cols.indexOf(a)>-1)return b[d];return!1},r=function(){for(var a=[],c=0,d=b.length;d>c;c++)b[c].cols instanceof Array&&a.push(b[c]);return a},s=function(a){for(var c=[],d=0,e=b.length;e>d;d++)b[d].cols&&b[d].level===a&&c.push(b[d]);return c},t=function(){for(var a=[],c=0,d=b.length;d>c;c++)b[c].rows instanceof Array&&a.push(b[c]);return a},u=function(a){for(var c=[],d=0,e=b.length;e>d;d++)b[d].rows&&b[d].level===a&&c.push(b[d]);return c},v=function(a){var b=0;return a.length&&a.forEach(function(a){if(a=a.filter(function(a){return a.cols}),a.length){var c=a.sort(i("level","desc")),d=c[0].level;d>b&&(b=d)}}),b},w=function(a){var b=0;return a.length&&a.forEach(function(a){if(a=a.filter(function(a){return a.rows}),a.length){var c=a.sort(i("level","desc")),d=c[0].level;d>b&&(b=d)}}),b},x=function(a,c){var f=k("cols",a,c),g=v(f.groups);g===e.cols?e.cols++:g>e.cols&&(e.cols=g+1),d.cols||(d.cols=r().length),d.cols++,b.push({id:"c"+d.cols,level:g+1,cols:j(a,c),hidden:0})},y=function(a,c){var f=k("rows",a,c),g=w(f.groups);e.rows=Math.max(e.rows,g+1),d.rows||(d.rows=t().length),d.rows++,b.push({id:"r"+d.rows,level:g+1,rows:j(a,c),hidden:0})},z=function(a,b){for(var c,d=0,e=b.length;e>d;d++)if(b[d].hidden=a,c=b[d].level,f[c]||(f[c]=[]),g[c]||(g[c]=[]),b[d].rows)for(var h=0,i=b[d].rows.length;i>h;h++)f[c][b[d].rows[h]]=a>0?!0:void 0;else if(b[d].cols)for(var h=0,j=b[d].cols.length;j>h;h++)g[c][b[d].cols[h]]=a>0?!0:void 0},A=function(a,b,d,e){var f,g;switch(a){case"rows":f=p(b+1,d).id,g=c.Grouping.getGroupLevelsByRows();break;case"cols":f=q(b+1,d).id,g=c.Grouping.getGroupLevelsByCols()}return!!(g[b+1]&&g[b+1].indexOf(d)>-1&&e==f)},B=function(a,b,d,e){var f,g;switch(a){case"rows":f=p(b-1,d).id,g=c.Grouping.getGroupLevelsByRows();break;case"cols":f=q(b-1,d).id,g=c.Grouping.getGroupLevelsByCols()}return!!(g[b-1]&&g[b-1].indexOf(d)>-1&&e==f)},C=function(b,d,h,i){if(0===d)return!1;var j,k,l=B(b,d,h,i),m=A(b,d,h,i),n=!1;switch(b){case"rows":j=c.Grouping.getGroupLevelsByRows(),k=a.countRows();for(var o=0;o<=e.rows;o++)if(f[o]&&f[o][d+1]){n=!0;break}break;case"cols":j=c.Grouping.getGroupLevelsByCols(),k=a.countCols();for(var o=0;o<=e.cols;o++)if(g[o]&&g[o][d+1]){n=!0;break}}if(l){if(d==k-1)return!0;if(!m||m&&n)return!0;if(!j[d+1])return!0}return!1},D=function(b){var c;switch(b){case"rows":c=e.rows;for(var d=0;c>=d;d++)if(f[d]&&f[d][a.countRows()-1])return!0;break;case"cols":c=e.cols;for(var d=0;c>=d;d++)if(g[d]&&g[d][a.countCols()-1])return!0}return!1},E=function(b,d,h,i){var j,k,l,m=o(i),n=!1,p=function(a){for(var b=!1,c="rows"==a?f:g,h=0;h<=e[a];h++){for(l=d;m[a].indexOf(l)>-1;)b=!(!c[h]||!c[h][l]),l--;if(b)break}return b},q=B(b,d,h,i),r=A(b,d,h,i);switch(b){case"rows":j=c.Grouping.getGroupLevelsByRows(),k=a.countRows(),n=p(b);break;case"cols":j=c.Grouping.getGroupLevelsByCols(),k=a.countCols(),n=p(b)}if(d==k-1)return!1;if(0==d){if(r)return!0}else if(!q||q&&n){if(r)return!0}else if(!j[d-1]&&r)return!0;return!1},F=function(a,b,d,e,f){var g;switch(a){case"rows":g=p(b-1,d).id;break;case"cols":g=q(b-1,d).id}if(!g)return null;if(b>0&&B(a,b-1,d,g)&&g!=e){var i=document.createElement("DIV");return c.Dom.addClass(i,h.expandButton),i.id="htExpand-"+g,i.appendChild(document.createTextNode("+")),i.setAttribute("data-level",d),i.setAttribute("data-type",a),i.setAttribute("data-hidden","1"),f.appendChild(i),i}return null},G=function(a){for(var b=t(),c=r(),d=0,e=b.length;e>d;d++)if(b[d].rows.indexOf(a.row)>-1&&b[d].hidden)return!0;if(null===a.col)return!1;for(var d=0,f=c.length;f>d;d++)if(c[d].cols.indexOf(a.col)>-1&&c[d].hidden)return!0;return!1};return{getGroups:function(){return b},getLevels:function(){return e},instance:a,baseSpareRows:a.getSettings().minSpareRows,baseSpareCols:a.getSettings().minSpareCols,getRowGroups:t,getColGroups:r,init:function(){var b=a.getSettings().groups;b&&b instanceof Array&&c.Grouping.initGroups(b)},initGroups:function(a){b=[],a.forEach(function(a){var b=[],c=!1,d=!1;a.rows instanceof Array?(b=a.rows,c=!0):a.cols instanceof Array&&(b=a.cols,d=!0);var e=b[0],f=b[b.length-1];c?y(e,f):d&&x(e,f)})},resetGroups:function(){b=[],d={rows:0,cols:0},e={rows:0,cols:0};var a;for(var f in h)if("function"!=typeof h[f]){a=document.querySelectorAll("."+h[f]);for(var g=0,i=a.length;i>g;g++)c.Dom.removeClass(a[g],h[f])}for(var j=["htGroupColClosest","htGroupCol"],f=0,k=j.length;k>f;f++){a=document.querySelectorAll("."+j[f]);for(var g=0,i=a.length;i>g;g++)c.Dom.removeClass(a[g],j[f])}},updateGroups:function(){var a=this.getSettings().groups;c.Grouping.resetGroups(),c.Grouping.initGroups(a)},afterGetRowHeader:function(a,b){for(var d=!1,e=0,g=f.length;g>e;e++)f[e]&&f[e][a]===!0&&(d=!0);d?c.Dom.addClass(b.parentNode,"hidden"):!d&&c.Dom.hasClass(b.parentNode,"hidden")&&c.Dom.removeClass(b.parentNode,"hidden")},afterGetColHeader:function(b){var d=this.view.wt.wtSettings.getSetting("rowHeaders").length,e=a.rootElement[0].querySelectorAll("colgroup col:nth-child("+parseInt(b+d+1,10)+")");if(0!==e.length){for(var f=!1,h=0,i=g.length;i>h;h++)g[h]&&g[h][b]===!0&&(f=!0);if(f)for(var h=0,j=e.length;j>h;h++)c.Dom.addClass(e[h],"hidden");else if(!f&&c.Dom.hasClass(e[0],"hidden"))for(var h=0,j=e.length;j>h;h++)c.Dom.removeClass(e[h],"hidden")}},groupIndicatorsFactory:function(a,b){var f,g,i,j,k,l,m,n;switch(b){case"horizontal":f=c.Grouping.getGroupLevelsByCols(),g=function(a){return Array.prototype.indexOf.call(a.parentNode.parentNode.childNodes,a.parentNode)+1},i=function(a,b){return q(a,b).id},j="cols",k=function(a,b){return q(a-1,b)},l="columnHeaders",m=function(a){if(1===a.length){var b=a[0];a[0]=function(a,d,e){-1>a?r()(a,d,e):(c.Dom.removeClass(d,h.groupIndicatorContainer),b(a,d,e))}}return function(){return a}},n=!0;break;case"vertical":f=c.Grouping.getGroupLevelsByRows(),g=function(a){return c.Dom.index(a)+1},i=function(a,b){return p(a,b).id},j="rows",k=function(a,b){return p(a-1,b)},l="rowHeaders",m=function(a){return a}}var o=function(a){var b=document.createElement("div");return a.appendChild(b),{button:b,addClass:function(a){c.Dom.addClass(b,a)}}},r=function(){var a=b.charAt(0).toUpperCase()+b.slice(1);return function(b,d,e){e++;for(var g,l;g=d.lastChild;)d.removeChild(g);c.Dom.addClass(d,h.groupIndicatorContainer);var m=i(b,e);if(b>-1&&f[b]&&f[b].indexOf(e)>-1&&(l=o(d),l.addClass(h.groupIndicator(a)),E(j,b,e,m)&&l.addClass(h.groupStart),C(j,b,e,m)&&(l.button.appendChild(document.createTextNode("-")),l.addClass(h.collapseButton),l.button.id=h.collapseGroupId(m),l.button.setAttribute("data-level",e),l.button.setAttribute("data-type",j))),n){var p=c.Dom.index(d.parentNode);if(-1===b||-1>b&&p===c.Grouping.getLevels().cols+1||0==p&&0==c.Grouping.getLevels().cols)if(l=o(d),l.addClass(h.levelTrigger),-1===b)l.button.id=h.collapseFromLevel("Cols",e),l.button.appendChild(document.createTextNode(e));else if(-1>b&&p===c.Grouping.getLevels().cols+1||0==p&&0==c.Grouping.getLevels().cols){var q=c.Dom.index(d)+1;l.button.id=h.collapseFromLevel("Rows",q),l.button.appendChild(document.createTextNode(q))}}var r=F(j,b,e,m,d);if(b>0){var s=k(b-1,e);r&&s.hidden&&c.Dom.addClass(r,h.clickable)}bb()}};if(a=m(a),d[j]>0)for(var s=0;sc;c++)if(a[c].rows)for(var e=0,f=a[c].rows.length;f>e;e++)b[a[c].rows[e]]||(b[a[c].rows[e]]=[]),b[a[c].rows[e]].push(a[c].level);return b},getGroupLevelsByCols:function(){for(var a=r(),b=[],c=0,d=a.length;d>c;c++)if(a[c].cols)for(var e=0,f=a[c].cols.length;f>e;e++)b[a[c].cols[e]]||(b[a[c].cols[e]]=[]),b[a[c].cols[e]].push(a[c].level);return b},toggleGroupVisibility:function(b){if(c.Dom.hasClass(b.target,h.expandButton)||c.Dom.hasClass(b.target,h.collapseButton)||c.Dom.hasClass(b.target,h.levelTrigger)){var d,f,g,i,j=b.target,k=j.id.split("-"),l=[],m=function(a){a&&(j=a),k=j.id.split("-"),d=k[1],f=parseInt(j.getAttribute("data-level"),10),g=j.getAttribute("data-type"),i=parseInt(j.getAttribute("data-hidden")),i=isNaN(i)?1:i?0:1,j.setAttribute("data-hidden",i.toString()),l.push(o(d))};if(j.className.indexOf(h.levelTrigger)>-1){for(var n,p=[],q=[],r=j.id.indexOf("Rows")>-1?"rows":"cols",t=1,v=e[r];v>=t;t++)if(n="rows"==r?u(t):s(t),t>=parseInt(k[1],10))for(var w=0,x=n.length;x>w;w++)q.push(n[w]);else for(var w=0,x=n.length;x>w;w++)p.push(n[w]);z(!0,q),z(!1,p)}else m(),z(i,l);g=g||r;var y=D(g),A=g.charAt(0).toUpperCase()+g.slice(1),B=c.Grouping["baseSpare"+A];y?0==B&&(a.alter("insert_"+g.slice(0,-1),a["count"+A]()),c.Grouping["dummy"+g.slice(0,-1)]=!0):0==B&&c.Grouping["dummy"+g.slice(0,-1)]&&(a.alter("remove_"+g.slice(0,-1),a["count"+A]()-1),c.Grouping["dummy"+g.slice(0,-1)]=!1),a.render(),b.stopImmediatePropagation()}},modifySelectionFactory:function(a){var b,c=this.instance,d=new n(0,0),e=function(a,b){var c=0;switch(a){case"down":for(;G(b);)c++,b.row+=1;break;case"up":for(;G(b);)c--,b.row-=1;break;case"right":for(;G(b);)c++,b.col+=1;break;case"left":for(;G(b);)c--,b.col-=1}return c},f=function(a,b){a.row>0?G(b)&&(a.row+=e("down",b)):a.row<0&&G(b)&&(a.row+=e("up",b)),a.col>0?G(b)&&(a.col+=e("right",b)):a.col<0&&G(b)&&(a.col+=e("left",b))};switch(a){case"start":return function(a){b=c.getSelected(),d.row=b[0]+a.row,d.col=b[1]+a.col,f(a,d)};case"end":return function(a){b=c.getSelected(),d.row=b[2]+a.row,d.col=b[3]+a.col,f(a,d)}}},modifyRowHeight:function(b,c){return a.view.wt.wtTable.rowFilter&&G({row:c,col:null})?0:void 0},validateGroups:function(){for(var b=function(a,b){return a[0]b[0]&&b[1]f;f++)if(c[f].rows){if(1===c[f].rows.length)throw new Error("Grouping error: Group {"+c[f].rows[0]+"} is invalid. Cannot define single-entry groups.");if(0===c[f].rows.length)throw new Error("Grouping error: Cannot define empty groups.");e.push(c[f].rows);for(var h=0,i=e.length;i>h;h++)if(b(c[f].rows,e[h]))throw new Error("Grouping error: ranges {"+c[f].rows[0]+", "+c[f].rows[1]+"} and {"+e[h][0]+", "+e[h][1]+"} are overlapping.")}else if(c[f].cols){if(1===c[f].cols.length)throw new Error("Grouping error: Group {"+c[f].cols[0]+"} is invalid. Cannot define single-entry groups.");if(0===c[f].cols.length)throw new Error("Grouping error: Cannot define empty groups.");d.push(c[f].cols);for(var h=0,j=d.length;j>h;h++)if(b(c[f].cols,d[h]))throw new Error("Grouping error: ranges {"+c[f].cols[0]+", "+c[f].cols[1]+"} and {"+d[h][0]+", "+d[h][1]+"} are overlapping.")}return!0},afterGetRowHeaderRenderers:function(a){c.Grouping.groupIndicatorsFactory(a,"vertical")},afterGetColumnHeaderRenderers:function(a){c.Grouping.groupIndicatorsFactory(a,"horizontal")},hookProxy:function(b,d){return function(){return a.getSettings().groups?d?c.Grouping[b](d).apply(this,arguments):c.Grouping[b].apply(this,arguments):void 0}}}},N=function(){var a=this,b=!!a.getSettings().groups;if(b){var d={};c.Grouping=new ab(a),a.getSettings().rowHeaders||(d.rowHeaders=!0),a.getSettings().colHeaders||(d.colHeaders=!0),(d.colHeaders||d.rowHeaders)&&a.updateSettings(d);var e=c.Grouping.validateGroups();if(!e)return;a.addHook("beforeInit",c.Grouping.hookProxy("init")),a.addHook("afterUpdateSettings",c.Grouping.hookProxy("updateGroups")),a.addHook("afterGetColumnHeaderRenderers",c.Grouping.hookProxy("afterGetColumnHeaderRenderers")),a.addHook("afterGetRowHeaderRenderers",c.Grouping.hookProxy("afterGetRowHeaderRenderers")),a.addHook("afterGetRowHeader",c.Grouping.hookProxy("afterGetRowHeader")),a.addHook("afterGetColHeader",c.Grouping.hookProxy("afterGetColHeader")),a.addHook("beforeOnCellMouseDown",c.Grouping.hookProxy("toggleGroupVisibility")),a.addHook("modifyTransformStart",c.Grouping.hookProxy("modifySelectionFactory","start")),a.addHook("modifyTransformEnd",c.Grouping.hookProxy("modifySelectionFactory","end")),a.addHook("modifyRowHeight",c.Grouping.hookProxy("modifyRowHeight"))}},bb=function(){for(var a=document.querySelectorAll("colgroup"),b=0,d=a.length;d>b;b++){var e=a[b].querySelectorAll("col.rowHeader");if(0==e.length)return;for(var f=0,g=e.length+1;g>f;f++){if(2==g)return;ff;f++)if("copy"===e[f].key){this.zeroClipboardInstance=new ZeroClipboard(a.getCell(f,0)),this.zeroClipboardInstance.off(),this.zeroClipboardInstance.on("copy",function(a){var b=a.clipboardData;b.setData("text/plain",c.copy()),c.instance.getSettings().outsideClickDeselects=c.outsideClickDeselectsCache}),d.bindEvents();break}},c.prototype.bindEvents=function(){var c=this;c.cmInstance&&(a(document).off("mouseenter."+c.cmInstance.guid).on("mouseenter."+c.cmInstance.guid,"#global-zeroclipboard-flash-bridge",function(){var a=c.cmInstance.rootElement[0].querySelector("td.current");a&&b.Dom.removeClass(a,"current"),c.outsideClickDeselectsCache=c.instance.getSettings().outsideClickDeselects,c.instance.getSettings().outsideClickDeselects=!1}),a(document).off("mouseleave."+c.cmInstance.guid).on("mouseleave."+c.cmInstance.guid,"#global-zeroclipboard-flash-bridge",function(){var a=c.cmInstance.rootElement[0].querySelector("td.zeroclipboard-is-hover");a&&b.Dom.removeClass(a,"zeroclipboard-is-hover"),c.instance.getSettings().outsideClickDeselects=c.outsideClickDeselectsCache}))},c.prototype.init=function(){if(this.getSettings().contextMenuCopyPaste){if("object"==typeof this.getSettings().contextMenuCopyPaste&&(d.swfPath=this.getSettings().contextMenuCopyPaste.swfPath),"undefined"==typeof ZeroClipboard)throw new Error("To be able to use the Copy/Paste feature from the context menu, you need to manualy include ZeroClipboard.js file to your website.");try{{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}}catch(a){if("undefined"==typeof navigator.mimeTypes["application/x-shockwave-flash"])throw new Error("To be able to use the Copy/Paste feature from the context menu, your browser needs to have Flash Plugin installed.")}d.instance=this,d.prepareZeroClipboard()}};var d=new c;b.hooks.add("afterRender",function(){d.setupZeroClipboard(this)}),b.hooks.add("afterInit",d.init),b.hooks.add("afterContextMenuDefaultOptions",d.addToContextMenu),b.ContextMenuCopyPaste=c}(c),k.prototype.init=function(){this.TABLE=this.instance.wtTable.TABLE,this.fixed=this.instance.wtTable.hider,this.fixedContainer=this.instance.wtTable.holder,this.scrollHandler=this.getScrollableElement(this.TABLE),this.$scrollHandler=a(this.scrollHandler)},k.prototype.makeClone=function(a){var b=document.createElement("DIV");b.className="ht_clone_"+a+" handsontable",b.style.position="absolute",b.style.overflow="hidden";var c=document.createElement("TABLE");return c.className=this.instance.wtTable.TABLE.className,b.appendChild(c),this.instance.wtTable.holder.parentNode.appendChild(b),new r({cloneSource:this.instance,cloneOverlay:this,table:c})},k.prototype.getScrollableElement=function(a){for(var c=a.parentNode;c&&c.style;){if("visible"!==c.style.overflow&&""!==c.style.overflow)return c;if(this instanceof z&&"visible"!==c.style.overflowX&&""!==c.style.overflowX)return c;c=c.parentNode}return b},k.prototype.refresh=function(a){this.clone&&this.clone.draw(a)},k.prototype.destroy=function(){this.$scrollHandler.off("."+this.clone.guid),a(b).off("."+this.clone.guid),a(document).off("."+this.clone.guid),a(document.body).off("."+this.clone.guid)},l.prototype.getSize=function(a){return this.cellSizes[a]},l.prototype.getContainerSize=function(a){return"function"==typeof this.containerSizeFn?this.containerSizeFn(a):this.containerSizeFn},l.prototype.countVisible=function(){return this.cellCount},l.prototype.isLastIncomplete=function(){return this.remainingSize>0},m.prototype.appear=function(a){var b,d,e,f,g,h,i,j,k,l,m,o;if(!this.disabled){var p,q,r,s,t,u,v,w=this.instance;for(u=w.cloneOverlay instanceof A||w.cloneOverlay instanceof y?w.getSetting("fixedRowsTop"):w.wtTable.getRowStrategy().countVisible(),t=0;u>t;t++)if(v=w.wtTable.rowFilter.visibleToSource(t),v>=a[0]&&v<=a[2]){p=v;break}for(t=u-1;t>=0;t--)if(v=w.wtTable.rowFilter.visibleToSource(t),v>=a[0]&&v<=a[2]){r=v;break}for(u=w.cloneOverlay instanceof z||w.cloneOverlay instanceof y?w.getSetting("fixedColumnsLeft"):w.wtTable.getColumnStrategy().cellCount,t=0;u>t;t++)if(v=w.wtTable.columnFilter.visibleToSource(t),v>=a[1]&&v<=a[3]){q=v; break}for(t=u-1;t>=0;t--)if(v=w.wtTable.columnFilter.visibleToSource(t),v>=a[1]&&v<=a[3]){s=v;break}if(void 0===p||void 0===q)return void this.disappear();b=p!==r||q!==s,d=w.wtTable.getCell(new n(p,q)),e=b?w.wtTable.getCell(new n(r,s)):d,f=c.Dom.offset(d),g=b?c.Dom.offset(e):f,h=c.Dom.offset(w.wtTable.TABLE),j=f.top,m=g.top+c.Dom.outerHeight(e)-j,l=f.left,o=g.left+c.Dom.outerWidth(e)-l,i=j-h.top-1,k=l-h.left-1;var x=c.Dom.getComputedStyle(d);parseInt(x.borderTopWidth,10)>0&&(i+=1,m=m>0?m-1:0),parseInt(x.borderLeftWidth,10)>0&&(k+=1,o=o>0?o-1:0),this.topStyle.top=i+"px",this.topStyle.left=k+"px",this.topStyle.width=o+"px",this.topStyle.display="block",this.leftStyle.top=i+"px",this.leftStyle.left=k+"px",this.leftStyle.height=m+"px",this.leftStyle.display="block";var B=Math.floor(this.settings.border.width/2);this.bottomStyle.top=i+m-B+"px",this.bottomStyle.left=k+"px",this.bottomStyle.width=o+"px",this.bottomStyle.display="block",this.rightStyle.top=i+"px",this.rightStyle.left=k+o-B+"px",this.rightStyle.height=m+1+"px",this.rightStyle.display="block",this.hasSetting(this.settings.border.cornerVisible)?(this.cornerStyle.top=i+m-4+"px",this.cornerStyle.left=k+o-4+"px",this.cornerStyle.display="block"):this.cornerStyle.display="none"}},m.prototype.disappear=function(){this.topStyle.display="none",this.leftStyle.display="none",this.bottomStyle.display="none",this.rightStyle.display="none",this.cornerStyle.display="none"},m.prototype.hasSetting=function(a){return"function"==typeof a?a():!!a},n.prototype.isValid=function(a){return this.row<0||this.col<0?!1:this.row>=a.getSetting("totalRows")||this.col>=a.getSetting("totalColumns")?!1:!0},n.prototype.isEqual=function(a){return a===this?!0:this.row===a.row&&this.col===a.col},n.prototype.isSouthEastOf=function(a){return this.row>=a.row&&this.col>=a.col},n.prototype.isNorthWestOf=function(a){return this.row<=a.row&&this.col<=a.col},n.prototype.isSouthWestOf=function(a){return this.row>=a.row&&this.col<=a.col},n.prototype.isNorthEastOf=function(a){return this.row<=a.row&&this.col>=a.col},b.WalkontableCellCoords=n,o.prototype.isValid=function(a){return this.from.isValid(a)&&this.to.isValid(a)},o.prototype.isSingle=function(){return this.from.row===this.to.row&&this.from.col===this.to.col},o.prototype.includes=function(a){var b=this.getTopLeftCorner(),c=this.getBottomRightCorner();return a.row<0&&(a.row=0),a.col<0&&(a.col=0),b.row<=a.row&&c.row>=a.row&&b.col<=a.col&&c.col>=a.col},o.prototype.includesRange=function(a){return this.includes(a.getTopLeftCorner())&&this.includes(a.getBottomRightCorner())},o.prototype.isEqual=function(a){return Math.min(this.from.row,this.to.row)==Math.min(a.from.row,a.to.row)&&Math.max(this.from.row,this.to.row)==Math.max(a.from.row,a.to.row)&&Math.min(this.from.col,this.to.col)==Math.min(a.from.col,a.to.col)&&Math.max(this.from.col,this.to.col)==Math.max(a.from.col,a.to.col)},o.prototype.overlaps=function(a){return a.isSouthEastOf(this.getTopLeftCorner())&&a.isNorthWestOf(this.getBottomRightCorner())},o.prototype.isSouthEastOf=function(a){return this.getTopLeftCorner().isSouthEastOf(a)||this.getBottomRightCorner().isSouthEastOf(a)},o.prototype.isNorthWestOf=function(a){return this.getTopLeftCorner().isNorthWestOf(a)||this.getBottomRightCorner().isNorthWestOf(a)},o.prototype.expand=function(a){var b=this.getTopLeftCorner(),c=this.getBottomRightCorner();return a.rowc.row||a.col>c.col?(this.from=new n(Math.min(b.row,a.row),Math.min(b.col,a.col)),this.to=new n(Math.max(c.row,a.row),Math.max(c.col,a.col)),!0):!1},o.prototype.expandByRange=function(a){if(this.includesRange(a)||!this.overlaps(a))return!1;var b=this.getTopLeftCorner(),c=this.getBottomRightCorner(),d=(this.getTopRightCorner(),this.getBottomLeftCorner(),a.getTopLeftCorner()),e=a.getBottomRightCorner(),f=Math.min(b.row,d.row),g=Math.min(b.col,d.col),h=Math.max(c.row,e.row),i=Math.max(c.col,e.col),j=new n(f,g),k=new n(h,i),l=new o(j,j,k).isCorner(this.from,a),m=a.isEqual(new o(j,j,k));return l&&!m&&(this.from.col>j.col&&(j.col=i,k.col=g),this.from.row>j.row&&(j.row=h,k.row=f)),this.from=j,this.to=k,!0},o.prototype.getDirection=function(){return this.from.isNorthWestOf(this.to)?"NW-SE":this.from.isNorthEastOf(this.to)?"NE-SW":this.from.isSouthEastOf(this.to)?"SE-NW":this.from.isSouthWestOf(this.to)?"SW-NE":void 0},o.prototype.setDirection=function(a){switch(a){case"NW-SE":this.from=this.getTopLeftCorner(),this.to=this.getBottomRightCorner();break;case"NE-SW":this.from=this.getTopRightCorner(),this.to=this.getBottomLeftCorner();break;case"SE-NW":this.from=this.getBottomRightCorner(),this.to=this.getTopLeftCorner();break;case"SW-NE":this.from=this.getBottomLeftCorner(),this.to=this.getTopRightCorner()}},o.prototype.getTopLeftCorner=function(){return new n(Math.min(this.from.row,this.to.row),Math.min(this.from.col,this.to.col))},o.prototype.getBottomRightCorner=function(){return new n(Math.max(this.from.row,this.to.row),Math.max(this.from.col,this.to.col))},o.prototype.getTopRightCorner=function(){return new n(Math.min(this.from.row,this.to.row),Math.max(this.from.col,this.to.col))},o.prototype.getBottomLeftCorner=function(){return new n(Math.max(this.from.row,this.to.row),Math.min(this.from.col,this.to.col))},o.prototype.isCorner=function(a,b){return b&&b.includes(a)&&(this.getTopLeftCorner().isEqual(new n(b.from.row,b.from.col))||this.getTopRightCorner().isEqual(new n(b.from.row,b.to.col))||this.getBottomLeftCorner().isEqual(new n(b.to.row,b.from.col))||this.getBottomRightCorner().isEqual(new n(b.to.row,b.to.col)))?!0:a.isEqual(this.getTopLeftCorner())||a.isEqual(this.getTopRightCorner())||a.isEqual(this.getBottomLeftCorner())||a.isEqual(this.getBottomRightCorner())},o.prototype.getOppositeCorner=function(a,b){if(!(a instanceof n))return!1;if(b&&b.includes(a)){if(this.getTopLeftCorner().isEqual(new n(b.from.row,b.from.col)))return this.getBottomRightCorner();if(this.getTopRightCorner().isEqual(new n(b.from.row,b.to.col)))return this.getBottomLeftCorner();if(this.getBottomLeftCorner().isEqual(new n(b.to.row,b.from.col)))return this.getTopRightCorner();if(this.getBottomRightCorner().isEqual(new n(b.to.row,b.to.col)))return this.getTopLeftCorner()}return a.isEqual(this.getBottomRightCorner())?this.getTopLeftCorner():a.isEqual(this.getTopLeftCorner())?this.getBottomRightCorner():a.isEqual(this.getTopRightCorner())?this.getBottomLeftCorner():a.isEqual(this.getBottomLeftCorner())?this.getTopRightCorner():void 0},o.prototype.getBordersSharedWith=function(a){if(!this.includesRange(a))return[];var b={top:Math.min(this.from.row,this.to.row),bottom:Math.max(this.from.row,this.to.row),left:Math.min(this.from.col,this.to.col),right:Math.max(this.from.col,this.to.col)},c={top:Math.min(a.from.row,a.to.row),bottom:Math.max(a.from.row,a.to.row),left:Math.min(a.from.col,a.to.col),right:Math.max(a.from.col,a.to.col)},d=[];return b.top==c.top&&d.push("top"),b.right==c.right&&d.push("right"),b.bottom==c.bottom&&d.push("bottom"),b.left==c.left&&d.push("left"),d},o.prototype.getInner=function(){for(var a=this.getTopLeftCorner(),b=this.getBottomRightCorner(),c=[],d=a.row;d<=b.row;d++)for(var e=a.col;e<=b.col;e++)this.from.row===d&&this.from.col===e||this.to.row===d&&this.to.col===e||c.push(new n(d,e));return c},o.prototype.getAll=function(){for(var a=this.getTopLeftCorner(),b=this.getBottomRightCorner(),c=[],d=a.row;d<=b.row;d++)for(var e=a.col;e<=b.col;e++)c.push(a.row===d&&a.col===e?a:b.row===d&&b.col===e?b:new n(d,e));return c},o.prototype.forAll=function(a){for(var b=this.getTopLeftCorner(),c=this.getBottomRightCorner(),d=b.row;d<=c.row;d++)for(var e=b.col;e<=c.col;e++){var f=a(d,e);if(f===!1)return}},b.WalkontableCellRange=o,p.prototype.visibleToSource=function(a){return a},p.prototype.sourceToVisible=function(a){return a},p.prototype.offsettedTH=function(a){return a-this.countTH},p.prototype.unOffsettedTH=function(a){return a+this.countTH},p.prototype.visibleRowHeadedColumnToSourceColumn=function(a){return this.visibleToSource(this.offsettedTH(a))},p.prototype.sourceColumnToVisibleRowHeadedColumn=function(a){return this.unOffsettedTH(this.sourceToVisible(a))},q.prototype=new l,q.prototype.getSize=function(a){return this.cellSizes[a]+(this.cellStretch[a]||0)},q.prototype.stretch=function(){var a,b=0;if(a=this.instance.wtTable.allRowsInViewport()?this.getContainerSize():this.getContainerSize(1/0),this.remainingSize=this.cellSizesSum-a,this.cellStretch.length=0,"all"===this.strategy){if(this.remainingSize<0){for(var c,d=a/this.cellSizesSum;b=g},r.prototype.draw=function(a){if(this.drawInterrupted=!1,!a&&!c.Dom.isVisible(this.wtTable.TABLE))return void(this.drawInterrupted=!0);a=a&&this.getSetting("offsetRow")===this.lastOffsetRow,this.lastOffsetRow=this.getSetting("offsetRow");var b=this.getSetting("totalRows");return this.lastOffsetRow>b&&b>0&&(this.scrollVertical(-1/0),this.scrollViewport(new n(b-1,0))),this.wtTable.draw(a),this},r.prototype.update=function(a,b){return this.wtSettings.update(a,b)},r.prototype.scrollVertical=function(a){var b=this.wtScroll.scrollVertical(a);return this.getSetting("onScrollVertically"),b},r.prototype.scrollHorizontal=function(a){var b=this.wtScroll.scrollHorizontal(a);return this.getSetting("onScrollHorizontally"),b},r.prototype.scrollViewport=function(a){return this.wtScroll.scrollViewport(a),this},r.prototype.getViewport=function(){return[this.wtTable.getFirstVisibleRow(),this.wtTable.getFirstVisibleColumn(),this.wtTable.getLastVisibleRow(),this.wtTable.getLastVisibleColumn()]},r.prototype.getSetting=function(a,b,c,d,e){return this.wtSettings.getSetting(a,b,c,d,e)},r.prototype.hasSetting=function(a){return this.wtSettings.has(a)},r.prototype.destroy=function(){a(b).off("."+this.guid),a(document.body).off("."+this.guid),this.wtScrollbars.destroy(),this.wtEvent&&this.wtEvent.destroy()},s.prototype=new k,s.prototype.resetFixedPosition=function(){if(this.instance.wtTable.holder.parentNode){var a=this.clone.wtTable.holder.parentNode,b=this.instance.wtTable.holder.getBoundingClientRect();a.style.top=Math.ceil(b.top,10)+"px",a.style.left=Math.ceil(b.left,10)+"px"}},s.prototype.destroy=function(){k.prototype.destroy.call(this),clearTimeout(this.lastTimeout)},t.prototype.parentCell=function(a){var b={},d=this.instance.wtTable.TABLE,e=c.Dom.closest(a,["TD","TH"],d);return e&&c.Dom.isChildOf(e,d)?(b.coords=this.instance.wtTable.getCoords(e),b.TD=e):c.Dom.hasClass(a,"wtBorder")&&c.Dom.hasClass(a,"current")?(b.coords=this.instance.selections[0].cellRange.highlight,b.TD=this.instance.wtTable.getCell(b.coords)):c.Dom.hasClass(a,"wtBorder")&&c.Dom.hasClass(a,"area")&&(b.coords=this.instance.selections[1].cellRange.to,b.TD=this.instance.wtTable.getCell(b.coords)),b},t.prototype.destroy=function(){clearTimeout(this.dblClickTimeout[0]),clearTimeout(this.dblClickTimeout[1])},b.requestAnimFrame=function(){return b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){return b.setTimeout(a,1e3/60)}}(),b.cancelRequestAnimFrame=function(){return b.cancelAnimationFrame||b.webkitCancelRequestAnimationFrame||b.mozCancelRequestAnimationFrame||b.oCancelRequestAnimationFrame||b.msCancelRequestAnimationFrame||clearTimeout}(),b.getComputedStyle||!function(){var a,c={getPropertyValue:function(b){return"float"==b&&(b="styleFloat"),a.currentStyle[b.toUpperCase()]||null}};b.getComputedStyle=function(b){return a=b,c}}(),!String.prototype.trim){var cb=/^\s+|\s+$/g;String.prototype.trim=function(){return this.replace(cb,"")}}v.prototype.offsetted=function(a){return a+this.offset},v.prototype.unOffsetted=function(a){return a-this.offset},v.prototype.visibleToSource=function(a){return this.offsetted(a)},v.prototype.sourceToVisible=function(a){return this.unOffsetted(a)},v.prototype.offsettedTH=function(a){return a-this.countTH},v.prototype.visibleColHeadedRowToSourceRow=function(a){return this.visibleToSource(this.offsettedTH(a))},v.prototype.sourceRowToVisibleColHeadedRow=function(a){return this.unOffsettedTH(this.sourceToVisible(a))},w.prototype=new l,w.prototype.add=function(a,b){if(!this.canRenderMoreRows())return!1;var c=this.sizeAtIndex(a,b);if(void 0===c)return!1;var d=this.getContainerSize(this.cellSizesSum+c);return this.cellSizes.push(c),this.cellSizesSum+=c,this.cellCount++,this.remainingSize=this.cellSizesSum-d,this.remainingSize<=c&&this.visiblCellCount++,!0},w.prototype.canRenderMoreRows=function(){return this.remainingSize<=0||this.cellCount-this.visiblCellCountthis.curOuts;)this.remove()},w.prototype.countRendered=function(){return this.cellCount},w.prototype.countVisible=function(){return this.visiblCellCount},w.prototype.isLastIncomplete=function(){var a=this.instance.wtTable.getLastVisibleRow(),b=this.instance.wtTable.getFirstVisibleColumn(),d=this.instance.wtTable.getCell(new n(a,b)),e=c.Dom.offset(d).top,f=c.Dom.outerHeight(d),g=e+f,h=this.instance.wtScrollbars.horizontal.scrollHandler.offsetTop+this.instance.wtScrollbars.vertical.getScrollPosition(),i=this.instance.wtViewport.getViewportHeight(),j=h+i;return g>j},x.prototype.scrollVertical=function(a){if(!this.instance.drawn)throw new Error("scrollVertical can only be called after table was drawn to DOM");var b,c=this.instance,d=c.getSetting("offsetRow"),e=c.getSetting("fixedRowsTop"),f=c.getSetting("totalRows"),g=c.wtViewport.getViewportHeight();return b=f>0&&!this.instance.wtTable.isLastRowFullyVisible()?this.scrollLogicVertical(a,d,f,e,g,function(a){return e>a-d&&a-d>=0?c.getSetting("rowHeight",a-d):c.getSetting("rowHeight",a)}):0,b!==d&&this.instance.wtScrollbars.vertical.scrollTo(b),c},x.prototype.scrollHorizontal=function(a){return this.instance.wtScrollbars.horizontal.scrollTo(a),this.instance},x.prototype.scrollLogicVertical=function(a,b,c,d){var e=b+a;return e>=c-d&&(e=c-d-1),0>e&&(e=0),e},x.prototype.scrollViewport=function(a){if(this.instance.drawn){var b=(this.instance.getSetting("offsetRow"),this.instance.getSetting("totalRows")),c=this.instance.getSetting("totalColumns");if(a.row<0||a.row>b-1)throw new Error("row "+a.row+" does not exist");if(a.col<0||a.col>c-1)throw new Error("column "+a.col+" does not exist");var d=this.instance.wtTable.getCell(a);"object"==typeof d?a.col>=this.instance.getSetting("fixedColumnsLeft")&&this.scrollToRenderedCell(d):a.row>=this.instance.wtTable.getLastVisibleRow()?(this.scrollVertical(a.row-this.instance.wtTable.getLastVisibleRow()),a.row==this.instance.wtTable.getLastVisibleRow()&&this.instance.wtTable.getRowStrategy().isLastIncomplete()&&this.scrollViewport(a)):a.row>=this.instance.getSetting("fixedRowsTop")&&this.scrollVertical(a.row-this.instance.wtTable.getFirstVisibleRow())}},x.prototype.scrollToRenderedCell=function(a){var d=c.Dom.offset(a),e=c.Dom.outerWidth(a),f=c.Dom.outerHeight(a),g=c.Dom.offset(this.instance.wtTable.TABLE),h={left:this.instance.wtScrollbars.horizontal.getScrollPosition(),top:this.instance.wtScrollbars.vertical.getScrollPosition()},i=this.instance.wtViewport.getWorkspaceWidth(),j=this.instance.wtViewport.getWorkspaceHeight(),k=c.Dom.outerWidth(this.instance.wtScrollbars.horizontal.clone.wtTable.TABLE),l=c.Dom.outerHeight(this.instance.wtScrollbars.vertical.clone.wtTable.TABLE);if(this.instance.wtScrollbars.horizontal.scrollHandler!==b&&(g.left=0,d.left-=c.Dom.offset(this.instance.wtScrollbars.horizontal.scrollHandler).left),this.instance.wtScrollbars.vertical.scrollHandler!==b&&(g.top=0,d.top=d.top-c.Dom.offset(this.instance.wtScrollbars.vertical.scrollHandler).top),i>e)if(d.leftg.left+h.left+i){var m=d.left+e-(g.left+h.left+i);this.instance.wtScrollbars.horizontal.setScrollPosition(h.left+m)}j>f&&(d.toph.top+j&&(this.instance.wtScrollbars.vertical.setScrollPosition(d.top-j+f),this.instance.wtScrollbars.vertical.onScroll()))},y.prototype=new k,y.prototype.resetFixedPosition=function(){if(this.instance.wtTable.holder.parentNode){var a=this.clone.wtTable.holder.parentNode;if(this.scrollHandler===b){var d=this.instance.wtTable.holder.getBoundingClientRect(),e=Math.ceil(d.top),f=Math.ceil(d.left);a.style.left=0>f?-f+"px":"0",a.style.top=0>e?-e+"px":"0"}else a.style.top=this.instance.wtScrollbars.vertical.getScrollPosition()+"px",a.style.left=this.instance.wtScrollbars.horizontal.getScrollPosition()+"px";a.style.width=c.Dom.outerWidth(this.clone.wtTable.TABLE)+4+"px",a.style.height=c.Dom.outerHeight(this.clone.wtTable.TABLE)+4+"px"}},z.prototype=new k,z.prototype.resetFixedPosition=function(){if(this.instance.wtTable.holder.parentNode){var a=this.clone.wtTable.holder.parentNode;if(this.scrollHandler===b){var d=this.instance.wtTable.holder.getBoundingClientRect(),e=Math.ceil(d.left);a.style.left=0>e?-e+"px":"0",a.style.top=this.instance.wtTable.hider.style.top}else a.style.top=this.instance.wtTable.hider.style.top,a.style.left=this.getScrollPosition()+"px";a.style.height=c.Dom.outerHeight(this.clone.wtTable.TABLE)+"px",a.style.width=c.Dom.outerWidth(this.clone.wtTable.TABLE)+4+"px"}},z.prototype.refresh=function(a){k.prototype.refresh.call(this,a)},z.prototype.getScrollPosition=function(){return c.Dom.getScrollLeft(this.scrollHandler)},z.prototype.setScrollPosition=function(a){this.scrollHandler===b?b.scrollTo(a,c.Dom.getWindowScrollTop()):this.scrollHandler.scrollLeft=a},z.prototype.onScroll=function(){this.readSettings(),this.instance.getSetting("onScrollHorizontally")},z.prototype.getLastCell=function(){return this.instance.wtTable.getLastVisibleColumn()},z.prototype.applyToDOM=function(){},z.prototype.scrollTo=function(a){this.setScrollPosition(this.getTableParentOffset()+a*this.cellSize)},z.prototype.getTableParentOffset=function(){return this.scrollHandler===b?this.instance.wtTable.holderOffset.left:0},z.prototype.readSettings=function(){this.total=this.instance.getSetting("totalColumns")},A.prototype=new k,A.prototype.resetFixedPosition=function(){if(this.instance.wtTable.holder.parentNode){var a=this.clone.wtTable.holder.parentNode;if(this.scrollHandler===b){var d=this.instance.wtTable.holder.getBoundingClientRect(),e=Math.ceil(d.top);a.style.left="0",a.style.top=0>e?-e+"px":"0"}else a.style.top=this.getScrollPosition()+"px",a.style.left="0";a.style.width=this.instance.wtScrollbars.horizontal.scrollHandler===b?this.instance.wtViewport.getWorkspaceActualWidth()+"px":c.Dom.outerWidth(this.clone.wtTable.TABLE)+"px",a.style.height=c.Dom.outerHeight(this.clone.wtTable.TABLE)+4+"px"}},A.prototype.getScrollPosition=function(){return c.Dom.getScrollTop(this.scrollHandler)},A.prototype.setScrollPosition=function(a){this.scrollHandler===b?b.scrollTo(c.Dom.getWindowScrollLeft(),a):this.scrollHandler.scrollTop=a},A.prototype.onScroll=function(){this.readSettings(),this.instance.draw(!0),this.instance.getSetting("onScrollVertically")},A.prototype.getLastCell=function(){return this.instance.getSetting("offsetRow")+this.instance.wtTable.tbodyChildrenLength-1},A.prototype.sumCellSizes=function(a,b){for(var c,d=0;b>a;)c=this.instance.wtSettings.settings.rowHeight(a),d+=void 0!==c?c:this.instance.wtSettings.settings.defaultRowHeight,a++;return d},A.prototype.refresh=function(a){this.applyToDOM(),k.prototype.refresh.call(this,a)},A.prototype.applyToDOM=function(){var a=this.getLastCell();this.measureBefore=this.sumCellSizes(0,this.offset),this.measureAfter=-1===a?0:this.sumCellSizes(a,this.total-a);var b=this.instance.wtViewport.getColumnHeaderHeight();this.fixedContainer.style.height=b+this.sumCellSizes(0,this.total)+4+"px",this.fixed.style.top=this.measureBefore+"px",this.fixed.style.bottom=""},A.prototype.scrollTo=function(a){var b=this.getTableParentOffset()+a*this.cellSize;this.setScrollPosition(b),this.onScroll()},A.prototype.getTableParentOffset=function(){return this.scrollHandler===b?this.instance.wtTable.holderOffset.top:0},A.prototype.readSettings=function(){this.offset=this.instance.getSetting("offsetRow"),this.total=this.instance.getSetting("totalRows");for(var a,b,c=this.getScrollPosition()-this.getTableParentOffset(),d=0,e=0;ec));e++);this.offset=Math.min(e,this.total),this.instance.update("offsetRow",this.offset)},B.prototype.registerListeners=function(){function c(){if(h.instance.drawn){if(!h.instance.wtTable.holder.parentNode)return void h.destroy();h.vertical.windowScrollPosition=h.vertical.getScrollPosition(),h.horizontal.windowScrollPosition=h.horizontal.getScrollPosition(),h.box=h.instance.wtTable.hider.getBoundingClientRect(),(h.vertical.windowScrollPosition!==d||h.horizontal.windowScrollPosition!==e||h.box.top!==f||h.box.left!==g)&&(h.vertical.onScroll(),h.horizontal.onScroll(),d=h.vertical.windowScrollPosition,e=h.horizontal.windowScrollPosition,f=h.box.top,g=h.box.left)}}var d,e,f,g,h=this,i=a(b);this.vertical.$scrollHandler.on("scroll."+this.instance.guid,c),this.vertical.scrollHandler!==this.horizontal.scrollHandler&&this.horizontal.$scrollHandler.on("scroll."+this.instance.guid,c),this.vertical.scrollHandler!==b&&this.horizontal.scrollHandler!==b&&i.on("scroll."+this.instance.guid,c)},B.prototype.destroy=function(){this.vertical&&(this.vertical.destroy(),this.vertical.$scrollHandler.off("scroll."+this.instance.guid)),this.horizontal&&(this.horizontal.destroy(),this.vertical.$scrollHandler.off("scroll."+this.instance.guid)),a(b).off("scroll."+this.instance.guid),this.corner&&this.corner.destroy(),this.debug&&this.debug.destroy()},B.prototype.refresh=function(a){this.horizontal&&this.horizontal.readSettings(),this.vertical&&this.vertical.readSettings(),this.horizontal&&this.horizontal.refresh(a),this.vertical&&this.vertical.refresh(a),this.corner&&this.corner.refresh(a),this.debug&&this.debug.refresh(a)},B.prototype.applyToDOM=function(){this.horizontal&&this.horizontal.applyToDOM(),this.vertical&&this.vertical.applyToDOM()},C.prototype.getBorder=function(a){return this.instanceBorders[a.guid]?this.instanceBorders[a.guid]:void(this.instanceBorders[a.guid]=new m(a,this.settings))},C.prototype.isEmpty=function(){return null===this.cellRange},C.prototype.add=function(a){this.isEmpty()?this.cellRange=new o(a,a,a):this.cellRange.expand(a)},C.prototype.replace=function(a,b){if(!this.isEmpty()){if(this.cellRange.from.isEqual(a))return this.cellRange.from=b,!0;if(this.cellRange.to.isEqual(a))return this.cellRange.to=b,!0}return!1},C.prototype.clear=function(){this.cellRange=null},C.prototype.getCorners=function(){var a=this.cellRange.getTopLeftCorner(),b=this.cellRange.getBottomRightCorner();return[a.row,a.col,b.row,b.col]},C.prototype.addClassAtCoords=function(a,b,d,e){var f=a.wtTable.getCell(new n(b,d));"object"==typeof f&&c.Dom.addClass(f,e)},C.prototype.draw=function(a){var b,d,e,f,g,h=a.wtTable.getRowStrategy().countVisible(),i=a.wtTable.getColumnStrategy().cellCount;if(this.isEmpty()){if(this.settings.border){var j=this.getBorder(a);j&&j.disappear()}}else{for(b=this.getCorners(),d=0;h>d;d++)for(f=a.wtTable.rowFilter.visibleToSource(d),e=0;i>e;e++)if(g=a.wtTable.columnFilter.visibleToSource(e),f>=b[0]&&f<=b[2]&&g>=b[1]&&g<=b[3]){if(this.settings.className&&this.addClassAtCoords(a,f,g,this.settings.className),g===b[1]){var k=a.wtTable.getRowHeader(f);k&&c.Dom.addClass(k,this.settings.highlightRowClassName)}if(f===b[0]||f>b[0]&&0==d){var k=a.wtTable.getColumnHeader(g);k&&c.Dom.addClass(k,this.settings.highlightColumnClassName)}}else f>=b[0]&&f<=b[2]?this.addClassAtCoords(a,f,g,this.settings.highlightRowClassName):g>=b[1]&&g<=b[3]&&this.addClassAtCoords(a,f,g,this.settings.highlightColumnClassName);if(a.getSetting("onBeforeDrawBorders",b,this.settings.className),this.settings.border){var j=this.getBorder(a);j&&j.appear(b)}}},D.prototype.update=function(a,b){if(void 0===b)for(var c in a)a.hasOwnProperty(c)&&(this.settings[c]=a[c]);else this.settings[a]=b;return this.instance},D.prototype.getSetting=function(a,b,c,d,e){return"function"==typeof this.settings[a]?this.settings[a](b,c,d,e):void 0!==b&&"[object Array]"===Object.prototype.toString.call(this.settings[a])?this.settings[a][b]:this.settings[a]},D.prototype.has=function(a){return!!this.settings[a]},E.prototype.getRowStrategy=function(){return this.isWorkingOnClone()?this.instance.cloneSource.wtTable.rowStrategy:this.rowStrategy},E.prototype.getColumnStrategy=function(){return this.isWorkingOnClone()?this.instance.cloneSource.wtTable.columnStrategy:this.columnStrategy},E.prototype.isWorkingOnClone=function(){return!!this.instance.cloneSource},E.prototype.refreshHiderDimensions=function(){var a=this.spreader.style;a.position="relative",a.width="auto",a.height="auto"},E.prototype.draw=function(a){if(a)this.instance.wtScrollbars&&this.instance.wtScrollbars.refresh(!0);else{this.isWorkingOnClone()?this.tableOffset=this.instance.cloneSource.wtTable.tableOffset:(this.holderOffset=c.Dom.offset(this.holder),this.tableOffset=c.Dom.offset(this.TABLE),this.instance.wtScrollbars.vertical.readSettings(),this.instance.wtScrollbars.horizontal.readSettings(),this.instance.wtViewport.resetSettings());var b;b=this.instance.cloneOverlay instanceof s||this.instance.cloneOverlay instanceof A||this.instance.cloneOverlay instanceof y?0:this.instance.wtSettings.settings.offsetRow,this.rowFilter=new v(b,this.instance.getSetting("totalRows"),this.instance.getSetting("columnHeaders").length),this.columnFilter=new p(this.instance.getSetting("totalColumns"),this.instance.getSetting("rowHeaders").length),this._doDraw()}return this.refreshPositions(a),this.isWorkingOnClone()||(this.instance.wtScrollbars.vertical.resetFixedPosition(),this.instance.wtScrollbars.horizontal.resetFixedPosition(),this.instance.wtScrollbars.corner.resetFixedPosition(),this.instance.wtScrollbars.debug&&this.instance.wtScrollbars.debug.resetFixedPosition()),this.instance.drawn=!0,this},E.prototype._doDraw=function(){var a=new F(this);a.render()},E.prototype.refreshPositions=function(a){this.refreshHiderDimensions(),this.refreshSelections(a)},E.prototype.removeClassFromCells=function(a){for(var b=this.TABLE.querySelectorAll("."+a),d=0,e=b.length;e>d;d++)c.Dom.removeClass(b[d],a)},E.prototype.refreshSelections=function(a){if(this.instance.selections){if(a)for(var b=0,c=this.instance.selections.length;c>b;b++)this.instance.selections[b].settings.className&&this.removeClassFromCells(this.instance.selections[b].settings.className),this.instance.selections[b].settings.highlightRowClassName&&this.removeClassFromCells(this.instance.selections[b].settings.highlightRowClassName),this.instance.selections[b].settings.highlightColumnClassName&&this.removeClassFromCells(this.instance.selections[b].settings.highlightColumnClassName);for(var b=0,c=this.instance.selections.length;c>b;b++)this.instance.selections[b].draw(this.instance,a)}},E.prototype.getCell=function(a){if(this.isRowBeforeViewport(a.row))return-1;if(this.isRowAfterViewport(a.row))return-2;var b=this.TBODY.childNodes[this.rowFilter.sourceToVisible(a.row)];return b?b.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(a.col)]:void 0},E.prototype.getColumnHeader=function(a){var b=this.THEAD.childNodes[0];return b?b.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(a)]:void 0},E.prototype.getRowHeader=function(a){if(0==this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0))return null;var b=this.TBODY.childNodes[this.rowFilter.sourceToVisible(a)];return b?b.childNodes[0]:void 0},E.prototype.getCoords=function(a){var b=a.parentNode,d=c.Dom.index(b);return d=b.parentNode===this.THEAD?this.rowFilter.visibleColHeadedRowToSourceRow(d):this.rowFilter.visibleToSource(d),new n(d,this.columnFilter.visibleRowHeadedColumnToSourceColumn(a.cellIndex))},E.prototype.getTrForRow=function(a){return this.TBODY.childNodes[this.rowFilter.sourceToVisible(a)]},E.prototype.getFirstVisibleRow=function(){return this.rowFilter.visibleToSource(0)},E.prototype.getFirstVisibleColumn=function(){if(this.isWorkingOnClone())return this.instance.cloneOverlay instanceof z||this.instance.cloneOverlay instanceof y?0:this.instance.cloneSource.wtTable.getFirstVisibleColumn();var a=this.instance.wtScrollbars.horizontal.getScrollPosition(),b=this.getColumnStrategy().cellCount,c=this.TBODY.firstChild;if(!c)return 0;for(var d=0;b>d;d++)if(a-=c.childNodes[d].offsetWidth,0>a)return d;return-1},E.prototype.getLastVisibleRow=function(){var a=this.rowFilter.visibleToSource(this.getRowStrategy().countVisible()-1),b=this.instance;if(b.cloneOverlay instanceof A||b.cloneOverlay instanceof y){var c=this.instance.getSetting("fixedRowsTop");return Math.min(c-1,a)}return a},E.prototype.getLastVisibleColumn=function(){var a=this.instance;if(this.isWorkingOnClone()){if(a.cloneOverlay instanceof z||a.cloneOverlay instanceof y){var b=this.getColumnStrategy().countVisible()-1,c=a.getSetting("fixedColumnsLeft");return Math.min(c-1,b)}return this.instance.cloneSource.wtTable.getLastVisibleColumn()}var d=this.instance.wtScrollbars.horizontal.getScrollPosition(),e=d+this.instance.wtViewport.getWorkspaceWidth(1/0),f=this.getColumnStrategy().cellCount,g=this.instance.getSetting("rowHeaders").length||0,h=this.TBODY.firstChild;if(!f)return-1;for(var i=0;f+g>i;i++)if(e-=h.childNodes[i].offsetWidth,0>=e)return i-g;return i-g-1},E.prototype.isRowBeforeViewport=function(a){return this.rowFilter.sourceToVisible(a)<0&&a>=0},E.prototype.isRowAfterViewport=function(a){return a>this.getLastVisibleRow()},E.prototype.isColumnBeforeViewport=function(a){return this.columnFilter.sourceToVisible(a)<0&&a>=0},E.prototype.isColumnAfterViewport=function(a){return a>this.getLastVisibleColumn()},E.prototype.isRowInViewport=function(a){return!this.isRowBeforeViewport(a)&&!this.isRowAfterViewport(a)},E.prototype.isColumnInViewport=function(a){return!this.isColumnBeforeViewport(a)&&!this.isColumnAfterViewport(a)},E.prototype.isLastRowFullyVisible=function(){return this.getLastVisibleRow()===this.instance.getSetting("totalRows")-1&&!this.getRowStrategy().isLastIncomplete()},E.prototype.isLastColumnFullyVisible=function(){return this.getLastVisibleColumn()===this.instance.getSetting("totalColumns")-1&&!this.getColumnStrategy().isLastIncomplete()},E.prototype.getVisibleRowsCount=function(){return this.getRowStrategy().countVisible()},E.prototype.allRowsInViewport=function(){return this.getRowStrategy().cellCount==this.getVisibleRowsCount()},F.prototype.render=function(){this.wtTable.isWorkingOnClone()||this.instance.getSetting("beforeDraw",!0),this.rowHeaders=this.instance.getSetting("rowHeaders"),this.rowHeaderCount=this.rowHeaders.length,this.fixedRowsTop=this.instance.getSetting("fixedRowsTop"),this.columnHeaders=this.instance.getSetting("columnHeaders"),this.columnHeaderCount=this.columnHeaders.length;var a,b,c,d=this.instance.getSetting("totalRows"),e=this.instance.getSetting("totalColumns"),f=!1;if(e>0){var g;this.wtTable.isWorkingOnClone()&&(this.instance.cloneOverlay instanceof A||this.instance.cloneOverlay instanceof y?g=this.fixedRowsTop:this.instance.cloneOverlay instanceof z&&(g=this.wtTable.getRowStrategy().cellCount)),this.adjustAvailableNodes(),f=!0,this.renderColGroups(),this.renderColumnHeaders(),b=this.getColumnCount(),this.renderRows(d,g,b),this.wtTable.isWorkingOnClone()||(c=this.instance.wtViewport.getWorkspaceWidth(),this.instance.wtViewport.containerWidth=null,this.wtTable.getColumnStrategy().stretch()),this.adjustColumnWidths(b) }if(f||this.adjustAvailableNodes(),this.instance.cloneOverlay instanceof s||this.removeRedundantRows(),!this.wtTable.isWorkingOnClone()){if(this.markOversizedRows(),this.instance.wtScrollbars.applyToDOM(),c!==this.instance.wtViewport.getWorkspaceWidth()){this.instance.wtViewport.containerWidth=null,this.wtTable.getColumnStrategy().stretch();var h=this.instance.wtTable.columnWidthCache;for(a=0;aa;)this.TBODY.removeChild(this.TBODY.lastChild),this.wtTable.tbodyChildrenLength--},F.prototype.renderRows=function(a,b,c){for(var d,e,f,g=this.instance.getSetting("offsetRow"),h=0,i=this.rowFilter.visibleToSource(h),j=this.wtTable.isWorkingOnClone();a>i&&i>=0;){if(h>1e3)throw new Error("Security brake: Too much TRs. Please define height for your table, which will enforce scrollbars.");if(void 0!==b&&h===b)break;if(e=this.getOrCreateTrForRow(h,e),this.renderRowHeaders(i,e),this.adjustColumns(e,c+this.rowHeaderCount),d=this.renderCells(i,e,c),g=this.instance.getSetting("offsetRow"),!j){if(f=this.wtTable.getRowStrategy().add(h,d),f===!1)break;this.resetOversizedRow(i)}if(e.firstChild){var k=this.instance.getSetting("rowHeight",i);e.firstChild.style.height=k?k+"px":""}h++,i=this.rowFilter.visibleToSource(h)}},F.prototype.resetOversizedRow=function(a){this.instance.wtTable.oversizedRows&&this.instance.wtTable.oversizedRows[a]&&(this.instance.wtTable.oversizedRows[a]=void 0)},F.prototype.markOversizedRows=function(){for(var a,b,d,e,f=this.instance.wtTable.TBODY.childNodes.length;f;)f--,d=this.instance.wtTable.rowFilter.visibleToSource(f),a=this.instance.wtSettings.settings.rowHeight(d),e=this.instance.wtTable.getTrForRow(d),b=c.Dom.innerHeight(e)-1,(!a&&this.instance.wtSettings.settings.defaultRowHeighta)&&(this.instance.wtTable.oversizedRows||(this.instance.wtTable.oversizedRows={}),this.instance.wtTable.oversizedRows[d]=b)},F.prototype.renderCells=function(a,b,d){for(var e,f,g=0;d>g;g++)f=this.columnFilter.visibleToSource(g),e=0===g?b.childNodes[this.columnFilter.sourceColumnToVisibleRowHeadedColumn(f)]:e.nextSibling,"TH"==e.nodeName&&(e=this.utils.replaceThWithTd(e,b)),c.Dom.hasClass(e,"hide")||(e.className=""),e.removeAttribute("style"),this.instance.getSetting("cellRenderer",a,f,e);return e},F.prototype.adjustColumnWidths=function(a){for(var b,c=this.instance.wtTable.columnWidthCache,d=!1,e=0;a>e;e++)b=this.wtTable.isWorkingOnClone()?this.instance.cloneSource.wtTable.columnWidthCache[e]:this.wtTable.getColumnStrategy().getSize(e),b!==c[e]&&(this.COLGROUP.childNodes[e+this.rowHeaderCount].style.width=b+"px",c[e]=b,d=!0)},F.prototype.appendToTbody=function(a){this.TBODY.appendChild(a),this.wtTable.tbodyChildrenLength++},F.prototype.getOrCreateTrForRow=function(a,b){var c;return a>=this.wtTable.tbodyChildrenLength?(c=this.createRow(),this.appendToTbody(c)):c=0===a?this.TBODY.firstChild:b.nextSibling,c},F.prototype.createRow=function(){for(var a=document.createElement("TR"),b=0;bd;d++)this.renderColumnHeader(c,d,a.childNodes[d+this.rowHeaderCount])}},F.prototype.adjustColGroups=function(){for(var a=this.getColumnCount();this.wtTable.colgroupChildrenLengtha+this.rowHeaderCount;)this.COLGROUP.removeChild(this.COLGROUP.lastChild),this.wtTable.colgroupChildrenLength--,this.wtTable.columnWidthCache&&this.wtTable.columnWidthCache.splice(-1,1)},F.prototype.adjustThead=function(){var a=this.getColumnCount(),b=this.THEAD.firstChild;if(this.columnHeaders.length){for(var d=0,e=this.columnHeaders.length;e>d;d++){for(b=this.THEAD.childNodes[d],b||(b=document.createElement("TR"),this.THEAD.appendChild(b)),this.theadChildrenLength=b.childNodes.length;this.theadChildrenLengtha+this.rowHeaderCount;)b.removeChild(b.lastChild),this.theadChildrenLength--}var f=this.THEAD.childNodes.length;if(f>this.columnHeaders.length)for(var d=this.columnHeaders.length;f>d;d++)this.THEAD.removeChild(this.THEAD.lastChild)}else b&&c.Dom.empty(b)},F.prototype.getTrForColumnHeaders=function(a){var b=this.THEAD.childNodes[a];return b},F.prototype.renderColumnHeader=function(a,b,c){return c.className="",c.removeAttribute("style"),this.columnHeaders[a](b,c,a)},F.prototype.getColumnCount=function(){return this.wtTable.isWorkingOnClone()&&(this.instance.cloneOverlay instanceof z||this.instance.cloneOverlay instanceof y)?this.instance.getSetting("fixedColumnsLeft"):this.wtTable.getColumnStrategy().cellCount},F.prototype.renderColGroups=function(){for(var a=0;ac;){var d=document.createElement("TD");a.appendChild(d),c++}for(;c>b;)a.removeChild(a.lastChild),c--},F.prototype.refreshStretching=function(){if(!this.wtTable.isWorkingOnClone()){var a=this.instance,b=a.getSetting("stretchH"),c=(a.getSetting("totalRows"),a.getSetting("totalColumns")),d=function(a){var b=e.instance.wtViewport.getViewportWidth(a);return b},e=this,f=function(b){var d=e.columnFilter.visibleToSource(b);return c>d?a.getSetting("columnWidth",d):void 0},g=function(b){return e.instance.cloneOverlay instanceof s||a.wtSettings.settings.renderAllRows?1/0:e.instance.wtViewport.getViewportHeight(b)},h=function(){return a.wtSettings.settings.defaultRowHeight};this.wtTable.columnStrategy=new q(a,d,f,b),this.wtTable.rowStrategy=new w(a,g,h)}},F.utils={},F.utils.replaceTdWithTh=function(a,b){var c;return c=document.createElement("TH"),b.insertBefore(c,a),b.removeChild(a),c},F.utils.replaceThWithTd=function(a,b){var c=document.createElement("TD");return b.insertBefore(c,a),b.removeChild(a),c},G.prototype.getWorkspaceHeight=function(){var a=this.instance.wtScrollbars.vertical.scrollHandler;if(a===b)return document.documentElement.clientHeight;var d=c.Dom.outerHeight(a),e=d>0&&a.clientHeight>0?a.clientHeight:1/0;return e},G.prototype.getWorkspaceWidth=function(){var a=Math.min(this.getContainerFillWidth(),document.documentElement.offsetWidth-this.getWorkspaceOffset().left,document.documentElement.offsetWidth),d=this.instance.wtScrollbars.horizontal.scrollHandler;if(d!=b){var e=this.instance.wtScrollbars.horizontal.scrollHandler.style.overflow;if("scroll"==e||"hidden"==e||"auto"==e)return Math.max(a,d.clientWidth)}return Math.max(a,c.Dom.outerWidth(this.instance.wtTable.TABLE))},G.prototype.getContainerFillWidth=function(){if(this.containerWidth)return this.containerWidth;for(var a,b,c=this.instance.wtTable.holder;c.parentNode!=document.body&&null!=c.parentNode&&-1===c.className.indexOf("handsontable");)c=c.parentNode;return b=document.createElement("DIV"),b.style.width="100%",b.style.height="1px",c.appendChild(b),a=b.offsetWidth,this.containerWidth=a,c.removeChild(b),a},G.prototype.getWorkspaceOffset=function(){return c.Dom.offset(this.instance.wtTable.TABLE)},G.prototype.getWorkspaceActualHeight=function(){return c.Dom.outerHeight(this.instance.wtTable.TABLE)},G.prototype.getWorkspaceActualWidth=function(){return c.Dom.outerWidth(this.instance.wtTable.TABLE)||c.Dom.outerWidth(this.instance.wtTable.TBODY)||c.Dom.outerWidth(this.instance.wtTable.THEAD)},G.prototype.getColumnHeaderHeight=function(){return isNaN(this.columnHeaderHeight)&&(this.columnHeaderHeight=c.Dom.outerHeight(this.instance.wtTable.THEAD)),this.columnHeaderHeight},G.prototype.getViewportHeight=function(a){var b=this.getWorkspaceHeight(a);if(1/0===b)return b;var c=this.getColumnHeaderHeight();return c>0&&(b-=c),b},G.prototype.getRowHeaderWidth=function(){if(this.instance.cloneSource)return this.instance.cloneSource.wtViewport.getRowHeaderWidth();if(isNaN(this.rowHeaderWidth)){var a=this.instance.getSetting("rowHeaders");if(a.length){var b=this.instance.wtTable.TABLE.querySelector("TH");this.rowHeaderWidth=0;for(var d=0,e=a.length;e>d;d++)b?(this.rowHeaderWidth+=c.Dom.outerWidth(b),b=b.nextSibling):this.rowHeaderWidth+=50}else this.rowHeaderWidth=0}return this.rowHeaderWidth},G.prototype.getViewportWidth=function(a){var b=this.getWorkspaceWidth(a);if(1/0===b)return b;var c=this.getRowHeaderWidth();return c>0?b-c:b},G.prototype.resetSettings=function(){this.rowHeaderWidth=0/0,this.columnHeaderHeight=0/0}}(jQuery,window,Handsontable),/*! * numeral.js * version : 1.5.3 * author : Adam Draper * license : MIT * http://adamwdraper.github.com/Numeral-js/ */ function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b.indexOf("$"),g=b.indexOf("("),h=b.indexOf("-"),j="";return b.indexOf(" $")>-1?(j=" ",b=b.replace(" $","")):b.indexOf("$ ")>-1?(j=" ",b=b.replace("$ ","")):b=b.replace("$",""),e=i(a._value,b,c),1>=f?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(g>f||h>f)&&(d=0),e.splice(d,0,o[p].currency.symbol+j),e=e.join("")):e=o[p].currency.symbol+j+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,j+o[p].currency.symbol),e=e.join("")):e=e+j+o[p].currency.symbol,e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d){var e,f,g,h,i,j,k=!1,l=!1,m=!1,n="",r=!1,s=!1,t=!1,u=!1,v=!1,w="",x="",y=Math.abs(a),z=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],A="",B=!1;if(0===a&&null!==q)return q;if(c.indexOf("(")>-1?(k=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(l=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1&&(r=c.indexOf("aK")>=0,s=c.indexOf("aM")>=0,t=c.indexOf("aB")>=0,u=c.indexOf("aT")>=0,v=r||s||t||u,c.indexOf(" a")>-1?(n=" ",c=c.replace(" a","")):c=c.replace("a",""),y>=Math.pow(10,12)&&!v||u?(n+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):y=Math.pow(10,9)&&!v||t?(n+=o[p].abbreviations.billion,a/=Math.pow(10,9)):y=Math.pow(10,6)&&!v||s?(n+=o[p].abbreviations.million,a/=Math.pow(10,6)):(y=Math.pow(10,3)&&!v||r)&&(n+=o[p].abbreviations.thousand,a/=Math.pow(10,3))),c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(w=" ",c=c.replace(" b","")):c=c.replace("b",""),g=0;g<=z.length;g++)if(e=Math.pow(1024,g),f=Math.pow(1024,g+1),a>=e&&f>a){w+=z[g],e>0&&(a/=e);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(x=" ",c=c.replace(" o","")):c=c.replace("o",""),x+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(m=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],j=c.indexOf(","),i?(i.indexOf("[")>-1?(i=i.replace("]",""),i=i.split("["),A=b(a,i[0].length+i[1].length,d,i[1].length)):A=b(a,i.length,d),h=A.split(".")[0],A=A.split(".")[1].length?o[p].delimiters.decimal+A.split(".")[1]:"",m&&0===Number(A.slice(1))&&(A="")):h=b(a,null,d),h.indexOf("-")>-1&&(h=h.slice(1),B=!0),j>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(h=""),(k&&B?"(":"")+(!k&&B?"-":"")+(!B&&l?"+":"")+h+A+(x?x:"")+(n?n:"")+(w?w:"")+(k&&B?")":"")}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-1/0)}var m,n="1.5.3",o={},p="en",q=null,r="0,0",s="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumeral(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumeral=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a}return(b||!o[a])&&j(a,b),m},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=l(a,b);return a*c*b*c/(c*c)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=l(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},s&&(module.exports=m),"undefined"==typeof ender&&(this.numeral=m),"function"==typeof define&&define.amd&&define([],function(){return m})}.call(this);