const Tools=(function(){if(!String.prototype.startsWith){Object.defineProperty(String.prototype,'startsWith',{value:function(search,rawPos){var pos=rawPos>0?rawPos|0:0;return this.substring(pos,pos+search.length)===search;}});}
var loop=function(array,from,to,fn){if(from<0||to>array.length){throw new Error("Array Index Out of Bounds!");}else{for(var i=from;i<to;i++){if(fn(array[i],i)===false){return array;}}
return array;}};var htmlCollectionToArray=function(object){if(object instanceof HTMLCollection){var array=new Array(object.length);for(var i=0;i<object.length;i++){array[i]=object.item(i);}
return array;}
return object;};var each=function(object,fn){if(typeof object==='object'){object=htmlCollectionToArray(object);for(var key in object){if(object.hasOwnProperty(key)){if(fn(object[key],key)===false){return object;}}}
return object;}else{throw new Error('Not Object!');}};var eachR=function(object,fn){if(typeof object==='object'){object=htmlCollectionToArray(object);var keysReversed=Object.keys(object).reverse();for(var keyIdx in keysReversed){if(keysReversed.hasOwnProperty(keyIdx)){var key=keysReversed[keyIdx];if(object.hasOwnProperty(key)){if(fn(object[key],key)===false){return object;}}}}
return object;}else{throw new Error('Not Object!');}};var eachNotNull=function(object,fn){return each(object,function(val,key){if(val!=null){fn(val,key);}})};var check=function(object,condition){var result=false;each(object,function(val,key){if(condition(val,key)){result=true;return false;}})
return result;}
var filter=function(object,condition){var result,append;if(typeof object==='object'){if(Array.isArray(object)){result=[];append=function(val){result.push(val);}}else{result={};append=function(val,key){result[key]=val;}}}else{throw new Error('Not Object!');}
each(object,function(val,key){if(condition(val,key)){append(val,key);}})
return result;}
var map=function(object,fn){if(typeof object==='object'){object=htmlCollectionToArray(object);var result=Array.isArray(object)?[]:{};each(object,function(val,key){result[key]=fn(val,key);});return result;}else{throw new Error('Not Object!');}};var join=function(object,separator){var result='';var sep=separator||'';var useSep=false;object.$each(function(val){if(useSep){result+=sep;}
else{useSep=true;}
result+=val;})
return result;}
var removeEmpty=function(object){return object.$each(function(val,key){if(val==null||typeof val==='undefined'){delete object[key];}});}
var objectExtend=function(fnExt,args,output,recursion){var index=0;var newObject=false;if(!recursion){recursion=true;if(typeof args[0]==='boolean'){newObject=args[index++];}}
var out=output||args[index++]||{};if(newObject){out=objectExtend(fnExt,[out],{});}
args.$loopFrom(index,function(obj){if(typeof obj!='undefined'){if(typeof obj==='object'&&!(obj instanceof Element)){each(obj,function(val,key){fnExt(out,val,key,recursion);});}else{out=obj;}}});return out;};var fnExtend=function(out,val,key,recursion){out[key]=val;};var extend=function(){return objectExtend(fnExtend,arguments,undefined,false);};var extendThis=function(args,out){return objectExtend(fnExtend,args,out,false);};var fnDeepExtend=function(out,val,key,recursion){if(Array.isArray(val)){out[key]=val.slice(0);}
else{out[key]=objectExtend(fnDeepExtend,[undefined,out[key],val],undefined,recursion);}};var deepExtend=function(){return objectExtend(fnDeepExtend,arguments,undefined,false);};var deepExtendThis=function(args,out){return objectExtend(fnDeepExtend,args,out,false);};var extendPrototype=function(prototype,values){Object.defineProperties(prototype,map(values,function(val,key){return{value:val,enumerable:false};}));};var extendPrototypes=function(prototypes,values){each(prototypes,function(prototype){extendPrototype(prototype,values);});};var evalScripts=function($target){console.debug("Evaluating scripts for:",$target);$target.getElementsByTagName('script').$each(function($script){eval($script.textContent);});};var replaceCharAt=function(source,charIndex,replacement){return source.substr(0,charIndex)+replacement+source.substr(charIndex+1);};var intersects=function(line1,line2){var det,gamma,lambda;det=(line1.p2.x-line1.p1.x)*(line2.p2.y-line2.p1.y)-(line2.p2.x-line2.p1.x)*(line1.p2.y-line1.p1.y);if(det===0){return false;}else{lambda=((line2.p2.y-line2.p1.y)*(line2.p2.x-line1.p1.x)+(line2.p1.x-line2.p2.x)*(line2.p2.y-line1.p1.y))/det;gamma=((line1.p1.y-line1.p2.y)*(line2.p2.x-line1.p1.x)+(line1.p2.x-line1.p1.x)*(line2.p2.y-line1.p1.y))/det;return(0<lambda&&lambda<1)&&(0<gamma&&gamma<1);}};var elementViewport=function($el,$area){var windowBounds=function(){return{top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth,}}
$area=$area||window;var boundsEl=$el.getBoundingClientRect();var boundsArea=$area instanceof Window?windowBounds():$area.getBoundingClientRect();function lineTop(bounds){return{p1:{x:bounds.left,y:bounds.top},p2:{x:bounds.right,y:bounds.top}}}
function lineLeft(bounds){return{p1:{x:bounds.left,y:bounds.top},p2:{x:bounds.left,y:bounds.bottom}}}
function lineBottom(bounds){return{p1:{x:bounds.right,y:bounds.bottom},p2:{x:bounds.left,y:bounds.bottom}}}
function lineRight(bounds){return{p1:{x:bounds.right,y:bounds.bottom},p2:{x:bounds.right,y:bounds.top}}}
var fullyIn=function(){var top=boundsEl.top>=boundsArea.top&&boundsEl.top<boundsArea.bottom;var left=boundsEl.left>=boundsArea.left&&boundsEl.left<boundsArea.right;var bottom=boundsEl.bottom<=boundsArea.bottom&&boundsEl.bottom>boundsArea.top;var right=boundsEl.right<=boundsArea.right&&boundsEl.right>boundsArea.left;return top&&left&&bottom&&right;};var partiallyIn=function(){if(fullyIn()){return true;}
var lineTopArea=lineTop(boundsArea);var lineLeftArea=lineLeft(boundsArea);var lineBottomArea=lineBottom(boundsArea);var lineRightArea=lineRight(boundsArea);var lineTopEl=lineTop(boundsEl);var lineLeftEl=lineLeft(boundsEl);var lineBottomEl=lineBottom(boundsEl);var lineRightEl=lineRight(boundsEl);return intersects(lineTopArea,lineLeftEl)||intersects(lineTopArea,lineRightEl)||intersects(lineLeftArea,lineTopEl)||intersects(lineLeftArea,lineBottomEl)||intersects(lineBottomArea,lineLeftEl)||intersects(lineBottomArea,lineRightEl)||intersects(lineRightArea,lineTopEl)||intersects(lineRightArea,lineBottomEl)};return{$el:$el,$area:$area,boundsEl:boundsEl,boundsArea:boundsArea,fullyIn:fullyIn,partiallyIn:partiallyIn,};};var revertStyle=function($el,style,value){if(value){$el.style[style]=value;}
else{$el.style.removeProperty(style);}};var getWantedSize=function($el,visibleDisplay){if(window.getComputedStyle($el).display!=='none'){return{w:$el.offsetWidth,h:parseInt(window.getComputedStyle($el).height)};}
var display=$el.style.display,position=$el.style.position,visibility=$el.style.visibility;$el.style.position=window.getComputedStyle($el).position=='fixed'?'fixed':'absolute';$el.style.visibility='hidden';$el.style.display=visibleDisplay||'block';var result={w:$el.offsetWidth,h:parseInt(window.getComputedStyle($el).height)};revertStyle($el,'display',display);revertStyle($el,'position',position);revertStyle($el,'visibility',visibility);return result;};var profile=function(message,time){var now=new Date().getTime();var out=[];if(time){out.push(now-time+'ms');}
if(message){out.push(message);}
if(out.length){console.debug(out);}
return now;};extendPrototype(Object.prototype,{$loop:function(from,to,fn){return loop(this,from,to,fn);},$loopTo:function(to,fn){return loop(this,0,to,fn);},$loopFrom:function(from,fn){return loop(this,from,this.length,fn);},$each:function(fn){return each(this,fn);},$eachR:function(fn){return eachR(this,fn);},$eachNotNull:function(fn){return eachNotNull(this,fn);},$check:function(condition){return check(this,condition);},$filter:function(condition){return filter(this,condition);},$map:function(fn){return map(this,fn);},$join:function(separator){return join(this,separator);},$extend:function(){return extendThis(arguments,this);},$deepExtend:function(){return deepExtendThis(arguments,this);},$removeEmpty:function(){return removeEmpty(this);},$evalScripts:function(){evalScripts(this);return this;}});var bool=function(value){return value&&(value==='true'||value===true);}
return{loop:loop,each:each,eachR:eachR,eachNotNull:eachNotNull,map:map,check:check,filter:filter,join:join,extend:extend,deepExtend:deepExtend,removeEmpty:removeEmpty,extendPrototype:extendPrototype,extendPrototypes:extendPrototypes,evalScripts:evalScripts,elementViewport:elementViewport,intersects:intersects,replaceCharAt:replaceCharAt,revertStyle:revertStyle,getWantedSize:getWantedSize,profile:profile,bool:bool,}})();const NumberFormat=(function(){const extraValues=(function(){const extraValue=function(result,condition){return{is:function(input){return condition(input);},result:result}}
return{empty:extraValue('&nbsp;',function(input){return typeof input==='undefined'||input==null||input.length==0;}),multiple:extraValue(typeof localised==='undefined'?'Multiple Values':localised['Multiple Values'],function(input){return input==='MULTIPLE';}),infinite:extraValue('∞',function(input){return!isFinite(input)&&!isNaN(input);}),nan:extraValue('�',function(input){return isNaN(input);}),}})();const options={companyLanguage:'en-US',currencyCode:'',decimalSeparator:'.',thousandsSeparator:' ',fractionDigits:2,fixFractionDigits:true,clearInteger:false,multiplier:1,suffix:false}
function init(_options){options.$extend(_options);}
function format(input,_options,fn){var result=false;extraValues.$each(function(extra){if(extra.is(input)){result=extra.result;return false;}})
if(result!=false){return result;}
return fn(input,_options);}
function isInteger(number){if(typeof number==='string'){return isInteger(Number(number));}
return(number^0)===number;}
function number(input,_options){let opts=options.$extend(true,_options);var result=input*opts.multiplier;if(isInteger(Number(input))&&opts.clearInteger){result=result.toFixed(0);}
else{if(opts.fixFractionDigits){result=result.toFixed(opts.fractionDigits);}
if(opts.decimalSeparator!=='.'){result=result.toString().replace('.',opts.decimalSeparator);}}
if(opts.thousandsSeparator){result=result.toString().replace(/\B(?=(\d{3})+(?!\d))/g,opts.thousandsSeparator)}
if(opts.suffix){result+=opts.suffix;}
return result;}
function currency(input,_options){let opts=options.$extend(true,_options);try{let formatter;if(isInteger(input)&&opts.clearInteger){formatter=new Intl.NumberFormat(opts.companyLanguage,{style:'currency',currency:opts.currencyCode,minimumFractionDigits:0,maximumFractionDigits:0,});}else{formatter=new Intl.NumberFormat(opts.companyLanguage,{style:'currency',currency:opts.currencyCode,minimumFractionDigits:2,});}
return formatter.format(input);}catch(err){return number(input);}}
return{init:init,number:function(input,_options){return format(input,_options,number);},currency:function(input,_options){return format(input,_options,currency);},}})();const Events=(function(){(function(){if(typeof window.CustomEvent==="function")return false;function CustomEvent(event,params){params=params||{bubbles:false,cancelable:false,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt;}
CustomEvent.prototype=window.Event.prototype;window.CustomEvent=CustomEvent;})();var onDocReady=function(fn,params){if(document.readyState==="complete"||document.readyState==="interactive"){setTimeout(fn,1);}else{document.addEventListener("DOMContentLoaded",fn,params);}};var isEvent=function(evt){return evt instanceof Event;};var initEvent=function(evt,props){return isEvent(evt)?evt:new CustomEvent(evt,{'detail':props});}
var triggerEvent=function($scope,event){$scope.dispatchEvent(event);return event;};var trigger=function($scope,evt,props){if(typeof evt==='object'&&!isEvent(evt)){evt.$map(function(e){return initEvent(e,props);}).$each(function(e){triggerEvent($scope,e);});}else{return triggerEvent($scope,initEvent(evt,props));}};var on=function($scope,type,fn,props){$scope.addEventListener(type,fn,props);return $scope;};var off=function($scope,type,fn){$scope.removeEventListener(type,fn);return $scope;};var offOn=function($scope,type,fn,props){off($scope,type,fn);on($scope,type,fn,props);return $scope;};Tools.extendPrototype(Document.prototype,{$ready:onDocReady,});Tools.extendPrototypes([Node.prototype,Window.prototype],{$trigger:function(type,props){return trigger(this,type,props);},$on:function(type,fn,props){return on(this,type,fn,props);},$off:function(type,fn){return off(this,type,fn);},$offOn:function(type,fn,props){return offOn(this,type,fn,props);},});var onAction=function(action,$scope,fn,props){if($scope!=null){$scope.$on(action,fn,props);}
return $scope;};var onClick=function($scope,fn,props){return onAction('click',$scope,fn,props);}
var onChange=function($scope,fn,props){return onAction('change',$scope,fn,props);}
var onFocus=function($scope,fn,props){return onAction('focus',$scope,fn,props);}
var onBlur=function($scope,fn,props){return onAction('blur',$scope,fn,props);}
var onKeydown=function($scope,fn,props){return onAction('keydown',$scope,fn,props);}
var onMouseEnter=function($scope,fn,props){return onAction('mouseenter',$scope,fn,props);}
var onMouseLeave=function($scope,fn,props){return onAction('mouseleave',$scope,fn,props);}
function regBtnOnClick($btn,fn){if($btn!=null){$btn.$on('click',function(e){return fn(e,$btn);});}}
return{onDocReady:onDocReady,trigger:trigger,on:on,off:off,offOn:offOn,onChange:onChange,onClick:onClick,onFocus:onFocus,onBlur:onBlur,onKeydown:onKeydown,onMouseEnter:onMouseEnter,onMouseLeave:onMouseLeave,}})();const Html=(function(){function ReplaceWithPolyfill(){'use-strict';var parent=this.parentNode,i=arguments.length,currentNode;if(!parent)return;if(!i)
parent.removeChild(this);while(i--){currentNode=arguments[i];if(typeof currentNode!=='object'){currentNode=this.ownerDocument.createTextNode(currentNode);}else if(currentNode.parentNode){currentNode.parentNode.removeChild(currentNode);}
if(!i)
parent.replaceChild(currentNode,this);else
parent.insertBefore(currentNode,this.previousSibling);}}
if(!Element.prototype.replaceWith)
Element.prototype.replaceWith=ReplaceWithPolyfill;if(!CharacterData.prototype.replaceWith)
CharacterData.prototype.replaceWith=ReplaceWithPolyfill;if(!DocumentType.prototype.replaceWith)
DocumentType.prototype.replaceWith=ReplaceWithPolyfill;if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector;}
if(!Element.prototype.closest){Element.prototype.closest=function(selector){var $el=this;do{if(Element.prototype.matches.call($el,selector))return $el;$el=$el.parentElement||$el.parentNode;}while($el!==null&&$el.nodeType===1);return null;};}
if(!Element.prototype.isPartOf){Element.prototype.isPartOf=function(selector){var $el=this;if(selector instanceof Element){return selector.contains($el);}
return $el.matches(selector)||$el.closest(selector)!=null;};}
(function(arr){arr.forEach(function(item){if(item.hasOwnProperty('remove')){return;}
Object.defineProperty(item,'remove',{configurable:true,enumerable:true,writable:true,value:function remove(){if(this.parentNode===null){return;}
this.parentNode.removeChild(this);}});});})([Element.prototype,CharacterData.prototype,DocumentType.prototype]);var EVENTS={CHANGE:'html_change',REPLACE:'html_replace',BEFORE:'html_before',PREPEND:'html_prepend',APPEND:'html_append',AFTER:'html_after',};var change=function($target,change,events){change();$target.$trigger([Html.EVENTS.CHANGE].concat(events));return $target;};var insertHtml=function($target,html,type,event){return change($target,function(){$target.insertAdjacentHTML(type,html);},[event]);};var insertElement=function($target,html,type,event){return change($target,function(){$target.insertAdjacentElement(type,html);},[event]);};var insert=function($target,html,type,event){return((html instanceof Element)?insertElement:insertHtml)($target,html,type,event);};var before=function($target,html){return insert($target,html,'beforebegin',Html.EVENTS.BEFORE);};var prepend=function($target,html){return insert($target,html,'afterbegin',Html.EVENTS.PREPEND);};var append=function($target,html){return insert($target,html,'beforeend',Html.EVENTS.APPEND);};var after=function($target,html){return insert($target,html,'afterend',Html.EVENTS.AFTER);};var replaceHtml=function($target,html){if(isNode(html)||isNodeList(html)){return change($target,function(){$target.innerHTML='';$target.insertAdjacentElement('beforeend',html)},Html.EVENTS.REPLACE);}else{return change($target,function(){$target.innerHTML=html},Html.EVENTS.REPLACE);}};var replaceThis=function($target,html){if(isNode(html)){return change(html,function(){$target.replaceWith(html);},Html.EVENTS.REPLACE);}else{return replaceThis($target,toNode(html));}};var detach=function($target){$target.parentElement.removeChild($target);return $target;}
function isNode(input){return input instanceof Node;}
function isNodeList(input){return input instanceof NodeList;}
function toNode(input){if(isNode(input)){return input;}
var doc=new DOMParser().parseFromString(input,"text/html");return doc.querySelector('head > *, body > *');}
function toNodes(input){var nodeToList=(function(){var newList=document.createDocumentFragment().childNodes;return function(node){return Object.create(newList,{'0':{value:node,enumerable:true},'length':{value:1},'item':{"value":function(i){return this[+i||0];},enumerable:true}});};}());if(isNodeList(input)){return input;}
if(isNode()){return nodeToList(input);}
var doc=new DOMParser().parseFromString(input,"text/html");return doc.querySelectorAll('head > *, body > *');}
var dimensions=(function(){return{width:function($target){return parseFloat(getComputedStyle($target,null).width.replace("px",""));},height:function($target){return parseFloat(getComputedStyle($target,null).height.replace("px",""));}}})();var clazz={clear:function($target){$target.removeAttribute('class');return $target;},get:function($target){return $target.className;},getList:function($target){return $target.classList;},set:function($target,clazz){$target.className=clazz;return $target;},add:function($target,clazz){$target.classList.add(clazz);return $target;},remove:function($target,clazz){$target.classList.remove(clazz);return $target;},toggle:function($target,clazz){$target.classList.toggle(clazz);return $target;},toggleWhen:function($target,add,clazz){return add?$target.$clAdd(clazz):$target.$clRemove(clazz);},has:function($target,clazz){return $target.classList&&$target.classList.contains(clazz);},};var create={element:function(props){props.id=props.id||'';props.clazz=props.clazz||props['class']||'';props.attrs=props.attrs||{};let element=document.createElement(props.tag);element.id=props.id;Html.clazz.set(element,Array.isArray(props.clazz)?props.clazz.join(' '):props.clazz);Tools.each(props.attrs,function(value,key){element.setAttribute(key,value);});return element;},A:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'A'}));},BUTTON:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'BUTTON'}));},DIV:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'DIV'}));},FORM:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'FORM'}));},H1:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'H1'}));},IMG:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'IMG'}));},INPUT:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'INPUT'}));},LABEL:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'LABEL'}));},LI:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'LI'}));},OPTION:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'OPTION'}));},P:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'P'}));},SELECT:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'SELECT'}));},SPAN:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'SPAN'}));},STYLE:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'STYLE'}));},SVG:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'SVG'}));},TABLE:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'TABLE'}));},TBODY:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'TBODY'}));},TD:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'TD'}));},THEAD:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'THEAD'}));},TH:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'TH'}));},TR:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'TR'}));},UL:function(props){return Html.create.element(Tools.deepExtend({},props,{tag:'UL'}));},};var createStyle=function(style){function getValue(value,style){return style+':'+value+';';}
function getValues(value,style){return value.$map(getValue).$join();}
function getStyle(styles){return styles.$map(function(value,style){let fn=typeof value==='object'?Array.isArray(value)?getValues:getStyles:getValue
return fn(value,style);}).$join();}
function getStyles(styles,selector){return selector+'{'+getStyle(styles)+'}'}
function getStyleSheet(){return style.$map(getStyles).$join();}
document.head.$prepend(create.STYLE({attrs:{type:'text/css'}}).$replaceHtml(getStyleSheet()));}
Tools.extendPrototype(Element.prototype,{$detach:function(){return detach(this);},$before:function(html){return before(this,html);},$prepend:function(html){return prepend(this,html);},$append:function(html){return append(this,html);},$after:function(html){return after(this,html);},$replaceHtml:function(html){return replaceHtml(this,html);},$replaceThis:function(html){return replaceThis(this,html);},});Tools.extendPrototype(Node.prototype,{$clClear:function(){return clazz.clear(this);},$clGet:function(){return clazz.get(this);},$clGetList:function(){return clazz.getList(this);},$clSet:function(cl){return clazz.set(this,cl);},$clAdd:function(cl){return clazz.add(this,cl);},$clRemove:function(cl){return clazz.remove(this,cl);},$clToggle:function(cl){return clazz.toggle(this,cl);},$clToggleWhen:function(add,cl){return clazz.toggleWhen(this,add,cl);},$clHas:function(cl){return clazz.has(this,cl);},$width:function(){return dimensions.width(this);},$height:function(){return dimensions.height(this);}});return{EVENTS:EVENTS,toNode:toNode,toNodes:toNodes,before:before,prepend:prepend,append:append,after:after,replaceHtml:replaceHtml,replaceThis:replaceThis,clazz:clazz,create:create,createStyle:createStyle,}})();const Animations=(function(){var animation={setStartState:function(){},doStep:function(elapsed){},setEndState:function(){}};var defaultProps={duration:500,display:'block',displayhide:'none',opacityHide:0,opacityShow:1,callback:function(){}};var run=function(runArgs){runArgs.start();const start=new Date().getTime();(function animationStep(){var elapsed=new Date().getTime()-start;if(elapsed>=runArgs.duration){runArgs.end();runArgs.callback();}else{runArgs.step(elapsed);requestAnimationFrame(animationStep);}})();};var runAnimation=function(animation,duration,callback){run({duration:duration,start:animation.setStartState,step:animation.doStep,end:animation.setEndState,callback:callback});};var runAnimations=function(animationsSet,duration,callback){run({duration:duration,start:function(){animationsSet.$each(function(animation){animation.setStartState();})},step:function(elapsed){animationsSet.$each(function(animation){animation.doStep(elapsed);})},end:function(){animationsSet.$each(function(animation){animation.setEndState();})},callback:function(){animationsSet.$each(function(animation){animation.props.callback();})
if(callback)callback();},});};var animations=function(userProps){var invert=false;const props=defaultProps.$extend(true,userProps.$removeEmpty());var theAnimation;var addSteps=function(definedSteps){theAnimation=animation.$extend(true,{doStep:definedSteps});};var addStates=function(states){theAnimation.$extend(states);};var getResult=function(){return theAnimation.$extend({props:props,run:function(){runAnimation(theAnimation,props.duration,props.callback);return props.$target;}});}
return{slide:function(){const heightStyle=props.$target.style.height;const overflowStyle=props.$target.style.height;const height=Tools.getWantedSize(props.$target,props.display).h;const stepSize=height/props.duration;addSteps(function(elapsed){var stepValue=(elapsed*stepSize)
if(invert){stepValue=height-stepValue;}
props.$target.style.height=stepValue+'px';});function revertStyle(){Tools.revertStyle(props.$target,'height',heightStyle);Tools.revertStyle(props.$target,'overflow',overflowStyle);}
return{down:function(){addStates({name:'slideDown',setStartState:function(){props.$target.style.height=0+'px';props.$target.style.overflow='hidden';props.$target.style.display=props.display;},setEndState:function(){revertStyle();props.$target.style.overflow='none';},});return getResult();},up:function(){addStates({name:'slideUp',setStartState:function(){props.$target.style.overflow='hidden';props.$target.style.height=height+'px';},setEndState:function(){props.$target.style.display=props.displayhide;revertStyle();},});invert=true;return getResult();},toggle:function(){return getComputedStyle(props.$target).display==props.displayhide?this.down():this.up();},}},fade:function(){const opacity=props.opacityShow-props.opacityHide;const stepSize=opacity/props.duration;addSteps(function(elapsed){var stepValue=(elapsed*stepSize)
if(invert){stepValue=opacity-stepValue;}
props.$target.style.opacity=stepValue;});return{'in':function(){addStates({name:'fadeIn',setStartState:function(){props.$target.style.opacity=props.opacityHide;props.$target.style.display=props.display;},setEndState:function(){props.$target.style.opacity=props.opacityShow;},});return getResult();},out:function(){addStates({name:'fadeOut',setStartState:function(){props.$target.style.opacity=props.opacityShow;},setEndState:function(){if(props.opacityHide<=0){props.$target.style.display=props.displayhide;}
props.$target.style.opacity=props.opacityHide;},});invert=true;return getResult();},toggle:function(){return getComputedStyle(props.$target).display==props.displayhide?this.in():this.out();},}}};}
var animProps=function($target,duration,props){return animations({$target:$target,duration:duration}.$extend(props));};var fadeIn=function($target,duration,props){return animProps($target,duration,props).fade().in();};var fadeOut=function($target,duration,props){return animProps($target,duration,props).fade().out();};var fadeToggle=function($target,duration,props){return animProps($target,duration,props).fade().toggle();};var slideDown=function($target,duration,props){return animProps($target,duration,props).slide().down();};var slideUp=function($target,duration,props){return animProps($target,duration,props).slide().up();};var slideToggle=function($target,duration,props){return animProps($target,duration,props).slide().toggle();};var bulkAnimation=function(animationsGetter,duration,animationCallback){return(function(){function run(callback){runAnimations(animationsGetter(),duration,function(){if(animationCallback){animationCallback();}
if(callback){callback();}});return bulk();}
function repeat(timeout,callback){setTimeout(function(){run(callback);},timeout);return bulk();}
function loop(timeout){repeat(timeout,function(){loop(timeout);});return bulk();}
function bulk(){return{run:run,repeat:repeat,loop:loop};}
return bulk()})();};Tools.extendPrototype(Element.prototype,{$fadeOut:function(delay,props){return fadeOut(this,delay,props).run();},$fadeIn:function(delay,props){return fadeIn(this,delay,props).run();},$fadeToggle:function(delay,props){return fadeToggle(this,delay,props).run();},$slideUp:function(delay,props){return slideUp(this,delay,props).run();},$slideDown:function(delay,props){return slideDown(this,delay,props).run();},$slideToggle:function(delay,props){return slideToggle(this,delay,props).run();},});return{fadeIn:fadeIn,fadeOut:fadeOut,fadeToggle:fadeToggle,slideDown:slideDown,slideUp:slideUp,slideToggle:slideToggle,bulkAnimation:bulkAnimation};})();const Ajax=(function(){var create=function(){return new XMLHttpRequest();};var open=function(method,url,async){var request=create();request.open(method,contextPath+url,async);request.setRequestHeader('X-Requested-With','XMLHttpRequest');return request;};var headers=function(request,headerValues){headerValues.$each(function(value,header){request.setRequestHeader(header,value);});}
var send=function(request,data){request.send(data);};var toFormData=function(data){if(data!=undefined){if(!(data instanceof FormData)&&typeof data!="string"){var notFormData=data;data=new FormData();notFormData.$each(function(val,key){Ajax.setFormData(data,key,val);});}}
return data;};var METHOD=(function(){var GET={open:function(url,async){return open('GET',url,async);},send:function(request){return send(request,null);}};var POST={open:function(url,async){return open('POST',url,async);},send:function(request,data){send(request,toFormData(data));}};return{GET:GET,POST:POST};})();var RESPONSE={on200:function(data,response){},on304:function(url,response){},onNot200:function(props,code,response){},onErr:function(props,code,response){console.error(props.url,'Unknown Error!');},onXXX:function(props,code,response){console.error(props.url,'Unknown Response!',code);},on401:function(props,response){console.error(props.url,'Unauthorized!');},on403:function(props,response){console.error(props.url,'Forbidden!');},on404:function(props,response){console.error(props.url,'Not Found!');},on500:function(props,response){console.error(props.url,'Internal Server Error!');},on503:function(props,response){console.warn(props.url,'Service Unavailable!');},};var TYPE=(function(){var $TEXT=function(response){return response;};var $JSON=function(response){return JSON.parse(response);};var $HTML=function(response){return Html.toNode(response);};var $HTMLS=function(response){return Html.toNodes(response);};return{TEXT:$TEXT,JSON:$JSON,HTML:$HTML,HTMLS:$HTMLS};})();var not200=function(props,errorCode,response){if(errorCode>=0){var err=props.response['on'+errorCode];if(err){err(props,response);}else{props.response.onXXX(props,errorCode,response);}}else{props.response.onErr(props,errorCode,response);}
props.response.onNot200(props,errorCode,response);};var processRequest=function(props){var resolve=function(result){props.response.on200(props.type(result.response),result.request);};var reject=function(result){not200(props,result.response,result.request);}
var process=function(resolve,reject){var result={request:props.method.open(props.url,props.async==undefined||props.async)}
result.request.onerror=function(){result.response=-1;reject(Error(result));};result.request.onreadystatechange=function(){if(result.request.readyState==4){if(result.request.status==200){result.response=result.request.response;resolve(result);}else{result.response=result.request.status;reject(result);}}};headers(result.request,props.headers);props.method.send(result.request,props.data);};var promise=function(){return new Promise(process);};process(resolve,reject);};var sendRequest=function(props){processRequest({method:props.method,url:props.url,data:props.data,type:props.type,headers:props.headers||{},response:RESPONSE.$deepExtend(true,props.response),})};var DEFAULTS=(function(){var checkRefresh=function(on200){sendRequest({method:METHOD.GET,url:'checkRefresh?clickTime='+Refresh.lastRefresh.get(),type:TYPE.JSON,response:{on200:on200}});};var callRefresh=function(on200,data){sendRequest({method:METHOD.POST,url:'callRefresh',type:TYPE.HTML,response:{on200:on200},data:data});};return{checkRefresh:checkRefresh,callRefresh:callRefresh};})();function setFormData(formData,key,value){if(formData.set){formData.set(key,value);}else{formData.append(key,value);}}
return{METHOD:METHOD,TYPE:TYPE,DEFAULTS:DEFAULTS,RESPONSE:RESPONSE,sendRequest:sendRequest,setFormData:setFormData};})();const Components=(function(){const SvgImage=(function(){var get=function(imageSelector,$element){var $image=document.querySelector(imageSelector||$element.getAttribute('svg-data'));return $image==null?Html.create.SVG():$image.cloneNode(true);}
var tag=function($element,imageSelector){$element.setAttribute('svg-data',imageSelector);return $element.$clAdd('svgAdded');}
var install=function($element,imageSelector,install){let $svg=get(imageSelector,$element);return tag(install($element,$svg),imageSelector);}
var append=function($element,imageSelector){return install($element,imageSelector,Html.append);}
var prepend=function($element,imageSelector){return install($element,imageSelector,Html.prepend);}
var replace=function($element,imageSelector){return install($element,imageSelector,Html.replaceHtml);}
return{get:get,replace:replace,append:append,prepend:prepend}})();const Toast=(function(){const style={'.js-toast':{'position':'absolute','z-index':'110','max-width':'350px','width':'67vw','top':'100px','right':'50px','display':'block',},'.js-toast-message':{'background-color':'white','padding':'0.5em','margin-bottom':'2px','border':'1px solid #666','box-shadow':'0 0 5px #666','cursor':'pointer','display':'block',}}
const $container=Html.create.DIV({'class':'js-toast'});Events.onDocReady(function(){Html.createStyle(style);document.body.$append($container);});function show(message){let $toast=Html.create.DIV({'class':'js-toast-message'}).$append(Html.create.DIV({'class':'text'}).$replaceHtml(message))
let remove=function(){$toast.remove();};setTimeout(function(){Animations.fadeOut($toast,5000,{callback:remove}).run();},1000)
$toast.$on('click',remove);$container.$append($toast);}
return{show:show};})();const Dialog=(function(){const style_default={'.js-dialog-wrapper':{'z-index':'100','position':'absolute','left':'0','top':'0','width':'100%','height':'100%','max-height':'100vh','pointer-events':'none','display':'block !important',},'.js-dialog-wrapper>*':{'pointer-events':'auto',},'.js-dialog-wrapper-modal':{'background-color':'rgba(0,0,0,.1)','position':'absolute','width':'100%','height':'100%',},'.js-dialog':{'margin':'0 auto','position':'absolute','left':['0','calc(50% - 50vw)'],'width':'100%','max-height':'100%','overflow-y':'hidden','-webkit-box-shadow':'rgba(0, 0, 0, 0.3) 0 1px 3px','-moz-box-shadow':'rgba(0, 0, 0, 0.3) 0 1px 3px','box-shadow':'rgba(0, 0, 0, 0.3) 0 1px 3px',},'@media only screen and (min-width: 768px)':{'.js-dialog':{'margin':'10px auto','width':'600px','left':'calc(50% - 300px)','max-height':['95%','calc(100% - 20px)'],}},'.js-dialog-title':{'height':'25px',},'.js-dialog-title > *':{'display':'inline-block','vertical-align':'middle',},'.js-dialog-title-text':{'font-size':'13px','margin':'6px',},'.js-dialog-title-close':{'float':'right','margin':'3px','width':'19px','height':'19px','padding':0,'border':0,'text-decoration':'none','-webkit-appearance':'none','border-radius':'3px','cursor':'pointer',},'.js-dialog-buttons':{'text-align':'right','padding':'5px',},'.js-dialog-title-buttons':{'float':'right',},'.js-dialog-button':{'text-decoration':'none','-webkit-appearance':'none','border-radius':'3px','position':'relative','min-width':'25px','height':'25px','margin':'0 2.5px','border':'none','font-weight':'500','font-size':'1.2rem','padding':'5px 10px','cursor':'pointer','vertical-align':'bottom',},'.js-dialog-title-buttons > .js-dialog-button':{'min-width':'19px','height':'19px','margin-top':'3px','padding':'2.5px 5px',},'.js-dialog-buttons > *':{'vertical-align':'bottom',},'.js-dialog-button-image':{'background-color':'transparent',},'.js-dialog-button-image svg':{'position':'absolute','left':'0px','top':'0px','height':'100%',},'.js-dialog-button-image.js-dialog-button-text':{'padding-left':'25px',},'.js-dialog-title-buttons > .js-dialog-button-image.js-dialog-button-text':{'background-color':'white','padding-left':'19px',},'.js-dialog-button:hover, .js-dialog-title-close:hover':{'-webkit-box-shadow':'rgba(0, 0, 0, 0.1) 50px 50px 0px 0px inset','-moz-box-shadow':'rgba(0, 0, 0, 0.1) 50px 50px 0px 0px inset','box-shadow':'rgba(0, 0, 0, 0.1) 50px 50px 0px 0px inset',},'.js-dialog-content-wrapper':{'position':'relative','overflow-y':'auto',},'.js-dialog-content':{'padding':'10px',},};const style_colors={'.js-dialog-title':{'background-color':'rgb(74,136,204)',},'.js-dialog-title-text':{'color':'white',},'.js-dialog-title-close':{'background-color':'white',},'.js-dialog-title-close svg g':{'fill':'rgb(74,136,204)',},'.js-dialog-buttons':{'background-color':'rgb(217,227,237)',},'.js-dialog-button-text':{'background-color':'rgb(74,136,204)','color':'white',},'.js-dialog-button-image svg g':{'fill':'rgb(74,136,204)',},'.js-dialog-button-image.js-dialog-button-text':{'background-color':'rgb(74,136,204)',},'.js-dialog-button-image.js-dialog-button-text svg g':{'fill':'white',},'.js-dialog-title-buttons > .js-dialog-button-text':{'background-color':'white','color':'rgb(74,136,204)',},'.js-dialog-title-buttons > .js-dialog-button-image svg g':{'fill':'white',},'.js-dialog-title-buttons > .js-dialog-button-image.js-dialog-button-text':{'background-color':'white',},'.js-dialog-title-buttons > .js-dialog-button-image.js-dialog-button-text svg g':{'fill':'rgb(74,136,204)',},'.js-dialog':{'background-color':'white',},}
Events.onDocReady(function(){Html.createStyle(style_default);Html.createStyle(style_colors);});const defOptions={id:false,'class':false,target:'body',modal:true,style:{},title:false,content:false,appendEmptyButtons:false,openOn:false,beforeOpen:function(){},afterOpen:function(){},closeOn:false,doOnCloseOn:function(){},beforeClose:function(){},closeable:true,wrapperCloseable:true,doOnClose:function(){},afterClose:function(){},destroyAfterClose:true,appendNode:function($target,$wrapper){$target.$append($wrapper);},detachNode:function($target,$wrapper){$wrapper.$detach();}}
const defBtnOptions={id:false,'class':false,fromElement:false,custom:false,text:'',icon:false,tooltip:false,title:false,action:function(){},close:true,visible:true,keyTrigger:function(evt){return false;}}
const init=function(opts){if(opts.hasOwnProperty('options')){defOptions.$deepExtend(opts.options);}
if(opts.hasOwnProperty('buttons')){defBtnOptions.$deepExtend(opts.buttons);}}
const read=function(prop){return(typeof prop==='function')?prop():prop;}
const readClass=function(prop,extraClass){let classNames=read(prop);if(!classNames&&!extraClass){return false;}
if(!classNames){classNames=[];}
if(!Array.isArray(classNames)){classNames=classNames.split(' ');}
classNames.push(extraClass);return classNames;}
const readContent=function(prop){let $content=read(prop);if(!$content){return false;}
if(!($content instanceof Element)){$content=Html.create.P().$replaceHtml($content);}
return $content;}
const readSelector=function(prop){let $content=read(prop);if(!$content){return false;}
if(!($content instanceof Element)){$content=document.querySelector($content);}
return $content;}
var dialogId=0;const dialogs={};const openedDialogs=(function(){const list=[];return{empty:function(){return list.length==0;},register:function(dialogId,$target){this.unregister(dialogId);list.push(dialogId);(function(){if(!$target.jsDialogs){$target.jsDialogs=true;$target.$jsDialogScrollable=$target.closest('.scrollable, .disabledScrollable');if($target.$jsDialogScrollable!=null){$target.$jsDialogScrollable.jsDialogsCount=$target.$jsDialogScrollable.jsDialogsCount||0;}}
if($target.$jsDialogScrollable!=null){$target.$jsDialogScrollable.$clAdd('disabledScrollable');$target.$jsDialogScrollable.$clRemove('scrollable');$target.$jsDialogScrollable.jsDialogsCount++;}})();},unregister:function(dialogId,$target){const index=list.indexOf(dialogId);if(index>-1){list.splice(index,1);}
(function(){if(!!$target){if($target.$jsDialogScrollable!=null){$target.$jsDialogScrollable.jsDialogsCount--;if($target.$jsDialogScrollable.jsDialogsCount==0){$target.$jsDialogScrollable.$clAdd('scrollable');$target.$jsDialogScrollable.$clRemove('disabledScrollable');}}}})();},last:function(){return this.empty()?undefined:list[list.length-1];},lastDialog:function(){return dialogs[this.last()];},fixScrollableHeight:function(){list.$each(function(dialogId){dialogs[dialogId].options.fixScrollableHeight();});},}})();Events.onKeydown(document,function(evt){if(!openedDialogs.empty()){var lastOpened=openedDialogs.lastDialog();if(evt.keyCode==27){if(lastOpened.options.keyClose){return lastOpened.options.keyClose(evt);}}
if(lastOpened.buttons.$each(function(btn){if(btn.keyTrigger(evt)){btn.$node.$trigger('click');}}));}});window.$on('resize',function(){openedDialogs.fixScrollableHeight();});const createDialog=function(options,buttons){const doCallbackAction=function(action){if(!!action){return action(options,buttons)!=false;}
return true;}
const close=function(evt){evt.stopImmediatePropagation();evt.preventDefault();options.closeDialog(read(options.doOnClose));return false;}
options.dialogId=++dialogId;options.nodes={};options.nodes.$dialog=Html.create.DIV({id:read(options.id),'class':readClass(options.class,'js-dialog')});options.style.$each(function(value,style){options.nodes.$dialog.style[style]=value;})
options.nodes.$dialogWrapper=Html.create.DIV({'class':'js-dialog-wrapper'}).$replaceHtml(options.nodes.$dialog);if(!!read(options.modal)){options.nodes.$dialogWrapper.$prepend(options.nodes.$dialogWrapperModal=Html.create.DIV({'class':'js-dialog-wrapper-modal'}));if(!!read(options.wrapperCloseable)){options.nodes.$dialogWrapperModal.onclick=close;}}
const $target=readSelector(options.target);options.openDialog=function(){if(doCallbackAction(options.beforeOpen)){openedDialogs.register(options.dialogId,$target);options.appendNode($target,options.nodes.$dialogWrapper);doCallbackAction(options.afterOpen);options.fixScrollableHeight();}}
options.closeDialog=function(closeAction){if(doCallbackAction(options.beforeClose)){options.detachNode($target,options.nodes.$dialogWrapper);openedDialogs.unregister(options.dialogId,$target);doCallbackAction(closeAction);doCallbackAction(options.afterClose);if(!!read(options.destroyAfterClose)){options.nodes.$dialogWrapper.remove();}}}
const openOn=read(options.openOn);if(!!openOn){document.$on(openOn,function(){options.openDialog();});}
const closeOn=read(options.closeOn);if(!!closeOn){document.$on(closeOn,function(){options.closeDialog(read(options.doOnCloseOn));});}
const visibleButtons=buttons.$filter(function(btn){return read(btn.visible)});visibleButtons.$each(function(btn){const $fromElement=readSelector(btn.fromElement);if($fromElement){btn.action=btn.action||$fromElement.onclick;btn.$node=$fromElement;if(!!btn.$node.parentNode){btn.$node.$detach();}
btn.$node.$clRemove('hidden');btn.$node.$clRemove('hiddenImportant');if(read(!btn.custom)){btn.$node.$clAdd('js-dialog-button');if(!(read(btn.text)===false)){btn.$node.$clAdd('js-dialog-button-text');}
if(!(read(btn.icon)===false)){btn.$node.$clAdd('js-dialog-button-image');}}}else{btn.$node=Html.create.BUTTON({id:read(btn.id),'class':readClass(btn.class,'js-dialog-button')});const icon=read(btn.icon);if(!!icon){Components.SvgImage.append(btn.$node,icon)
btn.$node.$clAdd('js-dialog-button-image');}
const text=read(btn.text);if(!!text){btn.$node.$append(Html.create.SPAN({'class':'text'}).$replaceHtml(text));btn.$node.$clAdd('js-dialog-button-text');}
const tooltip=read(btn.tooltip);if(!!tooltip){btn.$node.setAttribute('title',tooltip);}}
Events.onClick(btn.$node,function(){if(!!read(btn.close)){options.closeDialog(btn.action);}else{doCallbackAction(btn.action);}});});const title=read(options.title);const titleButtons=visibleButtons.$filter(function(btn){return read(btn.title);});const closeable=!!read(options.closeable);if(!!title||titleButtons.length||closeable){options.nodes.$dialog.$append(options.nodes.$title=Html.create.DIV({'class':'js-dialog-title'}));if(!!title){options.nodes.$title.$append(options.nodes.$titleText=Html.create.SPAN({'class':'js-dialog-title-text'}).$replaceHtml(title));}
if(closeable){const $close=Components.SvgImage.append(Html.create.BUTTON({'class':'js-dialog-title-close',attrs:{}}),'#iconContainer #dialogClose svg');options.nodes.$title.$append($close);options.nodes.$title.$clAdd('closeable');Events.onClick($close,close);options.keyClose=close;}
if(titleButtons.length){const $titleBtns=Html.create.DIV({'class':'js-dialog-title-buttons'});titleButtons.$each(function(btn){$titleBtns.$prepend(btn.$node);});options.nodes.$title.$append($titleBtns);}}
const basicButtons=visibleButtons.$filter(function(btn){return!read(btn.title);});if(basicButtons.length||read(options.appendEmptyButtons)){options.nodes.$dialog.$append(options.nodes.$dialogButtons=Html.create.DIV({'class':'js-dialog-buttons'}));if(!basicButtons.length){options.nodes.$dialogButtons.$clAdd('hidden');}
basicButtons.$each(function(btn){options.nodes.$dialogButtons.$prepend(btn.$node);});}
const $content=readContent(options.content);if(!!$content){options.nodes.$dialog.$append(options.nodes.$contentWrapper=Html.create.DIV({'class':'js-dialog-content-wrapper'}));options.nodes.$contentWrapper.$append(Html.create.DIV({'class':'js-dialog-content'}).$append($content));}
options.fixScrollableHeight=function(){if(options.nodes.$contentWrapper){let wrapper=options.nodes.$dialogWrapper.getBoundingClientRect().height;let title=options.nodes.$title?options.nodes.$title.getBoundingClientRect().height:0;let buttons=options.nodes.$dialogButtons?options.nodes.$dialogButtons.getBoundingClientRect().height:0;let margin=document.body.getBoundingClientRect().width>=768?20:0;options.nodes.$contentWrapper.style.maxHeight=(wrapper-title-buttons-margin)+'px';}}
return dialogs[options.dialogId]={options:options,buttons:buttons};}
function fillOpts(opts){if(!opts.hasOwnProperty('options')){opts.options={};}
if(!opts.hasOwnProperty('buttons')){opts.buttons=[];}}
function get(opts){fillOpts(opts)
return createDialog(Tools.deepExtend(true,defOptions,opts.options),opts.buttons.$map(function(button){return Tools.deepExtend(true,defBtnOptions,button);}),opts);}
function show(opts){let initOpts=get(opts);initOpts.options.openDialog();return initOpts;}
return{init:init,get:get,show:show,test:function(){Components.Dialog.show({options:{title:'Title',content:'Content Text Here!'},buttons:[{text:'Text Only'},{icon:'#iconContainer #dialogClose svg'},{icon:'#iconContainer #dialogClose svg',text:'Icon Text'},{title:true,text:'Text Only'},{title:true,icon:'#iconContainer #dialogClose svg'},{title:true,icon:'#iconContainer #dialogClose svg',text:'Icon Text'},]});}};})();const Tooltip=(function(){const DELAY_SHOW=100;const DELAY_HIDE=50;const CLAZZ='js-tooltip';const CLAZZ_DIV=CLAZZ+'-div';const $ttElements=document.getElementsByClassName(CLAZZ);function fixPosition($ttNode){var $tt=$ttNode.$origin;var pos=$tt.getBoundingClientRect();var div=$ttNode.getBoundingClientRect();$ttNode.style.left=Number(pos.left)+'px';$ttNode.style.top=Number(pos.top-(div.height+10))+'px';}
function fixAllVisible(){$ttElements.$each(function($tt){if($tt.tooltip&&$tt.tooltip.visible){fixPosition($tt.tooltip.$node);var visible;if($tt.isPartOf('.dataTables_wrapper')){visible=Tools.elementViewport($tt.closest('td'),$tt.closest('.scroller')).fullyIn();}else if($tt.isPartOf('.content-wrapper.scrollable')){visible=Tools.elementViewport($tt,$tt.closest('.content-wrapper.scrollable')).fullyIn();}else{visible=true;}
$tt.tooltip.$node.$clToggleWhen(!visible,'hidden');}})}
Events.on(window,'resize',fixAllVisible);Events.on(document,'scroll',fixAllVisible,true);function clearTooltipTimeout(tooltip,timeout){if(tooltip[timeout]){clearTimeout(tooltip[timeout]);tooltip[timeout]=false;}}
function clearHideTimeout($tt){clearTooltipTimeout($tt.tooltip,'timeoutHide',true);}
function clearShowTimeout($tt){clearTooltipTimeout($tt.tooltip,'timeoutShow',true);}
function clearTooltipTimeouts($tt){clearShowTimeout($tt);clearHideTimeout($tt);}
function hideAllExcept($tt){$ttElements.$each(function($anyTT){if($tt&&$anyTT.isPartOf($tt)){return;}
hideNow();});}
function hasFocus($tt){return document.activeElement&&document.activeElement.isPartOf($tt);}
function showNow($tt){if($tt.tooltip){clearTooltipTimeouts($tt);if(!$tt.tooltip.visible){$tt.tooltip.visible=true;document.body.$append($tt.tooltip.$node);fixPosition($tt.tooltip.$node);}}}
function hideNow($tt,force){if($tt.tooltip){clearTooltipTimeouts($tt);if(!force&&hasFocus($tt)){}else if($tt.tooltip.visible){$tt.tooltip.visible=false;$tt.tooltip.$node.$detach();}}}
function show($tt){clearHideTimeout($tt);if(!$tt.tooltip.visible){$tt.tooltip.timeoutShow=setTimeout(function(){showNow($tt);},DELAY_SHOW);}}
function hide($tt){clearShowTimeout($tt);if($tt.tooltip.visible){$tt.tooltip.timeoutHide=setTimeout(function(){hideNow($tt);},DELAY_HIDE);}}
function register($tt){if(!$tt.tooltip){$tt.tooltip={}
$tt.tooltip.$node=Html.create.DIV({'class':CLAZZ_DIV}).$replaceHtml($tt.getAttribute('title'));$tt.tooltip.$node.$origin=$tt;$tt.tooltip.$node.style.backgroundColor="#fff";$tt.tooltip.$node.style.color="#333";$tt.tooltip.$node.style.border="1px solid";$tt.tooltip.$node.style.borderColor="#333";$tt.tooltip.$node.style.borderRadius="3px";$tt.tooltip.$node.style.padding="5px";$tt.tooltip.$node.style.position="fixed";$tt.tooltip.$node.style.zIndex="101";$tt.removeAttribute('title');Events.onMouseEnter($tt,function(){show($tt);},true);Events.onFocus($tt,function(){showNow($tt);},true);Events.onBlur($tt,function(){hideNow($tt);});Events.onMouseLeave($tt,function(){hide($tt);},true);setTimeout(function(){if(hasFocus($tt)){showNow($tt);}},DELAY_SHOW);}}
function unregister($tt){if($tt.tooltip){hideNow($tt,true);}}
Events.onDocReady(function(){$ttElements.$each(register);new MutationObserver(function(mutationsList,observer){mutationsList.$each(function(mutation){if(mutation.type==='childList'){mutation.addedNodes.$each(function($added){if($added.querySelectorAll){$added.querySelectorAll('.'+CLAZZ).$each(register);}});mutation.removedNodes.$each(function($removed){if($removed.querySelectorAll){$removed.querySelectorAll('.'+CLAZZ).$each(unregister);}});}});}).observe(document.body,{childList:true,subtree:true});});})();return{SvgImage:SvgImage,Toast:Toast,Dialog:Dialog}})();Events.onDocReady(function(){if(/iPad/.test(navigator.userAgent)||/iPhone/.test(navigator.userAgent)){document.querySelectorAll("*").$each(function(el){el.onmouseover=function(){return false;};});document.querySelector('body').$clAdd('iOS');}else if(/Android/.test(navigator.userAgent)){document.querySelector('body').$clAdd('Android');}});var doWithDelay_callTime=new Array();var doWithDelay_timeout=new Array();function doWithDelay(settings){if(doWithDelay_timeout[settings.listenerId]==undefined){doWithDelay_timeout[settings.listenerId]=false;}
doWithDelay_callTime[settings.listenerId]=new Date();if(doWithDelay_timeout[settings.listenerId]===false){doWithDelay_timeout[settings.listenerId]=true;setTimeout(function(){doWithDelayEnd(settings);},settings.delta);}}
function doWithDelayEnd(settings){if(new Date()-doWithDelay_callTime[settings.listenerId]<settings.delta){setTimeout(function(){doWithDelayEnd(settings);},settings.delta);}else{doWithDelay_timeout[settings.listenerId]=false;settings.onDone();}}
function isTextSelected(input){var startPos=input.selectionStart;var endPos=input.selectionEnd;var doc=document.selection;if(doc&&doc.createRange().text.length!=0){return true;}else if(!doc&&input.value.substring(startPos,endPos).length!=0){return true;}
return false;}
function showMessage($message,canHide){$message.onclick=canHide?function(){this.$fadeOut(500,{opacityShow:window.getComputedStyle(this).opacity});}:undefined;$message.$fadeIn();if(canHide){$message.$fadeOut(5000);}}
function showToastMessage(text){var $toast=document.body.querySelector('.toastMessage');if($toast==null){$toast=Html.create.DIV({clazz:'toastMessage'}).$append(Html.create.DIV({clazz:'text'}));document.body.$append($toast);}
$toast.firstElementChild.$replaceHtml(text);showMessage($toast,true);}
function utf8_to_b64(str){return window.btoa(unescape(encodeURIComponent(str)));}
function b64_to_utf8(str){return decodeURIComponent(escape(window.atob(str)));}
function cutBase64Prefix(base64Data){return base64Data.substr(base64Data.indexOf(',')+1);}
function base64toBlob(base64Data,contentType){base64Data=cutBase64Prefix(base64Data);contentType=contentType||'';var sliceSize=1024;var byteCharacters=atob(base64Data);var bytesLength=byteCharacters.length;var slicesCount=Math.ceil(bytesLength/sliceSize);var byteArrays=new Array(slicesCount);for(var sliceIndex=0;sliceIndex<slicesCount;++sliceIndex){var begin=sliceIndex*sliceSize;var end=Math.min(begin+sliceSize,bytesLength);var bytes=new Array(end-begin);for(var offset=begin,i=0;offset<end;++i,++offset){bytes[i]=byteCharacters[offset].charCodeAt(0);}
byteArrays[sliceIndex]=new Uint8Array(bytes);}
return new Blob(byteArrays,{type:contentType});}
function base64toBlobFile(base64Data,contentType){base64Data=cutBase64Prefix(base64Data);return URL.createObjectURL(base64toBlob(base64Data,contentType));}
function loadModules(modul,nameClass){var mods=document.querySelectorAll("."+modul);var animateModule=function(){mods.$each(function(el){if(Tools.elementViewport(el).partiallyIn()){el.$clAdd(nameClass);}});}
window.$on('scroll',animateModule);animateModule();}
function createSuccessErrorMessage(result,content,successMessage,errorMessage,prepend,allowHide){var oldMessage=document.querySelector(content+" .message")
if(!!oldMessage){oldMessage.remove();}
var $message=Html.create.DIV({clazz:(result?'successMessage':'errorMessage')+' message'});$message.$replaceHtml(result?successMessage:errorMessage)
if(prepend){document.querySelector(content).$prepend($message);}else{document.querySelector(content).$append($message);}
showMessage($message,allowHide);}
const LanguageFactory=(function(){const ALL_COUNT=3;const COUNT=4;const ALL_FROM=6;const FROM=7;const TO=8;const COUNT_PLUS=10;const DECIMAL=11;const OTHERS=12;const REPLACEMENT=13;const macro_parts_regexp_lazy_str="(((\\*){0,1}(\\d+)|((\\*){0,1}(\\d+)-(\\d+))|((\\d+)\\+)|([d])|(\\*)):(.*?))+";const macro_parts_regexp=/(((\*){0,1}(\d+)|((\*){0,1}(\d+)-(\d+))|((\d+)\+)|([d])|(\*)):(.*))+/;const translation_macro_regex=new RegExp("\\{[a-zA-Z0-9]+\\}->\\(("+macro_parts_regexp_lazy_str+";?)+\\)","g");function testCount(countStr,variableValue){var count=parseInt(countStr);if(variableValue===count){return true;}
return false;}
function testEndsCount(countStr,variableValue){let value=variableValue+"";countStr=countStr+"";let lastIndex=value.lastIndexOf(countStr);if(lastIndex+countStr.length===value.length){return true;}
return false;}
function testFromTo(fromStr,toStr,variableValue){let from=parseInt(fromStr);let to=parseInt(toStr);if(variableValue>=from&&variableValue<=to){return true;}
return false;}
function testEndsFromTo(fromStr,toStr,variableValue){let from=parseInt(fromStr);let to=parseInt(toStr);let value=variableValue;for(let i=from;i<=to;i++){let iStr=i;let lastIndex=value.lastIndexOf(iStr);if(lastIndex+iStr.length===value.length){return true;}}
return false;}
let replaceMacrosInTranslation=function(translation,variables){let matches=translation.match(translation_macro_regex);let replacementMap={};if(matches){matches.forEach(function(e,i){let split=e.split("->");let variableKey=split[0].substring(1,split[0].length-1);let macro=split[1].substring(1,split[1].length-1);let macroSplit=macro.split(";");var variableValue=-1;VARIABLES=variables;if(variables.hasOwnProperty(variableKey)){variableValue=variables[variableKey];}else{console.error("Error during translatig macro, bad variable value for variable "+variableKey);}
for(let i=0;i<macroSplit.length;i++){let macroMatches=macroSplit[i].match(macro_parts_regexp);let allCount=macroMatches[ALL_COUNT];let allFrom=macroMatches[ALL_FROM];let others=macroMatches[OTHERS];let countStr=macroMatches[COUNT];let fromStr=macroMatches[FROM];let toStr=macroMatches[TO];let count_plusStr=macroMatches[COUNT_PLUS];let replacementStr=macroMatches[REPLACEMENT];let count_plus;if(countStr){if(!allCount&&testCount(countStr,variableValue)){replacementMap[e]=replacementStr;}else if(allCount&&allCount=="*"&&testEndsCount(countStr,variableValue)){replacementMap[e]=replacementStr;}}else if(fromStr&&toStr){if(!allFrom&&testFromTo(fromStr,toStr,variableValue)){replacementMap[e]=replacementStr;}else if(allFrom&&allFrom=="*"&&testEndsFromTo(fromStr,toStr,variableValue)){replacementMap[e]=replacementStr;}}else if(count_plusStr){count_plus=parseInt(count_plusStr);if(variableValue>=count_plus){replacementMap[e]=replacementStr;}}else if(others&&others=="*"){replacementMap[e]=replacementStr;}}});}
for(let key in replacementMap){if(replacementMap.hasOwnProperty(key)){translation=translation.replace(key,replacementMap[key]);}}
for(let variableName in variables){if(variables.hasOwnProperty(variableName)){translation=translation.replace("{"+variableName+"}",variables[variableName]);}}
return translation;}
return{replaceMacrosInTranslation:replaceMacrosInTranslation,localisedWithVariables:{}}})();