require.config({paths:{moment:"../../../../webjars/momentjs/2.24.0/moment.js",jdateformatparser:"../../../../webjars/moment-jdateformatparser/1.0.2/moment-jdateformatparser.js",daterangepicker:"../../../../webjars/bootstrap-daterangepicker/3.0.3/js/bootstrap-daterangepicker.js"}});require(["jquery","jdateformatparser","daterangepicker","xwiki-events-bridge"],function(b){var a=function(c,d){b(c).find('input[data-type="date"]').each(function(h,g){var f=b(g);var k=f.prev('input[type="hidden"]');var e=d().toMomentFormatString(f.attr("data-dateformat"));f.daterangepicker({drops:"down",opens:"center",autoUpdateInput:false,timePicker:true,timePicker24Hour:true,ranges:{'Today':[d().startOf("day"),d().endOf("day")],'Yesterday':[d().subtract(1,"days").startOf("day"),d().subtract(1,"days").endOf("day")],'Last 7 Days':[d().subtract(6,"days").startOf("day"),d().endOf("day")],'Last 30 Days':[d().subtract(29,"days").startOf("day"),d().endOf("day")],'This Month':[d().startOf("month"),d().endOf("month")],'Last Month':[d().subtract(1,"month").startOf("month"),d().subtract(1,"month").endOf("month")]},locale:{format:e,cancelLabel:'Clear',applyLabel:'Apply',customRangeLabel:'Custom Range',fromLabel:'From',toLabel:'To',}});var j=function(l,m,i){if(m.type=="cancel"){f.val("");k.val("")}else{if(i.startDate.isSame(i.endDate,"day")){f.val(i.startDate.format(e))}else{f.val(i.startDate.format(e)+" - "+i.endDate.format(e))}k.val(i.startDate.format("x")+"-"+i.endDate.format("x"))}b(document).trigger("xwiki:livetable:"+b(c).attr("id")+":filtersChanged")};f.on("apply.daterangepicker cancel.daterangepicker",function(l,i){j(this,l,i)});f.on("keypress",function(m){if(m.which===13){var i=f.val().trim();var l=i.split(" - ");if(l.length===2){k.val(d(l[0],e).format("x")+"-"+d(l[1],e).format("x"))}else{k.val(i)}}});f.on("hide.daterangepicker",function(i){this.hide=undefined;setTimeout(function(){delete i.target.hide},0)})})};require(["moment"],function(c){b(".xwiki-livetable").each(function(d,e){a(e,c)})})});