/*! ng-dialog - v0.1.8 (https://github.com/likeastore/ngDialog) */
!function (a, b) { "use strict"; var c = b.module("ngDialog", []), d = b.element, e = b.isDefined, f = (document.body || document.documentElement).style, g = e(f.animation) || e(f.WebkitAnimation) || e(f.MozAnimation) || e(f.MsAnimation) || e(f.OAnimation), h = "animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend"; c.provider("ngDialog", function () { var c, e = this.defaults = { className: "ngdialog-theme-default", plain: !1, showClose: !0, closeByDocument: !0, closeByEscape: !0 }, f = 0, i = 0; this.$get = ["$document", "$templateCache", "$compile", "$q", "$http", "$rootScope", "$timeout", function (j, k, l, m, n, o, p) { var q = j.find("body"), r = { onDocumentKeydown: function (a) { 27 === a.keyCode && s.close() }, closeDialog: function (b) { "undefined" != typeof a.Hammer ? a.Hammer(b[0]).off("tap", c) : b.unbind("click"), 1 === i && q.unbind("keydown"), b.hasClass("ngdialog-closing") || (i -= 1), g ? b.unbind(h).bind(h, function () { b.scope().$destroy(), b.remove(), 0 === i && q.removeClass("ngdialog-open") }).addClass("ngdialog-closing") : (b.scope().$destroy(), b.remove(), 0 === i && q.removeClass("ngdialog-open")), o.$broadcast("ngDialog.closed", b) } }, s = { open: function (g) { function h(a) { return a ? b.isString(a) && t.plain ? a : k.get(a) || n.get(a, { cache: !0 }) : "Empty template" } var j = this, t = b.copy(e); g = g || {}, b.extend(t, g), f += 1, j.latestID = "ngdialog" + f; var u, v = b.isObject(t.scope) ? t.scope.$new() : o.$new(); m.when(h(t.template)).then(function (e) { return e = b.isString(e) ? e : e.data && b.isString(e.data) ? e.data : "", k.put(t.template, e), t.showClose && (e += '
'), j.$result = u = d(''), u.html('' + e + "
"), t.controller && b.isString(t.controller) && u.attr("ng-controller", t.controller), t.className && u.addClass(t.className), t.data && b.isString(t.data) && (v.ngDialogData = "{" === t.data.replace(/^\s*/, "")[0] ? b.fromJson(t.data) : t.data), v.closeThisDialog = function () { r.closeDialog(u) }, p(function () { l(u)(v), q.addClass("ngdialog-open").append(u) }), t.closeByEscape && q.bind("keydown", r.onDocumentKeydown), t.submitByEnter && q.bind("keydown", function (a) { 13 === a.keyCode && u.scope().$eval(u.find(".ngdialog-submit").attr("ng-click")) }), c = function (a) { var b = t.closeByDocument ? d(a.target).hasClass("ngdialog-overlay") : !1, c = d(a.target).hasClass("ngdialog-close"); (b || c) && s.close(u.attr("id")) }, "undefined" != typeof a.Hammer ? a.Hammer(u[0]).on("tap", c) : u.bind("click", c), i += 1, o.$broadcast("ngDialog.opened", u), s }) }, close: function (a) { var b = d(document.getElementById(a)); return b.length ? r.closeDialog(b) : s.closeAll(), s }, closeAll: function () { var a = document.querySelectorAll(".ngdialog"); b.forEach(a, function (a) { r.closeDialog(d(a)) }) } }; return s } ] }), c.directive("ngDialog", ["ngDialog", function (a) { return { restrict: "A", link: function (c, d, e) { d.on("click", function (c) { c.preventDefault(), b.isDefined(e.ngDialogClosePrevious) && a.close(e.ngDialogClosePrevious), a.open({ template: e.ngDialog, className: e.ngDialogClass, controller: e.ngDialogController, scope: e.ngDialogScope, data: e.ngDialogData, showClose: "false" === e.ngDialogShowClose ? !1 : !0, closeByDocument: "false" === e.ngDialogCloseByDocument ? !1 : !0, closeByEscape: "false" === e.ngDialogCloseByEscape ? !1 : !0, submitByEnter: "false" === e.ngDialogSubmitByEnter ? !1 : !0 }) }) } } } ]) } (window, window.angular);