if ("undefined" == typeof jQuery) throw new Error("iziModal requires jQuery"); (function (t) { "use strict"; var e = t(window), i = t(document), n = "iziModal", o = { CLOSING: "closing", CLOSED: "closed", OPENING: "opening", OPENED: "opened", DESTROYED: "destroyed" }, s = function () { var t, e = document.createElement("fakeelement"), i = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "animationend", WebkitAnimation: "webkitAnimationEnd" }; for (t in i) if (void 0 !== e.style[t]) return i[t] }(), a = !!/Mobi/.test(navigator.userAgent), r = 0, l = function (t, e) { this.init(t, e) }; l.prototype = { constructor: l, init: function (e, i) { var s = this; this.$element = t(e), this.id = this.$element.attr("id"), this.content = this.$element.html(), this.state = o.CLOSED, this.options = i, this.width = 0, this.timer = null, this.timerTimeout = null, this.progressBar = null, this.isPaused = !1, this.isFullscreen = !1, this.headerHeight = 0, this.modalHeight = 0, this.$overlay = t('
'), this.$navigate = t('
Use
'), this.group = { name: this.$element.attr("data-" + n + "-group"), index: null, ids: [] }, this.$element.attr("aria-hidden", "true"), this.$element.attr("aria-labelledby", this.id), this.$element.attr("role", "dialog"), this.$element.hasClass("iziModal") || this.$element.addClass("iziModal"), void 0 === this.group.name && "" !== i.group && (this.group.name = i.group, this.$element.attr("data-" + n + "-group", i.group)), !0 === this.options.loop && this.$element.attr("data-" + n + "-loop", !0), t.each(this.options, function (t, e) { var o = s.$element.attr("data-" + n + "-" + t); try { void 0 !== o && !1 !== o && (i[t] = "" === o || ("function" == typeof e ? new Function(o) : o)) } catch (t) { } }), this.$header = t('

' + i.title + '

' + i.subtitle + '

"), !0 === i.fullscreen && (this.$header.append('"), !0 === i.rtl ? this.$header.css("padding-left", "76px") : this.$header.css("padding-right", "76px")), !0 !== i.timeoutProgressbar || isNaN(parseInt(i.timeout)) || !1 === i.timeout || 0 === i.timeout || this.$header.prepend('
'), !0 === i.iframe ? (this.$element.html('
' + this.content + "
"), null !== i.iframeHeight && this.$element.find("." + n + "-iframe").css("height", i.iframeHeight)) : this.$element.html('
' + this.content + "
"), "" === i.subtitle && this.$header.addClass(n + "-noSubtitle"), "" === i.title && "" === i.subtitle || (null !== i.headerColor && (this.$element.css("border-bottom", "3px solid " + i.headerColor), this.$header.css("background", this.options.headerColor)), null === i.icon && null === i.iconText || (this.$header.prepend(''), null !== i.icon && this.$header.find("." + n + "-header-icon").addClass(i.icon).css("color", i.iconColor), null !== i.iconText && this.$header.find("." + n + "-header-icon").html(i.iconText)), this.$element.css("overflow", "hidden").prepend(this.$header)), null === i.zindex || isNaN(parseInt(i.zindex)) || (this.$element.css("z-index", i.zindex), this.$navigate.css("z-index", i.zindex - 1), this.$overlay.css("z-index", i.zindex - 2)), "" !== i.radius && this.$element.css("border-radius", i.radius), "" !== i.padding && this.$element.find("." + n + "-content").css("padding", i.padding), "" !== i.theme && ("light" === i.theme ? this.$element.addClass(n + "-light") : this.$element.addClass(i.theme)), !0 === i.openFullscreen && (this.isFullscreen = !0, this.$element.addClass("isFullscreen")), !0 === i.rtl && this.$element.addClass(n + "-rtl"), "top" !== i.attached && "top" != this.$element.attr("data-" + n + "-attached") || this.$element.addClass("isAttachedTop"), "bottom" !== i.attached && "bottom" != this.$element.attr("data-" + n + "-attached") || this.$element.addClass("isAttachedBottom"), function () { t(document.body).find("style[rel=" + s.id + "]").remove(); var e = /%|px|em|cm/, o = String(i.width).split(e), a = String(i.width), r = "px"; o = String(o).split(",")[0], isNaN(i.width) && (r = -1 != String(i.width).indexOf("%") ? "%" : a.slice("-2")), s.$element.css({ "margin-left": -o / 2 + r, "max-width": parseInt(o) + r }), s.width = s.$element.outerWidth(), parseInt(o) > s.width && (s.width = parseInt(o)), s.mediaQueries = '", t(document.body).append(s.mediaQueries), s.$element.css("margin-top", parseInt(-s.$element.innerHeight() / 2) + "px") }() }, setGroup: function (e) { var i = this, o = this.group.name || e; if (this.group.ids = [], void 0 !== e && e !== this.group.name && (o = e, this.group.name = o, this.$element.attr("data-" + n + "-group", o)), void 0 !== o && "" !== o) { var s = 0; t.each(t("." + n + "[data-" + n + "-group=" + o + "]"), function (e, n) { i.group.ids.push(t(this).attr("id")), i.id == t(this).attr("id") && (i.group.index = s), s++ }) } }, toggle: function () { this.state == o.OPENED && this.close(), this.state == o.CLOSED && this.open() }, open: function (e) { function r() { l.state = o.OPENED, l.$element.trigger(o.OPENED), l.options.onOpened && "function" == typeof l.options.onOpened && l.options.onOpened(l) } var l = this; if (this.state == o.CLOSED) { if (l.$element.off("click", "[data-" + n + "-close]").on("click", "[data-" + n + "-close]", function (e) { e.preventDefault(); var i = t(e.currentTarget).attr("data-" + n + "-transitionOut"); void 0 !== i ? l.close({ transition: i }) : l.close() }), l.$element.off("click", "[data-" + n + "-fullscreen]").on("click", "[data-" + n + "-fullscreen]", function (t) { t.preventDefault(), !0 === l.isFullscreen ? (l.isFullscreen = !1, l.$element.removeClass("isFullscreen")) : (l.isFullscreen = !0, l.$element.addClass("isFullscreen")), l.options.onFullscreen && "function" == typeof l.options.onFullscreen && l.options.onFullscreen(l), l.$element.trigger("fullscreen", l) }), l.$navigate.off("click", "." + n + "-navigate-next").on("click", "." + n + "-navigate-next", function (t) { l.next(t) }), l.$element.off("click", "[data-" + n + "-next]").on("click", "[data-" + n + "-next]", function (t) { l.next(t) }), l.$navigate.off("click", "." + n + "-navigate-prev").on("click", "." + n + "-navigate-prev", function (t) { l.prev(t) }), l.$element.off("click", "[data-" + n + "-prev]").on("click", "[data-" + n + "-prev]", function (t) { l.prev(t) }), this.setGroup(), this.state = o.OPENING, this.$element.trigger(o.OPENING), this.$element.attr("aria-hidden", "false"), !0 === this.options.iframe) { this.$element.find("." + n + "-content").addClass(n + "-content-loader"), this.$element.find("." + n + "-iframe").on("load", function () { t(this).parent().removeClass(n + "-content-loader") }); var d = null; try { d = "" !== t(e.currentTarget).attr("href") ? t(e.currentTarget).attr("href") : null } catch (t) { } if (null === this.options.iframeURL || null !== d && void 0 !== d || (d = this.options.iframeURL), null === d || void 0 === d) throw new Error("Failed to find iframe URL"); this.$element.find("." + n + "-iframe").attr("src", d) } (this.options.bodyOverflow || a) && (t("html").addClass(n + "-isOverflow"), a && t("body").css("overflow", "hidden")), this.options.onOpening && "function" == typeof this.options.onOpening && this.options.onOpening(this), function () { if (l.group.ids.length > 1) { l.$navigate.appendTo("body"), l.$navigate.addClass(l.options.transitionInOverlay), !0 === l.options.navigateCaption && l.$navigate.find("." + n + "-navigate-caption").show(), !0 === l.options.navigateArrows || "closeToModal" === l.options.navigateArrows ? (l.$navigate.find("." + n + "-navigate-prev").css("margin-left", -(l.width / 2 + 84)), l.$navigate.find("." + n + "-navigate-next").css("margin-right", -(l.width / 2 + 84))) : (l.$navigate.find("." + n + "-navigate-prev").css("left", 0), l.$navigate.find("." + n + "-navigate-next").css("right", 0)); 0 === l.group.index && 0 === t("." + n + "[data-" + n + '-group="' + l.group.name + '"][data-' + n + "-loop]").length && !1 === l.options.loop && l.$navigate.find("." + n + "-navigate-prev").hide(), l.group.index + 1 === l.group.ids.length && 0 === t("." + n + "[data-" + n + '-group="' + l.group.name + '"][data-' + n + "-loop]").length && !1 === l.options.loop && l.$navigate.find("." + n + "-navigate-next").hide() } !0 === l.options.overlay && l.$overlay.appendTo("body"), l.options.transitionInOverlay && l.$overlay.addClass(l.options.transitionInOverlay); var i = l.options.transitionIn; "object" == typeof e && (void 0 === e.transition && void 0 === e.transitionIn || (i = e.transition || e.transitionIn)), "" !== i ? (l.$element.addClass("transitionIn " + i).show(), l.$element.find("." + n + "-wrap").one(s, function () { l.$element.removeClass(i + " transitionIn"), l.$overlay.removeClass(l.options.transitionInOverlay), l.$navigate.removeClass(l.options.transitionInOverlay), r() })) : (l.$element.show(), r()), !0 !== l.options.pauseOnHover || !0 !== l.options.pauseOnHover || !1 === l.options.timeout || isNaN(parseInt(l.options.timeout)) || !1 === l.options.timeout || 0 === l.options.timeout || (l.$element.off("mouseenter").on("mouseenter", function (t) { t.preventDefault(), l.isPaused = !0 }), l.$element.off("mouseleave").on("mouseleave", function (t) { t.preventDefault(), l.isPaused = !1 })) }(), !1 === this.options.timeout || isNaN(parseInt(this.options.timeout)) || !1 === this.options.timeout || 0 === this.options.timeout || (!0 === this.options.timeoutProgressbar ? (this.progressBar = { hideEta: null, maxHideTime: null, currentTime: (new Date).getTime(), el: this.$element.find("." + n + "-progressbar > div"), updateProgress: function () { if (!l.isPaused) { l.progressBar.currentTime = l.progressBar.currentTime + 10; var t = (l.progressBar.hideEta - l.progressBar.currentTime) / l.progressBar.maxHideTime * 100; l.progressBar.el.width(t + "%"), t < 0 && l.close() } } }, this.options.timeout > 0 && (this.progressBar.maxHideTime = parseFloat(this.options.timeout), this.progressBar.hideEta = (new Date).getTime() + this.progressBar.maxHideTime, this.timerTimeout = setInterval(this.progressBar.updateProgress, 10))) : this.timerTimeout = setTimeout(function () { l.close() }, l.options.timeout)), this.options.overlayClose && !this.$element.hasClass(this.options.transitionOut) && this.$overlay.click(function () { l.close() }), this.options.focusInput && this.$element.find(":input:not(button):enabled:visible:first").focus(), function t() { l.recalculateLayout(), l.timer = setTimeout(t, 300) }(), function () { if (l.options.history) { var t = document.title; document.title = t + " - " + l.options.title, document.title = t } }(), i.keydown(function (t) { l.options.closeOnEscape && 27 === t.keyCode && l.close() }) } }, close: function (e) { function r() { l.state = o.CLOSED, l.$element.trigger(o.CLOSED), !0 === l.options.iframe && l.$element.find("." + n + "-iframe").attr("src", ""), (l.options.bodyOverflow || a) && (t("html").removeClass(n + "-isOverflow"), a && t("body").css("overflow", "auto")), l.options.onClosed && "function" == typeof l.options.onClosed && l.options.onClosed(l), !0 === l.options.restoreDefaultContent && l.$element.find("." + n + "-content").html(l.content), void 0 === t("." + n + ":visible").attr("id") && t("html").removeClass(n + "-isAttached") } var l = this; if (this.state == o.OPENED || this.state == o.OPENING) { i.off("keydown"), this.state = o.CLOSING, this.$element.trigger(o.CLOSING), this.$element.attr("aria-hidden", "true"), clearTimeout(this.timer), clearTimeout(this.timerTimeout), l.options.onClosing && "function" == typeof l.options.onClosing && l.options.onClosing(this); var d = this.options.transitionOut; if ("object" == typeof e && (void 0 === e.transition && void 0 === e.transitionOut || (d = e.transition || e.transitionOut)), "" !== d) { var h = "light" == this.options.theme ? n + "-light" : this.options.theme; this.$element.attr("class", n + " transitionOut " + d + " " + h + " " + String(!0 === this.isFullscreen ? "isFullscreen" : "") + " " + String(this.$element.hasClass("isAttached") ? "isAttached" : "") + " " + String("top" === this.options.attached ? "isAttachedTop" : "") + " " + String("bottom" === this.options.attached ? "isAttachedBottom" : "") + (this.options.rtl ? n + "-rtl" : "")), this.$overlay.attr("class", n + "-overlay " + this.options.transitionOutOverlay), this.$navigate.attr("class", n + "-navigate " + this.options.transitionOutOverlay), this.$element.one(s, function () { l.$element.hasClass(d) && l.$element.removeClass(d + " transitionOut").hide(), l.$overlay.removeClass(l.options.transitionOutOverlay).remove(), l.$navigate.removeClass(l.options.transitionOutOverlay).remove(), r() }) } else this.$element.hide(), this.$overlay.remove(), this.$navigate.remove(), r() } }, next: function (e) { var i = this, o = "fadeInRight", s = "fadeOutLeft", a = t("." + n + ":visible"), r = {}; r.out = this, void 0 !== e && "object" != typeof e ? (e.preventDefault(), a = t(e.currentTarget), o = a.attr("data-" + n + "-transitionIn"), s = a.attr("data-" + n + "-transitionOut")) : void 0 !== e && (void 0 !== e.transitionIn && (o = e.transitionIn), void 0 !== e.transitionOut && (s = e.transitionOut)), this.close({ transition: s }), setTimeout(function () { for (var e = t("." + n + "[data-" + n + '-group="' + i.group.name + '"][data-' + n + "-loop]").length, s = i.group.index + 1; s <= i.group.ids.length; s++) { try { r.in = t("#" + i.group.ids[s]).data().iziModal } catch (t) { console.info("No next modal") } if (void 0 !== r.in) { t("#" + i.group.ids[s]).iziModal("open", { transition: o }); break } if (s == i.group.ids.length && e > 0 || !0 === i.options.loop) for (var a = 0; a <= i.group.ids.length; a++) if (r.in = t("#" + i.group.ids[a]).data().iziModal, void 0 !== r.in) { t("#" + i.group.ids[a]).iziModal("open", { transition: o }); break } } }, 200), t(document).trigger(n + "-group-change", r) }, prev: function (e) { var i = this, o = "fadeInLeft", s = "fadeOutRight", a = t("." + n + ":visible"), r = {}; r.out = this, void 0 !== e && "object" != typeof e ? (e.preventDefault(), a = t(e.currentTarget), o = a.attr("data-" + n + "-transitionIn"), s = a.attr("data-" + n + "-transitionOut")) : void 0 !== e && (void 0 !== e.transitionIn && (o = e.transitionIn), void 0 !== e.transitionOut && (s = e.transitionOut)), this.close({ transition: s }), setTimeout(function () { for (var e = t("." + n + "[data-" + n + '-group="' + i.group.name + '"][data-' + n + "-loop]").length, s = i.group.index; s >= 0; s--) { try { r.in = t("#" + i.group.ids[s - 1]).data().iziModal } catch (t) { console.info("No previous modal") } if (void 0 !== r.in) { t("#" + i.group.ids[s - 1]).iziModal("open", { transition: o }); break } if (0 === s && e > 0 || !0 === i.options.loop) for (var a = i.group.ids.length - 1; a >= 0; a--) if (r.in = t("#" + i.group.ids[a]).data().iziModal, void 0 !== r.in) { t("#" + i.group.ids[a]).iziModal("open", { transition: o }); break } } }, 200), t(document).trigger(n + "-group-change", r) }, destroy: function () { var e = t.Event("destroy"); this.$element.trigger(e), i.off("keydown"), clearTimeout(this.timer), clearTimeout(this.timerTimeout), !0 === this.options.iframe && this.$element.find("." + n + "-iframe").remove(), this.$element.html(this.$element.find("." + n + "-content").html()), i.find("style[rel=" + this.id + "]").remove(), this.$element.off("click", "[data-" + n + "-close]"), this.$element.off("click", "[data-" + n + "-fullscreen]"), this.$element.off("." + n).removeData(n).attr("style", ""), this.$overlay.remove(), this.$navigate.remove(), this.$element.trigger(o.DESTROYED), this.$element = null }, getState: function () { return this.state }, getGroup: function () { return this.group }, setTitle: function (t) { null !== this.options.title && (this.$header.find("." + n + "-header-title").html(t), this.options.title = t) }, setSubtitle: function (t) { null !== this.options.subtitle && (this.$header.find("." + n + "-header-subtitle").html(t), this.options.subtitle = t) }, setIcon: function (t) { 0 === this.$header.find("." + n + "-header-icon").length && this.$header.prepend(''), this.$header.find("." + n + "-header-icon").attr("class", n + "-header-icon " + t), this.options.icon = t }, setIconText: function (t) { this.$header.find("." + n + "-header-icon").html(t), this.options.iconText = t }, setHeaderColor: function (t) { this.$element.css("border-bottom", "3px solid " + t), this.$header.css("background", t), this.options.headerColor = t }, setZindex: function (t) { isNaN(parseInt(this.options.zindex)) || (this.options.zindex = t, this.$element.css("z-index", t), this.$navigate.css("z-index", t - 1), this.$overlay.css("z-index", t - 2)) }, setTransitionIn: function (t) { this.options.transitionIn = param.transition }, setTransitionOut: function (t) { this.options.transitionOut = param.transition }, startLoading: function () { this.$element.find("." + n + "-loader").length || this.$element.append('
') }, stopLoading: function () { var t = this; this.$element.find("." + n + "-loader").removeClass(this.options.transitionInOverlay).addClass(this.options.transitionOutOverlay), this.$element.find("." + n + "-loader").one(s, function () { t.$element.find("." + n + "-loader").removeClass(t.options.transitionOutOverlay).remove() }) }, recalculateLayout: function () { this.$element.find("." + n + "-header").length && (this.headerHeight = parseInt(this.$element.find("." + n + "-header").innerHeight()) + 2, this.$element.css("overflow", "hidden")); var i = e.height(), s = this.$element.outerHeight(), a = this.$element.find("." + n + "-content")[0].scrollHeight, r = parseInt(-(this.$element.innerHeight() + 1) / 2) + "px"; if (s !== this.modalHeight && (this.modalHeight = s, this.options.onResize && "function" == typeof this.options.onResize && this.options.onResize(this)), this.state == o.OPENED || this.state == o.OPENING) if (!0 === this.options.iframe) i < this.options.iframeHeight + this.headerHeight || !0 === this.isFullscreen ? (t("html").addClass(n + "-isAttached"), this.$element.addClass("isAttached"), this.$element.find("." + n + "-iframe").css({ height: parseInt(i - this.headerHeight) + "px" })) : (t("html").removeClass(n + "-isAttached"), this.$element.removeClass("isAttached"), this.$element.find("." + n + "-iframe").css({ height: parseInt(this.options.iframeHeight) + "px" })); else { i > a + this.headerHeight && !0 !== this.isFullscreen && (t("html").removeClass(n + "-isAttached"), this.$element.removeClass("isAttached"), this.$element.find("." + n + "-wrap").css({ height: "auto" })), (a + this.headerHeight > i || Math.ceil(this.$element.innerHeight()) < a || !0 === this.isFullscreen) && (t("html").hasClass(n + "-isAttached") || (t("html").addClass(n + "-isAttached"), this.$element.addClass("isAttached")), this.$element.find("." + n + "-wrap").css({ height: parseInt(i - this.headerHeight) + "px" })); var l = this.$element.find("." + n + "-wrap").scrollTop(), d = this.$element.find("." + n + "-content").innerHeight(); this.$element.find("." + n + "-wrap").innerHeight() + l < d - 50 ? this.$element.addClass("hasScroll") : this.$element.removeClass("hasScroll") } this.$element.css("margin-top") == r || "0px" == this.$element.css("margin-top") || t("html").hasClass(n + "-isAttached") || this.$element.css("margin-top", r) } }, i.off("click", "[data-" + n + "-open]").on("click", "[data-" + n + "-open]", function (e) { e.preventDefault(); var i = t("." + n + ":visible").attr("id"), o = t(e.currentTarget).attr("data-" + n + "-open"), s = t(e.currentTarget).attr("data-" + n + "-transitionIn"), a = t(e.currentTarget).attr("data-" + n + "-transitionOut"); void 0 !== a ? t("#" + i).iziModal("close", { transition: a }) : t("#" + i).iziModal("close"), setTimeout(function () { void 0 !== s ? t("#" + o).iziModal("open", { transition: s }) : t("#" + o).iziModal("open") }, 200) }), i.off("keyup").on("keyup", function (e) { var i = t("." + n + ":visible").attr("id"), o = t("#" + i).iziModal("getGroup"), s = e || window.event, a = s.target || s.srcElement; void 0 === i || void 0 === o || s.ctrlKey || s.metaKey || s.altKey || "INPUT" === a.tagName.toUpperCase() || "TEXTAREA" == a.tagName.toUpperCase() || (37 === s.keyCode ? t("#" + i).iziModal("prev", s) : 39 === s.keyCode && t("#" + i).iziModal("next", s)) }), t.fn[n] = function (e, i) { for (var o = this, s = 0; s < o.length; s++) { var a = t(o[s]), d = a.data(n), h = t.extend({}, t.fn[n].defaults, a.data(), "object" == typeof e && e); if (d || e && "object" != typeof e) { if ("string" == typeof e && void 0 !== d) return d[e].apply(d, [].concat(i)) } else a.data(n, d = new l(a, h)); h.autoOpen && (isNaN(parseInt(h.autoOpen)) ? !0 === h.autoOpen && setTimeout(function () { d.open() }, 0) : setTimeout(function () { d.open() }, h.autoOpen), r++) } return this }, t.fn[n].defaults = { title: "", subtitle: "", headerColor: "#88A0B9", theme: "", attached: "", icon: null, iconText: null, iconColor: "", rtl: !1, width: 600, padding: 0, radius: 3, zindex: 999, iframe: !1, iframeHeight: 400, iframeURL: null, focusInput: !0, group: "", loop: !1, navigateCaption: !0, navigateArrows: !0, history: !0, restoreDefaultContent: !1, autoOpen: 0, bodyOverflow: !1, fullscreen: !1, openFullscreen: !1, closeOnEscape: !1, overlay: !0, overlayClose: !1, overlayColor: "rgba(0, 0, 0, 0.4)", timeout: !1, timeoutProgressbar: !1, pauseOnHover: !1, timeoutProgressbarColor: "rgba(255,255,255,0.5)", transitionIn: "comingIn", transitionOut: "comingOut", transitionInOverlay: "fadeIn", transitionOutOverlay: "fadeOut", onFullscreen: function () { }, onResize: function () { }, onOpening: function () { }, onOpened: function () { }, onClosing: function () { }, onClosed: function () { } }, t.fn[n].Constructor = l }).call(this, window.jQuery);