text: !function(e){"use strict";var a=e.tablesorter||{},t=".compare-select",n=a.filterFormatter={addCompare:function(a,n,d){if(d.compare&&e.isArray(d.compare)&&d.compare.length>1){var l="",i=[t.slice(1)," "+t.slice(1),""],r=d.cellText?'<label class="'+i.join("-label")+n+'">'+d.cellText+"</label>":"";e.each(d.compare,function(e,a){l+="<option "+(d.selected===e?"selected":"")+">"+a+"</option>"}),a.wrapInner('<div class="'+i.join("-wrapper")+n+'" />').prepend(r+'<select class="'+i.join("")+n+'" />').find("select").append(l)}},updateCompare:function(a,n,d){var l=n.val()||"",i=l.replace(/\s*?[><=]\s*?/g,""),r=l.match(/[><=]/g)||"";return d.compare&&(e.isArray(d.compare)&&(r=(r||[]).join("")||d.compare[d.selected||0]),a.find(t).val(r)),[l,i]},uiSpinner:function(d,l,i){var r=e.extend({delayed:!0,addToggle:!0,exactMatch:!0,value:1,cellText:"",compare:"",min:0,max:100,step:1,disabled:!1},i),o=d.closest("table")[0].config,s=e('<input class="filter" type="hidden">').appendTo(d).bind("change"+o.namespace+"filter",function(){p({value:this.value,delayed:!1})}),c=[],p=function(n,l){var i,s=!0,p=n&&n.value&&a.formatFloat((n.value+"").replace(/[><=]/g,""))||d.find(".spinner").val()||r.value,f=(e.isArray(r.compare)?d.find(t).val()||r.compare[r.selected||0]:r.compare)||"",u=n&&"boolean"==typeof n.delayed?n.delayed:o.$table[0].hasInitialized?r.delayed||"":!0;r.addToggle&&(s=d.find(".toggle").is(":checked")),i=r.disabled||!s?"disable":"enable",d.find(".filter").val(s?(f?f:r.exactMatch?"=":"")+p:"").trigger(l?"":"search",u).end().find(".spinner").spinner(i).val(p),c.length&&(c.find(".spinner").spinner(i).val(p).end().find(t).val(f),r.addToggle&&(c.find(".toggle")[0].checked=s))};return r.oldcreate=r.create,r.oldspin=r.spin,r.create=function(e,a){p(),"function"==typeof r.oldcreate&&r.oldcreate(e,a)},r.spin=function(e,a){p(a),"function"==typeof r.oldspin&&r.oldspin(e,a)},r.addToggle&&e('<div class="button"><input id="uispinnerbutton'+l+'" type="checkbox" class="toggle" /><label for="uispinnerbutton'+l+'"></label></div>').appendTo(d).find(".toggle").bind("change",function(){p()}),d.closest("thead").find("th[data-column="+l+"]").addClass("filter-parsed"),e('<input class="spinner spinner'+l+'" />').val(r.value).appendTo(d).spinner(r).bind("change keyup",function(){p()}),o.$table.bind("filterFomatterUpdate",function(){var e=n.updateCompare(d,s,r)[0];d.find(".spinner").val(e),p({value:e},!0),a.filter.formatterUpdated(d,l)}),r.compare&&(n.addCompare(d,l,r),d.find(t).bind("change",function(){p()})),o.$table.bind("stickyHeadersInit",function(){c=o.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(l).empty(),r.addToggle&&e('<div class="button"><input id="stickyuispinnerbutton'+l+'" type="checkbox" class="toggle" /><label for="stickyuispinnerbutton'+l+'"></label></div>').appendTo(c).find(".toggle").bind("change",function(){d.find(".toggle")[0].checked=this.checked,p()}),e('<input class="spinner spinner'+l+'" />').val(r.value).appendTo(c).spinner(r).bind("change keyup",function(){d.find(".spinner").val(this.value),p()}),r.compare&&(n.addCompare(c,l,r),c.find(t).bind("change",function(){d.find(t).val(e(this).val()),p()}))}),o.$table.bind("filterReset",function(){e.isArray(r.compare)&&d.add(c).find(t).val(r.compare[r.selected||0]),r.addToggle&&(d.find(".toggle")[0].checked=!1),d.find(".spinner").spinner("value",r.value),setTimeout(function(){p()},0)}),p(),s},uiSlider:function(d,l,i){var r=e.extend({delayed:!0,valueToHeader:!1,exactMatch:!0,cellText:"",compare:"",allText:"all",value:0,min:0,max:100,step:1,range:"min"},i),o=d.closest("table")[0].config,s=e('<input class="filter" type="hidden">').appendTo(d).bind("change"+o.namespace+"filter",function(){p({value:this.value})}),c=[],p=function(n,i){var s="undefined"!=typeof n?a.formatFloat((n.value+"").replace(/[><=]/g,""))||r.value:r.value,p=r.compare?s:s===r.min?r.allText:s,f=(e.isArray(r.compare)?d.find(t).val()||r.compare[r.selected||0]:r.compare)||"",u=f+p,m=n&&"boolean"==typeof n.delayed?n.delayed:o.$table[0].hasInitialized?r.delayed||"":!0;r.valueToHeader?d.closest("thead").find("th[data-column="+l+"]").find(".curvalue").html(" ("+u+")"):d.find(".ui-slider-handle").addClass("value-popup").attr("data-value",u),d.find(".filter").val(f?f+s:s===r.min?"":(r.exactMatch?"=":"")+s).trigger(i?"":"search",m).end().find(".slider").slider("value",s),c.length&&(c.find(t).val(f).end().find(".slider").slider("value",s),r.valueToHeader?c.closest("thead").find("th[data-column="+l+"]").find(".curvalue").html(" ("+u+")"):c.find(".ui-slider-handle").addClass("value-popup").attr("data-value",u))};return d.closest("thead").find("th[data-column="+l+"]").addClass("filter-parsed"),r.valueToHeader&&d.closest("thead").find("th[data-column="+l+"]").find(".tablesorter-header-inner").append('<span class="curvalue" />'),r.oldcreate=r.create,r.oldslide=r.slide,r.create=function(e,a){p(),"function"==typeof r.oldcreate&&r.oldcreate(e,a)},r.slide=function(e,a){p(a),"function"==typeof r.oldslide&&r.oldslide(e,a)},e('<div class="slider slider'+l+'"/>').appendTo(d).slider(r),o.$table.bind("filterFomatterUpdate",function(){var e=n.updateCompare(d,s,r)[0];d.find(".slider").slider("value",e),p({value:e},!1),a.filter.formatterUpdated(d,l)}),r.compare&&(n.addCompare(d,l,r),d.find(t).bind("change",function(){p({value:d.find(".slider").slider("value")})})),o.$table.bind("filterReset",function(){e.isArray(r.compare)&&d.add(c).find(t).val(r.compare[r.selected||0]),setTimeout(function(){p({value:r.value})},0)}),o.$table.bind("stickyHeadersInit",function(){c=o.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(l).empty(),e('<div class="slider slider'+l+'"/>').val(r.value).appendTo(c).slider(r).bind("change keyup",function(){d.find(".slider").slider("value",this.value),p()}),r.compare&&(n.addCompare(c,l,r),c.find(t).bind("change",function(){d.find(t).val(e(this).val()),p()}))}),s},uiRange:function(t,n,d){var l=e.extend({delayed:!0,valueToHeader:!1,values:[0,100],min:0,max:100,range:!0},d),i=t.closest("table")[0].config,r=e('<input class="filter" type="hidden">').appendTo(t).bind("change"+i.namespace+"filter",function(){s()}),o=[],s=function(){var e=r.val(),a=e.split(" - ");""===e&&(a=[l.min,l.max]),a&&a[1]&&c({values:a,delay:!1},!0)},c=function(e,a){var d=e&&e.values||l.values,r=d[0]+" - "+d[1],s=d[0]===l.min&&d[1]===l.max?"":r,c=e&&"boolean"==typeof e.delayed?e.delayed:i.$table[0].hasInitialized?l.delayed||"":!0;l.valueToHeader?t.closest("thead").find("th[data-column="+n+"]").find(".currange").html(" ("+r+")"):t.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",d[0]).end().eq(1).attr("data-value",d[1]),t.find(".filter").val(s).trigger(a?"":"search",c).end().find(".range").slider("values",d),o.length&&(o.find(".range").slider("values",d),l.valueToHeader?o.closest("thead").find("th[data-column="+n+"]").find(".currange").html(" ("+r+")"):o.find(".ui-slider-handle").addClass("value-popup").eq(0).attr("data-value",d[0]).end().eq(1).attr("data-value",d[1]))};return t.closest("thead").find("th[data-column="+n+"]").addClass("filter-parsed"),l.valueToHeader&&t.closest("thead").find("th[data-column="+n+"]").find(".tablesorter-header-inner").append('<span class="currange"/>'),l.oldcreate=l.create,l.oldslide=l.slide,l.create=function(e,a){c(),"function"==typeof l.oldcreate&&l.oldcreate(e,a)},l.slide=function(e,a){c(a),"function"==typeof l.oldslide&&l.oldslide(e,a)},e('<div class="range range'+n+'"/>').appendTo(t).slider(l),i.$table.bind("filterFomatterUpdate",function(){s(),a.filter.formatterUpdated(t,n)}),i.$table.bind("filterReset",function(){t.find(".range").slider("values",l.values),setTimeout(function(){c()},0)}),i.$table.bind("stickyHeadersInit",function(){o=i.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(n).empty(),e('<div class="range range'+n+'"/>').val(l.value).appendTo(o).slider(l).bind("change keyup",function(){t.find(".range").val(this.value),c()})}),r},uiDateCompare:function(d,l,i){var r,o,s=e.extend({cellText:"",compare:"",endOfDay:!0,defaultDate:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},i),c=d.closest("table")[0].config,p=d.closest("thead").find("th[data-column="+l+"]").addClass("filter-parsed"),f=e('<input class="dateCompare" type="hidden">').appendTo(d).bind("change"+c.namespace+"filter",function(){var e=this.value;e&&s.onClose(e)}),u=[],m=function(a){var n,l,i=r.datepicker("getDate")||"",o=(e.isArray(s.compare)?d.find(t).val()||s.compare[s.selected||0]:s.compare)||"",p=c.$table[0].hasInitialized?s.delayed||"":!0;r.datepicker("setDate",(""===i?"":i)||null),""===i&&(a=!1),n=r.datepicker("getDate"),l=n?(s.endOfDay&&/<=/.test(o)?n.setHours(23,59,59):n.getTime())||"":"",n&&s.endOfDay&&"="===o&&(o="",l+=" - "+n.setHours(23,59,59),a=!1),d.find(".dateCompare").val(o+l).trigger(a?"":"search",p).end(),u.length&&u.find(".dateCompare").val(o+l).end().find(t).val(o)};return o='<input type="text" class="date date'+l+'" placeholder="'+(p.data("placeholder")||p.attr("data-placeholder")||c.widgetOptions.filter_placeholder.search||"")+'" />',r=e(o).appendTo(d),s.oldonClose=s.onClose,s.onClose=function(e,a){m(),"function"==typeof s.oldonClose&&s.oldonClose(e,a)},r.datepicker(s),c.$table.bind("filterReset",function(){e.isArray(s.compare)&&d.add(u).find(t).val(s.compare[s.selected||0]),d.add(u).find(".date").val(s.defaultDate).datepicker("setDate",s.defaultDate||null),setTimeout(function(){m()},0)}),c.$table.bind("filterFomatterUpdate",function(){var e,i=f.val();/\s+-\s+/.test(i)?(d.find(t).val("="),e=i.split(/\s+-\s+/)[0],r.datepicker("setDate",e||null)):(e=n.updateCompare(d,f,s)[1].toString()||"",e=""!==e?/\d{5}/g.test(e)?new Date(Number(e)):e||"":""),d.add(u).find(".date").datepicker("setDate",e||null),setTimeout(function(){m(!0),a.filter.formatterUpdated(d,l)},0)}),s.compare&&(n.addCompare(d,l,s),d.find(t).bind("change",function(){m()})),c.$table.bind("stickyHeadersInit",function(){u=c.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(l).empty(),u.append(o).find(".date").datepicker(s),s.compare&&(n.addCompare(u,l,s),u.find(t).bind("change",function(){d.find(t).val(e(this).val()),m()}))}),f.val(s.defaultDate?s.defaultDate:"")},uiDatepicker:function(t,n,d){var l,i,r=e.extend({endOfDay:!0,textFrom:"from",textTo:"to",from:"",to:"",changeMonth:!0,changeYear:!0,numberOfMonths:1},d),o=[],s=t.closest("table")[0].config,c=function(e){return e instanceof Date&&isFinite(e)},p=e('<input class="dateRange" type="hidden">').appendTo(t).bind("change"+s.namespace+"filter",function(){var e=this.value;e.match(" - ")?(e=e.split(" - "),t.find(".dateTo").val(e[1]),i(e[0])):e.match(">=")?i(e.replace(">=","")):e.match("<=")&&i(e.replace("<=",""))}),f=t.closest("thead").find("th[data-column="+n+"]").addClass("filter-parsed");return l="<label>"+r.textFrom+'</label><input type="text" class="dateFrom" placeholder="'+(f.data("placeholderFrom")||f.attr("data-placeholder-from")||s.widgetOptions.filter_placeholder.from||"")+'" /><label>'+r.textTo+'</label><input type="text" class="dateTo" placeholder="'+(f.data("placeholderTo")||f.attr("data-placeholder-to")||s.widgetOptions.filter_placeholder.to||"")+'" />',e(l).appendTo(t),r.oldonClose=r.onClose,i=r.onClose=function(e,a){var n,d=t.find(".dateFrom").datepicker("getDate"),l=t.find(".dateTo").datepicker("getDate");d=c(d)?d.getTime():"",l=c(l)?(r.endOfDay?l.setHours(23,59,59):l.getTime())||"":"",n=d?l?d+" - "+l:">="+d:l?"<="+l:"",t.add(o).find(".dateRange").val(n).trigger("search"),d=d?new Date(d):"",l=l?new Date(l):"",/<=/.test(n)?t.add(o).find(".dateFrom").datepicker("option","maxDate",l||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",l||null):/>=/.test(n)?t.add(o).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",d||null).end().find(".dateTo").datepicker("option","minDate",d||null):t.add(o).find(".dateFrom").datepicker("option","maxDate",null).datepicker("setDate",d||null).end().find(".dateTo").datepicker("option","minDate",null).datepicker("setDate",l||null),"function"==typeof r.oldonClose&&r.oldonClose(e,a)},r.defaultDate=r.from||"",t.find(".dateFrom").datepicker(r),r.defaultDate=r.to||"+7d",t.find(".dateTo").datepicker(r),s.$table.bind("filterFomatterUpdate",function(){var e=p.val()||"",d="",l="";/\s+-\s+/.test(e)?(e=e.split(/\s+-\s+/)||[],d=e[0]||"",l=e[1]||""):/>=/.test(e)?d=e.replace(/>=/,"")||"":/<=/.test(e)&&(l=e.replace(/<=/,"")||""),d=""!==d?/\d{5}/g.test(d)?new Date(Number(d)):d||"":"",l=""!==l?/\d{5}/g.test(l)?new Date(Number(l)):l||"":"",t.add(o).find(".dateFrom").datepicker("setDate",d||null),t.add(o).find(".dateTo").datepicker("setDate",l||null),setTimeout(function(){i(),a.filter.formatterUpdated(t,n)},0)}),s.$table.bind("stickyHeadersInit",function(){o=s.widgetOptions.$sticky.find(".tablesorter-filter-row").children().eq(n).empty(),o.append(l),r.defaultDate=r.from||"",o.find(".dateFrom").datepicker(r),r.defaultDate=r.to||"+7d",o.find(".dateTo").datepicker(r)}),t.closest("table").bind("filterReset",function(){t.add(o).find(".dateFrom").val("").datepicker("setDate",r.from||null),t.add(o).find(".dateTo").val("").datepicker("setDate",r.to||null),setTimeout(function(){i()},0)}),p.val(r.from?r.to?r.from+" - "+r.to:">="+r.from:r.to?"<="+r.to:"")}}}(jQuery);