/*
@license
webix UI v.2.4.5
This software is allowed to use under GPL or you need to obtain Commercial License 
 to use it in non-GPL project. Please contact sales@webix.com for details
*/
window.webix||(webix={}),webix.version="2.4.5",webix.codebase="./",webix.name="core",webix.clone=function(t){var e=webix.clone.a;return e.prototype=t,new e},webix.clone.a=function(){},webix.extend=function(t,e,i){if(t.b)return webix.PowerArray.insertAt.call(t.b,e,1),t;for(var s in e)(!t[s]||i)&&(t[s]=e[s]);
return e.defaults&&webix.extend(t.defaults,e.defaults),e.$init&&e.$init.call(t),t},webix.copy=function(t){var e;arguments.length>1?(e=arguments[0],t=arguments[1]):e=webix.isArray(t)?[]:{};for(var i in t)t[i]&&"object"==typeof t[i]&&!webix.isDate(t[i])?(e[i]=webix.isArray(t[i])?[]:{},webix.copy(e[i],t[i])):e[i]=t[i];
return e},webix.single=function(t){var e=null,i=function(){return e||(e=new t({})),e.c&&e.c.apply(e,arguments),e};return i},webix.protoUI=function(){var t=arguments,e=t[0].name,i=function(t){if(!i)return webix.ui[e].prototype;var s=i.b;if(s){for(var n=[s[0]],r=1;r<s.length;r++)n[r]=s[r],n[r].b&&(n[r]=n[r].call(webix,n[r].name)),n[r].prototype&&n[r].prototype.name&&(webix.ui[n[r].prototype.name]=n[r]);
if(webix.ui[e]=webix.proto.apply(webix,n),i.d)for(var r=0;r<i.d.length;r++)webix.type(webix.ui[e],i.d[r]);i=s=null}return this!=webix?new webix.ui[e](t):webix.ui[e]};return i.b=Array.prototype.slice.call(arguments,0),webix.ui[e]=i},webix.proto=function(){for(var t=arguments,e=t[0],i=!!e.$init,s=[],n=t.length-1;n>0;n--){if("function"==typeof t[n]&&(t[n]=t[n].prototype),t[n].$init&&s.push(t[n].$init),t[n].defaults){var r=t[n].defaults;
e.defaults||(e.defaults={});for(var a in r)webix.isUndefined(e.defaults[a])&&(e.defaults[a]=r[a])}if(t[n].type&&e.type)for(var a in t[n].type)e.type[a]||(e.type[a]=t[n].type[a]);for(var h in t[n])e[h]||e[h]===!1||(e[h]=t[n][h])}i&&s.push(e.$init),e.$init=function(){for(var t=0;t<s.length;t++)s[t].apply(this,arguments)
},e.$skin&&e.$skin();var o=function(t){this.$ready=[],this.$init(t),this.e&&this.e(t,this.defaults);for(var e=0;e<this.$ready.length;e++)this.$ready[e].call(this)};return o.prototype=e,e=t=null,o},webix.bind=function(t,e){return function(){return t.apply(e,arguments)}},webix.require=function(t,e,i){if(webix.require.disabled)return void(e&&e.call(i||this));
if("string"==typeof t)if(webix.f[t]!==!0){if(".css"==t.substr(-4)){var s=webix.html.create("LINK",{type:"text/css",rel:"stylesheet",href:webix.codebase+t});return document.head.appendChild(s),void(e&&e.call(i||window))}{arguments[4]}e?webix.f[t]?webix.f[t].push([e,i]):(webix.f[t]=[[e,i]],webix.ajax(webix.codebase+t,function(e){webix.exec(e);
var i=webix.f[t];webix.f[t]=!0;for(var s=0;s<i.length;s++)i[s][0].call(i[s][1]||window,!s)})):(webix.exec(webix.ajax().sync().get(webix.codebase+t).responseText),webix.f[t]=!0)}else e&&e.call(i);else{var n=t.length||0,r=e;if(n)(e=function(){return n?(n--,void webix.require(t[t.length-n-1],e,i)):r.apply(this,arguments)
})();else{for(var a in t)n++;e=function(){n--,0===n&&r.apply(this,arguments)};for(var a in t)webix.require(a,e,i)}}},webix.f={},webix.exec=function(t){window.execScript?window.execScript(t):window.eval(t)},webix.wrap=function(t,e){return t?function(){var i=t.apply(this,arguments);return e.apply(this,arguments),i
}:e},webix.isUndefined=function(t){return"undefined"==typeof t},webix.delay=function(t,e,i,s){return window.setTimeout(function(){if(!e||!e.$destructed){var s=t.apply(e,i||[]);return t=e=i=null,s}},s||1)},webix.once=function(t){var e=!0;return function(){e&&(e=!1,t.apply(this,arguments))}},webix.uid=function(){return this.g||(this.g=(new Date).valueOf()),this.g++,this.g
},webix.toNode=function(t){return"string"==typeof t?document.getElementById(t):t},webix.toArray=function(t){return webix.extend(t||[],webix.PowerArray,!0)},webix.toFunctor=function(str,scope){if("string"==typeof str){var method=str.replace("()","");return scope&&scope[method]?scope[method]:window[method]||eval(str)
}return str},webix.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},webix.isDate=function(t){return t instanceof Date},webix.h={},webix.event=function(t,e,i,s){t=webix.toNode(t);var n=webix.uid();return s&&(i=webix.bind(i,s)),webix.h[n]=[t,e,i],t.addEventListener?t.addEventListener(e,i,arguments[4]):t.attachEvent&&t.attachEvent("on"+e,webix.h[n][2]=function(){return i.apply(t,arguments)
}),n},webix.eventRemove=function(t){if(t){var e=webix.h[t];e[0].removeEventListener?e[0].removeEventListener(e[1],e[2],!1):e[0].detachEvent&&e[0].detachEvent("on"+e[1],e[2]),delete this.h[t]}},webix.EventSystem={$init:function(){this.i||(this.i={},this.j={},this.k={})},blockEvent:function(){this.i.l=!0
},unblockEvent:function(){this.i.l=!1},mapEvent:function(t){webix.extend(this.k,t,!0)},on_setter:function(t){if(t)for(var e in t){var i=webix.toFunctor(t[e],this.$scope),s=e.indexOf("->");-1!==s?this[e.substr(0,s)].attachEvent(e.substr(s+2),webix.bind(i,this)):this.attachEvent(e,i)}},callEvent:function(t,e){if(this.i.l)return!0;
t=t.toLowerCase();var i=this.i[t.toLowerCase()],s=!0;if(i)for(var n=0;n<i.length;n++)i[n].apply(this,e||[])===!1&&(s=!1);if(this.k[t]){var r=this.k[t];r.$eventSource=this,r.callEvent(t,e)||(s=!1),r.$eventSource=null}return s},attachEvent:function(t,e,i){t=t.toLowerCase(),i=i||webix.uid(),e=webix.toFunctor(e,this.$scope);
var s=this.i[t]||webix.toArray();return arguments[3]?s.unshift(e):s.push(e),this.i[t]=s,this.j[i]={f:e,t:t},i},detachEvent:function(t){if(this.j[t]){var e=this.j[t].t,i=this.j[t].f,s=this.i[e];s.remove(i),delete this.j[t]}},hasEvent:function(t){t=t.toLowerCase();var e=this.i[t];return e&&e.length?!0:!1
}},webix.extend(webix,webix.EventSystem,!0),webix.PowerArray={removeAt:function(t,e){t>=0&&this.splice(t,e||1)},remove:function(t){this.removeAt(this.find(t))},insertAt:function(t,e){if(e||0===e){var i=this.splice(e,this.length-e);this[e]=t,this.push.apply(this,i)}else this.push(t)},find:function(t){for(var e=0;e<this.length;e++)if(t==this[e])return e;
return-1},each:function(t,e){for(var i=0;i<this.length;i++)t.call(e||this,this[i])},map:function(t,e){for(var i=0;i<this.length;i++)this[i]=t.call(e||this,this[i]);return this},filter:function(t,e){for(var i=0;i<this.length;i++)t.call(e||this,this[i])||(this.splice(i,1),i--);return this}},webix.env={},function(){if(webix.env.strict=!!window.webix_strict,(-1!=navigator.userAgent.indexOf("Mobile")||-1!=navigator.userAgent.indexOf("Windows Phone"))&&(webix.env.mobile=!0),(webix.env.mobile||-1!=navigator.userAgent.indexOf("iPad")||-1!=navigator.userAgent.indexOf("Android"))&&(webix.env.touch=!0),-1!=navigator.userAgent.indexOf("Opera"))webix.env.isOpera=!0;
else{if(webix.env.isIE=!!document.all||-1!==navigator.userAgent.indexOf("Trident"),webix.env.isIE){var t=parseFloat(navigator.appVersion.split("MSIE")[1]);8==t&&(webix.env.isIE8=!0)}webix.env.isFF=-1!=navigator.userAgent.indexOf("Firefox"),webix.env.isWebKit=-1!=navigator.userAgent.indexOf("KHTML"),webix.env.isSafari=webix.env.isWebKit&&-1!=navigator.userAgent.indexOf("Mac")
}-1!=navigator.userAgent.toLowerCase().indexOf("android")&&(webix.env.isAndroid=!0,navigator.userAgent.toLowerCase().indexOf("trident")&&(webix.env.isAndroid=!1,webix.env.isIEMobile=!0)),webix.env.transform=!1,webix.env.transition=!1;for(var e=-1,i=["","webkit","Moz","O","ms"],s=["","-webkit-","-Moz-","-o-","-ms-"],n=document.createElement("DIV"),r=0;r<i.length;r++){var a=i[r]?i[r]+"Transform":"transform";
if("undefined"!=typeof n.style[a]){e=r;break}}if(e>-1){webix.env.cssPrefix=s[e];var h=webix.env.jsPrefix=i[e];webix.env.transform=h?h+"Transform":"transform",webix.env.transition=h?h+"Transition":"transition",webix.env.transitionDuration=h?h+"TransitionDuration":"transitionDuration",n.style[webix.env.transform]="translate3d(0,0,0)",webix.env.translate=n.style[webix.env.transform]?"translate3d":"translate",webix.env.transitionEnd="-Moz-"==webix.env.cssPrefix?"transitionend":h?h+"TransitionEnd":"transitionend"
}}(),webix.env.svg=function(){return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}(),webix.html={m:0,denySelect:function(){webix.m||(webix.m=document.onselectstart),document.onselectstart=webix.html.stopEvent},allowSelect:function(){0!==webix.m&&(document.onselectstart=webix.m||null),webix.m=0
},index:function(t){for(var e=0;t=t.previousSibling;)e++;return e},n:{},createCss:function(t){var e="";for(var i in t)e+=i+":"+t[i]+";";var s=this.n[e];return s||(s="s"+webix.uid(),this.addStyle("."+s+"{"+e+"}"),this.n[e]=s),s},addStyle:function(t){var e=this.ky;e||(e=this.ky=document.createElement("style"),e.setAttribute("type","text/css"),e.setAttribute("media","screen"),document.getElementsByTagName("head")[0].appendChild(e)),e.styleSheet?e.styleSheet.cssText+=t:e.appendChild(document.createTextNode(t))
},create:function(t,e,i){e=e||{};var s=document.createElement(t);for(var n in e)s.setAttribute(n,e[n]);return e.style&&(s.style.cssText=e.style),e["class"]&&(s.className=e["class"]),i&&(s.innerHTML=i),s},getValue:function(t){return t=webix.toNode(t),t?webix.isUndefined(t.value)?t.innerHTML:t.value:""
},remove:function(t){if(t instanceof Array)for(var e=0;e<t.length;e++)this.remove(t[e]);else t&&t.parentNode&&t.parentNode.removeChild(t)},insertBefore:function(t,e,i){t&&(e&&e.parentNode?e.parentNode.insertBefore(t,e):i.appendChild(t))},locate:function(t,e){var i;for(t.tagName?i=t:(t=t||event,i=t.target||t.srcElement);i;){if(i.getAttribute){var s=i.getAttribute(e);
if(s)return s}i=i.parentNode}return null},offset:function(t){if(t.getBoundingClientRect){var e=t.getBoundingClientRect(),i=document.body,s=document.documentElement,n=window.pageYOffset||s.scrollTop||i.scrollTop,r=window.pageXOffset||s.scrollLeft||i.scrollLeft,a=s.clientTop||i.clientTop||0,h=s.clientLeft||i.clientLeft||0,o=e.top+n-a,l=e.left+r-h;
return{y:Math.round(o),x:Math.round(l),width:t.offsetWidth,height:t.offsetHeight}}for(var o=0,l=0;t;)o+=parseInt(t.offsetTop,10),l+=parseInt(t.offsetLeft,10),t=t.offsetParent;return{y:o,x:l,width:t.offsetHeight,height:t.offsetWidth}},posRelative:function(t){return t=t||event,webix.isUndefined(t.offsetX)?{x:t.layerX,y:t.layerY}:{x:t.offsetX,y:t.offsetY}
},pos:function(t){if(t=t||event,t.touches&&t.touches[0]&&(t=t.touches[0]),t.pageX||t.pageY)return{x:t.pageX,y:t.pageY};var e=webix.env.isIE&&"BackCompat"!=document.compatMode?document.documentElement:document.body;return{x:t.clientX+e.scrollLeft-e.clientLeft,y:t.clientY+e.scrollTop-e.clientTop}},preventEvent:function(t){return t&&t.preventDefault&&t.preventDefault(),t&&(t.returnValue=!1),webix.html.stopEvent(t)
},stopEvent:function(t){return(t||event).cancelBubble=!0,!1},addCss:function(t,e,i){i&&-1!==t.className.indexOf(e)||(t.className+=" "+e)},removeCss:function(t,e){t.className=t.className.replace(RegExp(" "+e,"g"),"")}},webix.ready=function(t){this.o?t.call():this.p.push(t)},webix.p=[],function(){var t=document.getElementsByTagName("SCRIPT");
t.length&&(t=(t[t.length-1].getAttribute("src")||"").split("/"),t.splice(t.length-1,1),webix.codebase=t.slice(0,t.length).join("/")+"/");var e=function(){webix.env.isIE&&(document.body.className+=" webix_ie"),webix.callEvent("onReady",[])},i=function(){webix.o=!0,window.webix_ready&&webix.isArray(webix_ready)&&(webix.p=webix_ready.concat(webix.p));
for(var t=0;t<webix.p.length;t++)webix.p[t].call();webix.p=[]};webix.attachEvent("onReady",function(t){t?i():webix.delay(i)}),"complete"==document.readyState?e():webix.event(window,"load",e)}(),webix.locale=webix.locale||{},webix.ready(function(){webix.event(document.body,"click",function(t){webix.callEvent("onClick",[t||event])
})}),webix.editStop=function(){webix.callEvent("onEditEnd",[])},function(t){function e(t,e){var i=this;i.promise=i,i.state="pending",i.val=null,i.fn=t||null,i.er=e||null,i.next=[]}var i="undefined"!=typeof setImmediate?setImmediate:function(t){setTimeout(t,0)};e.prototype.resolve=function(t){var e=this;
"pending"===e.state&&(e.val=t,e.state="resolving",i(function(){e.fire()}))},e.prototype.reject=function(t){var e=this;"pending"===e.state&&(e.val=t,e.state="rejecting",i(function(){e.fire()}))},e.prototype.then=function(t,i){var s=this,n=new e(t,i);return s.next.push(n),"resolved"===s.state&&n.resolve(s.val),"rejected"===s.state&&n.reject(s.val),n
},e.prototype.fail=function(t){return this.then(null,t)},e.prototype.finish=function(t){var e=this;if(e.state=t,"resolved"===e.state)for(var i=0;i<e.next.length;i++)e.next[i].resolve(e.val);if("rejected"===e.state){for(var i=0;i<e.next.length;i++)e.next[i].reject(e.val);if(webix.assert&&!e.next.length)throw e.val
}},e.prototype.thennable=function(t,e,i,s,n){var r=this;if(n=n||r.val,"object"==typeof n&&"function"==typeof t)try{var a=0;t.call(n,function(t){0===a++&&e(t)},function(t){0===a++&&i(t)})}catch(h){i(h)}else s(n)},e.prototype.fire=function(){var t,e=this;try{t=e.val&&e.val.then}catch(i){return e.val=i,e.state="rejecting",e.fire()
}e.thennable(t,function(t){e.val=t,e.state="resolving",e.fire()},function(t){e.val=t,e.state="rejecting",e.fire()},function(i){if(e.val=i,"resolving"===e.state&&"function"==typeof e.fn)try{e.val=e.fn.call(void 0,e.val)}catch(s){return e.val=s,e.finish("rejected")}if("rejecting"===e.state&&"function"==typeof e.er)try{e.val=e.er.call(void 0,e.val),e.state="resolving"
}catch(s){return e.val=s,e.finish("rejected")}return e.val===e?(e.val=TypeError(),e.finish("rejected")):void e.thennable(t,function(t){e.val=t,e.finish("resolved")},function(t){e.val=t,e.finish("rejected")},function(t){e.val=t,e.finish("resolving"===e.state?"resolved":"rejected")})})},e.prototype.done=function(){if(this.state="rejected"&&!this.next)throw this.val;
return null},e.prototype.nodeify=function(t){return"function"==typeof t?this.then(function(e){try{t(null,e)}catch(i){setImmediate(function(){throw i})}return e},function(e){try{t(e)}catch(i){setImmediate(function(){throw i})}return e}):this},e.prototype.spread=function(t,e){return this.all().then(function(e){return"function"==typeof t&&t.apply(null,e)
},e)},e.prototype.all=function(){var t=this;return this.then(function(i){function s(){++r===a&&n.resolve(i)}var n=new e;if(!(i instanceof Array))return n.reject(TypeError),n;for(var r=0,a=i.length,h=0,o=i.length;o>h;h++){var l,c=i[h];try{l=c&&c.then}catch(u){n.reject(u);break}!function(e){t.thennable(l,function(t){i[e]=t,s()
},function(t){i[e]=t,s()},function(){s()},c)}(h)}return n})};var s={all:function(t){var i=new e(null,null);return i.resolve(t),i.all()},defer:function(){return new e(null,null)},fcall:function(){var t=new e,i=Array.apply([],arguments),s=i.shift();try{var n=s.apply(null,i);t.resolve(n)}catch(r){t.reject(r)
}return t},nfcall:function(){var t=new e,i=Array.apply([],arguments),s=i.shift();try{i.push(function(e,i){return e?t.reject(e):t.resolve(i)}),s.apply(null,i)}catch(n){t.reject(n)}return t}};t.promise=s}(webix),function(){function t(t,i,s){var n={name:i,data:s,key:o},a=webix.promise.defer();return c.push([t,n,a]),h||(h=setTimeout(e,1)),a.sync=function(){return n.sync=!0,r(t,n)
},a}function e(){for(var t=[],e=[],i="",s=0;s<c.length;s++){var r=c[s];r[1].sync||(l.multicall?(i=r[0],t.push(r[1]),e.push(r)):n.apply(this,r))}c=[],h=!1,l.multicall&&t.length&&n(i,{data:t,key:o,multicall:!0},e)}function i(t,e){if(l.multicall)for(var i=0;i<t.length;i++)t[i][2].resolve(e[i]);else t.resolve(e)
}function s(t,e){if(l.multicall)for(var i=0;i<t.length;i++)t[i][2].reject(e);else t.reject(e)}function n(t,e,n){var r=webix.ajax();e.data=r.stringify(e.data),r.post(t,e).then(function(t){var e=a(t.text());e?i(n,e.data):s(n,t.text())},function(t){s(n,t)}),webix.callEvent("onRemoteCall",[n,e])}function r(t,e){var i=webix.ajax();
return webix.callEvent("onRemoteCall",[null,e]),e.data=i.stringify(e.data),a(i.sync().post(t,e).responseText).data}function a(t){return webix.DataDriver.json.toObject.call(l,t)}var h,o="",l={timeout:30,parseDates:!0,multicall:!0},c=[],u=webix.remote=function(t,e,i,s){if(!e){var n=document.getElementsByTagName("script");
e=n[n.length-1].src}i=i||u,s=s||"";for(var r in t)if("$key"==r)o=t.$key;else if(0===r.indexOf("$"))u[r]=t[r];else if("object"==typeof t[r]){var a=i[r]={};u(t[r],e,a,r+".")}else i[r]=d(e,s+r)},d=function(e,i){return function(){return t(e,i,[].splice.call(arguments,0))}};u.config=l,u.flush=e}(),webix.skin={},webix.skin.air={topLayout:"wide",barHeight:34,tabbarHeight:36,rowHeight:34,toolbarHeight:22,listItemHeight:28,inputHeight:34,inputPadding:2,menuHeight:34,menuMargin:0,labelTopHeight:16,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:4,form:8},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:8},tabMargin:0,calendarHeight:70,padding:0,optionHeight:27},webix.skin.aircompact={topLayout:"wide",barHeight:24,tabbarHeight:26,rowHeight:26,toolbarHeight:22,listItemHeight:28,inputHeight:29,inputPadding:2,menuHeight:25,menuMargin:0,labelTopHeight:16,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:4,form:8},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:8},tabMargin:0,calendarHeight:70,padding:0,optionHeight:23},webix.skin.web={name:"web",topLayout:"space",barHeight:28,tabbarHeight:30,rowHeight:30,toolbarHeight:22,listItemHeight:28,inputHeight:28,inputPadding:2,menuMargin:0,menuHeight:27,labelTopHeight:16,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:4,form:8,accordion:9},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:8,accordion:0},tabMargin:3,tabTopOffset:3,calendarHeight:70,padding:0,optionHeight:22},webix.skin.clouds={topLayout:"wide",barHeight:36,tabbarHeight:46,rowHeight:34,toolbarHeight:22,listItemHeight:32,inputHeight:30,inputPadding:2,menuHeight:34,labelTopHeight:16,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:4,form:8},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:8},tabMargin:2,tabOffset:0,tabBottomOffset:10,calendarHeight:70,padding:0},webix.skin.terrace={topLayout:"space",barHeight:37,tabbarHeight:39,rowHeight:38,toolbarHeight:22,listItemHeight:28,inputHeight:30,inputPadding:2,menuMargin:0,menuHeight:32,labelTopHeight:16,layoutMargin:{space:20,wide:20,clean:0,head:4,line:-1,toolbar:4,form:8},layoutPadding:{space:20,wide:0,clean:0,head:0,line:0,toolbar:4,form:8},tabMargin:2,tabOffset:0,calendarHeight:70,padding:17,optionHeight:24},webix.skin.metro={topLayout:"space",barHeight:36,tabbarHeight:46,rowHeight:34,toolbarHeight:36,listItemHeight:32,inputHeight:30,buttonHeight:45,inputPadding:2,menuHeight:36,labelTopHeight:16,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:4,form:8,accordion:9},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:0,form:8,accordion:0},tabMargin:2,tabOffset:0,tabBottomOffset:10,calendarHeight:70,padding:0,optionHeight:23},webix.skin.light={topLayout:"space",barHeight:36,tabbarHeight:46,rowHeight:32,toolbarHeight:36,listItemHeight:32,inputHeight:34,buttonHeight:45,inputPadding:3,menuHeight:36,labelTopHeight:16,layoutMargin:{space:15,wide:15,clean:0,head:4,line:-1,toolbar:4,form:8,accordion:10},layoutPadding:{space:15,wide:0,clean:0,head:0,line:0,toolbar:0,form:8,accordion:0},tabMargin:2,tabOffset:0,tabBottomOffset:10,calendarHeight:70,padding:0,optionHeight:27},webix.skin.glamour={topLayout:"space",barHeight:39,tabbarHeight:39,rowHeight:32,toolbarHeight:39,listItemHeight:32,inputHeight:34,buttonHeight:34,inputPadding:3,menuHeight:36,labelTopHeight:16,layoutMargin:{space:15,wide:15,clean:0,head:4,line:-1,toolbar:4,form:8,accordion:10},layoutPadding:{space:15,wide:0,clean:0,head:0,line:0,toolbar:3,form:8,accordion:0},tabMargin:1,tabOffset:0,tabBottomOffset:1,calendarHeight:70,padding:0,optionHeight:27},webix.skin.touch={topLayout:"space",barHeight:42,tabbarHeight:50,rowHeight:42,toolbarHeight:42,listItemHeight:42,inputHeight:42,inputPadding:4,menuHeight:42,labelTopHeight:24,unitHeaderHeight:34,layoutMargin:{space:10,wide:4,clean:0,head:4,line:-1,toolbar:0,form:0,accordion:9},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:8,accordion:0},tabMargin:2,tabOffset:0,tabBottomOffset:10,calendar:{headerHeight:70,timepickerHeight:35,height:310,width:300},padding:0,customCheckbox:!0,customRadio:!0,optionHeight:32},webix.skin.flat={topLayout:"space",barHeight:45,tabbarHeight:45,rowHeight:34,toolbarHeight:45,listItemHeight:34,inputHeight:38,buttonHeight:38,inputPadding:3,menuHeight:34,labelTopHeight:22,propertyItemHeight:28,layoutMargin:{space:10,wide:10,clean:0,head:4,line:-1,toolbar:4,form:8,accordion:10},layoutPadding:{space:10,wide:0,clean:0,head:0,line:0,toolbar:5,form:17,accordion:0},tabMargin:4,tabOffset:0,tabBottomOffset:6,tabTopOffset:1,customCheckbox:!0,customRadio:!0,calendarHeight:70,padding:0,accordionType:"accordion",optionHeight:29},webix.skin.compact={topLayout:"space",barHeight:34,tabbarHeight:34,rowHeight:24,toolbarHeight:34,listItemHeight:28,inputHeight:30,buttonHeight:30,inputPadding:3,menuHeight:28,labelTopHeight:16,layoutMargin:{space:5,wide:5,clean:0,head:4,line:-1,toolbar:4,form:4,accordion:5},layoutPadding:{space:5,wide:0,clean:0,head:0,line:0,toolbar:3,form:12,accordion:0},tabMargin:3,tabOffset:0,tabBottomOffset:3,tabTopOffset:1,customCheckbox:!0,customRadio:!0,calendarHeight:70,padding:0,accordionType:"accordion",optionHeight:23},webix.skin.material={topLayout:"space",barHeight:45,tabbarHeight:47,rowHeight:38,toolbarHeight:22,listItemHeight:34,inputHeight:38,buttonHeight:38,inputPadding:2,menuMargin:0,menuHeight:34,labelTopHeight:16,propertyItemHeight:34,layoutMargin:{material:10,space:10,wide:10,clean:0,head:4,line:-1,toolbar:4,form:16,accordion:0},layoutPadding:{material:10,space:10,wide:0,clean:0,head:0,line:0,toolbar:4,form:16,accordion:0},tabMargin:0,tabOffset:0,tabBottomOffset:0,tabTopOffset:0,customCheckbox:!0,customRadio:!0,calendarHeight:70,padding:0,accordionType:"accordion"},webix.skin.set=function(t){if(webix.skin.$active=webix.skin[t],webix.skin.$name=t,webix.ui)for(var e in webix.ui){var i=webix.ui[e];
i&&i.prototype&&i.prototype.$skin&&i.prototype.$skin(i.prototype)}},webix.skin.set(window.webix_skin||"flat"),webix.Destruction={$init:function(){webix.destructors.push(this)},destructor:function(){var t=this.s;if(this.di&&this.editCancel(),this.callEvent&&this.callEvent("onDestruct",[]),this.destructor=function(){},this.getChildViews){var e=this.getChildViews();
if(e)for(var i=0;i<e.length;i++)e[i].destructor();if(this.Ns)for(var i=0;i<this.Ns.length;i++)this.Ns[i].destructor()}delete webix.ui.views[t.id],this.t=null,this.u=null,this.v=null,this.w&&(this.w.innerHTML="",this.w.t=null),this.x&&this.x.parentNode&&this.x.parentNode.removeChild(this.x),this.data&&this.data.destructor&&this.data.destructor(),this.unbind&&this.unbind(),this.data=null,this.x=this.$view=this.w=this.y=null,this.i=this.j={},webix.UIManager.A==this&&(webix.UIManager.A=null);
var s=t.url;s&&s.$proxy&&s.release&&s.release(),this.$scope=null,this.$destructed=!0}},webix.destructors=[],webix.event(window,"unload",function(){webix.callEvent("unload",[]),webix.B=!0;for(var t=0;t<webix.destructors.length;t++)webix.destructors[t].destructor();webix.destructors=[],webix.ui.et=webix.toArray();
for(var e in webix.h){var i=webix.h[e];i[0].removeEventListener?i[0].removeEventListener(i[1],i[2],!1):i[0].detachEvent&&i[0].detachEvent("on"+i[1],i[2]),delete webix.h[e]}}),function(){var t={},e={},i=new RegExp("(\\r\\n|\\n)","g"),s=new RegExp('(\\")',"g"),n=new RegExp("(\\\\)","g"),r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},a=/[&<>"'`]/g,h=function(t){return r[t]||"&amp;"
};webix.template=function(r){if("function"==typeof r)return r;if(t[r])return t[r];if(r=(r||"").toString(),-1!=r.indexOf("->")){var a=r.split("->");switch(a[0]){case"html":r=webix.html.getValue(a[1]);break;case"http":r=(new webix.ajax).sync().get(a[1],{uid:webix.uid()}).responseText}}if(r=(r||"").toString(),webix.env.strict){if(!e[r]){e[r]=[];
var h=[];if(r.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,function(t,e,i,s,n){h.push({pos:n,str:t,fn:function(t){return t[e]?i:s}})}),r.replace(/\{common\.([^}\(]*)\}/g,function(t,e,i){h.push({pos:i,str:t,fn:function(t,i){return i[e]||""}})}),r.replace(/\{common\.([^\}\(]*)\(\)\}/g,function(t,e,i){h.push({pos:i,str:t,fn:function(t,i){return i[e]?i[e].apply(this,arguments):""
}})}),r.replace(/\{obj\.([^:}]*)\}/g,function(t,e,i){h.push({pos:i,str:t,fn:function(t){return t[e]}})}),r.replace("{obj}",function(t,e,i){h.push({pos:i,str:t,fn:function(t){return t}})}),r.replace(/#([^#'";, ]+)#/gi,function(t,e,i){h.push("!"==e.charAt(0)?{pos:i,str:t,fn:function(t){return webix.template.escape(t[e.substr(1)])
}}:{pos:i,str:t,fn:function(t){return t[e]}})}),h.sort(function(t,e){return t.pos>e.pos?1:-1}),h.length){for(var o=0,l=function(t,i,s){e[t].push(function(){return t.slice(i,s)})},c=0;c<h.length;c++){var u=h[c].pos;l(r,o,u),e[r].push(h[c].fn),o=u+h[c].str.length}l(r,o,r.length)}else e[r].push(function(){return r
})}return function(){for(var t="",i=0;i<e[r].length;i++)t+=e[r][i].apply(this,arguments);return t}}r=r.replace(n,"\\\\"),r=r.replace(i,"\\n"),r=r.replace(s,'\\"'),r=r.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"'),r=r.replace(/\{common\.([^}\(]*)\}/g,"\"+(common.$1||'')+\""),r=r.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1.apply(this, arguments):"")+"'),r=r.replace(/\{obj\.([^}]*)\}/g,'"+(obj.$1)+"'),r=r.replace("{obj}",'"+obj+"'),r=r.replace(/#([^#'";, ]+)#/gi,function(t,e){return"!"==e.charAt(0)?'"+webix.template.escape(obj.'+e.substr(1)+')+"':'"+(obj.'+e+')+"'
});try{t[r]=Function("obj","common",'return "'+r+'";')}catch(d){}return t[r]},webix.template.escape=function(t){return t===webix.undefined||null===t?"":(t.toString()||"").replace(a,h)},webix.template.empty=function(){return""},webix.template.bind=function(t){return webix.bind(webix.template(t),this)},webix.type=function(t,e){if(t.b)return t.d||(t.d=[]),void t.d.push(e);
"function"==typeof t&&(t=t.prototype),t.types||(t.types={"default":t.type},t.type.name="default");var i=e.name,s=t.type;i&&(s=t.types[i]=webix.clone(e.baseType?t.types[e.baseType]:t.type));for(var n in e)s[n]=0===n.indexOf("template")?webix.template(e[n]):e[n];return i}}(),webix.Settings={$init:function(){this.s=this.config={}
},define:function(t,e){return"object"==typeof t?this.C(t):this.D(t,e)},D:function(t,e){var i=this[t+"_setter"];return this.s[t]=i?i.call(this,e,t):e},C:function(t){if(t)for(var e in t)this.D(e,t[e])},e:function(t,e){var i={};e&&(i=webix.extend(i,e)),"object"!=typeof t||t.tagName||webix.extend(i,t,!0),this.C(i)
},E:function(t,e){for(var i in e)switch(typeof t[i]){case"object":t[i]=this.E(t[i]||{},e[i]);break;case"undefined":t[i]=e[i]}return t}},webix.proxy=function(t,e){var i=webix.copy(webix.proxy[t]);return i.source=e,i.init&&i.init(),i},webix.proxy.post={$proxy:!0,load:function(t,e){webix.ajax().bind(t).post(this.source,this.params||{},e)
}},webix.proxy.sync={$proxy:!0,load:function(t,e){webix.ajax().sync().bind(t).get(this.source,null,e)}},webix.proxy.connector={$proxy:!0,connectorName:"!nativeeditor_status",load:function(t,e){webix.ajax(this.source,e,t)},saveAll:function(t,e,i,s){for(var n=this.source,r={},a=[],h=0;h<e.length;h++){var o=e[h];
a.push(o.id);for(var l in o.data)0!==l.indexOf("$")&&(r[o.id+"_"+l]=o.data[l]);r[o.id+"_"+this.connectorName]=o.operation}r.ids=a.join(","),r.webix_security=webix.securityKey,n+=-1==n.indexOf("?")?"?":"&",n+="editing=true",webix.ajax().post(n,r,s)},result:function(t,e,i,s,n,r){if(n=n.xml(),!n)return i.yr(null,s,n,r);
var a=n.data.action;a.length||(a=[a]);for(var h=[],o=0;o<a.length;o++){var l=a[o];h.push(l),l.status=l.type,l.id=l.sid,l.newid=l.tid,i.processResult(l,l,{text:s,data:n,loader:r})}return h}},webix.proxy.rest={$proxy:!0,load:function(t,e){webix.ajax(this.source,e,t)},save:function(t,e,i,s){var n=this.source;
n+="/"==n.charAt(n.length-1)?"":"/";var r=e.operation,a=e.data;"insert"==r&&delete a.id,"update"==r?webix.ajax().put(n+a.id,a,s):"delete"==r?webix.ajax().del(n+a.id,a,s):webix.ajax().post(n,a,s)}},webix.proxy.faye={$proxy:!0,init:function(){this.clientId=this.clientId||webix.uid()},load:function(t){var e=this.clientId;
this.client.subscribe(this.source,function(i){i.clientId!=e&&webix.dp(t).ignore(function(){if("delete"==i.operation)t.remove(i.data.id);else if("insert"==i.operation)t.add(i.data);else if("update"==i.operation){var e=t.getItem(i.data.id);e&&(webix.extend(e,i.data,!0),t.refresh(e.id))}})})},save:function(t,e){e.clientId=this.clientId,this.client.publish(this.source,e)
}},webix.proxy.indexdb={$proxy:!0,create:function(t,e,i,s){this.source=t+"/",this.F(s,i,function(t){var i=t.target.result;for(var s in e)for(var n=e[s],r=i.createObjectStore(s,{keyPath:"id",autoIncrement:!0}),a=0;a<n.length;a++)r.put(n[a])})},F:function(t,e,i){if(-1!=this.source.indexOf("/")){var s=this.source.split("/");
this.source=s[1],e=e||s[2];var n,r=window.indexedDB||window.webkitIndexedDB||window.mozIndexedDB;n=e?r.open(s[0],e):r.open(s[0]),i&&(n.onupgradeneeded=i),n.onerror=function(){},n.onblocked=function(){},n.onsuccess=webix.bind(function(e){this.db=e.target.result,t&&t.call(this)},this)}else this.db?t.call(this):webix.delay(this.F,this,[t],50)
},load:function(t,e){this.F(function(){var i=this.db.transaction(this.source).objectStore(this.source),s=[];i.openCursor().onsuccess=function(i){var n=i.target.result;n?(s.push(n.value),n["continue"]()):(t.parse(s),webix.ajax.$callback(t,e,"[]",s))}})},save:function(t,e,i){this.F(function(){var t,s=e.operation,n=e.data,r=e.id,a=this.db.transaction([this.source],"readwrite").objectStore(this.source);
"delete"==s?t=a["delete"](r):"update"==s?t=a.put(n):"insert"==s&&(delete n.id,t=a.add(n)),t.onsuccess=function(t){var n={status:s,id:e.id};"insert"==s&&(n.newid=t.target.result),i.processResult(n,n)}})}},webix.ajax=function(t,e,i,s){return 0!==arguments.length?(new webix.ajax).get(t,e,i,s):this.getXHR?this:new webix.ajax
},webix.ajax.count=0,webix.ajax.prototype={master:null,getXHR:function(){return webix.env.isIE?new ActiveXObject("Microsoft.xmlHTTP"):new XMLHttpRequest},stringify:function(t){var e=Date.prototype.toJSON;Date.prototype.toJSON=function(){return webix.i18n.parseFormatStr(this)};var i;return i=t instanceof Date?t.toJSON():JSON.stringify(t),Date.prototype.toJSON=e,i
},G:function(t,e,i,s,n){e&&(webix.isArray(e)||"function"==typeof(e.success||e.error||e))&&(s=i,i=e,e=null);var r=webix.promise.defer(),a=this.getXHR();webix.isArray(i)||(i=[i]),i.push({success:function(t,e){r.resolve(e)},error:function(){r.reject(a)}});var h=this.I||{};if("GET"!==n&&(h["Content-type"]="application/x-www-form-urlencoded"),webix.callEvent("onBeforeAjax",[n,t,e,a,h])){if("object"==typeof e){var o=[];
for(var l in e){var c=e[l];(null===c||c===webix.undefined)&&(c=""),"object"==typeof c&&(c=this.stringify(c)),o.push(l+"="+encodeURIComponent(c))}e=o.join("&")}e&&"GET"===n&&(t=t+(-1!=t.indexOf("?")?"&":"?")+e,e=null),a.open(n,t,!this.H);var u=this.Tw;u&&(a.responseType=u);for(var d in h)a.setRequestHeader(d,h[d]);
var f=this;return this.master=this.master||s,a.onreadystatechange=function(){if(!a.readyState||4==a.readyState){if(webix.ajax.count++,i&&f&&!a.aborted){if(-1!=webix.ly.find(a))return webix.ly.remove(a);var t,e,n=f.master||f,r=a.status>=400;"blob"!=a.responseType?(t=a.responseText||"",e=f.J(a)):(t="",e=a.response),webix.ajax.$callback(n,i,t,e,a,r)
}f&&(f.master=null),i=f=s=null}},this.H?a.send(e||null):setTimeout(function(){a.aborted||(-1!=webix.ly.find(a)?webix.ly.remove(a):a.send(e||null))},1),this.master&&this.master.Ve&&this.master.Ve.push(a),this.H?a:r}},J:function(x){return{xml:function(){try{return webix.DataDriver.xml.tagToObject(webix.DataDriver.xml.toObject(x.responseText,this))
}catch(t){}},rawxml:function(){return x.responseXML},text:function(){return x.responseText},json:function(){try{if(webix.env.strict)return JSON.parse(x.responseText);eval("webix.temp = "+x.responseText);var t=webix.temp;return webix.temp=null,t}catch(e){}}}},get:function(t,e,i){return this.G(t,e,i,0,"GET")
},post:function(t,e,i){return this.G(t,e,i,0,"POST")},put:function(t,e,i){return this.G(t,e,i,0,"PUT")},del:function(t,e,i){return this.G(t,e,i,0,"DELETE")},sync:function(){return this.H=!0,this},response:function(t){return this.Tw=t,this},header:function(t){return this.I=t,this},headers:function(t){return this.I=webix.extend(this.I||{},t),this
},bind:function(t){return this.master=t,this}},webix.ajax.$callback=function(t,e,i,s,n,r){if(!t.$destructed){if(-1===n&&s&&"function"==typeof s.json&&(s=s.json()),r&&webix.callEvent("onAjaxError",[n]),webix.isArray(e)||(e=[e]),!r)for(var a=0;a<e.length;a++)if(e[a]){var h=e[a].before;h&&h.call(t,i,s,n)
}for(var a=0;a<e.length;a++)if(e[a]){var o=e[a].success||e[a];r&&(o=e[a].error),o&&o.call&&o.call(t,i,s,n)}}},webix.send=function(t,e,i,s){var n=webix.html.create("FORM",{target:s||"_self",action:t,method:i||"POST"},"");for(var r in e){var a=webix.html.create("INPUT",{type:"hidden",name:r,value:e[r]},"");
n.appendChild(a)}n.style.display="none",document.body.appendChild(n),n.submit(),document.body.removeChild(n)},webix.AtomDataLoader={$init:function(t){this.data={},this.waitData=webix.promise.defer(),t&&(this.s.datatype=t.datatype||"json",this.$ready.push(this.K))},K:function(){this.L=!0,this.s.url&&this.url_setter(this.s.url),this.s.data&&this.data_setter(this.s.data)
},url_setter:function(t){if("string"==typeof t&&-1!=t.indexOf("->")){var e=t.split("->");t=webix.proxy(e[0],e[1])}return this.L?(this.load(t,this.s.datatype),t):t},data_setter:function(t){return this.L?(this.parse(t,this.s.datatype),!0):t},load:function(t,e){var i=arguments[2]||null;this.callEvent("onBeforeLoad",[]),"string"==typeof e?(this.data.driver=webix.DataDriver[e],e=arguments[2]):this.data.driver||(this.data.driver=webix.DataDriver.json);
var s=[{success:this.M,error:this.N}];if(e&&(webix.isArray(e)?s.push.apply(s,e):s.push(e)),"string"==typeof t&&-1!=t.indexOf("->")){var n=t.split("->");t=webix.proxy(n[0],n[1])}return t.$proxy&&t.load?t.load(this,s,i):"function"==typeof t?t(i).then(webix.bind(function(t){webix.ajax.$callback(this,s,"",t,-1)
},this),webix.bind(function(t){webix.ajax.$callback(this,s,"",null,t,!0)},this)):webix.ajax(t,s,this)},parse:function(t,e){return t&&t.then&&"function"==typeof t.then?t.then(webix.bind(function(t){t&&"function"==typeof t.json&&(t=t.json()),this.parse(t,e)},this)):t&&t.sync&&this.sync?this.sync(t):(this.callEvent("onBeforeLoad",[]),this.data.driver=webix.DataDriver[e||"json"],void this.M(t,null))
},M:function(t,e,i){var s,n=this.data.driver;s=-1===i?e:n.toObject(t,e),s?this.data=n.getDetails(n.getRecords(s)[0]):this.N(t,e,i),this.callEvent("onAfterLoad",[]),this.waitData.resolve()},N:function(t,e,i){this.callEvent("onAfterLoad",[]),this.callEvent("onLoadError",arguments),webix.callEvent("onLoadError",[t,e,i,this])
},O:function(t){if(!this.s.dataFeed||this.P||!t)return!0;var e=this.s.dataFeed;return"function"==typeof e?e.call(this,t.id||t,t):(e=e+(-1==e.indexOf("?")?"?":"&")+"action=get&id="+encodeURIComponent(t.id||t),this.callEvent("onBeforeLoad",[]),webix.ajax(e,function(t,e,i){this.P=!0;var s=webix.DataDriver.json,n=s.toObject(t,e);
n?this.setValues(s.getDetails(s.getRecords(n)[0])):this.N(t,e,i),this.P=!1,this.callEvent("onAfterLoad",[])},this),!1)}},webix.DataDriver={},webix.DataDriver.json={toObject:function(data){if(!data)return null;if("string"==typeof data)try{if(this.parseDates){var isodate=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;
data=JSON.parse(data,function(t,e){return"string"==typeof e&&isodate.test(e)?new Date(e):e})}else webix.env.strict?data=JSON.parse(data):(eval("webix.temp="+data),data=webix.temp)}catch(e){return null}return data},getRecords:function(t){return t&&t.data&&(t=t.data),t&&!webix.isArray(t)?[t]:t},getDetails:function(t){return"string"==typeof t?{id:t||webix.uid(),value:t}:t
},getOptions:function(t){return t.collections},getInfo:function(t){return{Q:t.total_count||0,R:t.pos||0,S:t.parent||0,T:t.config,U:t.webix_security}},child:"data",parseDates:!1},webix.DataDriver.html={toObject:function(t){if("string"==typeof t){var e=null;return-1==t.indexOf("<")&&(e=webix.toNode(t)),e||(e=document.createElement("DIV"),e.innerHTML=t),e.firstChild
}return t},getRecords:function(t){return t.getElementsByTagName(this.tag)},getDetails:function(t){return webix.DataDriver.xml.tagToObject(t)},getOptions:function(){return!1},getInfo:function(){return{Q:0,R:0}},tag:"LI"},webix.DataDriver.jsarray={toObject:function(data){return"string"==typeof data?webix.env.strict?JSON.parse(data):(eval("webix.temp="+data),webix.temp):data
},getRecords:function(t){return t},getDetails:function(t){for(var e={},i=0;i<t.length;i++)e["data"+i]=t[i];return null!==this.idColumn&&(e.id=t[this.idColumn]),e},getOptions:function(){return!1},getInfo:function(){return{Q:0,R:0}},idColumn:null},webix.DataDriver.csv={toObject:function(t){return t},getRecords:function(t){return t.split(this.row)
},getDetails:function(t){t=this.stringToArray(t);for(var e={},i=0;i<t.length;i++)e["data"+i]=t[i];return null!==this.idColumn&&(e.id=t[this.idColumn]),e},getOptions:function(){return!1},getInfo:function(){return{Q:0,R:0}},stringToArray:function(t){t=t.split(this.cell);for(var e=0;e<t.length;e++)t[e]=t[e].replace(/^[ \t\n\r]*(\"|)/g,"").replace(/(\"|)[ \t\n\r]*$/g,"");
return t},idColumn:null,row:"\n",cell:","},webix.DataDriver.xml={V:function(t){return t&&t.documentElement?t.getElementsByTagName("parsererror").length?null:t:null},toObject:function(t,e){var i=e?e.rawxml?e.rawxml():e:null;return this.V(i)?i:(i="string"==typeof t?this.fromString(t.replace(/^[\s]+/,"")):t,this.V(i)?i:null)
},getRecords:function(t){return this.xpath(t,this.records)},records:"/*/item",child:"item",config:"/*/config",getDetails:function(t){return this.tagToObject(t,{})},getOptions:function(){return!1},getInfo:function(t){var e=this.xpath(t,this.config);return e=e.length?this.assignTypes(this.tagToObject(e[0],{})):null,{Q:t.documentElement.getAttribute("total_count")||0,R:t.documentElement.getAttribute("pos")||0,S:t.documentElement.getAttribute("parent")||0,T:e,U:t.documentElement.getAttribute("webix_security")||null}
},xpath:function(t,e){if(window.XPathResult){var i=t;-1==t.nodeName.indexOf("document")&&(t=t.ownerDocument);for(var s=[],n=t.evaluate(e,i,null,XPathResult.ANY_TYPE,null),r=n.iterateNext();r;)s.push(r),r=n.iterateNext();return s}var a=!0;try{"undefined"==typeof t.selectNodes&&(a=!1)}catch(h){}if(a)return t.selectNodes(e);
var o=e.split("/").pop();return t.getElementsByTagName(o)},assignTypes:function(t){for(var e in t){var i=t[e];if("object"==typeof i)this.assignTypes(i);else if("string"==typeof i){if(""===i)continue;"true"==i?t[e]=!0:"false"==i?t[e]=!1:i==1*i&&(t[e]=1*t[e])}}return t},tagToObject:function(t,e){var i=1==t.nodeType&&t.getAttribute("stack"),s=0;
if(i){e=[];for(var n=t.childNodes,r=0;r<n.length;r++)1==n[r].nodeType&&e.push(this.tagToObject(n[r],{}))}else{e=e||{};var a=t.attributes;if(a&&a.length)for(var r=0;r<a.length;r++){e[a[r].name]=a[r].value;var s=1}for(var n=t.childNodes,r=0;r<n.length;r++)if(1==n[r].nodeType){var h=n[r].tagName;e[h]?("function"!=typeof e[h].push&&(e[h]=[e[h]]),e[h].push(this.tagToObject(n[r],{}))):e[h]=this.tagToObject(n[r],{}),s=2
}if(!s)return this.nodeValue(t);2>s&&(e.value=e.value||this.nodeValue(t))}return e},nodeValue:function(t){return t.firstChild?t.firstChild.wholeText||t.firstChild.data:""},fromString:function(t){try{if(window.DOMParser)return(new DOMParser).parseFromString(t,"text/xml");if(window.ActiveXObject){var e=new ActiveXObject("Microsoft.xmlDOM");
return e.loadXML(t),e}}catch(i){return null}}},webix.BaseBind={bind:function(t,e,i){this.attachEvent||webix.extend(this,webix.EventSystem),"string"==typeof t&&(t=webix.$$(t)),t.W&&t.W(),this.W&&this.W(),t.getBindData||webix.extend(t,webix.BindSource),this.X(),t.addBind(this.s.id,e,i),this.Os=t.s.id;var s=this.s.id;
this.Ps=this.attachEvent(this.touchable?"onAfterRender":"onBindRequest",function(){return t.getBindData(s)}),this.refresh&&this.isVisible(this.s.id)&&this.refresh()},unbind:function(){if(this.Os){var t=webix.$$(this.Os);t&&t.removeBind(this.s.id),this.detachEvent(this.Ps),this.Os=null}},X:function(){var t=this.s;
if(this.filter){var e=t.id;this.data.Y=webix.bind(function(){webix.$$(this.Os).Z[e]=!1},this)}var i=this.render;this.render=function(){if(!this.$){this.$=!0;var t=this.callEvent("onBindRequest");return this.$=!1,i.apply(this,t===!1?arguments:[])}},(this.getValue||this.getValues)&&(this.save=function(){return this.validate&&!this.validate()?!1:(webix.$$(this.Os).setBindData(this.getValue?this.getValue:this.getValues(),this.s.id),void(this.setDirty&&this.setDirty(!1)))
}),!t.dataFeed&&this.loadNext&&this.data.attachEvent("onStoreLoad",webix.bind(function(){this.Os&&(webix.$$(this.Os).Z[this.s.id]=!1)},this)),this.X=function(){}}},webix.BindSource={$init:function(){this.bb={},this.Z={},this.cb={},this.db(this)},saveBatch:function(t){this.eb=!0,t.call(this),this.eb=!1,this.fb()
},setBindData:function(t,e){if(e&&(this.cb[e]=!0),this.setValue)this.setValue(t);else if(this.setValues)this.setValues(t);else{var i=this.getCursor();i?this.updateItem(i,t):this.add(t)}this.callEvent("onBindUpdate",[t,e]),this.save&&this.save(),e&&(this.cb[e]=!1)},getBindData:function(t,e){if(this.Z[t])return!1;
var i=webix.$$(t);i.isVisible(i.s.id)&&(this.Z[t]=!0,this.gb(i,this.bb[t][0],this.bb[t][1]),e&&i.filter&&i.refresh())},addBind:function(t,e,i){this.bb[t]=[e,i]},removeBind:function(t){delete this.bb[t],delete this.Z[t],delete this.cb[t]},db:function(t){t.filter?webix.extend(this,webix.CollectionBind):t.setValue?webix.extend(this,webix.ValueBind):webix.extend(this,webix.RecordBind)
},fb:function(){if(!this.eb)for(var t in this.bb)this.cb[t]||(this.Z[t]=!1,this.getBindData(t,!0))},hb:function(t,e,i){t.setValue?t.setValue(i&&e?i[e]:i):t.filter?t.data.silent(function(){this.filter(e,i)}):!i&&t.clear?t.clear():t.O(i)&&t.setValues(webix.clone(i)),t.callEvent("onBindApply",[i,e,this])
}},webix.DataValue=webix.proto({name:"DataValue",isVisible:function(){return!0},$init:function(t){(!t||webix.isUndefined(t.value))&&(this.data=t||"");var e=t&&t.id?t.id:webix.uid();this.s={id:e},webix.ui.views[e]=this},setValue:function(t){this.data=t,this.callEvent("onChange",[t])},getValue:function(){return this.data
},refresh:function(){this.callEvent("onBindRequest")}},webix.EventSystem,webix.BaseBind),webix.DataRecord=webix.proto({name:"DataRecord",isVisible:function(){return!0},$init:function(t){this.data=t||{};var e=t&&t.id?t.id:webix.uid();this.s={id:e},webix.ui.views[e]=this},getValues:function(){return this.data
},setValues:function(t,e){this.data=e?webix.extend(this.data,t,!0):t,this.callEvent("onChange",[t])},refresh:function(){this.callEvent("onBindRequest")}},webix.EventSystem,webix.BaseBind,webix.AtomDataLoader,webix.Settings),webix.ValueBind={$init:function(){this.attachEvent("onChange",this.fb)},gb:function(t,e,i){e=e||"value";
var s=this.getValue()||"";if(i&&(s=i(s)),t.setValue)t.setValue(s);else if(t.filter)t.data.silent(function(){this.filter(e,s)});else{var n={};n[e]=s,t.O(s)&&t.setValues(n)}t.callEvent("onBindApply",[s,e,this])}},webix.RecordBind={$init:function(){this.attachEvent("onChange",this.fb)},gb:function(t,e,i){var s=this.getValues()||null;
i&&(s=i(s)),this.hb(t,e,s)}},webix.CollectionBind={$init:function(){this.ib=null,this.attachEvent("onSelectChange",function(){var t=this.getSelectedId();this.setCursor(t?t.id||t:null)}),this.attachEvent("onAfterCursorChange",this.fb),this.attachEvent("onAfterDelete",function(t){t==this.getCursor()&&this.setCursor(null)
}),this.data.attachEvent("onStoreUpdated",webix.bind(function(t,e,i){t&&t==this.getCursor()&&"paint"!=i&&"delete"!=i&&this.fb()},this)),this.data.attachEvent("onClearAll",webix.bind(function(){this.ib=null},this)),this.data.attachEvent("onIdChange",webix.bind(function(t,e){this.ib==t&&(this.ib=e,this.fb())
},this))},refreshCursor:function(){this.ib&&this.callEvent("onAfterCursorChange",[this.ib])},setCursor:function(t){t==this.ib||null!==t&&!this.getItem(t)||(this.callEvent("onBeforeCursorChange",[this.ib]),this.ib=t,this.callEvent("onAfterCursorChange",[t]))},getCursor:function(){return this.ib},gb:function(t,e,i){if("$level"==e&&this.data.getBranch)return(t.data||t).importData(this.data.getBranch(this.getCursor()));
var s=this.getItem(this.getCursor())||this.s.defaultData||null;return"$data"==e?"function"==typeof i?i.call(t,s,this):t.data.importData(s?s[i]:[]):(i&&(s=i(s)),void this.hb(t,e,s))}},webix.AtomRender={jb:function(t){return t.$empty?"":this.s.template(t,this)},render:function(){return this.isVisible(this.s.id)?((!this.callEvent||this.callEvent("onBeforeRender",[this.data]))&&(this.data&&!this.s.content&&(this.y.innerHTML=this.jb(this.data)),this.callEvent&&this.callEvent("onAfterRender",[])),!0):!1
},sync:function(t){this.kb=!1,"DataStore"!=t.name&&(t.data&&"DataStore"==t.name?t=t.data:this.kb=!0),this.kb?t.bind("change",webix.bind(function(t){t.id==this.data.id&&(this.data=t.attributes,this.refresh())},this)):t.attachEvent("onStoreUpdated",webix.bind(function(e){e&&e!=this.data.id||(this.data=t.pull[e],this.refresh())
},this))},template_setter:webix.template},webix.SingleRender=webix.proto({template_setter:function(t){this.type.template=webix.template(t)},jb:function(t){var e=this.type;return(e.templateStart?e.templateStart(t,e):"")+e.template(t,e)+(e.templateEnd?e.templateEnd(t,e):"")},customize:function(t){webix.type(this,t)
}},webix.AtomRender),webix.UIManager={A:null,lb:{},mb:0,nb:{enter:13,tab:9,esc:27,escape:27,up:38,down:40,left:37,right:39,pgdown:34,pagedown:34,pgup:33,pageup:33,end:35,home:36,"delete":46,backspace:8,space:32,meta:91,win:91,mac:91},ob:function(){webix.event(document.body,"click",webix.bind(this.pb,this)),webix.event(document,"keydown",webix.bind(this.qb,this)),document.body.addEventListener&&document.body.addEventListener("focus",webix.bind(this.rb,this),!0),webix.destructors.push(this)
},destructor:function(){webix.UIManager.A=null},getFocus:function(){return this.A},sb:function(t){this.tb=this.tb||t.s.id},setFocus:function(t,e){return t=webix.$$(t),t&&!t.$view&&(t=null),this.mb=new Date,this.A===t?!0:(this.A&&this.A.callEvent&&this.A.callEvent("onBlur",[this.A]),t&&t.callEvent&&t.callEvent("onFocus",[t,this.A]),webix.callEvent("onFocusChange",[t,this.A]),this.A&&this.A.blur&&!e&&this.A.blur(),this.A=t,t&&t.focus&&!e&&t.focus(),!0)
},hasFocus:function(t){return t===this.A?!0:!1},ub:function(t,e){var i=webix.html.locate(t,"view_id")||this.tb;return i=webix.$$(i),this.tb=null,i!=this.A?(e||(this.tb=null),i?(i=webix.$$(i),this.canFocus(i)&&this.setFocus(i)):e||this.setFocus(null),!0):void 0},pb:function(t){return new Date-this.mb<100?!1:this.ub(t)
},rb:function(t){return this.ub(t,!0)},canFocus:function(t){return t.isVisible()&&t.isEnabled()},vb:function(t){var e=this.getFocus();return t&&!this.wb(t,e)?!1:void(this.xb("getPrev",t)?this.A=null:this.setFocus(this.getPrev(t)))},wb:function(t,e){if(!t)return!1;if(!e)return!1;for(;e;){if(e===t)return!0;
e=e.getParentView()}return!1},yb:function(){this&&this.callEvent&&this.callEvent("onTimedKeyPress",[])},qb:function(t){var e=t.which||t.keyCode;e>95&&112>e&&(e-=48);var i=t.ctrlKey,s=t.shiftKey,n=t.altKey,r=t.metaKey,a=this.zb(e,i,s,n,r),h=this.getFocus();h&&h.callEvent&&(h.callEvent("onKeyPress",[e,t])===!1&&webix.html.preventEvent(t),h.hasEvent("onTimedKeyPress")&&(clearTimeout(h.Ab),h.Ab=webix.delay(this.yb,h,[],h.s.keyPressTimeout||250))),this.tabControl&&(9!==e||i||n||r||(this.xb(s?"getPrev":"getNext"),webix.html.preventEvent(t))),a=this.zb(String.fromCharCode(e),i,s,n,r);
var o=!i&&!n&&!r&&9!=e&&27!=e&&13!=e;return this.Bb(a,o,t)===!1?(webix.html.preventEvent(t),!1):void 0},xb:function(t){if(!this.getFocus())return null;t=t||"getNext";for(var e=this.getFocus(),i=e,s=webix.uid();;){if(e=this[t](e),e&&e.s.tabFocus&&this.canFocus(e))return this.setFocus(e);if(e===i||e.$fmarker==s)return null;
e.$fmarker=s}},getTop:function(t){for(var e,i=webix.$$(t);i&&(e=i.getParentView());)i=e;return i},getNext:function(t,e){var i=t.getChildViews();if(i.length&&!e)return i[0];var s=t.getParentView();if(!s)return t;var n=s.getChildViews();if(n.length)for(var r=webix.PowerArray.find.call(n,t)+1;r<n.length;){if(this.canFocus(n[r]))return n[r];
r++}return this.getNext(s,!0)},getPrev:function(t,e){var i=t.getChildViews();if(i.length&&e)return this.getPrev(i[i.length-1],!0);if(e)return t;var s=t.getParentView();if(!s)return this.getPrev(t,!0);var n=s.getChildViews();if(n)for(var r=webix.PowerArray.find.call(n,t)-1;r>=0;){if(this.canFocus(n[r]))return this.getPrev(n[r],!0);
r--}return s},addHotKey:function(t,e,i){var s=this.Cb(t);i||(i=null),s.handler=e,s.view=i;var n=this.zb(s.letter,s.ctrl,s.shift,s.alt,s.meta);return this.lb[n]||(this.lb[n]=[]),this.lb[n].push(s),t},removeHotKey:function(t,e,i){var s=this.Cb(t),n=this.zb(s.letter,s.ctrl,s.shift,s.alt,s.meta);if(e||i){var r=this.lb[n];
if(r){for(var a=r.length-1;a>=0;a--)i&&r[a].view!==i||e&&r[a].handler!==e||r.splice(a,1);r.length||delete this.lb[n]}}else delete this.lb[n]},zb:function(t,e,i,s,n){return t+"_"+["",e?"1":"0",i?"1":"0",s?"1":"0",n?"1":"0"].join("")},Bb:function(t,e,i){var s=this.getFocus();return this.lb[t]?this.Db(this.lb[t],s,i):e&&this.lb.ANY_0000?this.Db(this.lb.ANY_0000,s,i):!0
},Db:function(t,e,i){for(var s=0;s<t.length;s++){var n=t[s];if(null===n.view||e===n.view||"string"==typeof n.view&&e&&e.name===n.view){var r=n.handler(e,i);if(!!r===r)return r}}return!0},Cb:function(t){var e,i,s,n,r=this.nb,a=t.toLowerCase().split(/[\+\-_]/);e=i=s=n=0;for(var h="",o=0;o<a.length;o++)"ctrl"===a[o]?e=1:"shift"===a[o]?i=1:"alt"===a[o]?s=1:"command"===a[o]?n=1:h=r[a[o]]?String.fromCharCode(r[a[o]]):a[o];
return{letter:h.toUpperCase(),ctrl:e,shift:i,alt:s,meta:n}}},webix.ready(function(){webix.UIManager.ob(),webix.UIManager.addHotKey("enter",function(t){return t&&t.editStop&&t.Eb?(t.editStop(),!0):void 0}),webix.UIManager.addHotKey("esc",function(t){if(t){if(t.editCancel&&t.Eb)return t.editCancel(),!0;
var e=t.getTopParentView();e&&e.setPosition&&e.Fb()}}),webix.UIManager.addHotKey("shift+tab",function(t,e){if(t&&t.Gb&&!t.Gb(!1,e))return!1;if(t&&t.Eb){if(t.editNext)return t.editNext(!1);if(t.editStop)return t.editStop(),!0}}),webix.UIManager.addHotKey("tab",function(t,e){if(t&&t.Gb&&!t.Gb(!0,e))return!1;
if(t&&t.Eb){if(t.editNext)return t.editNext(!0);if(t.editStop)return t.editStop(),!0}else webix.delay(function(){webix.UIManager.setFocus(webix.$$(document.activeElement),!0)},1)})}),webix.IdSpace={$init:function(){this.Hb={},this.Ib={},this.getTopParentView=webix.bind(function(){return this},this),this.Jb(),this.$ready.push(this.Kb)
},$$:function(t){return this.Hb[t]},innerId:function(t){return this.Ib[t]},Jb:function(){this.Lb=webix.Mb,webix.Mb=this},Kb:function(){for(var t in this.Hb){var e=this.Hb[t];this.callEvent&&e.mapEvent&&!e.k.onitemclick&&e.mapEvent({onitemclick:this}),e.getTopParentView=this.getTopParentView}webix.Mb=this.Lb,this.Lb=0
},ui:function(){this.Jb();var t=webix.ui.apply(webix,arguments);return this.Kb(),t}},function(){var t=[],e=webix.ui;webix.ui||(e=webix.ui=function(i,s,n){webix.Nb=!0;var r,a=webix.toNode(i.container||s||document.body),h=a==document.body;return i.s||a&&webix.isArray(i)?r=i:(a&&h&&(i.$topView=!0),i.Ob||(i.Ob={}),r=e.A(i)),h&&!r.setPosition&&webix.ui.Pb(),r.s&&r.s.ft&&!a.$view?r.s.gt=a:r.$apiOnly||(a.appendChild?(a.appendChild(r.x),((!r.setPosition||r.s.fullscreen)&&a==document.body||r.s.position)&&t.push(r),i.skipResize||r.adjust()):a.destructor&&(n||0===n||webix.isArray(r)||(n=a,a=a.getParentView()),a&&a.Qb&&(r.getParentView&&r.getParentView()&&r.getParentView().Rb(r),a.Qb(r,n)))),webix.Nb=!1,r
}),webix.ui.animate=function(t,e,i){var s=webix.$$(e);if(s){var n=i||{type:"slide",direction:"left"},r=s.x.cloneNode(!0),a=webix.ui(t,e);a.x.parentNode.appendChild(r);var h=webix.animate.formLine(a.x,r,n);return n.callback=function(){webix.animate.breakLine(h)},webix.animate(h,n),a}},webix.ui.Sb=function(){var t=webix.html.create("div");
t.className="webix_skin_mark",t.style.cssText="position:absolute;left:-1000px;width:100px;padding:0px;margin:0px;min-height:100px;overflow-y:scroll;",document.body.appendChild(t);var e=t.offsetWidth-t.clientWidth,i={110:"air",120:"aircompact",130:"clouds",140:"web",150:"terrace",160:"metro",170:"light",180:"glamour",190:"touch",200:"flat",210:"compact",220:"material"}[10*Math.floor(t.offsetHeight/10)];
if(document.body.removeChild(t),i){var s=webix.skin[i];s&&s!=webix.skin.$active&&webix.skin.set(i)}return webix.env.$customScroll?0:e},webix.ui.scrollSize=webix.env.touch||webix.env.$customScroll?0:17,webix.ready(function(){var t=webix.ui.Sb();webix.ui.scrollSize=webix.env.touch?0:t}),webix.ui.Tb=function(t){return"$"+t+(this.Ub[t]=(this.Ub[t]||0)+1)
},webix.ui.Ub={},webix.ui.Pb=function(){webix.html.addStyle("html, body{ height:100%; }"),document.body.className+=" webix_full_screen",webix.ui.Pb=function(){}},webix.ui.resize=function(){if(!webix.ui.$freeze)for(var e=t.length-1;e>=0;e--)t[e].$destructed?t.splice(e,1):t[e].adjust()},webix.ui.each=function(t,e,i,s){if(t)for(var n=s?[t]:t.getChildViews(),r=0;r<n.length;r++)e.call(i||webix,n[r])!==!1&&webix.ui.each(n[r],e,i)
},webix.event(window,"resize",webix.ui.resize),e.Wb={},e.delay=function(t){webix.ui.Wb[t.id]=t},e.hasMethod=function(t,e){var i=webix.ui[t];return i?(i.b&&(i=i.call(webix)),!!webix.ui[t].prototype[e]):!1},webix.ui.zIndex=function(){return webix.ui.zIndexBase++},webix.ui.zIndexBase=100,e.A=function(t){if(t.view){var i=t.view;
return new e[i](t)}if(t.rows||t.cols){for(var s=t.rows||t.cols,n=!1,r=0;r<s.length;r++)s[r].body&&!s[r].view&&(n=!0);return n?new e.headerlayout(t):new e.layout(t)}return t.cells?new e.multiview(t):t.template||t.content?new e.template(t):new e.spacer(t)},e.views={},webix.$$=function(t){if(!t)return null;
if(e.views[t])return e.views[t];if(e.Wb[t])return webix.ui(e.Wb[t]);var i=t;if("object"==typeof t){if(t.s)return t;i=t.target||t.srcElement||t}return e.views[webix.html.locate({target:webix.toNode(i)},"view_id")]},webix.isUndefined(window.$$)&&(window.$$=webix.$$),webix.UIExtension=window.webix_view||{},webix.protoUI({name:"baseview",$init:function(t){t.id||(t.id=webix.ui.Tb(this.name)),this.Xb=webix.Xb,webix.Xb=null,this.$scope=t.$scope||(this.Xb?this.Xb.$scope:null),this.x||(this.w=this.x=webix.html.create("DIV",{"class":"webix_view"}),this.$view=this.x)
},$skin:!1,defaults:{width:0,height:0,gravity:1},getNode:function(){return this.x},getParentView:function(){return this.Xb||null},getTopParentView:function(){var t=this.getParentView();return t?t.getTopParentView():this},getFormView:function(){var t=this.getParentView();return!t||t.setValues?t:t.getFormView()
},getChildViews:function(){return[]},isVisible:function(t){if(this.s.hidden)return t&&(this.Yb||(this.Yb=[],this.Zb={}),this.Zb[t]||(this.Zb[t]=!0,this.Yb.push(t))),!1;var e=this.getParentView();return e?e.isVisible(t,this.s.id):!0},isEnabled:function(){if(this.$b)return!1;var t=this.getParentView();
return t?t.isEnabled():!0},disable:function(){webix.html.remove(this.$b),this.s.disabled=!0,this.$b=webix.html.create("div",{"class":"webix_disabled"}),window.getComputedStyle&&(this._b=window.getComputedStyle(this.x,null).getPropertyValue("position")),"absolute"!=this._b&&(this.x.style.position="relative"),this.x.appendChild(this.$b),webix.html.addCss(this.x,"webix_disabled_view",!0),webix.UIManager.vb(this)
},enable:function(){this.s.disabled=!1,this.$b&&(webix.html.remove(this.$b),webix.html.removeCss(this.x,"webix_disabled_view"),this.$b=null,this._b&&(this.x.style.position=this._b))},disabled_setter:function(t){return t?this.disable():this.enable(),t},container_setter:function(t){return!0},css_setter:function(t){return"object"==typeof t&&(t=webix.html.createCss(t)),this.x.className+=" "+t,t
},id_setter:function(t){if(webix.Mb&&webix.Mb!=this){var e=this.config.$id=t;webix.Mb.Hb[t]=this,t=webix.ui.Tb(this.name),webix.Mb.Ib[t]=e}return webix.ui.views[t]=this,this.x.setAttribute("view_id",t),t},$setSize:function(t,e){var i=this.ac;if(i&&i[0]==t&&i[1]==e)return!1;if(this.ac=[t,e],this.$width=this.bc=t-(this.cc?webix.ui.scrollSize:0),this.$height=this.dc=e-(this.ec?webix.ui.scrollSize:0),this.x.style.width=t+"px",this.x.style.height=e+"px",webix.env.isWebKit){this.x.offsetWidth,this.x.offsetHeight
}return!0},$getSize:function(t,e){var i=this.s,s=[i.width||i.minWidth||0,i.width||i.maxWidth||1e5,i.height||i.minHeight||0,i.height||i.maxHeight||1e5,i.gravity];return s[0]+=t,s[1]+=t,s[2]+=e,s[3]+=e,s},show:function(t,e){var i=this.getParentView(),s=!arguments[2];if(i)!e&&e!==!1&&this.s.animate&&i.s.animate&&(e=webix.extend(i.s.animate?webix.extend({},i.s.animate):{},this.s.animate,!0)),(s?i.fc:i.Fb)&&(s?i.fc:i.Fb).call(i,this,e),s&&this.Qd(),t&&s&&i.show(t);
else if(this.s.hidden){if(s){var n=webix.toNode(this.s.gt||document.body);n.appendChild(this.x),this.s.hidden=!1,this.adjust(),this.Qd()}}else s||(this.s.hidden=this.s.ft=!0,this.x&&(this.s.gt=this.x.parentNode,webix.html.remove(this.x)))},Qd:function(){if(this.Yb){for(var t=0;t<this.Yb.length;t++){var e=webix.$$(this.Yb[t]);
e&&e.render()}this.Yb=[],this.Zb={}}},hidden_setter:function(t){return t&&this.hide(),this.s.hidden},hide:function(){this.show(null,null,!0),webix.UIManager.vb(this)},adjust:function(){if(!this.x.parentNode)return!1;var t=this.x.parentNode.offsetWidth||0,e=this.x.parentNode.offsetHeight||0,i=this.$getSize(0,0);
i[0]>t&&(t=i[0]),i[2]>e&&(e=i[2]),t>i[1]&&(t=i[1]),e>i[3]&&(e=i[3]),this.$setSize(t,e)},resize:function(){if(!webix.gc&&!webix.ui.$freeze){var t=this.getParentView();t?t.resizeChildren?t.resizeChildren():t.resize():this.adjust()}}},webix.Settings,webix.Destruction,webix.BaseBind,webix.UIExtension),webix.protoUI({name:"view",$init:function(t){this.hc(t)
},hc:function(t){var e=webix.isUndefined(t.borderless);e&&!this.setPosition&&t.$topView&&(t.borderless=!0,e=!1),e&&this.defaults.borderless||t.borderless?t.Ob={top:!0,left:!0,bottom:!0,right:!0}:(t.Ob||(t.Ob={}),this.w.style.borderWidth="1px")},$getSize:function(t,e){var i=this.s.Ob;i&&(t+=(i.left?0:1)+(i.right?0:1),e+=(i.top?0:1)+(i.bottom?0:1));
var s=webix.ui.baseview.prototype.$getSize.call(this,t,e);return s},$setSize:function(t,e){var i=this.s.Ob;return i&&(t-=(i.left?0:1)+(i.right?0:1),e-=(i.top?0:1)+(i.bottom?0:1)),webix.ui.baseview.prototype.$setSize.call(this,t,e)}},webix.ui.baseview)}(),webix.ui.view.call(webix),webix.protoUI({name:"spacer",defaults:{borderless:!0},$init:function(){this.x.className+=" webix_spacer"
}},webix.ui.view),webix.protoUI({name:"baselayout",$init:function(t){this.$ready.push(this.kc),this.y=this.w,this.lc=[],this.ht=[],t.$topView&&(t.borderless=!0,t.Ob={top:!0,left:!0,bottom:!0,right:!0}),t.isolate&&webix.extend(this,webix.IdSpace)},rows_setter:function(t){this.mc=1,this.nc=t},cols_setter:function(t){this.mc=0,this.$view.style.whiteSpace="nowrap",this.nc=t
},Rb:function(t){webix.PowerArray.removeAt.call(this.q,webix.PowerArray.find.call(this.q,t)),this.resizeChildren(!0)},Qb:function(t,e){if(webix.isUndefined(e)){for(var i=0;i<this.q.length;i++)this.q[i].destructor();this.nc=t,this.kc()}else{var s;if("number"==typeof e){(0>e||e>this.q.length)&&(e=this.q.length);
var n=(this.q[e]||{}).x;webix.PowerArray.insertAt.call(this.q,t,e),t.s.hidden||webix.html.insertBefore(t.x,n,this.y)}else{s=webix.$$(e),e=webix.PowerArray.find.call(this.q,s);var r=s.x.parentNode;r&&!t.s.hidden&&r.insertBefore(t.x,s.x),s.destructor(),this.q[e]=t}this.mc||this.oc(t),this.q[e].Xb=this}this.resizeChildren(!0);
var a=this.elements?this:this.getFormView();a&&a.Qs(),webix.callEvent("onReconstruct",[this])},oc:function(t){t.x.style.display="inline-block",t.x.style.verticalAlign="top"},addView:function(t,e){return webix.isUndefined(e)&&(e=this.q.length),webix.ui(t,this,e).s.id},removeView:function(t){var e;e="object"!=typeof t?webix.$$(t):t;
var i=webix.PowerArray.find.call(this.q,e);if(i>=0){this.Vx&&this.Vx(i,e);var s=this.elements?this:this.getFormView();this.q.splice(i,1),s&&webix.ui.each(e,function(t){t.name&&delete s.getCleanValues()[t.config.name]},s,!0),e.destructor(),this.resizeChildren(!0),s&&s.Qs()}webix.callEvent("onReconstruct",[this])
},reconstruct:function(){this.Qb(this.nc)},Fb:function(t,e,i){t.s.hidden||(t.s.hidden=!0,webix.html.remove(t.x),this.qc++,i||webix.Nb||this.resizeChildren(!0))},Lw:function(t){t.callEvent&&t.callEvent("onViewShow",[])},resizeChildren:function(){if(!webix.ui.$freeze&&this.lc){var t=this.getParentView();
if(t)return t.resizeChildren?t.resizeChildren():t.resize();var e,i,s,n,r=this.$getSize(0,0);s=e=this.lc[0]||0,n=i=this.lc[1]||0,t?this.rc(e,i):(r[0]>e&&(s=r[0]),r[2]>i&&(n=r[2]),e>r[1]&&(s=r[1]),i>r[3]&&(n=r[3]),this.$setSize(s,n))}},getChildViews:function(){return this.q},index:function(t){t.s&&(t=t.s.id);
for(var e=0;e<this.q.length;e++)if(this.q[e].s.id==t)return e;return-1},fc:function(t,e,i){if(t.s.hidden){t.s.hidden=!1;for(var s=this.index(t)+1;this.q[s]&&this.q[s].s.hidden;)s++;var n=this.q[s]?this.q[s].x:null;webix.html.insertBefore(t.x,n,this.y||this.x),this.qc--,i||(this.resizeChildren(!0),t.refresh&&t.refresh()),t.callEvent&&(t.callEvent("onViewShow",[]),webix.ui.each(t,this.Lw))
}},showBatch:function(t){if(this.s.visibleBatch!=t){this.s.visibleBatch=t;for(var e=[],i=0;i<this.q.length;i++)this.q[i].s.batch?this.q[i].s.batch==t?e.push(this.q[i]):this.Fb(this.q[i],null,!0):e.push(this.q[i]);for(var i=0;i<e.length;i++)this.fc(e[i],null,!0);this.resizeChildren(!0)}},kc:function(t){this.q=[];
for(var e=0;e<t.length;e++)webix.Xb=this,t[e].Ob||(t[e].borderless=!0),this.q[e]=webix.ui.A(t[e],this),this.mc||this.oc(this.q[e]),this.s.visibleBatch&&this.s.visibleBatch!=this.q[e].s.batch&&this.q[e].s.batch&&(this.q[e].s.hidden=!0,this.qc++),this.q[e].s.hidden||((this.y||this.w).appendChild(this.q[e].x),this.q[e].$nospace&&this.qc++);
this.sc&&this.sc(t)},tc:function(t,e,i){if(this.mc!=i)for(var s=0;s<this.q.length;s++)this.q[s].s[t]=e,this.q[s].tc&&this.q[s].tc(t,e,i)},$getSize:function(t,e){var i=0,s=1e5,n=1e5,r=0;this.mc?n=0:s=0;var a=0,h=0,o=0;this.uc=[];for(var l=0;l<this.q.length;l++)if(!this.q[l].s.hidden){var c=this.uc[l]=this.q[l].$getSize(0,0);
this.q[l].$nospace?h++:this.mc?(c[0]>i&&(i=c[0]),c[1]<s&&(s=c[1]),r+=c[2],n+=c[3],c[2]==c[3]&&-1!=c[2]?(a+=c[2],h++):o+=c[4]):(c[2]>r&&(r=c[2]),c[3]<n&&(n=c[3]),i+=c[0],s+=c[1],c[0]==c[1]&&-1!=c[0]?(a+=c[0],h++):o+=c[4])}r>n&&(n=r),i>s&&(s=i),this.vc=[a,this.q.length-h,o],this.ng=[i+t,r+e];var u=webix.ui.baseview.prototype.$getSize.call(this,0,0);
return u[1]>=1e5&&(u[1]=0),u[3]>=1e5&&(u[3]=0),u[0]=(u[0]||i)+t,u[1]=Math.max(u[0],(u[1]||s)+t),u[2]=(u[2]||r)+e,u[3]=Math.max(u[2],(u[3]||n)+e),this.s.responsive&&(u[0]=0),u},$setSize:function(t,e){this.lc=[t,e],webix.ui.baseview.prototype.$setSize.call(this,t,e),this.rc(t,e)},wc:function(t,e,i){e=t[e],i=t[i];
var s=e;if(e!=i){var n=this.xc*t[4]/this.yc;if(e>n)s=e,this.yc-=t[4],this.xc-=s;else{if(!(n>i))return-1;s=i,this.yc-=t[4],this.xc-=s}}return s},it:function(t,e){var i=webix.$$(e);"hide"!==i&&i?(i||(i=webix.ui({view:"popup",body:[{}]})),t.jt=t.s.width,t.kt=t.s.height,t.lt=i.s.id,t.s.width=0,t.s.height||(t.s.autoheight=!0),webix.ui(t,i,this.ht.length)):(t.hide(),webix.delay(this.resize,this),t.lt="hide"),this.ht.push(t)
},mt:function(t){var e=t.lt;t.lt=0,"hide"!==e&&e?(t.s.width=t.jt,t.s.height=t.kt,delete t.s.autoheight,webix.ui(t,this,0)):(t.show(),webix.delay(this.resize,this)),this.ht.pop()},nt:function(t){if(!this.ot){if(this.ot=!0,t<this.ng[0])for(var e=0;e<this.q.length-1;e++){var i=this.q[e];if(!i.lt){this.it(i,this.s.responsive);
break}}else if(this.ht.length){var i=this.ht[this.ht.length-1],s="hide"==i.lt?0:i.jt,n=i.$getSize(s,0);n[0]+this.ng[0]+this.Dc+20<=t&&this.mt(i)}this.ot=!1}},rc:function(t,e){webix.gc=(webix.gc||0)+1,this.s.responsive&&this.nt(t,e),this.xc=(this.mc?e:t)-this.vc[0],this.yc=this.vc[2];for(var i=t,s=e,n=[],r=0;r<this.q.length;r++)if(!this.q[r].s.hidden){var a=this.uc[r];
if(this.mc){var s=this.wc(a,2,3);if(0>s){n.push(r);continue}}else{var i=this.wc(a,0,1);if(0>i){n.push(r);continue}}this.q[r].$setSize(i,s)}for(var r=0;r<n.length;r++){var h=n[r],a=this.uc[h],o=Math.round(this.xc*a[4]/this.yc);this.xc-=o,this.yc-=a[4],this.mc?s=o:i=o,this.q[h].$setSize(i,s)}webix.gc-=1
},zc:function(t,e){var i=this.index(t);return-1==i?null:this.q[i+e]},Ac:function(){return this.q[0]}},webix.EventSystem,webix.ui.baseview),webix.protoUI({name:"layout",$init:function(){this.qc=0},defaults:{type:"line"},kc:function(){this.Bc&&(t=this.Bc(t)),this.Uw||(this.x.className+=" webix_layout_"+(this.s.type||""),this.Uw=1),this.s.margin!==webix.undefined&&(this.Cc=this.s.margin),this.s.padding!=webix.undefined&&(this.Dc=this.Ec=this.s.padding),this.s.paddingX!==webix.undefined&&(this.Dc=this.s.paddingX),this.s.paddingY!==webix.undefined&&(this.Ec=this.s.paddingY),(this.Ec||this.Dc)&&(this.Fc=!0),this.Wx()&&!this.s.borderless&&(this.w.style.borderWidth="1px",this.Gc=!0);
var t=this.nc;this.s.borderless&&(this.s.Ob={top:!0,left:!0,right:!0,bottom:!0}),this.Hc(t),webix.ui.baselayout.prototype.kc.call(this,t),this.Ic(t)},$getSize:function(t,e){t=t||0,e=e||0;var i=this.Cc*(this.q.length-this.qc-1);if(this.Gc||this.Wx()){var s=this.s.Ob;s&&(t+=(s.left?0:1)+(s.right?0:1),e+=(s.top?0:1)+(s.bottom?0:1))
}return this.s.height||(e+=2*(this.Ec||0)+(this.mc?i:0)),this.s.width||(t+=2*(this.Dc||0)+(this.mc?0:i)),webix.ui.baselayout.prototype.$getSize.call(this,t,e)},$setSize:function(t,e){this.lc=[t,e];var i;i=this.Wx()||this.Gc?webix.ui.view.prototype.$setSize.call(this,t,e):webix.ui.baseview.prototype.$setSize.call(this,t,e),e=this.dc,t=this.bc;
var s=this.s;s.scroll&&(e=Math.max(e,this.ng[1]),t=Math.max(t,this.ng[0])),this.rc(t,e)},rc:function(t,e){var i=this.Cc*(this.q.length-this.qc-1);return this.mc?(e-=i+2*this.Ec,t-=2*this.Dc):(t-=i+2*this.Dc,e-=2*this.Ec),webix.ui.baselayout.prototype.rc.call(this,t,e)},resizeChildren:function(t){if(t){this.ac=null;
for(var e=[],i=0;i<this.q.length;i++){var s=this.q[i];e[i]=s.s;var n=s.lc&&!s.Gc||s.s.borderless?"0px":"1px";s.x.style.borderTopWidth=s.x.style.borderBottomWidth=s.x.style.borderLeftWidth=s.x.style.borderRightWidth=n}this.Hc(e);for(var i=0;i<e.length;i++)e[i].borderless&&this.q[i].hc&&this.q[i].hc(e[i]);
this.Ic(this.q)}webix.ui.baselayout.prototype.resizeChildren.call(this)},Wx:function(){return this.Fc&&this.Cc>0&&!this.Xx},Hc:function(t){if(!this.Wx()||this.s.borderless&&"space"!=this.s.type){for(var e=0;e<t.length;e++)t[e].Ob=webix.clone(this.s.Ob);var i=!1;this.Xx&&(i=!0);var s=t.length;if(this.mc){for(var e=1;s-1>e;e++)t[e].Ob.top=t[e].Ob.bottom=i;
if(s>1){for("head"!=this.s.type&&(t[0].Ob.bottom=i);t[s-1].hidden&&s>1;)s--;s>0&&(t[s-1].Ob.top=i)}}else{for(var e=1;s-1>e;e++)t[e].Ob.left=t[e].Ob.right=i;if(s>1){for("head"!=this.s.type&&(t[0].Ob.right=i),t[s-1].Ob.left=i;s>1&&t[s-1].hidden;)s--;s>0&&(t[s-1].Ob.left=i)}}}else for(var e=0;e<t.length;e++)t[e].Ob&&t[e].borderless||(t[e].Ob={top:!1,left:!1,right:!1,bottom:!1})
},Jc:function(t,e){e.top&&(t.borderTopWidth="0px"),e.left&&(t.borderLeftWidth="0px"),e.right&&(t.borderRightWidth="0px"),e.bottom&&(t.borderBottomWidth="0px")},Ic:function(t){for(var e=0,i=0;i<t.length;i++){var s=this.q[i],n=s.s.Ob;if(s.s.hidden&&this.q[i+1]){var r=this.q[i+1].s.Ob;n.top||(r.top=!1),n.left||(r.left=!1),i==e&&e++
}this.Jc(s.x.style,s.s.Ob)}for(var a=this.mc?"marginLeft":"marginTop",h=this.mc?"marginTop":"marginLeft",o=this.mc?this.Dc:this.Ec,l=this.mc?this.Ec:this.Dc,i=0;i<t.length;i++)this.q[i].x.style[a]=(o||0)+"px";this.q.length&&(this.q[e].x.style[h]=(l||0)+"px");for(var c=e+1;c<t.length;c++)this.q[c].x.style[h]=this.Cc+"px"
},type_setter:function(t){return this.Cc="undefined"!=typeof this.Kc[t]?this.Kc[t]:this.Kc.line,this.Dc=this.Ec="undefined"!=typeof this.Kc[t]?this.Lc[t]:this.Lc.line,this.Xx="material"==t||"clean"==t,"material"==t&&(this.s.borderless=!0),t},$skin:function(){var t=webix.skin.$active;this.Kc=t.layoutMargin,this.Lc=t.layoutPadding
}},webix.ui.baselayout),webix.ui.layout.call(webix),webix.animate=function(t,e){var i=e;if(webix.isArray(t))for(var s=0;s<t.length;s++){if(webix.isArray(e)&&(i=e[s]),"slide"==i.type){if("out"==i.subtype&&0===s)continue;if("in"==i.subtype&&1==s)continue}if("flip"!=i.type)webix.animate(t[s],i);else{var n=webix.clone(i);
0===s&&(n.type="flipback"),1==s&&(n.callback=null),webix.animate(t[s],n)}}else{var r=webix.toNode(t);r.Mc?webix.animate.end(r,i):webix.animate.start(r,i)}},webix.animate.end=function(t,e){t.style[webix.env.transitionDuration]="1ms",t.Mc=null,webix.Nc&&window.clearTimeout(webix.Nc),webix.Nc=webix.delay(webix.animate,webix,[t,e],10)
},webix.animate.isSupported=function(){return!webix.$testmode&&!webix.noanimate&&webix.env.transform&&webix.env.transition&&!webix.env.isOpera},webix.animate.formLine=function(t,e,i){var s=i.direction;e.parentNode.style.position="relative",e.style.position="absolute",t.style.position="absolute";var n=webix.env.isFF?"top"==s||"left"==s?-1:1:0;
return"top"==s||"bottom"==s?(t.style.left="0px",t.style.top=(i.top||n)+("top"==s?1:-1)*e.offsetHeight+"px"):(t.style.top=(i.top||0)+"px",t.style.left=n+("left"==s?1:-1)*e.offsetWidth+"px"),e.parentNode==t.parentNode&&i.keepViews?t.style.display="":webix.html.insertBefore(t,e.nextSibling,e.parentNode),"slide"==i.type&&"out"==i.subtype&&(t.style.left="0px",t.style.top=(i.top||0)+"px",e.parentNode.removeChild(e),webix.html.insertBefore(e,t.nextSibling,t.parentNode)),[t,e]
},webix.animate.breakLine=function(t){arguments[1]?t[1].style.display="none":webix.html.remove(t[1]),webix.animate.clear(t[0]),webix.animate.clear(t[1]),t[0].style.position=""},webix.animate.clear=function(t){t.style[webix.env.transform]="none",t.style[webix.env.transition]="none",t.style.top=t.style.left=""
},webix.animate.defaults={type:"slide",delay:"0",duration:"500",timing:"ease-in-out",x:0,y:0},webix.animate.start=function(t,e){"string"==typeof e&&(e={type:e}),e=webix.Settings.E(e,webix.animate.defaults);var i,s,n=webix.env.cssPrefix,r=t.Mc=e;switch("slide"==r.type&&r.direction){case"right":r.x=t.offsetWidth;
break;case"left":r.x=-t.offsetWidth;break;case"top":r.y=-t.offsetHeight;break;case"bottom":default:r.y=r.y||t.offsetHeight}("flip"==r.type||"flipback"==r.type)&&(i=[0,0],s="scaleX","vertical"==r.subtype?(i[0]=20,s="scaleY"):i[1]=20,("right"==r.direction||"bottom"==r.direction)&&(i[0]*=-1,i[1]*=-1));var a=r.duration+"ms "+r.timing+" "+r.delay+"ms",h=n+"TransformStyle: preserve-3d;",o="",l="";
switch(r.type){case"fade":o="opacity "+a,h="opacity: 0;";break;case"show":o="opacity "+a,h="opacity: 1;";break;case"flip":a=r.duration/2+"ms "+r.timing+" "+r.delay+"ms",l="skew("+i[0]+"deg, "+i[1]+"deg) "+s+"(0.00001)",o="all "+a;break;case"flipback":r.delay+=r.duration/2,a=r.duration/2+"ms "+r.timing+" "+r.delay+"ms",t.style[webix.env.transform]="skew("+-1*i[0]+"deg, "+-1*i[1]+"deg) "+s+"(0.00001)",t.style.left="0",l="skew(0deg, 0deg) "+s+"(1)",o="all "+a;
break;case"slide":var c=r.x+"px",u=r.y+"px";l=webix.env.translate+"("+c+", "+u+("translate3d"==webix.env.translate?", 0":"")+")",o=n+"transform "+a}webix.delay(function(){t.style[webix.env.transition]=o,webix.delay(function(){h&&(t.style.cssText+=h),l&&(t.style[webix.env.transform]=l);var e=!1,i=webix.event(t,webix.env.transitionEnd,function(s){t.Mc=null,r.callback&&r.callback.call(r.master||window,t,r,s),e=!0,webix.eventRemove(i)
});window.setTimeout(function(){e||(t.Mc=null,r.callback&&r.callback.call(r.master||window,t,r),e=!0,webix.eventRemove(i))},1.3*(1*r.duration+1*r.delay))})})},webix.MouseEvents={$init:function(t){t=t||{},this.Oc=0,this.Pc=300,this.Qc=null,this.Rc(t.onClick,"on_click"),this.Rc(t.onContext,"on_context"),this.Rc(t.onDblClick,"on_dblclick"),this.Rc(t.onMouseMove,"on_mouse_move"),this.on_click&&(webix.event(this.w,"click",this.Sc,this),webix.env.isIE8&&this.on_dblclick&&webix.event(this.w,"dblclick",this.Tc,this)),this.on_context&&webix.event(this.w,"contextmenu",this.Uc,this),this.on_mouse_move&&this.Vc()
},Vc:function(){this.Wc||(this.on_mouse_move=this.on_mouse_move||{},webix.event(this.w,"mousemove",this.Xc,this),webix.event(this.w,webix.env.isIE?"mouseleave":"mouseout",this.Xc,this),this.Wc=1)},Rc:function(t,e){if(t){var i=this[e],s=i?webix.extend({},i):{};this[e]=webix.extend(s,t)}},Sc:function(t){if(!this.isEnabled())return!1;
if(webix.UIManager.sb(this),this.on_dblclick){var e=(new Date).valueOf();if(e-this.Oc<=this.Pc&&this.locate){var i=this.locate(t);if(""+i==""+this.Qc)return this.Oc=0,this.Tc(t)}this.Oc=e}var s=this.Yc(t,this.on_click,"ItemClick");return s},Tc:function(t){return this.Yc(t,this.on_dblclick,"ItemDblClick")
},Uc:function(t){this.Yc(t,this.on_context,"BeforeContextMenu","AfterContextMenu")},Xc:function(t){if(document.createEventObject)t=document.createEventObject(event);else if(!(webix.$testmode||webix.isUndefined(t.webkitMovementY)||t.webkitMovementY||t.webkitMovementX))return;this.Zc&&window.clearTimeout(this.Zc),this.callEvent("onMouseMoving",[t]),this.Zc=window.setTimeout(webix.bind(function(){"mousemove"==t.type?this.$c(t):this._c(t)
},this),this.s.mouseEventDelay||500)},$c:function(t){this.Yc(t,this.on_mouse_move,"MouseMove")||this.callEvent("onMouseOut",[t||event])},_c:function(t){this.callEvent("onMouseOut",[t||event])},Yc:function(t,e,i,s){if(t=t||event,!t.processed){t.processed=!0;var n=t.target||t.srcElement;if(webix.env.isIE8){var r=this.s.id,a=n.w_view;
if(a){if(a!==r)return}else n.w_view=r}for(var h="",o=null,l=!1;n&&n.parentNode;){if(!l&&n.getAttribute&&(o=n.getAttribute(this.ad))){if(this.Qc=o,this.callEvent){if(!this.callEvent("on"+i,[o,t,n]))return;s&&this.callEvent("on"+s,[o,t,n])}l=!0}if(h=n.className){h=h.toString().split(" ");for(var c=0;c<h.length;c++)if(e[h[c]]){var u=webix.toFunctor(e[h[c]],this.$scope),d=u.call(this,t,o||webix.html.locate(t,this.ad),n);
if(d===!1)return l}}n=n.parentNode}return l}}},webix.protoUI({name:"accordionitem",$init:function(t){this.x.innerHTML="<div webix_ai_id='"+t.id+"'  class='webix_accordionitem_header'><div class='webix_accordionitem_button' ></div><div class='webix_accordionitem_label' ></div></div><div class='webix_accordionitem_body'></div>",this.w=this.x,this.bd=this.w.childNodes[0],t.header||(this.bd.style.display="none"),this.cd=this.w.childNodes[0].childNodes[1],this.dd=this.w.childNodes[0].childNodes[0],this.ed=this.w.childNodes[1],this.x.className+=" webix_accordionitem",this.fd=this.gd=null,this.q=!0
},Rb:function(){this.gd={destructor:function(){}}},Qb:function(t){this.gd.destructor(),this.gd=t,this.gd.Xb=this,this.ed.appendChild(this.gd.x),this.resize()},ad:"webix_ai_id",getChildViews:function(){return[this.gd]},body_setter:function(t){return"object"!=typeof t&&(t={template:t}),t.Ob={top:!0,left:!0,right:!0,bottom:!0},this.gd=webix.ui.A(t),this.gd.$view.style.border="0px solid red",this.gd.Xb=this,this.ed.appendChild(this.gd.x),t
},header_setter:function(t){return t&&(t=webix.template(t)),t},headerAlt_setter:function(t){return t&&(t=webix.template(t)),t},$getSize:function(t,e){var i=this.gd.$getSize(0,0),s=this.s.Ob;s&&(t+=(s.left?0:1)+(s.right?0:1),e+=(s.top?0:1)+(s.bottom?0:1));var n=0,r=webix.ui.baseview.prototype.$getSize.call(this,0,0);
return r[0]=(r[0]||i[0])+t,r[1]>=1e5&&(r[1]=i[1]),r[1]+=t,r[2]=(r[2]||i[2])+e,r[3]>=1e5&&(r[3]=i[3]),r[3]+=e,this.getParentView().mc?this.s.collapsed?r[2]=r[3]=this.hd():this.s.header&&(n=this.s.headerHeight):(this.s.collapsed&&(r[0]=r[1]=this.hd()),this.s.header&&(n=this.s.headerHeight)),r[2]+=n,r[3]+=n,r
},on_click:{webix_accordionitem_header:function(t){return this.id(t),!1},webix_accordionitem_header_v:function(t){return this.id(t),!1}},id:function(){this.define("collapsed",!this.s.collapsed)},collapsed_setter:function(t){if(this.s.header!==!1){var e=this.getParentView();if(t){if(!e||e.jd(this))this.kd();
else if(e.q.length>1)for(var i=0;i<e.q.length;i++)this!=e.q[i]&&(e.q[i].expand(),this.kd())}else this.ld();return this.s.collapsed=t,t||this.getParentView().md(this),this.refresh(),webix.Nb||this.resize(),e.callEvent("onAfter"+(t?"Collapse":"Expand"),[this.s.id]),this.s.$noresize=t,t}},collapse:function(){this.define("collapsed",!0),webix.UIManager.vb(this)
},expand:function(){this.define("collapsed",!1)},fc:function(){this.show()},Fb:function(){this.hide()},ld:function(){this.ed.style.display="",webix.html.removeCss(this.$view,"collapsed"),webix.html.removeCss(this.bd,"collapsed")},kd:function(){this.getParentView().mc;this.s.headerAlt&&(this.cd.innerHTML=this.s.headerAlt()),this.ed.style.display="none",webix.html.addCss(this.$view,"collapsed"),webix.html.addCss(this.bd,"collapsed")
},refresh:function(){var t=this.s[this.s.collapsed?"headerAlt":"header"]||this.s.header;t&&(this.cd.innerHTML=t());var e=this.getParentView().mc?"vertical":"horizontal";this.x.className.indexOf(" "+e)<0&&webix.html.addCss(this.x,e)},hd:function(){return this.s.collapsed?this.s.headerAltHeight:this.s.headerHeight
},$setSize:function(t,e){if(webix.ui.view.prototype.$setSize.call(this,t,e)){t=this.bc,e=this.dc;var i=this.hd();if(this.s.header)if(this.bd.style.height=i+"px",this.bd.style.width="auto",this.bd.style[webix.env.transform]="",this.bd.style.borderBottomWidth=(this.s.collapsed?0:1)+"px",this.getParentView().mc||!this.s.collapsed)e-=this.hd();
else if(this.s.collapsed)if(webix.animate.isSupported()){this.bd.style.width=e+"px",this.bd.style.height=t+3+"px";var s=Math.floor(e/2-t/2)+(t-this.s.headerAltHeight)/2;this.bd.style[webix.env.transform]="rotate(90deg) translate("+s+"px, "+(s+1)+"px)"}else this.bd.style.width=t+"px",this.bd.style.height=e+3+"px",this.cd.innerHTML="";
this.s.collapsed||(this.gd.$setSize(t,e),this.ct=e)}else if(!this.s.collapsed){var n=this.gd;this.ct&&n.$setSize(this.bc,this.ct)}},$skin:function(){var t=this.defaults;t.headerAltHeight=t.headerHeight=webix.skin.$active.barHeight,webix.skin.$active.borderlessAccordion&&(t.borderless=!0)},defaults:{header:!1,headerAlt:!1,body:""}},webix.MouseEvents,webix.EventSystem,webix.ui.view),webix.protoUI({name:"accordion",defaults:{panelClass:"accordionitem",multi:!1,collapsed:!1},addView:function(){var t=webix.ui.layout.prototype.addView.apply(this,arguments),e=webix.$$(t);
return e.collapsed_setter&&e.refresh&&e.refresh(),t},kc:function(){for(var t=this.s.panelClass,e=this.nc,i=0;i<e.length;i++)!e[i].body&&!e[i].header||e[i].view||(e[i].view=t),webix.isUndefined(e[i].collapsed)&&(e[i].collapsed=this.s.collapsed);this.nd=!0,webix.ui.layout.prototype.kc.call(this),this.nd=!1;
for(var i=0;i<this.q.length;i++)this.q[i].name==t&&this.q[i].refresh(),this.q[i].od=!1;for(var s=!1,i=this.q.length-1;i>=0&&!s;i--)this.q[i].s.hidden||(this.q[i].od=!0,s=!0)},md:function(t){if(this.s.multi===!1&&this.nd!==!0)for(var e=0;e<this.q.length;e++)t!=this.q[e]&&!this.q[e].s.collapsed&&this.q[e].collapse&&this.q[e].collapse()
},jd:function(t){if(this.s.multi===!0||this.nd)return!0;for(var e=0;e<this.q.length;e++)if(t!=this.q[e]&&!this.q[e].s.collapsed)return!0;return!1},$skin:function(){var t=this.defaults;webix.skin.$active.accordionType&&(t.type=webix.skin.$active.accordionType)}},webix.ui.layout),webix.protoUI({name:"headerlayout",defaults:{type:"accordion",multi:"mixed",collapsed:!1}},webix.ui.accordion),webix.DragControl={pd:webix.toArray(["dummy"]),addDrop:function(t,e,i){t=webix.toNode(t),t.webix_drop=this.qd(e),i&&(t.webix_master=!0)
},qd:function(t){t=t||webix.DragControl;var e=this.pd.find(t);return 0>e&&(e=this.pd.length,this.pd.push(t)),e},addDrag:function(t,e){t=webix.toNode(t),t.webix_drag=this.qd(e),webix.event(t,webix.env.mouse.down,this.rd,t),webix.event(t,"dragstart",webix.html.preventEvent)},rd:function(t){if(webix.DragControl.sd){if(webix.DragControl.td==t)return;
webix.DragControl.ud(),webix.DragControl.destroyDrag(t)}webix.DragControl.sd=this;var e=webix.env.mouse.context(t);webix.DragControl.vd=e,webix.DragControl.td=t,webix.DragControl.wd=webix.event(document.body,webix.env.mouse.move,webix.DragControl.xd),webix.DragControl.yd=webix.event(document.body,webix.env.mouse.up,webix.DragControl.ud),webix.html.addCss(document.body,"webix_noselect",1)
},ud:function(){webix.DragControl.zd()},xd:function(t){var e=webix.env.mouse.context(t);if(!(Math.abs(e.x-webix.DragControl.vd.x)<5&&Math.abs(e.y-webix.DragControl.vd.y)<5)&&(webix.DragControl.zd(!0),webix.DragControl.createDrag(webix.DragControl.td)))return webix.DragControl.sendSignal("start"),webix.DragControl.wd=webix.event(document.body,webix.env.mouse.move,webix.DragControl.Ad),webix.DragControl.yd=webix.event(document.body,webix.env.mouse.up,webix.DragControl.Bd),webix.DragControl.Ad(t),webix.env.touch?webix.html.preventEvent(t):void 0
},Bd:function(t){webix.DragControl.zd(),webix.DragControl.td=null,webix.DragControl.Cd&&(webix.DragControl.$drop(webix.DragControl.sd,webix.DragControl.Cd,t),webix.DragControl.$dragOut(webix.DragControl.sd,webix.DragControl.Cd,null,t)),webix.DragControl.destroyDrag(t),webix.DragControl.sendSignal("stop")
},zd:function(t){this.wd=webix.eventRemove(this.wd),this.yd=webix.eventRemove(this.yd),t||webix.html.removeCss(document.body,"webix_noselect")},Ad:function(t){var e=webix.html.pos(t),i=webix.env.mouse.context(t);if(webix.DragControl.$dragPos(e,t),webix.DragControl.v.style.top=e.y+webix.DragControl.top+"px",webix.DragControl.v.style.left=e.x+webix.DragControl.left+"px",webix.DragControl.Ed)webix.DragControl.Ed=!1;
else{var s=i.target=webix.env.touch?document.elementFromPoint(i.x,i.y):i.target,n=webix.env.touch?i:t;webix.DragControl.Fd(s,n)}return webix.html.preventEvent(t)},Fd:function(t,e){for(;t&&"BODY"!=t.tagName;){if(t.webix_drop){if(this.Cd&&(this.Cd!=t||t.webix_master)&&this.$dragOut(this.sd,this.Cd,t,e),!this.Cd||this.Cd!=t||t.webix_master)return this.Cd=null,this.Dd=this.$dragIn(webix.DragControl.sd,t,e),void(this.Dd&&(this.Cd=t));
return}t=t.parentNode}this.Cd&&(this.Cd=this.Dd=this.$dragOut(this.sd,this.Cd,null,e))},sendSignal:function(t){webix.DragControl.active="start"==t},getMaster:function(t){return this.pd[t.webix_drag||t.webix_drop]},getContext:function(){return this.Gd},getNode:function(){return this.v},createDrag:function(t){var e=webix.DragControl.sd;
webix.DragControl.Gd={};var i,s=this.pd[e.webix_drag];if(s.$dragCreate){if(i=s.$dragCreate(e,t),!i)return!1;i.style.position="absolute"}else{var n=webix.DragControl.$drag(e,t);if(!n)return!1;i=document.createElement("DIV"),i.innerHTML=n,i.className="webix_drag_zone",document.body.appendChild(i)}return i.style.zIndex=Math.max(i.style.zIndex,webix.ui.zIndex()),webix.DragControl.Hd=webix.event(i,webix.env.mouse.move,webix.DragControl.Id),webix.DragControl.Gd.from||(webix.DragControl.Gd={source:e,from:e}),webix.DragControl.v=i,!0
},Id:function(){webix.DragControl.Ed=!0},destroyDrag:function(t){var e=webix.DragControl.sd,i=this.pd[e.webix_drag];i&&i.$dragDestroy?(webix.DragControl.Hd=webix.eventRemove(webix.DragControl.Hd),webix.DragControl.v&&i.$dragDestroy(e,webix.DragControl.v,t)):webix.html.remove(webix.DragControl.v),webix.DragControl.Dd=webix.DragControl.sd=webix.DragControl.Cd=webix.DragControl.v=null
},top:5,left:5,$dragPos:function(t,e){var i=this.pd[webix.DragControl.sd.webix_drag];i.$dragPos&&i!=this&&i.$dragPos(t,e,webix.DragControl.v)},$dragIn:function(t,e,i){var s=this.pd[e.webix_drop];return s.$dragIn&&s!=this?s.$dragIn(t,e,i):(e.className=e.className+" webix_drop_zone",e)},$dragOut:function(t,e,i,s){var n=this.pd[e.webix_drop];
return n.$dragOut&&n!=this?n.$dragOut(t,e,i,s):(e.className=e.className.replace("webix_drop_zone",""),null)},$drop:function(t,e,i){var s=this.pd[e.webix_drop];return webix.DragControl.Gd.from=webix.DragControl.getMaster(t),s.$drop&&s!=this?s.$drop(t,e,i):void e.appendChild(t)},$drag:function(t,e){var i=this.pd[t.webix_drag];
return i.$drag&&i!=this?i.$drag(t,e):"<div style='"+t.style.cssText+"'>"+t.innerHTML+"</div>"}},webix.DataMove={copy:function(t,e,i,s){s=s||{};var n=s.newId||t;i=i||this;var r=this.getItem(t);return i&&(r=i.Jd(r)),i.data.add(i.Jd(r,n),e)},Kd:function(t,e,i){if(e&&t){var s=this.getIndexById(t);return s+(i==this&&i.getIndexById(e)<s?0:1)
}},move:function(t,e,i,s){s=s||{};var n=s.newId||t;if(i=i||this,i.data){if(webix.isArray(t)){t.length>3&&(this.$blockRender=i.$blockRender=!0);for(var r=0;r<t.length;r++){var a=this.move(t[r],e,i,s);e=i.Kd(a,t[r+1],this)}return this.$blockRender=i.$blockRender=!1,void(t.length>3&&(this.refresh(),i!=this&&i.refresh()))
}var a=t,h=this.getItem(t);return i&&i!=this?(a=i.data.add(i.Jd(h,n),e,s.parent||0),this.data.remove(t)):(0>e&&(e=this.data.order.length-1),this.data.move(this.getIndexById(t),e),this.data.callEvent("onDataMove",[t,e])),a}},moveUp:function(t,e){return this.move(t,this.getIndexById(t)-(e||1))},moveDown:function(t,e){return this.moveUp(t,-1*(e||1))
},moveTop:function(t){return this.move(t,0)},moveBottom:function(t){return this.move(t,this.data.count()-1)},Jd:function(t,e){var i=webix.extend({},t);return i.id=!e||this.data.pull[e]?webix.uid():e,i.$template=null,this.s.externalData&&(i=this.s.externalData.call(this,i,e)),i}},webix.Movable={move_setter:function(t){return t&&(this.Ld=webix.clone(this.Ld),this.Ld.master=this,webix.DragControl.addDrag(this.bd,this.Ld)),t
},Ld:{$dragCreate:function(t,e){var i=webix.html.offset(t),s=webix.html.pos(e);return webix.DragControl.top=i.y-s.y,webix.DragControl.left=i.x-s.x,webix.toNode(this.master.x)},$dragDestroy:function(t,e){var i=this.master;i.s&&(i.s.top=parseInt(e.style.top,10),i.s.left=parseInt(e.style.left,10)),webix.DragControl.top=webix.DragControl.left=5,this.master.callEvent("onViewMoveEnd",[])
},$dragPos:function(t,e){this.master.callEvent("onViewMove",[t,e])}}},webix.Modality={Md:function(t){if(t){if(!this.Nd){this.Nd=webix.html.create("div",{"class":"webix_modal"});var e=this.s.zIndex||webix.ui.zIndex();this.Od=webix.Pd,webix.Pd=e,this.Nd.style.zIndex=e-1,this.x.style.zIndex=e,document.body.appendChild(this.Nd)
}}else if(this.Nd){webix.html.remove(this.Nd);var i=this.Od;setTimeout(function(){webix.Pd=i},1),this.Nd=null}return t}},webix.protoUI({name:"window",$init:function(t){this.x.innerHTML="<div class='webix_win_content'><div class='webix_win_head'></div><div class='webix_win_body'></div></div>",this.w=this.x.firstChild,this.bd=this.w.childNodes[0],this.y=this.ed=this.w.childNodes[1],this.x.className+=" webix_window",this.fd=this.gd=null,this.s.Ob={top:!1,left:!1,right:!1,bottom:!1},t.id||(t.id=webix.uid()),webix.event(this.w,"click",webix.bind(this.Vw,this)),t.modal&&(this.my=!0)
},Vw:function(t){var e=webix.ui.et,i=e.find(this);-1==i&&(i=e.length-1),t.click_view=i,webix.env.isIE8&&(t.srcElement.click_view=i)},getChildViews:function(){return this.fd?[this.fd,this.gd]:[this.gd]},zIndex_setter:function(t){return this.x.style.zIndex=t,t},Rb:function(){this.gd={destructor:function(){}}
},Qb:function(t){this.gd.destructor(),this.gd=t,this.gd.Xb=this,this.ed.appendChild(this.gd.x);var e=this.gd.x.style;e.borderTopWidth=e.borderBottomWidth=e.borderLeftWidth=e.borderRightWidth="1px",this.gd.s.Ob=webix.clone(this.s.Ob),this.resize(!0)},show:function(t,e,i){if(!this.callEvent("onBeforeShow",arguments))return!1;
this.s.hidden=!1,this.x.style.zIndex=this.s.zIndex||webix.ui.zIndex(),(this.s.modal||this.my)&&(this.Md(!0),this.my=null);var s,n,r;if(e=e||{},e.pos||(e.pos=this.s.relative),t){"object"!=typeof t||t.tagName?(t=webix.toNode(t),s=webix.html.offset(t)):t.target||t.srcElement?(s=webix.html.pos(t),n=20,r=5):s=t;
var a=Math.max(window.innerWidth||0,document.body.offsetWidth),h=Math.max(window.innerHeight||0,document.body.offsetHeight);n=n||t.offsetWidth||0,r=r||t.offsetHeight||0;var o=this.ac,l=s.x,c=s.y,u=0,d=0;if(this.s.autofit){var f=6,b=6,x=6;i="top",c=0,l=0,a-s.x-n<o[0]&&"right"==e.pos&&(e.pos="left"),"right"==e.pos?(l=s.x+f+n,b=-r,i="left",u=Math.round(s.y+r/2),d=l-x):"left"==e.pos?(l=s.x-f-o[0]-1,b=-r,i="right",u=Math.round(s.y+r/2),d=l+o[0]+1):(l=s.x<0?0:a-s.x>o[0]?s.x:a-f-o[0],d=Math.round(s.x+n/2),d>l+o[0]&&(d=l+o[0]/2)),(!o[1]||h-r-s.y-b>o[1])&&"top"!=e.pos?(c=r+s.y+b-4,u||(i="top",u=c-x)):(c=s.y-b-o[1],0>c?(c=0,"top"==i&&(i=!1)):u||(i="bottom",c--,u=c+o[1]+1))
}var p=e.x||0,v=e.y||0;this.setPosition(l+p,c+v),this.Rd&&(i?this.Rd(i,d+p,u+v):this.Sd())}else this.s.position&&this.Td();this.x.style.display="block",this.Ww=1,webix.delay(function(){this.Ww=0},this,[],webix.env.touch?400:100),this.Qd(),this.config.autofocus&&(this.Vd=webix.UIManager.getFocus(),webix.UIManager.setFocus(this)),-1==webix.ui.et.find(this)&&webix.ui.et.push(this),this.callEvent("onShow",[])
},Fb:function(t){if(!(this.s.hidden||this.s.modal||this.Ww||t&&t.showpopup||webix.Pd&&this.s.zIndex<=webix.Pd)){if(t){var e=webix.env.isIE8?t.srcElement.click_view:t.click_view;e||0===e||(e=-1);var i=webix.ui.et.find(this);if(e>=i)return}this.hide()}},hidden_setter:function(t){return t?this.hide():this.show(),!!t
},hide:function(t){(t||!this.s.hidden)&&(this.s.modal&&this.Md(!1),"top"==this.s.position?webix.animate(this.x,{type:"slide",x:0,y:-(this.dc+20),duration:300,callback:this.Wd,master:this}):this.Wd(),this.s.autofocus&&(webix.UIManager.setFocus(this.Vd),this.Vd=null),this.ny())},ny:function(){var t=webix.ui.et,e=t.find(this),i=t.length-1;
if(e>-1)for(var s=i;s>e;s--)t[s].Sd&&t[s].hide();t.removeAt(e)},destructor:function(){this.s.autofocus&&(webix.B||webix.UIManager.setFocus(this.Vd),this.Vd=null),this.ny(),webix.Destruction.destructor.apply(this,[])},Wd:function(){this.$destructed||(this.x.style.display="none",this.s.hidden=!0,this.callEvent("onHide",[]))
},close:function(){this.Md(!1),webix.html.remove(this.x),this.destructor()},Xd:function(t){t.borderless=!0},body_setter:function(t){return"object"!=typeof t&&(t={template:t}),this.Xd(t),webix.Xb=this,this.gd=webix.ui.A(t),this.gd.Xb=this,this.ed.appendChild(this.gd.x),t},head_setter:function(t){return t===!1?t:("object"!=typeof t&&(t={template:t,padding:0}),t.borderless=!0,webix.Xb=this,this.fd=webix.ui.A(t),this.fd.Xb=this,this.bd.appendChild(this.fd.x),t)
},getBody:function(){return this.gd},getHead:function(){return this.fd},adjust:function(){return this.resize()},resizeChildren:function(){this.gd&&this.resize()},resize:function(){webix.ui.baseview.prototype.adjust.call(this),this.Td(this.s.left,this.s.top)},Td:function(t,e){if(this.s.position){this.$view.style.position="fixed";
var i=this.bc,s=this.dc,n=window.innerWidth||document.documentElement.offsetWidth,r=window.innerHeight||document.documentElement.offsetHeight,a=Math.round((n-i)/2),h=Math.round((r-s)/2);if("function"==typeof this.s.position){var o={left:a,top:h,width:i,height:s,maxWidth:n,maxHeight:r};this.s.position.call(this,o),(o.width!=i||o.height!=s)&&this.$setSize(o.width,o.height),this.setPosition(o.left,o.top)
}else"top"==this.s.position&&(h=webix.animate.isSupported()?-1*s:10),this.setPosition(a,h);"top"==this.s.position&&webix.animate(this.x,{type:"slide",x:0,y:s-2*(this.s.padding||0),duration:300,callback:this.Yd,master:this})}else this.setPosition(t,e)},Yd:function(t){webix.animate.clear(t),this.s.top=-(2*(this.s.padding||0)),this.setPosition(this.s.left,this.s.top)
},setPosition:function(t,e){this.x.style.top=e+"px",this.x.style.left=t+"px",this.s.left=t,this.s.top=e},$getSize:function(t,e){var i=this.s.Ob;i&&(t+=(i.left?0:1)+(i.right?0:1),e+=(i.top?0:1)+(i.bottom?0:1)),this.s.head&&(e+=1);var s=this.gd.$getSize(0,0);if(this.fd){var n=this.fd.$getSize(0,0);n[3]==n[2]&&(this.s.headHeight=n[3]),e+=this.s.headHeight
}if(this.s.fullscreen){var r=window.innerWidth||document.body.clientWidth,a=window.innerHeight||document.body.clientHeight;return[r,r,a,a]}var h=webix.ui.view.prototype.$getSize.call(this,0,0);return h[1]=Math.min(h[1],(s[1]>=1e5&&h[1]>=1e5?Math.max(s[0],300):s[1])+t),h[3]=Math.min(h[3],(s[3]>=1e5&&h[3]>=1e5?Math.max(s[2],200):s[3])+e),h[0]=Math.min(Math.max(h[0],s[0]+t),h[1]),h[2]=Math.min(Math.max(h[2],s[2]+e),h[3]),h
},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e),t=this.bc,e=this.dc,this.s.head===!1?(this.bd.style.display="none",this.gd.$setSize(t,e)):(this.fd.$setSize(t,this.s.headHeight),this.gd.$setSize(t,e-this.s.headHeight))},$skin:function(){this.defaults.headHeight=webix.skin.$active.barHeight
},defaults:{top:0,left:0,autofit:!0,relative:"bottom",body:"",head:"",hidden:!0,autofocus:!0}},webix.ui.view,webix.Movable,webix.Modality,webix.EventSystem),webix.protoUI({name:"popup",$init:function(){this.s.head=!1,this.$view.className+=" webix_popup",webix.attachEvent("onClick",webix.bind(this.Fb,this)),this.attachEvent("onHide",this.Sd)
},close:function(){webix.html.remove(this.$d),webix.ui.window.prototype.close.call(this)},$getSize:function(t,e){return webix.ui.window.prototype.$getSize.call(this,t+2*this.s.padding,e+2*this.s.padding)},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e),t=this.bc-2*this.s.padding,e=this.dc-2*this.s.padding,this.w.style.padding=this.s.padding+"px",this.bd.style.display="none",this.gd.$setSize(t,e)
},Xd:function(){},defaults:{padding:8},head_setter:function(){},Rd:function(t,e,i){this.Sd(),document.body.appendChild(this.$d=webix.html.create("DIV",{"class":"webix_point_"+t},"")),this.$d.style.zIndex=webix.ui.zIndex(),this.$d.style.top=i+"px",this.$d.style.left=e+"px"},Sd:function(){this.$d=webix.html.remove(this.$d)
}},webix.ui.window),webix.ui.et=webix.toArray(),webix.protoUI({name:"suggest",defaults:{autofocus:!1,type:"list",keyPressTimeout:1,body:{yCount:10,autoheight:!0,body:!0,select:!0,borderless:!0,navigation:!0},filter:function(t,e){return 0===t.value.toString().toLowerCase().indexOf(e.toLowerCase())?!0:!1
}},template_setter:webix.template,filter_setter:function(t){return webix.toFunctor(t,this.$scope)},$init:function(t){var e={};webix.extend(e,webix.copy(this.defaults.body)),e.view=t.type||this.defaults.type;var i=this.Jt(e);t.body&&webix.extend(i,t.body,!0),t.data&&(i.data=t.data),t.url&&(i.url=t.url),t.datatype&&(i.datatype=t.datatype),t.id&&(e.id=e.id||t.id+"_"+e.view),t.body=e,this.$ready.push(this._d),this.oy={}
},Jt:function(t){return t},Rs:function(t){if(t){var e,i,s;this.s.master&&(e=webix.$$(this.s.master),e.options_setter&&(i=e.getInputNode())&&(s=this.getItemText(t.id),webix.isUndefined(i.value)?i.innerHTML=s:i.value=s.replace(/<[^>]*>/g,"")))}},setMasterValue:function(t,e){if(this.s.master){var i=webix.$$(this.s.master);
e&&t.id?i.refresh():i.options_setter?i.setValue(t.id):i.setValueHere?i.setValueHere(t.text||t.value):i.setValue(t.text||t.value)}else this.ae&&(this.ae.value=t.text||t.value);e||(this.hide(!0),this.ae&&this.ae.focus()),this.callEvent("onValueSuggest",[t]),webix.delay(function(){webix.callEvent("onEditEnd",[])
})},getMasterValue:function(){return this.s.master?webix.$$(this.s.master).getValue():null},getItemText:function(t){var e=this.getList().getItem(t);if(!e)return this.oy[t]||"";if(this.s.template)return this.s.template.call(this,e,this.type);if(this.s.textValue)return e[this.s.textValue];var i=this.getList().type,s=i.template.call(i,e,i);
return this.oy[t]=s},getSuggestion:function(){var t,e=this.getList();return e.getSelectedId&&(t=e.getSelectedId()),!t&&e.data.order.length&&(t=e.data.order[0]),t&&"object"==typeof t&&(t+=""),t},getList:function(){return this.gd},_d:function(){var t=this.getList(),e=this.s.type;t.count?(t.attachEvent("onItemClick",webix.bind(function(e){this.setMasterValue(t.getItem(e))
},this)),t.data.attachEvent("onstoreupdated",webix.bind(function(t,e,i){"delete"==i&&t==this.getMasterValue()?this.setMasterValue({id:"",text:""},1):"update"==i&&t==this.getMasterValue()&&this.setMasterValue(e,1)},this)),t.data.attachEvent("onAfterFilter",webix.bind(this.be,this)),t.data.attachEvent("onStoreLoad",webix.bind(this.be,this)),webix.isUndefined(this.s.fitMaster)&&(this.s.fitMaster=!0)):"calendar"==e?(t.attachEvent("onDateSelect",function(t){this.getParentView().setMasterValue({value:t})
}),t.attachEvent("onTodaySet",function(t){this.getParentView().setMasterValue({value:t})}),t.attachEvent("onDateClear",function(t){this.getParentView().setMasterValue({value:t})})):"colorboard"==e&&t.attachEvent("onSelect",function(t){this.getParentView().setMasterValue({value:t})})},input_setter:function(t){return this.linkInput(t),0
},linkInput:function(t){var e;t.getInputNode?(e=t.getInputNode(),e.webix_master_id=t.s.id):e=webix.toNode(t),webix.event(e,"keydown",function(t){(e!=document.body||this.isVisible())&&this.ce(t)},this),this.pt=!0},ce:function(t){t=t||event;var e=this.getList(),i=t.target||t.srcElement;this.ae=i,this.s.master=i.webix_master_id,window.clearTimeout(this.de);
var s=t.keyCode;return 16!=s&&17!=s?9==s?this.ee(this,e):27==s?this.fe(this,e):13==s?this.ge(this,e):this.he(t)?(webix.html.preventEvent(t),!1):void(webix.isUndefined(i.value)||(clearTimeout(this.dt),this.dt=webix.delay(function(){if(this.pt||webix.UIManager.getFocus()==webix.$$(this.s.master)){this.ie=!0;
var t=i.value;e.config.dataFeed?e.filter("value",t):e.filter&&e.filter(webix.bind(function(e){return this.s.filter.call(this,e,t)},this))}},this,[],this.s.keyPressTimeout))):void 0},be:function(){if(!this.ie)return!0;this.ie=!1;var t=this.getList();t.count()>0?(this.adjust(),this.je=!0,this.show(this.ae,null,!0)):(this.hide(!0),this.ae=null)
},show:function(t){if(!this.isVisible()){var e=this.getList();e.filter&&!this.je?(e.filter(""),e.select&&this.ke(e)):this.je=!1,this.$customWidth&&this.$customWidth(t),t.tagName&&this.s.fitMaster&&(this.s.width=t.offsetWidth-2),e.Np&&e.render(),this.adjust()}webix.ui.popup.prototype.show.apply(this,arguments)
},ke:function(t){var e=this.getMasterValue();e&&t.exists&&t.exists(e)?t.select(e):(t.unselect(),t.showItem(t.getFirstId()))},ge:function(t,e){if(e.count&&e.count())if(t.isVisible()){var i=e.getSelectedId(!1,!0);i&&this.setMasterValue(e.getItem(i)),t.hide(!0)}else t.show(this.ae);else t.isVisible()&&t.hide(!0)
},fe:function(t){return t.hide(!0)},ee:function(t){return t.hide(!0)},he:function(t){var e=this.getList(),i=t.keyCode;if(e.count&&e.moveSelection){if(!(38!==i||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey))return e.moveSelection("up"),this.Rs(e.getSelectedItem()),!0;if(!(40!==i||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){var s=this.isVisible();
if(!s){if(!e.count())return!1;this.show(this.ae)}var n=e.getSelectedId();return!n&&e.count?e.select(e.getFirstId()):s&&e.moveSelection("down"),this.Rs(e.getSelectedItem()),!0}}return!1},getValue:function(){var t=this.getList().getSelectedId()||"";return t.id||t},setValue:function(t){var e=this.getList();
t?e.exists(t)&&(e.select(t),e.showItem(t)):(e.unselect(),e.showItem(e.getFirstId()))}},webix.ui.popup),webix.attachEvent("onClick",function(t){var e=webix.$$(t);if(e&&e.touchable){e.getNode(t);var i=t.target||t.srcElement;if("webix_disabled"==i.className)return;var s="";if(i.className&&0===i.className.toString().indexOf("webix_view"))return;
for(;i&&i.parentNode;){if(i.getAttribute){if(i.getAttribute("view_id"))break;if(s=i.className){s=s.toString().split(" ");for(var n=0;n<s.length;n++)if(e.on_click[s[n]]){var r=e.on_click[s[n]].call(e,t,e.s.id,i);if(r===!1)return}}}i=i.parentNode}if(e.s.click){var a=webix.toFunctor(e.s.click,e.$scope);
a&&a.call&&a.call(e,e.s.id,t)}var h=e.s.popup;if(e.s.popup&&!e.s.readonly){"object"!=typeof h||h.name||(h=e.s.popup=webix.ui(h).s.id);var h=webix.$$(h);h.isVisible()||(h.s.master=e.s.id,h.show(e.getInputNode()||e.getNode(),null,!0))}e.callEvent("onItemClick",[e.s.id,t])}}),webix.protoUI({name:"button",touchable:!0,$skin:function(){this.defaults.height=webix.skin.$active.buttonHeight||webix.skin.$active.inputHeight,this.le=webix.skin.$active.labelTopHeight||15
},defaults:{template:function(t,e){var i=e.me(t,e);return t.badge&&(i=i.replace("</button>","<span class='webix_badge'>"+t.badge+"</span></button>")),"<div class='webix_el_box' style='width:"+t.awidth+"px; height:"+t.aheight+"px'>"+i+"</div>"},label:"",tabFocus:!0,borderless:!0},me:function(t){var e="class='webixtype_"+(t.type||"base")+"' ";
return"<button type='button' "+e+">"+webix.template.escape(t.label||t.value)+"</button>"},$init:function(){this.x.className+=" webix_control webix_el_"+(this.$cssName||this.name),this.data=this.s,this.y=this.x},hotkey_setter:function(t){var e=this;this.Bt(t,function(t,i){var s=e.$view.firstChild;if(s.dispatchEvent){var n=document.createEvent("MouseEvents");
n.initEvent("click",!0,!0),i.preventDefault(),s.dispatchEvent(n)}})},Bt:function(t,e,i){var s=webix.UIManager.addHotKey(t,e,i);this.attachEvent("onDestruct",function(){webix.UIManager.removeHotKey(s,e,i)})},tooltip_setter:function(t){var e=this.re()||this.$view.firstChild;return e&&(e.title=t),t},type_setter:function(t){return this.ne[t]&&(this.me=webix.template(this.ne[t])),this.oe="prev"==t||"next"==t?this.pe:!1,t
},ne:{htmlbutton:"<button type='button' class='webix_el_htmlbutton webixtype_base'>#label#</button>",prev:"<input type='button' class='webixtype_prev' value='#label#' /><div class='webix_el_arrow webixtype_prev_arrow'></div>",next:"<input type='button' class='webixtype_next' value='#label#' /><div class='webix_el_arrow webixtype_next_arrow'></div>",imageButton:"<button type='button' class='webix_img_btn_abs webixtype_base' style='width:100%; line-height:#cheight#px'><div class='webix_image' style='width:#dheight#px;height:#dheight#px;background-image:url(#image#);'> </div> #label#</button>",imageButtonTop:"<button type='button' class='webix_img_btn_abs webix_img_btn_abs_top webixtype_base'><div class='webix_image' style='width:100%;height:100%;background-image:url(#image#);'> </div> <div class='webix_img_btn_text'>#label#</div></button>",image:"<button type='button' class='webix_img_btn' style='line-height:#cheight#px;'><div class='webix_image' style='width:#cheight#px;height:#cheight#px;background-image:url(#image#);'> </div> #label#</button>",imageTop:"<button type='button' class='webix_img_btn_top' style='background-image:url(#image#);'><div class='webix_img_btn_text'>#label#</div></button>",icon:"<button type='button' class='webix_img_btn' style='line-height:#cheight#px;'><span class='webix_icon_btn fa-#icon#' style='max-width:#cheight#px;'></span>#label#</button>",iconButton:"<button type='button' class='webix_img_btn_abs webixtype_base' style='width:100%;'><span class='webix_icon fa-#icon#'></span> #label#</button>",iconTop:"<button type='button' class='webix_img_btn_top' style='width:100%;top:4px;text-align:center;'><span class='webix_icon fa-#icon#'></span><div class='webix_img_btn_text'>#label#</div></button>",iconButtonTop:"<button type='button' class='webix_img_btn_abs webix_img_btn_abs_top webixtype_base' style='width:100%;top:0px;text-align:center;'><span class='webix_icon fa-#icon#'></span><div class='webix_img_btn_text'>#label#</div></button>"},qe:function(){for(var t=[],e=["input","select","textarea"],i=0;i<e.length;i++)for(var s=this.$view.getElementsByTagName(e[i]),n=0;n<s.length;n++)t.push(s[n]);
return t},disable:function(){var t,e=this.re();if(webix.ui.baseview.prototype.disable.apply(this,arguments),e&&-1==e.className.indexOf(" webix_disabled_box")){e.className+=" webix_disabled_box";var i=this.qe();for(t=0;t<i.length;t++)i[t].setAttribute("disabled",!0);if("top"==this.s.labelPosition){var s=this.y.firstChild;
s&&(s.className+=" webix_disabled_top_label")}}},enable:function(){webix.ui.baseview.prototype.enable.apply(this,arguments);var t=this.re();if(t){t.className=t.className.replace(" webix_disabled_box","");for(var e=this.qe(),i=0;i<e.length;i++)e[i].removeAttribute("disabled");if("top"==this.s.labelPosition){var s=this.y.firstChild;
s&&(s.className=s.className.replace(" webix_disabled_top_label",""))}}},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()},setValue:function(t){var e=this.s.value;return e==t?!1:(this.s.value=t,this.se&&this.$setValue(t),void this.callEvent("onChange",[t,e]))},$setValue:function(t){(this.getInputNode()||{}).value=t
},getValue:function(){var t=this.se?this.$getValue():this.s.value;return"undefined"==typeof t?"":t},$getValue:function(){return this.s.value||""},focus:function(){var t=this.getInputNode();t&&t.focus&&t.focus()},blur:function(){var t=this.getInputNode();t&&t.blur&&t.blur()},getInputNode:function(){return this.y.getElementsByTagName("input")[0]||this.y.getElementsByTagName("button")[0]
},re:function(){for(var t=0;t<this.y.childNodes.length;t++)if(this.y.childNodes[t].className.indexOf("webix_el_box")>=0)return this.y.childNodes[t];return null},ue:Math.sqrt(2),pe:function(){var t=this.re().childNodes[1],e=t.previousSibling,i="next"==this.s.type?"right":"left",s=this.s.aheight-2*webix.skin.$active.inputPadding-2,n=s*this.ue/2;
t.style.width=n+"px",t.style.height=n+"px",t.style.top=(s-n)/2+webix.skin.$active.inputPadding+"px",t.style[i]=(s-n)/2+this.ue/2+"px",e.style.width=this.s.awidth-s/2-2+"px",e.style.height=s+2+"px",e.style[i]=s/2+2+"px",e.style.top=webix.skin.$active.inputPadding+"px"},ve:function(){this.we=this.s.inputWidth||(this.bc-this.s.width>2?this.s.width:0)||this.bc,this.xe=this.s.inputHeight
},render:function(){if(this.ve(),this.s.awidth=this.we||this.bc,this.s.aheight=this.xe||this.dc,this.s.bheight=this.s.aheight+2,this.s.cheight=this.s.aheight-2*webix.skin.$active.inputPadding,this.s.dheight=this.s.cheight-2,webix.AtomRender.render.call(this)){if(this.se=!0,this.oe&&this.oe(),this.s.align){var t=this.y.firstChild;
switch("top"==this.s.labelPosition&&t.nextSibling&&(t=t.nextSibling),this.s.align){case"right":t.style.cssFloat="right";break;case"center":t.style.display="inline-block",t.parentNode.style.textAlign="center";break;case"middle":t.style.marginTop=Math.round((this.dc-this.xe)/2)+"px";break;case"bottom":t.style.marginTop=this.dc-this.xe+"px";
break;case"left":t.style.cssFloat="left"}}this.$render&&this.$render(this.data),this.s.disabled&&this.disable(),this.s.tooltip&&this.define("tooltip",this.s.tooltip),this.ze&&(this.ze(this.data),this.ze=0)}},refresh:function(){this.render()},on_click:{Ae:function(t){var e=webix.html.locate(t,"button_id");
e&&this.callEvent("onBeforeTabClick",[e,t])&&(this.setValue(e),this.callEvent("onAfterTabClick",[e,t]))},webix_all_segments:function(t,e){this.on_click.Ae.call(this,t,e)},webix_all_tabs:function(t,e){this.on_click.Ae.call(this,t,e)},webix_inp_counter_next:function(){this.next()},webix_inp_counter_prev:function(){this.prev()
},webix_inp_combo:function(t,e,i){i.focus()},webix_inp_checkbox_border:function(t){"DIV"==(t.target||t.srcElement).tagName||this.s.readonly||this.toggle()},webix_inp_checkbox_label:function(){this.s.readonly||this.toggle()},webix_inp_radio_border:function(t){var e=webix.html.locate(t,"radio_id");this.setValue(e)
},webix_inp_radio_label:function(t,e,i){return i=i.parentNode.getElementsByTagName("input")[0],this.on_click.webix_inp_radio_border.call(this,i,e,i)},webix_tab_more_icon:function(t,e,i){this.getPopup().resize(),this.getPopup().show(i,null,!0)},webix_tab_close:function(t){var e=webix.html.locate(t,"button_id");
e&&this.callEvent("onBeforeTabClose",[e,t])&&this.removeOption(e)}},Be:function(t){for(var e=0;e<t.length;e++)"string"==typeof t[e]?t[e]={id:t[e],value:t[e]}:(webix.isUndefined(t[e].id)&&(t[e].id=t[e].value),webix.isUndefined(t[e].value)&&(t[e].value=t[e].id));return t},Yx:function(t){var e=t?t.placeholder:this.s.placeholder;
return e?"<span class='webix_placeholder'>"+e+"</span>":""}},webix.ui.view,webix.AtomRender,webix.Settings,webix.EventSystem),webix.protoUI({name:"label",defaults:{template:"<div style='height:100%;line-height:#cheight#px'>#label#</div>"},$skin:function(){this.defaults.height=webix.skin.$active.inputHeight
},focus:function(){return!1},re:function(){return this.y.firstChild},setHTML:function(t){this.s.template=function(){return t},this.refresh()},setValue:function(t){this.s.label=t,webix.ui.button.prototype.setValue.apply(this,arguments)},$setValue:function(t){this.y.firstChild.innerHTML=t},oe:function(){}},webix.ui.button),webix.protoUI({name:"icon",$skin:function(){this.defaults.height=webix.skin.$active.inputHeight
},defaults:{template:function(t){return"<button type='button' "+(t.tabFocus?"":"tabindex='-1'")+" style='height:100%;width:100%;' class='webix_icon_button'><span class='webix_icon fa-"+t.icon+" '></span>"+(t.badge?"<span class='webix_badge'>"+t.badge+"</span>":"")+"</button>"},width:33},oe:function(){}},webix.ui.button),webix.protoUI({name:"text",Ce:!0,De:function(){this.Ce&&(webix.event(this.getInputNode(),"change",function(){var t=this.getValue();
t!=this.s.value&&this.setValue(this.getValue(),!0)},this),this.s.suggest&&webix.$$(this.s.suggest).linkInput(this))},$skin:function(){this.defaults.height=webix.skin.$active.inputHeight,this.defaults.inputPadding=webix.skin.$active.inputPadding},$init:function(t){"top"==t.labelPosition&&webix.isUndefined(t.height)&&this.defaults.height&&(t.height=this.defaults.height+this.le),this.Ns=[],this.Ct(),this.attachEvent("onAfterRender",this.De)
},$renderIcon:function(){var t=this.s;if(t.icon){var e=t.aheight-2*t.inputPadding,i=(e-18)/2-1;return"<span style='height:"+(e-i)+"px;padding-top:"+i+"px;' class='webix_input_icon fa-"+t.icon+"'></span>"}return""},Ct:function(){if(!this.Dt){var t=this.getFormView();t&&this.Bt("enter",function(e,i){t.callEvent("onSubmit",[e,i])
},this)}},relatedView_setter:function(t){return this.attachEvent("onChange",function(){var t=this.getValue(),e=this.s.relatedAction,i=this.s.relatedView,s=webix.$$(i);if(!s){var n=this.getTopParentView();n&&n.$$&&(s=n.$$(i))}"enable"==e?t?s.enable():s.disable():t?s.show():s.hide()}),t},validateEvent_setter:function(t){return"blur"==t&&this.attachEvent("onBlur",this.validate),"key"==t&&this.attachEvent("onTimedKeyPress",this.validate),t
},validate:function(){var t=this.s.validate;!t&&this.s.required&&(t=webix.rules.isNotEmpty);var e=(this.getFormView(),this.s.name),i=this.getValue(),s={};return s[e]=i,t&&!this.getFormView().Se(t,i,s,e)?!1:!0},bottomLabel_setter:function(t){return this.s.bottomPadding||(this.s.bottomPadding=18),t},py:function(){var t=this.s.invalidMessage;
return"function"==typeof t&&t.call(this),t},qy:function(t){var e=this.s;"undefined"!=typeof t&&(e.bottomLabel=t);var i=(e.invalid?e.invalidMessage:"")||e.bottomLabel||e.bottomPadding;i||(e.inputHeight=0),i&&!e.bottomPadding?(this.ry=1,e.bottomPadding=e.bottomPadding||18,e.height||this.render(),this.resize()):!i&&this.ry?(e.bottomPadding=this.ry=0,e.height||this.render(),this.resize()):this.render()
},$getSize:function(){var t=webix.ui.view.prototype.$getSize.apply(this,arguments),e=this.config.bottomPadding;return e&&(t[2]+=e,t[3]+=e),t},$setSize:function(t,e){var i=this.s;if(webix.ui.view.prototype.$setSize.call(this,t,e)){if(!t||!e)return;"top"==i.labelPosition?(i.inputHeight||(i.inputHeight=this.dc-this.le-(this.config.bottomPadding||0)),i.labelWidth=0):i.bottomPadding&&(i.inputHeight=this.dc-this.config.bottomPadding),this.render()
}},Ee:function(t){var e=(this.we||0)-(t.label?this.s.labelWidth:0)-4-(t.iconWidth||0);return 0>e?0:e},Fe:function(t,e){var i=t.id||webix.uid(),s=e.Ee(t),n=t.inputAlign||"left",r=(this.$renderIcon?this.$renderIcon(t):"",this.s.aheight-2*webix.skin.$active.inputPadding-2),a=t.text||t.value||this.Yx(t),h="<div class='webix_inp_static' tabindex='0' onclick='' style='line-height:"+r+"px;width: "+s+"px; text-align: "+n+";' >"+a+"</div>";
return e.$renderInput(t,h,i)},qt:function(t){var e="<"+t+(this.s.placeholder?" placeholder='"+this.s.placeholder+"' ":" ");this.s.readonly&&(e+="readonly='true' ");var i=this.s.attributes;if(i)for(var s in i)e+=s+"='"+i[s]+"' ";return e},$renderLabel:function(t,e){var i=t.labelAlign||"left",s="top"==this.s.labelPosition,n=s?"display:block;":"width: "+this.s.labelWidth+"px;",r="",a=s?this.le-2:this.s.aheight-2*this.s.inputPadding;
return t.label&&(r="<label style='"+n+"text-align: "+i+";line-height:"+a+"px;' onclick='' for='"+e+"' class='webix_inp_"+(s?"top_":"")+"label "+(t.required?"webix_required":"")+"'>"+(t.label||"")+"</label>"),r},$renderInput:function(t,e,i){var s=t.inputAlign||"left",n="top"==t.labelPosition,r=this.Ee(t);
i=i||t.name||webix.uid();var a=this.$renderLabel(t,i),h="";if(e)h+=e;else{h+=this.qt("input")+"id='"+i+"' type='"+(t.type||this.name)+"' value='"+webix.template.escape(t.value||"")+"' style='width: "+r+"px; text-align: "+s+";'";var o=t.attributes;if(o)for(var l in o)h+=" "+l+"='"+o[l]+"'";h+=" />"}var c=this.$renderIcon?this.$renderIcon(t):"";
h+=c;var u="";u=n?a+"<div class='webix_el_box' style='width:"+t.awidth+"px; height:"+t.aheight+"px'>"+h+"</div>":"<div class='webix_el_box' style='width:"+t.awidth+"px; height:"+t.aheight+"px'>"+a+h+"</div>";var d=t.awidth-r-2*webix.skin.$active.inputPadding,f=(t.invalid?t.invalidMessage:"")||t.bottomLabel;
return f&&(u+="<div class='webix_inp_bottom_label' style='width:"+(r||t.awidth)+"px;margin-left:"+Math.max(d,webix.skin.$active.inputPadding)+"px;'>"+f+"</div>"),u},defaults:{template:function(t,e){return e.$renderInput(t)},label:"",labelWidth:80},type_setter:function(t){return t},oe:!1,$setValue:function(t){this.getInputNode().value=t
},$getValue:function(){return this.getInputNode().value},suggest_setter:function(t){if(t){if("string"==typeof t){var e=webix.$$(t);if(e)return webix.$$(t).s.id;t={body:{url:t,dataFeed:t}}}else webix.isArray(t)?t={body:{data:this.Be(t)}}:t.body||(t.body={});webix.extend(t,{view:"suggest"});var i=webix.ui(t);
return this.Ns.push(i),i.s.id}return!1}},webix.ui.button),webix.protoUI({name:"segmented",Ce:!1,$init:function(){this.attachEvent("onChange",function(t){if(this.s.multiview){var e=this.getTopParentView(),i=null;e&&e.$$&&(i=e.$$(t)),i||(i=webix.$$(t)),i&&i.show&&i.show()}})},defaults:{template:function(t,e){!t.options;
var i=t.options;e.Be(i);var s=e.Ee(t),n=webix.uid(),r="<div style='width:"+s+"px' class='webix_all_segments'>",a=t.optionWidth||Math.floor(s/i.length);t.value||(t.value=i[0].id);for(var h=0;h<i.length;h++)r+="<button type='button' style='width:"+(i[h].width||a)+"px' ",r+="class='"+(t.value==i[h].id?"webix_selected ":"")+"webix_segment_"+(h==i.length-1?"N":h>0?1:0)+"' button_id='"+i[h].id+"' >",r+=i[h].value+"</button>";
return e.$renderInput(t,r+"</div>",n)}},$setValue:function(){this.refresh()},getValue:function(){return this.s.value},getInputNode:function(){return null},optionIndex:function(t){for(var e=this.s.options,i=0;i<e.length;i++)if(e[i].id==t)return i;return-1},addOption:function(t,e,i,s){var n=t;"object"!=typeof t?(e=e||t,n={id:t,value:e}):(t=n.id,s=i,i=e),this.optionIndex(t)<0&&webix.PowerArray.insertAt.call(this.s.options,n,s),i&&this.setValue(t)
},removeOption:function(t){var e=this.optionIndex(t),i=this.s.options;if(e>=0&&webix.PowerArray.removeAt.call(i,e),this.s.value==t){var s=Math.min(e,i.length-1);s>=0?this.setValue(i[s].id):this.s.value=-1}this.callEvent("onOptionRemove",[t,this.s.value]),this.refresh()},oe:!1},webix.ui.text),webix.protoUI({name:"search",$skin:function(){this.defaults.inputPadding=webix.skin.$active.inputPadding
},on_click:{webix_input_icon:function(t){return this.callEvent("onSearchIconClick",[t])}},defaults:{type:"text",icon:"search"}},webix.ui.text),webix.protoUI({name:"toggle",Ce:!0,$init:function(){this.attachEvent("onItemClick",function(){this.toggle()})},$setValue:function(){this.render()},toggle:function(){this.setValue(!this.getValue())
},getValue:function(){var t=this.s.value;return t&&"0"!=t?1:0},defaults:{template:function(t,e){var i=t.value?" webix_pressed":"";return t.label=(t.value?t.onLabel:t.offLabel)||t.label,t.icon=(t.value?t.onIcon:t.offIcon)||t.icon,"<div class='webix_el_box"+i+"' style='width:"+t.awidth+"px; height:"+t.aheight+"px'>"+e.me(t,e)+"</div>"
}},oe:!1},webix.ui.button),webix.protoUI({name:"select",defaults:{template:function(t,e){var i=e.Be(t.options),s=t.name||"x"+webix.uid(),n=e.qt("select")+"id='"+s+"' style='width:"+e.Ee(t)+"px;'>",r=webix.$$(i);if(r&&r.data&&r.data.each)r.data.each(function(e){n+="<option"+(e.id==t.value?" selected='true'":"")+" value='"+e.id+"'>"+e.value+"</option>"
});else for(var a=0;a<i.length;a++)n+="<option"+(i[a].id==t.value?" selected='true'":"")+" value='"+i[a].id+"'>"+i[a].value+"</option>";return n+="</select>",e.$renderInput(t,n,s)}},options_setter:function(t){if(t){if("string"==typeof t){var e=new webix.DataCollection({url:t});return e.data.attachEvent("onStoreLoad",webix.bind(this.refresh,this)),e
}return t}},getInputNode:function(){return this.y.getElementsByTagName("select")[0]}},webix.ui.text),webix.protoUI({name:"textarea",$skin:function(){},defaults:{template:function(t,e){var i=t.name||t.id,s="x"+webix.uid(),n=e.qt("textarea")+"style='width:"+e.Ee(t)+"px;'";return n+=" id='"+s+"' name='"+i+"' class='webix_inp_textarea'>"+(t.value||"")+"</textarea>",e.$renderInput(t,n,s)
},height:0,minHeight:60},Dt:!0,$renderLabel:function(t,e){{var i=t.labelAlign||"left",s="top"==this.s.labelPosition,n=s?"display:block;":"width: "+this.s.labelWidth+"px;",r="";s?this.le-2:(webix.skin.$active.inputHeight||this.s.aheight)-2*this.s.inputPadding}return t.label&&(r="<label style='"+n+"text-align: "+i+";' onclick='' for='"+e+"' class='webix_inp_"+(s?"top_":"")+"label "+(t.required?"webix_required":"")+"'>"+(t.label||"")+"</label>"),r
},getInputNode:function(){return this.y.getElementsByTagName("textarea")[0]}},webix.ui.text),webix.protoUI({name:"counter",defaults:{template:function(t,e){var i=t.value||0,s=t.name||"x"+webix.uid(),n="<div class='webix_el_group' style='width:"+e.Ee(t)+"px'>";return n+="<input type='button' class='webix_inp_counter_prev' value='-' />",n+=e.qt("input")+"type='text' class='webix_inp_counter_value' value='"+i+"'></input>",n+="<input id='"+s+"' type='button' class='webix_inp_counter_next' value='+'/><div>",e.$renderInput(t,n,s)
},min:0,max:1/0,step:1},$setValue:function(t){this.getInputNode().value=t},getInputNode:function(){return this.y.getElementsByTagName("input")[1]},getValue:function(){return 1*webix.ui.button.prototype.getValue.apply(this,arguments)},next:function(t){t=this.s.step,this.shift(t)},prev:function(t){t=-1*this.s.step,this.shift(t)
},shift:function(t){var e=this.s.min,i=this.s.max,s=this.getValue()+t;s>=e&&i>=s&&this.setValue(s)}},webix.ui.text),webix.protoUI({name:"checkbox",defaults:{checkValue:1,uncheckValue:0,template:function(t,e){var i=t.name||"x"+webix.uid(),s="";t.labelRight&&(s="<label class='webix_label_right'>"+t.labelRight+"</label>",t.labelWidth&&(t.label=t.label||"&nbsp;"));
var n=t.checkValue==t.value,r=Math.floor((e.s.aheight-16)/2),a=e.qt("input")+"style='margin-top:"+r+"px;"+(t.customCheckbox?"display:none":"")+"' id='"+i+"' type='checkbox' "+(n?"checked='1'":"")+"/>",h="webix_inp_checkbox_border webix_el_group webix_checkbox_"+(n?"1":"0"),o="<div style='line-height:"+e.s.cheight+"px' class='"+h+"'>"+a+(t.customCheckbox||"")+s+"</div>";
return e.$renderInput(t,o,i)}},De:function(){},$setValue:function(t){var e=t==this.s.checkValue,i=this.getInputNode()?this.getInputNode().parentNode:null;i&&(i.className=i.className.replace(/(webix_checkbox_)\d/,"$1"+(e?1:0))),this.getInputNode().checked=e},toggle:function(){var t=this.getValue()!=this.s.checkValue?this.s.checkValue:this.s.uncheckValue;
this.setValue(t)},getValue:function(){var t=this.s.value;return t==this.s.checkValue?this.s.checkValue:this.s.uncheckValue},$skin:function(){webix.skin.$active.customCheckbox&&(this.defaults.customCheckbox="<a onclick='javascript:void(0)'><label class='webix_custom_checkbox'></label></a>")}},webix.ui.text),webix.protoUI({name:"radio",defaults:{template:function(t,e){for(var i,s=e.Be(t.options),n=[],r=0;r<s.length;r++){var a="x"+webix.uid();
i=i||a,r&&(s[r].newline||t.vertical)&&n.push("<div class='webix_line_break'></div>");var h=s[r].id==t.value,o=e.qt("input")+"name='"+t.name+"' type='radio' "+(h?"checked='1'":"")+" value='"+s[r].id+"' id='"+a+"' style='"+(t.customRadio?"display:none":"")+"' />",l="<div radio_id='"+s[r].id+"' class='webix_inp_radio_border webix_radio_"+(h?"1":"0")+"'>"+o+(t.customRadio||"")+"</div>",c=s[r].value||"";
c&&(c="<label for='"+a+"' class='webix_label_right'>"+c+"</label>"),n.push("<div class='webix_radio_option'>"+l+c+"</div>")}return n="<div class='webix_el_group' style='margin-left:"+(t.label?t.labelWidth:0)+"px;'>"+n.join("")+"</div>",e.$renderInput(t,n,i)}},$getSize:function(t,e){var i=webix.ui.button.prototype.$getSize.call(this,t,e);
if(this.s.options){for(var s=1,n=0;n<this.s.options.length;n++)(this.s.vertical||this.s.options[n].newline)&&s++;i[3]=i[2]=Math.max(i[2],(this.s.optionHeight||25)*s)}return i},Ie:function(){return this.y.getElementsByTagName("input")},$setValue:function(t){for(var e=this.Ie(),i=0;i<e.length;i++){e[i].parentNode.getAttribute("radio_id")==t?(e[i].className="webix_inp_radio_on",e[i].checked=!0):(e[i].className="webix_inp_radio_on webix_hidden",e[i].checked=!1);
var s=e[i]?e[i].parentNode:null;s&&(s.className=s.className.replace(/(webix_radio_)\d/,"$1"+(e[i].checked?1:0)))}},getValue:function(){return this.s.value},$skin:function(){webix.skin.$active.customRadio&&(this.defaults.customRadio="<a onclick='javascript:void(0)'><label class='webix_custom_radio'></label></a>"),webix.skin.$active.optionHeight&&(this.defaults.optionHeight=webix.skin.$active.optionHeight)
}},webix.ui.text),webix.protoUI({name:"richselect",defaults:{template:function(t,e){return e.Fe(t,e)},popupWidth:200,icon:"angle-down"},suggest_setter:function(t){return this.options_setter(t)},options_setter:function(t){t=this.Kt?this.Kt(t):t;var e=this.s.popup=this.s.suggest=webix.ui.text.prototype.suggest_setter.call(this,t),i=webix.$$(e).getList();
return i&&i.attachEvent("onAfterLoad",webix.bind(this.Ss,this)),e},Ss:function(){var t=this.s.value;webix.isUndefined(t)||this.getPopup().isVisible()||this.s.text||this.$setValue(t)},$skin:function(){this.defaults.inputPadding=webix.skin.$active.inputPadding},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value)
},getInputNode:function(){return this.y.getElementsByTagName("DIV")[1]},getPopup:function(){return webix.$$(this.s.popup)},getText:function(){var t=this.getInputNode();return"undefined"==typeof t.value?t.innerHTML:t.value},$setValue:function(t){if(this.se){var e=t,i=this.getPopup();if(i)var e=this.getPopup().getItemText(t);
!e&&"object"==typeof t&&t.id&&(this.getPopup().getList().add(t),e=this.getPopup().getItemText(t.id),this.s.value=t.id),this.s.text=e;var s=this.getInputNode();webix.isUndefined(s.value)?s.innerHTML=e||this.Yx():s.value=e.replace(/<[^>]*>/g,"")}},getValue:function(){return this.s.value||""}},webix.ui.text),webix.protoUI({name:"combo",$init:function(){this.attachEvent("onBlur",webix.bind(function(){if(this.s.text!=this.getText()){var t=this.getPopup().getSuggestion();
if(!t||""===this.getInputNode().value&&""!==webix.$$(this.s.suggest).getItemText(t)){if(!this.s.editable){var e=this.getValue();this.$setValue(webix.isUndefined(e)?"":e)}}else this.setValue(t)}},this))},getInputNode:function(){return this.y.getElementsByTagName("input")[0]},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value)
},De:function(){webix.event(this.getInputNode(),"change",function(){var t=this.getInputNode(),e="";t.value&&(e=webix.$$(this.s.suggest).getSuggestion()||this.s.value),e!=this.s.value?this.setValue(e,!0):this.$setValue(e)},this),webix.$$(this.s.suggest).linkInput(this)},defaults:{template:function(t,e){return e.$renderInput(t)
},icon:"angle-down"}},webix.ui.richselect),webix.protoUI({name:"datepicker",$init:function(){this.$ready.push(this.Je)},defaults:{template:function(t,e){return"time"==e.s.type&&(e.s.icon=e.s.timeIcon),t.editable?e.$renderInput(t):e.Fe(t,e)},stringResult:!1,timepicker:!1,icon:"calendar",icons:!0,timeIcon:"clock-o"},$skin:function(){this.defaults.inputPadding=webix.skin.$active.inputPadding
},getPopup:function(){return webix.$$(this.s.popup)},Je:function(){var t=this.s;if(t.suggest)t.popup=t.suggest;else if(!t.popup){var e=this.s.timepicker;t.popup=t.suggest=this.suggest_setter({type:"calendar",height:240+(e?30:0),width:250,padding:0,body:{timepicker:e,type:this.s.type,icons:this.s.icons}})
}this.ze=function(){}},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value)},Tx:function(t){var e="time"==this.s.type;if("string"==typeof t&&t){var i=e?webix.i18n.parseTimeFormatDate:webix.i18n.parseFormatDate;t=i(t)}if(t){if(e&&webix.isArray(t)){var s=new Date;s.setHours(t[0]),s.setMinutes(t[1]),t=s
}isNaN(t.getTime())&&(t="")}return t},$setValue:function(t){var e=webix.$$(this.s.popup.toString()),i=e.gd;t=this.Tx(t),i.selectDate(t,!0),this.s.value=t?i.config.date:"";var s="time"==this.s.type,n=this.config.timepicker,r=this.Hx||(s?webix.i18n.timeFormatStr:n?webix.i18n.fullDateFormatStr:webix.i18n.dateFormatStr);
this.s.text=t?r(this.s.value):"";var a=this.getInputNode();a.value==webix.undefined?a.innerHTML=this.s.text||this.Yx():a.value=this.s.text||""},format_setter:function(t){return this.Hx=webix.Date.dateToStr(t),this.Gx=webix.Date.strToDate(t),t},getInputNode:function(){return this.s.editable?this.y.getElementsByTagName("input")[0]:this.y.getElementsByTagName("DIV")[1]
},getValue:function(){var t="time"==this.s.type,e=this.config.timepicker,i=this.s.value;if(this.se){if(this.s.editable){var s=this.Gx||(t?webix.i18n.timeFormatDate:e?webix.i18n.fullDateFormatDate:webix.i18n.dateFormatDate);i=s(this.getInputNode().value)}}else i=this.Tx(i)||null;if(this.s.stringResult){var n=t?webix.i18n.parseTimeFormatStr:webix.i18n.parseFormatStr;
return i?n(i):""}return i||null},getText:function(){var t=this.getInputNode();return t?"undefined"==typeof t.value?t.innerHTML:t.value:""}},webix.ui.text),webix.protoUI({name:"colorpicker",$init:function(){this.$ready.push(this.Je)},defaults:{template:function(t,e){return e.Fe(t,e)},icon:!1},Je:function(){var t=this.s;
t.suggest?t.popup=t.suggest:t.popup||(t.popup=t.suggest=this.suggest_setter({type:"colorboard",height:200})),this.ze=function(){}},$render:function(t){webix.isUndefined(t.value)||this.$setValue(t.value)},getValue:function(){return this.se&&this.s.editable?this.getInputNode().value:this.s.value},$setValue:function(t){var e=(webix.$$(this.s.popup).gd.setValue(t),this.s.icon?"":"<div style='background-color:"+t+";'>&nbsp;</div>"+t);
this.getInputNode().innerHTML=e}},webix.ui.datepicker),webix.RenderStack={$init:function(){this.v=document.createElement("DIV"),this.data.attachEvent("onIdChange",webix.bind(this.Ke,this)),this.attachEvent("onItemClick",this.Le),this.types||(this.types={"default":this.type},this.type.name="default"),this.type=webix.clone(this.type)
},customize:function(t){webix.type(this,t)},type_setter:function(t){return this.types[t]?(this.type=webix.clone(this.types[t]),this.type.css&&(this.w.className+=" "+this.type.css)):this.customize(t),this.type.on_click&&webix.extend(this.on_click,this.type.on_click),t},template_setter:function(t){this.type.template=webix.template(t)
},jb:function(t){var e=this.data.Me[t.id];return this.callEvent("onItemRender",[t]),this.type.templateStart(t,this.type,e)+(t.$template?this.type["template"+t.$template]:this.type.template)(t,this.type,e)+this.type.templateEnd(t,this.type,e)},Ne:function(t){return this.v.innerHTML=this.jb(t),this.v.firstChild
},Ke:function(t,e){var i=this.getItemNode(t);i&&(i.setAttribute(this.ad,e),this.t[e]=this.t[t],delete this.t[t])},Le:function(){if(this.s.click){var t=webix.toFunctor(this.s.click,this.$scope);t&&t.call&&t.apply(this,arguments)}},getItemNode:function(t){if(this.t)return this.t[t];this.t={};for(var e=this.y.childNodes,i=0;i<e.length;i++){var s=e[i].getAttribute(this.ad);
s&&(this.t[s]=e[i])}return this.getItemNode(t)},locate:function(t){return webix.html.locate(t,this.ad)},showItem:function(t){var e=this.getItemNode(t);if(e&&this.scrollTo){var i=e.offsetLeft,s=i+e.offsetWidth,n=e.offsetTop,r=n+e.offsetHeight,a=this.getScrollState(),h=a.x;(h>i||h+this.bc<s)&&(h=i);var o=a.y;
(o>n||o+this.dc<r)&&(o=n-5),this.scrollTo(h,o),this.Oe&&this.Oe(t)}},render:function(t,e,i){if(this.isVisible(this.s.id)&&!this.$blockRender)if(t){var s=this.getItemNode(t);switch(i){case"paint":case"update":if(!s)return;var n=this.t[t]=this.Ne(e);webix.html.insertBefore(n,s),webix.html.remove(s);break;
case"delete":if(!s)return;webix.html.remove(s),delete this.t[t];break;case"add":var n=this.t[t]=this.Ne(e);webix.html.insertBefore(n,this.getItemNode(this.data.getNextId(t)),this.y);break;case"move":webix.html.insertBefore(this.getItemNode(t),this.getItemNode(this.data.getNextId(t)),this.y)}}else if(this.callEvent("onBeforeRender",[this.data])){(this.Pe||this.y).innerHTML=this.data.getRange().map(this.jb,this).join(""),this.t=null,this.callEvent("onAfterRender",[]);
var n=this.y.offsetHeight}}},webix.ValidateData={$init:function(){this.h&&this.attachEvent("onChange",this.clearValidation)},clearValidation:function(){if(this.elements)for(var t in this.elements)this.Qe(t)},validate:function(t){this.callEvent("onBeforeValidate",[]);var e=this.Re={},i=!0,s=this.s.rules,n=this.isVisible&&!this.isVisible(),r={},a=[];
for(var h in this.elements){var o=this.elements[h].config.name;n||this.elements[h].isVisible()?r[o]=this.elements[h]:a.push(o)}if((s||r)&&!t&&this.getValues&&(t=this.getValues()),s){s.$obj&&(i=this.Se(s.$obj,t,t,"")&&i);var l=s.$all;if(l)for(var c in t)if(-1===a.indexOf(c)){var u=this.Se(l,t[c],t,c);
u||(e[c]=!0),i=u&&i}for(var c in s)if(-1===a.indexOf(c)&&0!==c.indexOf("$")&&!e[c]){var u=this.Se(s[c],t[c],t,c);u||(e[c]=!0),i=u&&i}}if(r)for(var c in r)if(!e[c]){var d=r[c];if(d.validate){var u=d.validate();i=u&&i,u||(e[c]=!0)}else{var f=d.s;if(f){var b=f.validate;if(!b&&f.required&&(b=webix.rules.isNotEmpty),b){var u=this.Se(b,t[c],t,c);
u||(e[c]=!0),i=u&&i}}}}return this.callEvent("onAfterValidation",[i,this.Re]),i},Se:function(t,e,i,s){return"string"==typeof t&&(t=webix.rules[t]),t.call(this,e,i,s)?(this.callEvent("onValidationSuccess",[s,i])&&this.Qe&&this.Qe(s,i),!0):(this.callEvent("onValidationError",[s,i])&&this.Te&&this.Te(s,i),!1)
}},webix.ValidateCollection={Ue:function(){this.data.attachEvent("onStoreUpdated",webix.bind(function(t,e,i){!t||"add"!=i&&"update"!=i||this.validate(t)},this)),this.attachEvent("onClearAll",this.clearValidation),this.Ue=function(){}},rules_setter:function(t){return t&&this.Ue(),t},clearValidation:function(){this.data.clearMark("webix_invalid",!0)
},validate:function(t){var e=!0;if(t){this.Re={};var i=this.getItem(t);e=webix.ValidateData.validate.call(this,i),e?this.callEvent("onValidationSuccess",[t,i])&&this.Qe(t):this.callEvent("onValidationError",[t,i,this.Re])&&this.Te(t,this.Re)}else for(var s in this.data.pull)var e=this.validate(s)&&e;
return e},Se:function(t,e,i,s){"string"==typeof t&&(t=webix.rules[t]);var n=t.call(this,e,i,s);return n||(this.Re[s]=!0),n},Qe:function(t){this.data.removeMark(t,"webix_invalid",!0)},Te:function(t){this.data.addMark(t,"webix_invalid",!0)}},webix.rules={isEmail:function(t){return/^[^@]+@[^@]+\.[^@]+$/.test((t||"").toString())
},isNumber:function(t){return parseFloat(t)==t},isChecked:function(t){return!!t||"0"===t},isNotEmpty:function(t){return 0===t||t}},webix.DataLoader=webix.proto({$init:function(t){t=t||"",this.Ve=webix.toArray(),this.data=new webix.DataStore,this.data.attachEvent("onClearAll",webix.bind(this.We,this)),this.data.attachEvent("onServerConfig",webix.bind(this.Xe,this)),this.data.feed=this.Ye,this.data.owner=t.id
},Ye:function(t,e,i){return this.Ze?this.Ze=[t,e,i]:(this.Ze=!0,this.$e=[t,e],void this._e.call(this,t,e,i))},_e:function(t,e,i){var s=this.data.url;0>t&&(t=0);var n=[this.af,i];if(s&&"string"!=typeof s){var r={from:t,count:e};if(this.getState){var a=this.getState();r.sort=a.sort,r.filter=a.filter}this.load(s,n,r)
}else{var h=s+(-1==s.indexOf("?")?"?":"&")+(this.count()?"continue=true":"");if(-1!=e&&(h+="&count="+e),t&&(h+="&start="+t),this.getState){var a=this.getState();if(a.sort&&(h+="&sort["+a.sort.id+"]="+a.sort.dir),a.filter)for(var o in a.filter)h+="&filter["+o+"]="+a.filter[o]}this.load(h,n)}},af:function(){var t=this.Ze,e=this.$e;
this.Ze=!1,"object"!=typeof t||t[0]==e[0]&&t[1]==e[1]||this.data.feed.apply(this,t)},load:function(t){var e=webix.AtomDataLoader.load.apply(this,arguments);return this.data.url||(this.data.url=t),e},loadNext:function(t,e,i,s,n){var r=this.s;return r.datathrottle&&!n?(this.bf&&window.clearTimeout(this.bf),void(this.bf=webix.delay(function(){this.loadNext(t,e,i,s,!0)
},this,0,r.datathrottle))):(e||0===e||(e=this.count()),t||(t=r.datafetch||this.count()),this.data.url=this.data.url||s,void(this.callEvent("onDataRequest",[e,t,i,s])&&this.data.url&&this.data.feed.call(this,e,t,i)))},cf:function(t,e){var i=this.$e;return this.Ze&&i&&i[0]<=e&&i[1]+i[0]>=t+e?!0:!1},M:function(t,e,i){var s;
return-1===i?s=e:(this.Ve.remove(i),s=this.data.driver.toObject(t,e)),s?(this.data.df(s),this.ef(),this.callEvent("onAfterLoad",[]),void this.waitData.resolve()):this.N(t,e,i)},removeMissed_setter:function(t){return this.data.ff=t},gf:function(){var t=this.s.save;t===!0&&(t=this.s.save=this.s.url);var e={master:this};
t&&t.url?webix.extend(e,t):e.url=t,webix.dp(e)},save_setter:function(t){return t&&this.$ready.push(this.gf),t},scheme_setter:function(t){this.data.scheme(t)},dataFeed_setter:function(t){if("string"==typeof t&&-1!=t.indexOf("->")){var e=t.split("->");t=webix.proxy(e[0],e[1])}return this.data.attachEvent("onBeforeFilter",webix.bind(function(t,e){if("function"==typeof t)return!0;
if(this.s.dataFeed&&(t||e)){t=t||"id",e&&"object"==typeof e&&(e=e.id),this.clearAll();var i=this.s.dataFeed;if("function"==typeof i){var s={};s[t]=e,i.call(this,e,s)}else if(i.$proxy){if(i.load){var n={};n[t]=e,i.load(this,null,n)}}else{var r="filter["+t+"]="+encodeURIComponent(e);this.load(i+(i.indexOf("?")<0?"?":"&")+r,this.s.datatype)
}return!1}},this)),t},ef:function(){if(this.s.ready&&!this.hf){var t=webix.toFunctor(this.s.ready,this.$scope);t&&webix.delay(t,this,arguments),this.hf=!0}},We:function(){for(var t=0;t<this.Ve.length;t++){var e=this.Ve[t];try{e.aborted=!0}catch(i){webix.ly.push(e)}e.abort()}this.Ve=webix.toArray(),this.waitData=webix.promise.defer()
},Xe:function(t){this.C(t)}},webix.AtomDataLoader),webix.ly=webix.toArray(),webix.DataMarks={addCss:function(t,e,i){if(!this.addRowCss&&!i&&!this.hasCss(t,e)){var s=this.getItemNode(t);s&&(s.className+=" "+e,i=!0)}return this.data.addMark(t,e,1,1,i)},removeCss:function(t,e,i){if(!this.addRowCss&&!i&&this.hasCss(t,e)){var s=this.getItemNode(t);
s&&(s.className=s.className.replace(e,"").replace("  "," "),i=!0)}return this.data.removeMark(t,e,1,i)},hasCss:function(t,e){return this.data.getMark(t,e)},clearCss:function(t,e){return this.data.clearMark(t,1,e)}},webix.DataStore=function(){this.name="DataStore",webix.extend(this,webix.EventSystem),this.setDriver("json"),this.pull={},this.order=webix.toArray(),this.Me={}
},webix.DataStore.prototype={setDriver:function(t){this.driver=webix.DataDriver[t]},df:function(t){this.callEvent("onParse",[this.driver,t]),this.jf&&this.filter();var e=this.driver.getInfo(t);e.U&&(webix.securityKey=e.U),e.T&&this.callEvent("onServerConfig",[e.T]);var i=this.driver.getOptions(t);i&&this.callEvent("onServerOptions",[i]);
var s=this.driver.getRecords(t);this.kf(e,s),this.lf&&this.mf&&!this.nf&&this.mf(this.lf),this.of&&(this.blockEvent(),this.sort(this.of),this.unblockEvent()),this.callEvent("onStoreLoad",[this.driver,t]),this.refresh()},kf:function(t,e){var i=1*(t.R||0),s=!0,n=!1;if(0===i&&this.order[0]&&this.order[this.order.length-1]){if(this.ff){n={};
for(var r=0;r<this.order.length;r++)n[this.order[r]]=!0}s=!1,i=this.order.length}for(var a=0,r=0;r<e.length;r++){var h=this.driver.getDetails(e[r]),o=this.id(h);this.pull[o]?s&&this.order[a+i]&&a++:(this.order[a+i]=o,a++),this.pull[o]?(webix.extend(this.pull[o],h,!0),this.pf&&this.pf(this.pull[o]),n&&delete n[o]):(this.pull[o]=h,this.qf&&this.qf(h))
}if(n){this.blockEvent();for(var l in n)this.remove(l);this.unblockEvent()}this.order[t.Q-1]||(this.order[t.Q-1]=webix.undefined)},id:function(t){return t.id||(t.id=webix.uid())},changeId:function(t,e){this.pull[t]&&(this.pull[e]=this.pull[t]),this.pull[e].id=e,this.order[this.order.find(t)]=e,this.jf&&(this.jf[this.jf.find(t)]=e),this.Me[t]&&(this.Me[e]=this.Me[t],delete this.Me[t]),this.callEvent("onIdChange",[t,e]),this.Ke&&this.Ke(t,e),delete this.pull[t]
},getItem:function(t){return this.pull[t]},updateItem:function(t,e){var i=this.getItem(t);webix.isUndefined(e)||i===e||webix.extend(i,e,!0),this.pf&&this.pf(i),this.callEvent("onDataUpdate",[t,i]),this.callEvent("onStoreUpdated",[t,i,"update"])},refresh:function(t){this.rf||(t?this.exists(t)&&this.callEvent("onStoreUpdated",[t,this.pull[t],"paint"]):this.callEvent("onStoreUpdated",[null,null,null]))
},silent:function(t,e){this.rf=!0,t.call(e||this),this.rf=!1},getRange:function(t,e){if(t=t?this.getIndexById(t):this.$min||this.startOffset||0,e?e=this.getIndexById(e):(e=0===this.$max?0:Math.min(this.$max||this.endOffset||1/0,this.count()-1),0>e&&(e=0)),t>e){var i=e;e=t,t=i}return this.getIndexRange(t,e)
},getIndexRange:function(t,e){e=Math.min(0===e?0:e||1/0,this.count()-1);for(var i=webix.toArray(),s=t||0;e>=s;s++)i.push(this.getItem(this.order[s]));return i},count:function(){return this.order.length},exists:function(t){return!!this.pull[t]},move:function(t,e){if(t!=e){var i=this.getIdByIndex(t),s=this.getItem(i);
this.jf&&this.sf(this.jf,0,0,this.getIdByIndex(t),this.getIdByIndex(e)),this.sf(this.order,t,e),this.callEvent("onStoreUpdated",[i,s,"move"])}},sf:function(t,e,i,s,n){if(s||n){e=i=-1;for(var r=0;r<t.length;r++)t[r]==s&&0>e&&(e=r),t[r]==n&&0>i&&(i=r)}var a=t[e];t.removeAt(e),t.insertAt(a,Math.min(t.length,i))
},scheme:function(t){this.tf={},this.uf=t.$save,this.qf=t.$init||t.$change,this.pf=t.$update||t.$change,this.vf=t.$serialize,this.lf=t.$group,this.of=t.$sort;for(var e in t)"$"!=e.substr(0,1)&&(this.tf[e]=t[e])},importData:function(t,e){var i=t.data||t;if(this.jf=null,"function"==typeof i.serialize)this.order=webix.toArray([].concat(i.order)),this.pull=i.pull,i.branch&&this.branch&&(this.branch=webix.copy(i.branch),this.Mg=null);
else{this.order=webix.toArray(),this.pull={};var s,n;if(webix.isArray(t))for(var r=0;r<t.length;r++)n=s=t[r],"object"==typeof n?s=n.id:n={id:s,value:s},this.order.push(n.id),this.qf&&this.qf(n),this.pull[n.id]=n;else for(var r in i)this.order.push(r),this.pull[r]={id:r,value:i[r]}}e||this.callEvent("onStoreUpdated",[])
},sync:function(t,e,i){var s=typeof t;if("string"==s&&(t=webix.$$("source")),"function"!=s&&"object"!=s&&(i=e,e=null),"DataStore"!=t.name){if(!t.data||"DataStore"!==t.data.name&&"TreeStore"!==t.data.name)return this.Ts=t,webix.callEvent("onSyncUnknown",[this,t,e]);t=t.data}var n=webix.bind(function(){this.wf||(this.importData(t,!0),e&&this.silent(e),this.Y&&this.Y(),this.callEvent("onSyncApply",[]),i?i=!1:this.refresh())
},this);this.ab=[t.attachEvent("onStoreUpdated",n),t.attachEvent("onIdChange",webix.bind(function(t,e){this.changeId(t,e),this.refresh(e)},this))],this.Ts=t,this.Us=this.attachEvent("onStoreUpdated",function(e,i,s){("update"==s||"save"==s)&&(this.wf=1,t.updateItem(e,i),this.wf=0)}),n()},unsync:function(){if(this.Ts){var t=this.Ts;
if("DataStore"==t.name||t.data&&"DataStore"==t.data.name){for(var e=0;e<this.ab.length;e++)t.detachEvent(this.ab[e]);this.detachEvent(this.Us)}else webix.callEvent("onUnSyncUnknown",[this,t]);this.Ts=null}},destructor:function(){this.unsync(),this.pull=this.order=this.Me=null,this.i=this.j={}},add:function(t,e){if(this.tf)for(var i in this.tf)webix.isUndefined(t[i])&&(t[i]=this.tf[i]);
this.qf&&this.qf(t);var s=this.id(t),n=arguments[2]||this.order,r=n.length;if((webix.isUndefined(e)||0>e)&&(e=r),e>r&&(e=Math.min(n.length,e)),this.callEvent("onBeforeAdd",[s,t,e])===!1)return!1;if(this.pull[s]=t,n.insertAt(s,e),this.jf){var a=this.jf.length;!e&&this.order.length&&(a=0),this.jf.insertAt(s,a)
}return this.callEvent("onAfterAdd",[s,e]),this.callEvent("onStoreUpdated",[s,t,"add"]),s},remove:function(t){if(webix.isArray(t))for(var e=0;e<t.length;e++)this.remove(t[e]);else{if(this.callEvent("onBeforeDelete",[t])===!1)return!1;var i=this.getItem(t);this.order.remove(t),this.jf&&this.jf.remove(t),delete this.pull[t],this.Me[t]&&delete this.Me[t],this.callEvent("onAfterDelete",[t]),this.callEvent("onStoreUpdated",[t,i,"delete"])
}},clearAll:function(){this.pull={},this.Me={},this.order=webix.toArray(),this.jf=this.url=null,this.callEvent("onClearAll",[]),this.refresh()},getIdByIndex:function(t){return this.order[t]},getIndexById:function(t){var e=this.order.find(t);return this.pull[t]?e:-1},getNextId:function(t,e){return this.order[this.getIndexById(t)+(e||1)]
},getFirstId:function(){return this.order[0]},getLastId:function(){return this.order[this.order.length-1]},getPrevId:function(t,e){return this.order[this.getIndexById(t)-(e||1)]},sort:function(t,e,i){var s=t;"function"==typeof t?s={as:t,dir:e}:"string"==typeof t&&(s={by:t.replace(/#/g,""),dir:e,as:i});
var n=[s.by,s.dir,s.as,s];this.callEvent("onBeforeSort",n)&&(this.order=this.xf(s,this.order),this.jf&&this.jf.length!=this.order.length&&(this.jf=this.xf(s,this.jf)),this.refresh(),this.callEvent("onAfterSort",n))},xf:function(t,e){var i=this.zf.yf(t);if(this.order.length){for(var s=webix.toArray(),n=e.length-1;n>=0;n--)s[n]=this.pull[e[n]];
return s.sort(i),webix.toArray(s.map(function(t){return this.id(t)},this))}return e},Af:function(t){this.jf&&!t&&(this.order=this.jf,delete this.jf)},Bf:function(t,e,i){for(var s=webix.toArray(),n=0;n<this.order.length;n++){var r=this.order[n];t(this.getItem(r),e)&&s.push(r)}i&&this.jf||(this.jf=this.order),this.order=s
},filter:function(t,e,i){if((t||this.jf||this.Mg)&&this.callEvent("onBeforeFilter",[t,e])&&(this.Af(i),this.order.length)){if(t){var s=t;e=e||"","string"==typeof t&&(t=t.replace(/#/g,""),"function"==typeof e?s=function(i){return e(i[t])}:(e=e.toString().toLowerCase(),s=function(e,i){return-1!=(e[t]||"").toString().toLowerCase().indexOf(i)
})),this.Bf(s,e,i,this.Cf)}this.refresh(),this.callEvent("onAfterFilter",[])}},Df:function(){for(var t=[],e=this.order.length-1;e>=0;e--)t[e]=this.pull[this.order[e]];return t},each:function(t,e,i){var s=this.order;i&&(s=this.jf||s);for(var n=0;n<s.length;n++)t.call(e||this,this.getItem(s[n]),n)},Ef:function(t,e){return function(){return t[e].apply(t,arguments)
}},provideApi:function(t,e){e&&this.mapEvent({onbeforesort:t,onaftersort:t,onbeforeadd:t,onafteradd:t,onbeforedelete:t,onafterdelete:t,ondataupdate:t});for(var i=["sort","add","remove","exists","getIdByIndex","getIndexById","getItem","updateItem","refresh","count","filter","getNextId","getPrevId","clearAll","getFirstId","getLastId","serialize","sync"],s=0;s<i.length;s++)t[i[s]]=this.Ef(this,i[s])
},addMark:function(t,e,i,s,n){var r=this.Me[t]||{};if(this.Me[t]=r,!r[e]){if(r[e]=s||!0,i){var a=r.$css||"";r.$css=a+" "+e}n||this.refresh(t)}return r[e]},removeMark:function(t,e,i,s){var n=this.Me[t];if(n){if(n[e]&&delete n[e],i){var r=n.$css;r&&(n.$css=r.replace(e,"").replace("  "," "))}s||this.refresh(t)
}},getMark:function(t,e){var i=this.Me[t];return i?i[e]:!1},clearMark:function(t,e,i){for(var s in this.Me){var n=this.Me[s];n[t]&&(delete n[t],e&&n.$css&&(n.$css=n.$css.replace(t,"").replace("  "," ")),i||this.refresh(s))}},serialize:function(t){var e=this.order;t&&this.jf&&(e=this.jf);for(var i=[],s=0;s<e.length;s++){var n=this.pull[e[s]];
this.vf&&(n=this.vf(n),n===!1)||i.push(n)}return i},zf:{yf:function(t){return this.Ff(t.dir,this.Gf(t.by,t.as))},Hf:{server:function(){return!1},date:function(t,e){return t-=0,e-=0,t>e?1:e>t?-1:0},"int":function(t,e){return t=1*t,e=1*e,t>e?1:e>t?-1:0},string_strict:function(t,e){return t=t.toString(),e=e.toString(),t>e?1:e>t?-1:0
},string:function(t,e){return e?t?(t=t.toString().toLowerCase(),e=e.toString().toLowerCase(),t>e?1:e>t?-1:0):-1:1}},Gf:function(t,e){return t?("function"!=typeof e&&(e=this.Hf[e||"string"]),function(i,s){return e(i[t],s[t])}):e},Ff:function(t,e){return"asc"!=t&&t?function(t,i){return-1*e(t,i)}:e}}},webix.DataCollection=webix.proto({name:"DataCollection",isVisible:function(){return this.data.order.length||this.data.jf||this.s.dataFeed?!0:!1
},$init:function(t){this.data.provideApi(this,!0);var e=t&&t.id?t.id:webix.uid();this.s.id=e,webix.ui.views[e]=this,this.data.attachEvent("onStoreLoad",webix.bind(function(){this.callEvent("onBindRequest",[])},this))},refresh:function(){this.callEvent("onBindRequest",[])}},webix.CollectionBind,webix.BindSource,webix.ValidateCollection,webix.DataLoader,webix.EventSystem,webix.BaseBind,webix.Destruction,webix.Settings),webix.Scrollable={$init:function(t){return t&&!t.scroll&&this.If?this.y=this.y||this.w:((this.y||this.w).appendChild(webix.html.create("DIV",{"class":"webix_scroll_cont"},"")),void(this.y=(this.y||this.w).firstChild))
},scroll_setter:function(t){if(!t)return!1;var e="x"==t?"x":"xy"==t?"xy":"a"==t?"xy":"y";if(webix.Touch&&webix.Touch.$active)this.y.setAttribute("touch_scroll",e),this.attachEvent&&this.attachEvent("onAfterRender",webix.bind(this.Jf,this)),this.Kf=!0;else if(webix.env.$customScroll)webix.CustomScroll.enable(this,e);
else{var i=this.y.parentNode.style;-1!=t.toString().indexOf("a")?i.overflowX=i.overflowY="auto":(-1!=e.indexOf("x")&&(this.ec=!0,i.overflowX="scroll"),-1!=e.indexOf("y")&&(this.cc=!0,i.overflowY="scroll"))}return e},Lf:function(t){if(!!this.s.scroll!=!!t){if(!webix.env.$customScroll){var e=this.y.parentNode.style;
e.overflowX=e.overflowY=t?"auto":"hidden"}this.ec=this.cc=!!t,this.s.scroll=!!t}},getScrollState:function(){if(webix.Touch&&webix.Touch.$active){var t=webix.Touch.Mf(this.y);return{x:-t.e,y:-t.f}}return{x:this.y.parentNode.scrollLeft,y:this.y.parentNode.scrollTop}},scrollTo:function(t,e){webix.Touch&&webix.Touch.$active?(e=Math.max(0,Math.min(e,this.y.offsetHeight-this.dc)),t=Math.max(0,Math.min(t,this.y.offsetWidth-this.bc)),webix.Touch.Nf(this.y,-t,-e,this.s.scrollSpeed||"100ms")):(this.y.parentNode.scrollLeft=t,this.y.parentNode.scrollTop=e)
},Jf:function(){if(-1!=this.s.scroll.toString().indexOf("x")&&(this.y.style.width="100%",this.y.style.width=this.y.scrollWidth+"px"),webix.Touch&&webix.Touch.$active&&this.Kf){webix.Touch.Of(),webix.Touch.Pf();var t=this.getScrollState(),e=this.y.offsetWidth-this.$width-t.x,i=this.y.offsetHeight-this.$height-t.y;
if(0>e||0>i){var s=0>e?Math.min(-e-t.x,0):-t.x,n=0>i?Math.min(-i-t.y,0):-t.y;webix.Touch.Nf(this.y,s,n,0)}}}},webix.protoUI({defaults:{size:10,page:0,group:5,template:"{common.pages()}",maxWidth:1e5,height:30,borderless:!0},name:"pager",on_click:{webix_pager_item:function(t,e){this.select(e)}},$init:function(t){this.data=this.s,this.y=this.x,this.x.className+=" webix_pager",(t.master===!1||0===t.master)&&this.$ready.push(this.wt)
},wt:function(){this.refresh(),this.$master={refresh:function(){},select:function(){}}},select:function(t){if(this.$master&&"pager"==this.$master.name)return this.$master.select(t);switch(t){case"next":t=this.s.page+1;break;case"prev":t=this.s.page-1;break;case"first":t=0;break;case"last":t=this.s.limit-1
}0>t&&(t=0),t>=this.data.limit&&(t=this.data.limit-1);var e=this.data.page;this.data.page=1*t,this.refresh()&&(this.s.animate&&this.Qf(e,1*t,this.s.animate)||this.$master.refresh())},ad:"webix_p_id",template_setter:webix.template,type:{template:function(t,e){return t.template.call(this,t,e)},pages:function(t){var e="";
if(-1==t.page)return"";t.$min=t.page-Math.round((t.group-1)/2),t.$max=t.$min+1*t.group-1,t.$min<0&&(t.$max+=-1*t.$min,t.$min=0),t.$max>=t.limit&&(t.$min-=Math.min(t.$min,t.$max-t.limit+1),t.$max=t.limit-1);for(var i=t.$min||0;i<=t.$max;i++)e+=this.button({id:i,index:i+1,selected:i==t.page?"_selected":""});
return e},page:function(t){return t.page+1},first:function(){return this.button({id:"first",index:webix.locale.pager.first,selected:""})},last:function(){return this.button({id:"last",index:webix.locale.pager.last,selected:""})},prev:function(){return this.button({id:"prev",index:webix.locale.pager.prev,selected:""})
},next:function(){return this.button({id:"next",index:webix.locale.pager.next,selected:""})},button:webix.template("<button type='button' webix_p_id='{obj.id}' class='webix_pager_item{obj.selected}'>{obj.index}</button>")},clone:function(t){t.$view||(t.view="pager",t=webix.ui(t)),this.Rf=t,t.$master=this,this.Sf()
},refresh:function(){var t=this.s;if(t.count){t.limit=Math.ceil(t.count/t.size),t.page=Math.min(t.limit-1,t.page);var e=t.page;return e>=0&&e!=t.old_page||t.limit!=t.old_limit?(this.render(),this.Sf(),t.old_limit=t.limit,t.old_page=t.page,!0):void 0}},apiOnly_setter:function(t){return this.$apiOnly=t
},Sf:function(){this.Rf&&(this.Rf.s.count=this.s.count,this.Rf.s.page=this.s.page,this.Rf.refresh())},Qf:function(t,e,i){if(t==e)return!1;if(this.Tf)return this.Uf&&window.clearTimeout(this.Uf),this.Uf=webix.delay(this.Qf,this,[t,e,i],100);var s=e>t?"left":"right";("top"==i.direction||"bottom"==i.direction)&&(s=e>t?"top":"bottom"),i.flip&&(s="");
var n=0,r=this.$master.y;this.$master.Vf&&(r=this.$master.Vf,n=r.offsetTop,webix.html.addCss(this.$master.$view,"webix_animation"));var a=r.cloneNode(!0);a.style.width=r.style.width="100%",a.style.backgroundColor=r.style.backgroundColor="white",this.$master.refresh(),webix.html.insertBefore(a,r.nextSibling,r.parentNode);
var h,o=i!==!0?i:{},l=webix.extend({direction:s,callback:webix.bind(function(){l.callback=null,webix.animate.breakLine(h),this.Tf=!1,this.$master.Vf&&webix.html.removeCss(this.$master.$view,"webix_animation")},this),top:n},o);h=webix.animate.formLine(r,a,l),webix.animate([r,a],l),this.Tf=!0}},webix.MouseEvents,webix.SingleRender,webix.ui.view,webix.EventSystem),webix.locale.pager={first:" &lt;&lt; ",last:" &gt;&gt; ",next:" &gt; ",prev:" &lt; "},webix.PagingAbility={pager_setter:function(t){function e(i){if(t.config.autosize&&this.getVisibleCount){var s=this.getVisibleCount();
isNaN(s)?(t.config.size=1,webix.delay(e,this,[!0])):s!=t.config.size&&(t.config.size=s,t.refresh(),i===!0&&this.refresh())}var n=this.s.pager;return-1==n.page?!1:(this.data.$min=this.sy(0,n.page*n.size),this.data.$max=this.sy(this.data.$min,n.size),this.data.$pagesize=this.data.$max-this.data.$min,!0)
}if("string"==typeof t){var i=webix.$$(t);if(!i)return this.$blockRender=!0,webix.delay(function(){var e=webix.$$(t);this.s.pager=this.pager_setter(e);var i=e.s;i.count=this.data.ty(i.level),e.refresh(),this.$blockRender=!1,this.render()},this),null;t=i}return this.attachEvent("onBeforeRender",e),t.$view||(t.view="pager",t=webix.ui(t)),this.Wf=t,t.$master=this,this.data.attachEvent("onStoreUpdated",function(){var e=t.s;
e.count=this.ty(e.level),t.refresh()}),this.data.ty=this.ty,t.s},ty:function(t){if(t&&0!==t){var e=0;return this.each(function(i){i.$level==t&&e++}),e}return this.count()},sy:function(t,e){var i=this.s.pager;if(i.level&&0!==i.level){var s=t,n=this.data.order.length;if(e)for(;n>s;){if(this.data.getItem(this.data.order[s]).$level==i.level){if(0===e)break;
e--}s++}return s}return t+e},setPage:function(t){this.Wf&&this.Wf.select(t)},getPage:function(){return this.Wf.s.page},getPager:function(){return this.Wf}},webix.protoUI({name:"tooltip",defaults:{dy:0,dx:20},$init:function(t){"string"==typeof t&&(t={template:t}),this.type=webix.extend({},this.type),this.x=this.w=this.y=document.createElement("DIV"),this.w.className="webix_tooltip",webix.html.insertBefore(this.w,document.body.firstChild)
},adjust:function(){},isVisible:function(){return!0},show:function(t,e){this.Xf||(this.data!=t&&(this.data=webix.extend({},t),this.render(t)),this.y.firstChild&&(this.w.style.top=e.y+this.s.dy+"px",this.w.style.left=e.x+this.s.dx+"px",this.w.style.display="block"))},hide:function(){this.data=null,this.w.style.display="none"
},disable:function(){this.Xf=!0},enable:function(){this.Xf=!1},type:{template:webix.template("{obj.id}"),templateStart:webix.template.empty,templateEnd:webix.template.empty}},webix.SingleRender,webix.Settings,webix.EventSystem,webix.ui.view),webix.AutoTooltip={tooltip_setter:function(t){if(t){"function"==typeof t&&(t={template:t});
var e=!t.template,i=[],s=new webix.ui.tooltip(t);return this.Vc(),i[0]=this.attachEvent("onMouseMove",function(t,i){if(this.getColumnConfig){var n=s.type.column=this.getColumnConfig(t.column);if(e){if(!n.tooltip&&n.tooltip!=webix.undefined)return;if(n.tooltip)s.type.template=n.tooltip=webix.template(n.tooltip);
else{var r=this.getText(t.row,t.column);s.type.template=function(){return r}}}}webix.DragControl.active||s.show(this.getItem(t),webix.html.pos(i))}),i[1]=this.attachEvent("onMouseOut",function(){s.hide()}),i[2]=this.attachEvent("onMouseMoving",function(){s.hide()}),this.attachEvent("onDestruct",function(){this.config.tooltip&&this.config.tooltip.destructor()
}),s.attachEvent("onDestruct",webix.bind(function(){for(var t=0;t<i.length;t++)this.detachEvent(i[t])},this)),s}}},webix.protoUI({name:"proto",$init:function(){this.data.provideApi(this,!0),this.y=this.y||this.w,this.data.attachEvent("onStoreUpdated",webix.bind(function(){this.render.apply(this,arguments)
},this))},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)&&this.render()},ad:"webix_item",on_mouse_move:{},type:{}},webix.PagingAbility,webix.DataMarks,webix.AutoTooltip,webix.ValidateCollection,webix.RenderStack,webix.DataLoader,webix.ui.view,webix.EventSystem,webix.Settings),webix.Values={$init:function(){this.elements={}
},focus:function(t){var e;if(t)e=this.elements[t];else if(this.q){var i=0;do e=this.q[i],i++;while(e&&!e.focus)}e&&e.focus&&e.focus()},setValues:function(t,e){this.Yf=e,this.blockEvent(),this.Zf(t,e),this.unblockEvent(),this.callEvent("onValues",[])},Zf:function(t,e){this.$f=e?webix.extend(this.getValues(),t,!0):webix.copy(t);
for(var i in this.elements){var s=this.elements[i];s&&(webix.isUndefined(this.$f[i])?(s.Ce&&s.setValue(""),this.$f[i]=s.getValue()):s.setValue(t[i]||this.$f[i]))}},isDirty:function(){return this.Yf?!0:1===this.getDirtyValues(1)?!0:!1},setDirty:function(t){this.Yf=t,t||(this.$f=this.getValues())},getDirtyValues:function(){var t={};
if(this.$f)for(var e in this.elements){var i=this.elements[e].getValue();if(this.$f[e]!=i&&(t[e]=i,arguments[0]))return 1}return t},getCleanValues:function(){return this.$f},getValues:function(t){var e,i=null,s=this.$f?webix.copy(this.$f):{};for(var n in this.elements)i=this.elements[n],e=!0,t&&("object"==typeof t?(t.hidden===!1&&(e=i.isVisible()),e&&t.disabled===!1&&(e=i.isEnabled())):e=t.call(this,i)),e?s[n]=i.getValue():delete s[n];
return s},clear:function(){this.Yf=!1;var t={};for(var e in this.elements)this.elements[e].Ce&&(t[e]=this.elements[e].s.defaultValue||"");this.setValues(t)},M:function(t,e,i){var s,n=this.data.driver;if(s=-1===i?e:n.toObject(t,e)){var r=n.getRecords(s)[0];this.setValues(n?n.getDetails(r):t)}else this.N(t,e,i);
this.callEvent("onAfterLoad",[]),this.waitData.resolve()},Te:function(t,e){var i=this.elements[t];t&&i&&(this.Qe(t,e,!0),webix.html.addCss(i.x,"webix_invalid"),i.s.invalid=!0,i.s.invalidMessage&&i.qy&&i.qy())},Qe:function(t,e,i){var s=this.elements[t];t&&s&&s.$view&&s.s.invalid&&(webix.html.removeCss(s.x,"webix_invalid"),s.s.invalid=!1,s.s.invalidMessage&&!i&&s.qy&&s.qy())
}},webix.protoUI({name:"toolbar",defaults:{type:"toolbar"},Gc:!0,_f:"webix_toolbar",ag:!1,$init:function(t){t.borderless||(this.w.style.borderWidth="1px"),this.w.className+=" "+this._f},Qs:function(){var t=this;t.elements={},webix.ui.each(this,function(e){return e.s.name&&e.getValue&&e.setValue&&(t.elements[e.s.name]=e,e.mapEvent&&e.mapEvent({onbeforetabclick:t,onaftertabclick:t,onitemclick:t,onchange:t})),e.setValues?!1:void 0
}),this.setDirty(!1)},sc:function(){this.Qs()},Bc:function(t){var e=this.s;return e.elements&&!t&&(this.nc=t=e.elements,this.mc=this.ag,delete e.elements),this.s.elementsConfig&&this.eg(this.nc,e.elementsConfig),t},eg:function(t,e){for(var i=0;i<t.length;i++){var s=t[i];webix.extend(s,e);var n=e;s.elementsConfig&&(n=webix.extend(webix.extend({},s.elementsConfig),e));
var r;r=s.body?[s.body]:s.rows||s.cols||s.cells||s.body,r&&this.eg(r,n)}},$getSize:function(t,e){var i=webix.ui.layout.prototype.$getSize.call(this,t,e),s=this.getParentView(),n=this.mc?3:1;return s&&this.mc!=s.mc&&(i[n]+=1e5),i},render:function(){},refresh:function(){this.render()}},webix.Scrollable,webix.AtomDataLoader,webix.Values,webix.ui.layout,webix.ValidateData),webix.protoUI({name:"template",$init:function(t){var e=this.fg[t.type];
e&&(webix.extend(t,e),t.borderless&&(delete t.Ob,this.hc(t))),this.y==this.x?(this.y=webix.html.create("DIV"),this.y.className=" webix_template",this.x.appendChild(this.y)):this.y.className+=" webix_template",this.attachEvent("onAfterLoad",this.gg),this.attachEvent("onAfterRender",this.hg)},setValues:function(t,e){this.data=e?webix.extend(this.data,t,!0):t,this.render()
},$skin:function(){this.fg.header.height=this.fg.section.height=webix.skin.$active.barHeight},fg:{header:{css:"webix_header"},section:{css:"webix_section",borderless:!0},clean:{css:"webix_clean",borderless:!0}},onClick_setter:function(t){return this.on_click=webix.extend(this.on_click||{},t,!0),this.Sc||webix.extend(this,webix.MouseEvents),t
},defaults:{template:webix.template.empty},gg:function(){this.ig=!1,this.jg(),this.resize()},jg:function(){this.ig||(this.ig=!0,this.render())},src_setter:function(t){return this.ig=!0,this.callEvent("onBeforeLoad",[]),webix.ajax(t,webix.bind(function(t){this.s.template=webix.template(t),this.gg(),this.callEvent("onAfterLoad",[])
},this)),t},hg:function(){this.s.autoheight&&(this.ac=null,this.resize()),this.s.scroll&&-1!=this.s.scroll.indexOf("x")&&(this.y.style.width=this.y.scrollWidth+"px")},content_setter:function(t){t&&(this.ig=!0,this.render=function(){},this.y.appendChild(webix.toNode(t)))},refresh:function(){this.render()
},setHTML:function(t){this.s.template=function(){return t},this.refresh()},setContent:function(t){this.y.innerHTML="",this.content_setter(t)},$setSize:function(t,e){if(webix.ui.view.prototype.$setSize.call(this,t,e)&&(this.jg(),this.s.autoheight)){var i=this.getTopParentView();clearTimeout(i.kg),i.kg=webix.delay(this.resize,this)
}},$getSize:function(t,e){return this.s.autoheight&&!this.s.type&&(this.s.height=this.lg()),webix.ui.view.prototype.$getSize.call(this,t,e)},lg:function(){var t;this.jg();webix.skin.$active.layoutPadding.space;return this.y.style.height="auto",t=this.y.scrollHeight,this.y.style.height="",t},If:!0},webix.Scrollable,webix.AtomDataLoader,webix.AtomRender,webix.EventSystem,webix.ui.view),webix.protoUI({name:"iframe",$init:function(t){this.y=this.w,this.w.innerHTML="<iframe style='width:100%; height:100%' frameborder='0' onload='var t= $$(\""+t.id+"\"); if (t) t.callEvent(\"onAfterLoad\",[]);' src='about:blank'></iframe>"
},load:function(t){this.src_setter(t)},src_setter:function(t){return this.getIframe().src=t,this.callEvent("onBeforeLoad",[]),t},getIframe:function(){return this.w.getElementsByTagName("iframe")[0]},getWindow:function(){return this.getIframe().contentWindow}},webix.ui.view,webix.EventSystem),webix.OverlayBox={showOverlay:function(t){this.mg?this.mg.innerHTML=t:(this.mg=webix.html.create("DIV",{"class":"webix_overlay"},t||""),webix.html.insertBefore(this.mg,this.x.firstChild,this.x),this.x.style.position="relative")
},hideOverlay:function(){this.mg&&(webix.html.remove(this.mg),this.mg=null)}},webix.protoUI({name:"scrollview",defaults:{scroll:"y",scrollSpeed:"0ms"},$init:function(){this.x.className+=" webix_scrollview"},body_setter:function(t){t.borderless=!0,this.gd=webix.ui.A(t),this.gd.Xb=this,this.y.appendChild(this.gd.x)
},getChildViews:function(){return[this.gd]},getBody:function(){return this.gd},resizeChildren:function(){this.ng=this.gd.$getSize(0,0),this.og()},og:function(){var t=(this.Mw||webix.ui.scrollSize,Math.max(this.bc,this.ng[0])),e=Math.max(this.dc,this.ng[2]);if(this.gd.$setSize(t,e),this.y.style.width=this.gd.bc+"px",this.y.style.height=this.gd.dc+"px",webix.env.touch){var i=this.getScrollState(),s=this.gd.dc-this.dc;
s<i.y&&this.scrollTo(null,s)}},$getSize:function(t,e){var i=this.ng=this.gd.$getSize(0,0),s=webix.ui.view.prototype.$getSize.call(this,t,e),n=this.Mw||webix.ui.scrollSize;return"x"==this.s.scroll?(s[2]=Math.max(s[2],i[2])+n,s[3]=Math.min(s[3],i[3])+n):"y"==this.s.scroll&&(s[0]=Math.max(s[0],i[0])+n,s[1]=Math.min(s[1],i[1])+n),s
},$setSize:function(t,e){var i=webix.ui.scrollSize;webix.ui.scrollSize=this.Mw||i,webix.ui.view.prototype.$setSize.call(this,t,e)&&this.og(),webix.ui.scrollSize=i},scroll_setter:function(t){var e=webix.env.$customScroll;return"string"==typeof t&&0===t.indexOf("native-")&&(this.Mw=17,t=t.replace("native-"),webix.env.$customScroll=!1),t=webix.Scrollable.scroll_setter.call(this,t),webix.env.$customScroll=e,t
},Qb:function(t){this.gd.destructor(),this.gd=t,this.gd.Xb=this,this.ed.appendChild(this.gd.x),this.resize()},showView:function(t){var e=webix.$$(t).$view.offsetTop-webix.$$(t).$view.parentNode.offsetTop;this.scrollTo(0,e)}},webix.Scrollable,webix.ui.view),webix.TreeRenderStack={$init:function(){},pg:function(t){var e=this.data.Me[t.id];
return this.callEvent("onItemRender",[t]),this.type.templateStart(t,this.type,e)+(t.$template?this.type["template"+t.$template](t,this.type,e):this.type.template(t,this.type,e))+this.type.templateEnd()},qg:function(t){return this.v.innerHTML=this.pg(t),this.v.firstChild},jb:function(t){var e="<div class='webix_tree_branch_"+t.$level+"'>"+this.pg(t);
return t.open&&(e+=this.rg(t.id)),e+="</div>"},rg:function(t){var e="",i=this.data.branch[t];if(i){e+="<div class='webix_tree_leaves'>";for(var s=i.length-1,n=0;s>=n;n++){var r=this.getItem(i[n]);this.type.sg[r.$level]=n==s,e+=this.jb(r)}e+="</div>"}return e},render:function(t,e,i){if(webix.TreeRenderStack.tg=this,this.isVisible(this.s.id)&&!this.$blockRender){if(t){var s,n=this.getItem(t);
if("add"!=i&&(s=this.getItemNode(t),!s))return;switch(i){case"branch":var r=s.parentNode,a=this.Ne(n);webix.html.insertBefore(a,r),webix.html.remove(r),this.t=null;break;case"paint":case"update":var a=this.t[t]=this.qg(n);webix.html.insertBefore(a,s),webix.html.remove(s);break;case"delete":webix.html.remove(s.parentNode);
break;case"add":var h;if(0==n.$parent?h=this.y.firstChild:(h=this.getItemNode(n.$parent),h&&(h=h.nextSibling)),h){var o=this.data.getNextSiblingId(t);o=this.getItemNode(o),o&&(o=o.parentNode);var a=this.Ne(n);this.t[t]=a.firstChild,webix.html.insertBefore(a,o,h)}break;default:return!1}this.callEvent("onPartialRender",[t,e,i])
}else this.callEvent("onBeforeRender",[this.data])&&(this.type.sg=[],this.y.innerHTML=this.rg(0),this.t=null,this.callEvent("onAfterRender",[]));return this.type.sg=0,webix.TreeRenderStack.tg=null,!0}},getItemNode:function(t){if(this.t)return this.t[t];this.t={};for(var e=this.y.getElementsByTagName("DIV"),i=0;i<e.length;i++){var s=e[i].getAttribute(this.ad);
s&&(this.t[s]=e[i])}return this.getItemNode(t)},vg:1},webix.SelectionModel={$init:function(){this.wg=webix.toArray(),this.data.attachEvent("onStoreUpdated",webix.bind(this.xg,this)),this.data.attachEvent("onStoreLoad",webix.bind(this.yg,this)),this.data.attachEvent("onAfterFilter",webix.bind(this.zg,this)),this.data.attachEvent("onIdChange",webix.bind(this.Ag,this)),this.$ready.push(this.uy)
},uy:function(){("multiselect"==this.s.select||this.s.multiselect)&&webix.event(this.$view,"mousedown",function(t){var e=(t||event).shiftKey;e&&(webix.vy=this,webix.html.addCss(this,"webix_noselect",1))})},Ag:function(t,e){for(var i=this.wg.length-1;i>=0;i--)this.wg[i]==t&&(this.wg[i]=e)},zg:function(){for(var t=this.wg.length-1;t>=0;t--)if(this.data.getIndexById(this.wg[t])<0){var e=this.wg[t];
this.removeCss(e,"webix_selected",!0),this.wg.splice(t,1),this.callEvent("onSelectChange",[e])}},xg:function(t,e,i){if("delete"==i)if(this.loadBranch)for(var s=this.wg.length-1;s>=0;s--)this.exists(this.wg[s])||this.wg.splice(s,1);else this.wg.remove(t);else t||this.data.count()||this.data.jf||(this.wg=webix.toArray())
},yg:function(){this.s.select&&this.data.each(function(t){t&&t.$selected&&this.select(t.id)},this)},Bg:function(t,e,i){return i||this.callEvent("onBeforeSelect",[t,e])?(e?this.addCss(t,"webix_selected",!0):this.removeCss(t,"webix_selected",!0),i?i.push(t):(e?this.wg.push(t):this.wg.remove(t),this.Cg(t)),!0):!1
},select:function(t,e){var i=arguments[2],s=arguments[3];if(!t)return this.selectAll();if(!webix.isArray(t))return s&&this.wg.length?this.selectAll(this.wg[this.wg.length-1],t):(i||e||1==this.wg.length&&this.wg[0]==t||(this.Dg=!0,this.unselectAll(),this.Dg=!1),this.isSelected(t)?void(i&&this.unselect(t)):void(this.Bg(t,!0)&&this.callEvent("onAfterSelect",[t])));
for(var n=0;n<t.length;n++)this.select(t[n],n?1:e,i,s)},unselect:function(t){return t?void(this.isSelected(t)&&this.Bg(t,!1)):this.unselectAll()},selectAll:function(t,e){var i,s=[];i=t||e?this.data.getRange(t||null,e||null):this.data.getRange(),i.each(function(t){this.data.getMark(t.id,"webix_selected")||(this.wg.push(t.id),this.Bg(t.id,!0,s))
},this),this.Cg(s)},unselectAll:function(){var t=[];this.wg.each(function(e){this.Bg(e,!1,t)},this),this.wg=webix.toArray(),this.Cg(t)},isSelected:function(t){return-1!=this.wg.find(t)},getSelectedId:function(t){switch(this.wg.length){case 0:return t?[]:"";case 1:return t?[this.wg[0]]:this.wg[0];default:return[].concat(this.wg)
}},getSelectedItem:function(t){var e=this.getSelectedId(!0);if(e.length>1||t){for(var i=e.length-1;i>=0;i--)e[i]=this.getItem(e[i]);return e}return e.length?this.getItem(e[0]):void 0},Eg:function(t){return t.length>100||t.length>this.data.count/2},Cg:function(t){if("object"!=typeof t&&(t=[t]),t.length){if(this.Eg(t))this.data.refresh();
else for(var e=0;e<t.length;e++)this.render(t[e],this.data.getItem(t[e]),"update");this.Dg||this.callEvent("onSelectChange",[t])}}},webix.ready(function(){webix.event(document.body,"mouseup",function(){webix.vy&&(webix.html.removeCss(webix.vy,"webix_noselect"),webix.vy=null)})}),webix.TreeDataMove={$init:function(){},copy:function(t,e,i,s){return s=s||{},s.copy=!0,this.move(t,e,i,s)
},Kd:function(t,e,i){if(e&&t){var s=this.getBranchIndex(t);return s+(i==this&&i.getBranchIndex(e)<s?0:1)}},Lt:function(t,e){var i=this.data.branch[t];if(i&&i.length)for(var s=0;s<i.length;s++){if(i[s]==e)return!0;if(this.Lt(i[s],e))return!0}return!1},move:function(t,e,i,s){s=s||{},e=e||0;var n=s.newId||t,r=s.parent||0;
if(i=i||this,i.data){if(!webix.isArray(t)){if(this!=i||s.copy){if(n=i.data.add(i.Jd(this.getItem(t),n),e,r||0),this.data.branch[t]&&i.getBranchIndex){var a=this.data.vf;this.data.vf=function(t){var e=webix.copy(t);return delete e.$parent,delete e.$level,delete e.$child,i.data.pull[e.id]&&(e.id=webix.uid()),e
};var h={data:this.serialize(t,!0),parent:n};this.data.vf=a,i.parse(h)}s.copy||this.data.remove(t)}else{if(t==r||this.Lt(t,r))return;var o=this.getItem(t),l=this.data.branch[r];l||(l=this.data.branch[r]=[]);var c=this.data.branch[o.$parent],u=webix.PowerArray.find.call(c,t);if(0>e&&(e=Math.max(l.length-1,0)),c===l&&e===u)return;
if(webix.PowerArray.removeAt.call(c,u),webix.PowerArray.insertAt.call(l,t,Math.min(l.length,e)),c=this.data.branch[o.$parent],o.$parent&&"0"!=o.$parent&&this.getItem(o.$parent).$count--,r&&"0"!=r){var d=i.getItem(r);d.$count++,this.Fg(o,d.$level+1)}else this.Fg(o,1);o.$parent=r,i.data.callEvent("onDataMove",[t,e,r])
}return this.refresh(),n}for(var f=0;f<t.length;f++){var b=this.move(t[f],e,i,s);e=i.Kd(b,t[f+1],this)}}},Fg:function(t,e){t.$level=e;var i=this.data.branch[t.id];if(i)for(var s=0;s<i.length;s++)this.Fg(this.getItem(i[s]),e+1)},Gg:function(t){t&&!t.header&&this.open(t)},$dropAllow:function(t){if(t.from!=t.to)return!0;
for(var e=0;e<t.source.length;e++)if(t.source==t.target||this.Lt(t.source,t.target))return!1;return!0},Jd:function(t,e){var i=webix.DataMove.Jd.call(this,t,e);return delete i.open,i}},webix.TreeDataLoader={$init:function(){this.data.attachEvent("onStoreUpdated",webix.bind(this.Hg,this)),this._e=this.Ig,this.loadNext=this.Jg,this.$ready.unshift(this.Hg)
},Ig:function(t,e,i){var s=this.data.url;this.load(s+(-1==s.indexOf("?")?"?":"&")+(this.count()?"continue=true&":"")+"parent="+encodeURIComponent(t),[this.af,i])},loadBranch:function(t,e,i){t=t||0,this.data.url=this.data.url||i,this.callEvent("onDataRequest",[t,e,this.data.url])&&this.data.url&&this.data.feed.call(this,t,0,e)
},Jg:function(){},Hg:function(t,e,i){i&&"add"!=i&&"delete"!=i&&"branch"!=i||this.data.Kg(this)}},webix.TreeStore={name:"TreeStore",$init:function(){this.Cf={showSubItems:!0},this.branch={0:[]},this.attachEvent("onParse",function(t,e){this.Lg(t.child);t.getInfo(e).S}),this.attachEvent("onClearAll",webix.bind(function(){this.Mg=null
},this))},filterMode_setter:function(t){return webix.extend(this.Cf,t,!0)},Af:function(t){if(this.Mg&&!t){this.branch=this.Mg,this.order=webix.toArray(webix.copy(this.branch[0]));for(var e in this.branch)"0"!=e&&(this.getItem(e).$count=this.branch[e].length);delete this.Mg}},Bf:function(t,e,i,s){i&&this.Mg||(this.Mg=this.branch,this.branch=webix.clone(this.branch)),this.branch[0]=this.Ng(t,e,this.branch[0],1,s||{})
},Ng:function(t,e,i,s,n){for(var r=[],a=n.level&&n.level!=s,h=0;h<i.length;h++){var o=i[h],l=this.getItem(o),c=!1,u=this.branch[o];if(a)c=!0;else if(t(this.getItem(o),e)){if(r.push(o),n.openParents!==!1)for(var d=this.getParentId(o);d&&"0"!=d;)this.getItem(d).open=1,d=this.getParentId(d);if(n.level||n.showSubItems)continue
}else c=!0;if((a||!n.level)&&u){var f=this.branch[o]=this.Ng(t,e,u,s+1,n);l.$count=f.length,c&&f.length&&r.push(o)}}return r},count:function(){if(this.order.length)return this.order.length;var t=0;return this.eachOpen(function(){t++}),t},changeId:function(t,e){if(this.branch[t]){for(var i=this.branch[e]=this.branch[t],s=0;s<i.length;s++)this.getItem(i[s]).$parent=e;
delete this.branch[t]}var n=this.getItem(t).$parent;if("0"!==n){var r=webix.PowerArray.find.call(this.branch[n],t);this.branch[n][r]=e}return webix.DataStore.prototype.changeId.call(this,t,e)},clearAll:function(){this.branch={0:[]},webix.DataStore.prototype.clearAll.call(this)},getPrevSiblingId:function(t){var e=this.branch[this.getItem(t).$parent],i=webix.PowerArray.find.call(e,t)-1;
return i>=0?e[i]:null},getNextSiblingId:function(t){var e=this.branch[this.getItem(t).$parent],i=webix.PowerArray.find.call(e,t)+1;return i<e.length?e[i]:null},getParentId:function(t){return this.getItem(t).$parent},getFirstChildId:function(t){var e=this.branch[t];return e&&e.length?e[0]:null},isBranch:function(t){return!!this.branch[t]
},getBranchIndex:function(t){var e=this.branch[this.pull[t].$parent];return webix.PowerArray.find.call(e,t)},Lg:function(t){this.Og="string"==typeof t?function(e){var i=e[t];return i&&delete e[t],i}:t},kf:function(t,e){for(var i=t.S||0,s=0;s<e.length;s++){var n=this.driver.getDetails(e[s]);this.qf&&this.qf(n);
var r=this.id(n);this.pull[r]=n,this.Pg(n,i)}i&&"0"!==i&&(this.pull[i].$count=e.length)},Pg:function(t,e,i){t.$parent=e||0,t.$level=i||("0"!=e?this.pull[e].$level+1:1),this.branch[t.$parent]||(this.branch[t.$parent]=[]),this.Mg&&(this.Mg[t.$parent]=this.branch[t.$parent]),this.branch[t.$parent].push(t.id);
var s=this.Og(t);if(t.webix_kids)return t.$count=-1;if(!s)return t.$count=0;webix.isArray(s)||(s=[s]),t.$count=s.length;for(var n=0;n<s.length;n++){var r=webix.DataDriver.json.getDetails(s[n]);this.qf&&this.qf(r),this.pull[this.id(r)]=r,this.Pg(r,t.id,t.$level+1)}},Kg:function(t){this.order=webix.toArray(),this.Qg(0,t)
},Qg:function(t,e){for(var i=this.branch[t],s=0;s<i.length;s++){var n=i[s];this.order.push(n),this.pull[n].open&&(-1==this.pull[n].$count?e.loadBranch(n):this.pull[n].$count&&this.Qg(n,e))}},provideApi:function(t,e){for(var i=["getPrevSiblingId","getNextSiblingId","getParentId","getFirstChildId","isBranch","getBranchIndex","filterMode_setter"],s=0;s<i.length;s++)t[i[s]]=this.Ef(this,i[s]);
t.getIndexById||webix.DataStore.prototype.provideApi.call(this,t,e)},getTopRange:function(){return webix.toArray([].concat(this.branch[0])).map(function(t){return this.getItem(t)},this)},eachChild:function(t,e,i,s){var n=this.branch;s&&this.Mg&&(n=this.Mg);var r=n[t];if(r)for(var a=0;a<r.length;a++)e.call(i||this,this.getItem(r[a]))
},each:function(t,e,i,s){this.eachChild(s||0,function(s){var n=this.branch;t.call(e||this,s),i&&this.Mg&&(n=this.Mg),n[s.id]&&this.each(t,e,i,s.id)},this,i)},eachOpen:function(t,e,i){this.eachChild(i||0,function(i){t.call(e||this,i),this.branch[i.id]&&i.open&&this.eachOpen(t,e,i.id)})},eachSubItem:function(t,e){var i=this.branch[t||0];
if(i)for(var s=0;s<i.length;s++){var n=i[s];this.branch[n]?(e.call(this,this.getItem(n),!0),this.eachSubItem(n,e)):e.call(this,this.getItem(n),!1)}},xf:function(t,e){var i=this.zf.yf(t);for(var s in this.branch){for(var n=this.branch[s],r=[],a=0;a<n.length;a++)r.push(this.pull[n[a]]);r.sort(i);for(var a=0;a<n.length;a++)r[a]=r[a].id;
this.branch[s]=r}return e},add:function(t,e,i){var s=!1;this.branch[i||0]=this.order=webix.toArray(this.branch[i||0]);var n=this.getItem(i||0);if(n&&(this.branch[n.id]||(s=!0),n.$count++),t.$count=0,t.$level=n?n.$level+1:1,t.$parent=n?n.id:0,this.Mg){var r=this.Mg[i||0];if(r||(r=this.Mg[i]=this.order),this.order!==r){var a=r.length;
!e&&this.branch[i||0].length&&(a=0),r=webix.toArray(r),r.insertAt(t.id,a)}}var h=webix.DataStore.prototype.add.call(this,t,e);return s&&this.refresh(i),h},Rg:function(t){var e=this.pull[t];if(this.branch[e.id]>0)for(var i=this.branch[t],s=0;s<i.length;s++)this.Rg(i[s],!0);delete this.branch[t],this.Mg&&delete this.Mg[t],delete this.pull[t],this.Me[t]&&delete this.Me[t]
},Wy:function(t,e,i){var s=t[e];1==s.length&&s[0]==i&&e?delete t[e]:webix.toArray(s).remove(i)},remove:function(t){var e=this.pull[t],i=e.$parent||0;if(this.callEvent("onBeforeDelete",[t])===!1)return!1;this.Rg(t),this.callEvent("onAfterDelete",[t]);var s=this.pull[i];this.Wy(this.branch,i,t),this.Mg&&this.Wy(this.Mg,i,t);
var n=0;s&&(s.$count--,s.$count<=0&&(s.$count=0,s.open=0,n=1)),this.callEvent("onStoreUpdated",[t,e,"delete"]),n&&this.refresh(s.id)},getBranch:function(t){var e=[],i=(this.Mg||this.branch)[t];if(i)for(var s=0;s<i.length;s++)e[s]=this.pull[i[s]];return e},serialize:function(t,e){var i=this.branch;e&&this.Mg&&(i=this.Mg);
for(var s=this.branch[t||0],n=[],r=0;r<s.length;r++){var a,h=this.pull[s[r]];if(this.vf){if(a=this.vf(h),a===!1)continue}else a=webix.copy(h);this.branch[h.id]&&(a.data=this.serialize(h.id,e)),n.push(a)}return n}},webix.TreeType={space:function(t){for(var e="",i=1;i<t.$level;i++)e+="<div class='webix_tree_none'></div>";
return e},icon:function(t){return t.$count?t.open?"<div class='webix_tree_open'></div>":"<div class='webix_tree_close'></div>":"<div class='webix_tree_none'></div>"},checkbox:function(t){return t.nocheckbox?"":"<input type='checkbox' class='webix_tree_checkbox' "+(t.checked?"checked":"")+(t.disabled?" disabled":"")+">"
},folder:function(t){return t.icon?"<div class='webix_tree_file webix_tree_"+t.icon+"'></div>":t.$count?t.open?"<div class='webix_tree_folder_open'></div>":"<div class='webix_tree_folder'></div>":"<div class='webix_tree_file'></div>"}},webix.TreeAPI={open:function(t){if(t){var e=this.getItem(t);e.$count&&!e.open&&this.callEvent("onBeforeOpen",[t])&&(e.open=!0,this.data.callEvent("onStoreUpdated",[t,0,"branch"]),this.callEvent("onAfterOpen",[t]))
}},close:function(t){if(t){var e=this.getItem(t);e.open&&this.callEvent("onBeforeClose",[t])&&(e.open=!1,this.data.callEvent("onStoreUpdated",[t,0,"branch"]),this.callEvent("onAfterClose",[t]))}},openAll:function(t){this.data.eachSubItem(t||0,function(t,e){e&&(t.open=!0)}),this.data.refresh()},closeAll:function(t){this.data.eachSubItem(t||0,function(t,e){e&&(t.open=!1)
}),this.data.refresh()},Sg:function(t,e,i){if(this.s.threeState)return this.Tg(t,null!==e?e:"");var s=this.getItem(t);s.checked=null!==e?e:!s.checked,this.callEvent("onItemCheck",[t,s.checked,i])},isBranchOpen:function(t){if("0"==t)return!0;var e=this.getItem(t);return e.open?this.isBranchOpen(e.$parent):!1
},getOpenItems:function(){var t=[];for(var e in this.data.branch)this.exists(e)&&this.getItem(e).open&&t.push(e);return t},getState:function(){return{open:this.getOpenItems(),select:this.getSelectedId(!0)}},Ug:function(t,e){var i=this.data.attachEvent("onStoreLoad",function(){t.setState.call(t,e),t.data.detachEvent(i),t=null
})},setState:function(t){if(t.open){this.closeAll();for(var e=t.open,i=0;i<e.length;i++){var s=this.getItem(e[i]);if(s&&s.$count&&(s.open=!0,-1==s.$count))return this.Ug(this,t),this.refresh(),0}this.refresh()}if(t.select&&this.select){var n=t.select;this.unselect();for(var i=0;i<n.length;i++)this.exists(n[i])&&this.select(n[i],!0)
}return 1}},webix.TreeClick={webix_tree_open:function(t,e){return this.close(e),!1},webix_tree_close:function(t,e){return this.open(e),!1},webix_tree_checkbox:function(t,e){return this.Sg(e,null,t),!1}},webix.TreeCollection=webix.proto({name:"TreeCollection",$init:function(){webix.extend(this.data,webix.TreeStore,!0),this.data.provideApi(this,!0)
}},webix.TreeDataLoader,webix.DataCollection),webix.DragOrder={Vg:!0,$drag:function(t,e){var i=webix.DragItem.$drag.call(this,t,e);if(i){var s=webix.DragControl.getContext();this.getBranchIndex&&(this.Wg=this.Xg?16*this.getItem(s.start).$level:0),s.fragile||this.addCss(s.start,"webix_transparent")}return i
},$dragPos:function(t,e,i){var s=webix.html.offset(this.$view),n=s.x+(this.Xg?+s.width-webix.ui.scrollSize-1:1);i.style.display="none";var r=document.elementFromPoint(n,t.y);if(r!=this.Yg){var a=webix.$$(r);if(a&&a==this){var h=this.locate(r);h&&this.Zg&&(h=this.Zg(h));var o=webix.DragControl.getContext().start;
if(h){if(h!=this.Yg){if(h!=o){var l,c;this.getBranchIndex?(l={parent:this.getParentId(h)},c=this.getBranchIndex(h)):(l={},c=this.getIndexById(h)),this.callEvent("onBeforeDropOrder",[o,c,e,l])&&(this.move(o,c,this,l),this.Yg=h)}webix.DragControl.Cd=this.w}}else if(h="$webix-last",this.Yg!=h){if(!this.callEvent("onBeforeDropOrder",[o,-1,e,{parent:0}]))return;
this.Yg=h}}}if(i.style.display="block",s.y+=this.$g,t.x=this.Wg||s.x,t.y=t.y-18,t.y<s.y)t.y=s.y;else{var u=s.y+this.$view.offsetHeight-60;t.y>u&&(t.y=u)}webix.DragControl.Ed=!0},$dragIn:function(){return!1},$drop:function(t,e,i){var s=webix.DragControl.getContext(),n=s.start;this.removeCss(n,"webix_transparent");
var r=this.getIndexById(n);this.callEvent("onAfterDropOrder",[n,r,i]),s.fragile&&this.refresh()}},webix.DragItem={_g:function(t,e,i){e||webix.DragControl.addDrop(t.w,t,!0),i||webix.DragControl.addDrag(t.w,t),this.attachEvent("onDragOut",function(t,e){this.$dragMark(t,e)})},drag_setter:function(t){return t&&("order"==t&&webix.extend(this,webix.DragOrder,!0),"inner"==t&&(this.ah=!0),this._g(this,"source"==t,"target"==t),delete this.drag_setter),t
},$dragIn:function(t,e,i){var s=this.locate(i)||null,n=webix.DragControl.Gd;if((this.ah||n.from.ah)&&n.from!==this)return!1;var r=webix.DragControl.getMaster(e),a=this.getItemNode(s,i)||this.y;return a==webix.DragControl.Dd?a:(n.target=s,n.to=r,this.bh&&(this.bh=window.clearTimeout(this.bh)),this.bh=webix.delay(this.ch,this,[webix.html.pos(i),s],250),this.$dropAllow(n,i)&&this.callEvent("onBeforeDragIn",[n,i])?(this.$dragMark(n,i),a):(n.to=n.target=null,null))
},$dropAllow:function(){return!0},Gg:function(){},ch:function(t,e){var i=1,s=0,n=this.s.dragscroll;"string"==typeof n&&(s=-1!=n.indexOf("x"),i=-1!=n.indexOf("y"));var r=this.Vf||this.$view,a=webix.html.offset(r),h=a.y,o=h+r.offsetHeight,l=a.x,c=l+r.offsetWidth,n=this.getScrollState(),u=!1,d=40,f=webix.DragControl.getContext();
this.Gg(e),i&&(t.y<h+d?(this.scrollTo(n.x,n.y-2*d),u=!0):t.y>o-d&&(this.scrollTo(n.x,n.y+2*d),u=!0)),s&&(t.x<l+d?(this.scrollTo(n.x-2*d,n.y),u=!0):t.x>c-d&&(this.scrollTo(n.x+2*d,n.y),u=!0)),u&&webix.DragControl.sd&&f&&f.to===this&&(this.bh=webix.delay(this.ch,this,[t],100))},$dragOut:function(t,e,i,s){var n=this.locate(s)||null,r=webix.DragControl.Gd;
return(r.target||"").toString()==(n||"").toString()?null:(this.bh&&(this.bh=window.clearTimeout(this.bh)),r.target=r.to=null,this.callEvent("onDragOut",[r,s]),null)},$drop:function(t,e,i){this.bh&&(this.bh=window.clearTimeout(this.bh));var s=webix.DragControl.Gd;s.to=this;var n=this.Zg?this.Zg(s.target):s.target;
this.getBranchIndex?n&&(s.parent=this.getParentId(n),s.index=this.getBranchIndex(n)):s.index=n?this.getIndexById(n):this.count(),this.$dragMark({},i),s.from&&s.from!=s.to&&s.from.callEvent&&s.from.callEvent("onBeforeDropOut",[s,i]),this.callEvent("onBeforeDrop",[s,i])&&(this.dh(s,i),this.callEvent("onAfterDrop",[s,i]))
},dh:function(t){if(t.from){var e={parent:t.parent,mode:t.pos};t.from.move(t.source,t.index,t.to,e)}},$drag:function(t,e){var i=this.locate(e);if(this.Zg&&(i=this.Zg(i,!0)),i){var s=[i];if(this.getSelectedId&&!this.Vg){var n=this.getSelectedId(!0,!0);if(n&&n.length>1&&-1!=webix.PowerArray.find.call(n,i)){for(var r={},s=[],a=0;a<n.length;a++)r[n[a]]=!0;
for(var a=0;a<this.data.order.length;a++){var h=this.data.order[a];r[h]&&s.push(h)}}}var o=webix.DragControl.Gd={source:s,start:i};if(o.fragile=this.addRowCss&&webix.env.touch&&(webix.env.isWebKit||webix.env.isFF),o.from=this,this.callEvent("onBeforeDrag",[o,e]))return webix.Touch&&(webix.Touch.km=null),o.html||this.$dragHTML(this.getItem(i),e)
}return null},$dragHTML:function(t){return this.jb(t)},$dragMark:function(t){var e=null;return t.target&&(e=this.Zg?this.Zg(t.target):t.target),this.eh&&this.eh!=e&&(t.fragile||this.removeCss(this.eh,"webix_drag_over"),this.eh=null),!this.eh&&e?(this.eh=e,t.fragile||this.addCss(e,"webix_drag_over"),e):t.to?!0:!1
}},webix.Group={$init:function(){webix.extend(this.data,webix.GroupStore),this.data.attachEvent("onClearAll",webix.bind(function(){this.data.nf=this.data.fh=null,this.gh=0},this))},group:function(t){this.data.ungroup(!0),this.data.group(t)},ungroup:function(t){this.data.ungroup(t)}},webix.GroupMethods={sum:function(t,e){e=e||this;
for(var i=0,s=0;s<e.length;s++)i+=1*t(e[s]);return i},min:function(t,e){e=e||this;for(var i=1/0,s=0;s<e.length;s++)1*t(e[s])<i&&(i=1*t(e[s]));return 1*i},max:function(t,e){e=e||this;for(var i=-1/0,s=0;s<e.length;s++)1*t(e[s])>i&&(i=1*t(e[s]));return 1*i},count:function(t,e){return e.length},any:function(t,e){return t(e[0])
},string:function(t){return t.$name}},webix.GroupStore={ungroup:function(t){return this.getBranchIndex?this.hh.apply(this,arguments):(this.nf&&(this.order=this.nf,this.pull=this.fh,this.fh=this.nf=null),void(t||this.callEvent("onStoreUpdated",[])))},mf:function(t){this.blockEvent(),this.group(t),this.unblockEvent()
},ih:function(t){if("function"==typeof t)return t;var e=function(e){return e[t]};return e.$name=t,e},group:function(t){if(this.getBranchIndex)return this.jh.apply(this,arguments);var e=this.ih(t.by);t.map[e]||(t.map[e]=[e,this.kh]);var i={},s=[];this.each(function(n){var r=e(n);i[r]||(s.push({id:r,$group:!0,$row:t.row}),i[r]=webix.toArray()),i[r].push(n)
});for(var n in t.map){var r=t.map[n][1]||"any",a=this.ih(t.map[n][0]);"function"!=typeof r&&(r=webix.GroupMethods[r]);for(var h=0;h<s.length;h++)s[h][n]=r.call(this,a,i[s[h].id])}this.nf=this.order,this.fh=this.pull,this.order=webix.toArray(),this.pull={};for(var h=0;h<s.length;h++){var o=this.id(s[h]);
this.pull[o]=s[h],this.order.push(o)}this.callEvent("onStoreUpdated",[])},jh:function(t,e){this.gh=(this.gh||0)+1;var i;"string"==typeof t?(i={by:this.ih(t),map:{}},i.map[t]=[t]):i="function"==typeof t?{by:t,map:{}}:t;var s;e?s=this.getItem(e).$level:(e=0,s=0);for(var n=this.branch[e],r=this.ih(i.by),a=[],h=[],o=0;o<n.length;o++){var l=this.getItem(n[o]),c=r(l),u=s+"$"+c,d=this.branch[u];
if(!d){var f=this.pull[u]={id:u,value:c,$group:!0,$row:i.row};h.push(f),d=this.branch[u]=[],d.lh=[],a.push(u)}d.push(l.id),d.lh.push(l)}this.branch[e]=a;for(var b in i.map){var x=i.map[b][1]||"any",p=this.ih(i.map[b][0]);"function"!=typeof x&&(x=webix.GroupMethods[x]);for(var o=0;o<h.length;o++)h[o][b]=x.call(this,p,this.branch[h[o].id].lh)
}for(var o=0;o<h.length;o++){var v=h[o];if(this.hasEvent("onGroupCreated")&&this.callEvent("onGroupCreated",[v.id,v.value,this.branch[v.id].lh]),i.footer){var w="footer$"+v.id,g=this.pull[w]={id:w,$footer:!0,value:v.value,$level:s,$count:0,$parent:v.id,$row:i.footer.row};for(var b in i.footer){var x=i.footer[b][1]||"any",p=this.ih(i.footer[b][0]);
"function"!=typeof x&&(x=webix.GroupMethods[x]),g[b]=x.call(this,p,this.branch[h[o].id].lh)}this.branch[v.id].push(g.id),this.callEvent("onGroupFooter",[g.id,g.value,this.branch[v.id].lh])}delete this.branch[v.id].lh}this.mh(a,e,s+1),this.callEvent("onStoreUpdated",[])},hh:function(t,e,i){if(i||this.gh){this.gh=Math.max(0,this.gh-1),e=e||0;
for(var s=[],n=this.branch[e],r=0;r<n.length;r++){var a=n[r],h=this.branch[a];h&&(s=s.concat(h)),delete this.pull[a],delete this.branch[a]}this.branch[e]=s;for(var r=s.length-1;r>=0;r--)this.pull[s[r]].$footer&&s.splice(r,1);this.mh(s,0,1),t||this.callEvent("onStoreUpdated",[])}},mh:function(t,e,i){e&&(this.getItem(e).$count=t.length);
for(var s=0;s<t.length;s++){var n=this.pull[t[s]];n.$level=i,n.$parent=e;var r=this.branch[n.id];r&&this.mh(r,n.id,i+1)}}},webix.clipbuffer={nh:null,oh:null,ph:0,init:function(){return null!==this.nh?this.nh:(webix.destructors.push(this),this.nh=document.createElement("textarea"),this.nh.className="webix_clipbuffer",this.nh.setAttribute("webixignore",1),document.body.appendChild(this.nh),webix.event(document.body,"keydown",webix.bind(function(t){var e=t.keyCode,i=!(!t.ctrlKey&&!t.metaKey);
86===e&&i&&webix.delay(this.rh,this,[],100)},this)),this.nh)},destructor:function(){this.nh=null},set:function(t){this.init(),this.nh.value=t,this.focus()},focus:function(){this.init(),this.nh.focus(),this.nh.select()},rh:function(){var t=this.nh.value,e=webix.UIManager.getFocus();e&&(e.callEvent("onPaste",[t]),this.nh.select())
}},webix.CopyPaste={clipboard_setter:function(t){return(t===!0||1===t)&&(t="modify"),this.attachEvent("onAfterSelect",function(t){var e=this.getItem(t),i=this.type.templateCopy(e);webix.clipbuffer.set(i,this),webix.clipbuffer.focus()}),this.attachEvent("onPaste",function(t){webix.isUndefined(this.rh[this.s.clipboard])||this.rh[this.s.clipboard].call(this,t)
}),this.attachEvent("onFocus",function(){webix.clipbuffer.focus()}),t},rh:{insert:function(t){this.add({value:t})},modify:function(t){for(var e=this.getSelectedId(!0),i=0;i<e.length;i++)this.getItem(e[i]).value=t,this.refresh(e[i])},custom:function(){}},templateCopy_setter:function(t){this.type.templateCopy=webix.template(t)
},type:{templateCopy:function(t){return this.template(t)}}},webix.KeysNavigation={sh:function(t){return function(e,i){var s=i.srcElement||i.target;if(!s.getAttribute("webixignore")){var n=s.tagName;if("INPUT"==n||"TEXTAREA"==n||"SELECT"==n)return!0}return e&&e.moveSelection&&e.config.navigation&&!e.Eb?e.moveSelection(t,i.shiftKey):!0
}},moveSelection:function(t){var e=this.getSelectedId(!0);if(1==e.length){if(e=e[0],"left"==t&&this.close)return this.close(e);if("right"==t&&this.open)return this.open(e);if("top"==t)e=this.getFirstId();else if("bottom"==t)e=this.getLastId();else if("up"==t||"left"==t||"pgup"==t){var i=this.getIndexById(e),s="pgup"==t?10:1;
e=this.getIdByIndex(Math.max(0,i-s))}else{if("down"!=t&&"right"!=t&&"pgdown"!=t)return;var i=this.getIndexById(e),s="pgdown"==t?10:1;e=this.getIdByIndex(Math.min(this.count()-1,i+s))}this.showItem(e),this.select(e)}return!1},navigation_setter:function(t){return t&&!webix.UIManager.th&&(webix.UIManager.th=!0,webix.UIManager.addHotKey("up",this.sh("up")),webix.UIManager.addHotKey("down",this.sh("down")),webix.UIManager.addHotKey("shift+up",this.sh("up")),webix.UIManager.addHotKey("shift+down",this.sh("down")),webix.UIManager.addHotKey("shift+right",this.sh("right")),webix.UIManager.addHotKey("shift+left",this.sh("left")),webix.UIManager.addHotKey("pageup",this.sh("pgup")),webix.UIManager.addHotKey("pagedown",this.sh("pgdown")),webix.UIManager.addHotKey("home",this.sh("top")),webix.UIManager.addHotKey("end",this.sh("bottom")),webix.UIManager.addHotKey("right",this.sh("right")),webix.UIManager.addHotKey("left",this.sh("left"))),t
}},webix.protoUI({name:"tree",defaults:{scroll:"a"},$init:function(){this.x.className+=" webix_tree",webix.extend(this.data,webix.TreeStore,!0),webix.extend(this.on_click,webix.TreeClick),this.attachEvent("onAfterRender",this.Jf),this.attachEvent("onPartialRender",this.Jf),this.data.provideApi(this,!0)
},ad:"webix_tm_id",on_context:{},on_dblclick:{webix_tree_checkbox:function(){return this.on_click.webix_tree_checkbox?this.on_click.webix_tree_checkbox.apply(this,arguments):void 0}},on_click:{webix_tree_item:function(t,e){if(this.s.activeTitle){var i=this.getItem(e);i.open?this.close(e):this.open(e)
}if(this.s.select)if("multiselect"==this.s.select||this.s.multiselect){if("level"==this.s.multiselect){var s=this.getSelectedId(!0)[0];if(s&&this.getParentId(e)!=this.getParentId(s))return}this.select(e,!1,t.ctrlKey||t.metaKey||"touch"==this.s.multiselect,t.shiftKey)}else this.select(e)}},rh:{insert:function(t){var e=this.getSelectedId()||"0";
this.add({value:t},null,e)},modify:function(t){for(var e=this.getSelectedId(!0),i=0;i<e.length;i++)this.getItem(e[i]).value=t,this.refresh(e[i])},custom:function(){}},Xg:!0,$dragHTML:function(t){return"<div class='borderless'>"+this.type.template(t,this.type)+"</div>"},type:webix.extend({template:function(t,e){var i=e["template"+t.level]||e.templateCommon;
return i.apply(this,arguments)},classname:function(t,e,i){var s="webix_tree_item";return t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css),i&&i.$css&&(s+=" "+i.$css),s},templateCommon:webix.template("{common.icon()} {common.folder()} <span>#value#</span>"),templateStart:webix.template('<div webix_tm_id="#id#" class="{common.classname()}">'),templateEnd:webix.template("</div>"),templateCopy:webix.template("#value#")},webix.TreeType)},webix.AutoTooltip,webix.Group,webix.TreeAPI,webix.DragItem,webix.TreeDataMove,webix.SelectionModel,webix.KeysNavigation,webix.MouseEvents,webix.Scrollable,webix.TreeDataLoader,webix.ui.proto,webix.TreeRenderStack,webix.CopyPaste,webix.EventSystem),webix.TreeStateCheckbox={uh:function(){if(this.vg){var t=this.render;
this.render=function(e,i){var s=t.apply(this,arguments);this.s.threeState&&s&&"checkbox"!=i&&this.vh.apply(this,arguments)},this.uh=function(){}}},threeState_setter:function(t){return t&&this.uh(),t},vh:function(t){var e,i,s,n,r;if(s=[],r=this,t&&!r.data.pull[t]&&(t=0),!t||r.data.pull[t].$count)for(i=this.wh(t),i.sort(function(t,e){return r.data.pull[e].$level-r.data.pull[t].$level
}),e=0;e<i.length;e++)e&&r.data.pull[i[e]].$parent==r.data.pull[i[e-1]].$parent||(s=s.concat(r.xh(i[e])));else s=s.concat(r.xh(t));for(n={},e=0;e<s.length;e++)n[s[e]]||(n[s[e]]=1,this.yh(s[e]));r=null},yh:function(t){var e,i;i=this.getItemNode(t),i&&(this.render(t,"checkbox","update"),this.getItem(t).indeterminate&&(i=this.getItemNode(t),e=i.getElementsByTagName("input")[0],e&&(e.indeterminate=this.getItem(t).indeterminate)))
},xh:function(t){var e,i,s,n,r,a,h,o;for(n=this.getParentId(t),a=this,r=[];n&&"0"!=n;){h=0,i=0,this.data.eachChild(n,function(t){t.indeterminate?h++:t.checked&&i++}),e=s=o=!1;var l=this.getItem(n);i==l.$count?e=!0:(i>0||h>0)&&(s=!0),(s||s!=l.indeterminate)&&(o=!0),l.indeterminate=s,l.checked!=e&&(o=!0),l.checked=e,o?(r.push(n),n=this.getParentId(n)):n=0
}return r},getChecked:function(){var t=[],e=this;return this.data.eachSubItem(0,function(i){e.isChecked(i.id)&&t.push(i.id)}),t},Tg:function(t,e){var i=this.getItem(t);if(i&&(""===e&&(e=!i.checked),i.checked!=e||i.indeterminate)){i.checked=e,this.zh(t);var s=this.xh(t);if(this.vg&&s.length<5)for(var n=0;n<s.length;n++)this.yh(s[n]);
else this.refresh();this.callEvent("onItemCheck",[t,e])}},checkItem:function(t){this.Sg(t,!0),this.updateItem(t)},uncheckItem:function(t){this.Sg(t,!1),this.updateItem(t)},Ah:function(t,e,i){var s=e?"checkItem":"uncheckItem";t?this[s](t):t=0,this.s.threeState?t||this.data.eachChild(0,function(t){this[s](t.id)
},this,i):this.data.each(function(t){this[s](t.id)},this,i,t)},checkAll:function(t,e){this.Ah(t,!0,e)},uncheckAll:function(t,e){this.Ah(t,!1,e)},zh:function(t){var e,i=this.getItem(t);i.indeterminate=!1,e=i.checked,this.data.eachSubItem(t,function(t){t.indeterminate=!1,t.checked=e}),this.vg&&this.isBranchOpen(i.$parent)&&this.render(t,0,"branch")
},isChecked:function(t){return this.getItem(t).checked},wh:function(t){var e=[];return this.data.eachSubItem(t,function(t,i){i||e.push(t.id)}),e}},webix.ui.tree&&webix.extend(webix.ui.tree,webix.TreeStateCheckbox,!0),webix.type(webix.ui.tree,{name:"lineTree",css:"webixLineTree",icon:function(t,e){for(var i="",s="",n=1;n<=t.$level;n++){if(n==t.$level)var s=t.$count?t.open?"webix_tree_open ":"webix_tree_close ":"webix_tree_none ";
var r=this.Bh(t,e,n);r&&(i+="<div class='"+s+" webix_tree_img webix_tree_"+r+"'></div>")}return i},Bh:function(t,e,i){var s=e.sg,n=webix.TreeRenderStack.tg;if(0===s&&n){var r=t.$level,a=t.id;for(s=[];r;){var h=n.getParentId(a),o=n.data.branch[h];o[o.length-1]==a&&(s[r]=!0),a=h,r--}e.sg=s}if(!s)return 0;
if(i==t.$level){var l=3;return t.$parent||0===t.$index&&(l=4),s[t.$level]&&(l=2),t.$count?t.open?"minus"+l:"plus"+l:"line"+l}return s[i]?"blank":"line1"}}),webix.NavigationButtons={Ch:function(){webix.html.remove(this.Dh),this.Dh=webix.html.create("DIV",{"class":"webix_nav_panel webix_nav_panel_"+this.s.navigation.type,style:"z-index:"+webix.ui.zIndex()+";"},""),this.x.appendChild(this.Dh),this.Eh(),this.Fh(),this.Gh()
},Gh:function(){var t=[];this.Dh&&(t[0]=webix.event(this.Dh,"click",webix.bind(function(t){for(var e=t.srcElement||t.target,i=!1;e!=this.Dh&&!i;){var s=e.getAttribute(this.Hh);s&&(i=!0,this.Ih(s)),e=e.parentNode}},this))),this.Jh&&(t[1]=webix.event(this.Jh,"click",webix.bind(function(){this.Kh(-1)},this))),this.Lh&&(t[1]=webix.event(this.Lh,"click",webix.bind(function(){this.Kh(1)
},this))),this.attachEvent("onDestruct",function(){for(var e=0;e<t.length;e++)this.detachEvent(t[e]);t=null})},Kh:function(t){if(this.q){var e=this.Mh+t;(e>=this.q.length||0>e)&&(e=0>e?this.q.length-1:0),this.setActiveIndex(e)}},Ih:function(t){this.q&&webix.$$(t).show()},Eh:function(){var t,e;if(e=this.s.navigation,e.items){this.Hh=e.linkAttr||"bind_id",this.Dh?this.Nh():this.Ch();
var i=this.q?this.q:this.data.order;if(i.length>1)for(var s=0;s<i.length;s++){t=webix.html.create("DIV",{"class":"webix_nav_item webix_nav_"+(s==this.Mh?"active":"inactive")},"<div></div>");var n=this.q?this.q[s].s.id:i[s];n&&t.setAttribute(this.Hh,n),this.Dh.appendChild(t)}}},Nh:function(){if(this.Dh)for(var t=this.Dh.childNodes,e=t.length-1;e>=0;e--)webix.html.remove(t[e])
},Fh:function(){var t;if(t=this.s.navigation,t.buttons){this.Jh&&webix.html.remove(this.Jh),this.Jh&&webix.html.remove(this.Lh);var e=webix.ui.zIndex();this.Jh=webix.html.create("DIV",{"class":"webix_nav_button_"+t.type+" webix_nav_button_prev ",style:"z-index:"+e+";"},'<div class="webix_nav_button_inner"></div>'),this.x.appendChild(this.Jh),this.Lh=webix.html.create("DIV",{"class":"webix_nav_button_"+t.type+" webix_nav_button_next ",style:"z-index:"+e+";"},'<div class="webix_nav_button_inner"></div>'),this.x.appendChild(this.Lh)
}}},webix.protoUI({name:"list",Oh:"webix_list",$init:function(t){webix.html.addCss(this.x,this.Oh+("x"==(t.layout||this.defaults.layout)?"-x":"")),this.data.provideApi(this,!0),this.Ph=webix.bind(this.Ph,this),this.data.attachEvent("onStoreLoad",this.Ph),this.data.attachEvent("onStoreUpdated",this.Ph),this.data.attachEvent("onSyncApply",this.Ph),this.attachEvent("onAfterRender",this.hg)
},$dragHTML:function(t){if("y"==this.s.layout&&"auto"==this.type.width){this.type.width=this.bc;var e=this.jb(t);return this.type.width="auto",e}return this.jb(t)},defaults:{select:!1,scroll:!0,layout:"y"},ad:"webix_l_id",on_click:{webix_list_item:function(t,e){this.s.select&&(this.Qh=!0,"multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,t.ctrlKey||t.metaKey||"touch"==this.s.multiselect,t.shiftKey):this.select(e),this.Qh=!1)
}},on_dblclick:{},getVisibleCount:function(){return Math.floor(this.dc/this.type.height)},Ph:function(){(this.s.autoheight||this.s.autowidth)&&this.resize()},Rh:function(t){var e=this.data.$pagesize||this.count();return this.Lf(t&&e>t),this.s.autoheight&&(t||1/0)>e&&(t=e),Math.max(this.type.height*t,this.s.minHeight||0)
},Sh:function(t){var e=this.data.$pagesize||this.count();return this.Lf(t&&e>t),this.s.autowidth&&(t||1/0)>e&&(t=e),this.type.width*t},hg:function(){"x"==this.s.layout&&(this.y.style.width="auto"!=this.type.width?this.type.width*this.count()+"px":"auto")},$getSize:function(t,e){return"y"==this.s.layout?("auto"!=this.type.width&&(this.s.width=this.type.width+(this.cc?webix.ui.scrollSize:0)),(this.s.yCount||this.s.autoheight)&&(this.s.height=this.Rh(this.s.yCount)||1)):("auto"!=this.type.height&&(this.s.height=this.type.height+(this.ec?webix.ui.scrollSize:0)),(this.s.xCount||this.s.autowidth)&&(this.s.width=this.Sh(this.s.xCount)||1)),webix.ui.view.prototype.$getSize.call(this,t,e)
},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)},type:{css:"",widthSize:function(t,e){return e.width+(e.width>-1?"px":"")},heightSize:function(t,e){return e.height+(e.height>-1?"px":"")},classname:function(t,e,i){var s="webix_list_item";return t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=" "+t.$css),i&&i.$css&&(s+=" "+i.$css),s
},template:function(t){return(t.icon?"<span class='webix_icon fa-"+t.icon+"'></span> ":"")+t.value+(t.badge?"<div class='webix_badge'>"+t.badge+"</div>":"")},width:"auto",templateStart:webix.template('<div webix_l_id="#id#" class="{common.classname()}" style="width:{common.widthSize()}; height:{common.heightSize()}; overflow:hidden;">'),templateEnd:webix.template("</div>")},$skin:function(){this.type.height=webix.skin.$active.listItemHeight
}},webix.KeysNavigation,webix.DataMove,webix.DragItem,webix.MouseEvents,webix.SelectionModel,webix.Scrollable,webix.ui.proto,webix.CopyPaste),webix.protoUI({name:"grouplist",defaults:{animate:{}},Oh:"webix_grouplist",$init:function(){webix.extend(this.data,webix.TreeStore,!0),this.data.count=function(){return this.order.length
},this.data.provideApi(this,!0),this.data.attachEvent("onClearAll",webix.bind(this.Th,this)),this.Th()},Th:function(){this.Uh=[],this.Vh=[]},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)&&(this.y.style.width=this.bc)},on_click:{webix_list_item:function(t,e){if(this.Wh)return!1;
for(var i=0;i<this.Vh.length;i++)if(this.Vh[i]==e){for(var s=i;s<this.Vh.length;s++)this.data.getItem(this.Vh[s]).$template="";return i?(this.Uh=this.data.branch[this.Vh[i-1]],this.Vh.splice(i)):(this.Uh=this.data.branch[0],this.Vh=[]),this.Xh=!1,this.render()}var n=this.getItem(e);return n.$count?(this.Xh=!0,this.Vh.push(e),n.$template="Back",this.Uh=this.data.branch[n.id],this.render()):void(this.s.select&&(this.Qh=!0,"multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,"touch"==this.s.multiselect||t.ctrlKey||t.metaKey,t.shiftKey):this.select(e),this.Qh=!1))
}},getOpenState:function(){return{parents:this.Vh,branch:this.Uh}},render:function(){var t,e;if(this.Vh=webix.copy(this.Vh),this.Uh=webix.copy(this.Uh),this.Vh.length)for(t=0;t<this.Vh.length;t++)this.data.branch[this.Vh[t]]||(this.Vh.splice(t,1),t--);if(e=this.Vh.length?this.Vh[this.Vh.length-1]:0,this.Uh=webix.copy(this.data.branch[e]),!this.Uh.length&&this.Vh.length&&(this.Uh=[e],this.Vh.pop()),this.Wh)return webix.delay(this.render,this,arguments,100);
for(t=0;t<this.Uh.length;t++)this.data.getItem(this.Uh[t]).$template="";if(this.Uh.length||(this.Uh=this.data.branch[0]),this.data.order=webix.toArray([].concat(this.Vh).concat(this.Uh)),this.callEvent("onBeforeRender",[this.data])){if(!this.Qh&&this.y.innerHTML&&webix.animate.isSupported()&&this.s.animate&&this.Yh!=this.Vh.length){if(this.callEvent("onBeforeRender",[this.data])){this.Zh||(this.Zh=[]);
var i=this.y.cloneNode(!1);i.innerHTML=this.data.getRange().map(this.jb,this).join("");var s=webix.extend({},this.s.animate);s.direction=this.Xh?"left":"right";var n=[webix.clone(s),webix.clone(s)];if(this.Xh)this.Zh.push(this.getScrollState()),webix.Touch&&webix.Touch.$active&&(n[0].y=0,n[1].y=-this.getScrollState().y);
else{var r=this.Zh.pop();webix.Touch&&webix.Touch.$active&&(n[0].y=-r.y,n[1].y=-this.getScrollState().y)}var a=webix.animate.formLine(i,this.y,s);webix.Touch&&webix.Touch.$active&&webix.Touch.Nf(i,0,this.Xh?0:n[0].y,"0ms"),s.master=this,s.callback=function(){this.y=i,this.Xh?webix.Touch&&webix.Touch.$active||this.scrollTo(0,0):webix.Touch&&webix.Touch.$active?webix.delay(function(){webix.Touch.Nf(i,0,n[0].y,"0ms")
},this):r&&this.scrollTo(0,r.y),webix.animate.breakLine(a),s.master=s.callback=null,this.t=null,this.Wh=!1,this.callEvent("onAfterRender",[])},this.Wh=!0,webix.animate(a,n)}}else webix.RenderStack.render.apply(this,arguments);this.Yh=this.Vh.length}},templateBack_setter:function(t){this.type.templateBack=webix.template(t)
},templateItem_setter:function(t){this.type.templateItem=webix.template(t)},templateGroup_setter:function(t){this.type.templateGroup=webix.template(t)},type:{template:function(t,e){return t.$count?e.templateGroup(t,e):e.templateItem(t,e)},css:"group",classname:function(t,e,i){return"webix_list_item webix_"+(t.$count?"group":"item")+(t.$template?"_back":"")+(i&&i.webix_selected?" webix_selected ":"")+(t.$css?t.$css:"")
},templateStart:webix.template('<div webix_l_id="#id#" class="{common.classname()}" style="width:{common.width}px; height:{common.height}px; padding:{common.padding}px; margin:{common.margin}px; overflow:hidden;">'),templateBack:webix.template("#value#"),templateItem:webix.template("#value#"),templateGroup:webix.template("#value#"),templateEnd:function(t){var e="";
return t.$count&&(e+="<div class='webix_arrow_icon'></div>"),e+="</div>"}},showItem:function(t){var e,i;for(t&&(e=this.getItem(t),i=e.$parent,e.$count&&(i=e.id)),this.Uh=this.data.branch[i||0],this.Vh=[];i;)this.getItem(i).$template="Back",this.Vh.unshift(i),i=this.getItem(i).$parent;this.Qh=!0,this.render(),this.Qh=!1,webix.RenderStack.showItem.call(this,t)
}},webix.Group,webix.ui.list),webix.type(webix.ui.grouplist,{}),webix.protoUI({name:"unitlist",ad:"webix_item_id",uniteBy_setter:webix.template,sort_setter:function(t){return"object"!=typeof t&&(t={}),this.E(t,{dir:"asc",as:"string"}),t},render:function(t,e,i){var s=this.s;if(this.isVisible(s.id)){if(!s.uniteBy)return!1;
if(t){var n=this.getItemNode(t);if(n&&"update"==i&&this.s.uniteBy.call(this,e)==this.getItem(t).$unitValue){var r=this.t[t]=this.Ne(e);return webix.html.insertBefore(r,n),void webix.html.remove(n)}}this.callEvent("onBeforeRender",[this.data])&&(this.units=null,this.$h(),this.units&&(this.y.innerHTML=this._h().map(this.jb,this).join(""),this.t=null),this.callEvent("onAfterRender",[]))
}},getUnits:function(){var t=[];if(this.units)for(var e in this.units)t.push(e);return t},getUnitList:function(t){return this.units?this.units[t]:null},jb:function(t){var e=this.data.Me[t.id];return this.callEvent("onItemRender",[t]),t.$unit?this.type.templateStartHeader(t,this.type)+this.type.templateHeader.call(this,t.$unit)+this.type.templateEnd(t,this.type):this.type.templateStart(t,this.type,e)+(t.$template?this.type["template"+t.$template]:this.type.template)(t,this.type)+this.type.templateEnd(t,this.type)
},_h:function(){var t,e,i,s;t=[];var n=this.data.$min||0,r=this.data.$max||1/0,a=0;for(i in this.units)for(t.push({$unit:i}),s=this.units[i],e=0;e<s.length;e++){if(a==n&&(t=[{$unit:i}]),t.push(this.getItem(s[e])),a==r)return webix.toArray(t);a++}return webix.toArray(t)},$h:function(){var t=this;this.units={},this.data.each(function(e){var i=t.s.uniteBy.call(this,e);
e.$unitValue=i,t.units[i]||(t.units[i]=[]),t.units[i].push(e.id)})},type:{headerHeight:20,templateHeader:function(t){return"<span class='webix_unit_header_inner'>"+t+"</span>"},templateStart:function(t,e,i){if(t.$unit)return e.templateStartHeader.apply(this,arguments);var s="webix_list_item webix_list_"+e.css+"_item"+(i&&i.webix_selected?" webix_selected":"")+e.classname(t,e,i),n="width:"+e.width+"px; height:"+e.height+"px; padding:"+e.padding+"px; margin:"+e.margin+"px; overflow:hidden;"+(e.layout&&"x"==e.layout?"float:left;":"");
return'<div webix_item_id="'+t.id+'" class="'+s+'" style="'+n+'">'},templateStartHeader:function(t,e){var i="webix_unit_header webix_unit_"+e.css+"_header"+(t.$selected?"_selected":""),s="width:"+e.width+"px; height:"+e.headerHeight+"px; overflow:hidden;";return'<div webix_unit_id="'+t.$unit+'" class="'+i+'" style="'+s+'">'
}},$skin:function(){this.type.headerHeight=webix.skin.$active.unitHeaderHeight||20}},webix.ui.list),webix.EditAbility={defaults:{editaction:"click"},$init:function(t){this.ai={},this.Eb=0,this.bi=0,this.w.style.position="relative",t&&(t.onDblClick=t.onDblClick||{}),this.attachEvent("onAfterRender",this.$s),this.s.editable&&this.ci()
},Ux:function(t){try{if("number"==typeof t.selectionStart)t.selectionStart=t.selectionEnd=t.value.length;else if("undefined"!=typeof t.createTextRange){var e=t.createTextRange();e.collapse(!1),e.select()}}catch(i){}},$s:function(){var t=this.getEditor();if(t&&t.$inline&&!t.getPopup){var e=this.mi(t);
if(e&&e!=t.node){var i=t.node.value;t.node=e,e.value=i,e.focus(),this.Ux(e)}else this.editStop()}},editable_setter:function(t){return t&&this.ci(),t},ci:function(){webix.attachEvent("onEditEnd",webix.bind(function(){this.Eb&&this.editStop()},this)),webix.attachEvent("onClick",webix.bind(function(t){this.Eb&&new Date-this.bi>200&&(this.di&&!this.di.popupType&&t&&this.di.node==t.target||this.editStop())
},this)),this.data.attachEvent&&this.data.attachEvent("onIdChange",webix.bind(function(t,e){this.ei(t,e)},this)),this.attachEvent("onItemClick",function(t){this.s.editable&&"click"==this.s.editaction&&this.edit(t)}),this.attachEvent("onItemDblClick",function(t){this.s.editable&&"dblclick"==this.s.editaction&&this.edit(t)
}),this.fi=webix.bind(function(){this.bi=new Date},this),this.ci=function(){},this.gi&&this.gi()},Vs:function(){webix.delay(function(){var t=this.getEditor();if(t&&t.config.liveEdit){var e={value:t.getValue(),old:t.value};if(e.value==e.old)return;t.value=e.value,this.ti(t,e.value),this.callEvent("onLiveEdit",[e,t])
}},this)},hi:function(t){var e=this.s.form;"string"!=typeof e&&(this.s.form=e=webix.ui(e).config.id);var e=webix.$$(e),i=e.setValues?e:e.getChildViews()[0];i.setValues(this.getItem(t.row||t)),e.config.master=this.config.id,e.show(this.getItemNode(t));var s=i.getChildViews()[0];s.focus()&&s.focus()},edit:function(t,e,i){if(this.callEvent("onBeforeEditStart",[t])){if(this.s.form)return this.hi(t);
var s=this.ii(t);if(s){if(this.getEditor(t))return;e||this.editStop(),this.bi=new Date;var n=webix.extend({},webix.editors[s]),r=this.ji(t,n,i);n.config.liveEdit&&(this.Ws=this.attachEvent("onKeyPress",this.Vs));var a=n.getPopup?n.getPopup(r).x:r;return a&&webix.event(a,"click",this.fi),r&&webix.event(r,"change",this.ki,{view:this,id:t}),i!==!1&&n.focus(),webix.UIManager.setFocus(this,!0),this.callEvent("onAfterEditStart",[t]),n
}return null}},getEditor:function(t){return t?this.ai[t]:this.di},ei:function(t,e){var i=this.ai[t];i&&(this.ai[e]=i,i.id=e,delete this.ai[t])},ki:function(){this.view.hasEvent("onEditorChange")&&this.view.callEvent("onEditorChange",[this.id,this.view.getEditorValue(this.id)])},li:function(){return this.s
},ji:function(t,e,i){var s=(e.config=this.li(t),e.render());e.$inline&&(s=this.mi(t)),e.node=s;var n=this.getItem(t),r=n[this.s.editValue||"value"];return webix.isUndefined(r)&&(r=""),e.setValue(r,n),e.value=r,this.ni(t,e),i!==!1&&this.showItem(t),e.$inline||this.oi(t,s,!0),e.afterRender&&e.afterRender(),s
},pi:function(t){return this.getItemNode(t)},mi:function(t){var e=this.pi(t);return e&&(e=e.getElementsByTagName("input")[0]||e),e},ii:function(){return this.s.editor},ni:function(t,e){e.id=t,this.ai[t]=this.di=e,this.Eb++},qi:function(t){this.di==t&&(this.di=0),t.destroy&&t.destroy(),delete t.popup,delete t.node,delete this.ai[t.id],this.Eb--
},focusEditor:function(){var t=this.getEditor.apply(this,arguments);t&&t.focus&&t.focus()},editCancel:function(){this.editStop(null,null,!0)},editStop:function(t){if(!this.Zx){this.Zx=1;var e=arguments[2],i=1;return t?i=this.ri(this.ai[t],e):this.si(function(t){i*=this.ri(t,e)}),this.Zx=0,i}},ug:function(t){var e=this.getItemNode(t);
return{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,parent:this.w}},oi:function(t,e,i){if(e.style){var s=this.ug(t);e.style.top=s.top+"px",e.style.left=s.left+"px",e.style.width=s.width-1+"px",e.style.height=s.height-1+"px",e.top=s.top,i&&s.parent.appendChild(e)}},si:function(t){for(var e in this.ai)t.call(this,this.ai[e])
},ri:function(t,e){if(t){var i={value:t.getValue(),old:t.value};if(this.callEvent("onBeforeEditStop",[i,t,e])){e||(i.value!=i.old||t.config.liveEdit)&&this.updateItem(this.ti(t,i.value)),t.$inline?t.node=null:webix.html.remove(t.node);var s=t.config.suggest;return s&&"string"==typeof s&&webix.$$(s).hide(),this.qi(t),this.Ws&&this.detachEvent(this.Ws),this.callEvent("onAfterEditStop",[i,t,e]),1
}return 0}},validateEditor:function(t){var e=!0;if(this.s.rules){var i=this.getEditor(t),s=i.column||this.s.editValue||"value",n=this.s.rules[s],r=this.s.rules.$all;if(n||r){var a=this.data.getItem(i.row||i.id),h=i.getValue(),o=i.getInputNode();n&&(e=n.call(this,h,a,s)),r&&(e=r.call(this,h,a,s)&&e),e?webix.html.removeCss(o,"webix_invalid"):webix.html.addCss(o,"webix_invalid"),webix.callEvent("onLiveValidation",[i,e,a,h])
}}return e},getEditorValue:function(t){var e;return e=0===arguments.length?this.di:this.getEditor(t),e?e.getValue():void 0},getEditState:function(){return this.di||!1},editNext:function(t,e){if(t=t!==!1,1==this.Eb||e){var i=this.ui(this.di||e,function(t){return this.ii(t)?!0:!1},t);if(this.editStop())return i&&(this.edit(i),this.vi(i)),!1
}},vi:function(){},ui:function(t,e,i){var s=this.getIndexById(t.id),n=this.data.order;if(i){for(var r=s+1;r<n.length;r++)if(e.call(this,n[r]))return n[r]}else for(var r=s-1;r>=0;r--)if(e.call(this,n[r]))return n[r];return null},ti:function(t,e){return this.getItem(t.id)[this.s.editValue||"value"]=e,t.id
}},function(){function t(t,i){var s=t.config.suggest;if(s){var n=t.config.suggest=e(s),r=webix.$$(n);r&&i&&r.linkInput(i)}}function e(t){if("string"==typeof t)return t;if(t.linkInput)return t.s.id;"object"==typeof t?(webix.isArray(t)&&(t={data:t}),t.view=t.view||"suggest"):t===!0&&(t={view:"suggest"});
var e=webix.ui(t);return e.config.id}webix.editors={text:{focus:function(){this.getInputNode(this.node).focus(),this.getInputNode(this.node).select()},getValue:function(){return this.getInputNode(this.node).value},setValue:function(e){var i=this.getInputNode(this.node);i.value=e,t(this,i)},getInputNode:function(){return this.node.firstChild
},render:function(){return webix.html.create("div",{"class":"webix_dt_editor"},"<input type='text'>")}},"inline-checkbox":{render:function(){return{}},getValue:function(){return this.node.checked},setValue:function(){},focus:function(){this.node.focus()},getInputNode:function(){},$inline:!0},"inline-text":{render:function(){return{}
},getValue:function(){return this.node.value},setValue:function(){},focus:function(){this.node.select(),this.node.focus()},getInputNode:function(){},$inline:!0},checkbox:{focus:function(){this.getInputNode().focus()},getValue:function(){return this.getInputNode().checked},setValue:function(t){this.getInputNode().checked=!!t
},getInputNode:function(){return this.node.firstChild.firstChild},render:function(){return webix.html.create("div",{"class":"webix_dt_editor"},"<div><input type='checkbox'></div>")}},select:{focus:function(){this.getInputNode().focus()},getValue:function(){return this.getInputNode().value},setValue:function(t){this.getInputNode().value=t
},getInputNode:function(){return this.node.firstChild},render:function(){var t="",e=this.config.options||this.config.collection;if(e.data&&e.data.each)e.data.each(function(e){t+="<option value='"+e.id+"'>"+e.value+"</option>"});else if(webix.isArray(e))for(var i=0;i<e.length;i++)t+="<option value='"+e[i]+"'>"+e[i]+"</option>";
else for(var s in e)t+="<option value='"+s+"'>"+e[s]+"</option>";return webix.html.create("div",{"class":"webix_dt_editor"},"<select>"+t+"</select>")}},popup:{focus:function(){this.getInputNode().focus()},destroy:function(){this.getPopup().hide()},getValue:function(){return this.getInputNode().getValue()||""
},setValue:function(t){this.getPopup().show(this.node),this.getInputNode().setValue(t)},getInputNode:function(){return this.getPopup().getChildViews()[0]},getPopup:function(){return this.config.popup||(this.config.popup=this.createPopup()),webix.$$(this.config.popup)},createPopup:function(){var t=this.config.popup||this.config.suggest;
if(t){var e;return"object"!=typeof t||t.name?e=webix.$$(t):(t.view=t.view||"suggest",e=webix.ui(t)),e.linkInput&&e.linkInput(document.body),e}var i=webix.editors.$popup[this.popupType];return"string"!=typeof i&&(i=webix.editors.$popup[this.popupType]=webix.ui(i),this.popupInit(i)),i.s.id},popupInit:function(){},popupType:"text",render:function(){return{}
},$inline:!0}},webix.editors.color=webix.extend({focus:function(){},popupType:"color",popupInit:function(t){t.getChildViews()[0].attachEvent("onSelect",function(t){webix.callEvent("onEditEnd",[t])})}},webix.editors.popup),webix.editors.date=webix.extend({focus:function(){},popupType:"date",setValue:function(t){this.wi=this.config.stringResult||t&&"string"==typeof t,webix.editors.popup.setValue.call(this,t)
},getValue:function(){return this.getInputNode().getValue(this.wi?webix.i18n.parseFormatStr:"")||""},popupInit:function(t){t.getChildViews()[0].attachEvent("onDateSelect",function(t){webix.callEvent("onEditEnd",[t])})}},webix.editors.popup),webix.editors.combo=webix.extend({xi:function(t){return this.config.popup?this.config.popup.config.id:t?e(t):this.rt(t)
},rt:function(){var t=webix.editors.combo;return t.st=t.st||this.xi(!0)},render:function(){var t=webix.html.create("div",{"class":"webix_dt_editor"},"<input type='text'>"),e=this.config.suggest=this.xi(this.config.suggest);return e&&(webix.$$(e).linkInput(t.firstChild,!0),webix.event(t.firstChild,"click",webix.bind(this.showPopup,this))),t
},getPopup:function(){return webix.$$(this.config.suggest)},showPopup:function(){var t=this.getPopup(),e=t.getList(),i=this.getInputNode(),s=this.getValue();t.show(i),s?e.exists(s)&&(e.select(s),e.showItem(s)):(e.unselect(),e.showItem(e.getFirstId())),t.ae=i},afterRender:function(){this.showPopup()},setValue:function(t){if(this.yi=t,this.config.suggest){var e=webix.$$(this.config.suggest),i=this.config.collection||this.config.options;
i&&e.getList().data.importData(i),this.zi=this.getInputNode(this.node).value=e.getItemText(t)}},getValue:function(){var t=this.getInputNode().value;return this.config.suggest?t==this.zi?this.yi:webix.$$(this.config.suggest).getSuggestion():t}},webix.editors.text),webix.editors.richselect=webix.extend({focus:function(){},getValue:function(){return this.getPopup().getValue()
},setValue:function(t){{var e=this.config.collection||this.config.options;this.getInputNode()}e&&this.getPopup().getList().data.importData(e),this.getPopup().show(this.node),this.getPopup().setValue(t)},getInputNode:function(){return this.getPopup().getList()},popupInit:function(t){t.linkInput(document.body)
},popupType:"richselect"},webix.editors.popup),webix.editors.password=webix.extend({render:function(){return webix.html.create("div",{"class":"webix_dt_editor"},"<input type='password'>")}},webix.editors.text),webix.editors.$popup={text:{view:"popup",width:250,height:150,body:{view:"textarea"}},color:{view:"popup",body:{view:"colorboard"}},date:{view:"popup",width:250,height:250,padding:0,body:{view:"calendar",icons:!0,borderless:!0}},richselect:{view:"suggest",body:{view:"list",select:!0}}}
}(),webix.VirtualRenderStack={$init:function(){this.t={},webix.event(this.x,"scroll",webix.bind(this.Ai,this)),webix.env.touch&&this.attachEvent("onAfterScroll",webix.bind(this.Ai,this)),this.Bi=[]},getItemNode:function(t){return this.t[t]},showItem:function(t){var e=this.Ci(),i=this.data.getIndexById(t),s=Math.floor(i/e.Di)*e.Ei,n=this.getScrollState();
(s<n.y||s+this.s.height>=n.y+this.dc)&&this.scrollTo(0,s)},render:function(t,e,i){if(this.isVisible(this.s.id)&&!this.$blockRender)if(t){var s=this.getItemNode(t);switch(i){case"update":if(!s)return;var n=this.t[t]=this.Ne(e);webix.html.insertBefore(n,s),webix.html.remove(s);break;default:this.Fi()}}else this.callEvent("onBeforeRender",[this.data])&&(this.t={},this.Ai(null,!0),this.Gi=!1,this.callEvent("onAfterRender",[]))
},Fi:function(){this.Gi||(this.Gi=!0,window.setTimeout(webix.bind(function(){this.render()},this),1))},Hi:function(t){var e=document.createElement("DIV");return e.style.cssText="height:"+t+"px; width:100%; overflow:hidden;",e},Ai:function(t,e){this.Bi=[];var i=this.Ci();(!this.y.firstChild||e)&&(this.y.innerHTML="",this.y.appendChild(this.Hi(i.Ii)),this.u=[this.y.firstChild]);
for(var s=i.R;s<=i.Ji;){for(;this.u[s]&&this.u[s].Ki&&s<=i.Ji;)s++;if(s>i.Ji)break;for(var n=s;!this.u[n];)n--;var r=this.u[n],a=s*i.Di+(this.data.$min||0);if(a>(this.data.$max||1/0))break;var h=Math.min(a+i.Di-1,this.data.$max||1/0),o=this.Hi(i.Ei),l=this.data.getIndexRange(a,h);if(!l.length)break;for(var c={$template:"Loading"},u=0;u<l.length;u++)l[u]||this.Bi.push(a+u),l[u]=this.jb(l[u]||c);
o.innerHTML=l.join("");for(var u=0;u<l.length;u++)this.t[this.data.getIdByIndex(a+u)]=o.childNodes[u];var d=parseInt(r.style.height,10),f=(s-n)*i.Ei,b=d-f-i.Ei;if(webix.html.insertBefore(o,f?r.nextSibling:r,this.y),this.u[s]=o,o.Ki=!0,0>=f&&b>0)r.style.height=b+"px",this.u[s+1]=r;else if(0>f?webix.html.remove(r):r.style.height=f+"px",b>0){var x=this.u[s+1]=this.Hi(b);
webix.html.insertBefore(x,o.nextSibling,this.y)}s++}if(this.Bi.length){var p=this.Bi[0],v=this.Bi.pop()+1;if(v>p){var w=v-p;if(this.cf(w,p))return;w=Math.max(w,this.s.datafetch||this.s.loadahead||0),this.loadNext(w,p)}}},Ci:function(){var t=this.getScrollState(),e=t.y,i=this.bc,s=this.dc,n=this.type,r=Math.floor(i/n.width)||1,a=Math.floor(e/n.height),h=Math.ceil((s+e)/n.height)-1,o=this.data.$max?this.data.$max-this.data.$min:this.data.count(),l=Math.ceil(o/r)*n.height;
return{R:a,Ji:h,Li:e,Ii:l,Ei:n.height,Di:r}},ug:function(t){var e=this.getItemNode(t);return e||(this.showItem(t),this.Ai(),e=this.getItemNode(t)),{left:e.offsetLeft,top:e.offsetTop,height:e.offsetHeight,width:e.offsetWidth,parent:this.w}}},webix.protoUI({name:"dataview",$init:function(t){t.sizeToContent&&this.$ready.unshift(this.Mi);
var e=t.prerender||this.defaults.prerender;(e===!1||e!==!0&&"auto"!==t.height&&!t.autoheight)&&webix.extend(this,webix.VirtualRenderStack,!0),t.autoheight&&(t.scroll=!1),this.w.className+=" webix_dataview"},Mi:function(){var t=webix.html.create("DIV",0,this.type.template({}));t.style.position="absolute",document.body.appendChild(t),this.type.width=t.offsetWidth,this.type.height=t.offsetHeight,webix.html.remove(t)
},defaults:{scroll:!0,datafetch:50},ad:"webix_f_id",on_click:{webix_dataview_item:function(t,e){this.s.select&&("multiselect"==this.s.select||this.s.multiselect?this.select(e,!1,"touch"==this.s.multiselect||t.ctrlKey||t.metaKey,t.shiftKey):this.select(e))}},on_dblclick:{},on_mouse_move:{},type:{template:webix.template("#value#"),templateLoading:webix.template("Loading..."),width:160,height:50,classname:function(t,e,i){var s="webix_dataview_item ";
return e.css&&(s+=e.css+" "),t.$css&&("object"==typeof t.$css&&(t.$css=webix.html.createCss(t.$css)),s+=t.$css+" "),i&&i.$css&&(s+=i.$css+" "),s},templateStart:webix.template('<div webix_f_id="#id#" class="{common.classname()}" style="width:{common.width}px; height:{common.height}px; float:left; overflow:hidden;">'),templateEnd:webix.template("</div>")},Ni:function(t){return this.s.height=this.type.height*Math.ceil(this.data.count()/Math.floor(t/this.type.width))
},autoheight_setter:function(t){return t&&(this.data.attachEvent("onStoreLoad",webix.bind(this.resize,this)),this.w.style.overflowY="hidden"),t},$getSize:function(t,e){this.s.xCount>0&&"auto"!=this.type.width&&!this.Nw&&(this.s.width=this.type.width*this.s.xCount+(this.cc?webix.ui.scrollSize:0)),this.s.yCount&&"auto"!=this.type.height&&(this.s.height=this.type.height*this.s.yCount);
var i=this.s.width||this.bc;return this.s.autoheight&&i&&(this.Ni(i),this.scroll_setter(!1)),webix.ui.view.prototype.$getSize.call(this,t,e)},$setSize:function(t,e){if(webix.ui.view.prototype.$setSize.call(this,t,e)){if(this.s.autoheight&&this.Ni()!=this.dc)return webix.delay(this.resize,this);var i=!1;
this.s.yCount&&"auto"==this.type.height&&(this.type.height=Math.floor(this.dc/this.s.yCount),i=!0),this.s.xCount&&("auto"==this.type.width||this.Nw)&&(this.Nw=!0,this.type.width=Math.floor(this.bc/this.s.xCount),i=!0),(i||this.Ai)&&this.render()}}},webix.DataMove,webix.DragItem,webix.MouseEvents,webix.KeysNavigation,webix.SelectionModel,webix.Scrollable,webix.ui.proto),webix.DataDriver.htmltable={toObject:function(t){t=webix.toNode(t);
var e=t.rows;return webix.html.remove(t),e},getRecords:function(t){for(var e=[],i=t[0]&&t[0].Oi?1:0;i<t.length;i++)e.push(t[i]);return e},getDetails:function(t){var e=t.getElementsByTagName("td");t={};for(var i=0;i<e.length;i++)t["data"+i]=e[i].innerHTML;return t},getInfo:function(){return{Q:0,R:0}},getOptions:function(){},getConfig:function(t){var e=[],i=t[0].getElementsByTagName("th");
i.length&&(t[0].Oi=!0);for(var s=0;s<i.length;s++){var n={id:"data"+s,header:this.Pi(i[s].innerHTML)},r=this.Qi(i[s]);n=webix.extend(n,r),e.push(n)}return e},Pi:function(t){var e=t.indexOf("json://");return-1!=e&&(t=JSON.parse(t.substr(e+7))),t},Qi:function(t){for(var e=t.attributes,i={},s=0;s<e.length;s++)i[e[s].nodeName]=this.Pi(e[s].nodeValue);
return i.width=parseInt(i.width,10),i}},webix.protoUI({name:"vscroll",defaults:{scroll:"x",scrollStep:40,scrollPos:0,scrollSize:18,scrollVisible:1,zoom:1},$init:function(t){var e=t.scroll||"x",i=this.x=webix.toNode(t.container);i.className+=" webix_vscroll_"+e,i.innerHTML="<div class='webix_vscroll_body'></div>",webix.event(i,"scroll",this.Ri,this),this.Si=0,this.Wi=0
},Ti:function(t){return t>15e5?(this.s.zoom=Math.floor(t/15e5)+1,this.Ui=t-this.Si,t=Math.floor(t/this.s.zoom)+this.Si):(this.s.zoom=1,this.Ui=1/0),t},scrollWidth_setter:function(t){return t=this.Ti(t),this.x.firstChild.style.width=t+"px",t},scrollHeight_setter:function(t){return t=this.Ti(t),this.x.firstChild.style.height=t+"px",t
},sizeTo:function(t,e,i){t=t-(e||0)-(i||0);var s=this.s.scrollSize;webix.env.isIE&&s&&(s+=1),s||!this.s.scrollVisible||webix.env.$customScroll||(this.x.style.pointerEvents="none",s=14),s?(e&&(this.x.style.marginTop=e+"px"),this.x.style["x"==this.s.scroll?"width":"height"]=Math.max(0,t)+"px",this.x.style["x"==this.s.scroll?"height":"width"]=s+"px"):this.x.style.display="none",this.Si=t
},getScroll:function(){return this.s.scrollPos*this.s.zoom},getSize:function(){return(this.s.scrollWidth||this.s.scrollHeight)*this.s.zoom},scrollTo:function(t){0>t&&(t=0);var e=this.s;t=Math.min(((e.scrollWidth||e.scrollHeight)-this.Si)*e.zoom,t),0>t&&(t=0);var i=t/e.zoom;return this.Wi!=i?(this.x["x"==e.scroll?"scrollLeft":"scrollTop"]=i,this.Vi(i),!0):void 0
},Ri:function(){var t=this.x["x"==this.s.scroll?"scrollLeft":"scrollTop"];t!=this.Wi&&this.Vi(t)},Vi:function(t){this.Wi=t,this.s.scrollPos=Math.min(this.Ui,t*this.s.zoom)||0,this.callEvent("onScroll",[this.s.scrollPos])},activeArea:function(t,e){this.Xi=e,webix.event(t,"mousewheel",this.Yi,this),webix.event(t,"DOMMouseScroll",this.Yi,this)
},Yi:function(t){var e=0;return t.wheelDeltaX&&Math.abs(t.wheelDeltaX)>Math.abs(t.wheelDeltaY)?this.Xi&&(e=t.wheelDeltaX/-40):this.Xi||(e=webix.isUndefined(t.wheelDelta)?t.detail:t.wheelDelta/-40),e&&this.scrollTo(this.s.scrollPos+e*this.s.scrollStep)?webix.html.preventEvent(t):void 0}},webix.EventSystem,webix.Settings),webix.Number={format:function(t,e){if(""===t||"undefined"==typeof t)return t;
e=e||webix.i18n,t=parseFloat(t);var i=0>t?"-":"";t=Math.abs(t);var s=t.toFixed(e.decimalSize).toString();s=s.split(".");var n="";if(e.groupSize){var r=e.groupSize,a=s[0].length;do{a-=r;var h=a>0?s[0].substr(a,r):s[0].substr(0,r+a);n=h+(n?e.groupDelimiter+n:"")}while(a>0)}else n=s[0];return e.decimalSize?i+n+e.decimalDelimiter+s[1]:i+n
},numToStr:function(t){return function(e){return webix.Number.format(e,t)}}},webix.Date={startOnMonday:!1,toFixed:function(t){return 10>t?"0"+t:t},weekStart:function(t){t=this.copy(t);var e=t.getDay();return this.startOnMonday&&(0===e?e=6:e--),this.datePart(this.add(t,-1*e,"day"))},monthStart:function(t){return t=this.copy(t),t.setDate(1),this.datePart(t)
},yearStart:function(t){return t=this.copy(t),t.setMonth(0),this.monthStart(t)},dayStart:function(t){return this.datePart(t,!0)},dateToStr:function(t,e){return"function"==typeof t?t:webix.env.strict?function(e){var i="",s=0;return t.replace(/%[a-zA-Z]/g,function(n,r){i+=t.slice(s,r);var a=function(t){return"%d"==n?webix.Date.toFixed(t.getDate()):"%m"==n?webix.Date.toFixed(t.getMonth()+1):"%j"==n?t.getDate():"%n"==n?t.getMonth()+1:"%y"==n?webix.Date.toFixed(t.getFullYear()%100):"%Y"==n?t.getFullYear():"%D"==n?webix.i18n.calendar.dayShort[t.getDay()]:"%l"==n?webix.i18n.calendar.dayFull[t.getDay()]:"%M"==n?webix.i18n.calendar.monthShort[t.getMonth()]:"%F"==n?webix.i18n.calendar.monthFull[t.getMonth()]:"%h"==n?webix.Date.toFixed((t.getHours()+11)%12+1):"%g"==n?(t.getHours()+11)%12+1:"%G"==n?t.getHours():"%H"==n?webix.Date.toFixed(t.getHours()):"%i"==n?webix.Date.toFixed(t.getMinutes()):"%a"==n?t.getHours()>11?"pm":"am":"%A"==n?t.getHours()>11?"PM":"AM":"%s"==n?webix.Date.toFixed(t.getSeconds()):"%W"==n?webix.Date.toFixed(webix.Date.getISOWeek(t)):n
};i+=a(e),s=r+2}),i+=t.slice(s,t.length)}:(t=t.replace(/%[a-zA-Z]/g,function(t){switch(t){case"%d":return'"+webix.Date.toFixed(date.getDate())+"';case"%m":return'"+webix.Date.toFixed((date.getMonth()+1))+"';case"%j":return'"+date.getDate()+"';case"%n":return'"+(date.getMonth()+1)+"';case"%y":return'"+webix.Date.toFixed(date.getFullYear()%100)+"';
case"%Y":return'"+date.getFullYear()+"';case"%D":return'"+webix.i18n.calendar.dayShort[date.getDay()]+"';case"%l":return'"+webix.i18n.calendar.dayFull[date.getDay()]+"';case"%M":return'"+webix.i18n.calendar.monthShort[date.getMonth()]+"';case"%F":return'"+webix.i18n.calendar.monthFull[date.getMonth()]+"';
case"%h":return'"+webix.Date.toFixed((date.getHours()+11)%12+1)+"';case"%g":return'"+((date.getHours()+11)%12+1)+"';case"%G":return'"+date.getHours()+"';case"%H":return'"+webix.Date.toFixed(date.getHours())+"';case"%i":return'"+webix.Date.toFixed(date.getMinutes())+"';case"%a":return'"+(date.getHours()>11?"pm":"am")+"';
case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+webix.Date.toFixed(date.getSeconds())+"';case"%W":return'"+webix.Date.toFixed(webix.Date.getISOWeek(date))+"';default:return t}}),e===!0&&(t=t.replace(/date\.get/g,"date.getUTC")),new Function("date","if (!date) return ''; if (!date.getMonth) date=webix.i18n.parseFormatDate(date);  return \""+t+'";'))
},strToDate:function(t,e){if("function"==typeof t)return t;var i,s,n,r=t.match(/%[a-zA-Z]/g),a="var temp=date.split(/[^0-9a-zA-Z]+/g);";if(!webix.i18n.calendar.monthShort_hash){for(n=webix.i18n.calendar.monthShort,s=webix.i18n.calendar.monthShort_hash={},i=0;i<n.length;i++)s[n[i]]=i;for(n=webix.i18n.calendar.monthFull,s=webix.i18n.calendar.monthFull_hash={},i=0;i<n.length;i++)s[n[i]]=i
}if(webix.env.strict)return function(t){if(!t)return"";if("object"==typeof t)return t;var s=t.split(/[^0-9a-zA-Z]+/g),n=[0,0,1,0,0,0];for(i=0;i<r.length;i++){var a=r[i];"%y"==a?n[0]=1*s[i]+(s[i]>50?1900:2e3):"%Y"==a?n[0]=s[i]||0:"%n"==a||"%m"==a?n[1]=(s[i]||1)-1:"%M"==a?n[1]=webix.i18n.calendar.monthShort_hash[s[i]]||0:"%F"==a?n[1]=webix.i18n.calendar.monthFull_hash[s[i]]||0:"%j"==a||"%d"==a?n[2]=s[i]||1:"%g"==a||"%G"==a||"%h"==a||"%H"==a?n[3]=s[i]||0:"%a"==a||"%A"==a?n[3]=n[3]%12+("am"==(s[i]||"").toLowerCase()?0:12):"%i"==a?n[4]=s[i]||0:"%s"==a&&(n[5]=s[i]||0)
}return e?new Date(Date.UTC(n[0],n[1],n[2],n[3],n[4],n[5])):new Date(n[0],n[1],n[2],n[3],n[4],n[5])};for(i=0;i<r.length;i++)switch(r[i]){case"%j":case"%d":a+="set[2]=temp["+i+"]||1;";break;case"%n":case"%m":a+="set[1]=(temp["+i+"]||1)-1;";break;case"%y":a+="set[0]=temp["+i+"]*1+(temp["+i+"]>50?1900:2000);";
break;case"%g":case"%G":case"%h":case"%H":a+="set[3]=temp["+i+"]||0;";break;case"%i":a+="set[4]=temp["+i+"]||0;";break;case"%Y":a+="set[0]=temp["+i+"]||0;";break;case"%a":case"%A":a+="set[3]=set[3]%12+((temp["+i+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":a+="set[5]=temp["+i+"]||0;";break;case"%M":a+="set[1]=webix.i18n.calendar.monthShort_hash[temp["+i+"]]||0;";
break;case"%F":a+="set[1]=webix.i18n.calendar.monthFull_hash[temp["+i+"]]||0;"}var h="set[0],set[1],set[2],set[3],set[4],set[5]";return e&&(h=" Date.UTC("+h+")"),new Function("date","if (!date) return ''; if (typeof date == 'object') return date; var set=[0,0,1,0,0,0]; "+a+" return new Date("+h+");")
},getISOWeek:function(t){if(!t)return!1;var e=t.getDay();0===e&&(e=7);var i=new Date(t.valueOf());i.setDate(t.getDate()+(4-e));var s=i.getFullYear(),n=Math.floor((i.getTime()-new Date(s,0,1).getTime())/864e5),r=1+Math.floor(n/7);return r},getUTCISOWeek:function(t){return this.getISOWeek(t)},Jv:function(t,e,i,s){if(i){var n=s(t,e);
if(n)for(var r=i>0?1:-1;n;)t.setHours(t.getHours()+r),n=s(t,e),r+=i>0?1:-1}},add:function(t,e,i,s){s&&(t=this.copy(t));var n=webix.Date.copy(t);switch(i){case"day":t.setDate(t.getDate()+e),this.Jv(t,n,e,function(t,e){return webix.Date.datePart(e,!0)==webix.Date.datePart(t,!0)});break;case"week":t.setDate(t.getDate()+7*e),this.Jv(t,n,7*e,function(t,e){return webix.Date.datePart(e,!0)==webix.Date.datePart(t,!0)
});break;case"month":t.setMonth(t.getMonth()+e),this.Jv(t,n,e,function(t,e){return e.getMonth()==t.getMonth()&&e.getYear()==t.getYear()});break;case"year":t.setYear(t.getFullYear()+e),this.Jv(t,n,e,function(t,e){return e.getFullYear()==t.getFullYear()});break;case"hour":t.setHours(t.getHours()+e),this.Jv(t,n,e,function(t,e){return e.getHours()==t.getHours()&&webix.Date.datePart(e,!0)==webix.Date.datePart(t,!0)
});break;case"minute":t.setMinutes(t.getMinutes()+e);break;default:webix.Date.add[i](t,e,i)}return t},datePart:function(t,e){e&&(t=this.copy(t));var i=this.copy(t);return i.setHours(0),t.setHours(i.getDate()!=t.getDate()?1:0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t},timePart:function(t,e){return e&&(t=this.copy(t)),(t.valueOf()/1e3-60*t.getTimezoneOffset())%86400
},copy:function(t){return new Date(t.valueOf())},equal:function(t,e){return t&&e?t.valueOf()===e.valueOf():!1},isHoliday:function(t){return t=t.getDay(),0===t||6==t?"webix_cal_event":void 0}},webix.i18n={Zi:["fullDateFormat","timeFormat","dateFormat","longDateFormat","parseFormat","parseTimeFormat"],parseFormat:"%Y-%m-%d %H:%i",parseTimeFormat:"%H:%i",numberFormat:webix.Number.format,priceFormat:function(t){return webix.i18n.$i(webix.i18n.numberFormat(t,webix.i18n._i))
},setLocale:function(t){var e=function(t,i){for(var s in i)"object"!=typeof i[s]||webix.isArray(i[s])?t[s]=i[s]:(t[s]||(t[s]={}),e(t[s],i[s]))};"string"==typeof t&&(t=this.locales[t]),t&&e(this,t);for(var i=webix.i18n.Zi,s=0;s<i.length;s++){var n=i[s],r=webix.i18n[n+"UTC"];webix.i18n[n+"Str"]=webix.Date.dateToStr(webix.i18n[n],r),webix.i18n[n+"Date"]=webix.Date.strToDate(webix.i18n[n],r)
}this.$i=webix.template(this.price),this._i=this.priceSettings||this,this.intFormat=webix.Number.numToStr({groupSize:this.groupSize,groupDelimiter:this.groupDelimiter,decimalSize:0})}},webix.i18n.locales={},webix.i18n.locales["en-US"]={groupDelimiter:",",groupSize:3,decimalDelimiter:".",decimalSize:2,dateFormat:"%m/%d/%Y",timeFormat:"%h:%i %A",longDateFormat:"%d %F %Y",fullDateFormat:"%m/%d/%Y %h:%i %A",price:"${obj}",priceSettings:{groupDelimiter:",",groupSize:3,decimalDelimiter:".",decimalSize:2},fileSize:["b","Kb","Mb","Gb","Tb","Pb","Eb"],calendar:{monthFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],hours:"Hours",minutes:"Minutes",done:"Done",clear:"Clear",today:"Today"},controls:{select:"Select"}},webix.i18n.setLocale("en-US"),webix.MapCollection={zj:function(t){for(var e=[],i=0;i<t.length;i++){var s=t[i].map,n=t[i].id;
if(n||(n=t[i].id="i"+webix.uid(),t[i].header||(t[i].header="")),s){var r="",a="";0===s.indexOf("(date)")?(r="webix.i18n.parseFormatDate(",a=")",t[i].format||(t[i].format=webix.i18n.dateFormatStr),s=s.replace("(date)","")):0===s.indexOf("(number)")&&(r="(",a=")*1",s=s.replace("(number)","")),""!==s?(s=s.replace(/\{obj\.([^}]*)\}/g,"\"+(obj.$1||'')+\""),s=s.replace(/#([^#'";, ]+)#/gi,"\"+(obj.$1||'')+\"")):s='"+(obj.'+n+"||'')+\"",e.push("obj."+n+" = "+r+'"'+s+'"'+a+";")
}this.Et(t[i])}if(e.length)try{this.data.qf=Function("obj",e.join("\n"))}catch(h){}},Et:function(t){var e=t.options||t.collection;if(e)if("string"==typeof e){var i=webix.$$(e);i||(i=new webix.DataCollection({url:e}),this.Ns.push(i)),i.getBody&&(i=i.getBody()),this.Bj(i,t)}else if(e.loadNext)this.Bj(e,t);
else if(e[0]&&"object"==typeof e[0])e=new webix.DataCollection({data:e}),this.Bj(e,t),this.Ns.push(e);else{if(webix.isArray(e)){for(var s={},n=0;n<e.length;n++)s[e[n]]=e[n];t.options=e=s}t.template=t.template||this.Ej(e,t.id,t.optionslist)}},Bj:function(t,e){if(e){delete e.options,e.collection=t,e.template=e.template||this.Dj(t,e.id,e.optionslist);
var i=t.data.attachEvent("onStoreUpdated",webix.bind(this.refresh,this));this.attachEvent("onDestruct",function(){t.data.detachEvent(i)})}},Ej:function(t,e,i){return i?function(i){var s=i[e]||i.value;if(!s)return"";for(var n=s.split(","),r=0;r<n.length;r++)n[r]=t[n[r]]||"";return n.join(", ")}:function(i){return t[i[e]]||i.value||""
}},Dj:function(t,e,i){return i?function(i){var s=i[e]||i.value;if(!s)return"";for(var n=s.split(","),r=0;r<n.length;r++){var a=t.data.pull[n[r]];n[r]=a?a.value||"":""}return n.join(", ")}:function(i){var s=i[e]||i.value,n=t.data.pull[s];return n&&(n.value||0===n.value)?n.value:""}}},webix.protoUI({name:"datatable",defaults:{leftSplit:0,rightSplit:0,columnWidth:100,minColumnWidth:20,minColumnHeight:26,prerender:!1,autoheight:!1,autowidth:!1,header:!0,fixedRowHeight:!0,scrollAlignY:!0,datafetch:50},$skin:function(){var t=webix.skin.$active.rowHeight,e=this.defaults;
e.rowHeight=t,e.headerRowHeight=webix.skin.$active.barHeight},on_click:{webix_richfilter:function(){return!1},webix_table_checkbox:function(t,e){e=this.locate(t);var i=this.getItem(e.row),s=this.getColumnConfig(e.column),n=i[e.column]!=s.checkValue?s.checkValue:s.uncheckValue;return i[e.column]=n,this.callEvent("onCheck",[e.row,e.column,n]),this.data.callEvent("onStoreUpdated",[e.row,i,this.s.checkboxRefresh?"update":"save"]),!1
},webix_table_radio:function(t){var e=this.locate(t),i=this.getItem(e.row),s=this.getColumnConfig(e.column);return this.eachRow(function(t){var i=this.data.pull[t];i&&i[e.column]==s.checkValue&&(i[e.column]=s.uncheckValue)}),i[e.column]=s.checkValue,this.callEvent("onCheck",[e.row,e.column,!0]),this.refresh(),!1
}},on_dblclick:{webix_table_checkbox:function(){return this.on_click.webix_table_checkbox.apply(this,arguments)}},on_context:{},$init:function(t){this.on_click=webix.extend({},this.on_click);var e="<div class='webix_ss_header'><div class='webix_hs_left'></div><div class='webix_hs_center'></div><div class='webix_hs_right'></div></div><div class='webix_ss_body'><div class='webix_ss_left'><div class='webix_ss_center_scroll'></div></div>";
e+="<div class='webix_ss_center'><div class='webix_ss_center_scroll'></div></div>",e+="<div class='webix_ss_right' ><div class='webix_ss_center_scroll'></div></div></div>",e+="<div class='webix_ss_hscroll'></div><div class='webix_ss_footer'><div class='webix_hs_left'></div><div class='webix_hs_center'></div><div class='webix_hs_right'></div></div><div class='webix_ss_vscroll_header'></div><div class='webix_ss_vscroll'></div><div class='webix_ss_vscroll_footer'></div>",this.w.innerHTML=e,this.bj=this.w.id=this.name+webix.uid(),this.w.className+=" webix_dtable",this.y=this.w,this.I=this.w.firstChild,this.Vf=this.I.nextSibling,this.cj=this.Vf.nextSibling.nextSibling,this.data.provideApi(this,!0),this.data.attachEvent("onParse",webix.bind(this.dj,this)),this.$ready.push(this.ej),this.fj=[],this.Mt=[],this.Nt=[],this.gj=[],this.hj={},this.ij={},this.$g=this.jj=0,this.Ns=[],this.data.attachEvent("onServerConfig",webix.bind(this.kj,this)),this.data.attachEvent("onServerOptions",webix.bind(this.lj,this)),this.attachEvent("onViewShow",this.Ow),webix.callEvent("onDataTable",[this,t])
},mj:function(){this.nj=this.oj=webix.ui.scrollSize,webix.html.addStyle("#"+this.bj+" .webix_cell { height:"+this.s.rowHeight+"px; line-height:"+(this.s.rowLineHeight||this.s.rowHeight)+"px;"+(this.s.fixedRowHeight?"":"white-space:normal;")+" }"),webix.html.addStyle("#"+this.bj+" .webix_hcell { height:"+this.s.headerRowHeight+"px; line-height:"+this.s.headerRowHeight+"px;}"),this.mj=function(){}
},ej:function(){this.data.attachEvent("onStoreLoad",webix.bind(this.refreshHeaderContent,this)),this.data.attachEvent("onSyncApply",webix.bind(this.refreshHeaderContent,this)),this.data.attachEvent("onStoreUpdated",webix.bind(function(){return this.render.apply(this,arguments)},this)),this.data.attachEvent("onStoreUpdated",webix.bind(this.pj,this)),this.render()
},refresh:function(){this.render()},render:function(t,e,i){if("save"!=i){if("move"==i){var s=webix.DragControl.getContext();if(s&&s.fragile)return}if(!this.fj.length){var n=this.s.columns;if(!n||!n.length){if(!this.s.autoConfig||!this.data.order.length)return;this.tj=0,this.qj()}this.rj()}return!this.isVisible(this.s.id)||this.$blockRender?this.mj():!t||-1==e||"paint"!=i&&"update"!=i?(this.sj&&(clearTimeout(this.sj),this.sj=0),this.callEvent("onBeforeRender",[this.data])?(this.mj(),this.tj||this.uj(),this.bc&&(this.s.experimental&&("paint"==i||"update"==i)&&t?this.Kv(t):this.vj(!0,!0)),t&&"update"==i||(this.wj=this.xj(),this.yj()),this.callEvent("onAfterRender",[this.data]),!0):void 0):(this.sj&&clearTimeout(this.sj),void(this.sj&&this.Lv!=t?(this.Lv=null,this.sj=webix.delay(function(){this.render()
},this)):(this.Lv=t,this.sj=webix.delay(function(){this.render(t,-1,i)},this))))}},columns_setter:function(t){return this.zj(t),t},getColumnConfig:function(t){return this.Aj[t]||this.am[t]},lj:function(t){for(var e in t){var i=this.getColumnConfig(e),s=new webix.DataCollection({data:t[e]});this.Ns.push(s),this.Bj(s,i)
}},kj:function(t){t.columns&&this.tj&&this.refreshColumns()},rj:function(){if(this.s.columns){this.fj=this.s.columns,this.Aj={};for(var t=0;t<this.fj.length;t++){var e=this.fj[t];this.Aj[e.id]=e;var i=e.cssFormat;i&&(e.cssFormat=webix.toFunctor(i,this.$scope)),e.width=e.width||this.s.columnWidth,"string"==typeof e.format&&(e.format=webix.i18n[e.format]||window[e.format]),webix.isUndefined(e.checkValue)&&(e.checkValue=1),webix.isUndefined(e.uncheckValue)&&(e.uncheckValue=0),e.css&&"object"==typeof e.css&&(e.css=webix.html.createCss(e.css));
var s=e.template;s&&("string"==typeof s&&(s=s.replace(/#\$value#/g,"#"+e.id+"#")),e.template=webix.template(s))}this.Mj("header",this.Mt),this.Mj("footer",this.Nt),this.callEvent("onStructureLoad",[])}},Cj:function(){this.uj()},uj:function(){this.Fj=this.fj.length-this.s.rightSplit,this.Gj=0;for(var t=0;t<this.fj.length;t++){if(!this.fj[t].node){var e=webix.html.create("DIV");
e.style.width=this.fj[t].width+"px",this.fj[t].node=e}t>=this.s.leftSplit&&t<this.Fj&&(this.Gj+=this.fj[t].width)}var i=[];if(this.s.rightSplit){var s=this.fj.length-this.s.rightSplit;i[s]=" webix_first",i[s-1]=" webix_last"}if(this.s.leftSplit){var n=this.s.leftSplit;i[n]=" webix_first",i[n-1]=" webix_last"
}i[0]=(i[0]||"")+" webix_first";var r=this.fj.length-1;i[r]=(i[r]||"")+" webix_last";for(var t=0;t<this.fj.length;t++){var a=this.fj[t].node;a.setAttribute("column",t),a.className="webix_column "+(this.fj[t].css||"")+(i[t]||"")}this.Hj(),this.Ij(),this.Jj(),this.Kj(),this.tj=!0},Ij:function(){for(var t=0,e=0;e<this.fj.length;e++){var i=this.fj[e];
(e==this.s.leftSplit||e==this.Fj)&&(t=0),i.node&&(i.node.style.left=t+"px",(this.s.leftSplit||this.s.rightSplit)&&(webix.html.remove(i.node),i.attached=!1)),t+=i.width}},Kj:function(){this.Lj||(this.Lj=0),this.s.header&&(this.fk(this.I,0,1),this.Mj("header",this.Mt),this.$g=this.Mt.Ot,this.Nj(this.I,"header",this.Mt)),this.s.footer&&(this.fk(this.cj,0,1),this.Mj("footer",this.Nt),this.jj=this.Nt.Ot,this.Nj(this.cj,"footer",this.Nt)),this.refreshHeaderContent(),this.Oj(),this.Nk&&this.markSorting(this.Nk,this.Ok)
},Mj:function(t,e){for(var i=0,s=0;s<this.fj.length;s++){var n=this.fj[s][t];n&&"object"==typeof n&&n.length||(webix.isUndefined(n)&&(n="header"==t?this.fj[s].id:""),n=[n]);for(var r=0;r<n.length;r++)"object"!=typeof n[r]&&(n[r]={text:n[r]}),n[r]&&n[r].height&&(e[r]=n[r].height);i=Math.max(i,n.length),this.fj[s][t]=n
}e.Ot=i;for(var s=i-1;s>=0;s--)e[s]=e[s]||this.s.headerRowHeight,e.Ot+=1*e[s];for(var s=0;s<this.fj.length;s++)for(var a=this.fj[s][t],r=0;r<a.length;r++){if(a[r]&&a[r].rowspan)for(var h=1;h<a[r].rowspan;h++)a[r+h]=null;if(a[r]&&a[r].colspan)for(var h=1;h<a[r].colspan;h++)this.fj[s+h][t][r]=null}for(var s=0;s<this.fj.length;s++){var n=this.fj[s][t];
if(n.length<i){var o=n.length-1;n[o].rowspan=i-n.length+1;for(var r=o+1;i>r;r++)n[r]=null}}return i},Pj:function(t,e){for(var i=t.getElementsByTagName("TD"),s=0;s<i.length;s++)if(i[s].getAttribute("active_id")==e)return i[s]},getHeaderContent:function(t){var e=this.Pj(this.I,t);if(e||(e=this.Pj(this.cj,t)),e){var i=this.hj[t],s=webix.ui.datafilter[i.content];
return s.getHelper?s.getHelper(e,i):{getValue:function(){return s.getValue(e)},setValue:function(t){return s.setValue(e,t)}}}},Pt:function(t,e,i){var s=i?-1:0;for(i+=e,e;i>e;e++)s+=t[e]+1;return s},Qj:function(t,e,i,s,n){if(t==e)return"";for(var r="<table style='width:"+i+"px' cellspacing='0' cellpadding='0'>",a=t;e>a;a++){r+="<tr>";
for(var a=t;e>a;a++)r+="<th  style='width:"+this.fj[a].width+"px'></th>";r+="</tr>"}for(var h=this.fj[0][s].length,o=0;h>o;o++){r+="<tr section='"+s+"'>";for(var a=t;e>a;a++){var l=this.fj[a][s][o];if(null!==l){l.content&&(l.contentId=l.contentId||webix.uid(),l.columnId=this.fj[a].id,l.format=this.fj[a].format,l.text=webix.ui.datafilter[l.content].render(this,l),this.hj[l.contentId]=l,this.Rj=!0),r+="<td column='"+(l.colspan?l.colspan-1+a:a)+"'";
var c="";a==t&&(c+="webix_first");var u=a+(l.colspan?l.colspan-1:0);u>=e-1&&(c+=" webix_last"),c&&(r+=' class="'+c+'"');var d=n[o],f="";l.contentId&&(r+=" active_id='"+l.contentId+"'"),l.colspan&&(r+=" colspan='"+l.colspan+"'"),l.rowspan&&(r+=" rowspan='"+l.rowspan+"'",d=this.Pt(this.Mt,o,l.rowspan)),d!=this.s.headerRowHeight&&(f=" style='line-height:"+d+"px; height:"+d+"px;'");
var b="webix_hcell",x=l.css;x&&("object"==typeof x&&(l.css=x=webix.html.createCss(x)),b+=" "+x),this.fj[a].$selected&&(b+=" webix_sel_hcell"),r+="><div class='"+b+"'"+f+">";var p=""===l.text?"&nbsp;":l.text;l.rotate&&(p="<div class='webix_rotate' style='width:"+(d-10)+"px; transform-origin:center "+(d-15)/2+"px;-webkit-transform-origin:center "+(d-15)/2+"px;'>"+p+"</div>"),r+=p+"</div></td>"
}}r+="</tr>"}return r+="</tr></table>"},showItemByIndex:function(t,e){var i=this.s.pager;if(i){var s=Math.floor(t/i.size);s!=i.page&&webix.$$(i.id).select(s)}if(-1!=t){var n=this.Sj();if(t<n[0]+1||t>=n[1]-1){var r=this.Tj(0,t);t<n[0]+1?r=Math.max(0,r-1):(r+=this.Uj(t)-this.Vj,t>0&&(r+=this.Uj(t-1)-1)),this.Wj.scrollTo(r)
}}if(-1!=e){if(e<this.s.leftSplit)return;if(e>=this.Fj)return;var n=this.Xj();if(e<n[0]+1||e>=n[1]-1){for(var r=0,a=this.s.leftSplit;e>a;a++)r+=this.fj[a].width;e<n[0]+1||(r+=this.fj[e].width-this.Yj),this.Zj.scrollTo(r)}}},showCell:function(t,e){if(!e||!t){var i=this.getSelectedId(!0);1==i.length&&(e=e||i[0].column,t=t||i[0].row)
}e=e?this.getColumnIndex(e):-1,t=t?this.getIndexById(t):-1,this.showItemByIndex(t,e)},scrollTo:function(t,e){if(this.Zj){if(this.$j)return this.$j(t,e);null!==t&&this.Zj.scrollTo(t),null!==e&&this.Wj.scrollTo(e)}},getScrollState:function(){if(this._j)return this._j();var t=this.Tj(0,this.ak||0);return{x:this.bk||0,y:t-(this.ck||0)}
},showItem:function(t){this.showItemByIndex(this.getIndexById(t),-1)},Nj:function(t,e,i){t.childNodes[0].innerHTML=this.Qj(0,this.s.leftSplit,this.dk,e,i),t.childNodes[1].innerHTML=this.Qj(this.s.leftSplit,this.Fj,this.Gj,e,i),t.childNodes[1].onscroll=webix.bind(this._s,this),t.childNodes[2].innerHTML=this.Qj(this.Fj,this.fj.length,this.ek,e,i)
},_s:function(){var t=this.getScrollState().x,e=this.I.childNodes[1].scrollLeft;e!=t&&this.scrollTo(e,null)},pj:function(){this.refreshHeaderContent(!0)},refreshHeaderContent:function(t){t=t===!0,this.s.header&&this.fk(this.I,t),this.s.footer&&this.fk(this.cj,t)},refreshFilter:function(t){this.fk(this.I,0,1,t),this.fk(this.I,0,0,t),this.fk(this.cj,0,1,t),this.fk(this.cj,0,0,t)
},fk:function(t,e,i,s){if(this.Rj&&t)for(var n=t.getElementsByTagName("TD"),r=0;r<n.length;r++)if(n[r].getAttribute("active_id")){var a=this.hj[n[r].getAttribute("active_id")];if(s&&s!=a.columnId)continue;var h=webix.ui.datafilter[a.content];i?a.value=h.getValue(n[r]):(!e||h.trackCells)&&h.refresh(this,n[r],a)
}},headerContent:[],gk:function(t,e,i){if(this.oj){if(t.style.height=Math.max(e,1)-1+"px",t.style.width=(this.Fj?0:i)+this.oj-1+"px",webix.env.isWebKit){t.offsetWidth}}else t.style.display="none"},Oj:function(){this.s.header&&this.gk(this.hk,this.$g,this.Lj),this.s.footer&&this.gk(this.ik,this.jj,this.Lj)
},sk:function(){this.oj=this.s.autoheight||this.s.scrollY===!1?0:webix.ui.scrollSize,this.nj=this.s.autowidth||this.s.scrollX===!1?0:webix.ui.scrollSize,this.Zj&&(this.Zj.x.style.display=this.nj?"block":"none"),this.Wj&&(this.Wj.x.style.display=this.oj?"block":"none")},Hj:function(){this.jk=0,this.bk=0;
var t,e;if(t=e=1,(this.s.autoheight||this.s.scrollY===!1)&&(e=this.oj=0),(this.s.autowidth||this.s.scrollX===!1)&&(t=this.nj=0),webix.env.touch&&(t=e=0),this.Zj||(this.Zj=new webix.ui.vscroll({container:this.cj.previousSibling,scrollWidth:this.Gj,scrollSize:this.nj,scrollVisible:t}),!t||this.nj||webix.env.$customScroll||(this.Zj.x.style.position="absolute"),this.Zj.attachEvent("onScroll",webix.bind(this.kk,this))),!this.Wj){this.hk=this.cj.nextSibling;
var i=this.hk.nextSibling;this.ik=i.nextSibling,this.Wj=new webix.ui.vscroll({container:i,scrollHeight:100,scroll:"y",scrollSize:this.oj,scrollVisible:e}),this.Wj.activeArea(this.Vf),this.Zj.activeArea(this.Vf,!0),this.Wj.attachEvent("onScroll",webix.bind(this.lk,this))}this.bc&&this.callEvent("onResize",[this.bc,this.dc]),webix.env.$customScroll&&webix.CustomScroll.enable(this),this.Hj=function(){}
},columnId:function(t){return this.fj[t].id},getColumnIndex:function(t){for(var e=0;e<this.fj.length;e++)if(this.fj[e].id==t)return e;return-1},nk:function(t,e){var i,s=0,n=0,r=0,a=0,h=0;for(i=0;i<this.fj.length&&((this.Fj==i||this.s.leftSplit==i)&&(s=0,h++),this.fj[i].id!=e);i++)s+=this.fj[i].width;
for(n+=this.fj[i].width,i=0;i<this.data.order.length&&this.data.order[i]!=t;i++)a+=this.Uj(i);return r+=this.Uj(i),[s,n,a-this.jk,r,this.Vf.childNodes[h]]},ok:function(){return this.row},locate:function(t){for(t=t.target||t.srcElement||t;t&&t.getAttribute&&!t.getAttribute("view_id");){var e=t.className,i=null;
if(-1!=e.indexOf("webix_cell")&&(i=this.pk(t),i&&(i.row=this.data.order[i.rind])),-1!=e.indexOf("webix_hcell")&&(i=this.pk(t),i&&(i.header=!0)),i)return i.column=this.fj[i.cind].id,i.toString=this.ok,i;t=t.parentNode}return null},pk:function(t){var e=t.parentNode;if(!e)return null;var i=1*(t.getAttribute("column")||e.getAttribute("column")),s=t.getAttribute("row")||0;
if(!s)for(var n=0;n<e.childNodes.length;n++)e.childNodes[n]==t&&(s=n+this.fj[i].qk);return{rind:s,cind:i}},rk:function(t){this.tj&&(this.Ij(),this.Jj(),this.Kj(),t||this.vj(!1,!1))},setColumnWidth:function(t,e,i){return this.Xs(this.getColumnIndex(t),e,i)},Xs:function(t,e,i){if(!isNaN(e)){var s=this.fj[t];
s.minWidth&&e<s.minWidth?e=s.minWidth:e<this.s.minColumnWidth&&(e=this.s.minColumnWidth);var n=s.width;return n!=e?(t>=this.s.leftSplit&&t<this.Fj&&(this.Gj+=e-n),s.width=e,s.node?(s.node.style.width=e+"px",i||this.rk(),this.callEvent("onColumnResize",[s.id]),!0):!1):!1}},Uj:function(t){var e=this.data.order[t];
return e?this.data.pull[e].$height||this.s.rowHeight:this.s.rowHeight},Tj:function(t,e){if(this.s.fixedRowHeight)return(e-t)*this.s.rowHeight;for(var i=0;e>t;t++)i+=this.Uj(t);return i},ug:function(t,e){1==arguments.length&&(e=t.column,t=t.row);for(var i=this.getItem(t),s=this.getColumnConfig(e),n=0,r=0,a=0;a<this.fj.length;a++){(a==this.s.leftSplit||a==this.Fj)&&(n=0);
var h=this.fj[a];if(h.id==e){var o=a<this.s.leftSplit?0:a>=this.Fj?2:1;r=this.Vf.childNodes[o].firstChild;break}n+=h.width}var l=(this.data.order.length,this.Tj(this.ak||0,this.getIndexById(t)));return{parent:r,top:l+(this.ck||0),left:n,width:s.width,height:i.$height||this.s.rowHeight}},xj:function(){var t=this.s.pager,e=0,i=this.data.order.length;
return t&&(e=t.size*t.page,i=Math.min(i,e+t.size),t.level&&(e=this.data.$min,i=this.data.$max)),this.Tj(e,i)},setRowHeight:function(t,e){if(!isNaN(e)){e<this.s.minColumnHeight&&(e=this.s.minColumnHeight);var i=this.getItem(t),s=i.$height||this.s.rowHeight;s!=e&&(i.$height=e,this.config.fixedRowHeight=!1,this.render(),this.callEvent("onRowResize",[t]))
}},lk:function(t){if(this.Vf.childNodes[1].scrollTop=this.jk=t,this.s.prerender)for(var e=this.Vf.childNodes,i=0;i<e.length;i++)e[i].scrollTop=t;else this.vj();webix.env.$customScroll&&webix.CustomScroll.sk(this.Vf),this.callEvent("onScrollY",[])},kk:function(t){this.Vf.childNodes[1].scrollLeft=this.bk=t,this.s.header&&(this.I.childNodes[1].scrollLeft=t),this.s.footer&&(this.cj.childNodes[1].scrollLeft=t),this.s.prerender===!1&&this.vj(this.tk?!1:!0),webix.env.$customScroll&&webix.CustomScroll.sk(this.Vf),this.callEvent("onScrollX",[])
},Xj:function(t){if(t)return[0,this.fj.length];for(var e=this.bk,i=this.s.leftSplit;e>0;)e-=this.fj[i].width,i++;var s=i;for(e&&i--,e+=this.Yj;e>0&&s<this.Fj;)e-=this.fj[s].width,s++;return[i,s]},getVisibleCount:function(){return Math.floor(this.Vj/this.config.rowHeight)},Sj:function(t){var e=this.jk,i=0,s=this.count(),n=this.s.pager;
if(n){var i=n.page*n.size,s=Math.min(s,i+n.size);n.level&&(i=this.data.$min,s=this.data.$max)}if(this.s.autoheight)return[i,s,0];if(t)return[i,s];var r=i,a=this.s.fixedRowHeight?this.s.rowHeight:0;if(a){var h=Math.ceil(e/a);e-=h*a,r+=h}else for(;e>0;)e-=this.Uj(r),r++;var o=r>0&&e?-(this.Uj(r-1)+e):0,l=r;
if(e&&r--,e+=this.Vj||this.dc,a){var h=Math.ceil(e/a);e-=h*a,l+=h,l>s&&(l=s)}else for(;e>0&&s>l;)e-=this.Uj(l),l++;return[r,l,o]},Kv:function(t){var e=this.getItem(t),i=this.getIndexById(t),s=this.Sj();if(!(i<s[0]||i>=s[1]))for(var n=this.Xj(),r=0;r<this.fj.length;r++){var a=this.fj[r];if(r<this.Fj&&r>=this.s.leftSplit&&(r<n[0]||r>n[1])&&(a.qk=-999),a.attached&&a.node){var h=a.node.childNodes[i-s[0]],o=this.Ek(e,this.fj[r],0);
h.innerHTML=o,h.className=this.Mv(this.fj[r],o,e,t)}}},vj:function(t,e){if(this.fj.length){e&&this.uk();var i=this.Xj(this.s.prerender),s=this.Sj(this.s.prerender===!0);if(t){for(var n=this.s.leftSplit;n<i[0];n++)this.vk(n,e);for(var n=i[1];n<this.Fj;n++)this.vk(n,e)}this.wk=[];for(var r=0,n=0;n<this.s.leftSplit;n++)r+=this.xk(n,s,e);
for(var n=i[0];n<i[1];n++)r+=this.xk(n,s,e,n==i[0]);for(var n=this.Fj;n<this.fj.length;n++)r+=this.xk(n,s,e);this.yk(s[0],s[1],e),this.zk(s)}},Ak:function(t,e){this.Bk=t,this.Ck=e,webix.html.remove(this.gj),this.gj=[]},yk:function(t,e,i){if((i||t!=this.Bk||e!=this.Ck)&&(this.Ak(t,e),this.Dk)){this.Dk=!1;
for(var s=0;s<this.wk.length;s++){var n,r=this.wk[s],a=this.getItem(r.id);n="function"==typeof a.$row?a.$row.call(this,a,this.type):this.Ek(a,this.getColumnConfig(a.$row),s);var h=this.gj[s]=webix.html.create("DIV",null,n);h.className="webix_cell webix_dtable_colrow",h.setAttribute("column",0),h.setAttribute("row",r.index),a.$height&&(h.style.height=a.$height+"px"),h.style.top=r.top+"px",this.Vf.appendChild(h)
}}},zk:function(t){var e=this.s.pager,i=this.s.datafetch,s=!this.Fk||t[0]>=this.Fk;if(this.Fk=t[0],this.Gk){if(e&&(!i||i>=e.size)&&this.Hk([0,e.size*e.page],Math.max(i,e.size),!0))return this.Gk=null;this.Ik(this.Gk,s),this.Gk=null}else if(this.s.loadahead){this.Hk(t,this.s.loadahead,s)}},Hk:function(t,e,i){var s=t[1],n=s+e;
i||(s=t[0]-e,n=t[0]),0>s&&(s=0),n=Math.min(n,this.data.order.length-1);for(var r=!1,a=s;n>a;a++)this.data.order[a]||(r?(r.last=a,r.count=a-s):r={start:a,count:n-s});return r?(this.Ik(r,i),!0):void 0},Ik:function(t,e){var i=Math.max(t.count,this.s.datafetch||this.s.loadahead||0),s=e?t.start:t.last-i+1;
this.cf(t.count,t.start)||this.loadNext(i,s)},vk:function(t){var e=this.fj[t];webix.html.remove(e.node),e.attached=!1},uk:function(){for(var t=0;t<this.fj.length;t++)this.fj[t].qk=-1;this.gj.length&&(webix.html.remove(this.gj),this.gj=[])},getText:function(t,e){return this.Ek(this.getItem(t),this.getColumnConfig(e),0)
},Mv:function(t,e,i,s){var n="webix_cell";if(t.cssFormat){var r=t.cssFormat(e,i,s,t.id);r&&(n+="object"==typeof r?" "+webix.html.createCss(r):" "+r)}var a=i.$css;a&&("object"==typeof a&&(i.$css=a=webix.html.createCss(a)),n+=" "+a);var h=this.data.Me[s];if(h&&(h.$css&&(n+=" "+h.$css),h.$cellCss)){var o=h.$cellCss[t.id];
o&&(n+=" "+o)}if(i.$cellCss){var l=i.$cellCss[t.id];l&&("object"==typeof l&&(l=webix.html.createCss(l)),n+=" "+l)}var c=this.data.getMark(i.id,"webix_selected");return(c&&(c.$row||c[t.id])||t.$selected)&&(n+=this.Lk),n},Ek:function(t,e,i){if(!t)return"";var s;return s=t[e.id],s===webix.undefined||null===s?s="":e.format&&(s=e.format(s)),e.template&&(s=e.template(t,this.type,s,e,i)),s
},type:{checkbox:function(t,e,i,s){var n=i==s.checkValue?'checked="true"':"";return"<input class='webix_table_checkbox' type='checkbox' "+n+">"},radio:function(t,e,i,s){var n=i==s.checkValue?'checked="true"':"";return"<input class='webix_table_radio' type='radio' "+n+">"},editIcon:function(){return"<span class='webix_icon fa-pencil'></span>"
},trashIcon:function(){return"<span class='webix_icon fa-trash'></span>"}},type_setter:function(t){return this.types&&this.types[t]?(this.type=webix.clone(this.types[t]),this.type.css&&(this.w.className+=" "+this.type.css)):webix.type(this,t),this.type.on_click&&webix.extend(this.on_click,this.type.on_click),t
},xk:function(t,e,i,s){var n=this.fj[t];if(!n.attached){var r=t<this.s.leftSplit?0:t>=this.Fj?2:1;this.Vf.childNodes[r].firstChild.appendChild(n.node),n.attached=!0,n.split=r}this.ak=e[0],this.ck=0;var a=0;if(this.s.scrollAlignY?e[1]==this.data.order.length||this.data.$pagesize&&e[1]%this.data.$pagesize===0?(a=this.ck=e[2],n.node.style.top=a+"px"):n.Jk&&(n.node.style.top="0px"):(this.ck=e[2],e[2]!=n.Jk&&(a=e[2],n.node.style.top=a+"px")),!i&&n.qk==e[0]&&n.Kk==e[1])return 0;
for(var h="",o=this.s.columns[t],l=this.s.rowHeight,c=e[0];c<e[1];c++){var u,d=this.data.order[c],f=this.data.getItem(d);if(f){if(s&&f.$row){this.Dk=!0,this.wk.push({top:a,id:f.id,index:c}),h+="<div class='webix_cell'></div>",a+=l;continue}var u=this.Ek(f,o,c),b=this.Mv(o,u,f,d);f.$height?(h+="<div class='"+b+"' style='height:"+f.$height+"px'>"+u+"</div>",a+=f.$height-l):h+="<div class='"+b+"'>"+u+"</div>"
}else h+="<div class='webix_cell'></div>",this.Gk?this.Gk.last=c:this.Gk={start:c,count:e[1]-c};a+=l}return n.node.innerHTML=h,n.qk=e[0],n.Kk=e[1],n.Jk=e[2],1},yj:function(){if(this.fj.length&&!isNaN(1*this.dc)){var t=this.wj+(this.nj?this.nj:0);if(!this.s.autoheight&&!this.s.yCount||!this.resize()){this.Wj.sizeTo(this.dc,this.$g,this.jj),this.Wj.define("scrollHeight",t),this.Vj=Math.max(0,this.dc-this.nj-this.$g-this.jj);
for(var e=0;3>e;e++)this.Vf.childNodes[e].style.height=this.Vj+"px",this.Vf.childNodes[e].firstChild.style.height=this.s.prerender?this.wj+"px":this.Vj+"px"}}},Jj:function(){if(this.fj.length){var t=0;for(this.dk=0,this.ek=0,this.Yj=0;t<this.s.leftSplit;)this.dk+=this.fj[t].width,t++;for(t=this.fj.length-1;t>=this.Fj;)this.ek+=this.fj[t].width,t--;
if(this.bc&&(!this.s.autowidth||!this.resize())){this.Yj=this.bc-this.ek-this.dk-this.oj,this.Vf.childNodes[1].firstChild.style.width=this.Gj+"px",this.Vf.childNodes[0].style.width=this.dk+"px",this.Vf.childNodes[1].style.width=this.Yj+"px",this.Vf.childNodes[2].style.width=this.ek+"px",this.I.childNodes[0].style.width=this.dk+"px",this.I.childNodes[1].style.width=this.Yj+"px",this.I.childNodes[2].style.width=this.ek+"px",this.cj.childNodes[0].style.width=this.dk+"px",this.cj.childNodes[1].style.width=this.Yj+"px",this.cj.childNodes[2].style.width=this.ek+"px";
var e=this.Yj-this.Gj;if(0>e&&(e=0),e!=this.Lj&&(this.Lj=e,this.Oj()),webix.env.isWebKit){var i=this.Vf.childNodes[0].offsetWidth;i=this.Vf.childNodes[1].offsetWidth,i=this.Vf.childNodes[2].offsetWidth}this.Zj.sizeTo(this.bc-this.oj),this.Zj.define("scrollWidth",this.Gj+this.dk+this.ek)}}},$getSize:function(t,e){if((this.s.autoheight||this.s.yCount)&&this.s.columns){var i=(this.s.yCount||0)*this.s.rowHeight;
i||(i=this.isVisible()?this.wj:this.count()*this.s.rowHeight),this.s.height=Math.max(i+(this.nj?this.nj:0)-1,this.s.minHeight||0)+this.$g+this.jj}this.s.autowidth&&this.s.columns&&(this.s.width=Math.max(this.Gj+this.dk+this.ek+this.oj,this.s.minWidth||0));var s=this.dk+this.ek+this.oj,n=webix.ui.view.prototype.$getSize.call(this,t,e);
return n[0]=Math.max(n[0]||s),n},Ow:function(){if(this.Zj){var t=this.getScrollState();this.Zj.Wi=this.Wj.Wi=-1,this.scrollTo(t.x,t.y)}},$setSize:function(){webix.ui.view.prototype.$setSize.apply(this,arguments)&&(this.tj&&(this.callEvent("onResize",[this.bc,this.dc]),this.Jj(),this.yj()),this.render())
},Mk:function(t){var e=this.getColumnConfig(t);if(e.sort){var i="asc";e.id==this.Nk&&(i="asc"==this.Ok?"desc":"asc"),this.zf(e.id,i,e.sort)}},markSorting:function(t,e){if(this.Pk||(this.Pk=webix.html.create("DIV")),webix.html.remove(this.Pk),e){var i=this.Qk(this.getColumnIndex(t));i&&(this.Pk.className="webix_ss_sort_"+e,i.style.position="relative",i.appendChild(this.Pk)),this.Nk=t,this.Ok=e
}else this.Nk=this.Ok=null},scroll_setter:function(t){return"string"==typeof t?(this.s.scrollX=-1!=t.indexOf("x"),this.s.scrollY=-1!=t.indexOf("y"),t):this.s.scrollX=this.s.scrollY=t},Qk:function(t){for(var e=this.I.getElementsByTagName("TD"),i=null,s=0;s<e.length;s++)if(e[s].getAttribute("column")==t&&!e[s].getAttribute("active_id")&&(i=e[s].firstChild,(e[s].colSpan||0)<2))return i;
return i},zf:function(t,e,i){e=e||"asc",this.markSorting(t,e),"server"==i?this.loadNext(-1,0,{before:function(){var t=this.data.url;this.clearAll(),this.data.url=t}},0,1):("text"==i&&(this.data.each(function(e){e.$text=this.getText(e.id,t)},this),i="string",t="$text"),"function"==typeof i?this.data.sort(i,e):this.data.sort(t,e,i||"string"))
},Yc:function(t,e,i,s){t=t||event;for(var n=t.target||t.srcElement,r=[],a="",h=null,o=!1;n&&n.parentNode;){if(a=n.className){a=a.toString().split(" ");for(var l=a.length-1;l>=0;l--)e[a[l]]&&r.push(e[a[l]])}if(n.parentNode.getAttribute){var c=n.parentNode.getAttribute("column")||n.getAttribute("column");
if(c){var u="DIV"==n.parentNode.tagName;if(o=!0,u){var d=n.parentNode.getAttribute("row")||n.getAttribute("row")||webix.html.index(n)+this.fj[c].qk;this.Qc=h={row:this.data.order[d],column:this.fj[c].id},h.toString=this.ok}else this.Qc=h={column:this.fj[c].id};if(r.length)for(var l=0;l<r.length;l++){var f=webix.toFunctor(r[l],this.$scope),b=f.call(this,t,h,n);
if(b===!1)return}if(u)this.callEvent("on"+i,[h,t,n])&&s&&this.callEvent("on"+s,[h,t,n]);else if("ItemClick"==i){var x="header"==n.parentNode.parentNode.getAttribute("section");x&&this.callEvent("onHeaderClick",[h,t,n])&&this.Mk(h.column)}break}}n=n.parentNode}return o},showOverlay:function(t){if(!this.Rk){var e=webix.html.create("DIV",{"class":"webix_overlay"},"");
this.Vf.appendChild(e),this.Rk=e}this.Rk.innerHTML=t},hideOverlay:function(){this.Rk&&(webix.html.remove(this.Rk),this.Rk=null)},mapCells:function(t,e,i,s,n){if(null===t&&this.data.order.length>0&&(t=this.data.order[0]),null===e&&(e=this.columnId(0)),null===i&&(i=this.data.order.length),null===s&&(s=this.s.columns.length),this.exists(t)&&(t=this.getIndexById(t),e=this.getColumnIndex(e),null!==e))for(var r=0;i>r&&t+r<this.data.order.length;r++)for(var a=t+r,h=this.data.order[a],o=this.getItem(h),l=0;s>l&&e+l<this.s.columns.length;l++){var c=e+l,u=this.columnId(c);
o[u]=n(o[u],h,u,r,l)}},dj:function(t,e){!this.s.columns&&t.getConfig&&this.define("columns",t.getConfig(e))},qj:function(){var t=this.getItem(this.getFirstId()),e=this.s.columns=[];for(var i in t)"id"!=i&&e.push({id:i,header:i[0].toUpperCase()+i.substr(1),sort:"string",editor:"text"});e.length&&(e[0].fillspace=!0),"undefined"==typeof this.s.select&&this.define("select","row")
}},webix.AutoTooltip,webix.Group,webix.DataMarks,webix.DataLoader,webix.MouseEvents,webix.MapCollection,webix.ui.view,webix.EventSystem,webix.Settings),webix.ui.datafilter={textWaitDelay:500,summColumn:{getValue:function(){},setValue:function(){},refresh:function(t,e,i){var s=0;t.mapCells(null,i.columnId,null,1,function(t){return t=1*t,isNaN(t)||(s+=t),t
}),i.format&&(s=i.format(s)),i.template&&(s=i.template({value:s})),e.firstChild.innerHTML=s},trackCells:!0,render:function(t,e){return e.template&&(e.template=webix.template(e.template)),""}},masterCheckbox:{getValue:function(){},setValue:function(){},getHelper:function(t,e){return{check:function(){e.checked=!1,t.onclick()
},uncheck:function(){e.checked=!0,t.onclick()},isChecked:function(){return e.checked}}},refresh:function(t,e,i){e.onclick=function(){this.getElementsByTagName("input")[0].checked=i.checked=!i.checked;var e=t.getColumnConfig(i.columnId),s=i.checked?e.checkValue:e.uncheckValue;t.data.each(function(e){e[i.columnId]=s,t.callEvent("onCheck",[e.id,i.columnId,s]),this.callEvent("onStoreUpdated",[e.id,e,"save"])
}),t.refresh()}},render:function(t,e){return"<input type='checkbox' "+(e.checked?"checked='1'":"")+">"}},textFilter:{getInputNode:function(t){return t.firstChild.firstChild},getValue:function(t){return this.getInputNode(t).value},setValue:function(t,e){this.getInputNode(t).value=e},refresh:function(t,e,i){e.component=t.s.id,t.registerFilter(e,i,this),e.Sk=t.s.id,i.value&&this.getValue(e)!=i.value&&this.setValue(e,i.value),e.onclick=webix.html.preventEvent,webix.event(e,"keydown",this.Tk)
},render:function(t,e){return this.init&&this.init(e),e.css="webix_ss_filter","<input "+(e.placeholder?'placeholder="'+e.placeholder+'" ':"")+"type='text'>"},Tk:function(t){var e=this.Sk;9!=(t.which||t.keyCode)&&(this.Uk&&window.clearTimeout(this.Uk),this.Uk=window.setTimeout(function(){webix.$$(e).filterByAll()
},webix.ui.datafilter.textWaitDelay))}},selectFilter:{getInputNode:function(t){return t.firstChild.firstChild},getValue:function(t){return this.getInputNode(t).value},setValue:function(t,e){this.getInputNode(t).value=e},refresh:function(t,e,i){i.compare=i.compare||function(t,e){return t==e},e.component=t.s.id,t.registerFilter(e,i,this);
var s;s=i.options?i.options:t.collectValues(i.columnId);for(var n=document.createElement("select"),r=0;r<s.length;r++){var a=document.createElement("option");a.value=s[r].id,a.text=s[r].value,n.add(a)}e.firstChild.innerHTML="",e.firstChild.appendChild(n),i.value&&this.setValue(e,i.value),e.onclick=webix.html.preventEvent,n.Sk=t.s.id,webix.event(n,"change",this.Vk)
},render:function(t,e){return this.init&&this.$init(e),e.css="webix_ss_filter",""},Vk:function(){webix.$$(this.Sk).filterByAll()}}},webix.ui.datafilter.serverFilter=webix.extend({Tk:function(t){var e=this.Sk,i=t.which||t.keyCode;9==i||i>=33&&40>=i||(this.Uk&&window.clearTimeout(this.Uk),this.Uk=window.setTimeout(function(){webix.$$(e).loadNext(-1,0,{before:function(){var t=this.data.url;
this.editStop&&this.editStop(),this.clearAll(),this.data.url=t},success:function(){this.callEvent("onAfterFilter",[])}},0,1)},webix.ui.datafilter.textWaitDelay))}},webix.ui.datafilter.textFilter),webix.ui.datafilter.serverSelectFilter=webix.extend({Vk:function(){var t=this.Sk;webix.$$(t).loadNext(-1,0,{before:function(){var t=this.data.url;
this.editStop&&this.editStop(),this.clearAll(),this.data.url=t},success:function(){this.callEvent("onAfterFilter",[])}},0,1)}},webix.ui.datafilter.selectFilter),webix.ui.datafilter.numberFilter=webix.extend({init:function(t){t.prepare=function(e){var i=-1!=e.indexOf("=")?1:0,s=this.format(e);return""===s?"":(-1!=e.indexOf(">")?t.compare=this.Wk:-1!=e.indexOf("<")?(t.compare=this.Xk,i*=-1):(t.compare=this.Yk,i=0),s-i)
}},format:function(t){return t.replace(/[^0-9]/g,"")},Wk:function(t,e){return 1*t>e},Xk:function(t,e){return e>1*t},Yk:function(t,e){return 1*t==e}},webix.ui.datafilter.textFilter),webix.ui.datafilter.dateFilter=webix.extend({format:function(t){if(""===t)return"";var e=new Date;if(-1!=t.indexOf("today"))e=webix.Date.dayStart(e);
else if(-1==t.indexOf("now")){var i=t.match(/[0-9]+/g);if(!i||!i.length)return"";i.length<3?(i.reverse(),e=new Date(i[0],(i[1]||1)-1,1)):e=webix.i18n.dateFormatDate(t.replace(/^[>< =]+/,""))}return e.valueOf()}},webix.ui.datafilter.numberFilter),webix.extend(webix.ui.datatable,{find:function(t,e){for(var i=[],s=this.data.count(),n=0;s>n;n++){var r=this.getItem(this.data.order[n]),a=!0;
if("object"==typeof t){for(var h in t)if(r[h]!=t[h]){a=!1;break}}else t(r)||(a=!1);if(a&&i.push(r),e&&i.length)return i[0]}return i},filterByAll:function(){this.data.silent(function(){this.filter();var t=!1;for(var e in this.ij){var i=this.ij[e],s=i[2].getValue(i[0]),n=s;i[1].prepare&&(n=i[1].prepare.call(i[2],n,i[1],this)),i[1].value=s;
var r=i[1].compare;this.callEvent("onBeforeFilter",[e,n,i[1]])&&""!==n&&(r?this.filter(function(t,i){if(!t)return!1;var s=t[e];return r(s,i,t)},n,t):this.filter(e,n,t),t=!0)}},this),this.refresh(),this.callEvent("onAfterFilter",[])},filterMode_setter:function(t){return webix.extend(this.data.Cf,t,!0)
},getFilter:function(t){var e=this.ij[t];return e&&e[2].getInputNode?e[2].getInputNode(e[0]):null},registerFilter:function(t,e,i){this.ij[e.columnId]=[t,e,i]},collectValues:function(t){var e=[{id:"",value:""}],i={"":!0},s=this.getColumnConfig(t),n=s.options||s.collection;if(n){if("object"==typeof n&&!n.loadNext){if(webix.isArray(n))for(var r=0;r<n.length;r++)e.push({id:n[r],value:n[r]});
else for(var a in n)e.push({id:a,value:n[a]});return e}"string"==typeof n&&(n=webix.$$(n)),n.getBody&&(n=n.getBody()),this.Zk.call(n,"id","value",e,i)}else this.Zk(s.id,s.id,e,i);return e},Zk:function(t,e,i,s){this.data.each(function(n){var r=n?n[e]:"";s[r]||(s[r]=!0,i.push({id:n[t],value:r}))},this,!0),i.sort(function(t,e){return t.value>e.value?1:-1
})}}),webix.extend(webix.ui.datatable,{hover_setter:function(t){return t&&!this.Yw&&(this.Vc(),this.config.experimental=!0,this.attachEvent("onMouseMoving",function(){var t=this.locate(arguments[0]);t=t?t.row:null,this.Zw!=t&&(this.Zw&&this.removeRowCss(this.Zw,this.s.hover),this.$w(),this.Zw=t)}),this.attachEvent("onMouseOut",function(){this.Zw&&(this.removeRowCss(this.Zw,this.s.hover),this.Zw=null)
}),this.Yw=1),t},$w:function(){webix.delay(function(){this.Zw&&this.addRowCss(this.Zw,this.s.hover)},this,[],5)},select_setter:function(t){return!this.select&&t&&(webix.extend(this,this._k.$k,!0),t===!0?t="row":"multiselect"==t&&(t="row",this.s.multiselect=!0),webix.extend(this,this._k[t],!0)),t},getSelectedId:function(t){return t?[]:""
},getSelectedItem:function(t){return webix.SelectionModel.getSelectedItem.call(this,t)},_k:{$k:{Lk:" webix_cell_select",$init:function(){this.al(),this.on_click.webix_cell=webix.bind(this.bl,this),this.cl=this.zg=function(){this.unselect()},this.data.attachEvent("onStoreUpdated",webix.bind(this.xg,this)),this.data.attachEvent("onClearAll",webix.bind(this.cl,this)),this.data.attachEvent("onAfterFilter",webix.bind(this.zg,this)),this.data.attachEvent("onIdChange",webix.bind(this.Ag,this)),this.$ready.push(webix.SelectionModel.uy)
},Ag:function(t,e){for(var i=0;i<this.dl.length;i++)this.dl[i]==t&&(this.dl[i]=e);for(var i=0;i<this.el.length;i++){var s=this.el[i];s.row==t&&(t=this.fl(s),s.row=e,e=this.fl(s),s.id=e,delete this.gl[t],this.gl[e]=!0)}},xg:function(t,e,i){"delete"==i&&this.unselect(t)},al:function(){this.el=[],this.gl={},this.dl=[]
},getSelectedId:function(t,e){var i;if(this.el.length>1||t){if(i=[].concat(this.el),e)for(var s=0;s<i.length;s++)i[s]=i[s].id}else if(i=this.el[0],e&&i)return i.id;return i},ok:function(){return this.row},hl:function(t,e){var i=this.fl(t);if(null!==i){if(t.id=i,t.toString=this.ok,!this.callEvent("onBeforeSelect",[t,e]))return!1;
if(!this.gl[i]||!e&&1!=this.el.length)return e||this.il(),this.el.push(t),this.gl[i]=!0,this.callEvent("onAfterSelect",[t,e]),this.jl(this.kl(t)),!0}},il:function(){if(!this.el.length)return!1;for(var t=0;t<this.dl.length;t++){var e=this.getItem(this.dl[t]);e&&this.data.removeMark(e.id,"webix_selected",0,1)
}var i=this.s.columns;if(i)for(var t=0;t<i.length;t++)i[t].$selected=null;return this.al(),!0},clearSelection:function(){this.il()&&(this.callEvent("onSelectChange",[]),this.render())},ll:function(t){var e=this.fl(t);if(!e&&this.el.length&&(this.clearSelection(),this.callEvent("onSelectChange",[])),this.gl[e]){if(!this.callEvent("onBeforeUnSelect",[t]))return!1;
for(var i=0;i<this.el.length;i++)if(this.el[i].id==e){this.el.splice(i,1);break}delete this.gl[e],this.callEvent("onAfterUnselect",[t]),this.jl(0,this.ml(t))}},nl:function(t){var e=this.getItem(t);return this.data.addMark(e.id,"webix_selected",0,{$count:0},!0)},jl:function(t){t&&this.dl.push(t),this.Dg||(this.render(),this.callEvent("onSelectChange",[]))
},bl:function(t,e){var i=t.ctrlKey||t.metaKey||"touch"==this.s.multiselect,s=t.shiftKey;if(this.s.multiselect||"multiselect"==this.s.select||(i=s=!1),s&&this.el.length){var n=this.el[this.el.length-1];this.ol(e,n)}else i&&this.gl[this.fl(e)]?this.ll(e):this.hl({row:e.row,column:e.column},i)},pl:function(t,e,i){var s=this.s.columns;
if(e){for(var n=[],r=0;r<s.length;r++)s[r].$selected&&n.push(s[r]);s=n}for(var a=this.data.order,h=0,r=0;r<a.length;r++){var o=this.getItem(a[r]);if(o){var l=this.data.getMark(o.id,"webix_selected");if(l||e){for(var c=0,u=0;u<s.length;u++){var d=s[u].id;if(i||e||l[d]){if(!t)return{row:a[r],column:d};
o[d]=t(o[d],a[r],d,h,c),c++}}h++}}}}},row:{Lk:" webix_row_select",fl:function(t){return t.row},select:function(t,e){t&&(t=t.toString()),this.hl({row:t},e)},kl:function(t){return this.nl(t.row).$row=!0,t.row},unselect:function(t){this.ll({row:t})},ml:function(t){return this.data.removeMark(t.row,"webix_selected",0,1),t.row
},mapSelection:function(t){return this.pl(t,!1,!0)},ol:function(t,e){return this.selectRange(t.row,e.row)},selectRange:function(t,e){var i=this.getIndexById(t),s=this.getIndexById(e);if(i>s){var n=i;i=s,s=n}this.Dg=!0;for(var r=i;s>=r;r++)this.select(this.getIdByIndex(r),!0);this.Dg=!1,this.jl()}},cell:{fl:function(t){return t.column?t.row+"_"+t.column:null
},select:function(t,e,i){this.hl({row:t,column:e},i)},kl:function(t){var e=this.nl(t.row);return e.$count++,e[t.column]=!0,t.row},unselect:function(t,e){this.ll({row:t,column:e})},ml:function(t){var e=this.nl(t.row);return e.$count--,e[t.column]=!1,e.$count<=0&&this.data.removeMark(t.row,"webix_selected"),t.row
},mapSelection:function(t){return this.pl(t,!1,!1)},ol:function(t,e){return this.selectRange(t.row,t.column,e.row,e.column)},selectRange:function(t,e,i,s){var n=this.getIndexById(t),r=this.getIndexById(i),a=this.getColumnIndex(e),h=this.getColumnIndex(s);if(n>r){var o=n;n=r,r=o}if(a>h){var o=a;a=h,h=o
}this.Dg=!0;for(var l=n;r>=l;l++)for(var c=a;h>=c;c++)this.select(this.getIdByIndex(l),this.columnId(c),!0);this.Dg=!1,this.jl()}},column:{Lk:" webix_column_select",fl:function(t){return t.column},ok:function(){return this.column},select:function(t,e){this.hl({column:t},e)},kl:function(t){this.s.columns[this.getColumnIndex(t.column)].$selected=!0,this.Dg||this.Kj()
},unselect:function(t){this.ll({column:t})},ml:function(t){this.s.columns[this.getColumnIndex(t.column)].$selected=null,this.Kj()},mapSelection:function(t){return this.pl(t,!0,!1)},ol:function(t,e){return this.selectRange(t.column,e.column)},selectRange:function(t,e){var i=this.getColumnIndex(t),s=this.getColumnIndex(e);
if(i>s){var n=i;i=s,s=n}this.Dg=!0;for(var r=i;s>=r;r++)this.select(this.columnId(r),!0);this.Dg=!1,this.Kj(),this.jl()}}}}),webix.extend(webix.ui.datatable,{blockselect_setter:function(t){return t&&this.ql&&(webix.event(this.x,"mousemove",this.rl,this),webix.event(this.x,"mousedown",this.sl,this),webix.event(document.body,"mouseup",this.tl,this),this.ql=this.ul=this.vl=!1),t
},ql:!0,wl:function(t,e){for(var i=t.target||t.srcElement;i;){if(i.getAttribute&&i.getAttribute("webixignore"))return!1;if(i==e)return!0;i=i.parentNode}return!1},sl:function(t){if(this.wl(t,this.Vf)){this.xl=webix.html.offset(this.Vf);var e=webix.html.pos(t);this.ul=[e.x-this.xl.x,e.y-this.xl.y]}},tl:function(){if(this.yl){var t=this.zl.apply(this,this.ul),e=this.zl.apply(this,this.vl);
t.row&&e.row&&this.ol(t,e),this.yl=webix.html.remove(this.yl)}this.ul=this.vl=!1},Al:function(){this.clearSelection(),this.yl=webix.html.create("div",{"class":"webix_block_selection"},""),this.Vf.appendChild(this.yl)},rl:function(t){if(this.ul!==!1){var e=webix.html.pos(t),i=[e.x-this.xl.x,e.y-this.xl.y];
if(Math.abs(this.ul[0]-i[0])<5&&Math.abs(this.ul[1]-i[1])<5)return;this.vl===!1&&this.Al(t),this.vl=i,this.Bl(this.ul[0],this.ul[1],this.vl[0],this.vl[1])}},Bl:function(t,e,i,s){var n=this.yl.style,r=Math.min(t,i),a=Math.max(t,i),h=Math.min(e,s),o=Math.max(e,s);n.left=r+"px",n.top=h+"px",n.width=a-r+"px",n.height=o-h+"px"
},zl:function(t,e){this.ek&&t>this.dk+this.Yj?t+=this.Zj.getSize()-this.Yj-this.dk-this.ek:(!this.dk||t>this.dk)&&(t+=this.Zj.getScroll()),e+=this.getScrollState().y;var i=null,s=null;0>t&&(t=0),0>e&&(e=0);for(var n=this.s.columns,r=this.data.order,a=0,h=0;h<n.length;h++)if(a+=n[h].width,a>=t){s=n[h].id;
break}if(s||(s=n[n.length-1].id),a=0,this.s.fixedRowHeight)i=r[Math.floor(e/this.s.rowHeight)];else for(var h=0;h<r.length;h++)if(a+=this.Uj(h),a>=e){i=r[h];break}return i||(i=r[r.length-1]),{row:i,column:s}}}),webix.protoUI({name:"resizearea",defaults:{dir:"x"},$init:function(t){var e=t.dir||"x",i=webix.toNode(t.container),s="x"==e?"width":"height",n=t.margin?t.margin+"px":0;
this.Cl="x"==e?"left":"top",this.x=webix.html.create("DIV",{"class":"webix_resize_area webix_dir_"+e}),webix.event(this.x,webix.env.mouse.down,webix.html.stopEvent),n&&(n="x"==e?n+" 0 "+n:"0 "+n+" 0 "+n),this.Dl=webix.html.create("DIV",{"class":"webix_resize_handle_"+e,style:n?"padding:"+n:""},"<div class='webix_handle_content'></div>"),this.El=webix.html.create("DIV",{"class":"webix_resize_origin_"+e}),t[s]&&(this.El.style[s]=t[s]+(t.border?1:0)+"px",this.Dl.style[s]=t[s]+"px"),t.cursor&&(this.Dl.style.cursor=this.El.style.cursor=this.x.style.cursor=t.cursor),this.Fl=webix.event(i,webix.env.mouse.move,this.Gl,this),this.Hl=webix.event(document.body,webix.env.mouse.up,this.Il,this),this.Dl.style[this.Cl]=this.El.style[this.Cl]=t.start+"px",i.appendChild(this.x),i.appendChild(this.Dl),i.appendChild(this.El)
},Il:function(){this.callEvent("onResizeEnd",[this.Jl]),webix.eventRemove(this.Fl),webix.eventRemove(this.Hl),webix.html.remove(this.x),webix.html.remove(this.Dl),webix.html.remove(this.El),this.x=this.Dl=this.El=null},Gl:function(t){var e=webix.html.pos(t);this.Jl=("x"==this.s.dir?e.x:e.y)+this.s.start-this.s.eventPos,this.Dl.style[this.Cl]=this.Jl+"px",this.callEvent("onResize",[this.Jl])
}},webix.EventSystem,webix.Settings),webix.extend(webix.ui.datatable,{resizeRow_setter:function(t){return this.s.scrollAlignY=!1,this.s.fixedRowHeight=!1,this.resizeColumn_setter(t)},resizeColumn_setter:function(t){return t&&this.Kl&&(webix.event(this.x,"mousemove",this.Ll,this),webix.event(this.x,"mousedown",this.Ml,this),webix.event(this.x,"mouseup",this.Nl,this),this.Kl=!1),t
},Kl:!0,Ml:function(t){this.Ol&&(this.Pl=[webix.html.pos(t),this.Ol[2]],webix.html.denySelect())},Nl:function(){this.Pl=!1,webix.html.allowSelect()},Ql:function(t){if(t=t||event,!this.Rl){var e=this.Ol[0],i=this.Pl[1],s=this.pk(i);if(s){var n,r=this.Pl[0];if("x"==e?(n=webix.html.offset(i).x+this.Ol[1]-webix.html.offset(this.Vf).x,r=r.x,this.Ol[1]||(s.cind-=i.parentNode.colSpan||1)):(n=webix.html.offset(i).y+this.Ol[1]-webix.html.offset(this.Vf).y+this.$g,r=r.y,this.Ol[1]||s.rind--),s.cind>=0&&s.rind>=0){this.Rl=[e,s,n];
var a=new webix.ui.resizearea({container:this.x,dir:e,eventPos:r,start:n,cursor:("x"==e?"e":"n")+"-resize"});a.attachEvent("onResizeEnd",webix.bind(this.Sl,this))}this.Ml=this.Ol=!1}}},Sl:function(t){if(this.Rl){var e=this.Rl[0],i=this.Rl[1],s=t-this.Rl[2];if("x"==e){this.s.rightSplit&&i.cind+1>=this.Fj&&i.cind!==this.fj.length-1&&(i.cind++,s*=-1);
var n=this.fj[i.cind].width;this.Xs(i.cind,n+s)}else{var r=this.getIdByIndex(i.rind),a=this.getItem(r).$height||this.s.rowHeight;this.setRowHeight(r,a+s)}this.Nl()}this.Rl=null},Ll:function(t){if(this.Ol&&this.Pl)return this.Ql(t);t=t||event;var e=t.target||t.srcElement,i=!1;if("TD"!=e.tagName&&"TABLE"!=e.tagName){var s=e.className||"",n=-1!=s.indexOf("webix_cell");
if(!n||!this.config.drag){var r=-1!=s.indexOf("webix_hcell");if(this.Ol=!1,n||r){var a=e.offsetWidth,h=e.offsetHeight,o=webix.html.posRelative(t);n&&this.s.resizeRow&&(o.y<3?(this.Ol=["y",0,e],i="n-resize"):h-o.y<4&&(this.Ol=["y",h,e],i="n-resize")),this.s.resizeColumn&&(o.x<3?(this.Ol=["x",0,e],i="e-resize"):a-o.x<4&&(this.Ol=["x",a,e],i="e-resize"))
}this.Tl&&window.clearTimeout(this.Tl),this.Tl=webix.delay(this.Ul,this,[i],i?100:0)}}},Ul:function(t){this.Vl!=t&&(this.Vl=t,this.x.style.cursor=t||"default")}}),webix.extend(webix.ui.datatable,webix.PagingAbility),webix.csv={escape:!0,delimiter:{rows:"\n",cols:"	"},parse:function(t,e){if(e=e||this.delimiter,!this.escape)return this.Wl(t,e);
for(var i=t.replace(/\n$/,"").split(e.rows),s=0;s<i.length-1;)this.Xl(i[s],'"')%2===1&&(i[s]+=e.rows+i[s+1],delete i[s+1],s++),s++;var n=[];for(s=0;s<i.length;s++)if("undefined"!=typeof i[s]){for(var r=i[s].split(e.cols),a=0;a<r.length;a++)0===r[a].indexOf('"')&&(r[a]=r[a].substr(1,r[a].length-2)),r[a]=r[a].replace('""','"');
n.push(r)}return n},Wl:function(t,e){for(var i=t.split(e.rows),s=0;s<i.length;s++)i[s]=i[s].split(e.cols);return i},Xl:function(t,e){var i=t.split(e);return i.length-1},stringify:function(t,e){if(e=e||this.delimiter,!this.escape){for(var i=0;i<t.length;i++)t[i]=t[i].join(e.cols);return t.join(e.rows)
}for(var s=/\n|\"|;|,/,i=0;i<t.length;i++){for(var n=0;n<t[i].length;n++)s.test(t[i][n])&&(t[i][n]=t[i][n].replace(/"/g,'""'),t[i][n]='"'+t[i][n]+'"');t[i]=t[i].join(e.cols)}return t=t.join(e.rows)}},webix.TablePaste={clipboard_setter:function(t){return(t===!0||1===t)&&(this.s.clipboard="block"),webix.clipbuffer.init(),this.attachEvent("onSelectChange",this.Yl),this.attachEvent("onPaste",this.Zl),t
},Yl:function(){if(!this.getEditor||!this.getEditor()){var t=this.$l();webix.clipbuffer.set(t),webix.UIManager.setFocus(this)}},$l:function(){var t=[];return this.mapSelection(function(e,i,s,n){return t[n]||(t[n]=[]),t[n].push(e),e}),webix.csv.stringify(t,this.s.delimiter)},Zl:function(t){if(!webix.isUndefined(this.rh[this.s.clipboard])){var e=webix.csv.parse(t,this.s.delimiter);
this.rh[this.s.clipboard].call(this,e)}},rh:{block:function(t){var e=this.mapSelection(null);e&&(this.mapCells(e.row,e.column,t.length,null,function(e,i,s,n,r){return t[n]&&t[n].length>r?t[n][r]:e}),this.render())},selection:function(t){this.mapSelection(function(e,i,s,n,r){return t[n]&&t[n].length>r?t[n][r]:e
}),this.render()},repeat:function(t){this.mapSelection(function(e,i,s,n,r){return i=t[n%t.length],e=i[r%i.length]}),this.render()},custom:function(){}}},webix.extend(webix.ui.datatable,webix.TablePaste),function(){function t(t,n){var r=i(t,n),a='<rows profile="color">';return a+=e("header","head",t,r),t.config.footer&&(a+=e("footer","foot",t,r)),a+=s(t,r,n),a+="</rows>"
}function e(t,e,i,s){for(var n="<"+e+">",r=1,a=0;a<s.length;a++)s[a][t]&&s[a][t].length>r&&(r=s[a][t].length);for(var a=0;r>a;a++){n+="<columns>";for(var h=0;h<s.length;h++){var o=s[h];n+="<column",n+=o.width?' width="'+o.width+'"':"";var l=o[t][a];n+=l&&l.colspan?' colspan="'+l.colspan+'"':"",n+=l&&l.rowspan?' rowspan="'+l.rowspan+'"':"",n+=o.exportAsTree?' type="tree"':"",n+=' align="left"',n+="><![CDATA[",n+=(o[t][a]?o[t][a].text:"").replace(/<[^>]*>/g," "),n+="]]></column>"
}n+="</columns>"}return n+="</"+e+">"}function i(t,e){function i(t,e){var i=t?webix.clone(t):{};"object"==typeof e&&webix.extend(i,e,!0),s.push(i)}var s=[],n=e.columns;if(e.id&&s.push({id:"id",width:50,header:[{text:"ID"}],footer:[""]}),n)for(var r in n)i(t.getColumnConfig(r),n[r]);else for(var a=t.s.columns,h=0;h<a.length;h++)i(a[h]);
return s}function s(t,e,i){for(var s="",n=t.data,r=0;r<n.order.length;r++){var a=n.order[r],h=n.pull[a];if(!i.level||i.level==h.$level){var o=h.$level?' level="'+(h.$level-1)+'"':"";s+='<row id="'+a+'"'+o+">";for(var l=0;l<e.length;l++){var c=t.Ek(h,e[l],r);s+="<cell><![CDATA["+(null!==c&&c!==webix.undefined?c.toString().replace(/<[^>]*>/g,""):"")+"]]></cell>"
}s+="</row>"}}return s}function n(t,e){webix.send(t,{grid_xml:encodeURI(e)},null,"_blank")}webix.extend(webix.ui.datatable,{exportToPDF:function(e,i){var s=t(this,i||{});e=e||"http://webix-export.appspot.com/export/pdf",n(e,s)},exportToExcel:function(e,i){var s=t(this,i||{});e=e||"http://webix-export.appspot.com/export/excel",n(e,s)
}})}(),webix.storage||(webix.storage={}),webix.storage.local={put:function(t,e){t&&window.JSON&&window.localStorage&&window.localStorage.setItem(t,window.JSON.stringify(e))},get:function(t){if(t&&window.JSON&&window.localStorage){var e=window.localStorage.getItem(t);return e?webix.DataDriver.json.toObject(e):null
}return null},remove:function(t){t&&window.JSON&&window.localStorage&&window.localStorage.removeItem(t)},clear:function(){window.localStorage.clear()}},webix.storage.session={put:function(t,e){t&&window.JSON&&window.sessionStorage&&window.sessionStorage.setItem(t,window.JSON.stringify(e))},get:function(t){if(t&&window.JSON&&window.sessionStorage){var e=window.sessionStorage.getItem(t);
return e?webix.DataDriver.json.toObject(e):null}return null},remove:function(t){t&&window.JSON&&window.sessionStorage&&window.sessionStorage.removeItem(t)},clear:function(){window.sessionStorage.clear()}},webix.storage.cookie={put:function(t,e,i,s){t&&window.JSON&&(document.cookie=t+"="+window.JSON.stringify(e)+(s&&s instanceof Date?";expires="+s.toUTCString():"")+(i?";domain="+i:""))
},_l:function(t){for(var e=document.cookie.split(";"),i="",s="",n="",r=!1,a=0;a<e.length;a++){if(i=e[a].split("="),s=i[0].replace(/^\s+|\s+$/g,""),s==t)return r=!0,i.length>1&&(n=unescape(i[1].replace(/^\s+|\s+$/g,""))),n;i=null,s=""}return null},get:function(t){if(t&&window.JSON){var e=this._l(t);return e?webix.DataDriver.json.toObject(e):null
}return null},remove:function(t,e){t&&this._l(t)&&(document.cookie=t+"="+(e?";domain="+e:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT")},clear:function(t){for(var e=document.cookie.split(";"),i=0;i<e.length;i++)document.cookie=/^[^=]+/.exec(e[i])[0]+"="+(t?";domain="+t:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"
}},webix.DataState={getState:function(){for(var t=this.config.columns.length,e=this.config.columns,i={ids:[],size:[],select:this.getSelectedId(!0),scroll:this.getScrollState()},s=0;t>s;s++)i.ids.push(e[s].id),i.size.push(e[s].width);if(this.Nk&&(i.sort={id:this.Nk,dir:this.Ok}),this.ij){var n={},r=0;
for(var a in this.ij)if(!this.am[a]){var h=this.ij[a];h[1].value=n[a]=h[2].getValue(h[0]),r=1}r&&(i.filter=n)}i.hidden=[];for(var a in this.am)i.hidden.push(a);return i},setState:function(t){var e=this.config.columns;if(t){if(this.Nk=null,this.blockEvent(),t.hidden){for(var i={},s=0;s<t.hidden.length;s++)i[t.hidden[s]]=!0,this.bm.length||this.hideColumn(t.hidden[s]);
if(this.bm.length)for(var s=0;s<this.bm.length;s++){var n=this.bm[s];!!i[n]==!this.am[n]&&this.hideColumn(n,!!i[n])}}if(t.ids){for(var r=!1,a=this.config.columns,s=0;s<a.length;s++)a[s].id!=t.ids[s]&&(r=!0);if(r){for(var s=0;s<t.ids.length;s++)a[s]=this.getColumnConfig(t.ids[s])||a[s];this.refreshColumns()
}}if(t.size)for(var h=Math.min(t.size.length,e.length),s=0;h>s;s++)e[s]&&e[s].width!=t.size[s]&&this.Xs(s,t.size[s],!0);if(t.filter)for(var o in this.ij){var l=this.ij[o];l[2].setValue(l[0],"")}if(this.unblockEvent(),this.rk(!0),this.callEvent("onStructureUpdate",[]),t.sort){var c=e[this.getColumnIndex(t.sort.id)];
c&&this.zf(t.sort.id,t.sort.dir,c.sort)}if(t.filter){for(var o in t.filter){var u=t.filter[o];if(u&&this.ij[o]){var l=this.ij[o];l[2].setValue(l[0],u);var d=l[1].contentId;d&&(this.hj[d].value=u)}}this.filterByAll()}if(t.select&&this.select){var f=t.select;this.unselect();for(var s=0;s<f.length;s++)(!f[s].row||this.exists(f[s].row))&&this.hl(f[s],!0)
}t.scroll&&this.scrollTo(t.scroll.x,t.scroll.y)}}},webix.extend(webix.ui.datatable,webix.DataState),function(){var t=webix.Touch={config:{longTouchDelay:1e3,scrollDelay:150,gravity:500,deltaStep:30,speed:"0ms",finish:1500,ellastic:!0},limit:function(e){t.cm=e!==!1},disable:function(){t.Xf=!0},enable:function(){t.Xf=!1
},$init:function(){t.$init=function(){},webix.event(document.body,e.down,t.dm),webix.event(document.body,e.move,t.em),webix.event(document.body,e.up,t.fm),webix.event(document.body,"dragstart",function(t){return webix.html.preventEvent(t)}),webix.event(document.body,"touchstart",function(e){if(!t.Xf&&!t.cm&&webix.env.isSafari){var i=e.srcElement.tagName.toLowerCase();
return"input"==i||"textarea"==i||"select"==i||"label"==i?!0:(t.im=!0,webix.html.preventEvent(e))}}),t.Of(),t.jm=[null,null],t.$active=!0},Of:function(){t.km=t.lm=t.mm=null,t.nm=t.om=t.pm=this.qm=null,t.rm={sm:0,tm:0,um:0},t.vm&&(webix.html.removeCss(t.vm,"webix_touch"),t.vm=null),window.clearTimeout(t.wm),t.xm=!0,t.ym=!0,t.zm=!0,t.Am||t.Pf()
},fm:function(e){if(t.km){if(t.nm){var i=t.Mf(t.om),s=i.e,n=i.f,r=t.config.finish,a=t.Bm(e,!0),h=webix.$$(t.om),o=h&&h.$scroll?h.$scroll.gravity:t.config.gravity;if(a.um){var l=s+o*a.sm/a.um,c=n+o*a.tm/a.um,u=t.jm[0]?t.Cm(l,!1,!1,t.pm.dx,t.pm.px):s,d=t.jm[1]?t.Cm(c,!1,!1,t.pm.dy,t.pm.py):n,f=Math.max(Math.abs(u-s),Math.abs(d-n));
150>f&&(r=r*f/150),(u!=s||d!=n)&&(r=Math.round(r*Math.max((u-s)/(l-s),(d-n)/(c-n))));var b={e:u,f:d},h=webix.$$(t.om);h&&h.adjustScroll&&h.adjustScroll(b),r=Math.max(100,r),s!=b.e||n!=b.f?(t.Nf(t.om,b.e,b.f,r+"ms"),t.Dm&&t.Dm.Em(b.e,b.f,r+"ms"),t.Fm(b.e,b.f,r+"ms")):t.Pf()}else t.Pf()}else if(!this.qm)if(t.zm&&!t.ym)t.Gm("onSwipeX");
else if(t.ym&&!t.zm)t.Gm("onSwipeY");else if(webix.env.isSafari&&t.im){t.im=!1;var x=t.km.target;webix.delay(function(){var t=document.createEvent("MouseEvents");t.initEvent("click",!0,!0),x.dispatchEvent(t)})}t.Gm("onTouchEnd"),t.Of()}},em:function(e){if(t.km){var i=t.Bm(e);if(t.Gm("onTouchMove"),t.nm)t.Hm(i);
else if(t.ym=t.Im(i.Jm,"x",t.ym),t.zm=t.Im(i.Ei,"y",t.zm),t.nm){var s=t.Km("onBeforeScroll");if(s){var n={};s.callEvent("onBeforeScroll",[n]),n.update&&(t.config.speed=n.speed,t.config.scale=n.scale)}t.Lm(i)}return webix.html.preventEvent(e)}},Hm:function(){if(t.om){var e=t.Mf(t.om),i=(e.e,e.f,t.mm||t.km),s=webix.$$(t.om),n=s&&s.$scroll?s.$scroll.ellastic:t.config.ellastic;
t.jm[0]&&(e.e=t.Cm(e.e-i.x+t.lm.x,n,e.e,t.pm.dx,t.pm.px)),t.jm[1]&&(e.f=t.Cm(e.f-i.y+t.lm.y,n,e.f,t.pm.dy,t.pm.py)),t.Nf(t.om,e.e,e.f,"0ms"),t.Dm&&t.Dm.Em(e.e,e.f,"0ms"),t.Fm(e.e,e.f,"0ms")}},Fm:function(e,i,s){var n=t.pm.px/t.pm.dx*-e,r=t.pm.py/t.pm.dy*-i;t.jm[0]&&t.Nf(t.jm[0],n,0,s),t.jm[1]&&t.Nf(t.jm[1],0,r,s)
},scrollTo:function(e,i,s,n){t.Nf(e,i,s,n)},Nf:function(e,i,s,n){if(!t.tt&&window.setAnimationFrame&&window.setAnimationFrame(function(){return t.tt=!0,t.Nf(e,i,s,n)}),t.tt=null,t.Am=!0,e){var r=t.config.translate||webix.env.translate;e.style[webix.env.transform]=r+"("+Math.round(i)+"px, "+Math.round(s)+"px"+("translate3d"==r?", 0":"")+")",e.style[webix.env.transitionDuration]=n
}},Mf:function(e){var i,s=window.getComputedStyle(e)[webix.env.transform];if("none"==s)i={e:0,f:0};else if(window.WebKitCSSMatrix)i=new WebKitCSSMatrix(s);else if(window.MSCSSMatrix)i=new MSCSSMatrix(s);else{var n=s.replace(/(matrix\()(.*)(\))/gi,"$2");n=n.replace(/\s/gi,""),n=n.split(",");for(var i={},r=["a","b","c","d","e","f"],a=0;a<r.length;a++)i[r[a]]=parseInt(n[a],10)
}return t.Dm&&t.Dm.Mm(i),i},Cm:function(t,e,i,s,n){if(t===i)return t;var r=Math.abs(t-i),a=r/(t-i);if(t>0)return e?i+a*Math.sqrt(r):0;var h=s-n;return 0>h+t?e?i-Math.sqrt(-(t-i)):-h:t},Nm:function(e){if(!e.scroll_enabled){e.scroll_enabled=!0,e.parentNode.style.position="relative";var i=webix.env.cssPrefix;
e.style.cssText+=i+"transition: "+i+"transform; "+i+"user-select:none; "+i+"transform-style:flat;",e.addEventListener(webix.env.transitionEnd,t.Pf,!1)}},Lm:function(){-1!=t.nm.indexOf("x")&&(t.jm[0]=t.Om("x",t.pm.dx,t.pm.px,"width")),-1!=t.nm.indexOf("y")&&(t.jm[1]=t.Om("y",t.pm.dy,t.pm.py,"height")),t.Nm(t.om),window.setTimeout(t.Hm,1)
},Om:function(e,i,s,n){if(2>i-s){var r=t.Mf(t.om),a="y"==e?r.e:0,h="y"==e?0:r.f;return t.Dm||t.Nf(t.om,a,h,"0ms"),t.nm=t.nm.replace(e,""),""}var o=webix.html.create("DIV",{"class":"webix_scroll_"+e},"");return o.style[n]=Math.max(s*s/i-7,10)+"px",t.om.parentNode.appendChild(o),o},Im:function(e,i,s){return e>t.config.deltaStep?(t.xm&&(t.Pm(i),t.pk(i),-1==(t.nm||"").indexOf(i)&&(t.nm="")),!1):s
},Pf:function(){var e,i,s;s=webix.$$(t.om||this),s&&(t.om?e=t.Mf(t.om):s.getScrollState&&(i=s.getScrollState(),e={e:i.x,f:i.y}),webix.callEvent("onAfterScroll",[e]),s.callEvent&&s.callEvent("onAfterScroll",[e])),t.nm||(webix.html.remove(t.jm),t.jm=[null,null]),t.Am=!1},Pm:function(){window.clearTimeout(t.wm),t.xm=!1
},Qm:function(e){return t.jm[0]||t.jm[1]?void t.Rm(e,t.jm[0]?"x":"y"):!0},dm:function(i){var s=i.target||event.srcElement;if(!(t.Xf||s.tagName&&"textarea"==s.tagName.toLowerCase()&&s.offsetHeight<s.scrollHeight)){t.km=e.context(i);var n=webix.$$(i);if(!(!t.cm||t.Sm()||n&&n.$touchCapture))return t.Qm(i),void(t.km=null);
t.Gm("onTouchStart"),t.Qm(i)&&(t.wm=window.setTimeout(t.Tm,t.config.longTouchDelay)),!n||!n.touchable||s.className&&0===s.className.indexOf("webix_view")||(t.vm=n.getNode(i),webix.html.addCss(t.vm,"webix_touch"))}},Tm:function(){t.km&&(t.Gm("onLongTouch"),webix.callEvent("onClick",[t.km]),t.qm=!0)},Rm:function(i,s){t.pk(s);
var n=t.jm[0]||t.jm[1];if(n){var r=t.Km("onBeforeScroll");r&&r.callEvent("onBeforeScroll",[t.km,t.lm])}!n||t.om&&n.parentNode==t.om.parentNode||(t.Of(),t.Pf(),t.km=e.context(i)),t.em(i)},Bm:function(i){return t.mm=t.lm,t.lm=e.context(i),t.rm.Jm=Math.abs(t.km.x-t.lm.x),t.rm.Ei=Math.abs(t.km.y-t.lm.y),t.mm&&(t.lm.time-t.mm.time<t.config.scrollDelay?(t.rm.sm=t.rm.sm/1.3+t.lm.x-t.mm.x,t.rm.tm=t.rm.tm/1.3+t.lm.y-t.mm.y):t.rm.tm=t.rm.sm=0,t.rm.um=t.rm.um/1.3+(t.lm.time-t.mm.time)),t.rm
},Um:function(e){t.pm={dx:e.offsetWidth,dy:e.offsetHeight,px:e.parentNode.offsetWidth,py:e.parentNode.offsetHeight}},Sm:function(e){var i=t.km.target;if(!webix.env.touch&&!webix.env.transition&&!webix.env.transform)return null;for(;i&&"BODY"!=i.tagName;){if(i.getAttribute){var s=i.getAttribute("touch_scroll");
if(s&&(!e||-1!=s.indexOf(e)))return[i,s]}i=i.parentNode}return null},pk:function(e){var i=this.Sm(e);return i&&(t.nm=i[1],t.om=i[0],t.Um(i[0])),i},Gm:function(e){webix.callEvent(e,[t.km,t.lm]);var i=t.Km(e);i&&i.callEvent(e,[t.km,t.lm])},Km:function(e){var i=webix.$$(t.km);if(!i)return null;for(;i;){if(i.hasEvent&&i.hasEvent(e))return i;
i=i.getParentView()}return null},gm:function(e){if(!e.touches[0]){var i=t.lm;return i.time=new Date,i}return{target:e.target,x:e.touches[0].pageX,y:e.touches[0].pageY,time:new Date}},hm:function(t){return{target:t.target||t.srcElement,x:t.pageX,y:t.pageY,time:new Date}}};webix.ready(function(){webix.env.touch&&(t.$init(),window.MSCSSMatrix&&webix.html.addStyle(".webix_view{ -ms-touch-action: none; }"))
});var e=webix.env.mouse={down:"mousedown",up:"mouseup",move:"mousemove",context:t.hm};window.navigator.pointerEnabled?(e.down="pointerdown",e.move="pointermove",e.up="pointerup"):window.navigator.msPointerEnabled?(e.down="MSPointerDown",e.move="MSPointerMove",e.up="MSPointerUp"):webix.env.touch&&(e.down="touchstart",e.move="touchmove",e.up="touchend",e.context=t.gm)
}(),webix.attachEvent("onDataTable",function(t,e){webix.env.touch&&(webix.Touch.$init(),e.scrollSize=0,webix.extend(t,e.prerender===!0?t.Vm:t.Wm),webix.Touch.Xf&&webix.Touch.limit(),t.defaults.scrollAlignY=!1,t.Vf.setAttribute("touch_scroll","xy"),t.$ready.push(function(){var t="",e=this.s;e.autowidth||e.scrollX===!1||(t+="x"),e.autoheight||e.scrollY===!1||(t+="y"),this.Vf.setAttribute("touch_scroll",t)
}),webix.Touch.Nm(t.Vf.childNodes[1].firstChild),webix.Touch.Nf(t.Vf.childNodes[1].firstChild,0,0,"0ms"),t.Em(0,0,"0ms"))}),webix.extend(webix.ui.datatable,{Vm:{$j:function(t,e){webix.Touch.Nf(this.Vf.childNodes[1].firstChild,0,0,"0ms"),this.Em(t,e,"0ms")},_j:function(){var t=webix.Touch.Mf(this.Vf.childNodes[1].firstChild);
return{x:-t.e,y:-t.f}},$init:function(){this.attachEvent("onBeforeScroll",function(){webix.Touch.om=this.Vf.childNodes[1].firstChild,webix.Touch.Um(webix.Touch.om),webix.Touch.Dm=this}),this.attachEvent("onTouchEnd",function(){webix.Touch.Dm=null})},Em:function(t,e,i){this.s.leftSplit&&webix.Touch.Nf(this.Vf.childNodes[0].firstChild,0,e,i),this.s.rightSplit&&webix.Touch.Nf(this.Vf.childNodes[2].firstChild,0,e,i),this.s.header&&webix.Touch.Nf(this.I.childNodes[1].firstChild,t,0,i),this.s.footer&&webix.Touch.Nf(this.cj.childNodes[1].firstChild,t,0,i),this.callEvent("onSyncScroll",[t,e,i])
},Mm:function(){}},Wm:{$j:function(t,e){webix.delay(function(){this.callEvent("onAfterScroll",[{e:-t,f:-e}])},this)},$scroll:{gravity:0,elastic:!1},$init:function(){this.attachEvent("onBeforeScroll",function(){var t=webix.Touch;t.om=this.Vf.childNodes[1].firstChild,t.Um(t.om),t.pm.dy=this.wj,t.Dm=this
}),this.attachEvent("onAfterScroll",function(t){webix.Touch.Dm=null,webix.Touch.$m=null,this.jk=0;var e=webix.Touch.config.translate;return webix.Touch.config.translate="translate",this.Em(t.e,0,"0ms"),webix.Touch.config.translate=e,this.bk=-t.e,this.jk=-t.f,this.render(),!1})},Em:function(t,e,i){e+=this.jk,webix.Touch.Nf(this.Vf.childNodes[1].firstChild,t,e,i),this.s.leftSplit&&webix.Touch.Nf(this.Vf.childNodes[0].firstChild,0,e,i),this.s.rightSplit&&webix.Touch.Nf(this.Vf.childNodes[2].firstChild,0,e,i),this.s.header&&webix.Touch.Nf(this.I.childNodes[1].firstChild,t,0,i),this.s.footer&&webix.Touch.Nf(this.cj.childNodes[1].firstChild,t,0,i),this.callEvent("onSyncScroll",[t,e,i])
},Mm:function(t){t.f-=this.jk}}}),webix.extend(webix.ui.datatable,{$init:function(){this.data.attachEvent("onStoreLoad",webix.bind(this._m,this)),this.attachEvent("onStructureLoad",this._m),this.attachEvent("onStructureUpdate",this.an),this.attachEvent("onResize",this.an)},_m:function(){if(this.count()){for(var t=!1,e=this.fj,i=0;i<e.length;i++)e[i].adjust&&(t=this.bn(i,e[i].adjust,!0)||t);
t&&this.rk()}},an:function(){var t=this.s.columns,e=[],i=0;if(t&&!this.s.autowidth)for(var s=0;s<t.length;s++){var n=t[s].fillspace;n&&(e[s]=n,i+=1*n||1)}i&&this.cn(e,i)},cn:function(t,e){var i=this.s.columns;if(i){for(var s=this.bc-this.oj,n=!1,r=0;r<i.length;r++)t[r]||(s-=i[r].width||this.config.columnWidth);
if(s>0)for(var r=0;r<t.length;r++)if(t[r]){var a=Math.min(s,Math.round(s*t[r]/e));n=this.Xs(r,a,!0)||n,s-=i[r].width,e-=t[r]}n&&this.rk(!0)}},dn:function(t,e){var i=webix.html.create("DIV",{"class":"webix_view webix_table_cell webix_measure_size webix_cell"},"");i.style.cssText="width:1px; visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;",document.body.appendChild(i);
var s=this.s.columns[t],n=-1/0;if("header"!=e)for(var r=0;r<this.data.order.length;r++){var a=this.getItem(this.data.order[r]),h=this.Ek(a,s,r);i.innerHTML=h,n=Math.max(i.scrollWidth,n)}if(e&&"data"!=e)for(var r=0;r<s.header.length;r++){var o=s.header[r];o&&(i.innerHTML=o.text,n=Math.max(i.scrollWidth,n))
}return i=webix.html.remove(i),n+1+(webix.env.isIE?webix.skin.$active.layoutPadding.space:0)},bn:function(t,e,i){if(t>=0){var s=this.dn(t,e);return this.Xs(t,s,i)}},adjustColumn:function(t,e){this.bn(this.getColumnIndex(t),e)},adjustRowHeight:function(t,e){var i=this.getColumnConfig(t),s=(this.data.count(),webix.html.create("DIV",{"class":"webix_table_cell webix_measure_size webix_cell"},""));
s.style.cssText="width:"+i.width+"px; height:1px; visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden;",this.$view.appendChild(s),this.data.each(function(t){t&&(s.innerHTML=this.Ek(t,i,0),t.$height=Math.max(s.scrollHeight,this.s.rowHeight))},this),s=webix.html.remove(s),e||this.refresh()
}}),webix.extend(webix.ui.datatable,{math_setter:function(t){return t&&this.en(),t},fn:"$",en:function(){webix.env.strict||(this.data.attachEvent("onStoreUpdated",webix.bind(this.gn,this)),this.data.attachEvent("onStoreLoad",webix.bind(this.hn,this)),this.attachEvent("onStructureLoad",this.hn))},gn:function(t,e,i){if(t&&"delete"!=i&&"paint"!=i){"add"==i&&this.pn(e);
for(var s=0;s<this.fj.length;s++)this.jn(t,this.fj[s].id,"add"!==i)}},jn:function(t,e,i){var s,n=this.getItem(t);if(i===!0?s=n[this.fn+e]||n[e]:(s=n[e],this.kn={}),"undefined"!=typeof s&&null!==s&&(s.length>0&&"="===s.substr(0,1)?(("undefined"==typeof n[this.fn+e]||i!==!0)&&(n[this.fn+e]=n[e]),n[e]=this.ln(s,t,e)):("undefined"!=typeof n[this.fn+e]&&delete n[this.fn+e],this.mn(t,e)),"undefined"!=typeof n.depends&&"undefined"!=typeof n.depends[e]))for(var r in n.depends[e]){var a=n.depends[e][r][0]+"__"+n.depends[e][r][1];
"undefined"==typeof this.kn[a]&&(this.kn[a]=!0,this.jn(n.depends[e][r][0],n.depends[e][r][1],!0))}},nn:function(t,e){var i=this.getItem(t);"undefined"!=typeof i[this.fn+e]&&(i[e]=i[this.fn+e])},hn:function(){if(this.fj&&this.count()){this.pn();for(var t=0;t<this.fj.length;t++){var e=this.columnId(t);
this.data.each(function(t){this.jn(t.id,e)},this)}}},pn:function(t){for(var e=0;e<this.fj.length;e++)if(this.fj[e].math){var i=this.columnId(e),s="="+this.fj[e].math;s=s.replace(/\$r/g,"#$r#"),s=s.replace(/\$c/g,"#$c#"),t?t[i]=this.qn(s,t.id,i):this.data.each(function(t){t[i]=this.qn(s,t.id,i)},this)
}},qn:function(t,e,i){return webix.template(t)({$r:e,$c:i})},rn:function(t,e){var i;if(!this.exists(t))return"#out_of_range";i=this.getItem(t);var s=i[this.fn+e]||i[e]||0;return s=s.toString(),"="!==s.substring(0,1)?s:("undefined"==typeof i[this.fn+e]&&(i[this.fn+e]=i[e]),i[e]=this.ln(s,t,e,!0),i[e])
},ln:function(t,e,i,s){if(s===!0){if(this.sn(e,i))return"#selfreference"}else this.tn();this.un(e,i);this.getItem(e);t=t.substring(1);var n=this.vn(t),r=this.wn(t);if(n)t=this.xn(t,r),t=this.yn(t,n);else{t=this.xn(t,r,!0);var r=[]}var a=this.zn(t);if(a!==!1)return a;this.An(e,i),this.mn(e,i);for(var h=0;h<r.length;h++)this.Bn([e,i],r[h]);
var a=this.zn(t);if(a!==!1)return a;if(!t)return t;t=this.Cn(t);var a=this.zn(t);return a!==!1?a:t},vn:function(t){var e=/(\+|\-|\*|\/)/g,i=t.replace(/\[[^)]*?\]/g,"").match(e);return i},wn:function(t){var e=/\[([^\]]+),([^\]]+)\]/g,i=t.match(e);null===i&&(i=[]);for(var s=0;s<i.length;s++){var n=i[s],r=n;
n=n.substr(1,n.length-2),n=n.split(","),n[0]=this.Dn(n[0]),n[1]=this.Dn(n[1]),":"===n[0].substr(0,1)&&(n[0]=this.getIdByIndex(n[0].substr(1))),":"===n[1].substr(0,1)&&(n[1]=this.columnId(n[1].substr(1))),n[2]=r,i[s]=n}return i},xn:function(t,e,i){var s="(",n=")";i&&(s=n="");for(var r=0;r<e.length;r++){var a=e[r],h=this.rn(a[0],a[1]);
isNaN(h)&&(h='"'+h+'"'),t=t.replace(a[2],s+h+n)}return t},yn:function(t,e){for(var i=[],s=0;s<e.length;s++){var n=e[s],r=this.En(t,n);i.push(r[0]),t=r[1]}i.push(t);for(var s=0;s<i.length;s++){var a=this.Dn(i[s]);i[s]=a}for(var h="",s=0;s<i.length-1;s++)h+=i[s]+e[s];return h+=i[i.length-1]},Cn:function(expr){try{webix.temp_value="",expr="webix.temp_value = "+expr,eval(expr)
}catch(ex){webix.temp_value=""}var result=webix.temp_value;return webix.temp_value=null,result.toString()},En:function(t,e){var i=t.indexOf(e),s=t.substr(0,i),n=t.substr(i+1);return[s,n]},Dn:function(t){return t=t.replace(/^ */g,""),t=t.replace(/ *$/g,"")},tn:function(){this.Fn=[]},un:function(t,e){this.Fn[t+"__"+e]=!0
},An:function(t,e){"undefined"!=typeof this.Fn[t+"__"+e]&&delete this.Fn[t+"__"+e]},sn:function(t,e){return"undefined"!=typeof this.Fn[t+"__"+e]?!0:!1},Bn:function(t,e){var i=this.getItem(e[0]);"undefined"==typeof i.depends&&(i.depends={}),"undefined"==typeof i.depends[e[1]]&&(i.depends[e[1]]={}),i.depends[e[1]][t[0]+"__"+t[1]]=t,i=this.getItem(t[0]),"undefined"==typeof i.triggers&&(i.triggers={}),"undefined"==typeof i.triggers[t[1]]&&(i.triggers[t[1]]={}),i.triggers[t[1]][e[0]+"__"+e[1]]=e
},mn:function(t,e){if(this.exists(t,e)){var i=this.getItem(t,e);if("undefined"!=typeof i.triggers)for(var s in i.triggers[e]){var n=i.triggers[e][s];delete this.getItem(n[0]).depends[n[1]][t+"__"+e]}}},zn:function(t){var e=/#\w+/,i=t.match(e);return null!==i&&i.length>0?i[0]:!1}}),webix.extend(webix.ui.datatable,{ii:function(t){return this.getColumnConfig(t.column).editor
},getEditor:function(t,e){return t?(1==arguments.length&&(e=t.column,t=t.row),(this.ai[t]||{})[e]):this.di},si:function(t){for(var e in this.ai){var i=this.ai[e];for(var s in i)"$count"!=s&&t.call(this,i[s])}},ji:function(t,e,i){var s=t.row,n=t.column,r=e.config=this.getColumnConfig(n);i!==!1&&this.showCell(s,n);
var a=e.render();e.$inline&&(a=this.mi(t)),e.node=a;var h,o=this.getItem(s),l=r.editFormat;return this.s.editMath&&(h=o["$"+n]),h=h||o[n],webix.isUndefined(h)&&(h=""),e.setValue(l?l(h):h,o),e.value=o[n],this.ni(t,e),e.$inline||this.oi(t,a,!0),e.afterRender&&e.afterRender(),this.s.liveValidation&&(webix.event(e.node,"keyup",this.Gn(t,this)),this.validateEditor(t)),a
},Gn:function(t,e){return function(){e.validateEditor(t)}},ti:function(t,e){var i=this.getColumnConfig(t.column).editParse,s=this.getItem(t.row);return s[t.column]=i?i(e):e,this.s.editMath&&delete s["$"+t.column],t.row},ni:function(t,e){var i=this.ai[t.row]=this.ai[t.row]||{};i.$count=(i.$count||0)+1,e.row=t.row,e.column=t.column,this.di=i[t.column]=e,this.Eb++,this.Hn=this.getScrollState()
},qi:function(t){this.di==t&&(this.di=0),t.destroy&&t.destroy();var e=this.ai[t.row];delete e[t.column],e.$count--,e.$count||delete this.ai[t.row],this.Eb--},ei:function(t,e){var i=this.ai[t];if(i){this.ai[e]=i,delete this.ai[t];for(var s in i)i[s].row=e}},pi:function(t){var e=this.getColumnConfig(t.column);
if(e&&e.node&&e.attached){var i=this.getIndexById(t.row);if(i>=e.qk&&i<e.Kk)return e.node.childNodes[i-e.qk]}return 0},editCell:function(t,e,i,s){return e=e||this.s.columns[0].id,webix.EditAbility.edit.call(this,{row:t,column:e},i,s)},editRow:function(t){t&&t.row&&(t=t.row);var e=!1;this.eachColumn(function(i){this.edit({row:t,column:i},e,!e),e=!0
})},editColumn:function(t){t&&t.column&&(t=t.column);var e=!1;this.eachRow(function(i){this.edit({row:i,column:t},e,!e),e=!0})},eachRow:function(t,e){var i=this.data.order;e&&(i=this.data.jf||i);for(var s=0;s<i.length;s++)t.call(this,i[s])},eachColumn:function(t,e){for(var i in this.Aj){var s=this.Aj[i];
t.call(this,s.id,s)}if(e)for(var i in this.am){var s=this.am[i];t.call(this,s.id,s)}},vi:function(t){if(this.getSelectedId){var e=this.getSelectedId(!0);if(1==e.length)return this.hl(t),!1}},Gb:function(t,e){if(this.s.editable&&!this.Eb){if(e.target&&"INPUT"==e.target.tagName)return!0;var i=this.getSelectedId(!0);
if(1==i.length)return this.editNext(t,i[0]),!1}return!0},ui:function(t,e,i){var s=this.getIndexById(t.row),n=this.getColumnIndex(t.column),r=this.data.order,a=this.fj;if(i)for(var h=s;h<r.length;h++){for(var o=n+1;o<a.length;o++){var l={row:r[h],column:a[o].id};if(e.call(this,l))return l}n=-1}else for(var h=s;h>=0;h--){for(var o=n-1;o>=0;o--){var l={row:r[h],column:a[o].id};
if(e.call(this,l))return l}n=a.length}return null},In:function(){this.Eb&&(this.Jn?this.Jn=!1:(this.Wj.scrollTo(this.getScrollState().y+this.Vf.childNodes[1].firstChild.scrollTop),this.Vf.childNodes[1].firstChild.scrollTop=0,this.Jn=!0))},Kn:function(){this.Eb&&this.Zj.scrollTo(this.Vf.childNodes[1].scrollLeft)
},gi:function(){this.attachEvent("onScrollY",this.Ln),this.attachEvent("onScrollX",this.Ln),this.attachEvent("onScrollY",this.$s),this.attachEvent("onColumnResize",function(){this.editStop()}),this.attachEvent("onAfterFilter",function(){this.editStop()}),this.attachEvent("onRowResize",function(){this.editStop()
}),this.Vf.childNodes[1].firstChild.onscroll=webix.bind(this.In,this),this.Vf.childNodes[1].onscroll=webix.bind(this.Kn,this)},Ln:function(){if(this.Eb){var t=this.Hn;this.Hn=this.getScrollState();var e=this.Hn.y-t.y;this.si(function(t){if(t.getPopup){var i=this.getItemNode(t);t.getPopup().show(i?i:{x:-1e4,y:-1e4})
}else t.$inline||(t.node.top-=e,t.node.style.top=t.node.top+"px")})}}}),webix.extend(webix.ui.datatable,webix.EditAbility),webix.extend(webix.ui.datatable,{$init:function(){this.am={},this.bm=[],this.Mn=[0,0],this.attachEvent("onStructureLoad",this.Nn)},Nn:function(){for(var t=this.fj,e=t.length-1;e>=0;e--)t[e].hidden?this.hideColumn(t[e].id,!0,!0):t[e].batch&&this.config.visibleBatch&&t[e].batch!=this.config.visibleBatch&&this.hideColumn(t[e].id,!0,!0)
},moveColumn:function(t,e){var i=this.getColumnIndex(t);if(i!=e){var s=this.s.columns,n=s.splice(i,1),r=e-(e>i?1:0);webix.PowerArray.insertAt.call(s,n[0],r),this.On()}},isColumnVisible:function(t){return!this.am[t]},hideColumn:function(t,e,i){var s=this.s.columns,n=this.bm,r=this.am;if(e!==!1){var a=this.getColumnIndex(t);
if(-1==a)return;if(!n.length){for(var h=0;h<s.length;h++)n[h]=s[h].id;this.Mn=[this.s.leftSplit,this.Fj]}a<this.s.leftSplit&&this.s.leftSplit--,a>=this.Fj?this.s.rightSplit--:this.Fj--,this.xt(a,s[a],0),this.vk(a);var o=r[t]=s.splice(a,1)[0];o.qk=-1,delete this.Aj[t]}else{var o=r[t];if(!o)return;for(var l=null,h=0;h<n.length&&n[h]!=t;h++)r[n[h]]||(l=n[h]);
var a=l?this.getColumnIndex(l)+1:0;webix.PowerArray.insertAt.call(s,o,a),this.xt(a,o,1),delete o.hidden,h<this.Mn[0]&&this.s.leftSplit++,h>=this.Mn[1]?this.s.rightSplit++:this.Fj++,delete r[t],this.Aj[t]=o}i||this.On()},xt:function(t,e,i){for(var s=e.header.length-1;s>=0;s--)if(null===e.header[s])for(var n=t;n>=0;n--){var r=this.fj[n];
if(null!==r.header[s]){r.header[s].colspan+i>t-n&&(r.header[s].colspan-=i?-1:1);break}}else e.header[s].colspan&&0===i&&(e.header[s].colspan=1)},refreshColumns:function(t){this.Aj={};for(var e=0;e<this.fj.length;e++){var i=this.fj[e];this.Aj[i.id]=i,i.attached=i.node=null}for(var e=0;3>e;e++)this.Vf.childNodes[e].firstChild.innerHTML="";
this.fj=this.config.columns=t||this.config.columns,this.tj=0,this.callEvent("onStructureUpdate"),this.rj(),this.sk(),this.render()},On:function(){this.tj=0,this.callEvent("onStructureUpdate"),this.uj(),this.render()},showColumn:function(t){return this.hideColumn(t,!1)},showColumnBatch:function(t){this.eachColumn(function(e,i){i.batch&&(i.batch==t&&this.am[i.id]?this.hideColumn(i.id,!1,!0):i.batch==t||this.am[i.id]||this.hideColumn(i.id,!0,!0))
},!0),this.On()}}),webix.extend(webix.ui.datatable,{moveSelection:function(t,e){var i=this.getSelectedId(!0),s=i.length-1;if(s>=0){var n=i[s].row,r=i[s].column,a=this.s.multiselect?e:!1;if("top"==t||"bottom"==t){if(n&&("top"==t?n=this.data.getFirstId():"bottom"==t&&(n=this.data.getLastId())),r){var s=0;
"bottom"==t&&(s=this.config.columns.length-1),r=this.columnId(s)}}else if("up"==t||"down"==t||"pgup"==t||"pgdown"==t){if(n){var s=this.getIndexById(n),h="pgup"==t||"pgdown"==t?Math.round(this.Vj/this.s.rowHeight):1;"up"==t||"pgup"==t?s-=h:("down"==t||"pgdown"==t)&&(s+=h),0>s&&(s=0),s>=this.data.order.length&&(s=this.data.order.length-1),n=this.getIdByIndex(s)
}}else{if("right"!=t&&"left"!=t)return;if(r&&"row"!=this.config.select){var s=this.getColumnIndex(r);if("right"==t?s++:"left"==t&&s--,0>s||s>=this.config.columns.length)return;r=this.columnId(s)}else{if(this.open&&"right"==t)return this.open(n);if(this.close&&"left"==t)return this.close(n)}}this.showCell(n,r),this.hl({row:n,column:r},a)
}return!1}}),webix.extend(webix.ui.datatable,webix.KeysNavigation),webix.extend(webix.ui.datatable,webix.DataMove),webix.extend(webix.ui.datatable,{$dragHTML:function(t){for(var e=this.bc-this.oj,i="<div class='webix_dd_drag' style='width:"+(e-2)+"px;'>",s=this.s.columns,n=0;n<s.length;n++){var r=this.Ek(t,s[n]);
i+="<div style='width:"+s[n].width+"px;'>"+r+"</div>"}return i+"</div>"},getHeaderNode:function(t,e){var i=this.getColumnIndex(t);e=e||0;for(var s=this.I.childNodes[1].getElementsByTagName("TR")[e+1].childNodes,n=0;n<s.length;n++)if(s[n].getAttribute("column")==i)return s[n].firstChild;return null},getItemNode:function(t){if(t&&!t.header){var e=t.row||t,i=this.getIndexById(e),s=this.Sj();
if(i<s[0]&&i>s[1])return;var n=this.Xj(),r=this.s.leftSplit?0:n[0];if(t.column&&(r=this.getColumnIndex(t.column),r<this.Fj&&r>=this.s.leftSplit&&(r<n[0]||r>n[1])))return;var a=this.s.columns[r];if(a.attached&&a.node)return a.node.childNodes[i-s[0]]}},Zg:function(t,e){return!t||t.header&&e?0:this.data.order[t.rind]
},dragColumn_setter:function(t){var e;"order"==t?e={$drag:webix.bind(function(t,i){var s=this.locate(i);if(!s||!this.callEvent("onBeforeColumnDrag",[s.column,i]))return!1;webix.DragControl.Gd={from:e,start:s,custom:"column_dnd"};var n=this.getColumnConfig(s.column);return this.Qn=webix.html.posRelative(i),this.Rn=n.width,"<div class='webix_dd_drag_column' style='width:"+n.width+"px'>"+(n.header[0].text||"&nbsp;")+"</div>"
},this),$dragPos:webix.bind(function(t,e,i){var s=webix.DragControl.getContext(),n=webix.html.offset(this.$view);i.style.display="none";var r=document.elementFromPoint(t.x,n.y+1),a=r?this.locate(r):null,h=webix.DragControl.getContext().start.column;if(a&&a.column!=h&&(!this.Sn||a.column!=this.Yg)&&"column_dnd"==s.custom&&webix.$$(r)==this){if(!this.callEvent("onBeforeColumnDropOrder",[h,a.column,e]))return;
var o=this.getColumnIndex(h),l=this.getColumnIndex(a.column);e.touches&&(this.wy=e.target,this.wy.style.display="none",this.$view.parentNode.appendChild(this.wy)),this.moveColumn(h,l+(l>o?1:0)),this.Yg=a.column,this.Sn=!0}if(a&&a.column==h&&(this.Sn=!1),i.style.display="block",t.x=t.x-this.Qn.x,t.y=n.y,t.x<n.x)t.x=n.x;
else{var c=n.x+this.$view.offsetWidth-this.oj-this.Rn;t.x>c&&(t.x=c)}webix.DragControl.Ed=!0},this),$dragDestroy:webix.bind(function(t,e){webix.html.remove(e),this.wy&&webix.html.remove(this.wy);var i=webix.DragControl.getContext().start;this.callEvent("onAfterColumnDropOrder",[i.column,this.Yg,t])},this)}:t&&(e={ah:!0,$drag:webix.bind(function(t,i){var s=this.locate(i);
if(!s||!this.callEvent("onBeforeColumnDrag",[s.column,i]))return!1;webix.DragControl.Gd={from:e,start:s,custom:"column_dnd"};for(var n=this.getColumnConfig(s.column).header,r="&nbsp;",a=0;a<n.length;a++)if(n[a]){r=n[a].text;break}return"<div class='webix_dd_drag_column'>"+r+"</div>"},this),$drop:webix.bind(function(t,e,i){var s=i;
i.touches&&this.Tn&&(s=this.Tn);var n=this.locate(s);if(!n)return!1;var r=webix.DragControl.getContext().start.column;if(r!=n.column){if(!this.callEvent("onBeforeColumnDrop",[r,n.column,i]))return;var a=this.getColumnIndex(r),h=this.getColumnIndex(n.column);this.moveColumn(r,h+(h>a?1:0)),this.callEvent("onAfterColumnDrop",[r,n.column,i])
}},this),$dragIn:webix.bind(function(t,i,s){var n=webix.DragControl.getContext();if("column_dnd"!=n.custom||n.from!=e)return!1;for(var r=s.target||s.srcElement;-1==(r.className||"").indexOf("webix_hcell");)if(r=r.parentNode,!r)return;return r!=this.Tn&&(this.Tn&&webix.html.removeCss(this.Tn,"webix_dd_over_column"),webix.html.addCss(r,"webix_dd_over_column")),this.Tn=r
},this),$dragDestroy:webix.bind(function(t,e){this.Tn&&webix.html.removeCss(this.Tn,"webix_dd_over_column"),webix.html.remove(e)},this)}),t&&(webix.DragControl.addDrag(this.I,e),webix.DragControl.addDrop(this.I,e,!0))}}),webix.extend(webix.ui.datatable,webix.DragItem),webix.extend(webix.ui.datatable,{Te:function(t,e){this.Un(t);
for(var i in e)this.addCellCss(t,i,"webix_invalid_cell");this.addCss(t,"webix_invalid")},Qe:function(t){this.Un(t),this.removeCss(t,"webix_invalid")},Un:function(t){var e=(this.getItem(t),this.data.getMark(t,"$cellCss"));if(e)for(var i in e)e[i]=e[i].replace("webix_invalid_cell","").replace("  "," ")
},addRowCss:function(t,e,i){this.addCss(t,e,i)},removeRowCss:function(t,e,i){this.removeCss(t,e,i)},addCellCss:function(t,e,i,s){var n=this.data.getMark(t,"$cellCss"),r=n||{},a=r[e]||"";r[e]=a.replace(i,"").replace("  "," ")+" "+i,n||this.data.addMark(t,"$cellCss",!1,r,!0),s||this.refresh(t)},removeCellCss:function(t,e,i,s){var n=this.data.getMark(t,"$cellCss");
if(n){var r=n[e]||"";r&&(n[e]=r.replace(i,"").replace("  "," ")),s||this.refresh(t)}}}),webix.extend(webix.ui.datatable,webix.ValidateCollection),webix.TreeTableClick={},webix.TreeTablePaste={insert:function(t){for(var e=this.getSelectedId(!0,!0),i=0;i<t.length;i++){for(var s={},n=0;n<this.s.columns.length;n++)s[this.s.columns[n].id]=t[i][n]||"";
!webix.isUndefined(s.id)&&this.exists(s.id)&&(s.id=webix.uid()),this.add(s,null,e[0])}}},webix.protoUI({name:"treetable",$init:function(){webix.extend(this.data,webix.TreeStore,!0),webix.extend(this.type,webix.TreeType),webix.extend(this,webix.TreeDataMove,!0);for(var t in webix.TreeClick)this.on_click[t]||(this.on_click[t]=this.Vn(webix.TreeClick[t]));
this.type.treetable=webix.template("{common.space()}{common.icon()} {common.folder()}"),this.type.treecheckbox=function(t){return t.indeterminate&&!t.nocheckbox?"<div class='webix_tree_checkbox webix_indeterminate'></div>":webix.TreeType.checkbox.apply(this,arguments)},this.data.provideApi(this,!0)},Xg:!1,Vn:function(t){return function(e,i){return i=i.row,t.call(this,e,i)
}},getState:function(){var t=webix.DataState.getState.call(this);return webix.extend(t,webix.TreeAPI.getState.call(this)),t},setState:function(t){webix.TreeAPI.setState.call(this,t)&&webix.DataState.setState.call(this,t)},clipboard_setter:function(t){return webix.extend(this.rh,webix.TreeTablePaste),webix.TablePaste.clipboard_setter.call(this,t)
}},webix.TreeAPI,webix.TreeStateCheckbox,webix.TreeDataLoader,webix.ui.datatable),webix.Canvas=webix.proto({$init:function(t){this.Wn=[],this.Xn=t.name,this.tg=webix.toNode(t.container||t);var e=t.width*(window.devicePixelRatio||1),i=t.height*(window.devicePixelRatio||1),s=t.style||"";s+=";width:"+t.width+"px;height:"+t.height+"px;",this.Yn(t.name,s,e,i)
},Yn:function(t,e,i,s){return this.Zn=webix.html.create("canvas",{width:i,height:s,canvas_id:t,style:e||""}),this.tg.appendChild(this.Zn),this.Zn.getContext||webix.env.isIE&&(webix.require("legacy/excanvas/excanvas.js"),G_vmlCanvasManager.init_(document),G_vmlCanvasManager.initElement(this.Zn)),this.Zn
},getCanvas:function(t){var e=(this.Zn||this.Yn(this.w)).getContext(t||"2d");return this.$n||(this.$n=!0,e.scale(window.devicePixelRatio||1,window.devicePixelRatio||1)),e},_n:function(t,e){this.Zn&&(this.Zn.setAttribute("width",t*(window.devicePixelRatio||1)),this.Zn.setAttribute("height",e*(window.devicePixelRatio||1)),this.Zn.style.width=t+"px",this.Zn.style.height=e+"px",this.$n=!1)
},renderText:function(t,e,i,s,n){if(i){n&&(n=Math.max(n,0)),e&&(e=Math.max(e,0));var r=webix.html.create("DIV",{"class":"webix_canvas_text"+(s?" "+s:""),style:"left:"+t+"px; top:"+e+"px;"},i);return this.tg.appendChild(r),this.Wn.push(r),n&&(r.style.width=n+"px"),r}},renderTextAt:function(t,e,i,s,n,r,a){var h=this.renderText.call(this,i,s,n,r,a);
return h&&(t&&(h.style.top="middle"==t?parseInt(s-h.offsetHeight/2,10)+"px":s-h.offsetHeight+"px"),e&&(h.style.left="left"==e?i-h.offsetWidth+"px":parseInt(i-h.offsetWidth/2,10)+"px")),h},clearCanvas:function(t){var e,i=[];for(e=0;e<this.Wn.length;e++)this.tg.removeChild(this.Wn[e]);if(this.Wn=[],!t&&this.tg.t){for(i=this.ao();i.length;)i[0].parentNode.removeChild(i[0]),i.splice(0,1);
i=null,this.tg.t.getElementsByTagName("AREA").length||(this.tg.t.parentNode.removeChild(this.tg.t),this.tg.t=null)}this.getCanvas().clearRect(0,0,this.Zn.offsetWidth,this.Zn.offsetHeight)},toggleCanvas:function(){this.bo("none"==this.Zn.style.display)},showCanvas:function(){this.bo(!0)},hideCanvas:function(){this.bo(!1)
},bo:function(t){var e,i;for(i=0;i<this.Wn.length;i++)this.Wn[i].style.display=t?"":"none";if(this.tg.t)for(e=this.ao(),i=0;i<e.length;i++)t?e[i].removeAttribute("disabled"):e[i].setAttribute("disabled","true");this.Zn.style.display=t?"":"none"},ao:function(){var t,e,i=[];for(t=this.tg.t.getElementsByTagName("AREA"),e=0;e<t.length;e++)t[e].getAttribute("userdata")==this.Xn&&i.push(t[e]);
return i}}),webix.color={co:["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],toHex:function(t,e){t=parseInt(t,10);for(var i="";t>0;)i=this.co[t%16]+i,t=Math.floor(t/16);for(;i.length<e;)i="0"+i;return i},hexToDec:function(t){return parseInt(t,16)},toRgb:function(t){var e,i,s,n;return"string"!=typeof t?(e=t[0],i=t[1],s=t[2]):-1!=t.indexOf("rgb")?(n=t.substr(t.indexOf("(")+1,t.lastIndexOf(")")-t.indexOf("(")-1).split(","),e=n[0],i=n[1],s=n[2]):("#"==t.substr(0,1)&&(t=t.substr(1)),e=this.hexToDec(t.substr(0,2)),i=this.hexToDec(t.substr(2,2)),s=this.hexToDec(t.substr(4,2))),e=parseInt(e,10)||0,i=parseInt(i,10)||0,s=parseInt(s,10)||0,(0>e||e>255)&&(e=0),(0>i||i>255)&&(i=0),(0>s||s>255)&&(s=0),[e,i,s]
},hsvToRgb:function(t,e,i){var s,n,r,a,h,o,l,c;switch(s=Math.floor(t/60)%6,n=t/60-s,r=i*(1-e),a=i*(1-n*e),h=i*(1-(1-n)*e),o=0,l=0,c=0,s){case 0:o=i,l=h,c=r;break;case 1:o=a,l=i,c=r;break;case 2:o=r,l=i,c=h;break;case 3:o=r,l=a,c=i;break;case 4:o=h,l=r,c=i;break;case 5:o=i,l=r,c=a}return o=Math.floor(255*o),l=Math.floor(255*l),c=Math.floor(255*c),[o,l,c]
},rgbToHsv:function(t,e,i){var s,n,r,a,h,o,l,c;return s=t/255,n=e/255,r=i/255,a=Math.min(s,n,r),h=Math.max(s,n,r),l=0,o=0===h?0:1-a/h,c=h,h==a?l=0:h==s&&n>=r?l=60*(n-r)/(h-a)+0:h==s&&r>n?l=60*(n-r)/(h-a)+360:h==n?l=60*(r-s)/(h-a)+120:h==r&&(l=60*(s-n)/(h-a)+240),[l,o,c]}},webix.HtmlMap=webix.proto({$init:function(t){this.ad="map_"+webix.uid(),this.U=t,this.eo=[]
},addRect:function(t,e,i){this.fo(t,"RECT",e,i)},addPoly:function(t,e,i){this.fo(t,"POLY",e,i)},fo:function(t,e,i,s){var n="";4==arguments.length&&(n="userdata='"+s+"'"),this.eo.push("<area "+this.U+"='"+t+"' shape='"+e+"' coords='"+i.join()+"' "+n+"></area>")},addSector:function(t,e,i,s,n,r,a,h){var o=[];
o.push(s),o.push(Math.floor(n*a));for(var l=e;i>l;l+=Math.PI/18)o.push(Math.floor(s+r*Math.cos(l))),o.push(Math.floor((n+r*Math.sin(l))*a));return o.push(Math.floor(s+r*Math.cos(i))),o.push(Math.floor((n+r*Math.sin(i))*a)),o.push(s),o.push(Math.floor(n*a)),this.addPoly(t,o,h)},render:function(t){var e=webix.html.create("DIV");
e.style.cssText="position:absolute; width:100%; height:100%; top:0px; left:0px;",t.appendChild(e);var i=webix.env.isIE?"":"src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='";e.innerHTML="<map id='"+this.ad+"' name='"+this.ad+"'>"+this.eo.join("\n")+"</map><img "+i+" class='webix_map_img' usemap='#"+this.ad+"'>",t.t=e,this.eo=[]
}}),webix.protoUI({name:"chart",$init:function(t){this.go=[this.s],this.ho=[],this.w.className+=" webix_chart",this.$ready.push(this.Mi),t.preset&&this.io(t),this.attachEvent("onMouseMove",this.jo),this.data.provideApi(this,!0)},Mi:function(){this.data.attachEvent("onStoreUpdated",webix.bind(function(){this.render()
},this))},defaults:{color:"RAINBOW",alpha:"1",label:!1,value:"{obj.value}",padding:{},type:"pie",lineColor:"#ffffff",cant:.5,barWidth:30,line:{width:2,color:"#1293f8"},item:{radius:3,borderColor:"#636363",borderWidth:1,color:"#ffffff",alpha:1,type:"r",shadow:!1},shadow:!0,gradient:!1,border:!0,labelOffset:20,origin:"auto",scale:"linear"},ad:"webix_area_id",on_click:{webix_chart_legend_item:function(t,e,i){var s=i.getAttribute("series_id");
if(this.callEvent("onLegendClick",[t,s,i])){var n=this.s,r=n.legend.values,a=r&&r[s].toggle||n.legend.toggle;"undefined"!=typeof s&&this.go.length>1&&a&&(-1!=i.className.indexOf("hidden")?this.showSeries(s):this.hideSeries(s))}}},on_dblclick:{},on_mouse_move:{},locate:function(t){return webix.html.locate(t,this.ad)
},$setSize:function(t,e){if(webix.ui.view.prototype.$setSize.call(this,t,e)){for(var i in this.canvases)this.canvases[i]._n(this.bc,this.dc);this.render()}},type_setter:function(t){return"undefined"==typeof this.s.offset&&(this.s.offset=!("area"==t||"stackedArea"==t)),"radar"!=t||this.s.yAxis||this.define("yAxis",{}),"scatter"==t&&(this.s.yAxis||this.define("yAxis",{}),this.s.xAxis||this.define("xAxis",{})),t
},removeAllSeries:function(){this.clearCanvas(),this.ko&&(this.ko.innerHTML="",this.ko.parentNode.removeChild(this.ko),this.ko=null),this.canvases&&(this.canvases={}),this.w.innerHTML="";for(var t=0;t<this.go.length;t++)this.go[t].tooltip&&this.go[t].tooltip.destructor();this.go=[]},clearCanvas:function(){if(this.canvases&&"object"==typeof this.canvases)for(var t in this.canvases)this.canvases[t].clearCanvas()
},render:function(){var t,e,i,s,n;if(this.isVisible(this.s.id)&&this.callEvent("onBeforeRender",[this.data])){if(this.canvases&&"object"==typeof this.canvases)for(e in this.canvases)this.canvases[e].clearCanvas();else this.canvases={};if(this.s.legend&&(this.canvases.legend||(this.canvases.legend=this.lo("legend")),this.mo(this.data.getRange(),this.bc,this.dc)),t=this.no(this.bc,this.dc),s=new webix.HtmlMap(this.ad),n=this.s,this.go)for(i=this.oo(),e=0;e<this.go.length;e++)this.s=this.go[e],this.canvases[e]||(this.canvases[e]=this.lo(e,"z-index:"+(2+e))),this["$render_"+this.s.type](this.canvases[e].getCanvas(),i,t.start,t.end,e,s);
s.render(this.w),this.w.lastChild.style.zIndex=100,this.po(this.w.lastChild,t),this.callEvent("onAfterRender",[]),this.s=n}},po:function(t,e){var i={};i.left=e.start.x,i.top=e.start.y,i.width=e.end.x-e.start.x,i.height=e.end.y-e.start.y;for(var s in i)t.style[s]=i[s]+"px"},oo:function(){var t,e,i,s,n,r,a,h,o,l;
if(s=this.data.getRange(),t=-1!=this.s.type.toLowerCase().indexOf("barh")?"yAxis":"xAxis",e=this.s[t],e&&e.units&&"object"==typeof e.units){if(i=e.units,h=[],"undefined"!=typeof i.start&&"undefined"!=typeof i.end&&"undefined"!=typeof i.next)for(a=i.start;a<=i.end;)h.push(a),a=i.next.call(this,a);else"[object Array]"===Object.prototype.toString.call(i)&&(h=i);
if(r=[],h.length){for(o=e.value,l={},n=0;n<s.length;n++)l[o(s[n])]=n;for(n=0;n<h.length;n++)"undefined"!=typeof l[h[n]]?(s[l[h[n]]].$unit=h[n],r.push(s[l[h[n]]])):r.push({$unit:h[n]})}return r}return s},series_setter:function(t){if("object"!=typeof t);else{this.e(t.length?t[0]:t),this.go=[this.s];for(var e=1;e<t.length;e++)this.addSeries(t[e])
}return t},value_setter:webix.template,xValue_setter:webix.template,yValue_setter:function(t){this.define("value",t)},alpha_setter:webix.template,label_setter:webix.template,lineColor_setter:webix.template,borderColor_setter:webix.template,pieInnerText_setter:webix.template,gradient_setter:function(t){return"function"!=typeof t&&t&&t===!0&&(t="light"),t
},colormap:{RAINBOW:function(t){var e=Math.floor(this.getIndexById(t.id)/this.count()*1536);return 1536==e&&(e-=1),this.qo[Math.floor(e/256)](e%256)}},color_setter:function(t){return this.colormap[t]||webix.template(t)},fill_setter:function(t){return t&&"0"!=t?webix.template(t):!1},io:function(t){this.define("preset",t.preset),delete t.preset
},preset_setter:function(t){var e,i,s;if(this.defaults=webix.extend({},this.defaults),s=this.presets[t],"object"==typeof s){for(e in s)if("object"==typeof s[e])if(this.defaults[e]&&"object"==typeof this.defaults[e]){this.defaults[e]=webix.extend({},this.defaults[e]);for(i in s[e])this.defaults[e][i]=s[e][i]
}else this.defaults[e]=webix.extend({},s[e]);else this.defaults[e]=s[e];return t}return!1},legend_setter:function(t){return t?("object"!=typeof t&&(t={template:t}),this.E(t,{width:150,height:18,layout:"y",align:"left",valign:"bottom",template:"",toggle:-1!=this.s.type.toLowerCase().indexOf("stacked")?"":"hide",marker:{type:"square",width:15,height:15,radius:3},margin:4,padding:3}),t.template=webix.template(t.template),t):(this.legendObj&&(this.legendObj.innerHTML="",this.legendObj=null),!1)
},item_setter:function(t){"object"!=typeof t&&(t={color:t,borderColor:t}),this.E(t,webix.extend({},this.defaults.item));var e=["alpha","borderColor","color","radius"];return this.ro(e,t),t},line_setter:function(t){return"object"!=typeof t&&(t={color:t}),webix.extend(this.defaults.line,t,!0),t=webix.extend({},this.defaults.line),t.color=webix.template(t.color),t
},padding_setter:function(t){return"object"!=typeof t&&(t={left:t,right:t,top:t,bottom:t}),this.E(t,{left:50,right:20,top:35,bottom:40}),t},xAxis_setter:function(t){if(!t)return!1;"object"!=typeof t&&(t={template:t}),this.E(t,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:!0});var e=["lineColor","template","lines"];
return this.ro(e,t),this.so=webix.extend({},t),t},yAxis_setter:function(t){this.E(t,{title:"",color:"#000000",lineColor:"#cfcfcf",template:"{obj}",lines:!0,bg:"#ffffff"});var e=["lineColor","template","lines","bg"];return this.ro(e,t),this.to=webix.extend({},t),t},ro:function(t,e){for(var i=0;i<t.length;i++)e[t[i]]=webix.template(e[t[i]])
},lo:function(t,e,i){return new webix.Canvas({container:i||this.w,name:t,style:e||"",width:this.bc,height:this.dc})},uo:function(t,e,i,s,n,r){var a=0;return this.s.yAxis&&(this.canvases.y||(this.canvases.y=this.lo("axis_y")),a=this.vo(this.canvases.y.getCanvas(),t,e,i,s,n)),this.s.xAxis&&(this.canvases.x||(this.canvases.x=this.lo("axis_x")),this.wo(this.canvases.x.getCanvas(),t,e,i,r,a)),a
},wo:function(t,e,i,s,n,r){for(var a,h=i.x-.5,o=parseInt(r?r:s.y,10)+.5,l=s.x,c=!0,u=0;u<e.length;u++){this.s.offset===!0?a=h+n/2+u*n:(a=u==e.length-1?s.x:h+u*n,c=!!u),a=Math.ceil(a)-.5;var d="auto"!=this.s.origin&&"bar"==this.s.type&&parseFloat(this.s.value(e[u]))<this.s.origin;this.xo(a,o,e[u],c,d),(this.s.offset||u)&&this.s.xAxis.lines.call(this,e[u])&&this.yo(t,a,s.y,i.y,e[u])
}this.canvases.x.renderTextAt(!0,!1,h,s.y+this.s.padding.bottom-3,this.s.xAxis.title,"webix_axis_title_x",s.x-i.x),this.zo(t,h,o,l,o,this.s.xAxis.color,1),this.s.xAxis.lines.call(this,{})&&this.s.offset&&this.zo(t,l+.5,s.y,l+.5,i.y+.5,this.s.xAxis.color,.2)},vo:function(t,e,i,s,n,r){var a,h={};if(this.s.yAxis){var o=i.x-.5,l=s.y,c=i.y,u=s.y;
if(this.s.yAxis.step&&(a=parseFloat(this.s.yAxis.step)),"undefined"==typeof this.to.step||"undefined"==typeof this.to.start||"undefined"==typeof this.to.end?(h=this.Ao(n,r),n=h.start,r=h.end,a=h.step,this.s.yAxis.end=r,this.s.yAxis.start=n):"logarithmic"==this.config.scale&&(this.Bo=!0),this.Co(i,s),0!==a){if(r==n)return l;
for(var d=(l-c)*a/(r-n),f=0,b=n;r>=b;b+=a){var x=this.Bo?Math.pow(10,b):b;h.fixNum&&(x=parseFloat(x).toFixed(h.fixNum));var p=Math.floor(l-f*d)+.5;if(b==n&&"auto"==this.s.origin||!this.s.yAxis.lines.call(this,b)||this.zo(t,o,p,s.x,p,this.s.yAxis.lineColor.call(this,b),1),b==this.s.origin&&(u=p),1>a&&!this.Bo){var v=Math.min(Math.floor(this.Do(a)),0>=n?0:Math.floor(this.Do(n))),w=Math.pow(10,-v);
x=Math.round(x*w)/w,b=x}this.canvases.y.renderText(0,p-5,this.s.yAxis.template(x.toString()),"webix_axis_item_y",i.x-5),f++}return this.zo(t,o,l+1,o,c,this.s.yAxis.color,1),u}}},Co:function(t,e){var i="webix_axis_title_y"+(webix.Eo&&9!=webix.Eo?" webix_ie_filter":""),s=this.canvases.y.renderTextAt("middle",!1,0,parseInt((e.y-t.y)/2+t.y,10),this.s.yAxis.title,i);
s&&(s.style.left=(webix.env.transform?(s.offsetHeight-s.offsetWidth)/2:0)+"px")},Fo:function(t,e){var i=Math.floor(this.Do(t)),s=Math.ceil(this.Do(e));return{start:i,step:1,end:s}},Ao:function(t,e){if(this.Bo=!1,"logarithmic"==this.s.scale){var i=Math.floor(this.Do(t)),s=Math.ceil(this.Do(e));if(t>0&&e>0&&s-i>1)return this.Bo=!0,this.Fo(t,e)
}"auto"!=this.s.origin&&this.s.origin<t&&(t=this.s.origin);var n,r,a;n=(e-t)/8||1;var h=Math.floor(this.Do(n)),o=Math.pow(10,h),l=n/o;if(l=l>5?10:5,n=parseInt(l,10)*o,n>Math.abs(t))r=0>t?-n:0;else{var c=Math.abs(t),u=Math.floor(this.Do(c)),d=c/Math.pow(10,u);for(r=Math.ceil(10*d)/10*Math.pow(10,u)-n,c>1&&n>.1&&(r=Math.ceil(r));0>t?t>=r:r>=t;)r-=n;
0>t&&(r=-r-2*n)}for(a=r;e>a;)a+=n,a=parseFloat((1*a).toFixed(Math.abs(h)));return{start:r,end:a,step:n,fixNum:0>h?Math.abs(h):0}},Go:function(t,e){var i,s,n=this.data.Df(),r=arguments.length&&"h"==t?this.so:this.to;if(e=e||"value",r&&"undefined"!=typeof r.end&&"undefined"!=typeof r.start&&r.step)i=parseFloat(r.end),s=parseFloat(r.start);
else if(i=webix.GroupMethods.max(this.go[0][e],n),s=r&&"undefined"!=typeof r.start?parseFloat(r.start):webix.GroupMethods.min(this.go[0][e],n),this.go.length>1)for(var a=1;a<this.go.length;a++){var h=webix.GroupMethods.max(this.go[a][e],n),o=webix.GroupMethods.min(this.go[a][e],n);h>i&&(i=h),s>o&&(s=o)
}return{max:i,min:s}},Do:function(t){var e="log";return Math[e](t)/Math.LN10},xo:function(t,e,i,s,n){if(this.s.xAxis){var r=this.canvases.x.renderTextAt(n,s,t,e-(n?2:0),this.s.xAxis.template(i));r&&(r.className+=" webix_axis_item_x")}},yo:function(t,e,i,s,n){this.s.xAxis&&this.s.xAxis.lines&&this.zo(t,e,i,e,s,this.s.xAxis.lineColor.call(this,n),1)
},zo:function(t,e,i,s,n,r,a){t.strokeStyle=r,t.lineWidth=a,t.beginPath(),t.moveTo(e,i),t.lineTo(s,n),t.stroke(),t.lineWidth=1},Ho:function(t,e){var i,s=1;return i=e!=t?e-t:t,[i,s]},qo:[function(t){return"#FF"+webix.color.toHex(t/2,2)+"00"},function(t){return"#FF"+webix.color.toHex(t/2+128,2)+"00"},function(t){return"#"+webix.color.toHex(255-t,2)+"FF00"
},function(t){return"#00FF"+webix.color.toHex(t,2)},function(t){return"#00"+webix.color.toHex(255-t,2)+"FF"},function(t){return"#"+webix.color.toHex(t,2)+"00FF"}],addSeries:function(t){var e=webix.extend({},this.s);this.s=webix.extend({},e),this.e(t,{}),this.go.push(this.s),this.s=e},jo:function(t,e,i){var s;
if(i.getAttribute("userdata")&&(this.Io=i.getAttribute("userdata"),this.go[this.Io])){for(var n=0;n<this.go.length;n++)s=this.go[n].tooltip,s&&s.disable();i.getAttribute("disabled")||(s=this.go[this.Io].tooltip,s&&s.enable())}},hideSeries:function(t){this.canvases[t].hideCanvas(),this.s.legend.values&&this.s.legend.values[t]&&(this.s.legend.values[t].$hidden=!0),this.mo()
},showSeries:function(t){this.canvases[t].showCanvas(),this.s.legend.values&&this.s.legend.values[t]&&delete this.s.legend.values[t].$hidden,this.mo()},mo:function(t,e){var i,s,n,r,a,h,o,l,c,u,d,f=0,b=0;if(t=t||[],e=e||this.bc,l=this.canvases.legend.getCanvas(),s=this.s.legend,o="x"!=this.s.legend.layout?"width:"+s.width+"px":"",this.ko&&(this.ko.innerHTML="",this.ko.parentNode.removeChild(this.ko)),this.canvases.legend.clearCanvas(!0),n=webix.html.create("DIV",{"class":"webix_chart_legend",style:"left:"+f+"px; top:"+b+"px;"+o},""),s.padding&&(n.style.padding=s.padding+"px"),this.ko=n,this.w.appendChild(n),a=[],s.values)for(i=0;i<s.values.length;i++)a.push(this.Jo(n,s.values[i].text,"undefined"!=typeof s.values[i].id?typeof s.values[i].id:i,s.values[i].$hidden));
else for(i=0;i<t.length;i++)a.push(this.Jo(n,s.template(t[i])));for(0===n.offsetWidth&&(n.style.width="auto"),h=n.offsetWidth,r=n.offsetHeight,e>h&&("x"==s.layout&&"center"==s.align&&(f=(e-h)/2),"right"==s.align&&(f=e-h),s.margin&&"center"!=s.align&&(f+=("left"==s.align?1:-1)*s.margin)),r<this.dc&&("middle"==s.valign&&"center"!=s.align&&"x"!=s.layout?b=(this.dc-r)/2:"bottom"==s.valign&&(b=this.dc-r),s.margin&&"middle"!=s.valign&&(b+=("top"==s.valign?1:-1)*s.margin)),n.style.left=f+"px",n.style.top=b+"px",l.save(),i=0;i<a.length;i++)d=a[i],s.values&&s.values[i].$hidden?(u=!0,c=s.values[i].disableColor?s.values[i].disableColor:"#d9d9d9"):(u=!1,c=s.values?s.values[i].color:this.s.color.call(this,t[i])),this.Ko(l,d.offsetLeft+f,d.offsetTop+b,c,d.offsetHeight,u,i);
l.restore(),a=null},Jo:function(t,e,i,s){var n="";"x"==this.s.legend.layout&&(n="float:left;");var r=webix.html.create("DIV",{style:n+"padding-left:"+(10+this.s.legend.marker.width)+"px","class":"webix_chart_legend_item"+(s?" hidden":"")},e);return arguments.length>2&&r.setAttribute("series_id",i),t.appendChild(r),r
},Ko:function(t,e,i,s,n,r,a){var h=[],o=this.s.legend.marker,l=this.s.legend.values,c=l&&l[a].markerType?l[a].markerType:o.type;if(s&&(t.strokeStyle=t.fillStyle=s),"round"!=c&&o.radius)if("item"==c){if(this.s.line&&"scatter"!=this.s.type&&!this.s.disableLines){t.beginPath(),t.lineWidth=this.go[a].line.width,t.strokeStyle=r?s:this.go[a].line.color.call(this,{});
var u=e+5,d=i+n/2;t.moveTo(u,d);var f=u+o.width;t.lineTo(f,d),t.stroke()}var b=this.go[a].item,x=parseInt(b.radius.call(this,{}),10)||0;x&&(t.beginPath(),r?(t.lineWidth=b.borderWidth,t.strokeStyle=s,t.fillStyle=s):(t.lineWidth=b.borderWidth,t.fillStyle=b.color.call(this,{}),t.strokeStyle=b.borderColor.call(this,{}),t.globalAlpha=b.alpha.call(this,{})),t.beginPath(),e+=o.width/2+5,i+=n/2,this.Lo(t,e,i,x+1,b.type),t.fill(),t.stroke()),t.globalAlpha=1
}else t.beginPath(),t.lineWidth=1,e+=5,i+=n/2-o.height/2,h=[[e+o.radius,i+o.radius,o.radius,Math.PI,3*Math.PI/2,!1],[e+o.width-o.radius,i],[e+o.width-o.radius,i+o.radius,o.radius,-Math.PI/2,0,!1],[e+o.width,i+o.height-o.radius],[e+o.width-o.radius,i+o.height-o.radius,o.radius,0,Math.PI/2,!1],[e+o.radius,i+o.height],[e+o.radius,i+o.height-o.radius,o.radius,Math.PI/2,Math.PI,!1],[e,i+o.radius]],this.Mo(t,h),t.stroke(),t.fill();
else{t.beginPath(),t.lineWidth=o.height,t.lineCap=o.type,e+=t.lineWidth/2+5,i+=n/2,t.moveTo(e,i);var f=e+o.width-o.height+1;t.lineTo(f,i),t.stroke(),t.fill()}},no:function(t,e){var i,s,n,r;if(i=this.s.padding.left,s=this.s.padding.top,n=t-this.s.padding.right,r=e-this.s.padding.bottom,this.s.legend){var a=this.s.legend,h=this.s.legend.width,o=this.s.legend.height;
"x"==a.layout?"center"==a.valign?"right"==a.align?n-=h:"left"==a.align&&(i+=h):"bottom"==a.valign?r-=o:s+=o:"right"==a.align?n-=h:"left"==a.align&&(i+=h)}return{start:{x:i,y:s},end:{x:n,y:r}}},No:function(t){var e,i,s,n,r;if(this.s.yAxis&&"undefined"!=typeof this.s.yAxis.end&&"undefined"!=typeof this.s.yAxis.start&&this.s.yAxis.step)s=parseFloat(this.s.yAxis.end),n=parseFloat(this.s.yAxis.start);
else{for(e=0;e<t.length;e++)for(t[e].$sum=0,t[e].$min=1/0,i=0;i<this.go.length;i++)r=parseFloat(this.go[i].value(t[e])||0),isNaN(r)||(-1!=this.go[i].type.toLowerCase().indexOf("stacked")&&(t[e].$sum+=r),r<t[e].$min&&(t[e].$min=r));for(s=-1/0,n=1/0,e=0;e<t.length;e++)t[e].$sum>s&&(s=t[e].$sum),t[e].$min<n&&(n=t[e].$min);
n>0&&(n=0)}return{max:s,min:n}},Oo:function(t,e,i,s,n,r,a,h){var o,l,c,u,d,f;return"light"==r?(o="x"==h?t.createLinearGradient(e,i,s,i):t.createLinearGradient(e,i,e,n),f=[[0,"#FFFFFF"],[.9,a],[1,a]],l=2):"falling"==r||"rising"==r?(o="x"==h?t.createLinearGradient(e,i,s,i):t.createLinearGradient(e,i,e,n),c=webix.color.toRgb(a),u=webix.color.rgbToHsv(c[0],c[1],c[2]),u[1]*=.5,d="rgb("+webix.color.hsvToRgb(u[0],u[1],u[2])+")","falling"==r?f=[[0,d],[.7,a],[1,a]]:"rising"==r&&(f=[[0,a],[.3,a],[1,d]]),l=0):(t.globalAlpha=.37,l=0,o="x"==h?t.createLinearGradient(e,n,e,i):t.createLinearGradient(e,i,s,i),f=[[0,"#9d9d9d"],[.3,"#e8e8e8"],[.45,"#ffffff"],[.55,"#ffffff"],[.7,"#e8e8e8"],[1,"#9d9d9d"]]),this.Po(o,f),{gradient:o,offset:l}
},Qo:function(t,e,i,s){return t*=-1,e+=Math.cos(t)*s,i-=Math.sin(t)*s,{x:e,y:i}},Po:function(t,e){for(var i=0;i<e.length;i++)t.addColorStop(e[i][0],e[i][1])},Mo:function(t,e){var i,s;for(i=0;i<e.length;i++)s=i?"lineTo":"moveTo",e[i].length>2&&(s="arc"),t[s].apply(t,e[i])},Ro:function(t,e,i,s,n){t.addRect(e,[i[0].x-s.x,i[0].y-s.y,i[1].x-s.x,i[1].y-s.y],n)
}},webix.Group,webix.AutoTooltip,webix.DataLoader,webix.MouseEvents,webix.EventSystem,webix.ui.view),webix.extend(webix.ui.chart,{$render_pie:function(t,e,i,s,n,r){this.So(t,e,i,s,1,r,n)},So:function(t,e,i,s,n,r,a){if(e.length){var h=this.To(i,s),o=this.s.radius?this.s.radius:h.radius;if(!(0>o)){var l=this.Uo(e),c=this.Vo(l),u=this.Wo(l,c),d=this.s.x?this.s.x:h.x,f=this.s.y?this.s.y:h.y;
1==n&&this.s.shadow&&this.Xo(t,d,f,o),f/=n;var b=-Math.PI/2,x=[];if(t.scale(1,n),this.s.gradient){var p=1!=n?d+o/3:d,v=1!=n?f+o/3:f;this.Yo(t,d,f,o,p,v)}for(var w=0;w<e.length;w++)if(l[w]){t.strokeStyle=this.s.lineColor.call(this,e[w]),t.beginPath(),t.moveTo(d,f),x.push(b);var g=-Math.PI/2+u[w]-1e-4;
t.arc(d,f,o,b,g,!1),t.lineTo(d,f);var m=this.s.color.call(this,e[w]);t.fillStyle=m,t.fill(),this.s.pieInnerText&&this.Zo(d,f,5*o/6,b,g,n,this.s.pieInnerText(e[w],c),!0),this.s.label&&this.Zo(d,f,o+this.s.labelOffset,b,g,n,this.s.label(e[w])),1!=n&&(this.$o(t,d,f,b,g,o,!0),t.fillStyle="#000000",t.globalAlpha=.2,this.$o(t,d,f,b,g,o,!1),t.globalAlpha=1,t.fillStyle=m),r.addSector(e[w].id,b,g,d-i.x,f-i.y/n,o,n,a),b=g
}t.globalAlpha=.8;var y;for(w=0;w<x.length;w++)y=this.Qo(x[w],d,f,o),this.zo(t,d,f,y.x,y.y,this.s.lineColor.call(this,e[w]),2);1==n&&(t.lineWidth=2,t.strokeStyle="#ffffff",t.beginPath(),t.arc(d,f,o+1,0,2*Math.PI,!1),t.stroke()),t.globalAlpha=1,t.scale(1,1/n)}}},Uo:function(t){for(var e=[],i=0;i<t.length;i++)e.push(parseFloat(this.s.value(t[i])||0));
return e},Vo:function(t){for(var e=0,i=0;i<t.length;i++)e+=t[i];return e},Wo:function(t,e){var i,s=[],n=0;e=e||this.Vo(t);for(var r=0;r<t.length;r++)i=t[r],s[r]=2*Math.PI*(e?(i+n)/e:1/t.length),n+=i;return s},To:function(t,e){var i=e.x-t.x,s=e.y-t.y,n=t.x+i/2,r=t.y+s/2,a=Math.min(i/2,s/2);return{x:n,y:r,radius:a}
},$o:function(t,e,i,s,n,r,a){if(t.lineWidth=1,0>=s&&n>=0||s>=0&&n<=Math.PI||Math.abs(s-Math.PI)>.003&&s<=Math.PI&&n>=Math.PI){0>=s&&n>=0&&(s=0,a=!1,this._o(t,e,i,r,s,n)),s<=Math.PI&&n>=Math.PI&&(n=Math.PI,a=!1,this._o(t,e,i,r,s,n));var h=(this.s.pieHeight||Math.floor(r/4))/this.s.cant;t.beginPath(),t.arc(e,i,r,s,n,!1),t.lineTo(e+r*Math.cos(n),i+r*Math.sin(n)+h),t.arc(e,i+h,r,n,s,!0),t.lineTo(e+r*Math.cos(s),i+r*Math.sin(s)),t.fill(),a&&t.stroke()
}},_o:function(t,e,i,s,n,r){t.beginPath(),t.arc(e,i,s,n,r,!1),t.stroke()},Xo:function(t,e,i,s){t.globalAlpha=.5;for(var n=["#c4c4c4","#c6c6c6","#cacaca","#dcdcdc","#dddddd","#e0e0e0","#eeeeee","#f5f5f5","#f8f8f8"],r=n.length-1;r>-1;r--)t.beginPath(),t.fillStyle=n[r],t.arc(e+1,i+1,s+r,0,2*Math.PI,!0),t.fill();
t.globalAlpha=1},ap:function(t){return t.addColorStop(0,"#ffffff"),t.addColorStop(.7,"#7a7a7a"),t.addColorStop(1,"#000000"),t},Yo:function(t,e,i,s,n,r){t.beginPath();var a;"function"!=typeof this.s.gradient?(a=t.createRadialGradient(n,r,s/4,e,i,s),a=this.ap(a)):a=this.s.gradient(a),t.fillStyle=a,t.arc(e,i,s,0,2*Math.PI,!0),t.fill(),t.globalAlpha=.7
},Zo:function(t,e,i,s,n,r,a,h){var o=this.canvases[0].renderText(0,0,a,0,1);if(o){var l=o.scrollWidth;o.style.width=l+"px",l>t&&(l=t);var c=.2>n-s?4:8;h&&(c=l/1.8);var u=s+(n-s)/2;i-=(c-8)/2;var d=-c,f=-8,b="right";(u>=Math.PI/2&&u<Math.PI||u<=3*Math.PI/2&&u>=Math.PI)&&(d=-l-d+1,b="left");var x=0;!h&&1>r&&u>0&&u<Math.PI&&(x=(this.s.height||Math.floor(i/4))/r);
var p=(e+Math.floor((i+x)*Math.sin(u)))*r+f,v=t+Math.floor((i+c/2)*Math.cos(u))+d,w=n<Math.PI/2+.01,g=s<Math.PI/2;g&&w?v=Math.max(v,t+3):g||w?!h&&(u>=Math.PI/2&&u<Math.PI||u<=3*Math.PI/2&&u>=Math.PI)&&(v+=l/3):v=Math.min(v,t-l),o.style.top=p+"px",o.style.left=v+"px",o.style.width=l+"px",o.style.textAlign=b,o.style.whiteSpace="nowrap"
}},$render_pie3D:function(t,e,i,s,n,r){this.So(t,e,i,s,this.s.cant,r)},$render_donut:function(t,e,i,s,n,r){if(e.length){this.So(t,e,i,s,1,r,n);var a=this.s,h=this.To(i,s),o=a.radius?a.radius:h.radius,l=a.innerRadius&&a.innerRadius<o?a.innerRadius:o/3,c=a.x?a.x:h.x,u=a.y?a.y:h.y;t.fillStyle="#ffffff",t.beginPath(),t.arc(c,u,l,0,2*Math.PI,!0),t.fill()
}}}),webix.extend(webix.ui.chart,{$render_bar:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v,w,g=s.y-i.y;w=!!this.s.yAxis,v=!!this.s.xAxis,l=this.Go(),c=l.max,u=l.min,h=(s.x-i.x)/e.length,n||"auto"!=this.s.origin&&!w||this.uo(e,i,s,u,c,h),w&&(c=parseFloat(this.s.yAxis.end),u=parseFloat(this.s.yAxis.start)),b=this.Ho(u,c),d=b[0],f=b[1],p=d?g/d:d,w||"auto"!=this.s.origin&&v||(x=10,p=d?(g-x)/d:x),!n&&"auto"!=this.s.origin&&!w&&this.s.origin>u&&this.wo(t,e,i,s,h,s.y-p*(this.s.origin-u)),a=parseInt(this.s.barWidth,10);
var m=0,y=0;for(o=0;o<this.go.length;o++)o==n&&(y=m),"bar"==this.go[o].type&&m++;this.go&&a*m+4>h&&(a=parseInt(h/m-4,10));var _=(h-a*m)/2,$="undefined"!=typeof this.s.radius?parseInt(this.s.radius,10):Math.round(a/5),k=!1,I=this.s.gradient;for(I&&"function"!=typeof I?(k=I,I=!1):I&&(I=t.createLinearGradient(0,s.y,0,i.y),this.s.gradient(I)),v||this.zo(t,i.x,s.y+.5,s.x,s.y+.5,"#000000",1),o=0;o<e.length;o++){var S=parseFloat(this.s.value(e[o])||0);
if(this.Bo&&(S=this.Do(S)),!isNaN(S)){S>c&&(S=c),S-=u,S*=f;var C=i.x+_+o*h+(a+1)*y,E=s.y;if(0>S||this.s.yAxis&&0===S&&!("auto"!=this.s.origin&&this.s.origin>u))this.canvases[n].renderTextAt(!0,!0,C+Math.floor(a/2),E,this.s.label(e[o]));else{w||"auto"!=this.s.origin&&v||(S+=x/p);var M=I||this.s.color.call(this,e[o]);
t.globalAlpha=this.s.alpha.call(this,e[o]);var j=this.bp(t,i,C,E,a,u,$,p,S,M,I,k);k&&this.cp(t,C,E,a,u,$,p,S,M,k),this.s.border&&this.dp(t,C,E,a,u,$,p,S,M),t.globalAlpha=1,j[0]!=C?this.canvases[n].renderTextAt(!1,!0,C+Math.floor(a/2),j[1],this.s.label(e[o])):this.canvases[n].renderTextAt(!0,!0,C+Math.floor(a/2),j[3],this.s.label(e[o])),r.addRect(e[o].id,[C-i.x,j[3]-i.y,j[2]-i.x,j[1]-i.y],n)
}}}},ep:function(t,e,i,s,n,r,a){var h=this.s.xAxis,o=i;return h&&"auto"!=this.s.origin&&this.s.origin>a&&(i-=(this.s.origin-a)*n,o=i,s-=this.s.origin-a,0>s&&(s*=-1,t.translate(e+r,i),t.rotate(Math.PI),e=0,i=0),i-=.5),{value:s,x0:e,y0:i,start:o}},bp:function(t,e,i,s,n,r,a,h,o,l,c,u){t.save(),t.fillStyle=l;
var d=this.ep(t,i,s,o,h,n,r),f=this.fp(t,d.x0,d.y0,n,a,h,d.value,this.s.border?1:0);c&&!u&&t.lineTo(d.x0+(this.s.border?1:0),e.y),t.fill(),t.restore();var b=d.x0,x=d.x0!=i?i+f[0]:f[0],p=d.x0!=i?d.start-f[1]-d.y0:d.y0,v=d.x0!=i?d.start-d.y0:f[1];return[b,p,x,v]},gp:function(t,e){var i,s;s=webix.color.toRgb(e),i=webix.color.rgbToHsv(s[0],s[1],s[2]),i[2]/=1.4,e="rgb("+webix.color.hsvToRgb(i[0],i[1],i[2])+")",t.strokeStyle=e,1==t.globalAlpha&&(t.globalAlpha=.9)
},dp:function(t,e,i,s,n,r,a,h,o){var l;t.save(),l=this.ep(t,e,i,h,a,s,n),this.gp(t,o),this.fp(t,l.x0,l.y0,s,r,a,l.value,t.lineWidth/2,1),t.stroke(),t.restore()},cp:function(t,e,i,s,n,r,a,h,o,l){t.save();var c=this.ep(t,e,i,h,a,s,n),u=this.Oo(t,c.x0,c.y0,c.x0+s,c.y0-a*c.value+2,l,o,"y"),d=this.s.border?1:0;
t.fillStyle=u.gradient,this.fp(t,c.x0+u.offset,c.y0,s-2*u.offset,r,a,c.value,u.offset+d),t.fill(),t.restore()},fp:function(t,e,i,s,n,r,a,h,o){t.beginPath();var l=0;if(n>r*a){var c=(n-r*a)/n;1>=c&&c>=-1&&(l=-Math.acos(c)+Math.PI/2)}t.moveTo(e+h,i);var u=i-Math.floor(r*a)+n+(n?0:h);r*a>n&&t.lineTo(e+h,u);
var d=e+n;n&&n>0&&t.arc(d,u,n-h,-Math.PI+l,-Math.PI/2,!1);var f=e+s-n-h,b=u-n+(n?h:0);t.lineTo(f,b),n&&n>0&&t.arc(f+h,u,n-h,-Math.PI/2,0-l,!1);var x=e+s-h;return t.lineTo(x,i),o||t.lineTo(e+h,i),[x,b]}}),webix.extend(webix.ui.chart,{$render_line:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v;if(l=this.hp(t,e,i,s,n),a=this.s,e.length){for(c=a.offset?i.x+.5*l.cellWidth:i.x,o=[],h=0;h<e.length;h++)if(v=this.ip(e[h],i,s,l)){if(d=h?l.cellWidth*h-.5+c:c,b="object"==typeof v?v.y0:v,h&&this.s.fixOverflow){if(p=this.ip(e[h-1],i,s,l),p.out&&p.out==v.out)continue;
u=l.cellWidth*(h-1)-.5+c,f="object"==typeof p?p.y0:p,p.out&&(x="min"==p.out?s.y:i.y,o.push({x:this.jp(u,d,f,b,x),y:x})),v.out&&(x="min"==v.out?s.y:i.y,o.push({x:this.jp(u,d,f,b,x),y:x}))}v.out||o.push({x:d,y:v,index:h})}for(this.kp=i,h=1;h<=o.length;h++)u=o[h-1].x,f=o[h-1].y,h<o.length&&(d=o[h].x,b=o[h].y,this.zo(t,u,f,d,b,a.line.color.call(this,e[h-1]),a.line.width),a.line&&a.line.shadow&&(t.globalAlpha=.3,this.zo(t,u+2,f+a.line.width+8,d+2,b+a.line.width+8,"#eeeeee",a.line.width+3),t.globalAlpha=1)),"undefined"!=typeof o[h-1].index&&this.lp(t,u,f,e[o[h-1].index],a.label(e[o[h-1].index]),n,r,i)
}},jp:function(t,e,i,s,n){return t+(n-i)*(e-t)/(s-i)},lp:function(t,e,i,s,n,r,a){var h=this.s.item,o=parseInt(h.radius.call(this,s),10)||0,l=this.kp;if(o){if(t.save(),h.shadow){t.lineWidth=1,t.strokeStyle="#bdbdbd",t.fillStyle="#bdbdbd";for(var c=[.1,.2,.3],u=c.length-1;u>=0;u--)t.globalAlpha=c[u],t.strokeStyle="#d0d0d0",t.beginPath(),this.Lo(t,e,i+2*o/3,o+u+1,h.type),t.stroke();
t.beginPath(),t.globalAlpha=.3,t.fillStyle="#bdbdbd",this.Lo(t,e,i+2*o/3,o+1,h.type),t.fill()}t.restore(),t.lineWidth=h.borderWidth,t.fillStyle=h.color.call(this,s),t.strokeStyle=h.borderColor.call(this,s),t.globalAlpha=h.alpha.call(this,s),t.beginPath(),this.Lo(t,e,i,o+1,h.type),t.fill(),t.stroke(),t.globalAlpha=1
}if(n&&this.canvases[r].renderTextAt(!1,!0,e,i-o-this.s.labelOffset,this.s.label.call(this,s)),a){var d=this.s.eventRadius||o+1;a.addRect(s.id,[e-d-l.x,i-d-l.y,e+d-l.x,i+d-l.y],r)}},Lo:function(t,e,i,s,n){var r=[];if(!n||"square"!=n&&"s"!=n)if(!n||"diamond"!=n&&"d"!=n)r=!n||"triangle"!=n&&"t"!=n?[[e,i,s,0,2*Math.PI,!0]]:[[e,i-s],[e+Math.sqrt(3)*s/2,i+s/2],[e-Math.sqrt(3)*s/2,i+s/2],[e,i-s]];
else{var a=t.lineWidth>1?t.lineWidth*Math.sqrt(2)/4:0;r=[[e,i-s],[e+s,i],[e,i+s],[e-s,i],[e+a,i-s-a]]}else s*=Math.sqrt(2)/2,r=[[e-s-t.lineWidth/2,i-s],[e+s,i-s],[e+s,i+s],[e-s,i+s],[e-s,i-s]];this.Mo(t,r)},ip:function(t,e,i,s){var n=s.minValue,r=s.maxValue,a=s.unit,h=s.valueFactor,o=this.s.value(t);
this.Bo&&(o=this.Do(o));var l=(parseFloat(o||0)-n)*h;this.s.yAxis||(l+=s.startValue/a);var c=i.y-a*l;return!this.s.fixOverflow||"line"!=this.s.type&&"area"!=this.s.type?(o>r&&(c=e.y),(0>l||n>o)&&(c=i.y)):o>r?c={y:e.y,y0:c,out:"max"}:(0>l||n>o)&&(c={y:i.y,y0:c,out:"min"}),c},hp:function(t,e,i,s,n){var r,a={};
a.totalHeight=s.y-i.y,a.cellWidth=(s.x-i.x)/(this.s.offset?e.length:e.length-1);var h=!!this.s.yAxis,o=-1!=this.s.type.indexOf("stacked")?this.No(e):this.Go();a.maxValue=o.max,a.minValue=o.min,n||this.uo(e,i,s,a.minValue,a.maxValue,a.cellWidth),h&&(a.maxValue=parseFloat(this.s.yAxis.end),a.minValue=parseFloat(this.s.yAxis.start));
var l=this.Ho(a.minValue,a.maxValue);return r=l[0],a.valueFactor=l[1],a.unit=r?a.totalHeight/r:10,a.startValue=0,h||(a.startValue=10,a.unit!=a.totalHeight&&(a.unit=r?(a.totalHeight-a.startValue)/r:10)),a}}),webix.extend(webix.ui.chart,{$render_barH:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v,w,g,m,y,_,$,k,I,S;
for(o=(s.y-i.y)/e.length,d=this.Go("h"),f=d.max,b=d.min,y=s.x-i.x,S=!!this.s.yAxis,n||this.mp(t,e,i,s,b,f,o),S&&(f=parseFloat(this.s.xAxis.end),b=parseFloat(this.s.xAxis.start)),g=this.Ho(b,f),v=g[0],p=g[1],$=v?y/v:10,S||(m=10,$=v?(y-m)/v:10),h=parseInt(this.s.barWidth,10),h*this.go.length+4>o&&(h=o/this.go.length-4),a=Math.floor((o-h*this.go.length)/2),w="undefined"!=typeof this.s.radius?parseInt(this.s.radius,10):Math.round(h/5),x=!1,c=this.s.gradient,c&&"function"!=typeof c?(x=c,c=!1):c&&(c=t.createLinearGradient(i.x,i.y,s.x,i.y),this.s.gradient(c)),S||this.zo(t,i.x-.5,i.y,i.x-.5,s.y,"#000000",1),u=0;u<e.length;u++)if(_=parseFloat(this.s.value(e[u]||0)),this.Bo&&(_=this.Do(_)),_>f&&(_=f),_-=b,_*=p,k=i.x,I=i.y+a+u*o+(h+1)*n,0>_&&"auto"==this.s.origin||this.s.xAxis&&0===_&&!("auto"!=this.s.origin&&this.s.origin>b))this.canvases[n].renderTextAt("middle","right",k+10,I+h/2+a,this.s.label(e[u]));
else{0>_&&"auto"!=this.s.origin&&this.s.origin>b&&(_=0),S||(_+=m/$),l=c||this.s.color.call(this,e[u]),this.s.border&&this.np(t,k,I,h,b,w,$,_,l),t.globalAlpha=this.s.alpha.call(this,e[u]);var C=this.op(t,s,k,I,h,b,w,$,_,l,c,x);x&&this.pp(t,k,I,h,b,w,$,_,l,x),t.globalAlpha=1,C[3]==I?(this.canvases[n].renderTextAt("middle","left",C[0]-5,C[3]+Math.floor(h/2),this.s.label(e[u])),r.addRect(e[u].id,[C[0]-i.x,C[3]-i.y,C[2]-i.x,C[3]+h-i.y],n)):(this.canvases[n].renderTextAt("middle",!1,C[2]+5,C[1]+Math.floor(h/2),this.s.label(e[u])),r.addRect(e[u].id,[C[0]-i.x,I-i.y,C[2]-i.x,C[3]-i.y],n))
}},qp:function(t,e,i,s,n,r,a,h,o){var l=0;if(n>r*a){var c=(n-r*a)/n;l=-Math.asin(c)+Math.PI/2}t.moveTo(e,i+h);var u=e+r*a-n-(n?0:h);r*a>n&&t.lineTo(u,i+h);var d=i+n;n&&n>0&&t.arc(u,d,n-h,-Math.PI/2+l,0,!1);var f=i+s-n-(n?0:h),b=u+n-(n?h:0);t.lineTo(b,f),n&&n>0&&t.arc(u,f,n-h,0,Math.PI/2-l,!1);var x=i+s-h;
return t.lineTo(e,x),o||t.lineTo(e,i+h),[b,x]},mp:function(t,e,i,s,n,r,a){var h=0;this.s.xAxis&&(this.canvases.x||(this.canvases.x=this.lo("axis_x")),h=this.rp(this.canvases.x.getCanvas(),e,i,s,n,r)),this.s.yAxis&&(this.canvases.y||(this.canvases.y=this.lo("axis_y")),this.sp(this.canvases.y.getCanvas(),e,i,s,a,h))
},sp:function(t,e,i,s,n,r){if(this.s.yAxis){var a,h=parseInt(r?r:i.x,10)-.5,o=s.y+.5,l=i.y;this.zo(t,h,o,h,l,this.s.yAxis.color,1);for(var c=0;c<e.length;c++){var u="auto"!=this.s.origin&&"barH"==this.s.type&&parseFloat(this.s.value(e[c]))<this.s.origin;a=l+n/2+c*n,this.canvases.y.renderTextAt("middle",u?!1:"left",u?h+5:h-5,a,this.s.yAxis.template(e[c]),"webix_axis_item_y",u?0:h-10),this.s.yAxis.lines.call(this,e[c])&&this.zo(t,i.x,a,s.x,a,this.s.yAxis.lineColor.call(this,e[c]),1)
}this.zo(t,i.x+.5,l+.5,s.x,l+.5,this.s.yAxis.lineColor.call(this,{}),1),this.Co(i,s)}},rp:function(t,e,i,s,n,r){var a,h={},o=this.s.xAxis;if(o){var l=s.y+.5,c=i.x-.5,u=s.x-.5,d=i.x;if(this.zo(t,c,l,u,l,o.color,1),o.step&&(a=parseFloat(o.step)),("undefined"==typeof this.so.step||"undefined"==typeof this.so.start||"undefined"==typeof this.so.end)&&(h=this.Ao(n,r),n=h.start,r=h.end,a=h.step,this.s.xAxis.end=r,this.s.xAxis.start=n,this.s.xAxis.step=a),0!==a){for(var f=(u-c)*a/(r-n),b=0,x=n;r>=x;x+=a){var p=this.Bo?Math.pow(10,x):x;
h.fixNum&&(p=parseFloat(p).toFixed(h.fixNum));var v=Math.floor(c+b*f)+.5;if(x==n&&"auto"==this.s.origin||!o.lines.call(this,x)||this.zo(t,v,l,v,i.y,this.s.xAxis.lineColor.call(this,x),1),x==this.s.origin&&(d=v+1),1>a&&!this.Bo){var w=Math.min(Math.floor(this.Do(a)),0>=n?0:Math.floor(this.Do(n))),g=Math.pow(10,-w);
p=Math.round(p*g)/g,x=p}this.canvases.x.renderTextAt(!1,!0,v,l+2,o.template(p.toString()),"webix_axis_item_x"),b++}return this.canvases.x.renderTextAt(!0,!1,c,s.y+this.s.padding.bottom-3,this.s.xAxis.title,"webix_axis_title_x",s.x-i.x),o.lines.call(this,{})||this.zo(t,c,i.y-.5,u,i.y-.5,this.s.xAxis.color,.2),d
}}},tp:function(t,e,i,s,n,r,a){var h=this.s.yAxis,o=e;return h&&"auto"!=this.s.origin&&this.s.origin>a&&(e+=(this.s.origin-a)*n,o=e,s-=this.s.origin-a,0>s&&(s*=-1,t.translate(e,i+r),t.rotate(Math.PI),e=.5,i=0),e+=.5),{value:s,x0:e,y0:i,start:o}},op:function(t,e,i,s,n,r,a,h,o,l,c,u){t.save();var d=this.tp(t,i,s,o,h,n,r);
t.fillStyle=l,t.beginPath();var f=this.qp(t,d.x0,d.y0,n,a,h,d.value,this.s.border?1:0);c&&!u&&t.lineTo(e.x,d.y0+(this.s.border?1:0)),t.fill(),t.restore();var b=d.y0,x=d.y0!=s?s:f[1],p=d.y0!=s?d.start-f[0]:d.start,v=d.y0!=s?d.start:f[0];return[p,b,v,x]},np:function(t,e,i,s,n,r,a,h,o){t.save();var l=this.tp(t,e,i,h,a,s,n);
t.beginPath(),this.gp(t,o),t.globalAlpha=.9,this.qp(t,l.x0,l.y0,s,r,a,l.value,t.lineWidth/2,1),t.stroke(),t.restore()},pp:function(t,e,i,s,n,r,a,h,o,l){t.save();var c=this.tp(t,e,i,h,a,s,n),u=this.Oo(t,c.x0,c.y0+s,c.x0+a*c.value,c.y0,l,o,"x");t.fillStyle=u.gradient,t.beginPath(),this.qp(t,c.x0,c.y0+u.offset,s-2*u.offset,r,a,c.value,u.offset),t.fill(),t.globalAlpha=1,t.restore()
}}),webix.extend(webix.ui.chart,{$render_stackedBar:function(t,e,i,s,n,r){var a,h,o,l,c=s.y-i.y,u=!!this.s.yAxis,d=!!this.s.xAxis,f=this.No(e);a=f.max,h=f.min;var b=Math.floor((s.x-i.x)/e.length);n||this.uo(e,i,s,h,a,b),u&&(a=parseFloat(this.s.yAxis.end),h=parseFloat(this.s.yAxis.start));var x=this.Ho(h,a);
l=x[0],o=x[1];var p=l?c/l:10,v=parseInt(this.s.barWidth,10);v+4>b&&(v=b-4);var w=Math.floor((b-v)/2),g=this.s.gradient?this.s.gradient:!1;d||this.zo(t,i.x,s.y+.5,s.x,s.y+.5,"#000000",1);for(var m=0;m<e.length;m++){var y=parseFloat(this.s.value(e[m]||0));if(this.Bo&&(y=this.Do(y)),y){n||(y-=h),y*=o;var _=i.x+w+m*b,$=s.y;
if(n?$=e[m].$startY:e[m].$startY=$,!($<i.y+1))if(0>y||this.s.yAxis&&0===y)this.canvases.y.renderTextAt(!0,!0,_+Math.floor(v/2),$,this.s.label(e[m]));else{var k=this.s.color.call(this,e[m]);t.globalAlpha=this.s.alpha.call(this,e[m]),t.fillStyle=this.s.color.call(this,e[m]),t.beginPath();var I=this.up(t,_-(this.s.border?.5:0),$,v+(this.s.border?.5:0),p,y,0,i.y);
if(t.fill(),g){t.save();var S=this.Oo(t,_,$,_+v,I[1],g,k,"y");t.fillStyle=S.gradient,t.beginPath(),I=this.up(t,_+S.offset,$,v-2*S.offset,p,y,this.s.border?1:0,i.y),t.fill(),t.restore()}this.s.border&&(t.save(),this.gp(t,k),t.beginPath(),this.up(t,_-.5,$,v+1,p,y,0,i.y,1),t.stroke(),t.restore()),t.globalAlpha=1,this.canvases[n].renderTextAt(!1,!0,_+Math.floor(v/2),I[1]+($-I[1])/2-7,this.s.label(e[m])),r.addRect(e[m].id,[_-i.x,I[1]-i.y,I[0]-i.x,(e[m].$startY||$)-i.y],n),e[m].$startY=this.s.border?I[1]+1:I[1]
}}else n&&e[m].$startY||(e[m].$startY=s.y)}},up:function(t,e,i,s,n,r,a,h,o){t.moveTo(e,i);var l=i-n*r+a;h>l&&(l=h),t.lineTo(e,l);var c=e+s,u=l;t.lineTo(c,u);var d=e+s;return t.lineTo(d,i),o||t.lineTo(e,i),[d,u-2*a]}}),webix.extend(webix.ui.chart,{$render_stackedBarH:function(t,e,i,s,n,r){var a,h,o,l,c=s.x-i.x,u=!!this.s.yAxis,d=this.No(e);
a=d.max,h=d.min;var f=Math.floor((s.y-i.y)/e.length);n||this.mp(t,e,i,s,h,a,f),u&&(a=parseFloat(this.s.xAxis.end),h=parseFloat(this.s.xAxis.start));var b=this.Ho(h,a);l=b[0],o=b[1];var x=l?c/l:10,p=0;u||(p=10,x=l?(c-p)/l:10);var v=parseInt(this.s.barWidth,10);v+4>f&&(v=f-4);var w=(f-v)/2,g=0,m=!1,y=this.s.gradient;
y&&(m=!0),u||this.zo(t,i.x-.5,i.y,i.x-.5,s.y,"#000000",1);var _=0,$=0;for(k=0;k<this.go.length;k++)k==n&&($=_),"stackedBarH"==this.go[k].type&&_++;for(var k=0;k<e.length;k++){$||(e[k].$startX=i.x);var I=parseFloat(this.s.value(e[k]||0));I>a&&(I=a),I-=h,I*=o;var S=i.x,C=i.y+w+k*f;if($?S=e[k].$startX:e[k].$startX=S,0>I||this.s.yAxis&&0===I)this.canvases.y.renderTextAt("middle",!0,S+10,C+v/2,this.s.label(e[k]));
else{u||(I+=p/x);var E=this.s.color.call(this,e[k]);t.globalAlpha=this.s.alpha.call(this,e[k]),t.fillStyle=this.s.color.call(this,e[k]),t.beginPath();var M=this.qp(t,S,C,v,g,x,I,this.s.border?1:0);if(y&&!m&&t.lineTo(i.x+c,C+(this.s.border?1:0)),t.fill(),m){var j=this.Oo(t,S,C+v,S,C,m,E,"x");t.fillStyle=j.gradient,t.beginPath(),M=this.qp(t,S,C,v,g,x,I,0),t.fill()
}this.s.border&&this.np(t,S,C,v,h,g,x,I,E),t.globalAlpha=1,this.canvases[n].renderTextAt("middle",!0,e[k].$startX+(M[0]-e[k].$startX)/2-1,C+(M[1]-C)/2,this.s.label(e[k])),r.addRect(e[k].id,[e[k].$startX-i.x,C-i.y,M[0]-i.x,M[1]-i.y],n),e[k].$startX=M[0]}}}}),webix.extend(webix.ui.chart,{$render_spline:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v,w;
if(c=this.hp(t,e,i,s,n),a=this.s,this.kp=i,o=[],e.length){for(f=a.offset?i.x+.5*c.cellWidth:i.x,h=0;h<e.length;h++)p=this.ip(e[h],i,s,c),p&&(d=h?c.cellWidth*h-.5+f:f,o.push({x:d,y:p,index:h}));for(u=this.vp(o),h=0;h<o.length;h++){if(b=o[h].x,v=o[h].y,h<o.length-1){for(x=o[h+1].x,w=o[h+1].y,l=b;x>l;l++){var g=this.wp(l,b,h,u.a,u.b,u.c,u.d);
g<i.y&&(g=i.y),g>s.y&&(g=s.y);var m=this.wp(l+1,b,h,u.a,u.b,u.c,u.d);m<i.y&&(m=i.y),m>s.y&&(m=s.y),this.zo(t,l,g,l+1,m,a.line.color(e[h]),a.line.width)}this.zo(t,x-1,this.wp(l,b,h,u.a,u.b,u.c,u.d),x,w,a.line.color(e[h]),a.line.width)}this.lp(t,b,v,e[o[h].index],a.label(e[o[h].index]),n,r)}}},vp:function(t){var e,i,s,n,r,a,h,o,l=[],c=[],u=t.length;
for(r=0;u-1>r;r++)l[r]=t[r+1].x-t[r].x,c[r]=(t[r+1].y-t[r].y)/l[r];for(h=[],o=[],h[0]=0,h[1]=2*(l[0]+l[1]),o[0]=0,o[1]=6*(c[1]-c[0]),r=2;u-1>r;r++)h[r]=2*(l[r-1]+l[r])-l[r-1]*l[r-1]/h[r-1],o[r]=6*(c[r]-c[r-1])-l[r-1]*o[r-1]/h[r-1];for(a=[],a[u-1]=a[0]=0,r=u-2;r>=1;r--)a[r]=(o[r]-l[r]*a[r+1])/h[r];for(e=[],i=[],s=[],n=[],r=0;u-1>r;r++)e[r]=t[r].y,i[r]=-l[r]*a[r+1]/6-l[r]*a[r]/3+(t[r+1].y-t[r].y)/l[r],s[r]=a[r]/2,n[r]=(a[r+1]-a[r])/(6*l[r]);
return{a:e,b:i,c:s,d:n}},wp:function(t,e,i,s,n,r,a){return s[i]+(t-e)*(n[i]+(t-e)*(r[i]+(t-e)*a[i]))}}),webix.extend(webix.ui.chart,{$render_area:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v,w,g,m;if(u=this.hp(t,e,i,s,n),h=this.s,l=h.eventRadius||Math.floor(u.cellWidth/2),e.length){for(d=[],x=h.offset?i.x+.5*u.cellWidth:i.x,o=0;o<e.length;o++)if(c=e[o],b=this.ip(c,i,s,u),w=x+u.cellWidth*o,b){if(g="object"==typeof b?b.y0:b,o&&this.s.fixOverflow){if(f=this.ip(e[o-1],i,s,u),f.out&&f.out==b.out)continue;
p=u.cellWidth*(o-1)-.5+x,v="object"==typeof f?f.y0:f,f.out&&(m="min"==f.out?s.y:i.y,d.push([this.jp(p,w,v,g,m),m])),b.out&&(m="min"==b.out?s.y:i.y,d.push([this.jp(p,w,v,g,m),m]),o==e.length-1&&m==i.y&&d.push([w,i.y]))}b.out||(d.push([w,g]),r.addRect(c.id,[w-l-i.x,g-l-i.y,w+l-i.x,g+l-i.y],n)),h.yAxis||(a=h.offset||o!=e.length-1?"center":"left",this.canvases[n].renderTextAt(!1,a,w,g-h.labelOffset,h.label(c)))
}d.length&&(d.push([w,s.y]),d.push([d[0][0],s.y])),t.globalAlpha=this.s.alpha.call(this,e[0]),t.fillStyle=this.s.color.call(this,e[0]),t.beginPath(),this.Mo(t,d),t.fill(),h.border&&(t.lineWidth=h.borderWidth||1,h.borderColor?t.strokeStyle=h.borderColor.call(this,e[0]):this.gp(t,t.fillStyle),t.beginPath(),this.Mo(t,d),t.stroke()),t.lineWidth=1,t.globalAlpha=1
}},$render_stackedArea:function(t,e,i,s,n,r){var a,h,o,l,c,u,d,f,b,x,p,v,w,g;if(x=this.hp(t,e,i,s,n),l=this.s,f=l.eventRadius||Math.floor(x.cellWidth/2),e.length){p=[],g=[],v=l.offset?i.x+.5*x.cellWidth:i.x;var m=function(t,i){return n?e[t].$startY?i-s.y+e[t].$startY:0:i},y=function(t,e,i){var s=(i.y-e.y)/(i.x-e.x);
return s*t+e.y-s*e.x};for(c=0;c<e.length;c++)b=e[c],c?v+=x.cellWidth:(w=m(c,s.y),p.push([v,w])),w=m(c,this.ip(b,i,s,x)),g.push(isNaN(w)&&!c?e[c].$startY||s.y:w),w&&(p.push([v,w]),r.addRect(b.id,[v-f-i.x,w-f-i.y,v+f-i.x,w+f-i.y],n),l.yAxis||(o=!l.offset&&d?"left":"center",this.canvases[n].renderTextAt(!1,o,v,w-l.labelOffset,l.label(b))));
if(p.push([v,m(c-1,s.y)]),n)for(c=e.length-2;c>0;c--)v-=x.cellWidth,w=e[c].$startY,w&&p.push([v,w]);for(p.push([p[0][0],p[0][1]]),t.globalAlpha=this.s.alpha.call(this,e[0]),t.fillStyle=this.s.color.call(this,e[0]),t.beginPath(),this.Mo(t,p),t.fill(),c=0;c<e.length;c++){if(w=g[c],!w)for(c==e.length-1&&(w=e[c].$startY),u=c+1;u<e.length;u++)if(g[u]){a={x:i.x,y:g[0]},h={x:i.x+x.cellWidth*u,y:g[u]},w=y(i.x+x.cellWidth*c,a,h);
break}e[c].$startY=w}}}}),webix.extend(webix.ui.chart,{$render_radar:function(t,e,i,s,n,r){this.xp(t,e,i,s,n,r)},xp:function(t,e,i,s,n,r){if(e.length){for(var a=this.To(i,s),h=this.s.radius?this.s.radius:a.radius,o=this.s.x?this.s.x:a.x,l=this.s.y?this.s.y:a.y,c=[],u=0;u<e.length;u++)c.push(1);var d=this.Wo(c,e.length);
this.kp=i,n||this.yp(d,o,l,h,e),this.zp(t,d,o,l,h,e,n,r)}},zp:function(t,e,i,s,n,r,a,h){var o,l,c,u,d,f,b,x,p,v,w,g,m,y,_,$,k,I,S;for(c=this.s,d=c.yAxis.start,f=c.yAxis.end,S=this.Ho(d,f),g=S[0],I=g?n/g:n/2,k=S[1],m=-Math.PI/2,o=l=m,p=[],x=0,u=0;u<r.length;u++)$?_=$:(y=c.value(r[u]),this.Bo&&(y=this.Do(y)),_=(parseFloat(y||0)-d)*k),v=Math.floor(I*_),y=c.value(u!=r.length-1?r[u+1]:r[0]),this.Bo&&(y=this.Do(y)),$=(parseFloat(y||0)-d)*k,w=Math.floor(I*$),o=l,l=u!=r.length-1?m+e[u]-1e-4:m,b=x||this.Qo(o,i,s,v),x=this.Qo(l,i,s,w),p.push(b);
c.fill&&this.Ap(t,p,r),!c.disableLines&&r.length>2&&this.Bp(t,p,r),(!c.disableItems||r.length<3)&&this.Cp(t,p,r,a,h),p=null},Cp:function(t,e,i,s,n){for(var r=0;r<e.length;r++)this.lp(t,e[r].x,e[r].y,i[r],this.s.label.call(this,i),s,n)},Ap:function(t,e,i){var s,n;t.globalAlpha=this.s.alpha.call(this,{}),t.beginPath();
for(var r=0;r<e.length;r++)t.fillStyle=this.s.fill.call(this,i[r]),s=e[r],n=e[r+1]||e[0],r||t.moveTo(s.x,s.y),t.lineTo(n.x,n.y);t.fill(),t.globalAlpha=1},Bp:function(t,e,i){for(var s,n,r=0;r<e.length;r++)s=e[r],n=e[r+1]||e[0],this.zo(t,s.x,s.y,n.x,n.y,this.s.line.color.call(this,i[r]),this.s.line.width)
},yp:function(t,e,i,s,n){var r=this.s.yAxis,a=this.s.xAxis,h=r.start,o=r.end,l=r.step,c={},u=this.to;if("undefined"==typeof u.step||"undefined"==typeof u.start||"undefined"==typeof u.end){var d=this.Go();c=this.Ao(d.min,d.max),h=c.start,o=c.end,l=c.step,r.end=o,r.start=h}var f,b,x,p,v,w=[],g=0,m=s*l/(o-h);
1>l&&(p=Math.min(this.Do(l),0>=h?0:this.Do(h)),v=Math.pow(10,-p));var y=[];this.canvases.scale||(this.canvases.scale=this.lo("radar_scale"));var _=this.canvases.scale.getCanvas();for(f=o;f>=h;f-=l){var $=this.Bo?Math.pow(10,f):f;c.fixNum&&($=parseFloat(f).toFixed(c.fixNum)),w.push(Math.floor(g*m)+.5),v&&!this.Bo&&($=Math.round($*v)/v,f=$);
var k=i-s+w[w.length-1];if(this.canvases.scale.renderTextAt("middle","left",e,k,r.template($.toString()),"webix_axis_item_y webix_radar"),t.length<2)return void this.Dp(_,"arc",e,i,s-w[w.length-1],-Math.PI/2,3*Math.PI/2,f);var I,S=-Math.PI/2,C=S;for(b=0;b<t.length;b++)f==o&&y.push(C),I=S+t[b]-1e-4,this.Dp(_,t.length>2?u.lineShape||"line":"arc",e,i,s-w[w.length-1],C,I,f,b,n[f]),C=I;
g++}for(f=0;f<y.length;f++)x=this.Qo(y[f],e,i,s),a.lines.call(this,n[f],f)&&this.zo(_,e,i,x.x,x.y,a?a.lineColor.call(this,n[f]):"#cfcfcf",1),this.Ep(_,e,i,s,y[f],a?a.template.call(this,n[f]):"&nbsp;")},Dp:function(t,e,i,s,n,r,a,h,o){var l,c;if(0>n)return!1;l=this.Qo(r,i,s,n),c=this.Qo(a,i,s,n);var u=this.s.yAxis;
u.bg&&(t.beginPath(),t.moveTo(i,s),"arc"==e?t.arc(i,s,n,r,a,!1):(t.lineTo(l.x,l.y),t.lineTo(c.x,c.y)),t.fillStyle=u.bg(h,o),t.moveTo(i,s),t.fill(),t.closePath()),u.lines.call(this,h)&&(t.lineWidth=1,t.beginPath(),"arc"==e?t.arc(i,s,n,r,a,!1):(t.moveTo(l.x,l.y),t.lineTo(c.x,c.y)),t.strokeStyle=u.lineColor.call(this,h),t.stroke())
},Ep:function(t,e,i,s,n,r){var a=this.canvases.scale.renderText(0,0,r,"webix_axis_radar_title",1),h=a.scrollWidth,o=a.offsetHeight,l=.001,c=this.Qo(n,e,i,s+5),u=0,d=0;(0>n||n>Math.PI)&&(d=-o),n>Math.PI/2&&(u=-h),Math.abs(n+Math.PI/2)<l||Math.abs(n-Math.PI/2)<l?u=-h/2:(Math.abs(n)<l||Math.abs(n-Math.PI)<l)&&(d=-o/2),a.style.top=c.y+d+"px",a.style.left=c.x+u+"px",a.style.width=h+"px",a.style.whiteSpace="nowrap"
}}),webix.extend(webix.ui.chart,{$render_scatter:function(t,e,i,s,n,r){if(!this.s.xValue)return!1;var a=this.Go(),h=this.Go("h","xValue");n||(this.canvases.x||(this.canvases.x=this.lo("axis_x")),this.canvases.y||(this.canvases.y=this.lo("axis_y")),this.vo(this.canvases.y.getCanvas(),e,i,s,a.min,a.max),this.rp(this.canvases.x.getCanvas(),e,i,s,h.min,h.max)),a={min:this.s.yAxis.start,max:this.s.yAxis.end},h={min:this.s.xAxis.start,max:this.s.xAxis.end};
var o=this.Fp(t,e,i,s,h,a);this.kp=i;for(var l=0;l<e.length;l++)this.Gp(t,r,i,s,o,h,a,e[l],n)},Fp:function(t,e,i,s,n,r){var a={};return a.totalHeight=s.y-i.y,a.totalWidth=s.x-i.x,this.Hp(a,n.min,n.max,a.totalWidth,"X"),this.Hp(a,r.min,r.max,a.totalHeight,"Y"),a},Gp:function(t,e,i,s,n,r,a,h,o){var l=this.Ip(n,s,i,r,h,"X"),c=this.Ip(n,i,s,a,h,"Y");
this.lp(t,l,c,h,this.s.label.call(this,h),o,e)},Ip:function(t,e,i,s,n,r){var a=this.s["X"==r?"xValue":"value"].call(this,n),h=t["valueFactor"+r],o=(parseFloat(a||0)-s.min)*h,l=t["unit"+r],c=i[r.toLowerCase()]-("X"==r?-1:1)*Math.floor(l*o);return 0>o&&(c=i[r.toLowerCase()]),a>s.max&&(c=e[r.toLowerCase()]),a<s.min&&(c=i[r.toLowerCase()]),c
},Hp:function(t,e,i,s,n){var r=this.Ho(e,i);n=n||"",t["relValue"+n]=r[0],t["valueFactor"+n]=r[1],t["unit"+n]=t["relValue"+n]?s/t["relValue"+n]:10}}),webix.extend(webix.ui.chart,{presets:{simple:{item:{borderColor:"#ffffff",color:"#2b7100",shadow:!1,borderWidth:2},line:{color:"#8ecf03",width:2}},plot:{color:"#1293f8",item:{borderColor:"#636363",borderWidth:1,color:"#ffffff",type:"r",shadow:!1},line:{color:"#1293f8",width:2}},diamond:{color:"#b64040",item:{borderColor:"#b64040",color:"#b64040",type:"d",radius:3,shadow:!0},line:{color:"#ff9000",width:2}},point:{color:"#fe5916",disableLines:!0,fill:!1,disableItems:!1,item:{color:"#feb916",borderColor:"#fe5916",radius:2,borderWidth:1,type:"r"},alpha:1},line:{line:{color:"#3399ff",width:2},item:{color:"#ffffff",borderColor:"#3399ff",radius:2,borderWidth:2,type:"d"},fill:!1,disableItems:!1,disableLines:!1,alpha:1},area:{fill:"#3399ff",line:{color:"#3399ff",width:1},disableItems:!0,alpha:.2,disableLines:!1},round:{item:{radius:3,borderColor:"#3f83ff",borderWidth:1,color:"#3f83ff",type:"r",shadow:!1,alpha:.6}},square:{item:{radius:3,borderColor:"#447900",borderWidth:2,color:"#69ba00",type:"s",shadow:!1,alpha:1}},column:{color:"RAINBOW",gradient:!1,barWidth:45,radius:0,alpha:1,border:!0},stick:{barWidth:5,gradient:!1,color:"#67b5c9",radius:2,alpha:1,border:!1},alpha:{color:"#b9a8f9",barWidth:70,gradient:"falling",radius:0,alpha:.5,border:!0}}}),webix.protoUI({name:"calendar",defaults:{date:new Date,select:!1,navigation:!0,monthSelect:!0,weekHeader:!0,weekNumber:!1,skipEmptyWeeks:!1,calendarHeader:"%F %Y",calendarWeekHeader:"W#",events:webix.Date.isHoliday,minuteStep:5,icons:!1,timepickerHeight:30,headerHeight:70,dayTemplate:function(t){return t.getDate()
},width:259,height:250},dayTemplate_setter:webix.template,calendarHeader_setter:webix.Date.dateToStr,calendarWeekHeader_setter:webix.Date.dateToStr,calendarTime_setter:function(t){return this._w=t,webix.Date.dateToStr(t)},date_setter:function(t){return this.Jp(t)},maxDate_setter:function(t){return this.Jp(t)
},minDate_setter:function(t){return this.Jp(t)},$init:function(){this.x.className+=" webix_calendar",this.Kp={},this.Lp=this.Mp=null,this.Np=0},type_setter:function(t){return"time"==t&&(this.jq=!0,this.Np=-1),t},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()},$getSize:function(t,e){if(this.s.cellHeight){var i=this.Op(this.s.date);
this.s.height=this.s.cellHeight*i.Sp+(webix.skin.$active.calendarHeight||70)}return webix.ui.view.prototype.$getSize.call(this,t,e)},Op:function(t,e){if(!this.Pp||e){var i=t.getMonth(),s=t.getFullYear(),n=new Date(s,i+1,1),r=webix.Date.weekStart(new Date(s,i,1)),a=Math.round((n.valueOf()-r.valueOf())/864e5),h=this.s.skipEmptyWeeks?Math.ceil(a/7):6;
this.Pp={Qp:i,Rp:r,zc:n,Sp:h}}return this.Pp},$skin:function(){webix.skin.$active.calendar&&(webix.skin.$active.calendar.width&&(this.defaults.width=webix.skin.$active.calendar.width),webix.skin.$active.calendar.height&&(this.defaults.height=webix.skin.$active.calendar.height),webix.skin.$active.calendar.headerHeight&&(this.defaults.headerHeight=webix.skin.$active.calendar.headerHeight),webix.skin.$active.calendar.timepickerHeight&&(this.defaults.timepickerHeight=webix.skin.$active.calendar.timepickerHeight))
},Tp:function(t){for(var e=this.Op(t),i=this.s,s=[],n=[],r=this.bc-36,a=this.dc-this.s.headerHeight-10-(this.s.timepicker||this.ax?this.s.timepickerHeight:0),h=i.weekNumber?8:7,o=0;h>o;o++)n[o]=Math.ceil(r/(h-o)),r-=n[o];for(var l=e.Sp,c=0;l>c;c++)s[c]=Math.ceil(a/(l-c)),a-=s[c];return[n,s]},icons_setter:function(t){this.ax=t?"object"==typeof t?t:this.Sx:null
},ax:[],Sx:[{template:function(){return"<span class='webix_cal_icon_today webix_cal_icon'>"+webix.i18n.calendar.today+"</span>"},on_click:{webix_cal_icon_today:function(){this.setValue(new Date),this.callEvent("onTodaySet",[this.getSelectedDate()])}}},{template:function(){return"<span class='webix_cal_icon_clear webix_cal_icon'>"+webix.i18n.calendar.clear+"</span>"
},on_click:{webix_cal_icon_clear:function(){this.setValue(""),this.callEvent("onDateClear",[this.getSelectedDate()])}}}],refresh:function(){this.render()},render:function(){this.Np=0,this.Up=!1;var t=this.s;if(this.isVisible(t.id)){this.Vp=webix.Date.datePart(new Date),this.callEvent("onBeforeRender",[]);
var e=this.s.date,i=this.Op(e,!0),s=this.Tp(e),n=s[0],r=s[1],a="<div class='webix_cal_month'><span class='webix_cal_month_name"+(this.s.monthSelect?"":" webix_readonly")+"'>"+t.calendarHeader(e)+"</span>";if(t.navigation&&(a+="<div class='webix_cal_prev_button'></div><div class='webix_cal_next_button'></div>"),a+="</div>",t.weekHeader&&(a+="<div class='webix_cal_header'>"+this.Wp(n)+"</div>"),a+="<div class='webix_cal_body'>"+this.Xp(n,r,i)+"</div>",(this.s.timepicker||this.ax)&&(a+="<div class='webix_cal_footer'>",this.s.timepicker&&(a+=this.Yp(e)),this.ax&&(a+=this.bx()),a+="</div>"),this.w.innerHTML=a,"time"==this.s.type){var h=this.s.date;
h&&("string"==typeof h?e=webix.i18n.parseTimeFormatDate(h):webix.isArray(h)&&(e.setHours(h[0]),e.setMinutes(h[1]))),this.yt(-1,e)}this.callEvent("onAfterRender",[])}},bx:function(t){for(var e="<div class='webix_cal_icons'>",i=this.ax,s=0;s<i.length;s++){if(i[s].template){var n="function"==typeof i[s].template?i[s].template:webix.template(i[s].template);
e+=n.call(this,t)}i[s].on_click&&webix.extend(this.on_click,i[s].on_click)}return e+="</div>"},Yp:function(t){var e=this.s.calendarTime||webix.i18n.timeFormatStr;return"<div class='webix_cal_time"+(this.ax?" webix_cal_time_icons":"")+"'><span class='webix_icon fa-clock-o'></span> "+e(t)+"</div>"},Wp:function(t){var e=this.s,i="",s=0;
e.weekNumber&&(s=1,i+="<div class='webix_cal_week_header' style='width: "+t[0]+"px;' >"+e.calendarWeekHeader()+"</div>");for(var n=webix.Date.startOnMonday?1:0,r=0;7>r;r++){var a=(n+r)%7,h=webix.i18n.calendar.dayShort[a];i+="<div day='"+a+"' style='width: "+t[r+s]+"px;' >"+h+"</div>"}return i},blockDates_setter:function(t){return webix.toFunctor(t,this.$scope)
},Zp:function(t,e){var i="webix_cal_day";return webix.Date.equal(t,this.Vp)&&(i+=" webix_cal_today"),webix.Date.equal(t,this.Lp)&&(i+=" webix_cal_select"),t.getMonth()!=e.Qp&&(i+=" webix_cal_outside"),(this.s.blockDates&&this.s.blockDates.call(this,t)||t<this.s.minDate||t>this.s.maxDate)&&(i+=" webix_cal_day_disabled"),this.s.events&&(i+=" "+this.s.events(t)),i
},Xp:function(t,e,i){for(var s=this.s,n="",r=webix.Date.datePart(webix.Date.copy(i.Rp)),a=s.weekNumber?1:0,h=webix.Date.getISOWeek(webix.Date.add(r,2,"day",!0)),o=(this.s.minDate||new Date(1,1,1),this.s.maxDate||new Date(9999,1,1),0);o<e.length;o++){n+="<div class='webix_cal_row' style='height:"+e[o]+"px;line-height:"+e[o]+"px'>",a&&(n+="<div class='webix_cal_week_num' style='width:"+t[0]+"px'>"+h+"</div>");
for(var l=a;l<t.length;l++){var c=this.Zp(r,i),u=this.s.dayTemplate.call(this,r);n+="<div day='"+l+"' class='"+c+"' style='width:"+t[l]+"px'><span class='webix_cal_day_inner'>"+u+"</span></div>",r=webix.Date.add(r,1,"day"),r.getHours()&&(r=webix.Date.datePart(r))}n+="</div>",h++}return n},$p:function(t,e){var i=this.s.date;
e||(e=this.aq[this.Np]._p),this.Np||(i=webix.Date.copy(i),i.setDate(1));var s=webix.Date.add(i,t*e,"month",!0);this.bq(i,s)},bq:function(t,e){this.callEvent("onBeforeMonthChange",[t,e])&&(this.Np?this.cq(e):this.showCalendar(e),this.callEvent("onAfterMonthChange",[e,t]))},aq:{"-2":{dq:function(t,e){t.setMinutes(e)
}},"-1":{dq:function(t,e){t.setHours(e)}},0:{_p:1},1:{eq:function(t){return t.getFullYear()},fq:function(t){return webix.i18n.calendar.monthShort[t]},dq:function(t,e){e!=t.getMonth()&&t.setDate(1),t.setMonth(e)},_p:12},2:{eq:function(t){var e=t.getFullYear();return this.gq=e=e-e%10-1,e+" - "+(e+10)},fq:function(t){return this.gq+t
},dq:function(t,e){t.setFullYear(this.gq+e)},_p:120}},cq:function(t){var e,i,s,n,r,a="",h=this.s.weekHeader?2:1,o=this.aq[this.Np],l=this.w.childNodes;if(t&&(this.s.date=t),this.Up||(this.hq=this.w.offsetHeight-this.s.headerHeight-this.s.timepickerHeight,this.iq=l[h].offsetWidth,this.Up=1),this.jq){i=this.hq/6;
var c=6,u=this._w||webix.i18n.timeFormat,d=u.match(/%([a,A])/);for(d&&c++,r=parseInt((this.iq-3)/c,10),a+="<div class='webix_time_header'>"+this.kq(r,d)+"</div>",a+="<div  class='webix_cal_body' style='height:"+this.hq+"px'>",a+="<div class='webix_hours'>",n=this.s.date.getHours(),s=0;24>s;s++){if(e="",d&&((n>11&&11>=s||11>=n&&s>11)&&(e=" webix_cal_blurred_hours"),s%4===0)){var f=4==s?"AM":16==s?"PM":"";
a+="<div class='webix_cal_block_empty"+e+"' style='"+this.lq(r,i)+"clear:both;'>"+f+"</div>"}e+=n==s?" webix_selected":"";var b=webix.Date.toFixed(d&&s>12?s-12:s);a+="<div class='webix_cal_block"+e+"' data-value='"+s+"' style='"+this.lq(r,i)+(s%4!==0||d?"":"clear:both;")+"'>"+b+"</div>"}for(a+="</div>",a+="<div class='webix_minutes'>",n=this.s.date.getMinutes(),s=0;60>s;s+=this.s.minuteStep)e=n==s?" webix_selected":"",a+="<div class='webix_cal_block webix_cal_block_min"+e+"' data-value='"+s+"' style='"+this.lq(r,i)+(s%2===0?"clear:both;":"")+"'>"+webix.Date.toFixed(s)+"</div>";
a+="</div>",a+="</div>",a+="<div  class='webix_time_footer'>"+this.mq()+"</div>",this.w.innerHTML=a}else{for(l[0].firstChild.innerHTML=o.eq(this.s.date),i=this.hq/3,r=this.iq/4,n=1==this.Np?this.s.date.getMonth():this.s.date.getFullYear(),s=0;12>s;s++)e=n==(1==this.Np?s:o.fq(s))?" webix_selected":"",a+="<div class='webix_cal_block"+e+"' data-value='"+s+"' style='"+this.lq(r,i)+"'>"+o.fq(s)+"</div>";
h-1&&(l[h-1].style.display="none"),l[h].innerHTML=a,l[h+1]?l[h+1].innerHTML=this.mq():this.w.innerHTML+="<div  class='webix_time_footer'>"+this.mq()+"</div>",l[h].style.height=this.hq+"px"}},lq:function(t,e){return"width:"+t+"px; height:"+e+"px; line-height:"+e+"px;"},mq:function(){return"<input type='button' style='width:100%' class='webix_cal_done' value='"+webix.i18n.calendar.done+"'>"
},kq:function(t,e){var i=t*(e?5:4),s=2*t;return"<div class='webix_cal_hours' style='width:"+i+"px'>"+webix.i18n.calendar.hours+"</div><div class='webix_cal_minutes' style='width:"+s+"px'>"+webix.i18n.calendar.minutes+"</div>"},yt:function(t,e){this.callEvent("onBeforeZoom",[t])&&(this.Np=t,t?this.cq(e):this.showCalendar(e),this.callEvent("onAfterZoom",[t]))
},nq:function(t){var e=this.s.date,i=webix.Date.copy(e);this.aq[this.Np].dq(i,t);var s=this.Np-1;this.yt(s,i)},zt:function(t){this.callEvent("onBeforeDateSelect",[t])&&(this.selectDate(t,!0),this.callEvent("onDateSelect",[t]),this.callEvent("onAfterDateSelect",[t]))},on_click:{webix_cal_prev_button:function(){this.$p(-1)
},webix_cal_next_button:function(){this.$p(1)},webix_cal_day:function(t,e,i){if(-1!==i.className.indexOf("webix_cal_day_disabled"))return!1;var s=webix.html.index(i)-(this.s.weekNumber?1:0),n=webix.html.index(i.parentNode),r=webix.Date.add(this.Op().Rp,s+7*n,"day",!0);this.s.timepicker&&(r.setHours(this.s.date.getHours()),r.setMinutes(this.s.date.getMinutes())),this.zt(r)
},webix_cal_time:function(){if(this.aq[this.Np-1]){this.jq=!0;var t=this.Np-1;this.yt(t)}},webix_cal_done:function(){this.zt(this.s.date)},webix_cal_month_name:function(){if(this.jq=!1,2!=this.Np&&this.s.monthSelect){var t=Math.max(this.Np,0)+1;this.yt(t)}},webix_cal_block:function(t,e,i){if(this.jq){var s=-1!=i.className.indexOf("webix_cal_block_min")?this.Np-1:this.Np,n=this.s.date,r=webix.Date.copy(n);
this.aq[s].dq(r,1*i.getAttribute("data-value")),this.cq(r)}else this.nq(1*i.getAttribute("data-value"))}},Jp:function(t,e){return t?("string"==typeof t&&(t=e?webix.Date.strToDate(e)(t):webix.i18n.parseFormatDate(t)),t):webix.Date.datePart(new Date)},showCalendar:function(t){t=this.Jp(t),this.s.date=t,this.render(),this.resize()
},getSelectedDate:function(){return this.Mp?webix.Date.copy(this.Mp):this.Mp},getVisibleDate:function(){return webix.Date.copy(this.s.date)},setValue:function(t){this.selectDate(t,!0)},getValue:function(t){var e=this.getSelectedDate();return t&&(e=webix.Date.dateToStr(t)(e)),e},selectDate:function(t,e){t?(t=this.Jp(t),this.Mp=t,this.Lp=webix.Date.datePart(webix.Date.copy(t))):(this.Mp=null,this.Lp=null,this.s.date&&webix.Date.datePart(this.s.date)),e?this.showCalendar(t):this.render(),this.callEvent("onChange",[t])
},locate:function(){return null}},webix.MouseEvents,webix.ui.view,webix.EventSystem),webix.protoUI({name:"property",$init:function(){this.w.className+=" webix_property",this.Ns=[]},defaults:{nameWidth:100,editable:!0},on_render:{checkbox:function(t){return"<input type='checkbox' class='webix_property_check' "+(t?"checked":"")+">"
},color:function(t){return'<div class="webix_property_col_val"><div class=\'webix_property_col_ind\' style="background-color:'+(t||"#FFFFFF")+';"></div><span>'+t+"</span></div>"}},on_edit:{label:!1},ad:"webix_f_id",on_click:{webix_property_check:function(t){var e=this.locate(t);return this.getItem(e).value=!this.getItem(e).value,this.callEvent("onCheck",[e,this.getItem(e).value]),!1
}},on_dblclick:{},registerType:function(t,e){if(e.template&&(this.on_render[t]=e.template),e.editor&&(this.on_edit[t]=e.editor),e.click)for(var i in e.click)this.on_click[i]=e.click[i]},elements_setter:function(t){this.oq={};for(var e=0;e<t.length;e++){var i=t[e];"multiselect"==i.type&&(i.optionslist=!0),i.id=i.id||webix.uid(),i.label=i.label||"",i.value=i.value||"",this.oq[i.id]=e,this.template=this.Et(t[e])
}return t},showItem:function(t){webix.RenderStack.showItem.call(this,t)},locate:function(){return webix.html.locate(arguments[0],this.ad)},getItemNode:function(t){return this.y.childNodes[this.oq[t]]},getItem:function(t){return this.s.elements[this.oq[t]]},ii:function(t){var e=this.getItem(t).type;if("checkbox"==e)return"inline-checkbox";
var i=this.on_edit[e];return i===!1?!1:i||e},li:function(t){return this.getItem(t)},ui:function(t,e,i){var s=this.oq[t.id],n=this.s.elements;if(i){for(var r=s+1;r<n.length;r++)if(e.call(this,n[r].id))return n[r].id}else for(var r=s-1;r>=0;r--)if(e.call(this,n[r].id))return n[r].id;return null},updateItem:function(){this.refresh()
},ug:function(t){var e=this.getItemNode(t);return{left:e.offsetLeft+this.s.nameWidth,top:e.offsetTop,height:e.firstChild.offsetHeight,width:this.pq,parent:this.w}},setValues:function(t,e){e||this.qq();for(var i in t){var s=this.getItem(i);s&&(s.value=t[i])}this.rq=t,this.refresh()},M:function(){return webix.Values.M.apply(this,arguments)
},qq:function(){for(var t=this.s.elements,e=0;e<t.length;e++)t[e].value=""},getValues:function(){for(var t=webix.clone(this.rq||{}),e=0;e<this.s.elements.length;e++){var i=this.s.elements[e];"label"!=i.type&&(t[i.id]=i.value)}return t},refresh:function(){this.render()},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&(this.pq=this.bc-this.s.nameWidth,this.render())
},$getSize:function(t,e){if(this.s.autoheight){var i=this.s.elements.length;this.s.height=Math.max(this.type.height*i,this.s.minHeight||0)}return webix.ui.view.prototype.$getSize.call(this,t,e)},jb:function(){var t=[],e=this.s.elements;if(e)for(var i=0;i<e.length;i++){var s=e[i];s.css&&"object"==typeof s.css&&(s.css=webix.html.createCss(s.css));
var n='<div webix_f_id="'+s.id+'" class="webix_property_line '+(s.css||"")+'">';if("label"==s.type)t[i]=n+"<div class='webix_property_label_line'>"+s.label+"</div></div>";else{var r,a=this.on_render[s.type],h="<div class='webix_property_label' style='width:"+this.s.nameWidth+"px'>"+s.label+"</div><div class='webix_property_value' style='width:"+this.pq+"px'>";
r=s.collection||s.options?s.template(s,s.value):s.format?s.format(s.value):s.value,a&&(r=a.call(this,s.value,s)),t[i]=n+h+r+"</div></div>"}}return t.join("")},type:{height:24,templateStart:webix.template(""),templateEnd:webix.template("</div>")},$skin:function(){this.type.height=webix.skin.$active.propertyItemHeight||24
}},webix.EditAbility,webix.MapCollection,webix.MouseEvents,webix.Scrollable,webix.SingleRender,webix.AtomDataLoader,webix.EventSystem,webix.ui.view),webix.protoUI({name:"colorboard",defaults:{template:'<div style="width:100%;height:100%;background-color:{obj.val}"></div>',palette:null,height:220,width:220,cols:12,rows:10,minLightness:.15,maxLightness:1},$init:function(){webix.event(this.x,"click",webix.bind(function(t){var e=webix.html.locate(t,"webix_val");
this.setValue(e),this.callEvent("onSelect",[this.s.value,t])},this))},sq:function(t){var e=this.s.palette;t=t.toUpperCase();for(var i=0,s=e.length;s>i;i++)for(var n=0,r=e[i].length;r>n;n++)if(e[i][n].toUpperCase()==t)return{row:i,col:n};return null},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()
},getValue:function(){return this.s.value},re:function(){return this.x.firstChild},setValue:function(t){return t?("#"!=t.charAt(0)&&(t="#"+t),this.s.value=t,this.tq(t),t):void 0},uq:null,vq:function(){if(this.uq&&this.uq.parentNode)return this.uq;var t=this.uq=document.createElement("div");return t.className="webix_color_selector",this.x.lastChild.appendChild(t),t
},tq:function(t,e){if(this.isVisible()){var i=0,s=0;if(!e){var n=this.sq(t);n&&(e=this.x.lastChild.childNodes[n.row].childNodes[n.col])}if(!(e&&e.parentNode&&e.parentNode.parentNode))return void(this.uq&&(this.uq.style.left="-100px"));var r=e.parentNode;i=e.offsetLeft-r.offsetLeft,s=-(this.$height-(e.offsetTop-r.parentNode.offsetTop));
var a=this.vq(),h=["left:"+i+"px","top:"+s+"px","width:"+e.style.width,"height:"+e.style.height].join(";");"undefined"!=typeof a.style.cssText?a.style.cssText=h:a.setAttribute("style",h)}},wq:function(t){function e(t){return webix.color.toHex(t,2)}function i(t,i,s){return"#"+e(Math.floor(t))+e(Math.floor(i))+e(Math.floor(s))
}function s(t,e,i){var s,r,a;if(e){var h=.5>i?i*(1+e):i+e-i*e,o=2*i-h;s=n(o,h,t+1/3),r=n(o,h,t),a=n(o,h,t-1/3)}else s=r=a=i;return{r:255*s,g:255*r,b:255*a}}function n(t,e,i){return 0>i&&(i+=1),i>1&&(i-=1),1/6>i?t+6*(e-t)*i:.5>=i?e:2/3>i?t+(e-t)*(2/3-i)*6:t}function r(t){for(var e=[],s=255,n=s/t,r=0;t>r;r++)s=Math.round(s>0?s:0),e.push(i(s,s,s)),s-=n;
return e[e.length-1]="#000000",e}var a=[],h=t.rows-1,o=1/t.cols,l=(t.maxLightness-t.minLightness)/h,c=null;a.push(r(t.cols));for(var u=0,d=t.minLightness;h>u;u++){c=[];for(var f=0,b=0;f<t.cols;f++){var x=s(b,1,d);c.push(i(x.r,x.g,x.b)),b+=o}a.push(c),d+=l}this.s.palette=a},render:function(){function t(t,e,i){for(var r='<div class="webix_color_row">',a=0;a<t.length;a++)n.width=e[a],n.height=i,n.val=t[a],r+=s(n);
return r+="</div>"}if(this.isVisible(this.s.id)){this.s.palette||this.wq(this.s);var e=this.s.palette;this.callEvent("onBeforeRender",[]);for(var i=this.s,s=webix.template('<div style="width:{obj.width}px;height:{obj.height}px;" webix_val="{obj.val}">'+(i.template||"")+"</div>"),n={width:0,height:0,val:0},r=this.$width,a=this.$height,h=[],o='<div class="webix_color_palette">',l="object"==typeof e[0]?e[0]:e,c=0;c<l.length;c++)h[c]=Math.floor(r/(l.length-c)),r-=h[c];
if("object"==typeof e[0])for(var u=0;u<e.length;u++){var d=Math.floor(a/(e.length-u));a-=d;var f=e[u];o+=t(f,h,d)}else o+=t(e,h,a);o+="</div>",this.x.innerHTML=o,this.uq=null,this.callEvent("onAfterRender",[])}},refresh:function(){this.render()}},webix.ui.view,webix.EventSystem),webix.protoUI({name:"resizer",defaults:{width:7,height:7},$init:function(t){var e=this.getParentView().Cc;
webix.event(this.x,webix.env.mouse.down,this.xq,this),webix.event(document.body,webix.env.mouse.up,this.yq,this);var i=this.zq();this.Aq=!1,this.Bq=i,this.Cq="x"==i?"width":"height","x"==i?t.height=0:t.width=0,e>0?(this.x.className+=" webix_resizer_v"+i,this.x.style.marginRight="-"+e+"px","x"==i?t.width=e:t.height=e,this.$nospace=!0):this.x.className+=" webix_resizer_"+i,this.x.innerHTML="<div class='webix_resizer_content'></div>","y"==i&&e>0&&(this.x.style.marginBottom="-"+(t.height||this.defaults.height)+"px")
},xq:function(t){var e=this.Dq();e&&(t=t||event,this.Aq=!0,this.Pl=webix.html.pos(t),this.Eq=[],this.Fq(t,e[0]))},yq:function(){this.Aq=!1,this.Pl=!1},Fq:function(t,e){var i,s,n,r,a;t=t||event,i=this.Bq,this.getParentView().x.style.position="relative",n=webix.html.offset(this.x),r=webix.html.offset(this.getParentView().x),a=n[i]-r[i],s=webix.html.offset(e.$view)[i]-webix.html.offset(this.getParentView().$view)[i],this.Rl=[i,e,a,s],this.Gq=new webix.ui.resizearea({container:this.getParentView().x,dir:i,eventPos:this.Pl[i],start:a-1,height:this.$height,width:this.$width,border:1,margin:this.getParentView()["_padding"+i.toUpperCase()]}),this.Gq.attachEvent("onResizeEnd",webix.bind(this.Hq,this)),this.Gq.attachEvent("onResize",webix.bind(this.Iq,this)),webix.html.addCss(document.body,"webix_noselect",1)
},zq:function(){return this.getParentView().mc?"y":"x"},Iq:function(){var t,e,i,s,n,r,a,h,o,l;if(this.Rl)for(t=this.Dq(),n=this.Rl[0],s=this.Gq.Jl-this.Rl[2],o=this.Jq(t,n,s),l=t[0]["$"+this.Cq]+t[1]["$"+this.Cq],a="y"==n?["minHeight","maxHeight"]:["minWidth","maxWidth"],r=0;2>r;r++){e=t[r].s,i=r?-s:s;
var c=e[a[0]],u=e[a[1]];if(i>0&&u&&u<=o[r]||0>i&&(c||3)>=o[r])return this.Eq[r]=i>0?u:c||3,h=this.Kq(t,n),void(this.Gq.Dl.style["y"==n?"top":"left"]=this.Rl[3]+h[0]+"px");o[r]<3?this.Gq.Dl.style["y"==n?"top":"left"]=this.Rl[3]+r*l+1+"px":this.Eq[r]=null}},Dq:function(){var t,e;for(t=this.getParentView().q,e=0;e<t.length;e++)if(t[e]==this)return!t[e-1]||t[e-1].s.$noresize?null:!t[e+1]||t[e+1].s.$noresize?null:[t[e-1],t[e+1]]
},Hq:function(t){if("undefined"!=typeof t){var e,i,s,n,r,a=this.getParentView().mc;if(this.Lq=null,this.Rl){if(i=this.Rl[0],s=t-this.Rl[2],e=this.Dq(),e[0]&&e[1]){r=this.Mq(e,i,s);for(var n=0;2>n;n++){var h=e[n].$getSize(0,0);if(a?h[2]==h[3]:Math.abs(h[1]-h[0])<3)e[n].s[this.Cq]=r[n],e[n].tc&&e[n].tc(this.Cq,r[n],a);
else{var o=e[n].$view[a?"offsetHeight":"offsetWidth"];e[n].s.gravity=r[n]/o*e[n].s.gravity}}e[0].resize();for(var n=0;2>n;n++)e[n].callEvent&&e[n].callEvent("onViewResize",[]);webix.callEvent("onLayoutResize",[e])}this.Rl=!1}this.Rl=!1,this.Aq=!1,this.Eq=null,webix.html.removeCss(document.body,"webix_noselect")
}},Kq:function(t){var e,i,s;return s=t[0]["$"+this.Cq]+t[1]["$"+this.Cq],this.Eq[0]?(e=this.Eq[0],i=s-e):this.Eq[1]&&(i=this.Eq[1],e=s-i),[e,i]},Jq:function(t,e,i){for(var s=[],n=0;2>n;n++)s[n]=t[n]["$"+this.Cq]+(n?-1:1)*i;return s},Mq:function(t,e,i){var s,n,r;if(this.Eq[0]||this.Eq[1])n=this.Kq(t,e);
else for(n=this.Jq(t,e,i),s=0;2>s;s++)n[s]<0&&(r=n[0]+n[1],n[s]=1,n[1-s]=r-1);return n}},webix.MouseEvents,webix.ui.view),webix.protoUI({name:"multiview",defaults:{animate:{}},setValue:function(t){webix.$$(t).show()},getValue:function(){return this.getActiveId()},$init:function(){this.Mh=0,this.mc=1,this.x.style.position="relative",this.x.className+=" webix_multiview",this.Nq=[]
},Oq:function(t,e){var i=webix.$$(t);i.Pq||(i.Qq=[],i.Pq={}),i.Pq[e]||(i.Pq[e]=!0,i.Qq.push(e))},Rq:function(t){var e=webix.$$(t);if(this.s.keepViews&&(e.x.style.display=""),this.Nq[this.Nq.length-2]!=t?(10==this.Nq.length&&this.Nq.splice(0,1),this.Nq.push(t)):this.Nq.splice(this.Nq.length-1,1),e.Pq){for(var i=0;i<e.Qq.length;i++)webix.$$(e.Qq[i]).render();
e.Qq=[],e.Pq={}}},addView:function(){var t=webix.ui.baselayout.prototype.addView.apply(this,arguments);return webix.html.remove(webix.$$(t).$view),t},Vx:function(t){if(t==this.Mh){var e=Math.max(t-1,1);this.q[e]&&this.fc(this.q[e],!1)}t<this.Mh&&this.Mh--},Fb:function(){},kc:function(t){t=t||this.nc;
for(var e=0;e<t.length;e++)t[e].Ob=this.s.borderless?{top:1,left:1,right:1,bottom:1}:this.s.Ob||{};webix.ui.baselayout.prototype.kc.call(this,t);for(var e=1;e<this.q.length;e++)this.s.keepViews?this.q[e].x.style.display="none":webix.html.remove(this.q[e].x);for(var e=0;e<t.length;e++){var i=this.q[e];
if(!i.q||i.Gc){var s=i.s.Ob;s.top&&(i.x.style.borderTopWidth="0px"),s.left&&(i.x.style.borderLeftWidth="0px"),s.right&&(i.x.style.borderRightWidth="0px"),s.bottom&&(i.x.style.borderBottomWidth="0px")}}this.Rq(this.getActiveId())},cells_setter:function(t){this.nc=t},Sq:function(t,e){var i=(this.s.animate||{}).direction,s="top"==i||"bottom"==i;
return e>t?s?"bottom":"right":s?"top":"left"},fc:function(t,e){var i=this.getParentView();if(i&&i.getTabbar&&i.getTabbar().setValue(t.s.$id||t.s.id),this.Wh)return webix.delay(this.fc,this,[t,e],100);for(var s=-1,n=0;n<this.q.length;n++)if(this.q[n]==t){s=n;break}if(!(0>s||s==this.Mh)){{var r=this.q[this.Mh],a=this.q[s];
r.$getSize(0,0)}if((e||"undefined"==typeof e)&&webix.animate.isSupported()&&this.s.animate){var h=webix.extend({},this.s.animate);this.s.keepViews&&(h.keepViews=!0),h.direction=this.Sq(s,this.Mh),h=webix.Settings.E(e||{},h);var o=webix.animate.formLine(a.x,r.x,h);a.$getSize(0,0),a.$setSize(this.bc,this.dc);
var l=h.callback;h.callback=function(){webix.animate.breakLine(o,this.s.keepViews),this.Wh=!1,l&&l.call(this),l=h.master=h.callback=null,this.resize()},h.master=this,this.Mh=s,this.Rq(this.getActiveId()),webix.animate(o,h),this.Wh=!0}else this.s.keepViews?r.x.style.display="none":(webix.html.remove(r.x),this.x.appendChild(this.q[n].x)),this.Mh=s,r.resize(),this.Rq(this.getActiveId());
a.callEvent&&(a.callEvent("onViewShow",[]),webix.ui.each(a,this.Lw)),this.callEvent("onViewChange",[r.s.id,a.s.id])}},$getSize:function(t,e){var i=this.q[this.Mh].$getSize(0,0);if(this.s.fitBiggest)for(var s=0;s<this.q.length;s++)if(s!=this.Mh)for(var n=this.q[s].$getSize(0,0),r=0;4>r;r++)i[r]=Math.max(i[r],n[r]);
var a=webix.ui.baseview.prototype.$getSize.call(this,0,0);return a[1]>=1e5&&(a[1]=0),a[3]>=1e5&&(a[3]=0),a[0]=(a[0]||i[0])+t,a[1]=(a[1]||i[1])+t,a[2]=(a[2]||i[2])+e,a[3]=(a[3]||i[3])+e,a},$setSize:function(t,e){this.lc=[t,e],webix.ui.baseview.prototype.$setSize.call(this,t,e),this.q[this.Mh].$setSize(t,e)
},isVisible:function(t,e){return e&&e!=this.getActiveId()?(t&&this.Oq(e,t),!1):webix.ui.view.prototype.isVisible.call(this,t,this.s.id)},getActiveId:function(){return this.q.length?this.q[this.Mh].s.id:null},back:function(t){if(t=t||1,this.callEvent("onBeforeBack",[this.getActiveId(),t])){if(this.Nq.length>t){var e=this.Nq[this.Nq.length-t-1];
return webix.$$(e).show(),e}return null}return null}},webix.ui.baselayout),webix.protoUI({name:"form",defaults:{type:"form",autoheight:!0},Tq:-1,_f:"webix_form",ag:!0,$getSize:function(t,e){this.cc&&!this.s.width&&(t+=webix.ui.scrollSize);var i=webix.ui.layout.prototype.$getSize.call(this,t,e);return(this.s.scroll||!this.s.autoheight)&&(i[2]=this.s.height||this.s.minHeight||0,i[3]+=1e5),i
}},webix.ui.toolbar),webix.protoUI({name:"multiselect",$cssName:"richselect",defaults:{separator:","},Kt:function(t){var e=!webix.isArray(t)&&"object"==typeof t&&!t.name,i={view:"checksuggest",separator:this.config.separator,buttonText:this.config.buttonText,button:this.config.button};this.s.optionWidth?i.width=this.s.optionWidth:i.fitMaster=!0,e&&webix.extend(i,t,!0);
var s=webix.ui(i),n=s.getList();return"string"==typeof t?n.load(t):e||n.parse(t),s.attachEvent("onBeforeShow",function(){this.setValue(webix.$$(this.s.master).config.value)}),s},$setValue:function(t){if(this.se){var e=this.getPopup();this.getInputNode().innerHTML=e?e.setValue(t):""}},getValue:function(){return this.s.value||""
}},webix.ui.richselect),webix.editors.multiselect=webix.extend({popupType:"multiselect"},webix.editors.richselect),webix.type(webix.ui.list,{name:"multilist",templateStart:webix.template('<div webix_l_id="#!id#" class="{common.classname()}" style="width:{common.widthSize()}; height:{common.heightSize()}; overflow:hidden;">')},"default"),webix.type(webix.ui.list,{name:"checklist",templateStart:webix.template('<div webix_l_id="#!id#" class="{common.classname()}" style="width:{common.widthSize()}; height:{common.heightSize()}; overflow:hidden; white-space:nowrap;">{common.checkbox()}'),checkbox:function(t){var e=t.$checked?"fa-check-square":"fa-square-o";
return"<span class='webix_icon "+e+"'></span>"},template:webix.template("#value#")},"default"),webix.protoUI({name:"multisuggest",defaults:{separator:",",type:"layout",button:!0,width:0,filter:function(t,e){var i=this.getItemText(t.id);return i.toString().toLowerCase().indexOf(e.toLowerCase())>-1},body:{rows:[{view:"list",type:"multilist",borderless:!0,autoheight:!0,yCount:5,multiselect:"touch",select:!0,on:{onItemClick:function(){var t=this.getParentView().getParentView();
webix.delay(function(){webix.$$(t.s.master).setValue(t.getValue())})}}},{view:"button",click:function(){var t=this.getParentView().getParentView();t.setMasterValue({id:t.getValue()}),t.hide()}}]}},Jt:function(t){return t.rows[0]},_d:function(){var t=this.getButton(),e=this.s.button?this.s.buttonText||webix.i18n.controls.select:0;
t&&(e?(t.s.value=e,t.refresh()):t.hide())},getButton:function(){return this.getBody().getChildViews()[1]},getList:function(){return this.getBody().getChildViews()[0]},setValue:function(t){var e=[],i=this.getList();if(i.unselect(),t&&("string"==typeof t&&(t=t.split(this.config.separator)),t[0]))for(var s=0;s<t.length;s++)i.exists(t[s])&&(i.select(t[s],!0),e.push(this.getItemText(t[s])));
return e.join(this.config.separator+" ")},getValue:function(){return this.getList().getSelectedId(!0).sort().join(this.config.separator)}},webix.ui.suggest),webix.protoUI({name:"checksuggest",defaults:{button:!1,body:{rows:[{view:"list",css:"webix_multilist",borderless:!0,autoheight:!0,yCount:5,select:!0,type:"checklist",on:{onItemClick:function(t){var e=this.getItem(t);
e.$checked=e.$checked?0:1,this.refresh(t);var i=this.getParentView().getParentView();webix.$$(i.s.master).setValue(i.getValue())}}},{view:"button",click:function(){var t=this.getParentView().getParentView();t.setMasterValue({id:t.getValue()}),t.hide()}}]}},ge:function(t,e){if(e.count&&e.count())if(t.isVisible()){var i=e.getSelectedId(!1,!0);
if(i){e.getItem(i).$checked=e.getItem(i).$checked?0:1,i=this.getValue();var s=webix.$$(this.s.master);s.xy="",s.setValue(i),s.getInputNode().value=""}t.hide(!0)}else t.show(this.ae);else t.isVisible()&&t.hide(!0)},setValue:function(t){var e,i=this.getList(),s=[],n={},r=[];for(t=t||[],"string"==typeof t&&(t=t.split(this.config.separator)),e=0;e<t.length;e++)n[t[e]]=1;
for(i.data.each(function(t){t.$checked?n[t.id]||(t.$checked=0,r.push(t.id)):n[t.id]&&(t.$checked=1,r.push(t.id)),t.$checked&&s.push(this.getItemText(t.id))},this,!0),e=0;e<r.length;e++)i.refresh(r[e]);return s.join(this.config.separator+" ")},getValue:function(){var t=[];return this.getList().data.each(function(e){e.$checked&&t.push(e.id)
},this,!0),t.sort().join(this.config.separator)},Rs:function(){}},webix.ui.multisuggest),webix.protoUI({name:"multicombo",$cssName:"text",defaults:{separator:",",icon:!1,iconWidth:0,template:function(t,e){return e.yy(t,e)}},$init:function(){this.$view.className+=" webix_multicombo",this.attachEvent("onBlur",webix.bind(function(){this.xy="",this.refresh()
},this)),this.attachEvent("onBeforeRender",function(){return this.zy||(this.zy=this.config.aheight),!0}),this.attachEvent("onAfterRender",function(){this.ac=null})},on_click:{webix_multicombo_delete:function(t,e,i){var s;return i&&(s=i.parentNode.getAttribute("value"))&&this.Ay(s),!1}},Ay:function(t){var e=webix.toArray(this.s.value.split(this.s.separator));
e.remove(t),this.setValue(e.join(this.s.separator))},Kt:function(t){var e=!webix.isArray(t)&&"object"==typeof t&&!t.name,i={view:"checksuggest",separator:this.config.separator,buttonText:this.config.buttonText,button:this.config.button},s=this;this.s.optionWidth&&(i.width=this.s.optionWidth),e&&webix.extend(i,t,!0);
var n=webix.ui(i);this.s.optionWidth||(n.$customWidth=function(){this.config.width=s.Ee(s.s)}),n.attachEvent("onBeforeShow",function(t,e,i){return this.setValue(webix.$$(this.s.master).config.value),t.tagName&&"input"==t.tagName.toLowerCase()?(webix.ui.popup.prototype.show.apply(this,[t.parentNode,e,i]),!1):void 0
});var r=n.getList();return"string"==typeof t?r.load(t):e||r.parse(t),n},yy:function(t,e){var i=t.id||webix.uid(),s=e.Ee(t),n=t.inputAlign||"left",r=this.zy-2*webix.skin.$active.inputPadding-2,a=(t.text||t.value||this.Yx(t),t.value,"<ul class='webix_multicombo_listbox' style='line-height:"+r+"px'></ul>"),h="<input type='text' class='webix_multicombo_input' style='width: "+Math.min(s,e.By||7)+"px;height:"+r+"px;max-width:"+(s-20)+"px' value='"+(e.xy||"")+"'/>",o="<div class='webix_inp_static' tabindex='0' onclick='' style='line-height:"+r+"px;width: "+s+"px;  text-align: "+n+";height:auto' >"+a+h+"</div>",n=t.inputAlign||"left";
i=i||t.name||webix.uid();var l=e.$renderLabel(t,i);return o+="</div>",top?l+"<div class='webix_el_box' style='width:"+this.s.awidth+"px; '>"+o+"</div>":"<div class='webix_el_box' style='width:"+this.s.awidth+"px; min-height:"+this.s.aheight+"px;'>"+l+o+"</div>"},Cy:function(){return this.re().getElementsByTagName("UL")[0]
},oe:function(){var t=this.getPopup();if(t){var e=t?t.setValue(this.s.value):"",i="",s=this.Cy();if(e)for(var n=this.s.value.split(this.s.separator),r=e.split(this.s.separator),a=this.zy-2*webix.skin.$active.inputPadding-8,h=0;h<r.length;h++){var o="<span>"+r[h]+"</span><span class='webix_multicombo_delete'>x</span>";
i+="<li class='webix_multicombo_value' style='line-height:"+a+"px;' value='"+n[h]+"'>"+o+"</li>"}s.innerHTML=i}this.Dy()},Ey:function(t){if(t&&t.value.length){if(t.createTextRange){var e=t.createTextRange();e.moveStart("character",t.value.length),e.collapse(),e.select()}else if(t.selectionStart||"0"==t.selectionStart){var i=t.value.length;
t.selectionStart=i,t.selectionEnd=i,t.focus()}}else t.focus()},Dy:function(){var t="top"==this.s.labelPosition,e=Math.max(this.re().firstChild.offsetHeight+2*webix.skin.$active.inputPadding,this.zy)+(t?this.le:0),i=this.$getSize(0,0);if(e!=i[2]){this.Fy=this.re().firstChild.offsetHeight+(t?this.le:0);
var s=this.getTopParentView();clearTimeout(s.kg),s.kg=webix.delay(function(){this.config.height=this.Fy+2*webix.skin.$active.inputPadding,this.resize(),this.Hy&&(this.Ey(this.getInputNode()),this.Hy=!1),(this.getPopup().isVisible()||this.Hy)&&this.getPopup().show(this.re().firstChild)},this)}},getInputNode:function(){return this.re().getElementsByTagName("INPUT")[0]
},$setValue:function(){this.oe()},getValue:function(){return this.s.value},Iy:function(t){var e=document.createElement("span");e.className="webix_multicombo_input",e.style.visibility="visible",e.style.height="0px",e.innerHTML=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),document.body.appendChild(e);
var i=e.offsetWidth+10;return document.body.removeChild(e),i},De:function(){webix.event(this.re(),"click",function(){this.getInputNode().focus()},this),webix.event(this.getInputNode(),"focus",function(){-1==this.re().className.indexOf("webix_focused")&&(this.re().className+=" webix_focused")},this),webix.event(this.getInputNode(),"blur",function(){this.re().className=this.re().className.replace(" webix_focused","")
},this),webix.event(this.getInputNode(),"input",function(){!this.getInputNode().value&&this.xy&&(this.getInputNode().style.width="20px",this.By=20,this.xy="",this.Hy=!0,this.getPopup().show(this.re().firstChild),this.Dy())},this),webix.event(this.getInputNode(),"keyup",function(){var t=this.getInputNode(),e=this.Iy(t.value)+10;
t.style.width=e+"px",e!=this.By&&(this.By=e,this.xy=t.value,this.Hy=!0,this.getPopup().show(this.re().firstChild),this.Dy())},this),webix.event(this.getInputNode(),"keydown",function(t){if(this.isVisible()){t=t||event;var e=this.Cy().lastChild;8==t.keyCode&&e&&(!this.getInputNode().value&&(new Date).valueOf()-(this.Jy||0)>500?(this.Hy=!0,this.Ay(e.getAttribute("value"))):this.Jy=(new Date).valueOf())
}},this),webix.$$(this.s.suggest).linkInput(this)}},webix.ui.richselect),webix.protoUI({name:"menu",Oh:"webix_menu",$init:function(){this.data.attachEvent("onStoreUpdated",webix.bind(function(){this.Uq()},this)),this.attachEvent("onMouseMove",this.Vq),this.attachEvent("onMouseOut",function(){this.Wq()&&"click"==this.s.openAction||this.Xq||this.Uq()
}),this.attachEvent("onItemClick",function(t,e,i){var s=this.getItem(t);if(s){if(s.$template)return;var n=this.getTopMenu();if(!this.data.getMark(t,"webix_disabled")){if(!n.callEvent("onMenuItemClick",[t,e,i]))return void(e.showpopup=!0);this!=n&&n.Le(t,e,i),s.submenu?(this!==n&&!webix.env.touch||"click"!=n.s.openAction||this.Yq(t,i),e.showpopup=!0):(n.Uq(!0),n.$q&&n.hide())
}}}),this.data.attachEvent("onClearAll",function(){this._q=[]}),this.data._q=[]},getTopMenu:function(){for(var t=this;t.ar;)t=webix.$$(t.ar);return t},Rh:function(t){this.s.autoheight&&(t=this.count());for(var e=0,i=0;t>i;i++){var s=this.data.pull[this.data.order[i]];e+=s&&"Separator"==s.$template?4:this.type.height
}return e},on_mouse_move:{},type:{css:"menu",width:"auto",templateStart:function(t,e,i){if("Separator"===t.$template||"Spacer"===t.$template)return'<div webix_l_id="#id#" class="webix_context_'+t.$template.toLowerCase()+'">';var s=(t.href?" href='"+t.href+"' ":"")+(t.target?" target='"+t.target+"' ":"");
return webix.ui.list.prototype.type.templateStart(t,e,i).replace(/^<div/,"<a "+s)+(t.submenu&&e.subsign?"<div class='webix_submenu_icon'></div>":"")},templateEnd:function(t){return"Separator"===t.$template||"Spacer"===t.$template?"</div>":"</a>"},templateSeparator:webix.template("<div class='sep_line'></div>"),templateSpacer:webix.template("<div></div>")},getMenu:function(t){if(this.data.pull[t])return this;
for(var e in this.data.pull){var i=this.getItem(e);if(i.submenu){var s=this.br(i).getMenu(t);if(s)return s}}},getSubMenu:function(t){var e=this.getMenu(t),i=e.getItem(t);return i.submenu?e.br(i):null},getMenuItem:function(t){return this.getMenu(t).getItem(t)},br:function(t){var e=webix.$$(t.submenu);
return e||(t.submenu=this.cr(t),e=webix.$$(t.submenu)),e},Vq:function(t,e,i){this.Wq()&&this.Yq(t,i)},Wq:function(){var t=this.getTopMenu();if("click"==t.s.openAction){if(webix.env.touch)return!1;var e=t.dr;return e&&webix.$$(e).isVisible()?!0:!1}return!0},Yq:function(t,e){var i=this.getItem(t);if(i&&(this.Xq=null,this.dr&&i.submenu!=this.dr&&this.Uq(!0),i.submenu&&!this.config.hidden)){var s=this.br(i);
if(this.data.getMark(t,"webix_disabled"))return;s.show(e,{pos:this.s.subMenuPos}),s.ar=this.s.id,this.dr=i.submenu}},disableItem:function(t){this.getMenu(t).addCss(t,"webix_disabled")},enableItem:function(t){this.getMenu(t).removeCss(t,"webix_disabled")},er:function(t,e){var i=this.data;i._q[t]!=e&&(i._q[t]=e,i.filter(function(t){return!i._q[t.id]
}),this.resize())},hideItem:function(t){var e=this.getMenu(t);e&&e.er(t,!0)},showItem:function(t){var e=this.getMenu(t);return e?(e.er(t,!1),webix.ui.list.prototype.showItem.call(e,t)):void 0},Uq:function(t){if(this.dr){var e=webix.$$(this.dr);e.Uq&&e.Uq(t),(t||!e.gr)&&(e.hide(),this.dr=null)}},cr:function(t){var e={view:"submenu",data:t.submenu},i=this.getTopMenu().s.submenuConfig;
i&&webix.extend(e,i,!0);var s=this.getMenuItem(t.id);s&&s.config&&webix.extend(e,s.config,!0);var n=webix.ui(e);return n.s.id},$skin:function(){webix.ui.list.prototype.$skin.call(this),this.type.height=webix.skin.$active.menuHeight},defaults:{scroll:"",layout:"x",mouseEventDelay:100,subMenuPos:"bottom"}},webix.ui.list),webix.protoUI({name:"submenu",$init:function(){this.gd=webix.clone(this.hr),this.gd.A=this,this.attachEvent("onMouseOut",function(){"click"!=this.getTopMenu().s.openAction&&(this.Xq||this.gr||this.hide())
}),this.attachEvent("onMouseMoving",function(){this.ar&&(webix.$$(this.ar).Xq=!0)})},$skin:function(){webix.ui.menu.prototype.$skin.call(this),webix.ui.popup.prototype.$skin.call(this),this.type.height=webix.skin.$active.menuHeight},hr:{$getSize:function(t,e){var i=1*this.A.s.height,s=1*this.A.s.width,n=webix.ui.menu.prototype.$getSize.call(this.A,t,e);
return this.A.s.height=i,this.A.s.width=s,n},$setSize:function(t,e){this.A.s.scroll&&(this.A.ed.style.height=e+"px")},destructor:function(){this.A=null}},body_setter:function(){},defaults:{width:150,subMenuPos:"right",layout:"y",autoheight:!0},type:{height:webix.skin.menuHeight,subsign:!0}},webix.ui.menu,webix.ui.popup),webix.ContextHelper={defaults:{padding:"4",hidden:!0},body_setter:function(t){return t=webix.ui.window.prototype.body_setter.call(this,t),this.gd.x.style.borderWidth="0px",t
},attachTo:function(t){t.on_context?t.attachEvent("onAfterContextMenu",webix.bind(this.ir,this)):webix.event(t,"contextmenu",this.jr,this)},getContext:function(){return this.nh},jr:function(t){return this.nh=webix.toNode(t||event),this.kr(t)},ir:function(t,e){return this.nh={obj:webix.$$(e),id:t},this.kr(e)
},kr:function(t){var e=this.show(t,null,!0);return webix.callEvent("onClick",[t]),e===!1?!1:webix.html.preventEvent(t)},gr:!0,master_setter:function(t){return this.attachTo(t),null}},webix.protoUI({name:"context"},webix.ContextHelper,webix.ui.popup),webix.protoUI({name:"contextmenu",$q:!0,$init:function(t){t.submenuConfig&&webix.extend(t,t.submenuConfig)
}},webix.ContextHelper,webix.ui.submenu),webix.protoUI({name:"tabbar",$skin:function(){var t=webix.skin.$active,e=this.defaults;e.topOffset=t.tabTopOffset||0,e.tabOffset="undefined"!=typeof t.tabOffset?t.tabOffset:10,e.bottomOffset=t.tabBottomOffset||0,e.height=t.tabbarHeight,e.tabMargin=t.tabMargin,e.inputPadding=t.inputPadding,e.tabMinWidth=t.tabMinWidth||100,e.tabMoreWidth=t.tabMoreWidth||40
},ut:function(){var t,e=this.config,i=e.options.length,s=this.we-2*e.tabOffset,n=e.optionWidth||e.tabMinWidth;if(n>s/i)return{max:parseInt(s/n,10)||1};if(!e.optionWidth)for(t=0;t<e.options.length;t++)e.options[t].width&&(s-=e.options[t].width+(t||e.type?0:e.tabMargin),i--);return{width:i?s/i:e.tabMinWidth}
},Je:function(){var t=this.s;if(!t.tabbarPopup){var e={view:"popup",width:t.popupWidth||200,body:{view:"list",borderless:!0,select:!0,css:"webix_tab_list",autoheight:!0,yCount:t.yCount,type:{template:t.popupTemplate}}},i=webix.ui(e);i.getBody().attachEvent("onBeforeSelect",webix.bind(function(t){return t&&this.callEvent("onBeforeTabClick",[t])?(this.setValue(t),webix.$$(this.s.tabbarPopup).hide(),this.callEvent("onAfterTabClick",[t]),!0):void 0
},this)),t.tabbarPopup=i.s.id,this.Ns.push(i)}this.Je=function(){}},getPopup:function(){return this.Je(),webix.$$(this.s.tabbarPopup)},moreTemplate_setter:webix.template,popupTemplate_setter:webix.template,defaults:{popupWidth:200,popupTemplate:"#value#",yCount:7,moreTemplate:'<span class="webix_icon fa-ellipsis-h"></span>',template:function(t,e){var i,s,n,r,a,h,o,l,c,u=t.options;
if(u.length){e.Be(u),!t.value&&u.length&&(t.value=u[0].id),u=webix.copy(u),s="",t.tabOffset&&(s+="<div class='webix_tab_filler' style='width:"+t.tabOffset+"px;'>&nbsp;</div>"),i=e.we-2*t.tabOffset-(t.type?0:t.tabMargin*(u.length-1)),l=t.topOffset+t.bottomOffset;var d=e.ut();if(d.max&&d.max<u.length){var f=e.getPopup();
f.hide();var b=f.getBody()||null;if(b)if(d.max){var x=!1;for(n=0;n<u.length&&!x;n++)if(u[n].id==t.value&&(x=!0,n+1>d.max)){var p=u.splice(n+1-d.max,d.max);u=p.concat(u)}b.clearAll(),b.parse(u.slice(d.max))}else b.clearAll()}else e.s.tabbarPopup&&webix.$$(e.s.tabbarPopup).hide();o=t.tabOffset;var v=!1;
for(n=0;n<u.length&&!v;n++)if(d&&d.max?(d.max==n+1&&(v=!0),i=e.we-2*t.tabOffset-(!t.type&&d.max>1?t.tabMargin*(d.max-1):0),c=(i-t.tabMoreWidth)/d.max):c=d.width,c=u[n].width||t.optionWidth||c,o+=c+(n&&!t.type?t.tabMargin:0),t.tabMargin>0&&n&&!t.type&&(s+="<div class='webix_tab_filler' style='width:"+t.tabMargin+"px;'></div>"),s+=e.vt(u[n],c),v){{e.dc-(t.type?0:l)
}s+='<div class="webix_tab_more_icon" style="width:'+t.tabMoreWidth+'px;">'+t.moreTemplate(t,e)+"</div>",o+=t.tabMoreWidth}r=e.bc-o,r>0&&!t.type&&(s+="<div class='webix_tab_filler' style='width:"+r+"px;'>&nbsp;</div>")}else s="<div class='webix_tab_filler' style='width:"+e.we+"px; border-right:0px;'></div>";
return a="",h=l&&!t.type?"height:"+(e.dc-l)+"px":"",t.topOffset&&!t.type&&(a+="<div class='webix_before_all_tabs' style='width:100%;height:"+t.topOffset+"px'></div>"),a+="<div style='"+h+"' class='webix_all_tabs "+(t.type?"webixtype_"+t.type:"")+"'>"+s+"</div>",t.bottomOffset&&!t.type&&(a+="<div class='webix_after_all_tabs' style='width:100%;height:"+t.bottomOffset+"px'></div>"),a
}},vt:function(t,e){var i,s="",n=this.config;if(t.id==n.value&&(s=" webix_selected"),t.css&&(s+=" "+t.css),e=t.width||e,i='<div class="webix_item_tab'+s+'" button_id="'+t.id+'" style="width:'+e+'px;">',this.lr){var r=this.dc-2*n.inputPadding-2,a=this.dc-2,h=webix.extend({cheight:r,aheight:a},t);i+=this.lr(h)
}else{var o=t.icon?"<span class='webix_icon fa-"+t.icon+"'></span> ":"";i+=o+t.value}return(t.close||n.close)&&(i+="<span class='webix_tab_close webix_icon fa-times'></span>"),i+="</div>"},ne:{image:"<div class='webix_img_btn_top' style='height:#cheight#px;background-image:url(#image#);'><div class='webix_img_btn_text'>#value#</div></div>",icon:"<div class='webix_img_btn' style='line-height:#cheight#px;height:#cheight#px;'><span class='webix_icon_btn fa-#icon#' style='max-width:#cheight#px;max-height:#cheight#px;'></span>#value#</div>",iconTop:"<div class='webix_img_btn_top' style='height:#cheight#px;width:100%;top:0px;text-align:center;'><span class='webix_icon fa-#icon#'></span><div class='webix_img_btn_text'>#value#</div></div>"},type_setter:function(t){return this.s.tabOffset=0,this.ne[t]&&(this.lr=webix.template(this.ne[t])),t
}},webix.ui.segmented),webix.protoUI({name:"tabview",defaults:{type:"clean"},setValue:function(t){this.q[0].setValue(t)},getValue:function(){return this.q[0].getValue()},getTabbar:function(){return this.q[0]},getMultiview:function(){return this.q[1]},addView:function(t){var e=t.body.id=t.body.id||webix.uid();
this.getMultiview().addView(t.body),t.id=t.body.id,t.value=t.header,delete t.body,delete t.header;var i=this.getTabbar();return i.addOption(t),i.refresh(),e},removeView:function(t){var e=this.getTabbar();e.removeOption(t),e.refresh()},$init:function(t){this.$ready.push(this.Nv);for(var e=t.cells,i=[],s=e.length-1;s>=0;s--){var n=e[s].body||e[s];
n.id||(n.id="view"+webix.uid()),i[s]={value:e[s].header,id:n.id,close:e[s].close,width:e[s].width},e[s]=n}var r={view:"tabbar",multiview:!0},a={view:"multiview",cells:e,animate:!!t.animate};t.value&&(r.value=t.value),t.tabbar&&webix.extend(r,t.tabbar,!0),t.multiview&&webix.extend(a,t.multiview,!0),r.options=r.options||i,t.rows=[r,a],delete t.cells,delete t.tabs
},Nv:function(){this.getTabbar().attachEvent("onOptionRemove",function(t){var e=webix.$$(t);e&&e.destructor()})}},webix.ui.layout),webix.protoUI({name:"htmlform",mr:null,$init:function(t){this.elements=null,t.content&&(t.container==t.content||!t.container&&t.content==document.body)&&(this.nr=!0)},content_setter:function(t){if(t=webix.toNode(t),this.nr)for(;t.childNodes.length>1;)this.x.childNodes[0].appendChild(t.childNodes[0]);
else this.x.childNodes[0].appendChild(t);return!0},render:function(){this.mr||(webix.ui.template.prototype.render.apply(this,arguments),this.mr=this.getValues())},pc:function(){return this.elements||(this.elements=this.x.querySelectorAll("[name]")),this.elements},getValues:function(){for(var t=this.$f?webix.clone(this.$f):{},e=this.pc(),i=0;i<e.length;i++)("input"!==this.or(e[i])||"radio"!==this.pr(e[i],"type")||e[i].checked!==!1)&&(t[e[i].name]=this.qr(e[i]));
return t},setValues:function(t,e){e||this.clear(!0),this.render(),this.$f=webix.clone(t);for(var i=this.pc(),s=0;s<i.length;s++)webix.isUndefined(t[i[s].name])||this.rr(i[s],t[i[s].name]);this.callEvent("onChange",[])},focus:function(t){var e;e=webix.isUndefined(t)?this.pc()[0]:this.x.querySelector('[name="'+t+'"]'),webix.isUndefined(e)||e.focus()
},clear:function(t){this.render();for(var e=this.pc(),i=0;i<e.length;i++){var s=t?"":this.mr[e[i].name]||"";this.rr(e[i],s)}},or:function(t){return t.tagName?t.tagName.toLowerCase():null},pr:function(t,e){if(!t.getAttribute)return null;var i=t.getAttribute(e);return i.toLowerCase?i.toLowerCase():null
},qr:function(t){var e=this.or(t);return this.sr[e]?this.sr[e].call(this,t):this.sr.other.call(this,t)},sr:{input:function(t){var e=this.pr(t,"type");return"checkbox"===e?t.checked:t.value},textarea:function(t){return t.value},select:function(t){var e=t.selectedIndex;return t.options[e].value},other:function(t){return t.innerHTML
}},rr:function(t,e){var i=this.or(t);return this.tr[i]?this.tr[i].call(this,t,e):this.tr.other.call(this,t,e)},tr:{input:function(t,e){var i=this.pr(t,"type");"checkbox"===i?t.checked=e?!0:!1:"radio"===i?t.checked=t.value===e?!0:!1:t.value=e},textarea:function(t,e){t.value=e},select:function(t,e){t.value=e?e:t.firstElementChild.value||e
},other:function(t,e){t.innerHTML=e}},Te:function(t,e){this.Qe(t,e);var i=this.x.querySelector('[name="'+t+'"]');i&&webix.html.addCss(i,"invalid")},Qe:function(t){var e=this.x.querySelector('[name="'+t+'"]');e&&webix.html.removeCss(e,"invalid")}},webix.ui.template,webix.Values),webix.dp=function(t){if("object"==typeof t&&t.s&&(t=t.s.id),webix.dp.ur[t])return webix.dp.ur[t];
("string"==typeof t||"number"==typeof t)&&(t={master:webix.$$(t)});var e=new webix.DataProcessor(t),i=e.s.master.s.id;return webix.dp.ur[i]=e,webix.$$(i).attachEvent("onDestruct",function(){webix.dp.ur[this.s.id]=null,delete webix.dp.ur[this.s.id]}),e},webix.dp.ur={},webix.dp.$$=function(t){return webix.dp.ur[t]
},webix.DataProcessor=webix.proto({defaults:{autoupdate:!0,updateFromResponse:!1,mode:"post",operationName:"webix_operation",trackMove:!1},$init:function(){this.reset(),this.vr=!1,this.name="DataProcessor",this.$ready.push(this.Mi)},reset:function(){this.zr=[]},url_setter:function(t){var e="";if("string"==typeof t){var i=t.split("->");
i.length>1&&(t=i[1],e=i[0])}else t&&t.mode&&(e=t.mode,t=t.url);return e?webix.proxy(e,t):t},master_setter:function(t){var e=t;return"DataStore"!=t.name&&(e=t.data),this.s.store=e,t},Mi:function(){this.s.store.attachEvent("onStoreUpdated",webix.bind(this.Ar,this)),this.s.store.attachEvent("onDataMove",webix.bind(this.Br,this))
},ignore:function(t,e){var i=this.vr;this.vr=!0,t.call(e||this),this.vr=i},off:function(){this.vr=!0},on:function(){this.vr=!1},Cr:function(t){var e={};for(var i in t)0!==i.indexOf("$")&&(e[i]=t[i]);return e},save:function(t,e,i){e=e||"update",this.Dr(t,i||this.s.store.getItem(t),e)},Dr:function(t,e,i){if("object"==typeof t&&(t=t.toString()),!t||this.vr===!0||!i||"paint"==i)return!0;
var s=this.s.store;s&&s.vf&&(e=s.vf(e));var n={id:t,data:this.Cr(e),operation:i};if(webix.isUndefined(e.$parent)||(n.data.parent=e.$parent),"delete"!=n.operation){var r=this.s.master;r&&r.data&&r.data.getMark&&r.data.getMark(t,"webix_invalid")&&(n.Er=!0),this.validate(n.data)||(n.Er=!0)}return this.Fr(n)&&this.zr.push(n),this.s.autoupdate&&this.send(),!0
},Br:function(t,e,i){if(this.s.trackMove){var s=webix.copy(this.s.store.getItem(t)),n=this.s.store.order;s.webix_move_index=e,s.webix_move_id=n[e+1]||"",s.webix_move_parent=i,this.Dr(t,s,"update")}},Ar:function(t,e,i){switch(i){case"save":i="update";break;case"update":i="update";break;case"add":i="insert";
break;case"delete":i="delete";break;default:return!0}return this.Dr(t,e,i)},Fr:function(t){for(var e=0;e<this.zr.length;e++){var i=this.zr[e];if(i.id==t.id)return"delete"==t.operation&&("insert"==i.operation?this.zr.splice(e,1):i.operation="delete"),i.data=t.data,i.Er=t.Er,!1}return!0},send:function(){this.Gr()
},Gr:function(){if(this.s.url){for(var t=this.zr,e=[],i=this.s.url,s=0;s<t.length;s++){var n=t[s];if(!n.Hr&&!n.Er){var r=n.id,a=n.operation,h="object"!=typeof i||i.$proxy?i:i[a],o=h&&(h.$proxy||"function"==typeof h);if(h&&(this.s.store.uf&&this.s.store.uf(n.data),this.callEvent("onBefore"+a,[r,n]))){if(n.Hr=!0,!this.callEvent("onBeforeDataSend",[n]))return;
n.data=this.Ir(n.data);var l=this.at({id:n.id,status:n.operation});h.$proxy?h.save?h.save(this.config.master,n,this,l):e.push(n):("insert"==a&&delete n.data.id,o?h(n.id,n.operation,n.data).then(function(t){t&&"function"==typeof t.json&&(t=t.json()),l.success("",t,-1)},function(t){l.error("",null,t)}):(n.data[this.s.operationName]=a,this.G(h,n.data,this.s.mode,a,l))),this.callEvent("onAfterDataSend",[n])
}}}i.$proxy&&i.saveAll&&e.length&&i.saveAll(this.config.master,e,this,this.at({}))}},Ir:function(t){var e={};for(var i in t)0!==i.indexOf("$")&&(e[i]=t[i]);return e},G:function(t,e,i,s,n){return"function"==typeof t?t(e,s,n):void webix.ajax()[i](t,e,n)},at:function(t){var e=this;return{success:function(i,s,n){return e.xr(t,i,s,n)
},error:function(i,s,n){return e.yr(t,i,s,n)}}},attachProgress:function(t,e,i){this.attachEvent("onBeforeDataSend",t),this.attachEvent("onAfterSync",e),this.attachEvent("onAfterSaveError",i),this.attachEvent("onLoadError",i)},yr:function(t,e,i,s){t?this.Jr(!0,t.id,!1,t.status,!1,{text:e,data:i,loader:s}):(this.callEvent("onLoadError",arguments),webix.callEvent("onLoadError",[e,i,s,this]))
},Jr:function(t,e,i,s,n,r){var a=this.getItemState(e);if(a.Hr=!1,t){if(this.callEvent("onBeforeSaveError",[e,s,n,r]))return a.Er=!0,void this.callEvent("onAfterSaveError",[e,s,n,r])}else this.setItemState(e,!1);if(n&&"delete"!=s&&this.s.updateFromResponse){var h=this.s.store.getItem(e);webix.extend(h,n,!0),this.s.store.refresh(e)
}i&&e!=i&&this.s.store.changeId(e,i),this.callEvent("onAfterSave",[n,e,r]),this.callEvent("onAfter"+s,[n,e,r])},processResult:function(t,e,i){var s=e&&("error"==e.status||"invalid"==e.status),n=e?e.newid||e.id:!1;this.Jr(s,t.id,n,t.status,e,i)},xr:function(t,e,i,s){if(this.callEvent("onBeforeSync",[t,e,i,s]),-1===s)this.processResult(t,i,{});
else{var n=this.s.url;if(n.$proxy&&n.result)n.result(t,this.s.master,this,e,i,s);else{var r;e&&(r=i.json(),e&&"undefined"==typeof r&&(r={status:"error"})),this.processResult(t,r,{text:e,data:i,loader:s})}}this.callEvent("onAfterSync",[t,e,i,s])},escape:function(t){return this.s.escape?this.s.escape(t):encodeURIComponent(t)
},getState:function(){if(!this.zr.length)return!1;for(var t=this.zr.length-1;t>=0;t--)if(this.zr[t].Hr)return"saving";return!0},getItemState:function(t){var e=this.bt(t);return this.zr[e]||null},setItemState:function(t,e){if(e)this.save(t,e);else{var i=this.bt(t);i>-1&&this.zr.splice(i,1)}},bt:function(t){for(var e=-1,i=0;i<this.zr.length;i++)if(this.zr[i].id==t){e=i;
break}return e}},webix.Settings,webix.EventSystem,webix.ValidateData),webix.jsonp=function(t,e,i,s){var n="webix_jsonp_"+webix.uid(),r=document.createElement("script");r.id=n,r.type="text/javascript";var a=document.getElementsByTagName("head")[0];"function"==typeof e&&(s=i,i=e,e={}),e||(e={}),e.jsonp="webix.jsonp."+n,webix.jsonp[n]=function(){i.apply(s||window,arguments),r.parentNode.removeChild(r),i=a=s=r=null,delete webix.jsonp[n]
};var h=[];for(var o in e)h.push(o+"="+encodeURIComponent(e[o]));t+=(-1==t.indexOf("?")?"?":"&")+h.join("&"),r.src=t,a.appendChild(r)},webix.markup={namespace:"x",attribute:"data-",dataTag:"li",Ys:/-([a-z])/g,Zs:function(t){return t[1].toUpperCase()},Lr:{width:!0,height:!0,gravity:!0,margin:!0,padding:!0,paddingX:!0,paddingY:!0,minWidth:!0,maxWidth:!0,minHeight:!0,maxHeight:!0,headerRowHeight:!0},Mr:function(t,e){return webix.ui.hasMethod(t,e)
},init:function(t,e,i){t=t||document.body;for(var s=[],n=this.Nr(t),r=n.html,a=null,h=n.length-1;h>=0;h--)s[h]=n[h];for(var h=0;h<s.length;h++){var o;o=this.Or(s[h],r),o.$scope=i,a=this.Pr(o,s[h],r,e)}return a},parse:function(t,e){"string"==typeof t&&(t=webix.DataDriver[e||"xml"].toObject(t,t));var i=this.Nr(t,e);
return this.Or(i[0],i.html)},Pr:function(t,e,i,s){return s?t.container=s:(t.container=e.parentNode,webix.html.remove(e)),this.Mr(t.view,"setPosition")&&delete t.container,webix.ui(t)},Nr:function(t){this.Qr=this.namespace?this.namespace+":":"",this.Rr=this.Qr+"ui";var e=t.getElementsByTagName(this.Rr);
return!e.length&&t.documentElement&&t.documentElement.tagName==this.Rr&&(e=[t.documentElement]),!e.length&&this.namespace&&(e=t.getElementsByTagName("ui"),!e.length&&t.documentElement&&"ui"==t.documentElement.tagName&&(e=[t.documentElement])),e.length||(e=this.Sr(t),e.html=!0),e},Sr:function(t){if(t.getAttribute&&t.getAttribute(this.attribute+"view"))return[t];
for(var e=t.querySelectorAll("["+this.attribute+"view]"),i=[],s=0;s<e.length;s++)e[s].parentNode.getAttribute(this.attribute+"view")||i.push(e[s]);return i},Or:function(t,e,i){var s=!1;if(!i){var n=this.Tr(t,e);if("ui"==n)for(var r=t.childNodes,a=0;a<r.length;a++)if(1==r[a].nodeType)return this.Or(r[a],e);
i={view:n},e&&"table"==t.tagName.toLowerCase()&&(i.data=t,i.datatype="htmltable",s=!0)}for(var h="cols"==i.view||"rows"==i.view||this.Mr(i.view,"addView"),o=[],l=0,c=!(e||t.style),u=t.firstChild;u;){if(1==u.nodeType){var n=this.Tr(u,e);if("data"==n){l=1;var d=u;u=u.nextSibling,i.data=this.Ur(d,e);continue
}if("config"==n){this.Vr(u,i,e);var f=u;u=u.nextSibling,webix.html.remove(f);continue}if("column"==n){l=1;var b=this.Wr(u,e);b.header=b.header||b.value,b.width=1*b.width||"",i.columns=i.columns||[],i.columns.push(b)}else if(n||h&&e){var x=this.Or(u,e,{view:n});"head"==x.view?i.head=x.rows?x.rows[0]:x.template:"body"==x.view?this.Mr(i.view,"addView")?o.push({body:x.rows?x.rows[0]:x.value,header:x.header||""}):i.body=x.rows?1==x.rows.length?x.rows[0]:{rows:x.rows}:x.value:o.push(x)
}else if(c){l=1;var p=u.tagName;e&&(p=p.toLowerCase().replace(this.Ys,this.Zs)),i[p]=webix.DataDriver.xml.tagToObject(u)}}u=u.nextSibling}if(this.Xr(t,i,e),o.length)i.stack?i[i.stack]=o:this.Mr(i.view,"setValues")?i.elements=o:"rows"==i.view?(i.view="layout",i.rows=o):"cols"==i.view?(i.view="layout",i.cols=o):this.Mr(i.view,"setValue")?i.cells=o:this.Mr(i.view,"getBody")?i.body=1==o.length?o[0]:{rows:o}:i.rows=o;
else if(!s&&!l)if(!e||i.template||i.view&&"template"!=i.view){var v=this.Yr(t,e);if(v){var w="template";this.Mr(i.view,"setValue")&&(w="value"),i[w]=i[w]||v}}else i.view="template",i.content=t;return i},Zr:function(t){var e=t.replace(/\s+/gm,"");return e.length>0?!1:!0},$r:{body:1,head:1,data:1,rows:1,cols:1,cells:1,elements:1,ui:1,column:1,config:1},Vr:function(t,e,i){var s=this.Xr(t,{});
s.name?(e[s.name]=s,delete s.name):s.stack?e[s.stack]=[]:e=s;for(var n=t.childNodes,r=0;r<n.length;r++){var a=null;a=1==n[r].nodeType&&"config"==n[r].tagName.toLowerCase()&&n[r].attributes.length?this.Vr(n[r],s,i):n[r].innerHTML,s.stack&&a&&e[s.stack].push(a)}return e},Tr:function(t,e){if(e)return t.getAttribute(this.attribute+"view")||("config"==t.tagName.toLowerCase()?"config":null);
var i=t.tagName.toLowerCase();if(this.namespace){if(0===i.indexOf(this.Qr)||t.scopeName==this.namespace)return i.replace(this.Qr,"")}else if(webix.ui[i]||this.$r[i])return i;return 0},Ur:function(t,e){for(var i=[],s=t.getElementsByTagName(webix.markup.dataTag),n=0;n<s.length;n++){var r=s[n];if(r.parentNode.parentNode.tagName!=webix.markup.dataTag){var a=this.Wr(r,e);
r.className&&(a.$css=r.className),i.push(a)}}return webix.html.remove(t),i},Yr:function(t){return t.style?t.innerHTML:t.firstChild?t.firstChild.wholeText||t.firstChild.data||"":""},Wr:function(t,e){if(!e)return webix.DataDriver.xml.tagToObject(t);var i=this.Xr(t,{},e);return!i.value&&t.childNodes.length&&(i.value=this.Yr(t,e)),i
},Xr:function(t,e,i){for(var s=t.attributes,n=0;n<s.length;n++){var r=s[n].name;if(i){if(0!==r.indexOf(this.attribute))continue;r=r.replace(this.attribute,"").replace(this.Ys,this.Zs)}var a=s[n].value;-1!=a.indexOf("json://")&&(a=JSON.parse(a.replace("json://",""))),this.Lr[r]&&(a=parseInt(a,10)),e[r]=a
}return e}},function(){function t(t,e){var s=t.callback;i(!1),t.box.parentNode.removeChild(t.box),d=t.box=null,s&&s(e,t.details)}function e(e){if(d){e=e||event;var i=e.which||event.keyCode;if(webix.message.keyboard)return(13==i||32==i)&&t(d,!0),27==i&&t(d,!1),e.preventDefault&&e.preventDefault(),!(e.cancelBubble=!0)
}}function i(t){i.cover&&i.cover.parentNode||(i.cover=document.createElement("DIV"),i.cover.onkeydown=e,i.cover.className="webix_modal_cover",document.body.appendChild(i.cover)),i.cover.style.display=t?"inline-block":"none"}function s(t,e,i){return"<div class='webix_popup_button"+(i?" "+i:"")+"' result='"+e+"' ><div>"+t+"</div></div>"
}function n(t){f.area||(f.area=document.createElement("DIV"),f.area.className="webix_message_area",f.area.style[f.position]="5px",document.body.appendChild(f.area)),f.hide(t.id);var e=document.createElement("DIV");return e.innerHTML="<div>"+t.text+"</div>",e.className="webix_info webix_"+t.type,e.onclick=function(){f.hide(t.id),t=null
},webix.$testmode&&(e.className+=" webix_no_transition"),"bottom"==f.position&&f.area.firstChild?f.area.insertBefore(e,f.area.firstChild):f.area.appendChild(e),t.expire>0&&(f.timers[t.id]=window.setTimeout(function(){f.hide(t.id)},t.expire)),e.style.height=e.offsetHeight-2+"px",f.pull[t.id]=e,e=null,t.id
}function r(e,i,n){var r=document.createElement("DIV");r.className=" webix_modal_box webix_"+e.type,r.setAttribute("webixbox",1);var a="";if(e.width&&(r.style.width=e.width+(webix.rules.isNumber(e.width)?"px":"")),e.height&&(r.style.height=e.height+(webix.rules.isNumber(e.height)?"px":"")),e.title&&(a+='<div class="webix_popup_title">'+e.title+"</div>"),a+='<div class="webix_popup_text"><span>'+(e.content?"":e.text)+'</span></div><div  class="webix_popup_controls">',(i||e.ok)&&(a+=s(e.ok||"OK",!0,"confirm")),(n||e.cancel)&&(a+=s(e.cancel||"Cancel",!1)),e.buttons)for(var h=0;h<e.buttons.length;h++)a+=s(e.buttons[h],h);
if(a+="</div>",r.innerHTML=a,e.content){var o=e.content;"string"==typeof o&&(o=document.getElementById(o)),"none"==o.style.display&&(o.style.display=""),r.childNodes[e.title?1:0].appendChild(o)}return r.onclick=function(i){i=i||event;var s=i.target||i.srcElement;if(s.className||(s=s.parentNode),-1!=s.className.indexOf("webix_popup_button")){var n=s.getAttribute("result");
n="true"==n||("false"==n?!1:n),t(e,n)}i.cancelBubble=!0},e.box=r,(i||n||e.buttons)&&(d=e),r}function a(t,s,n){var a=t.tagName?t:r(t,s,n);t.hidden||i(!0),document.body.appendChild(a);var h=t.left||Math.abs(Math.floor(((window.innerWidth||document.documentElement.offsetWidth)-a.offsetWidth)/2)),o=t.top||Math.abs(Math.floor(((window.innerHeight||document.documentElement.offsetHeight)-a.offsetHeight)/2));
return a.style.top="top"==t.position?"-3px":o+"px",a.style.left=h+"px",a.onkeydown=e,a.focus(),t.hidden&&webix.modalbox.hide(a),a}function h(t){return a(t,!0,!1)}function o(t){return a(t,!0,!0)}function l(t){return a(t)}function c(t,e,i){return"object"!=typeof t&&("function"==typeof e&&(i=e,e=""),t={text:t,type:e,callback:i}),t
}function u(t,e,i,s){return"object"!=typeof t&&(t={text:t,type:e,expire:i,id:s}),t.id=t.id||f.uid(),t.expire=t.expire||f.expire,t}var d=null;document.attachEvent?document.attachEvent("onkeydown",e):document.addEventListener("keydown",e,!0),webix.alert=function(){var t=c.apply(this,arguments);return t.type=t.type||"confirm",h(t)
},webix.confirm=function(){var t=c.apply(this,arguments);return t.type=t.type||"alert",o(t)},webix.modalbox=function(){var t=c.apply(this,arguments);return t.type=t.type||"alert",l(t)},webix.modalbox.hide=function(t){if(t){for(;t&&t.getAttribute&&!t.getAttribute("webixbox");)t=t.parentNode;t&&t.parentNode.removeChild(t)
}i(!1),d=null};var f=webix.message=function(t){t=u.apply(this,arguments),t.type=t.type||"info";var e=t.type.split("-")[0];switch(e){case"alert":return h(t);case"confirm":return o(t);case"modalbox":return l(t);default:return n(t)}};f.seed=(new Date).valueOf(),f.uid=function(){return f.seed++},f.expire=4e3,f.keyboard=!0,f.position="top",f.pull={},f.timers={},f.hideAll=function(){for(var t in f.pull)f.hide(t)
},f.hide=function(t){var e=f.pull[t];e&&e.parentNode&&(window.setTimeout(function(){e.parentNode.removeChild(e),e=null},2e3),e.style.height=0,e.className+=" hidden",f.timers[t]&&window.clearTimeout(f.timers[t]),delete f.pull[t])}}(),webix.protoUI({name:"carousel",defaults:{scrollSpeed:"300ms",type:"clean",navigation:{}},$init:function(){this.x.className+=" webix_carousel",this.Ft=null,this.y=null,this.Mh=0,this.$ready.unshift(this.Gt),this.$ready.push(this.Mi)
},Gt:function(){this.Ft&&this.Ft.destructor&&this.Ft.destructor();var t="";this.config.cols?(t="cols",this.mc=0):(t="rows",this.mc=1);var e={borderless:!0,type:"clean"};e[t]=webix.copy(this.config[t]),webix.extend(e,e.layoutConfig||{},!0),this.Ft=webix.ui.A(e),this.Ft.Xb=this,this.x.appendChild(this.Ft.x),this.q=this.Ft.q,this.Ft.fc=webix.bind(webix.ui.carousel.prototype.fc,this),this.Ft.adjustScroll=webix.bind(webix.ui.carousel.prototype.adjustScroll,this),webix.attachEvent("onReconstruct",webix.bind(function(t){t==this.Ft&&this.Ht()
},this)),this.w=this.x.firstChild},getChildViews:function(){return[this.Ft]},getLayout:function(){return this.Ft},Mi:function(){this.w.setAttribute("touch_scroll",this.mc?"y":"x"),this.Ft.attachEvent("onAfterScroll",webix.bind(function(){this.callEvent("onShow",[this.getActiveId()])},this))},adjustScroll:function(t){var e,i=this.mc?this.dc:this.bc;
return this.mc?(e=Math.round(t.f/i),t.f=e*i):(e=Math.round(t.e/i),t.e=e*i),this.Mh=-e,this.s.navigation&&this.Eh(),!0},fc:function(t){var e,i,s,n,r,a;for(s=-1,i=this.Ft,e=0;e<i.q.length;e++)if(i.q[e]==t){s=e;break}0>s||s==this.Mh||(this.Mh=s,n=i.mc?this.dc:this.bc,r=-(i.mc?0:s*n),a=-(i.mc?s*n:0),this.scrollTo(r,a),this.callEvent("onShow",[i.q[this.Mh].s.id]),this.s.navigation&&this.Ch())
},scrollTo:function(t,e){webix.Touch&&webix.animate.isSupported()?webix.Touch.Nf(this.w,t,e,this.s.scrollSpeed||"100ms"):(this.w.style.marginLeft=t+"px",this.w.style.marginTop=e+"px")},navigation_setter:function(t){return this.E(t,{type:"corner",buttons:!0,items:!0}),t},showNext:function(){this.Mh<this.Ft.q.length-1&&this.setActiveIndex(this.Mh+1)
},showPrev:function(){this.Mh>0&&this.setActiveIndex(this.Mh-1)},setActiveIndex:function(t){var e=this.Ft.q[t].s.id;webix.$$(e).show()},getActiveIndex:function(){return this.Mh},$getSize:function(t,e){var i=this.Ft.$getSize(0,0),s=webix.ui.view.prototype.$getSize.call(this,t,e);return this.Ft.mc?(s[0]=Math.max(s[0],i[0]),s[1]=Math.min(s[1],i[1])):(s[2]=Math.max(s[2],i[2]),s[3]=Math.min(s[3],i[3])),s
},$setSize:function(t,e){var i=this.Ft,s=i.q.length,n=webix.ui.view.prototype.$setSize.call(this,t,e),r=this.dc*(i.mc?s:1),a=this.bc*(i.mc?1:s);n?(this.w.style.height=r+"px",this.w.style.width=a+"px",i.$setSize(a,r),this.Ht()):i.$setSize(a,r)},Ht:function(){var t=this.Ft,e=this.Mh||0,i=t.mc?this.dc:this.bc,s=-(t.mc?0:e*i),n=-(t.mc?e*i:0);
this.scrollTo(s,n),this.s.navigation&&this.Ch()},getActiveId:function(){var t=this.Ft.q[this.Mh];return t?t.s.id:null},setActive:function(t){webix.$$(t).show()}},webix.EventSystem,webix.NavigationButtons,webix.ui.view),webix.type(webix.ui.list,{name:"uploader",template:"#name#  {common.removeIcon()}{common.percent()}<div style='float:right'>#sizetext#</div>",percent:function(t){return"transfer"==t.status?"<div style='width:60px; text-align:center; float:right'>"+t.percent+"%</div>":"<div class='webix_upload_"+t.status+"'><span class='"+("error"==t.status?"error_icon":"fa-ok webix_icon")+"'></span></div>"
},removeIcon:function(){return"<div class='webix_remove_upload'><span class='cancel_icon'></span></div>"},on_click:{webix_remove_upload:function(t,e){webix.$$(this.config.uploader).files.remove(e)}}}),webix.UploadDriver={flash:{$render:function(){window.swfobject||webix.require("legacy/swfobject.js");
var t=this.s;t.swfId=t.swfId||"webix_swf_"+webix.uid(),this.re().innerHTML+="<div class='webix_upload_flash'><div id='"+t.swfId+"'></div></div>",this._r=this.re().lastChild,swfobject.embedSWF(webix.codebase+"/legacy/uploader.swf",t.swfId,"100%","100%","9",null,{uploaderId:t.id,ID:t.swfId,enableLogs:t.enableLogs?"1":"",paramName:t.paramName||"upload",multiple:t.multiple?"Y":""},{wmode:"transparent"});
swfobject.getFlashPlayerVersion();webix.event(this.x,"click",webix.bind(function(){var t=new Date;t-(this.ds||0)>250&&this.fileDialog()},this)),this.files.attachEvent("onBeforeDelete",webix.bind(this.as,this))},$applyFlash:function(t,e){return this[t].apply(this,e)},getSwfObject:function(){return swfobject.getObjectById(this.s.swfId)
},fileDialog:function(){this.getSwfObject()&&this.getSwfObject().showDialog()},send:function(t){if("function"==typeof t&&(this.fs=t,t=0),!t){var e=this.files.data.order,i=!0;if(e.length)for(var s=0;s<e.length;s++)i=this.send(e[s])&&i;return void(i&&this.gs())}var n=this.files.getItem(t);return"client"!==n.status?!1:(n.status="transfer",this.getSwfObject()&&this.getSwfObject().upload(t,this.s.upload,this.s.formData||{}),!0)
},$beforeAddFileToQueue:function(t,e,i){var s=e.split(".").pop(),n=this.ks(i);return this.callEvent("onBeforeFileAdd",[{id:t,name:e,size:i,sizetext:n,type:s}])},$addFileToQueue:function(t,e,i){if(this.files.exists(t))return!1;this.s.multiple||this.files.clearAll();var s=e.split(".").pop(),n=this.ks(i),r={name:e,id:t,size:i,sizetext:n,type:s,status:"client"};
this.files.add(r),this.callEvent("onAfterFileAdd",[r]),t&&this.s.autosend&&this.send(t)},stopUpload:function(t){this.as(t)},as:function(t){var e=this.files.getItem(t);this.getSwfObject().uploadStop(t),e.status="client"},$onUploadSuccess:function(t,e,i){var s=this.files.getItem(t);s&&(s.status="server",s.progress=100,i.data&&"string"==typeof i.data&&(i=JSON.parse(i.data),webix.extend(s,i,!0)),this.callEvent("onFileUpload",[s,i]),this.callEvent("onChange",[]),this.files.updateItem(t))
},$onUploadFail:function(t){var e=this.files.getItem(t);e.status="error",delete e.percent,this.files.updateItem(t),this.callEvent("onFileUploadError",[e,""])}},html5:{$render:function(){if(this._r)return void this.w.appendChild(this._r);this.files.attachEvent("onBeforeDelete",this.as);var t={type:"file","class":"webix_hidden_upload",tabindex:-1};
this.s.accept&&(t.accept=this.s.accept),this.s.multiple&&(t.multiple="true");var e=webix.html.create("input",t);this._r=this.w.appendChild(e),webix.event(this.x,"drop",webix.bind(function(t){this.bs(t),webix.html.preventEvent(t)},this)),webix.event(e,"change",webix.bind(function(){if(this.cs(e.files),webix.env.isIE){var t=document.createElement("form");
t.appendChild(this._r),t.reset(),this.w.appendChild(e)}else e.value=""},this)),webix.event(this.x,"click",webix.bind(function(){var t=new Date;t-(this.ds||0)>250&&this.fileDialog()},this)),webix.event(this.x,"dragenter",webix.html.preventEvent),webix.event(this.x,"dragexit",webix.html.preventEvent),webix.event(this.x,"dragover",webix.html.preventEvent)
},bs:function(t){var e=t.dataTransfer.files;this.callEvent("onBeforeFileDrop",[e,t])&&this.cs(e),this.callEvent("onAfterFileDrop",[e,t])},fileDialog:function(t){this.ds=new Date,this.es=t;var e=this.x.getElementsByTagName("INPUT");e[e.length-1].click()},send:function(t,e){if("function"==typeof t&&(this.fs=t,t=0),!t){var i=this.files.data.order,s=!0;
if(i.length)for(var n=0;n<i.length;n++)s=!this.send(i[n],e)&&s;return void(s&&this.gs())}var r=this.files.getItem(t);if("client"!==r.status)return!1;r.status="transfer";var a=new FormData;a.append("upload",r.file);var h={};if(e=e||{},webix.callEvent("onBeforeAjax",["POST",this.s.upload,e,l,h,a])){for(var o in e)a.append(o,e[o]);
var l=r.xhr=new XMLHttpRequest;l.upload.addEventListener("progress",webix.bind(function(e){this.$updateProgress(t,e.loaded/e.total*100)},this),!1),l.onload=webix.bind(function(){l.aborted||this.is(t)},this),l.open("POST",this.s.upload,!0);for(var o in h)l.setRequestHeader(o,h[o]);l.send(a)}return this.$updateProgress(t,0),!0
},is:function(t){var e=this.files.getItem(t);if(e){var i=null;200==e.xhr.status&&(i=webix.DataDriver.json.toObject(e.xhr.responseText)),i&&"error"!=i.status?this.js(t,i):(e.status="error",delete e.percent,this.files.updateItem(t),this.callEvent("onFileUploadError",[e,i])),delete e.xhr}},stopUpload:function(t){webix.bind(this.as,this.files)(t)
},as:function(t){var e=this.getItem(t);"undefined"!=typeof e.xhr&&(e.xhr.aborted=!0,e.xhr.abort()),delete e.xhr,e.status="client"}}},webix.protoUI({name:"uploader",defaults:{autosend:!0,multiple:!0},$cssName:"button",Ce:!0,send:function(){},fileDialog:function(){},stopUpload:function(){},$init:function(){var t=webix.UploadDriver.html5;
this.files=new webix.DataCollection,(webix.isUndefined(XMLHttpRequest)||webix.isUndefined((new XMLHttpRequest).upload))&&(t=webix.UploadDriver.flash),webix.extend(this,t,!0)},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&this.render()},apiOnly_setter:function(t){return webix.delay(this.render,this),this.$apiOnly=t
},cs:function(t){for(var e=0;e<t.length;e++)this.addFile(t[e])},link_setter:function(t){return t&&webix.delay(function(){var t=webix.$$(this.s.link);t.sync&&t.filter?t.sync(this.files):t.setValues&&this.files.data.attachEvent("onStoreUpdated",function(){t.setValues(this)}),t.s.uploader=this.s.id},this),t
},addFile:function(t,e,i){var s=null;"object"==typeof t&&(s=t,t=s.name,e=s.size);var n=this.ks(e);i=i||t.split(".").pop();var r={file:s,name:t,id:webix.uid(),size:e,sizetext:n,type:i,context:this.es,status:"client"};if(this.callEvent("onBeforeFileAdd",[r])){this.s.multiple||this.files.clearAll();var a=this.files.add(r);
this.callEvent("onAfterFileAdd",[r]),a&&this.s.autosend&&this.send(a,this.s.formData)}},addDropZone:function(t){var e=webix.toNode(t);webix.event(e,"dragover",webix.html.preventEvent),webix.event(e,"dragover",function(){webix.html.addCss(e,"webix_drop_file")}),webix.event(e,"dragleave",function(){webix.html.removeCss(e,"webix_drop_file")
}),webix.event(e,"drop",webix.bind(function(t){webix.html.removeCss(e,"webix_drop_file");var i=t.dataTransfer;if(i&&i.files.length)for(var s=0;s<i.files.length;s++)this.addFile(i.files[s]);return webix.html.preventEvent(t)},this))},ks:function(t){for(var e=0;t>1024;)e++,t/=1024;return Math.round(100*t)/100+" "+webix.i18n.fileSize[e]
},js:function(t,e){if("server"===e.status){var i=this.files.getItem(t);i.status="server",i.progress=100,webix.extend(i,e,!0),this.callEvent("onFileUpload",[i,e]),this.callEvent("onChange",[]),this.files.updateItem(t)}this.isUploaded()&&this.gs(e)},gs:function(t){this.callEvent("onUploadComplete",[t]),this.fs&&(this.fs.call(this,t),this.fs=0)
},isUploaded:function(){for(var t=this.files.data.order,e=0;e<t.length;e++)if("server"!=this.files.getItem(t[e]).status)return!1;return!0},$updateProgress:function(t,e){var i=this.files.getItem(t);i.percent=Math.round(e),this.files.updateItem(t)},setValue:function(t){"string"==typeof t&&(t={value:t,status:"server"}),this.files.clearAll(),t&&this.files.parse(t),this.callEvent("onChange",[])
},getValue:function(){var t=[];return this.files.data.each(function(e){"server"==e.status&&t.push(e.value||e.name)}),t.join(",")}},webix.ui.button),webix.html.addMeta=function(t,e){document.getElementsByTagName("head").item(0).appendChild(webix.html.create("meta",{name:t,content:e}))},function(){var t=function(){var t=!!(window.orientation%180);
webix.ui.orientation!==t&&(webix.ui.orientation=t,webix.callEvent("onRotate",[t]))};webix.env.touch&&(webix.ui.orientation=!!((webix.isUndefined(window.orientation)?90:window.orientation)%180),webix.event(window,"onorientationchange"in window?"orientationchange":"resize",t)),webix.env.isFF&&window.matchMedia&&(window.matchMedia("(orientation: portrait)").addListener(function(){webix.ui.orientation=!1
}),window.matchMedia("(orientation: landscape)").addListener(function(){webix.ui.orientation=!0})),webix.ui.fullScreen=function(){if(webix.env.touch){webix.html.addMeta("apple-mobile-web-app-capable","yes"),webix.html.addMeta("viewport","initial-scale=1, maximum-scale=1, user-scalable=no");var e=document.body.offsetHeight||document.body.scrollHeight,i=-1!=navigator.userAgent.indexOf("iPhone"),s=(-1!=navigator.userAgent.indexOf("iPad"),navigator.userAgent.match(/iPhone OS (\d+)/)),n=s&&s[1]>=7,r=i&&(356==e||208==e||306==e||158==e||444==e),a=568==window.screen.height,h=function(){var t=0,e=0;
if(i&&!n)webix.ui.orientation?(t=a?568:480,e=r?268:300):(t=320,e=a?r?504:548:r?416:460);else if(webix.env.isAndroid){if(!webix.env.isFF){document.body.style.width=document.body.style.height="1px",document.body.style.overflow="hidden";var s=window.outerWidth/window.innerWidth;t=window.outerWidth/s,e=window.outerHeight/s
}}else webix.env.isIEMobile||(t=window.innerWidth,e=window.innerHeight);e&&(document.body.style.height=e+"px",document.body.style.width=t+"px"),webix.ui.$freeze=!1,webix.ui.resize()},o=function(){webix.ui.$freeze=!0,webix.env.isSafari?h():webix.delay(h,null,[],500)};webix.attachEvent("onRotate",o),t(),webix.delay(o)
}}}(),function(){if(window.jQuery){var t=jQuery,e=[],i=function(t){return t&&t.getAttribute?t.getAttribute("view_id"):void 0},s=function(s){return function(n){if("string"!=typeof n){var r=[];return this.each(function(){var t,e,e=i(this)||i(this.firstChild);if(e&&(t=webix.$$(e)),!t){var a=n?n.data:0;a&&(n.data=null);
var h=webix.copy(n||{autoheight:!0,autowidth:!0});if(h.view=s,a&&(n.data=h.data=a),"table"===this.tagName.toLowerCase()){var o=webix.html.create("div",{id:this.getAttribute("id")||"","class":this.getAttribute("class")||""},"");this.parentNode.insertBefore(o,this),h.container=o,t=webix.ui(h),t.parse(this,"htmltable")
}else h.container=this,t=webix.ui(h)}r.push(t)}),1===r.length?r[0]:r}return e[n]?e[n].apply(this,[]):void t.error("Method "+n+" does not exist on jQuery.".name)}},n=function(){for(var e in webix.ui){var i="webix_"+e;t.fn[i]||(t.fn[i]=s(e))}};n(),t(n)}}(),webix.history={track:function(t,e){this.ls(t,e);
var i=webix.$$(t),s=function(){webix.history.ms||i.getValue&&webix.history.push(t,i.getValue())};i.getActiveId?i.attachEvent("onViewChange",s):i.attachEvent("onChange",s)},ns:function(t,e){webix.history.ms=1,t=webix.$$(t),t.callEvent("onBeforeHistoryNav",[e])&&t.setValue&&t.setValue(e),webix.history.ms=0
},push:function(t,e,i){t=webix.$$(t);var s="";e&&(s="#!/"+e),webix.isUndefined(i)&&(i=t.getValue?t.getValue():e),window.history.pushState({webix:!0,id:t.s.id,value:i},"",s)},ls:function(t,e){webix.event(window,"popstate",function(t){t.state&&t.state.webix&&webix.history.ns(t.state.id,t.state.value)});
var i=window.location.hash;webix.noanimate=!0,i&&0===i.indexOf("#!/")?webix.history.ns(t,i.replace("#!/","")):e&&(webix.history.push(t,e),webix.history.ns(t,e)),webix.noanimate=!1,this.ls=function(){}}},webix.protoUI({name:"fieldset",defaults:{borderless:!0},$init:function(t){this.x.className+=" webix_fieldset",this.x.innerHTML="<fieldset><legend></legend><div></div></fieldset>"
},label_setter:function(t){return this.x.firstChild.childNodes[0].innerHTML=t,t},getChildViews:function(){return[this.os]},body_setter:function(t){return this.os=webix.ui(t,this.x.firstChild.childNodes[1]),this.os.Xb=this,t},getBody:function(){return this.os},$getSize:function(t,e){t+=18,e+=45;var i=this.ps=this.os.$getSize(t,e);
return i},$setSize:function(t,e){webix.ui.view.prototype.$setSize.call(this,t,e)&&(e=Math.min(this.ps[3],e),t=Math.min(this.ps[1],t),this.os.$setSize(t-18,e-45))}},webix.ui.view),webix.protoUI({name:"slider",$touchCapture:!0,defaults:{min:0,max:100,value:50,step:1,title:!1,template:function(t,e){var i=e.qs="x"+(t.id||webix.uid()),s="<div class='webix_slider_title'></div><div class='webix_slider_box'><div class='webix_slider_left'>&nbsp;</div><div class='webix_slider_right'></div><div class='webix_slider_handle' id='"+i+"'>&nbsp;</div></div>";
return e.$renderInput(t,s,i)}},type_setter:function(t){this.x.className+=" webix_slider_"+t},title_setter:function(t){return"string"==typeof t?webix.template(t):t},rs:function(){return document.getElementById(this.qs)},oe:function(){var t=this.rs(),e=this.s;if(t){var i=this.Ee(e),s=e.value%e.step?Math.round(e.value/e.step)*e.step:e.value;
s=Math.max(Math.min(s,e.max),e.min);var n=e.max-e.min,r=Math.ceil((i-20)*(s-e.min)/n),a=i-20-r;t.style.left=10+r-8+"px",t.parentNode.style.width=i+"px",a=Math.min(Math.max(a,2),i-22),r=Math.min(Math.max(r,2),i-22);var h=t.previousSibling;h.style.width=a+"px";var o=h.previousSibling;o.style.width=r+"px",this.s.title&&(t.parentNode.previousSibling.innerHTML=this.s.title(this.s,this))
}},refresh:function(){this.oe()},$setValue:function(){this.refresh()},$getValue:function(){return this.s.value},$init:function(){webix.env.touch?this.attachEvent("onTouchStart",webix.bind(this.ss,this)):webix.event(this.x,"mousedown",webix.bind(this.ss,this))},ss:function(t){var e=t.target||t.srcElement;
this.Ky&&this.Ky(t);var i=this.s.value;return webix.isArray(i)&&(i=webix.copy(i)),-1!=e.className.indexOf("webix_slider_handle")?(this.$x=i,this.ts.apply(this,arguments)):void(-1!=e.className.indexOf("webix_slider")&&(this.$x=i,this.s.value=this.us.apply(this,arguments),this.ts(t)))},ts:function(){this.vs=webix.env.touch?[this.attachEvent("onTouchMove",webix.bind(this.ws,this)),this.attachEvent("onTouchEnd",webix.bind(this.xs,this))]:[webix.event(document.body,"mousemove",webix.bind(this.ws,this)),webix.event(document.body,"mouseup",webix.bind(this.xs,this))],webix.html.addCss(document.body,"webix_noselect")
},xs:function(){this.vs&&(webix.env.touch?(webix.detachEvent(this.vs[0]),webix.detachEvent(this.vs[1])):(webix.eventRemove(this.vs[0]),webix.eventRemove(this.vs[1])),this.vs=[]),webix.html.removeCss(document.body,"webix_noselect");var t=this.s.value;webix.isArray(t)&&(t=webix.copy(t)),this.s.value=this.$x,this.setValue(t)
},ws:function(){this.s.value=this.us.apply(this,arguments),this.refresh(),this.callEvent("onSliderDrag",[])},us:function(t,e){var i=0;return i=webix.env.touch?e?e.x:t.x:webix.html.pos(t).x,this.ys(i)},ys:function(t){var e=this.s,i=e.max-e.min,s=webix.html.offset(this.rs().parentNode).x,n=Math.ceil((t-s)*i/this.Ee(e));
return n=Math.round((n+e.min)/e.step)*e.step,Math.max(Math.min(n,e.max),e.min)},De:function(){}},webix.ui.text),webix.proxy.offline={$proxy:!0,storage:webix.storage.local,cache:!1,data:"",zs:function(){this.cache||webix.env.offline||(webix.call("onOfflineMode",[]),webix.env.offline=!0)},As:function(){!this.cache&&webix.env.offline&&(webix.env.offline=!1,webix.call("onOnlineMode",[]))
},load:function(t,e){var i={error:function(){var i=this.getCache()||this.data,s={responseText:i},n=webix.ajax.prototype.J(s);this.zs(),webix.ajax.$callback(t,e,i,n,s)},success:function(i,s,n){this.As(),webix.ajax.$callback(t,e,i,s,n),this.setCache(i)}};this.cache&&this.getCache()?i.error.call(this):this.source.$proxy?this.source.load(this,i):webix.ajax(this.source,i,this)
},getCache:function(){return this.storage.get(this.Bs())},clearCache:function(){this.storage.remove(this.Bs())},setCache:function(t){this.storage.put(this.Bs(),t)},Bs:function(){return this.source.$proxy?this.source.source+"_$proxy$_data":this.source+"_$proxy$_data"},saveAll:function(t,e,i,s){this.setCache(t.serialize()),webix.ajax.$callback(t,s,"",e)
},result:function(t,e,i,s,n){for(var r=0;r<n.length;r++)i.processResult({id:n[r].id,status:n[r].operation},{},{})}},webix.proxy.cache={init:function(){webix.extend(this,webix.proxy.offline)},cache:!0},webix.proxy.local={init:function(){webix.extend(this,webix.proxy.offline)},cache:!0,data:[]},window.angular&&function(){function t(t){var e=t.attr("id");
return e||(e=webix.uid(),t.attr("id",e)),e}angular.module("webix",[]).directive("webixUi",["$parse",function(e){return{restrict:"A",scope:!1,link:function(i,s,n){{var r=n.webixUi,a=n.webixReady,h=null;t(s)}s.ready(function(){if(!h){if(a&&(a=e(a)),s.bind("$destroy",function(){h&&h.destructor()}),r){var t=function(){if(h&&h.destructor(),i[r]){var t=webix.copy(i[r]);
t.$scope=i,h=webix.ui(t,s[0]),a&&a(i,{root:h})}};i.$watch(r,t),t()}else{n.view||s.attr("view","rows");var o=webix.markup,l=o.attribute;o.attribute="",h="undefined"!=typeof n.webixRefresh?o.init(s[0],s[0],i):o.init(s[0],null,i),o.attribute=l,a&&a(i,{root:h})}i.$watch(function(){return s[0].offsetWidth+"."+s[0].offsetHeight
},function(){h&&h.adjust()})}})}}}]).directive("webixShow",["$parse",function(e){return{restrict:"A",scope:!1,link:function(i,s,n){var r=e(n.webixShow),a=t(s);r(i)||s.attr("hidden","true"),i.$watch(n.webixShow,function(){var t=webix.$$(a);t&&(r(i)?(webix.$$(a).show(),s[0].removeAttribute("hidden")):webix.$$(a).hide())
})}}}]).directive("webixEvent",["$parse",function(e){var i=function(t,i,s){var n=s.split("="),r=e(n[1]),a=n[0].trim();i.attachEvent(a,function(){return r(t,{id:arguments[0],details:arguments})})};return{restrict:"A",scope:!1,link:function(e,s,n){var r=n.webixEvent.split(";"),a=t(s);setTimeout(function(){var t=s[0].firstChild;
t&&1==t.nodeType&&(a=t.getAttribute("view_id")||a);for(var n=webix.$$(a),h=0;h<r.length;h++)i(e,n,r[h])})}}}]).directive("webixElements",["$parse",function(){return{restrict:"A",scope:!1,link:function(e,i,s){var n=s.webixElements,r=t(i);e.$watchCollection&&e.$watchCollection(n,function(t){setTimeout(function(){var e=webix.$$(r);
e&&(e.define("elements",t),e.refresh())},1)})}}}]).directive("webixData",["$parse",function(){return{restrict:"A",scope:!1,link:function(e,i,s){var n=s.webixData,r=t(i);e.$watchCollection&&e.$watchCollection(n,function(t){t&&setTimeout(function(){var e=i[0].firstChild;e&&1==e.nodeType&&(r=e.getAttribute("view_id")||r);
var s=webix.$$(r);s&&(s.options_setter?(s.define("options",t),s.refresh()):(s.clearAll&&s.clearAll(),s.parse(t)))},1)})}}}])}(),window.Backbone&&function(){function t(t){t.Cs=!0,t.callEvent("onBeforeLoad",[]),t.blockEvent()}function e(t){t.unblockEvent(),t.Cs=!1,t.refresh()}var i={use_id:!1};webix.attachEvent("onUnSyncUnknown",function(t,e){for(var i=t.ab,s=t.It,n=0;n<i.length;n++)t.detachEvent(i[n]);
for(var n=0;n<s.length;n++)e.off.apply(e,s[n])}),webix.attachEvent("onSyncUnknown",function(s,n,r){function a(t){if(i.use_id)return t;var e={};for(var s in t)"id"!=s&&(e[s]=t[s]);return e}function h(t){return i.use_id?t.id:t.cid}function o(t,e){var i=[];e.each(function(t){var e=h(t),s=l(t);s.id=e,i.push(s)
}),t.clearAll(),t.df(i)}function l(t){if(i.get){for(var e={},s=0;s<i.get.length;s++){var n=i.get[s];e[n]=t.get(n)}return e}return t.toJSON()}r&&(i=r),i.get&&"string"==typeof i.get&&(i.get=i.get.split(","));for(var c=[["change",function(t){var e=h(t),i=s.pull[e]=l(t);i.id=e,s.pf&&s.pf(i),s.refresh(i.id)
}],["remove",function(t){var e=h(t);s.pull[e]&&s.remove(e)}],["add",function(t){var e=h(t);if(!s.pull[e]){var i=l(t);i.id=e,s.qf&&s.qf(i),s.add(i)}}],["reset",function(){o(s,n)}],["request",function(e){e instanceof Backbone.Collection&&t(s)}],["sync",function(t){t instanceof Backbone.Collection&&e(s)
}],["error",function(t){t instanceof Backbone.Collection&&e(s)}]],u=0;u<c.length;u++)n.bind.apply(n,c[u]);var d=[s.attachEvent("onAfterAdd",function(t){if(!n.get(t)){var e=a(s.getItem(t)),i=new n.model(e),r=h(i);r!=t&&this.changeId(t,r),n.add(i),n.trigger("webix:add",i)}return!0}),s.attachEvent("onDataUpdate",function(t){var e=n.get(t),i=a(s.getItem(t));
return e.set(i),n.trigger("webix:change",e),!0}),s.attachEvent("onAfterDelete",function(t){var e=n.get(t);return e&&(n.trigger("webix:remove",e),n.remove(t)),!0})];s.Ts=n,s.ab=d,s.It=c,(n.length||s.count())&&o(s,n)}),window.WebixView=Backbone.View.extend({tagName:"div",initialize:function(t){this.options=t||{}
},render:function(){this.beforeRender&&this.beforeRender.apply(this,arguments);var t=this.config||this.options.config,e=this.el?$(this.el)[0]:document.body;return e&&!e.config&&(e.innerHTML=""),this.root=webix.ui(webix.copy(t),e),this.afterRender&&this.afterRender.apply(this,arguments),this},destroy:function(){this.root&&this.root.destructor()
},getRoot:function(){return this.root},getChild:function(t){return this.root.$$(t)}})}(),webix.ActiveContent={$init:function(t){if(t.activeContent){this.$ready.push(this.Ds),this.Es={},this.Fs={},this.Gs={},this.Hs={};for(var e in t.activeContent)if(this[e]=this.Is(e),t.activeContent[e].earlyInit){var i=webix.Xb;
webix.Xb=null,this[e].call(this,{},this,t.activeContent),webix.Xb=i}}},Ds:function(){if(webix.event(this.$view,"blur",function(t){var e=webix.$$(t);if(e!==this&&e.getValue&&e.setValue){e.getNode(t);var i=e.getValue();i!=e.s.value&&e.setValue(i)}},this,!0),this.filter){for(var t in this.s.activeContent)this.type[t]=this[t],this[t]=this.Js(t);
this.type.masterUI=this}},Js:function(t){return function(e){for(var i=this.Hs[t],s=i.s.id,n=this.getItemNode(e).getElementsByTagName("DIV"),r=0;r<n.length;r++)if(n[r].getAttribute("view_id")==s){i.x=i.y=n[r];break}return i}},Ks:function(t,e,i){return function(s){if(s)for(var n=s.target||s.srcElement;n;){if(n.getAttribute&&n.getAttribute("view_id")){if(t.y=t.x=t.$view=n,i.locate){var r=i.locate(n.parentNode),a=i.Gs[e][r];
t.s.value=a,t.s.$masterId=r}return n}n=n.parentNode}return t.x}},Ls:function(t,e){return function(i){var s=e.data;if(e.filter){var n=e.locate(this.x.parentNode);s=e.getItem(n),this.refresh(),e.Fs[t][n]=this.x.outerHTML||(new XMLSerializer).serializeToString(this.x),e.Gs[t][n]=i}s[t]=i}},Is:function(t){return function(e,i,s){var n=i.Es?i:i.masterUI;
if(!n.Es[t]){var r=document.createElement("DIV");s=s||n.s.activeContent;var a=webix.ui(s[t],r);r.firstChild.setAttribute("onclick","event.processed = true; if (webix.env.isIE8) event.srcElement.w_view = '"+a.s.id+"';"),a.getNode=n.Ks(a,t,n),a.attachEvent("onChange",n.Ls(t,n)),n.Hs[t]=a,n.Es[t]=r.innerHTML,n.Fs[t]={},n.Gs[t]={}
}if(n.filter&&e[t]!=n.Gs[t]&&!webix.isUndefined(e[t])){var a=n.Hs[t];a.blockEvent(),a.$view.firstChild||a.refresh(),a.setValue(e[t]),a.refresh(),a.unblockEvent(),n.Gs[t][e.id]=e[t],n.Fs[t][e.id]=a.x.outerHTML||(new XMLSerializer).serializeToString(a.x)}return n.Fs[t][e.id]||n.Es[t]}}},webix.ProgressBar={$init:function(){webix.isUndefined(this.cu)&&this.attachEvent&&(this.attachEvent("onBeforeLoad",this.showProgress),this.attachEvent("onAfterLoad",this.hideProgress),this.cu=null)
},showProgress:function(t){if(!this.cu){t=webix.extend({position:0,delay:2e3,type:"icon",icon:"refresh",hide:!1},t||{},!0);var e="icon"==t.type?"fa-"+t.icon+" fa-spin":"";if(this.cu=webix.html.create("DIV",{"class":"webix_progress_"+t.type},"<div class='webix_progress_state "+e+"'></div>"),this.x.style.position="relative",webix.html.insertBefore(this.cu,this.x.firstChild,this.x),!webix.Touch.$active&&this.getScrollState){var i=this.getScrollState();
this.x.scrollWidth!=this.$width&&(this.cu.style.left=i.x+"px"),this.x.scrollHeight!=this.$height&&(this.cu.style.top="bottom"!=t.type?i.y+"px":i.y+this.$height-this.cu.offsetHeight+"px")}this.du=1}t&&"icon"!=t.type&&webix.delay(function(){if(this.cu){var e=t.position||1;if(this.cu.style[webix.env.transitionDuration]===webix.undefined&&t.delay){var i=0,s=0,n=e/t.delay*30,r=this;
this.Oy&&(window.clearInterval(this.Oy),s=this.cu.firstChild.offsetWidth/this.cu.offsetWidth*100),this.Oy=window.setInterval(function(){30*i==t.delay?window.clearInterval(r.Oy):(r.cu.firstChild.style.width=s+i*n*e*100+"%",i++)},30)}else this.cu.firstChild.style.width=100*e+"%",t.delay&&(this.cu.firstChild.style[webix.env.transitionDuration]=t.delay+"ms");
t.hide&&webix.delay(this.hideProgress,this,[1],t.delay)}this.du=0},this)},hideProgress:function(t){this.du&&(t=!0),this.cu&&(t?(this.Oy&&window.clearInterval(this.Oy),webix.html.remove(this.cu),this.cu=null):this.showProgress({position:1.1,delay:300,hide:!0}))}},webix.protoUI({name:"video",$init:function(t){t.id||(t.id=webix.uid()),this.$ready.push(this.Ms)
},Ms:function(){var t=this.s;if(this.w=webix.html.create("video",{"class":"webix_view_video",style:"width:100%;height:100%;",autobuffer:"autobuffer"},""),t.poster&&(this.w.poster=t.poster),t.src){"object"!=typeof t.src&&(t.src=[t.src]);for(var e=0;e<t.src.length;e++)this.w.innerHTML+=' <source src="'+t.src[e]+'">'
}t.controls&&(this.w.controls=!0),t.autoplay&&(this.w.autoplay=!0),this.x.appendChild(this.w)},getVideo:function(){return this.w},defaults:{src:"",controls:!0}},webix.ui.view);
//# sourceMappingURL=./webix.js.map