(function($,F){ window.console=window.console||{log:function(){},error:function(){}};$.fn.footable=function(options,ready){options=options||{}; return this.filter('table').each(function(i,tbl){var ft=F.get(tbl);if(ft instanceof F.Table)ft.destroy();F.init(tbl,options,ready);});};var debug_defaults={events:[]};F.__debug__=JSON.parse(localStorage.getItem('footable_debug'))||false;F.__debug_options__=JSON.parse(localStorage.getItem('footable_debug_options'))||debug_defaults;F.debug=function(value,options){if(!F.is.boolean(value))return F.__debug__;F.__debug__=value;if(F.__debug__){localStorage.setItem('footable_debug',JSON.stringify(F.__debug__));F.__debug_options__=$.extend(true,{},debug_defaults,options||{});if(F.is.hash(options)){localStorage.setItem('footable_debug_options',JSON.stringify(F.__debug_options__));}}else{localStorage.removeItem('footable_debug');localStorage.removeItem('footable_debug_options');}};F.get=function(table){return $(table).first().data('__FooTable__');};F.init=function(table,options,ready){return new F.Table(table,options,ready);};      })(jQuery,FooTable=window.FooTable||{});(function(F){var returnTrue=function(){return true;};F.arr={};F.arr.each=function(array,func){if(!F.is.array(array)||!F.is.fn(func))return;for(var i=0,len=array.length;i<len;i++){if(func(array[i],i)===false)break;}};F.arr.get=function(array,where){var result=[];if(!F.is.array(array))return result;if(!F.is.fn(where))return array;for(var i=0,len=array.length;i<len;i++){if(where(array[i],i))result.push(array[i]);}
return result;};F.arr.any=function(array,where){if(!F.is.array(array))return false;where=F.is.fn(where)?where:returnTrue;for(var i=0,len=array.length;i<len;i++){if(where(array[i],i))return true;}
return false;};F.arr.contains=function(array,value){if(!F.is.array(array)||F.is.undef(value))return false;for(var i=0,len=array.length;i<len;i++){if(array[i]==value)return true;}
return false;};F.arr.first=function(array,where){if(!F.is.array(array))return null;where=F.is.fn(where)?where:returnTrue;for(var i=0,len=array.length;i<len;i++){if(where(array[i],i))return array[i];}
return null;};F.arr.map=function(array,getter){var result=[],returned=null;if(!F.is.array(array)||!F.is.fn(getter))return result;for(var i=0,len=array.length;i<len;i++){if((returned=getter(array[i],i))!=null)result.push(returned);}
return result;};F.arr.remove=function(array,where){var remove=[],removed=[];if(!F.is.array(array)||!F.is.fn(where))return removed;var i=0,len=array.length;for(;i<len;i++){if(where(array[i],i,removed)){remove.push(i);removed.push(array[i]);}} 
remove.sort(function(a,b){return b-a;});i=0;len=remove.length;for(;i<len;i++){var index=remove[i]-i;array.splice(index,1);}
return removed;};})(FooTable);(function(F){F.is={};F.is.type=function(value,type){return typeof value===type;};F.is.defined=function(value){return typeof value!=='undefined';};F.is.undef=function(value){return typeof value==='undefined';};F.is.array=function(value){return'[object Array]'===Object.prototype.toString.call(value);};F.is.date=function(value){return'[object Date]'===Object.prototype.toString.call(value)&&!isNaN(value.getTime());};F.is.boolean=function(value){return'[object Boolean]'===Object.prototype.toString.call(value);};F.is.string=function(value){return'[object String]'===Object.prototype.toString.call(value);};F.is.number=function(value){return'[object Number]'===Object.prototype.toString.call(value);};F.is.fn=function(value){return(F.is.defined(window)&&value===window.alert)||'[object Function]'===Object.prototype.toString.call(value);};F.is.error=function(value){return'[object Error]'===Object.prototype.toString.call(value);};F.is.object=function(value){return'[object Object]'===Object.prototype.toString.call(value);};F.is.hash=function(value){return F.is.object(value)&&value.constructor===Object&&!value.nodeType&&!value.setInterval;};F.is.element=function(obj){return typeof HTMLElement==='object'?obj instanceof HTMLElement:obj&&typeof obj==='object'&&obj!==null&&obj.nodeType===1&&typeof obj.nodeName==='string';};F.is.promise=function(obj){return F.is.object(obj)&&F.is.fn(obj.then)&&F.is.fn(obj.promise);};F.is.jq=function(obj){return F.is.defined(jQuery)&&obj instanceof jQuery&&obj.length>0;};F.is.emptyObject=function(value){if(!F.is.hash(value))return false;for(var prop in value){if(value.hasOwnProperty(prop))
return false;}
return true;};F.is.emptyArray=function(value){return F.is.array(value)?value.length===0:true;};F.is.emptyString=function(value){return F.is.string(value)?value.length===0:true;};})(FooTable);(function(F){F.str={};F.str.contains=function(str,contains,ignoreCase){return!F.is.emptyString(str)&&!F.is.emptyString(contains)&&contains.length<=str.length&&(ignoreCase?str.toUpperCase().indexOf(contains.toUpperCase()):str.indexOf(contains))!==-1;};F.str.containsWord=function(str,word,ignoreCase){if(F.is.emptyString(str)||F.is.emptyString(word)||str.length<word.length)
return false;var parts=str.split(/\W/);for(var i=0,len=parts.length;i<len;i++){if(ignoreCase?parts[i].toUpperCase()==word.toUpperCase():parts[i]==word)return true;}
return false;};F.str.from=function(str,from){return this.contains(str,from)?str.substring(str.indexOf(from)+1):str;};F.str.startsWith=function(str,prefix){return str.slice(0,prefix.length)==prefix;};F.str.toCamelCase=function(str){if(str.toUpperCase()===str)return str.toLowerCase();return str.replace(/^([A-Z])|[-\s_](\w)/g,function(match,p1,p2){if(p2)return p2.toUpperCase();return p1.toLowerCase();});};})(FooTable);(function(F){"use strict";if(!Object.create){Object.create=(function(){var Object=function(){};return function(prototype){if(arguments.length>1)
throw Error('Second argument not supported');if(!F.is.object(prototype))
throw TypeError('Argument must be an object');Object.prototype=prototype;var result=new Object();Object.prototype=null;return result;};})();}
function Class(){}
var __extendable__=/xyz/.test(function(){xyz;})?/\b_super\b/:/.*/;
 Class.__extend__=function(proto,name,func,original){proto[name]=F.is.fn(original)&&__extendable__.test(func)?(function(name,fn){return function(){var tmp,ret;tmp=this._super;this._super=original;ret=fn.apply(this,arguments);this._super=tmp;return ret;};})(name,func):func;};Class.extend=function(arg1,arg2){var args=Array.prototype.slice.call(arguments);arg1=args.shift();arg2=args.shift();function __extend__(proto,name,func,original){proto[name]=F.is.fn(original)&&__extendable__.test(func)?(function(name,fn,ofn){return function(){var tmp,ret;tmp=this._super;this._super=ofn;ret=fn.apply(this,arguments);this._super=tmp;return ret;};})(name,func,original):func;}
if(F.is.hash(arg1)){var proto=Object.create(this.prototype),_super=this.prototype;for(var name in arg1){if(name==='__ctor__')continue;__extend__(proto,name,arg1[name],_super[name]);}
var obj=F.is.fn(proto.__ctor__)?proto.__ctor__:function(){if(!F.is.fn(this.construct))
throw new SyntaxError('FooTable class objects must be constructed with the "new" keyword.');this.construct.apply(this,arguments);};proto.construct=F.is.fn(proto.construct)?proto.construct:function(){};obj.prototype=proto;proto.constructor=obj;obj.extend=Class.extend;return obj;}else if(F.is.string(arg1)&&F.is.fn(arg2)){__extend__(this.prototype,arg1,arg2,this.prototype[arg1]);}};F.Class=Class;F.ClassFactory=F.Class.extend({construct:function(){this.registered={};},contains:function(name){return F.is.defined(this.registered[name]);},register:function(name,klass,priority){if(!F.is.string(name)||!F.is.fn(klass))return;var current=this.registered[name];this.registered[name]={name:name,klass:klass,priority:F.is.number(priority)?priority:(F.is.defined(current)?current.priority:0)};},load:function(arg1,argN){var self=this,args=Array.prototype.slice.call(arguments),reg=[],loaded=[];for(var name in self.registered){if(!self.registered.hasOwnProperty(name))continue;reg.push(self.registered[name]);}
reg.sort(function(a,b){return b.priority-a.priority;});F.arr.each(reg,function(r){if(F.is.fn(r.klass)){loaded.push(self._make(r.klass,args));}});return loaded;},make:function(name,arg1,argN){var self=this,args=Array.prototype.slice.call(arguments),reg;name=args.shift();reg=self.registered[name];if(F.is.fn(reg.klass)){return self._make(reg.klass,args);}
return null;},_make:function(klass,args){function Class(){return klass.apply(this,args);}
Class.prototype=klass.prototype;return new Class();}});})(FooTable);(function($,F){F.css2json=function(cssText){if(F.is.emptyString(cssText))return{};var json={},props=cssText.split(';'),pair,key,value;for(var i=0,i_len=props.length;i<i_len;i++){pair=props[i].split(':');key=F.str.toCamelCase($.trim(pair[0]));value=$.trim(pair[1]);json[key]=value;}
return json;};F.getFnPointer=function(functionName){if(F.is.emptyString(functionName))return null;if(F.is.fn(window[functionName]))return window[functionName];return null;};F.checkFnValue=function(self,value,def){def=F.is.fn(def)?def:null;function wrap(t,fn,d){if(!F.is.fn(fn))return d;return function(){return fn.apply(t,arguments);};}
return F.is.fn(value)?wrap(self,value,def):(F.is.type(value,'string')?wrap(self,F.getFnPointer(value),def):def);};})(jQuery,FooTable);(function($,F){F.Cell=F.Class.extend({construct:function(table,row,column,valueOrElement){this.ft=table;this.row=row;this.column=column;this.created=false;this.define(valueOrElement);},define:function(valueOrElement){this.$el=F.is.element(valueOrElement)||F.is.jq(valueOrElement)?$(valueOrElement):null;this.$detail=null;var hasOptions=F.is.hash(valueOrElement)&&F.is.hash(valueOrElement.options)&&F.is.defined(valueOrElement.value);this.value=this.column.parser.call(this.column,F.is.jq(this.$el)?this.$el:(hasOptions?valueOrElement.value:valueOrElement),this.ft.o);this.o=$.extend(true,{classes:null,style:null},hasOptions?valueOrElement.options:{});this.classes=F.is.jq(this.$el)&&this.$el.attr('class')?this.$el.attr('class').split(/\S+/g):(F.is.array(this.o.classes)?this.o.classes:(F.is.string(this.o.classes)?this.o.classes.split(/\S+/g):[]));this.style=F.is.jq(this.$el)&&this.$el.attr('style')?F.css2json(this.$el.attr('style')):(F.is.hash(this.o.style)?this.o.style:(F.is.string(this.o.style)?F.css2json(this.o.style):{}));},$create:function(){if(this.created)return;(this.$el=F.is.jq(this.$el)?this.$el:$('<td/>')).data('value',this.value).contents().detach().end().append(this.format(this.value));this._setClasses(this.$el);this._setStyle(this.$el);this.$detail=$('<tr/>').addClass(this.row.classes.join(' ')).data('__FooTableCell__',this).append($('<th/>',{text:this.column.title})).append($('<td/>'));this.created=true;},collapse:function(){if(!this.created)return;this.$detail.children('td').first().attr('class',this.$el.attr('class')).attr('style',this.$el.attr('style')).css('display','table-cell').append(this.$el.contents().detach());if(!F.is.jq(this.$detail.parent()))
this.$detail.appendTo(this.row.$details.find('.footable-details > tbody'));},restore:function(){if(!this.created)return;if(F.is.jq(this.$detail.parent())){var $cell=this.$detail.children('td').first();this.$el.attr('class',$cell.attr('class')).attr('style',$cell.attr('style')).css('display',(this.column.hidden||!this.column.visible)?'none':'table-cell').append($cell.contents().detach());}
this.$detail.detach();},parse:function(){return this.column.parser.call(this.column,this.$el,this.ft.o);},format:function(value){return this.column.formatter.call(this.column,value,this.ft.o);},val:function(value,redraw){if(F.is.undef(value)){ return this.value;} 
var self=this,hasOptions=F.is.hash(value)&&F.is.hash(value.options)&&F.is.defined(value.value);this.o=$.extend(true,{classes:self.classes,style:self.style},hasOptions?value.options:{});this.value=hasOptions?value.value:value;this.classes=F.is.array(this.o.classes)?this.o.classes:(F.is.string(this.o.classes)?this.o.classes.split(/\S+/g):[]);this.style=F.is.hash(this.o.style)?this.o.style:(F.is.string(this.o.style)?F.css2json(this.o.style):{});if(this.created){this.$el.data('value',this.value).empty();var $detail=this.$detail.children('td').first().empty(),$target=F.is.jq(this.$detail.parent())?$detail:this.$el;$target.append(this.format(this.value));this._setClasses($target);this._setStyle($target);if(F.is.boolean(redraw)?redraw:true)this.row.draw();}},_setClasses:function($el){var hasColClasses=!F.is.emptyArray(this.column.classes),hasClasses=!F.is.emptyArray(this.classes),classes=null;$el.removeAttr('class');if(!hasColClasses&&!hasClasses)return;if(hasColClasses&&hasClasses){classes=this.classes.concat(this.column.classes).join(' ');}else if(hasColClasses){classes=this.column.classes.join(' ');}else if(hasClasses){classes=this.classes.join(' ');}
if(!F.is.emptyString(classes)){$el.addClass(classes);}},_setStyle:function($el){var hasColStyle=!F.is.emptyObject(this.column.style),hasStyle=!F.is.emptyObject(this.style),style=null;$el.removeAttr('style');if(!hasColStyle&&!hasStyle)return;if(hasColStyle&&hasStyle){style=$.extend({},this.column.style,this.style);}else if(hasColStyle){style=this.column.style;}else if(hasStyle){style=this.style;}
if(F.is.hash(style)){$el.css(style);}}});})(jQuery,FooTable);(function($,F){F.Column=F.Class.extend({construct:function(instance,definition){this.ft=instance;this.type='text';this.virtual=F.is.boolean(definition.virtual)?definition.virtual:false;this.$el=F.is.jq(definition.$el)?definition.$el:null;this.index=F.is.number(definition.index)?definition.index:-1;this.define(definition);this.$create();},define:function(definition){this.hidden=F.is.boolean(definition.hidden)?definition.hidden:false;this.visible=F.is.boolean(definition.visible)?definition.visible:true;this.name=F.is.string(definition.name)?definition.name:null;if(this.name==null)this.name='col'+(definition.index+1);this.title=F.is.string(definition.title)?definition.title:null;if(!this.virtual&&this.title==null&&F.is.jq(this.$el))this.title=this.$el.html();if(this.title==null)this.title='Column '+(definition.index+1);this.style=F.is.hash(definition.style)?definition.style:(F.is.string(definition.style)?F.css2json(definition.style):{});this.classes=F.is.array(definition.classes)?definition.classes:(F.is.string(definition.classes)?definition.classes.split(/\S+/g):[]);this.parser=F.checkFnValue(this,definition.parser,this.parser);this.formatter=F.checkFnValue(this,definition.formatter,this.formatter);},$create:function(){(this.$el=!this.virtual&&F.is.jq(this.$el)?this.$el:$('<th/>')).html(this.title);},parser:function(valueOrElement){if(F.is.jq(valueOrElement))return valueOrElement.data('value')||valueOrElement.text(); if(F.is.defined(valueOrElement)&&valueOrElement!=null)return valueOrElement+''; return null;},formatter:function(value){return value==null?'':value;},createCell:function(row){var element=F.is.jq(row.$el)?row.$el.children('td,th').get(this.index):null,data=F.is.hash(row.value)?row.value[this.name]:null;return new F.Cell(this.ft,row,this,element||data);}});F.columns=new F.ClassFactory();})(jQuery,FooTable);(function($,F){F.Defaults=function(){this.stopPropagation=false;this.on=null;};F.defaults=new F.Defaults();})(jQuery,FooTable);(function($,F){F.Row=F.Class.extend({construct:function(table,columns,dataOrElement){this.ft=table;this.columns=columns;this.created=false;this.define(dataOrElement);},define:function(dataOrElement){this.$el=F.is.element(dataOrElement)||F.is.jq(dataOrElement)?$(dataOrElement):null;this.$toggle=$('<span/>',{'class':'footable-toggle fooicon fooicon-plus'});var isObj=F.is.hash(dataOrElement),hasOptions=isObj&&F.is.hash(dataOrElement.options)&&F.is.hash(dataOrElement.value);this.value=isObj?(hasOptions?dataOrElement.value:dataOrElement):null;this.o=$.extend(true,{expanded:false,classes:null,style:null},hasOptions?dataOrElement.options:{});this.expanded=F.is.jq(this.$el)?(this.$el.data('expanded')||this.o.expanded):this.o.expanded;this.classes=F.is.jq(this.$el)&&this.$el.attr('class')?this.$el.attr('class').split(/\S+/g):(F.is.array(this.o.classes)?this.o.classes:(F.is.string(this.o.classes)?this.o.classes.split(/\S+/g):[]));this.style=F.is.jq(this.$el)&&this.$el.attr('style')?F.css2json(this.$el.attr('style')):(F.is.hash(this.o.style)?this.o.style:(F.is.string(this.o.style)?F.css2json(this.o.style):{}));this.cells=this.createCells();if(!F.is.hash(this.value)||F.is.emptyObject(this.value)){var val={};F.arr.each(self.cells,function(cell){val[cell.column.name]=cell.val();});this.value=val;}},$create:function(){if(this.created)return;(this.$el=F.is.jq(this.$el)?this.$el:$('<tr/>')).data('__FooTableRow__',this);this._setClasses(this.$el);this._setStyle(this.$el);if(this.ft.rows.toggleColumn=='last')this.$toggle.addClass('last-column');this.$details=$('<tr/>',{'class':'footable-detail-row'}).append($('<td/>',{colspan:this.ft.columns.visibleColspan}).append($('<table/>',{'class':'footable-details '+this.ft.classes.join(' ')}).append('<tbody/>')));var self=this;F.arr.each(self.cells,function(cell){if(!cell.created)cell.$create();self.$el.append(cell.$el);});self.$el.off('click.ft.row').on('click.ft.row',{self:self},self._onToggle);this.created=true;},createCells:function(){var self=this;return F.arr.map(self.columns,function(col){return col.createCell(self);});},val:function(data){if(!F.is.hash(data)){ return this.value;} 
this.collapse(false);var self=this,isObj=F.is.hash(data),hasOptions=isObj&&F.is.hash(data.options)&&F.is.hash(data.value);this.o=$.extend(true,{expanded:self.expanded,classes:self.classes,style:self.style},hasOptions?data.options:{});this.expanded=this.o.expanded;this.classes=F.is.array(this.o.classes)?this.o.classes:(F.is.string(this.o.classes)?this.o.classes.split(/\S+/g):[]);this.style=F.is.hash(this.o.style)?this.o.style:(F.is.string(this.o.style)?F.css2json(this.o.style):{});var value=hasOptions?data.value:data;F.arr.each(this.cells,function(cell){if(F.is.defined(value[cell.column.name]))cell.val(value[cell.column.name],false);});if(this.created){this._setClasses(this.$el);this._setStyle(this.$el);this.draw();}},_setClasses:function($el){var hasClasses=!F.is.emptyArray(this.classes),classes=null;$el.removeAttr('class');if(!hasClasses)return;else classes=this.classes.join(' ');if(!F.is.emptyString(classes)){$el.addClass(classes);}},_setStyle:function($el){var hasStyle=!F.is.emptyObject(this.style),style=null;$el.removeAttr('style');if(!hasStyle)return;else style=this.style;if(F.is.hash(style)){$el.css(style);}},expand:function(){if(!this.created)return;this.__hidden__=F.arr.map(this.cells,function(cell){return cell.column.hidden&&cell.column.visible?cell:null;});if(this.__hidden__.length>0){this.$details.insertAfter(this.$el).children('td').first().attr('colspan',this.ft.columns.visibleColspan);F.arr.each(this.__hidden__,function(cell){cell.collapse();});}
this.$el.attr('data-expanded',true);this.$toggle.removeClass('fooicon-plus').addClass('fooicon-minus');this.expanded=true;},collapse:function(setExpanded){if(!this.created)return;F.arr.each(this.__hidden__,function(cell){cell.restore();});this.$details.detach();this.$el.removeAttr('data-expanded');this.$toggle.removeClass('fooicon-minus').addClass('fooicon-plus');if(F.is.boolean(setExpanded)?setExpanded:true)this.expanded=false;},predraw:function(){if(this.created){if(this.expanded){this.collapse(false);}
this.$toggle.detach();this.$el.detach();}},draw:function($parent){if(!this.created)this.$create();$parent.append(this.$el);var self=this;F.arr.each(self.cells,function(cell){cell.$el.css('display',(cell.column.hidden||!cell.column.visible?'none':'table-cell'));if(self.ft.rows.showToggle&&self.ft.columns.hasHidden){if((self.ft.rows.toggleColumn=='first'&&cell.column.index==self.ft.columns.firstVisibleIndex)||(self.ft.rows.toggleColumn=='last'&&cell.column.index==self.ft.columns.lastVisibleIndex)){cell.$el.prepend(self.$toggle);}}});if(this.expanded){this.expand();}},toggle:function(){if(this.created&&this.ft.columns.hasHidden){if(this.expanded)this.collapse();else this.expand();}},_onToggle:function(e){var self=e.data.self; if($(e.target).is('tr,td,.footable-toggle')){self.toggle();}}});})(jQuery,FooTable);(function($,F){F.instances=[];F.Table=F.Class.extend({construct:function(element,options,ready){ this._resizeTimeout=null;this.id=F.instances.push(this);this.initialized=false;this.$el=(F.is.jq(element)?element:$(element)).first(); this.o=$.extend(true,{},F.defaults,options);this.classes=[];this.breakpoints=F.components.internal.make('breakpoints',this);this.columns=F.components.internal.make('columns',this);this.rows=F.components.internal.make('rows',this);this.components={internal:[this.breakpoints,this.columns,this.rows],core:F.components.core.load(this),custom:F.components.load(this)}; var self=this;self._preinit().then(function(){return self._init().then(function(){if(F.is.fn(ready))ready.call(self,self);});},function(err){if(F.is.error(err)){console.error('FooTable: unhandled error thrown during initialization.',err);}});},_preinit:function(){var self=this;return this.raise('preinit.ft.table').then(function(){var classes=self.$el.attr('class').match(/\S+/g),data=self.$el.data()||{};self.o.ajax=F.checkFnValue(self,data.ajax,self.o.ajax);self.o.stopPropagation=F.is.boolean(data.stopPropagation)?data.stopPropagation:self.o.stopPropagation;for(var i=0,len=classes.length;i<len;i++){if(!F.str.startsWith(classes[i],'footable'))self.classes.push(classes[i]);}
var $loader=$('<div/>',{'class':'footable-loader'}).append($('<span/>',{'class':'fooicon fooicon-loader'}));self.$el.hide().after($loader);return self.execute(false,false,'preinit',data).always(function(){self.$el.show();$loader.remove();});});},_init:function(){var self=this;return self.raise('init.ft.table').then(function(){var $thead=self.$el.children('thead'),$tbody=self.$el.children('tbody'),$tfoot=self.$el.children('tfoot');self.$el.addClass('footable footable-'+self.id);if(F.is.hash(self.o.on))self.$el.on(self.o.on);if($tfoot.length==0)self.$el.append($tfoot=$('<tfoot/>'));if($tbody.length==0)self.$el.append('<tbody/>');if($thead.length==0)self.$el.prepend($thead=$('<thead/>'));return self.execute(false,true,'init').then(function(){self.$el.data('__FooTable__',self);if($tfoot.children('tr').length==0)$tfoot.remove();if($thead.children('tr').length==0)$thead.remove();return self.draw().then(function(){$(window).off('resize.ft'+self.id,self._onWindowResize).on('resize.ft'+self.id,{self:self},self._onWindowResize);self.initialized=true;});});});},destroy:function(){var self=this;return self.raise('destroy.ft.table').then(function(){return self.execute(true,true,'destroy').then(function(){self.$el.removeData('__FooTable__');if(F.is.hash(self.o.on))self.$el.off(self.o.on);self.initialized=false;});},function(err){if(F.is.error(err)){console.error('FooTable: unhandled error thrown while destroying the plugin.',err);}});},raise:function(eventName,args){var self=this,debug=F.__debug__&&(F.is.emptyArray(F.__debug_options__.events)||F.arr.any(F.__debug_options__.events,function(name){return F.str.contains(eventName,name);}));args=args||[];args.unshift(this);return $.Deferred(function(d){var evt=$.Event(eventName);if(self.o.stopPropagation==true){self.$el.one(eventName,function(e){e.stopPropagation();});}
if(debug)console.log('FooTable:'+eventName+': ',args);self.$el.trigger(evt,args);if(evt.isDefaultPrevented()){if(debug)console.log('FooTable: default prevented for the "'+eventName+'" event.');d.reject(evt);}else d.resolve(evt);});},use:function(type){var components=this.components.internal.concat(this.components.core,this.components.custom);for(var i=0,len=components.length;i<len;i++){if(components[i]instanceof type)return components[i];}
return null;},draw:function(){var self=this;return self.execute(false,true,'predraw').then(function(){return self.raise('predraw.ft.table').then(function(){return self.execute(false,true,'draw').then(function(){return self.raise('draw.ft.table').then(function(){return self.execute(false,true,'postdraw').then(function(){self.raise('postdraw.ft.table');});});});});},function(err){if(F.is.error(err)){console.error('FooTable: unhandled error thrown during a draw operation.',err);}});},execute:function(reverse,enabled,methodName,param1,paramN){var self=this,args=Array.prototype.slice.call(arguments);reverse=args.shift();enabled=args.shift();var internal=self.components.internal.slice(0),core=enabled?F.arr.get(self.components.core,function(c){return c.enabled;}):self.components.core.slice(0),custom=enabled?F.arr.get(self.components.custom,function(c){return c.enabled;}):self.components.custom.slice(0);args.unshift(reverse?custom.reverse():internal);return self._execute.apply(self,args).then(function(){args.shift();args.unshift(reverse?core.reverse():core);return self._execute.apply(self,args).then(function(){args.shift();args.unshift(reverse?internal.reverse():custom);return self._execute.apply(self,args);});});},_execute:function(components,methodName,param1,paramN){if(!components||!components.length)return $.when();var self=this,args=Array.prototype.slice.call(arguments),component;components=args.shift();methodName=args.shift();component=components.shift();if(!F.is.fn(component[methodName]))
return self._execute.apply(self,[components,methodName].concat(args));return $.Deferred(function(d){try{var result=component[methodName].apply(component,args);if(F.is.promise(result)){return result.then(d.resolve,d.reject);}else{d.resolve(result);}}catch(err){d.reject(err);}}).then(function(){return self._execute.apply(self,[components,methodName].concat(args));});},_onWindowResize:function(e){var self=e.data.self;if(self._resizeTimeout!=null){clearTimeout(self._resizeTimeout);}
self._resizeTimeout=setTimeout(function(){self._resizeTimeout=null;self.raise('resize.ft.table').then(function(){self.breakpoints.check();});},300);}});})(jQuery,FooTable);(function($,F){if(F.is.undef(window.moment)){return;}
F.DateColumn=F.Column.extend({construct:function(instance,definition){this._super(instance,definition);this.type='date';this.formatString=F.is.string(definition.formatString)?definition.formatString:'MM-DD-YYYY';},parser:function(valueOrElement){if(F.is.jq(valueOrElement)){valueOrElement=valueOrElement.data('value')||valueOrElement.text();if(F.is.string(valueOrElement))valueOrElement=isNaN(valueOrElement)?valueOrElement:+valueOrElement;}
if(F.is.date(valueOrElement))return moment(valueOrElement);if(F.is.object(valueOrElement)&&F.is.boolean(valueOrElement._isAMomentObject))return valueOrElement;if(F.is.string(valueOrElement)){ if(isNaN(valueOrElement)){return moment(valueOrElement,this.formatString);}else{valueOrElement=+valueOrElement;}}
if(F.is.number(valueOrElement)){return moment(valueOrElement);}
return null;},formatter:function(value){return F.is.object(value)&&F.is.boolean(value._isAMomentObject)?value.format(this.formatString):'';},filterValue:function(valueOrElement){ if(F.is.element(valueOrElement)||F.is.jq(valueOrElement))valueOrElement=$(valueOrElement).data('filterValue')||$(valueOrElement).text(); if(F.is.hash(valueOrElement)&&F.is.hash(valueOrElement.options)){if(F.is.string(valueOrElement.options.filterValue))valueOrElement=valueOrElement.options.filterValue;if(F.is.defined(valueOrElement.value))valueOrElement=valueOrElement.value;} 
if(F.is.object(valueOrElement)&&F.is.boolean(valueOrElement._isAMomentObject))return valueOrElement.format(this.formatString); if(F.is.string(valueOrElement)){ if(isNaN(valueOrElement)){return valueOrElement;}else{ valueOrElement=+valueOrElement;}}
if(F.is.number(valueOrElement)||F.is.date(valueOrElement)){return moment(valueOrElement).format(this.formatString);} 
if(F.is.defined(valueOrElement)&&valueOrElement!=null)return valueOrElement+'';return''; }});F.columns.register('date',F.DateColumn);})(jQuery,FooTable);(function($,F){F.NumberColumn=F.Column.extend({construct:function(instance,definition){this._super(instance,definition);this.type='number';},parser:function(valueOrElement){if(F.is.jq(valueOrElement)){valueOrElement=valueOrElement.data('value')||valueOrElement.text().replace(/[^0-9.\-]/g,'');}
if(F.is.string(valueOrElement))valueOrElement=parseFloat(valueOrElement);if(F.is.number(valueOrElement))return valueOrElement;return null;}});F.columns.register('number',F.NumberColumn);})(jQuery,FooTable);(function($,F){F.Component=F.Class.extend({construct:function(instance,enabled){if(!(instance instanceof F.Table))
throw new TypeError('The instance parameter must be an instance of FooTable.Table.');this.ft=instance;this.enabled=F.is.boolean(enabled)?enabled:false;},preinit:null,init:null,destroy:null,predraw:null,draw:null,postdraw:null});F.components=new F.ClassFactory();F.components.core=new F.ClassFactory();F.components.internal=new F.ClassFactory();})(jQuery,FooTable);(function($,F){F.Breakpoint=F.Class.extend({construct:function(name,width){this.name=name;this.width=width;}});})(jQuery,FooTable);(function($,F){F.Breakpoints=F.Component.extend({construct:function(table){ this._super(table,true);this.o=table.o;this.current=null;this.array=[];this.cascade=this.o.cascade;this.hidden=null;this._classNames=''; this.getWidth=F.checkFnValue(this,this.o.getWidth,this.getWidth);},preinit:function(data){var self=this;return this.ft.raise('preinit.ft.breakpoints',[data]).then(function(){self.cascade=F.is.boolean(data.cascade)?data.cascade:self.cascade;self.o.breakpoints=F.is.hash(data.breakpoints)?data.breakpoints:self.o.breakpoints;self.getWidth=F.checkFnValue(self,data.getWidth,self.getWidth);if(self.o.breakpoints==null)self.o.breakpoints={"xs":480,"sm":768,"md":992,"lg":1200};for(var name in self.o.breakpoints){if(!self.o.breakpoints.hasOwnProperty(name))continue;self.array.push(new F.Breakpoint(name,self.o.breakpoints[name]));self._classNames+='breakpoint-'+name+' ';} 
self.array.sort(function(a,b){return b.width-a.width;});});},init:function(){var self=this;return this.ft.raise('init.ft.breakpoints').then(function(){self.current=self.get();});},draw:function(){this.ft.$el.removeClass(this._classNames).addClass('breakpoint-'+this.current.name);},calculate:function(){var self=this,current=null,hidden=[],breakpoint,prev=null,width=self.getWidth();for(var i=0,len=self.array.length;i<len;i++){breakpoint=self.array[i];
if((!current&&i==len-1)||(width>=breakpoint.width&&(prev instanceof F.Breakpoint?width<=prev.width:true))){current=breakpoint;}
if(!current)hidden.push(breakpoint.name);prev=breakpoint;}
hidden.push(current.name);self.hidden=hidden.join(' ');return current;},visible:function(breakpoints){if(F.is.emptyString(breakpoints))return true;if(breakpoints==='all')return false;var parts=breakpoints.split(' '),i=0,len=parts.length;for(;i<len;i++){if(this.cascade?F.str.containsWord(this.hidden,parts[i]):parts[i]==this.current.name)return false;}
return true;},check:function(){var self=this,bp=self.get();if(!(bp instanceof F.Breakpoint)||bp==self.current)
return; self.ft.raise('before.ft.breakpoints',[self.current,bp]).then(function(){var previous=self.current;self.current=bp;return self.ft.draw().then(function(){self.ft.raise('after.ft.breakpoints',[self.current,previous]);});});},get:function(breakpoint){if(F.is.undef(breakpoint))return this.calculate();if(breakpoint instanceof F.Breakpoint)return breakpoint;if(F.is.string(breakpoint))return F.arr.first(this.array,function(bp){return bp.name==breakpoint;});if(F.is.number(breakpoint))return breakpoint>=0&&breakpoint<this.array.length?this.array[breakpoint]:null;return null;},getWidth:function(){if(F.is.fn(this.o.getWidth))return this.o.getWidth(this.ft);if(this.o.useParentWidth==true)return this.getParentWidth();return this.getViewportWidth();},getParentWidth:function(){return this.ft.$el.parent().width();},getViewportWidth:function(){var ratio=F.is.defined(window.devicePixelRatio)?window.devicePixelRatio:1;return(window.innerWidth||(document.body?document.body.offsetWidth:0))/ratio;}});F.components.internal.register('breakpoints',F.Breakpoints,10);})(jQuery,FooTable);(function(F){F.Column.prototype.breakpoints=null;F.Column.prototype.__breakpoints_define__=function(definition){this.breakpoints=F.is.emptyString(definition.breakpoints)?null:definition.breakpoints;};F.Column.extend('define',function(definition){this._super(definition);this.__breakpoints_define__(definition);});})(FooTable);(function(F){F.Defaults.prototype.breakpoints=null;F.Defaults.prototype.cascade=false;F.Defaults.prototype.useParentWidth=false;F.Defaults.prototype.getWidth=null;})(FooTable);(function($,F){F.Columns=F.Component.extend({construct:function(table){ this._super(table,true);this.o=table.o;this.array=[];this.$header=null;this.showHeader=table.o.showHeader;},parse:function(data){var self=this;return $.Deferred(function(d){function merge(cols1,cols2){var merged=[];if(cols1.length==0||cols2.length==0){merged=cols1.concat(cols2);}else{

var highest=0;F.arr.each(cols1.concat(cols2),function(c){if(c.index>highest)highest=c.index;});highest++;for(var i=0,cols1_c,cols2_c;i<highest;i++){cols1_c={};F.arr.each(cols1,function(c){if(c.index==i){cols1_c=c;return false;}});cols2_c={};F.arr.each(cols2,function(c){if(c.index==i){cols2_c=c;return false;}});merged.push($.extend(true,{},cols1_c,cols2_c));}}
return merged;}
function complete(cols){var columns=[],column;F.arr.each(cols,function(def){if(column=F.columns.contains(def.type)?F.columns.make(def.type,self.ft,def):new F.Column(self.ft,def))
columns.push(column);});if(F.is.emptyArray(columns)){d.reject(Error("No columns supplied."));}else{ columns.sort(function(a,b){return a.index-b.index;});d.resolve(columns);}}
var json=[],html=[]; var $header=self.ft.$el.find('tr.footable-header'),$cell,cdata;if($header.length==0)$header=self.ft.$el.find('thead > tr:last:has([data-breakpoints])');if($header.length==0)$header=self.ft.$el.find('tbody > tr:first:has([data-breakpoints])');if($header.length>0){var virtual=$header.parent().is('tbody')&&$header.children().length==$header.children('td').length;if(!virtual)self.$header=$header.addClass('footable-header');$header.children('td,th').each(function(i,cell){$cell=$(cell);cdata=$cell.data();cdata.index=i;cdata.$el=$cell;cdata.virtual=virtual;html.push(cdata);});if(virtual)self.showHeader=false;} 
if(F.is.array(self.o.columns)){F.arr.each(self.o.columns,function(c,i){c.index=i;json.push(c);});complete(merge(json,html));}else if(F.is.promise(self.o.columns)){self.o.columns.then(function(cols){F.arr.each(cols,function(c,i){c.index=i;json.push(c);});complete(merge(json,html));},function(xhr){d.reject(Error('Columns ajax request error: '+xhr.status+' ('+xhr.statusText+')'));});}else{complete(merge(json,html));}});},preinit:function(data){var self=this;return self.ft.raise('preinit.ft.columns',[data]).then(function(){return self.parse(data).then(function(columns){self.array=columns;self.showHeader=F.is.boolean(data.showHeader)?data.showHeader:self.showHeader;});});},init:function(){var self=this;return this.ft.raise('init.ft.columns',[self.array]).then(function(){self.$create();});},predraw:function(){var self=this,first=true;self.visibleColspan=0;self.firstVisibleIndex=0;self.lastVisibleIndex=0;self.hasHidden=false;F.arr.each(self.array,function(col){col.hidden=!self.ft.breakpoints.visible(col.breakpoints);if(!col.hidden){if(first){self.firstVisibleIndex=col.index;first=false;}
self.lastVisibleIndex=col.index;self.visibleColspan++;}
if(col.hidden&&col.visible)self.hasHidden=true;});},draw:function(){F.arr.each(this.array,function(col){col.$el.css('display',(col.hidden||!col.visible?'none':'table-cell'));});},$create:function(){var self=this;self.$header=F.is.jq(self.$header)?self.$header:$('<tr/>',{'class':'footable-header'});self.$header.children('th,td').detach();F.arr.each(self.array,function(col){self.$header.append(col.$el);});if(self.showHeader&&!F.is.jq(self.$header.parent())){self.ft.$el.children('thead').append(self.$header);}},get:function(column){if(column instanceof F.Column)return column;if(F.is.string(column))return F.arr.first(this.array,function(col){return col.name==column;});if(F.is.number(column))return F.arr.first(this.array,function(col){return col.index==column;});if(F.is.fn(column))return F.arr.get(this.array,column);return null;},ensure:function(columns){var self=this,result=[];if(!F.is.array(columns))return result;F.arr.each(columns,function(name){result.push(self.get(name));});return result;}});F.components.internal.register('columns',F.Columns,5);})(jQuery,FooTable);(function(F){F.Defaults.prototype.columns=[];F.Defaults.prototype.showHeader=true;})(FooTable);(function($,F){F.Rows=F.Component.extend({construct:function(table){ this._super(table,true);this.o=table.o;this.array=[];this.all=[];this.showToggle=table.o.showToggle;this.toggleColumn=table.o.toggleColumn;this.emptyString=table.o.empty;this.expandFirst=table.o.expandFirst;this.$empty=null;},parse:function(){var self=this;return $.Deferred(function(d){var $rows=self.ft.$el.children('tbody').children('tr');function complete(rows){var result=$.map(rows,function(r){return new F.Row(self.ft,self.ft.columns.array,r);});if(F.is.emptyArray(result)){d.reject(Error("No rows supplied."));}else{d.resolve(result);}}
if(F.is.jq($rows)){complete($rows);}else if(F.is.array(self.o.rows)&&self.o.rows.length>0){complete(self.o.rows);}else if(F.is.promise(self.o.rows)){self.o.rows.then(function(rows){complete(rows);},function(xhr){d.reject(Error('Rows ajax request error: '+xhr.status+' ('+xhr.statusText+')'));});}else{complete([]);}});},preinit:function(data){var self=this;return self.ft.raise('preinit.ft.rows',[data]).then(function(){return self.parse().then(function(rows){self.all=rows;self.array=self.all.slice(0);self.showToggle=F.is.boolean(data.showToggle)?data.showToggle:self.showToggle;self.toggleColumn=F.is.string(data.toggleColumn)?data.toggleColumn:self.toggleColumn;if(self.toggleColumn!="first"&&self.toggleColumn!="last")self.toggleColumn="first";self.emptyString=F.is.string(data.empty)?data.empty:self.emptyString;self.expandFirst=F.is.boolean(data.expandFirst)?data.expandFirst:self.expandFirst;});});},init:function(){var self=this;return self.ft.raise('init.ft.rows',[self.all]).then(function(){self.$empty=$('<tr/>',{'class':'footable-empty'}).append($('<td/>').text(self.emptyString));});},predraw:function(){F.arr.each(this.array,function(row){row.predraw();});this.array=this.all.slice(0);},draw:function(){var self=this,$tbody=self.ft.$el.children('tbody'),first=true; if(self.array.length>0){self.$empty.detach(); F.arr.each(self.array,function(row){if(self.expandFirst&&first){row.expanded=true;first=false;}
row.draw($tbody);});}else{ self.$empty.children('td').attr('colspan',self.ft.columns.visibleColspan);$tbody.append(self.$empty);}}});F.components.internal.register('rows',F.Rows,0);})(jQuery,FooTable);(function(F){F.Defaults.prototype.rows=[];F.Defaults.prototype.empty='No results';F.Defaults.prototype.showToggle=true;F.Defaults.prototype.toggleColumn='first';F.Defaults.prototype.expandFirst=false;})(FooTable);(function(F){F.Filter=F.Class.extend({construct:function(name,query,columns,space){this.name=name;this.space=F.is.string(space)&&(space=='OR'||space=='AND')?space:'AND';this.query=new F.Query(query,this.space);this.columns=columns;},match:function(str){if(!F.is.string(str))return false;if(F.is.string(this.query)){this.query=new F.Query(this.query,this.space);}
return this.query instanceof F.Query?this.query.match(str):false;},matchRow:function(row){var self=this,text=F.arr.map(row.cells,function(cell){return F.arr.contains(self.columns,cell.column)?cell.filterValue:null;}).join(' ');return self.match(text);}});})(FooTable);(function($,F){F.Filtering=F.Component.extend({construct:function(table){ this._super(table,table.o.filtering.enabled);this.filters=table.o.filtering.filters;this.delay=table.o.filtering.delay;this.min=table.o.filtering.min;this.space=table.o.filtering.space;this.placeholder=table.o.filtering.placeholder;this.position=table.o.filtering.position;this.$row=null;this.$cell=null;this.$dropdown=null;this.$input=null;this.$button=null;this._filterTimeout=null;},preinit:function(data){var self=this;this.ft.raise('preinit.ft.filtering').then(function(){ if(self.ft.$el.hasClass('footable-filtering'))
self.enabled=true; self.enabled=F.is.boolean(data.filtering)?data.filtering:self.enabled; if(!self.enabled)return;self.space=F.is.string(data.filterSpace)?data.filteringSpace:self.space;self.min=F.is.number(data.filterMin)?data.filteringMin:self.min;self.delay=F.is.number(data.filterDelay)?data.filteringDelay:self.delay;self.placeholder=F.is.number(data.filterPlaceholder)?data.filterPlaceholder:self.placeholder;self.filters=F.is.array(data.filters)?self.ensure(data.filters):self.ensure(self.filters);if(self.ft.$el.hasClass('footable-filtering-left'))
self.position='left';if(self.ft.$el.hasClass('footable-filtering-center'))
self.position='center';if(self.ft.$el.hasClass('footable-filtering-right'))
self.position='right';self.position=F.is.string(data.filterPosition)?data.filterPosition:self.position;},function(){self.enabled=false;});},init:function(){var self=this;this.ft.raise('init.ft.filtering').then(function(){self.$create();},function(){self.enabled=false;});},destroy:function(){var self=this;this.ft.raise('destroy.ft.filtering').then(function(){self.ft.$el.removeClass('footable-filtering').find('thead > tr.footable-filtering').remove();});},$create:function(){var self=this;var $form_grp=$('<div/>',{'class':'form-group'}).append($('<label/>',{'class':'sr-only',text:'Search'})),$input_grp=$('<div/>',{'class':'input-group'}).appendTo($form_grp),$input_grp_btn=$('<div/>',{'class':'input-group-btn'}),$dropdown_toggle=$('<button/>',{type:'button','class':'btn btn-default dropdown-toggle'}).on('click',{self:self},self._onDropdownToggleClicked).append($('<span/>',{'class':'caret'})),position;switch(self.position){case'left':position='footable-filtering-left';break;case'center':position='footable-filtering-center';break;default:position='footable-filtering-right';break;}
self.ft.$el.addClass('footable-filtering').addClass(position);self.$row=$('<tr/>',{'class':'footable-filtering'}).prependTo(self.ft.$el.children('thead'));self.$cell=$('<th/>').attr('colspan',self.ft.columns.visibleColspan).appendTo(self.$row);self.$form=$('<form/>',{'class':'form-inline'}).append($form_grp).appendTo(self.$cell);self.$input=$('<input/>',{type:'text','class':'form-control',placeholder:self.placeholder});self.$button=$('<button/>',{type:'button','class':'btn btn-primary'}).on('click',{self:self},self._onSearchButtonClicked).append($('<span/>',{'class':'fooicon fooicon-search'}));self.$dropdown=$('<ul/>',{'class':'dropdown-menu dropdown-menu-right'}).append(F.arr.map(self.ft.columns.array,function(col){return col.filterable&&col.visible?$('<li/>').append($('<a/>',{'class':'checkbox'}).append($('<label/>',{text:col.title}).prepend($('<input/>',{type:'checkbox',checked:true}).data('__FooTableColumn__',col)))):null;}));if(self.delay>0){self.$input.on('keypress keyup',{self:self},self._onSearchInputChanged);self.$dropdown.on('click','input[type="checkbox"]',self._onSearchColumnClicked);}
$input_grp_btn.append(self.$button,$dropdown_toggle,self.$dropdown);$input_grp.append(self.$input,$input_grp_btn);},predraw:function(){if(F.is.emptyArray(this.filters))
return;var self=this;self.ft.rows.array=$.grep(self.ft.rows.array,function(r){return r.filtered(self.filters);});},draw:function(){this.$cell.attr('colspan',this.ft.columns.visibleColspan);},addFilter:function(name,query,columns){var f=F.arr.first(this.filters,function(f){return f.name==name;});if(f instanceof F.Filter){f.name=name;f.query=query;f.columns=columns;}else{this.filters.push({name:name,query:query,columns:columns});}},removeFilter:function(name){F.arr.remove(this.filters,function(f){return f.name==name;});},filter:function(query,columns){if(F.is.undef(query)){query=$.trim(this.$input.val()||'');}else{this.$input.val(query);}
if(!F.is.emptyString(query)){this.addFilter('search',query,columns);}else{this.removeFilter('search');}
this.$button.children('.fooicon').removeClass('fooicon-search').addClass('fooicon-remove');return this._filter();},clear:function(){this.$button.children('.fooicon').removeClass('fooicon-remove').addClass('fooicon-search');this.$input.val(null);this.removeFilter('search');return this._filter();},columns:function(){if(F.is.jq(this.$dropdown)){ return this.$dropdown.find('input:checked').map(function(){return $(this).data('__FooTableColumn__');}).get();}else{return this.ft.columns.get(function(c){return c.filterable;});}},ensure:function(filters){var self=this,parsed=[],filterable=self.columns();if(!F.is.emptyArray(filters)){F.arr.each(filters,function(f){if(F.is.object(f)&&(!F.is.emptyString(f.query)||f.query instanceof F.Query)){f.name=F.is.emptyString(f.name)?'anon':f.name;f.columns=F.is.emptyArray(f.columns)?filterable:self.ft.columns.ensure(f.columns);parsed.push(f instanceof F.Filter?f:new F.Filter(f.name,f.query,f.columns,self.space));}});}
return parsed;},_filter:function(){var self=this;self.filters=self.ensure(self.filters);return self.ft.raise('before.ft.filtering',[self.filters]).then(function(){self.filters=self.ensure(self.filters);return self.ft.draw().then(function(){self.ft.raise('after.ft.filtering',[self.filters]);});});},_onSearchInputChanged:function(e){var self=e.data.self;var alpha=e.type=='keypress'&&!F.is.emptyString(String.fromCharCode(e.charCode)),ctrl=e.type=='keyup'&&(e.which==8||e.which==46);
 if(alpha||ctrl){if(self._filterTimeout!=null)clearTimeout(self._filterTimeout);self._filterTimeout=setTimeout(function(){self._filterTimeout=null;self.filter();},self.delay);}},_onSearchButtonClicked:function(e){e.preventDefault();var self=e.data.self;if(self._filterTimeout!=null)clearTimeout(self._filterTimeout);var $icon=self.$button.children('.fooicon');if($icon.hasClass('fooicon-remove'))self.clear();else self.filter();},_onSearchColumnClicked:function(e){var self=e.data.self;if(self._filterTimeout!=null)clearTimeout(self._filterTimeout);self._filterTimeout=setTimeout(function(){self._filterTimeout=null;var $icon=self.$button.children('.fooicon');if($icon.hasClass('fooicon-remove')){$icon.removeClass('fooicon-remove').addClass('fooicon-search');self.filter();}},self.delay);},_onDropdownToggleClicked:function(e){e.preventDefault();e.stopPropagation();var self=e.data.self;self.$dropdown.parent().toggleClass('open');if(self.$dropdown.parent().hasClass('open'))$(document).on('click.footable',{self:self},self._onDocumentClicked);else $(document).off('click.footable',self._onDocumentClicked);},_onDocumentClicked:function(e){if($(e.target).closest('.dropdown-menu').length==0){e.preventDefault();var self=e.data.self;self.$dropdown.parent().removeClass('open');$(document).off('click.footable',self._onDocumentClicked);}}});F.components.core.register('filtering',F.Filtering,10);})(jQuery,FooTable);(function(F){F.Query=F.Class.extend({construct:function(query,space){this._original=null;this._value=null;this.space=F.is.string(space)&&(space=='OR'||space=='AND')?space:'AND';this.left=null;this.right=null;this.parts=[];this.operator=null;this.val(query);},val:function(value){ if(F.is.emptyString(value))return this._value; if(F.is.emptyString(this._original))this._original=value;else if(this._original==value)return;this._value=value;this._parse();},match:function(str){if(F.is.emptyString(this.operator)||this.operator==='OR')
return this._left(str,false)||this._match(str,false)||this._right(str,false);if(this.operator==='AND')
return this._left(str,true)&&this._match(str,true)&&this._right(str,true);},_match:function(str,def){var self=this,result=false;if(F.is.emptyArray(self.parts)&&self.left instanceof F.Query)return def;if(F.is.emptyArray(self.parts))return result;if(self.space==='OR'){ F.arr.each(self.parts,function(p){var match=F.str.contains(str,p.query,true);if(match&&!p.negate)result=true;if(match&&p.negate){result=false;return result;}});}else{ result=true;F.arr.each(self.parts,function(p){var match=F.str.contains(str,p.query,true);if((!match&&!p.negate)||(match&&p.negate))result=false;return result;});}
return result;},_left:function(str,def){return(this.left instanceof F.Query)?this.left.match(str):def;},_right:function(str,def){return(this.right instanceof F.Query)?this.right.match(str):def;},_parse:function(){if(F.is.emptyString(this._value))return;  if(/\sOR\s/.test(this._value)){ this.operator='OR';var or=this._value.split(/(?:\sOR\s)(.*)?/);this.left=new F.Query(or[0],this.space);this.right=new F.Query(or[1],this.space);}else if(/\sAND\s/.test(this._value)){ this.operator='AND';var and=this._value.split(/(?:\sAND\s)(.*)?/);this.left=new F.Query(and[0],this.space);this.right=new F.Query(and[1],this.space);}else{ this.parts=F.arr.map(this._value.match(/(?:[^\s"]+|"[^"]*")+/g),this._part);}},_part:function(str){var p={query:str,negate:false,phrase:false,exact:false}; if(F.str.startsWith(p.query,'-')){p.query=F.str.from(p.query,'-');p.negate=true;}
if(/^"(.*?)"$/.test(p.query)){ p.query=p.query.replace(/^"(.*?)"$/,'$1');p.phrase=true;p.exact=true;}else if(/(?:\w)+?([-_\+\.])(?:\w)+?/.test(p.query)){ p.query=p.query.replace(/(?:\w)+?([-_\+\.])(?:\w)+?/g,function(match,p1){return match.replace(p1,' ');});p.phrase=true;}
return p;}});})(FooTable);(function(F){F.Cell.prototype.filterValue=null; F.Cell.prototype.__filtering_define__=function(valueOrElement){this.filterValue=this.column.filterValue.call(this.column,valueOrElement);}; F.Cell.prototype.__filtering_val__=function(value){if(F.is.defined(value)){ this.filterValue=this.column.filterValue.call(this.column,value);}}; F.Cell.extend('define',function(valueOrElement){this._super(valueOrElement);this.__filtering_define__(valueOrElement);}); F.Cell.extend('val',function(value){var val=this._super(value);this.__filtering_val__(value);return val;});})(FooTable);(function($,F){F.Column.prototype.filterable=true;F.Column.prototype.filterValue=function(valueOrElement){ if(F.is.element(valueOrElement)||F.is.jq(valueOrElement))return $(valueOrElement).data('filterValue')||$(valueOrElement).text(); if(F.is.hash(valueOrElement)&&F.is.hash(valueOrElement.options)){if(F.is.string(valueOrElement.options.filterValue))return valueOrElement.options.filterValue;if(F.is.defined(valueOrElement.value))valueOrElement=valueOrElement.value;}
if(F.is.defined(valueOrElement)&&valueOrElement!=null)return valueOrElement+''; return''; };  F.Column.prototype.__filtering_define__=function(definition){this.filterable=F.is.boolean(definition.filterable)?definition.filterable:this.filterable;}; F.Column.extend('define',function(definition){this._super(definition); this.__filtering_define__(definition);});})(jQuery,FooTable);(function(F){F.Defaults.prototype.filtering={enabled:false,filters:[],delay:1200,min:3,space:'AND',placeholder:'Search',position:'right'};})(FooTable);(function(F){F.Row.prototype.filtered=function(filters){var result=true,self=this;F.arr.each(filters,function(f){if((result=f.matchRow(self))==false)return false;});return result;};})(FooTable);(function(F){F.Table.prototype.applyFilter=function(query,columns){return this.use(F.Filtering).filter(query,columns);};F.Table.prototype.clearFilter=function(){return this.use(F.Filtering).clear();};})(FooTable);(function($,F){F.Sorter=F.Class.extend({construct:function(column,direction){this.column=column;this.direction=direction;}});})(jQuery,FooTable);(function($,F){F.Sorting=F.Component.extend({construct:function(table){ this._super(table,table.o.sorting.enabled);this.o=table.o.sorting;this.column=null;this._changed=false;},preinit:function(data){var self=this;this.ft.raise('preinit.ft.sorting',[data]).then(function(){if(self.ft.$el.hasClass('footable-sorting'))
self.enabled=true;self.enabled=F.is.boolean(data.sorting)?data.sorting:self.enabled;if(!self.enabled)return;self.column=F.arr.first(self.ft.columns.array,function(col){return col.sorted;});},function(){self.enabled=false;});},init:function(){var self=this;this.ft.raise('init.ft.sorting').then(function(){F.arr.each(self.ft.columns.array,function(col){if(col.sortable){col.$el.addClass('footable-sortable').append($('<span/>',{'class':'fooicon fooicon-sort'}));}});self.ft.$el.on('click.footable','.footable-sortable',{self:self},self._onSortClicked);},function(){self.enabled=false;});},destroy:function(){var self=this;this.ft.raise('destroy.ft.paging').then(function(){self.ft.$el.off('click.footable','.footable-sortable',self._onSortClicked);self.ft.$el.children('thead').children('tr.footable-header').children('.footable-sortable').removeClass('footable-sortable').find('span.fooicon').remove();});},predraw:function(){if(!this.column)return;var self=this,col=self.column;self.ft.rows.array.sort(function(a,b){return col.direction=='ASC'?col.sorter(a.cells[col.index].value,b.cells[col.index].value):col.sorter(b.cells[col.index].value,a.cells[col.index].value);});},draw:function(){if(!this.column)return;var self=this,$sortable=self.ft.$el.find('thead > tr > .footable-sortable'),$active=self.column.$el;$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');$sortable.not($active).children('.fooicon').addClass('fooicon-sort');$active.addClass(self.column.direction=='ASC'?'footable-asc':'footable-desc').children('.fooicon').addClass(self.column.direction=='ASC'?'fooicon-sort-asc':'fooicon-sort-desc');},sort:function(column,direction){return this._sort(column,direction);},_sort:function(column,direction){var self=this;var sorter=new F.Sorter(self.ft.columns.get(column),F.Sorting.dir(direction));return self.ft.raise('before.ft.sorting',[sorter]).then(function(){F.arr.each(self.ft.columns.array,function(col){if(col!=self.column)col.direction=null;});self.column=self.ft.columns.get(sorter.column);if(self.column)self.column.direction=F.Sorting.dir(sorter.direction);return self.ft.draw().then(function(){self.ft.raise('after.ft.sorting',[sorter]);});});},_onSortClicked:function(e){e.preventDefault();var self=e.data.self,$header=$(this).closest('th,td'),direction=$header.is('.footable-asc, .footable-desc')?($header.hasClass('footable-desc')?'ASC':'DESC'):'ASC';self._sort($header.index(),direction);}});F.Sorting.dir=function(str){return F.is.string(str)&&(str=='ASC'||str=='DESC')?str:'ASC';};F.components.core.register('sorting',F.Sorting,5);})(jQuery,FooTable);(function($,F){F.Column.prototype.direction=null;F.Column.prototype.sortable=true;F.Column.prototype.sorted=false;F.Column.prototype.sorter=function(a,b){if(typeof a==='string')a=a.toLowerCase();if(typeof b==='string')b=b.toLowerCase();if(a===b)return 0;if(a<b)return-1;return 1;};  F.Column.prototype.__sorting_define__=function(definition){this.sorter=F.checkFnValue(this,definition.sorter,this.sorter);this.direction=F.is.type(definition.direction,'string')?F.Sorting.dir(definition.direction):null;this.sortable=F.is.boolean(definition.sortable)?definition.sortable:true;this.sorted=F.is.boolean(definition.sorted)?definition.sorted:false;}; F.Column.extend('define',function(definition){this._super(definition);this.__sorting_define__(definition);});})(jQuery,FooTable);(function(F){F.Defaults.prototype.sorting={enabled:false};})(FooTable);(function(F){F.Table.prototype.sort=function(column,direction){return this.use(F.Sorting).sort(column,direction);};})(FooTable);(function($,F){F.Pager=F.Class.extend({construct:function(total,current,size,page,forward){this.total=total;this.current=current;this.size=size;this.page=page;this.forward=forward;}});})(jQuery,FooTable);(function($,F){F.Paging=F.Component.extend({construct:function(table){ this._super(table,table.o.paging.enabled);this.strings=table.o.paging.strings;this.current=table.o.paging.current;this.size=table.o.paging.size;this.limit=table.o.paging.limit;this.position=table.o.paging.position;this.countFormat=table.o.paging.countFormat;this.total=-1;this.$row=null;this.$cell=null;this.$pagination=null;this.$count=null;this._previous=1;this._total=0;},preinit:function(data){var self=this;this.ft.raise('preinit.ft.paging',[data]).then(function(){if(self.ft.$el.hasClass('footable-paging'))
self.enabled=true;self.enabled=F.is.boolean(data.paging)?data.paging:self.enabled;if(!self.enabled)return;self.size=F.is.number(data.pagingSize)?data.pagingSize:self.size;self.current=F.is.number(data.pagingCurrent)?data.pagingCurrent:self.current;self.limit=F.is.number(data.pagingLimit)?data.pagingLimit:self.limit;if(self.ft.$el.hasClass('footable-paging-left'))
self.position='left';if(self.ft.$el.hasClass('footable-paging-center'))
self.position='center';if(self.ft.$el.hasClass('footable-paging-right'))
self.position='right';self.position=F.is.string(data.pagingPosition)?data.pagingPosition:self.position;self.countFormat=F.is.string(data.pagingCountFormat)?data.pagingCountFormat:self.countFormat;self.total=Math.ceil(self.ft.rows.array.length/self.size);self._total=self.total;},function(){self.enabled=false;});},init:function(){var self=this;this.ft.raise('init.ft.paging').then(function(){self.$create();},function(){self.enabled=false;});},destroy:function(){var self=this;this.ft.raise('destroy.ft.paging').then(function(){self.ft.$el.removeClass('footable-paging').find('tfoot > tr.footable-paging').remove();});},predraw:function(){this.total=Math.ceil(this.ft.rows.array.length/this.size);this.current=this.current>this.total?this.total:(this.current<1?1:this.current);this._total=this.ft.rows.array.length;if(this.ft.rows.array.length>this.size)
this.ft.rows.array=this.ft.rows.array.splice((this.current-1)*this.size,this.size);},draw:function(){this.$cell.attr('colspan',this.ft.columns.visibleColspan);this._setVisible(this.current,this.current>this._previous);this._setNavigation(true);},$create:function(){var self=this,multiple=self.total>1,link=function(attr,html,klass){return $('<li/>',{'class':klass}).attr('data-page',attr).append($('<a/>',{'class':'footable-page-link',href:'#'}).data('page',attr).html(html));},position;switch(self.position){case'left':position='footable-paging-left';break;case'right':position='footable-paging-right';break;default:position='footable-paging-center';break;}
self.ft.$el.addClass('footable-paging').addClass(position);self.$cell=$('<td/>').attr('colspan',self.ft.columns.visibleColspan);self.$row=$('<tr/>',{'class':'footable-paging'}).append(self.$cell).appendTo(self.ft.$el.children('tfoot'));self.$pagination=$('<ul/>',{'class':'pagination'}).on('click.footable','a.footable-page-link',{self:self},self._onPageClicked);self.$count=$('<span/>',{'class':'label label-default'});if(self.total==0||self.total==1){self.$pagination.empty();self.$count.text(self.total+' of '+self.total);self._total=self.total;return;}
self.$pagination.empty();if(multiple){self.$pagination.append(link('first',self.strings.first,'footable-page-nav'));self.$pagination.append(link('prev',self.strings.prev,'footable-page-nav'));if(self.limit>0&&self.limit<self.total){self.$pagination.append(link('prev-limit',self.strings.prevPages,'footable-page-nav'));}}
for(var i=0,$li;i<self.total;i++){$li=link(i+1,i+1,'footable-page');self.$pagination.append($li);}
if(multiple){if(self.limit>0&&self.limit<self.total){self.$pagination.append(link('next-limit',self.strings.nextPages,'footable-page-nav'));}
self.$pagination.append(link('next',self.strings.next,'footable-page-nav'));self.$pagination.append(link('last',self.strings.last,'footable-page-nav'));}
self.$cell.append(self.$pagination,$('<div/>',{'class':'divider'}),self.$count);self._total=self.total;},first:function(){return this._set(1);},prev:function(){return this._set(this.current-1>0?this.current-1:1);},next:function(){return this._set(this.current+1<this.total?this.current+1:this.total);},last:function(){return this._set(this.total);},goto:function(page){return this._set(page>this.total?this.total:(page<1?1:page));},prevPages:function(){var page=this.$pagination.children('li.footable-page.visible:first').data('page')-1;this._setVisible(page,true);this._setNavigation(false);},nextPages:function(){var page=this.$pagination.children('li.footable-page.visible:last').data('page')+1;this._setVisible(page,false);this._setNavigation(false);},_set:function(page){var self=this,pager=new F.Pager(self.total,self.current,self.size,page,page>self.current);return self.ft.raise('before.ft.paging',[pager]).then(function(){pager.page=pager.page>pager.total?pager.total:pager.page;pager.page=pager.page<1?1:pager.page;if(self.current==page)return $.when();self._previous=self.current;self.current=pager.page;return self.ft.draw().then(function(){self.ft.raise('after.ft.paging',[pager]);});});},_setNavigation:function(active){if(this.current==1){this.$pagination.children('li[data-page="first"],li[data-page="prev"]').addClass('disabled');}else{this.$pagination.children('li[data-page="first"],li[data-page="prev"]').removeClass('disabled');}
if(this.current==this.total){this.$pagination.children('li[data-page="next"],li[data-page="last"]').addClass('disabled');}else{this.$pagination.children('li[data-page="next"],li[data-page="last"]').removeClass('disabled');}
if((this.$pagination.children('li.footable-page.visible:first').data('page')||1)==1){this.$pagination.children('li[data-page="prev-limit"]').addClass('disabled');}else{this.$pagination.children('li[data-page="prev-limit"]').removeClass('disabled');}
if((this.$pagination.children('li.footable-page.visible:last').data('page')||this.limit)==this.total){this.$pagination.children('li[data-page="next-limit"]').addClass('disabled');}else{this.$pagination.children('li[data-page="next-limit"]').removeClass('disabled');}
if(this.limit>0&&this.total<this.limit){this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').hide();}else{this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').show();}
if(active){this.$pagination.children('li.footable-page').removeClass('active').filter('li[data-page="'+this.current+'"]').addClass('active');}},_setVisible:function(page,right){if(this.limit>0&&this.total>this.limit){if(!this.$pagination.children('li.footable-page[data-page="'+page+'"]').hasClass('visible')){var start=0,end=0;if(right==true){end=page>this.total?this.total:page;start=end-this.limit;}else{start=page<1?0:page-1;end=start+this.limit;}
if(start<0){start=0;end=this.limit>this.total?this.total:this.limit;}
if(end>this.total){end=this.total;start=this.total-this.limit<0?0:this.total-this.limit;}
this.$pagination.children('li.footable-page').removeClass('visible').slice(start,end).addClass('visible');}}else{this.$pagination.children('li.footable-page').removeClass('visible').slice(0,this.total).addClass('visible');}
var first=(this.size*(page-1))+1,last=this.size*page;if(this.ft.rows.array.length==0){first=0;last=0;}else{last=last>this._total?this._total:last;}
this._setCount(page,this.total,first,last,this._total);},_setCount:function(currentPage,totalPages,pageFirst,pageLast,totalRows){this.$count.text(this.countFormat.replace(/\{CP}/g,currentPage).replace(/\{TP}/g,totalPages).replace(/\{PF}/g,pageFirst).replace(/\{PL}/g,pageLast).replace(/\{TR}/g,totalRows));},_onPageClicked:function(e){e.preventDefault();if($(e.target).closest('li').is('.active,.disabled'))return;var self=e.data.self,page=$(this).data('page');switch(page){case'first':self.first();return;case'prev':self.prev();return;case'next':self.next();return;case'last':self.last();return;case'prev-limit':self.prevPages();return;case'next-limit':self.nextPages();return;default:self._set(page);return;}}});F.components.core.register('paging',F.Paging,0);})(jQuery,FooTable);(function(F){F.Defaults.prototype.paging={enabled:false,countFormat:'{CP} of {TP}',current:1,limit:5,position:'center',size:10,strings:{first:'&laquo;',prev:'&lsaquo;',next:'&rsaquo;',last:'&raquo;',prevPages:'...',nextPages:'...'}};})(FooTable);(function(F){F.Table.prototype.gotoPage=function(num){return this.use(F.Paging).goto(num);};F.Table.prototype.nextPage=function(){return this.use(F.Paging).next();};F.Table.prototype.prevPage=function(){return this.use(F.Paging).prev();};F.Table.prototype.firstPage=function(){return this.use(F.Paging).first();};F.Table.prototype.lastPage=function(){return this.use(F.Paging).last();};F.Table.prototype.nextPages=function(){return this.use(F.Paging).nextPages();};F.Table.prototype.prevPages=function(){return this.use(F.Paging).prevPages();};})(FooTable);﻿;(function($){$.fn.textfill=function(options){

 var defaults={debug:false,maxFontPixels:40,minFontPixels:4,innerTag:'span',widthOnly:false,success:null, callback:null,fail:null, complete:null, explicitWidth:null,explicitHeight:null,changeLineHeight:false};var Opts=$.extend(defaults,options);



 function _debug(){if(!Opts.debug||typeof console=='undefined'||typeof console.debug=='undefined'){return;}
console.debug.apply(console,arguments);} 
function _warn(){if(typeof console=='undefined'||typeof console.warn=='undefined'){return;}
console.warn.apply(console,arguments);}

function _debug_sizing(prefix,ourText,maxHeight,maxWidth,minFontPixels,maxFontPixels){function _m(v1,v2){var marker=' / ';if(v1>v2)
marker=' > ';else if(v1==v2)
marker=' = ';return marker;}
_debug('[TextFill] '+prefix+' { '+'font-size: '+ourText.css('font-size')+','+'Height: '+ourText.height()+'px '+_m(ourText.height(),maxHeight)+maxHeight+'px,'+'Width: '+ourText.width()+_m(ourText.width(),maxWidth)+maxWidth+','+'minFontPixels: '+minFontPixels+'px, '+'maxFontPixels: '+maxFontPixels+'px }');}
function _sizing(prefix,ourText,func,max,maxHeight,maxWidth,minFontPixels,maxFontPixels){_debug_sizing(prefix,ourText,maxHeight,maxWidth,minFontPixels,maxFontPixels);





while(minFontPixels<(maxFontPixels-1)){var fontSize=Math.floor((minFontPixels+maxFontPixels)/2);ourText.css('font-size',fontSize);if(func.call(ourText)<=max){minFontPixels=fontSize;if(func.call(ourText)==max)
break;}
else
maxFontPixels=fontSize;_debug_sizing(prefix,ourText,maxHeight,maxWidth,minFontPixels,maxFontPixels);}
ourText.css('font-size',maxFontPixels);if(func.call(ourText)<=max){minFontPixels=maxFontPixels;_debug_sizing(prefix+'* ',ourText,maxHeight,maxWidth,minFontPixels,maxFontPixels);}
return minFontPixels;}

_debug('[TextFill] Start Debug');this.each(function(){ var ourText=$(Opts.innerTag+':visible:first',this); var maxHeight=Opts.explicitHeight||$(this).height();var maxWidth=Opts.explicitWidth||$(this).width();var oldFontSize=ourText.css('font-size');var lineHeight=parseFloat(ourText.css('line-height'))/parseFloat(oldFontSize);_debug('[TextFill] Inner text: '+ourText.text());_debug('[TextFill] All options: ',Opts);_debug('[TextFill] Maximum sizes: { '+'Height: '+maxHeight+'px, '+'Width: '+maxWidth+'px'+' }');var minFontPixels=Opts.minFontPixels;
 var maxFontPixels=(Opts.maxFontPixels<=0?maxHeight:Opts.maxFontPixels);
 var fontSizeHeight=undefined;if(!Opts.widthOnly)
fontSizeHeight=_sizing('Height',ourText,$.fn.height,maxHeight,maxHeight,maxWidth,minFontPixels,maxFontPixels);
 var fontSizeWidth=undefined;fontSizeWidth=_sizing('Width',ourText,$.fn.width,maxWidth,maxHeight,maxWidth,minFontPixels,maxFontPixels);if(Opts.widthOnly){ourText.css({'font-size':fontSizeWidth,'white-space':'nowrap'});if(Opts.changeLineHeight)
ourText.parent().css('line-height',(lineHeight*fontSizeWidth+'px'));}
else{var fontSizeFinal=Math.min(fontSizeHeight,fontSizeWidth);ourText.css('font-size',fontSizeFinal);if(Opts.changeLineHeight)
ourText.parent().css('line-height',(lineHeight*fontSizeFinal)+'px');}
_debug('[TextFill] Finished { '+'Old font-size: '+oldFontSize+', '+'New font-size: '+ourText.css('font-size')+' }'); if((ourText.width()>maxWidth)||(ourText.height()>maxHeight&&!Opts.widthOnly)){ourText.css('font-size',oldFontSize); if(Opts.fail)
Opts.fail(this);_debug('[TextFill] Failure { '+'Current Width: '+ourText.width()+', '+'Maximum Width: '+maxWidth+', '+'Current Height: '+ourText.height()+', '+'Maximum Height: '+maxHeight+' }');}
else if(Opts.success){Opts.success(this);}
else if(Opts.callback){_warn('callback is deprecated, use success, instead'); Opts.callback(this);}}); if(Opts.complete)
Opts.complete(this);_debug('[TextFill] End Debug');return this;};})(window.jQuery);