"), v && !v.isBefore(i.firstDay) || this.linkedCalendars && "left" != a ? Y += "
" : Y += '
'; var w = this.locale.monthNames[i[1][1].month()] + i[1][1].format(" YYYY"); if (this.showDropdowns) { for (var P = i[1][1].month(), x = i[1][1].year(), M = C && C.year() || this.maxYear, I = v && v.year() || this.minYear, S = x == I, B = x == M, A = '"; for (var N = '") } if (Y += '
' + w + "
", C && !C.isAfter(i.lastDay) || this.linkedCalendars && "right" != a && !this.singleDatePicker ? Y += "
"), e.each(this.locale.daysOfWeek, function (t, e) { Y += "
" + e + "
" }), Y += "
", Y += "", Y += "", null == this.endDate && this.maxSpan) { var O = this.startDate.clone().add(this.maxSpan).endOf("day"); C && !O.isBefore(C) || (C = O) } for (b = 0; b < 6; b++) { Y += "
", this.showWeekNumbers ? Y += '
' + i[b][0].week() + "
" : this.showISOWeekNumbers && (Y += '
' + i[b][0].isoWeek() + "
"); for (k = 0; k < 7; k++) { var W = []; i[b][k].isSame(new Date, "day") && W.push("today"), i[b][k].isoWeekday() > 5 && W.push("weekend"), i[b][k].month() != i[1][1].month() && W.push("off", "ends"), this.minDate && i[b][k].isBefore(this.minDate, "day") && W.push("off", "disabled"), C && i[b][k].isAfter(C, "day") && W.push("off", "disabled"), this.isInvalidDate(i[b][k]) && W.push("off", "disabled"), i[b][k].format("YYYY-MM-DD") == this.startDate.format("YYYY-MM-DD") && W.push("active", "start-date"), null != this.endDate && i[b][k].format("YYYY-MM-DD") == this.endDate.format("YYYY-MM-DD") && W.push("active", "end-date"), null != this.endDate && i[b][k] > this.startDate && i[b][k] < this.endDate && W.push("in-range"); var H = this.isCustomDate(i[b][k]); !1 !== H && ("string" == typeof H ? W.push(H) : Array.prototype.push.apply(W, H)); var j = "", R = !1; for (D = 0; D < W.length; D++)j += W[D] + " ", "disabled" == W[D] && (R = !0); R || (j += "available"), Y += '
' + i[b][k].date() + "
" } Y += "
" } Y += "", Y += "
", this.container.find(".drp-calendar." + a + " .calendar-table").html(Y) }, renderTimePicker: function (t) { if ("right" != t || this.endDate) { var e, a, i, s = this.maxDate; if (!this.maxSpan || this.maxDate && !this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate) || (s = this.startDate.clone().add(this.maxSpan)), "left" == t) a = this.startDate.clone(), i = this.minDate; else if ("right" == t) { a = this.endDate.clone(), i = this.startDate; var n = this.container.find(".drp-calendar.right .calendar-time"); if ("" != n.html() && (a.hour(isNaN(a.hour()) ? n.find(".hourselect option:selected").val() : a.hour()), a.minute(isNaN(a.minute()) ? n.find(".minuteselect option:selected").val() : a.minute()), a.second(isNaN(a.second()) ? n.find(".secondselect option:selected").val() : a.second()), !this.timePicker24Hour)) { var r = n.find(".ampmselect option:selected").val(); "PM" === r && a.hour() < 12 && a.hour(a.hour() + 12), "AM" === r && 12 === a.hour() && a.hour(0) } a.isBefore(this.startDate) && (a = this.startDate.clone()), s && a.isAfter(s) && (a = s.clone()) } e = ' ", e += ': ", this.timePickerSeconds) { e += ': " } if (!this.timePicker24Hour) { e += '" } this.container.find(".drp-calendar." + t + " .calendar-time").html(e) } }, updateFormInputs: function () { this.singleDatePicker || this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)) ? this.container.find("button.applyBtn").prop("disabled", !1) : this.container.find("button.applyBtn").prop("disabled", !0) }, move: function () { var t, a = { top: 0, left: 0 }, i = this.drops, s = e(window).width(); switch (this.parentEl.is("body") || (a = { top: this.parentEl.offset().top - this.parentEl.scrollTop(), left: this.parentEl.offset().left - this.parentEl.scrollLeft() }, s = this.parentEl[0].clientWidth + this.parentEl.offset().left), i) { case "auto": (t = this.element.offset().top + this.element.outerHeight() - a.top) + this.container.outerHeight() >= this.parentEl[0].scrollHeight && (t = this.element.offset().top - this.container.outerHeight() - a.top, i = "up"); break; case "up": t = this.element.offset().top - this.container.outerHeight() - a.top; break; default: t = this.element.offset().top + this.element.outerHeight() - a.top }this.container.css({ top: 0, left: 0, right: "auto" }); var n = this.container.outerWidth(); if (this.container.toggleClass("drop-up", "up" == i), "left" == this.opens) { var r = s - this.element.offset().left - this.element.outerWidth(); n + r > e(window).width() ? this.container.css({ top: t, right: "auto", left: 9 }) : this.container.css({ top: t, right: r, left: "auto" }) } else if ("center" == this.opens) { (o = this.element.offset().left - a.left + this.element.outerWidth() / 2 - n / 2) < 0 ? this.container.css({ top: t, right: "auto", left: 9 }) : o + n > e(window).width() ? this.container.css({ top: t, left: "auto", right: 0 }) : this.container.css({ top: t, left: o, right: "auto" }) } else { var o; (o = this.element.offset().left - a.left) + n > e(window).width() ? this.container.css({ top: t, left: "auto", right: 0 }) : this.container.css({ top: t, left: o, right: "auto" }) } }, show: function (t) { this.isShowing || (this._outsideClickProxy = e.proxy(function (t) { this.outsideClick(t) }, this), e(document).on("mousedown.daterangepicker", this._outsideClickProxy).on("touchend.daterangepicker", this._outsideClickProxy).on("click.daterangepicker", "[data-toggle=dropdown]", this._outsideClickProxy).on("focusin.daterangepicker", this._outsideClickProxy), e(window).on("resize.daterangepicker", e.proxy(function (t) { this.move(t) }, this)), this.oldStartDate = this.startDate.clone(), this.oldEndDate = this.endDate.clone(), this.previousRightTime = this.endDate.clone(), this.updateView(), this.container.show(), this.move(), this.element.trigger("show.daterangepicker", this), this.isShowing = !0) }, hide: function (t) { this.isShowing && (this.endDate || (this.startDate = this.oldStartDate.clone(), this.endDate = this.oldEndDate.clone()), this.startDate.isSame(this.oldStartDate) && this.endDate.isSame(this.oldEndDate) || this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel), this.updateElement(), e(document).off(".daterangepicker"), e(window).off(".daterangepicker"), this.container.hide(), this.element.trigger("hide.daterangepicker", this), this.isShowing = !1) }, toggle: function (t) { this.isShowing ? this.hide() : this.show() }, outsideClick: function (t) { var a = e(t.target); "focusin" == t.type || a.closest(this.element).length || a.closest(this.container).length || a.closest(".calendar-table").length || (this.hide(), this.element.trigger("outsideClick.daterangepicker", this)) }, showCalendars: function () { this.container.addClass("show-calendar"), this.move(), this.element.trigger("showCalendar.daterangepicker", this) }, hideCalendars: function () { this.container.removeClass("show-calendar"), this.element.trigger("hideCalendar.daterangepicker", this) }, clickRange: function (t) { var e = t.target.getAttribute("data-range-key"); if (this.chosenLabel = e, e == this.locale.customRangeLabel) this.showCalendars(); else { var a = this.ranges[e]; this.startDate = a[0], this.endDate = a[1], this.timePicker || (this.startDate.startOf("day"), this.endDate.endOf("day")), this.alwaysShowCalendars || this.hideCalendars(), this.clickApply() } }, clickPrev: function (t) { e(t.target).parents(".drp-calendar").hasClass("left") ? (this.leftCalendar.month.subtract(1, "month"), this.linkedCalendars && this.rightCalendar.month.subtract(1, "month")) : this.rightCalendar.month.subtract(1, "month"), this.updateCalendars() }, clickNext: function (t) { e(t.target).parents(".drp-calendar").hasClass("left") ? this.leftCalendar.month.add(1, "month") : (this.rightCalendar.month.add(1, "month"), this.linkedCalendars && this.leftCalendar.month.add(1, "month")), this.updateCalendars() }, hoverDate: function (t) { if (e(t.target).hasClass("available")) { var a = e(t.target).attr("data-title"), i = a.substr(1, 1), s = a.substr(3, 1), n = e(t.target).parents(".drp-calendar").hasClass("left") ? this.leftCalendar.calendar[i][s] : this.rightCalendar.calendar[i][s], r = this.leftCalendar, o = this.rightCalendar, h = this.startDate; this.endDate || this.container.find(".drp-calendar tbody td").each(function (t, a) { if (!e(a).hasClass("week")) { var i = e(a).attr("data-title"), s = i.substr(1, 1), l = i.substr(3, 1), c = e(a).parents(".drp-calendar").hasClass("left") ? r.calendar[s][l] : o.calendar[s][l]; c.isAfter(h) && c.isBefore(n) || c.isSame(n, "day") ? e(a).addClass("in-range") : e(a).removeClass("in-range") } }) } }, clickDate: function (t) { if (e(t.target).hasClass("available")) { var a = e(t.target).attr("data-title"), i = a.substr(1, 1), s = a.substr(3, 1), n = e(t.target).parents(".drp-calendar").hasClass("left") ? this.leftCalendar.calendar[i][s] : this.rightCalendar.calendar[i][s]; if (this.endDate || n.isBefore(this.startDate, "day")) { if (this.timePicker) { var r = parseInt(this.container.find(".left .hourselect").val(), 10); if (!this.timePicker24Hour) "PM" === (l = this.container.find(".left .ampmselect").val()) && r < 12 && (r += 12), "AM" === l && 12 === r && (r = 0); var o = parseInt(this.container.find(".left .minuteselect").val(), 10); isNaN(o) && (o = parseInt(this.container.find(".left .minuteselect option:last").val(), 10)); var h = this.timePickerSeconds ? parseInt(this.container.find(".left .secondselect").val(), 10) : 0; n = n.clone().hour(r).minute(o).second(h) } this.endDate = null, this.setStartDate(n.clone()) } else if (!this.endDate && n.isBefore(this.startDate)) this.setEndDate(this.startDate.clone()); else { if (this.timePicker) { var l; r = parseInt(this.container.find(".right .hourselect").val(), 10); if (!this.timePicker24Hour) "PM" === (l = this.container.find(".right .ampmselect").val()) && r < 12 && (r += 12), "AM" === l && 12 === r && (r = 0); o = parseInt(this.container.find(".right .minuteselect").val(), 10); isNaN(o) && (o = parseInt(this.container.find(".right .minuteselect option:last").val(), 10)); h = this.timePickerSeconds ? parseInt(this.container.find(".right .secondselect").val(), 10) : 0; n = n.clone().hour(r).minute(o).second(h) } this.setEndDate(n.clone()), this.autoApply && (this.calculateChosenLabel(), this.clickApply()) } this.singleDatePicker && (this.setEndDate(this.startDate), !this.timePicker && this.autoApply && this.clickApply()), this.updateView(), t.stopPropagation() } }, calculateChosenLabel: function () { var t = !0, e = 0; for (var a in this.ranges) { if (this.timePicker) { var i = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm"; if (this.startDate.format(i) == this.ranges[a][0].format(i) && this.endDate.format(i) == this.ranges[a][1].format(i)) { t = !1, this.chosenLabel = this.container.find(".ranges li:eq(" + e + ")").addClass("active").attr("data-range-key"); break } } else if (this.startDate.format("YYYY-MM-DD") == this.ranges[a][0].format("YYYY-MM-DD") && this.endDate.format("YYYY-MM-DD") == this.ranges[a][1].format("YYYY-MM-DD")) { t = !1, this.chosenLabel = this.container.find(".ranges li:eq(" + e + ")").addClass("active").attr("data-range-key"); break } e++ } t && (this.showCustomRangeLabel ? this.chosenLabel = this.container.find(".ranges li:last").addClass("active").attr("data-range-key") : this.chosenLabel = null, this.showCalendars()) }, clickApply: function (t) { this.hide(), this.element.trigger("apply.daterangepicker", this) }, clickCancel: function (t) { this.startDate = this.oldStartDate, this.endDate = this.oldEndDate, this.hide(), this.element.trigger("cancel.daterangepicker", this) }, monthOrYearChanged: function (t) { var a = e(t.target).closest(".drp-calendar").hasClass("left"), i = a ? "left" : "right", s = this.container.find(".drp-calendar." + i), n = parseInt(s.find(".monthselect").val(), 10), r = s.find(".yearselect").val(); a || (r < this.startDate.year() || r == this.startDate.year() && n < this.startDate.month()) && (n = this.startDate.month(), r = this.startDate.year()), this.minDate && (r < this.minDate.year() || r == this.minDate.year() && n < this.minDate.month()) && (n = this.minDate.month(), r = this.minDate.year()), this.maxDate && (r > this.maxDate.year() || r == this.maxDate.year() && n > this.maxDate.month()) && (n = this.maxDate.month(), r = this.maxDate.year()), a ? (this.leftCalendar.month.month(n).year(r), this.linkedCalendars && (this.rightCalendar.month = this.leftCalendar.month.clone().add(1, "month"))) : (this.rightCalendar.month.month(n).year(r), this.linkedCalendars && (this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, "month"))), this.updateCalendars() }, timeChanged: function (t) { var a = e(t.target).closest(".drp-calendar"), i = a.hasClass("left"), s = parseInt(a.find(".hourselect").val(), 10), n = parseInt(a.find(".minuteselect").val(), 10); isNaN(n) && (n = parseInt(a.find(".minuteselect option:last").val(), 10)); var r = this.timePickerSeconds ? parseInt(a.find(".secondselect").val(), 10) : 0; if (!this.timePicker24Hour) { var o = a.find(".ampmselect").val(); "PM" === o && s < 12 && (s += 12), "AM" === o && 12 === s && (s = 0) } if (i) { var h = this.startDate.clone(); h.hour(s), h.minute(n), h.second(r), this.setStartDate(h), this.singleDatePicker ? this.endDate = this.startDate.clone() : this.endDate && this.endDate.format("YYYY-MM-DD") == h.format("YYYY-MM-DD") && this.endDate.isBefore(h) && this.setEndDate(h.clone()) } else if (this.endDate) { var l = this.endDate.clone(); l.hour(s), l.minute(n), l.second(r), this.setEndDate(l) } this.updateCalendars(), this.updateFormInputs(), this.renderTimePicker("left"), this.renderTimePicker("right") }, elementChanged: function () { if (this.element.is("input") && this.element.val().length) { var e = this.element.val().split(this.locale.separator), a = null, i = null; 2 === e.length && (a = t(e[0], this.locale.format), i = t(e[1], this.locale.format)), (this.singleDatePicker || null === a || null === i) && (i = a = t(this.element.val(), this.locale.format)), a.isValid() && i.isValid() && (this.setStartDate(a), this.setEndDate(i), this.updateView()) } }, keydown: function (t) { 9 !== t.keyCode && 13 !== t.keyCode || this.hide(), 27 === t.keyCode && (t.preventDefault(), t.stopPropagation(), this.hide()) }, updateElement: function () { if (this.element.is("input") && this.autoUpdateInput) { var t = this.startDate.format(this.locale.format); this.singleDatePicker || (t += this.locale.separator + this.endDate.format(this.locale.format)), t !== this.element.val() && this.element.val(t).trigger("change") } }, remove: function () { this.container.remove(), this.element.off(".daterangepicker"), this.element.removeData() } }, e.fn.daterangepicker = function (t, i) { var s = e.extend(!0, {}, e.fn.daterangepicker.defaultOptions, t); return this.each(function () { var t = e(this); t.data("daterangepicker") && t.data("daterangepicker").remove(), t.data("daterangepicker", new a(t, s, i)) }), this }, a });