HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/kemi.komma.pro/wwwroot/js/kms/angular.js
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

/*
 AngularJS v1.5.8
 (c) 2010-2016 Google, Inc. http://angularjs.org
 License: MIT
 */
(function (C) {
  'use strict';

  function N(a) {
    return function () {
      var b = arguments[0],
          d;
      d = "[" + (a ? a + ":" : "") + b + "] http://errors.angularjs.org/1.5.8/" + (a ? a + "/" : "") + b;

      for (b = 1; b < arguments.length; b++) {
        d = d + (1 == b ? "?" : "&") + "p" + (b - 1) + "=";
        var c = encodeURIComponent,
            e;
        e = arguments[b];
        e = "function" == typeof e ? e.toString().replace(/ \{[\s\S]*$/, "") : "undefined" == typeof e ? "undefined" : "string" != typeof e ? JSON.stringify(e) : e;
        d += c(e);
      }

      return Error(d);
    };
  }

  function ta(a) {
    if (null == a || Va(a)) return !1;
    if (L(a) || G(a) || F && a instanceof F) return !0;
    var b = "length" in Object(a) && a.length;
    return T(b) && (0 <= b && (b - 1 in a || a instanceof Array) || "function" == typeof a.item);
  }

  function q(a, b, d) {
    var c, e;
    if (a) if (z(a)) for (c in a) {
      "prototype" == c || "length" == c || "name" == c || a.hasOwnProperty && !a.hasOwnProperty(c) || b.call(d, a[c], c, a);
    } else if (L(a) || ta(a)) {
      var f = "object" !== _typeof(a);

      c = 0;

      for (e = a.length; c < e; c++) {
        (f || c in a) && b.call(d, a[c], c, a);
      }
    } else if (a.forEach && a.forEach !== q) a.forEach(b, d, a);else if (sc(a)) for (c in a) {
      b.call(d, a[c], c, a);
    } else if ("function" === typeof a.hasOwnProperty) for (c in a) {
      a.hasOwnProperty(c) && b.call(d, a[c], c, a);
    } else for (c in a) {
      ua.call(a, c) && b.call(d, a[c], c, a);
    }
    return a;
  }

  function tc(a, b, d) {
    for (var c = Object.keys(a).sort(), e = 0; e < c.length; e++) {
      b.call(d, a[c[e]], c[e]);
    }

    return c;
  }

  function uc(a) {
    return function (b, d) {
      a(d, b);
    };
  }

  function Yd() {
    return ++pb;
  }

  function Pb(a, b, d) {
    for (var c = a.$$hashKey, e = 0, f = b.length; e < f; ++e) {
      var g = b[e];
      if (D(g) || z(g)) for (var h = Object.keys(g), k = 0, l = h.length; k < l; k++) {
        var m = h[k],
            n = g[m];
        d && D(n) ? da(n) ? a[m] = new Date(n.valueOf()) : Wa(n) ? a[m] = new RegExp(n) : n.nodeName ? a[m] = n.cloneNode(!0) : Qb(n) ? a[m] = n.clone() : (D(a[m]) || (a[m] = L(n) ? [] : {}), Pb(a[m], [n], !0)) : a[m] = n;
      }
    }

    c ? a.$$hashKey = c : delete a.$$hashKey;
    return a;
  }

  function S(a) {
    return Pb(a, va.call(arguments, 1), !1);
  }

  function Zd(a) {
    return Pb(a, va.call(arguments, 1), !0);
  }

  function Z(a) {
    return parseInt(a, 10);
  }

  function Rb(a, b) {
    return S(Object.create(a), b);
  }

  function A() {}

  function Xa(a) {
    return a;
  }

  function ha(a) {
    return function () {
      return a;
    };
  }

  function vc(a) {
    return z(a.toString) && a.toString !== ma;
  }

  function y(a) {
    return "undefined" === typeof a;
  }

  function w(a) {
    return "undefined" !== typeof a;
  }

  function D(a) {
    return null !== a && "object" === _typeof(a);
  }

  function sc(a) {
    return null !== a && "object" === _typeof(a) && !wc(a);
  }

  function G(a) {
    return "string" === typeof a;
  }

  function T(a) {
    return "number" === typeof a;
  }

  function da(a) {
    return "[object Date]" === ma.call(a);
  }

  function z(a) {
    return "function" === typeof a;
  }

  function Wa(a) {
    return "[object RegExp]" === ma.call(a);
  }

  function Va(a) {
    return a && a.window === a;
  }

  function Ya(a) {
    return a && a.$evalAsync && a.$watch;
  }

  function Ga(a) {
    return "boolean" === typeof a;
  }

  function $d(a) {
    return a && T(a.length) && ae.test(ma.call(a));
  }

  function Qb(a) {
    return !(!a || !(a.nodeName || a.prop && a.attr && a.find));
  }

  function be(a) {
    var b = {};
    a = a.split(",");
    var d;

    for (d = 0; d < a.length; d++) {
      b[a[d]] = !0;
    }

    return b;
  }

  function wa(a) {
    return Q(a.nodeName || a[0] && a[0].nodeName);
  }

  function Za(a, b) {
    var d = a.indexOf(b);
    0 <= d && a.splice(d, 1);
    return d;
  }

  function pa(a, b) {
    function d(a, b) {
      var d = b.$$hashKey,
          e;

      if (L(a)) {
        e = 0;

        for (var f = a.length; e < f; e++) {
          b.push(c(a[e]));
        }
      } else if (sc(a)) for (e in a) {
        b[e] = c(a[e]);
      } else if (a && "function" === typeof a.hasOwnProperty) for (e in a) {
        a.hasOwnProperty(e) && (b[e] = c(a[e]));
      } else for (e in a) {
        ua.call(a, e) && (b[e] = c(a[e]));
      }

      d ? b.$$hashKey = d : delete b.$$hashKey;
      return b;
    }

    function c(a) {
      if (!D(a)) return a;
      var b = f.indexOf(a);
      if (-1 !== b) return g[b];
      if (Va(a) || Ya(a)) throw xa("cpws");
      var b = !1,
          c = e(a);
      void 0 === c && (c = L(a) ? [] : Object.create(wc(a)), b = !0);
      f.push(a);
      g.push(c);
      return b ? d(a, c) : c;
    }

    function e(a) {
      switch (ma.call(a)) {
        case "[object Int8Array]":
        case "[object Int16Array]":
        case "[object Int32Array]":
        case "[object Float32Array]":
        case "[object Float64Array]":
        case "[object Uint8Array]":
        case "[object Uint8ClampedArray]":
        case "[object Uint16Array]":
        case "[object Uint32Array]":
          return new a.constructor(c(a.buffer), a.byteOffset, a.length);

        case "[object ArrayBuffer]":
          if (!a.slice) {
            var b = new ArrayBuffer(a.byteLength);
            new Uint8Array(b).set(new Uint8Array(a));
            return b;
          }

          return a.slice(0);

        case "[object Boolean]":
        case "[object Number]":
        case "[object String]":
        case "[object Date]":
          return new a.constructor(a.valueOf());

        case "[object RegExp]":
          return b = new RegExp(a.source, a.toString().match(/[^\/]*$/)[0]), b.lastIndex = a.lastIndex, b;

        case "[object Blob]":
          return new a.constructor([a], {
            type: a.type
          });
      }

      if (z(a.cloneNode)) return a.cloneNode(!0);
    }

    var f = [],
        g = [];

    if (b) {
      if ($d(b) || "[object ArrayBuffer]" === ma.call(b)) throw xa("cpta");
      if (a === b) throw xa("cpi");
      L(b) ? b.length = 0 : q(b, function (a, d) {
        "$$hashKey" !== d && delete b[d];
      });
      f.push(a);
      g.push(b);
      return d(a, b);
    }

    return c(a);
  }

  function na(a, b) {
    if (a === b) return !0;
    if (null === a || null === b) return !1;
    if (a !== a && b !== b) return !0;

    var d = _typeof(a),
        c;

    if (d == _typeof(b) && "object" == d) if (L(a)) {
      if (!L(b)) return !1;

      if ((d = a.length) == b.length) {
        for (c = 0; c < d; c++) {
          if (!na(a[c], b[c])) return !1;
        }

        return !0;
      }
    } else {
      if (da(a)) return da(b) ? na(a.getTime(), b.getTime()) : !1;
      if (Wa(a)) return Wa(b) ? a.toString() == b.toString() : !1;
      if (Ya(a) || Ya(b) || Va(a) || Va(b) || L(b) || da(b) || Wa(b)) return !1;
      d = U();

      for (c in a) {
        if ("$" !== c.charAt(0) && !z(a[c])) {
          if (!na(a[c], b[c])) return !1;
          d[c] = !0;
        }
      }

      for (c in b) {
        if (!(c in d) && "$" !== c.charAt(0) && w(b[c]) && !z(b[c])) return !1;
      }

      return !0;
    }
    return !1;
  }

  function $a(a, b, d) {
    return a.concat(va.call(b, d));
  }

  function ab(a, b) {
    var d = 2 < arguments.length ? va.call(arguments, 2) : [];
    return !z(b) || b instanceof RegExp ? b : d.length ? function () {
      return arguments.length ? b.apply(a, $a(d, arguments, 0)) : b.apply(a, d);
    } : function () {
      return arguments.length ? b.apply(a, arguments) : b.call(a);
    };
  }

  function ce(a, b) {
    var d = b;
    "string" === typeof a && "$" === a.charAt(0) && "$" === a.charAt(1) ? d = void 0 : Va(b) ? d = "$WINDOW" : b && C.document === b ? d = "$DOCUMENT" : Ya(b) && (d = "$SCOPE");
    return d;
  }

  function bb(a, b) {
    if (!y(a)) return T(b) || (b = b ? 2 : null), JSON.stringify(a, ce, b);
  }

  function xc(a) {
    return G(a) ? JSON.parse(a) : a;
  }

  function yc(a, b) {
    a = a.replace(de, "");
    var d = Date.parse("Jan 01, 1970 00:00:00 " + a) / 6E4;
    return isNaN(d) ? b : d;
  }

  function Sb(a, b, d) {
    d = d ? -1 : 1;
    var c = a.getTimezoneOffset();
    b = yc(b, c);
    d *= b - c;
    a = new Date(a.getTime());
    a.setMinutes(a.getMinutes() + d);
    return a;
  }

  function ya(a) {
    a = F(a).clone();

    try {
      a.empty();
    } catch (b) {}

    var d = F("<div>").append(a).html();

    try {
      return a[0].nodeType === Ma ? Q(d) : d.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/, function (a, b) {
        return "<" + Q(b);
      });
    } catch (c) {
      return Q(d);
    }
  }

  function zc(a) {
    try {
      return decodeURIComponent(a);
    } catch (b) {}
  }

  function Ac(a) {
    var b = {};
    q((a || "").split("&"), function (a) {
      var c, e, f;
      a && (e = a = a.replace(/\+/g, "%20"), c = a.indexOf("="), -1 !== c && (e = a.substring(0, c), f = a.substring(c + 1)), e = zc(e), w(e) && (f = w(f) ? zc(f) : !0, ua.call(b, e) ? L(b[e]) ? b[e].push(f) : b[e] = [b[e], f] : b[e] = f));
    });
    return b;
  }

  function Tb(a) {
    var b = [];
    q(a, function (a, c) {
      L(a) ? q(a, function (a) {
        b.push(ea(c, !0) + (!0 === a ? "" : "=" + ea(a, !0)));
      }) : b.push(ea(c, !0) + (!0 === a ? "" : "=" + ea(a, !0)));
    });
    return b.length ? b.join("&") : "";
  }

  function qb(a) {
    return ea(a, !0).replace(/%26/gi, "&").replace(/%3D/gi, "=").replace(/%2B/gi, "+");
  }

  function ea(a, b) {
    return encodeURIComponent(a).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%3B/gi, ";").replace(/%20/g, b ? "%20" : "+");
  }

  function ee(a, b) {
    var d,
        c,
        e = Na.length;

    for (c = 0; c < e; ++c) {
      if (d = Na[c] + b, G(d = a.getAttribute(d))) return d;
    }

    return null;
  }

  function fe(a, b) {
    var d,
        c,
        e = {};
    q(Na, function (b) {
      b += "app";
      !d && a.hasAttribute && a.hasAttribute(b) && (d = a, c = a.getAttribute(b));
    });
    q(Na, function (b) {
      b += "app";
      var e;
      !d && (e = a.querySelector("[" + b.replace(":", "\\:") + "]")) && (d = e, c = e.getAttribute(b));
    });
    d && (e.strictDi = null !== ee(d, "strict-di"), b(d, c ? [c] : [], e));
  }

  function Bc(a, b, d) {
    D(d) || (d = {});
    d = S({
      strictDi: !1
    }, d);

    var c = function c() {
      a = F(a);

      if (a.injector()) {
        var c = a[0] === C.document ? "document" : ya(a);
        throw xa("btstrpd", c.replace(/</, "&lt;").replace(/>/, "&gt;"));
      }

      b = b || [];
      b.unshift(["$provide", function (b) {
        b.value("$rootElement", a);
      }]);
      d.debugInfoEnabled && b.push(["$compileProvider", function (a) {
        a.debugInfoEnabled(!0);
      }]);
      b.unshift("ng");
      c = cb(b, d.strictDi);
      c.invoke(["$rootScope", "$rootElement", "$compile", "$injector", function (a, b, c, d) {
        a.$apply(function () {
          b.data("$injector", d);
          c(b)(a);
        });
      }]);
      return c;
    },
        e = /^NG_ENABLE_DEBUG_INFO!/,
        f = /^NG_DEFER_BOOTSTRAP!/;

    C && e.test(C.name) && (d.debugInfoEnabled = !0, C.name = C.name.replace(e, ""));
    if (C && !f.test(C.name)) return c();
    C.name = C.name.replace(f, "");

    ca.resumeBootstrap = function (a) {
      q(a, function (a) {
        b.push(a);
      });
      return c();
    };

    z(ca.resumeDeferredBootstrap) && ca.resumeDeferredBootstrap();
  }

  function ge() {
    C.name = "NG_ENABLE_DEBUG_INFO!" + C.name;
    C.location.reload();
  }

  function he(a) {
    a = ca.element(a).injector();
    if (!a) throw xa("test");
    return a.get("$$testability");
  }

  function Cc(a, b) {
    b = b || "_";
    return a.replace(ie, function (a, c) {
      return (c ? b : "") + a.toLowerCase();
    });
  }

  function je() {
    var a;

    if (!Dc) {
      var b = rb();
      (qa = y(b) ? C.jQuery : b ? C[b] : void 0) && qa.fn.on ? (F = qa, S(qa.fn, {
        scope: Oa.scope,
        isolateScope: Oa.isolateScope,
        controller: Oa.controller,
        injector: Oa.injector,
        inheritedData: Oa.inheritedData
      }), a = qa.cleanData, qa.cleanData = function (b) {
        for (var c, e = 0, f; null != (f = b[e]); e++) {
          (c = qa._data(f, "events")) && c.$destroy && qa(f).triggerHandler("$destroy");
        }

        a(b);
      }) : F = O;
      ca.element = F;
      Dc = !0;
    }
  }

  function sb(a, b, d) {
    if (!a) throw xa("areq", b || "?", d || "required");
    return a;
  }

  function Pa(a, b, d) {
    d && L(a) && (a = a[a.length - 1]);
    sb(z(a), b, "not a function, got " + (a && "object" === _typeof(a) ? a.constructor.name || "Object" : _typeof(a)));
    return a;
  }

  function Qa(a, b) {
    if ("hasOwnProperty" === a) throw xa("badname", b);
  }

  function Ec(a, b, d) {
    if (!b) return a;
    b = b.split(".");

    for (var c, e = a, f = b.length, g = 0; g < f; g++) {
      c = b[g], a && (a = (e = a)[c]);
    }

    return !d && z(a) ? ab(e, a) : a;
  }

  function tb(a) {
    for (var b = a[0], d = a[a.length - 1], c, e = 1; b !== d && (b = b.nextSibling); e++) {
      if (c || a[e] !== b) c || (c = F(va.call(a, 0, e))), c.push(b);
    }

    return c || a;
  }

  function U() {
    return Object.create(null);
  }

  function ke(a) {
    function b(a, b, c) {
      return a[b] || (a[b] = c());
    }

    var d = N("$injector"),
        c = N("ng");
    a = b(a, "angular", Object);
    a.$$minErr = a.$$minErr || N;
    return b(a, "module", function () {
      var a = {};
      return function (f, g, h) {
        if ("hasOwnProperty" === f) throw c("badname", "module");
        g && a.hasOwnProperty(f) && (a[f] = null);
        return b(a, f, function () {
          function a(b, d, e, f) {
            f || (f = c);
            return function () {
              f[e || "push"]([b, d, arguments]);
              return R;
            };
          }

          function b(a, d) {
            return function (b, e) {
              e && z(e) && (e.$$moduleName = f);
              c.push([a, d, arguments]);
              return R;
            };
          }

          if (!g) throw d("nomod", f);
          var c = [],
              e = [],
              p = [],
              u = a("$injector", "invoke", "push", e),
              R = {
            _invokeQueue: c,
            _configBlocks: e,
            _runBlocks: p,
            requires: g,
            name: f,
            provider: b("$provide", "provider"),
            factory: b("$provide", "factory"),
            service: b("$provide", "service"),
            value: a("$provide", "value"),
            constant: a("$provide", "constant", "unshift"),
            decorator: b("$provide", "decorator"),
            animation: b("$animateProvider", "register"),
            filter: b("$filterProvider", "register"),
            controller: b("$controllerProvider", "register"),
            directive: b("$compileProvider", "directive"),
            component: b("$compileProvider", "component"),
            config: u,
            run: function run(a) {
              p.push(a);
              return this;
            }
          };
          h && u(h);
          return R;
        });
      };
    });
  }

  function ia(a, b) {
    if (L(a)) {
      b = b || [];

      for (var d = 0, c = a.length; d < c; d++) {
        b[d] = a[d];
      }
    } else if (D(a)) for (d in b = b || {}, a) {
      if ("$" !== d.charAt(0) || "$" !== d.charAt(1)) b[d] = a[d];
    }

    return b || a;
  }

  function le(a) {
    S(a, {
      bootstrap: Bc,
      copy: pa,
      extend: S,
      merge: Zd,
      equals: na,
      element: F,
      forEach: q,
      injector: cb,
      noop: A,
      bind: ab,
      toJson: bb,
      fromJson: xc,
      identity: Xa,
      isUndefined: y,
      isDefined: w,
      isString: G,
      isFunction: z,
      isObject: D,
      isNumber: T,
      isElement: Qb,
      isArray: L,
      version: me,
      isDate: da,
      lowercase: Q,
      uppercase: ub,
      callbacks: {
        $$counter: 0
      },
      getTestability: he,
      $$minErr: N,
      $$csp: Ba,
      reloadWithDebugInfo: ge
    });
    Ub = ke(C);
    Ub("ng", ["ngLocale"], ["$provide", function (a) {
      a.provider({
        $$sanitizeUri: ne
      });
      a.provider("$compile", Fc).directive({
        a: oe,
        input: Gc,
        textarea: Gc,
        form: pe,
        script: qe,
        select: re,
        style: se,
        option: te,
        ngBind: ue,
        ngBindHtml: ve,
        ngBindTemplate: we,
        ngClass: xe,
        ngClassEven: ye,
        ngClassOdd: ze,
        ngCloak: Ae,
        ngController: Be,
        ngForm: Ce,
        ngHide: De,
        ngIf: Ee,
        ngInclude: Fe,
        ngInit: Ge,
        ngNonBindable: He,
        ngPluralize: Ie,
        ngRepeat: Je,
        ngShow: Ke,
        ngStyle: Le,
        ngSwitch: Me,
        ngSwitchWhen: Ne,
        ngSwitchDefault: Oe,
        ngOptions: Pe,
        ngTransclude: Qe,
        ngModel: Re,
        ngList: Se,
        ngChange: Te,
        pattern: Hc,
        ngPattern: Hc,
        required: Ic,
        ngRequired: Ic,
        minlength: Jc,
        ngMinlength: Jc,
        maxlength: Kc,
        ngMaxlength: Kc,
        ngValue: Ue,
        ngModelOptions: Ve
      }).directive({
        ngInclude: We
      }).directive(vb).directive(Lc);
      a.provider({
        $anchorScroll: Xe,
        $animate: Ye,
        $animateCss: Ze,
        $$animateJs: $e,
        $$animateQueue: af,
        $$AnimateRunner: bf,
        $$animateAsyncRun: cf,
        $browser: df,
        $cacheFactory: ef,
        $controller: ff,
        $document: gf,
        $exceptionHandler: hf,
        $filter: Mc,
        $$forceReflow: jf,
        $interpolate: kf,
        $interval: lf,
        $http: mf,
        $httpParamSerializer: nf,
        $httpParamSerializerJQLike: of,
        $httpBackend: pf,
        $xhrFactory: qf,
        $jsonpCallbacks: rf,
        $location: sf,
        $log: tf,
        $parse: uf,
        $rootScope: vf,
        $q: wf,
        $$q: xf,
        $sce: yf,
        $sceDelegate: zf,
        $sniffer: Af,
        $templateCache: Bf,
        $templateRequest: Cf,
        $$testability: Df,
        $timeout: Ef,
        $window: Ff,
        $$rAF: Gf,
        $$jqLite: Hf,
        $$HashMap: If,
        $$cookieReader: Jf
      });
    }]);
  }

  function db(a) {
    return a.replace(Kf, function (a, d, c, e) {
      return e ? c.toUpperCase() : c;
    }).replace(Lf, "Moz$1");
  }

  function Nc(a) {
    a = a.nodeType;
    return 1 === a || !a || 9 === a;
  }

  function Oc(a, b) {
    var d,
        c,
        e = b.createDocumentFragment(),
        f = [];

    if (Vb.test(a)) {
      d = e.appendChild(b.createElement("div"));
      c = (Mf.exec(a) || ["", ""])[1].toLowerCase();
      c = ja[c] || ja._default;
      d.innerHTML = c[1] + a.replace(Nf, "<$1></$2>") + c[2];

      for (c = c[0]; c--;) {
        d = d.lastChild;
      }

      f = $a(f, d.childNodes);
      d = e.firstChild;
      d.textContent = "";
    } else f.push(b.createTextNode(a));

    e.textContent = "";
    e.innerHTML = "";
    q(f, function (a) {
      e.appendChild(a);
    });
    return e;
  }

  function Pc(a, b) {
    var d = a.parentNode;
    d && d.replaceChild(b, a);
    b.appendChild(a);
  }

  function O(a) {
    if (a instanceof O) return a;
    var b;
    G(a) && (a = W(a), b = !0);

    if (!(this instanceof O)) {
      if (b && "<" != a.charAt(0)) throw Wb("nosel");
      return new O(a);
    }

    if (b) {
      b = C.document;
      var d;
      a = (d = Of.exec(a)) ? [b.createElement(d[1])] : (d = Oc(a, b)) ? d.childNodes : [];
    }

    Qc(this, a);
  }

  function Xb(a) {
    return a.cloneNode(!0);
  }

  function wb(a, b) {
    b || eb(a);
    if (a.querySelectorAll) for (var d = a.querySelectorAll("*"), c = 0, e = d.length; c < e; c++) {
      eb(d[c]);
    }
  }

  function Rc(a, b, d, c) {
    if (w(c)) throw Wb("offargs");
    var e = (c = xb(a)) && c.events,
        f = c && c.handle;
    if (f) if (b) {
      var g = function g(b) {
        var c = e[b];
        w(d) && Za(c || [], d);
        w(d) && c && 0 < c.length || (a.removeEventListener(b, f, !1), delete e[b]);
      };

      q(b.split(" "), function (a) {
        g(a);
        yb[a] && g(yb[a]);
      });
    } else for (b in e) {
      "$destroy" !== b && a.removeEventListener(b, f, !1), delete e[b];
    }
  }

  function eb(a, b) {
    var d = a.ng339,
        c = d && fb[d];
    c && (b ? delete c.data[b] : (c.handle && (c.events.$destroy && c.handle({}, "$destroy"), Rc(a)), delete fb[d], a.ng339 = void 0));
  }

  function xb(a, b) {
    var d = a.ng339,
        d = d && fb[d];
    b && !d && (a.ng339 = d = ++Pf, d = fb[d] = {
      events: {},
      data: {},
      handle: void 0
    });
    return d;
  }

  function Yb(a, b, d) {
    if (Nc(a)) {
      var c = w(d),
          e = !c && b && !D(b),
          f = !b;
      a = (a = xb(a, !e)) && a.data;
      if (c) a[b] = d;else {
        if (f) return a;
        if (e) return a && a[b];
        S(a, b);
      }
    }
  }

  function zb(a, b) {
    return a.getAttribute ? -1 < (" " + (a.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").indexOf(" " + b + " ") : !1;
  }

  function Ab(a, b) {
    b && a.setAttribute && q(b.split(" "), function (b) {
      a.setAttribute("class", W((" " + (a.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").replace(" " + W(b) + " ", " ")));
    });
  }

  function Bb(a, b) {
    if (b && a.setAttribute) {
      var d = (" " + (a.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ");
      q(b.split(" "), function (a) {
        a = W(a);
        -1 === d.indexOf(" " + a + " ") && (d += a + " ");
      });
      a.setAttribute("class", W(d));
    }
  }

  function Qc(a, b) {
    if (b) if (b.nodeType) a[a.length++] = b;else {
      var d = b.length;

      if ("number" === typeof d && b.window !== b) {
        if (d) for (var c = 0; c < d; c++) {
          a[a.length++] = b[c];
        }
      } else a[a.length++] = b;
    }
  }

  function Sc(a, b) {
    return Cb(a, "$" + (b || "ngController") + "Controller");
  }

  function Cb(a, b, d) {
    9 == a.nodeType && (a = a.documentElement);

    for (b = L(b) ? b : [b]; a;) {
      for (var c = 0, e = b.length; c < e; c++) {
        if (w(d = F.data(a, b[c]))) return d;
      }

      a = a.parentNode || 11 === a.nodeType && a.host;
    }
  }

  function Tc(a) {
    for (wb(a, !0); a.firstChild;) {
      a.removeChild(a.firstChild);
    }
  }

  function Db(a, b) {
    b || wb(a);
    var d = a.parentNode;
    d && d.removeChild(a);
  }

  function Qf(a, b) {
    b = b || C;
    if ("complete" === b.document.readyState) b.setTimeout(a);else F(b).on("load", a);
  }

  function Uc(a, b) {
    var d = Eb[b.toLowerCase()];
    return d && Vc[wa(a)] && d;
  }

  function Rf(a, b) {
    var d = function d(c, _d) {
      c.isDefaultPrevented = function () {
        return c.defaultPrevented;
      };

      var f = b[_d || c.type],
          g = f ? f.length : 0;

      if (g) {
        if (y(c.immediatePropagationStopped)) {
          var h = c.stopImmediatePropagation;

          c.stopImmediatePropagation = function () {
            c.immediatePropagationStopped = !0;
            c.stopPropagation && c.stopPropagation();
            h && h.call(c);
          };
        }

        c.isImmediatePropagationStopped = function () {
          return !0 === c.immediatePropagationStopped;
        };

        var k = f.specialHandlerWrapper || Sf;
        1 < g && (f = ia(f));

        for (var l = 0; l < g; l++) {
          c.isImmediatePropagationStopped() || k(a, c, f[l]);
        }
      }
    };

    d.elem = a;
    return d;
  }

  function Sf(a, b, d) {
    d.call(a, b);
  }

  function Tf(a, b, d) {
    var c = b.relatedTarget;
    c && (c === a || Uf.call(a, c)) || d.call(a, b);
  }

  function Hf() {
    this.$get = function () {
      return S(O, {
        hasClass: function hasClass(a, b) {
          a.attr && (a = a[0]);
          return zb(a, b);
        },
        addClass: function addClass(a, b) {
          a.attr && (a = a[0]);
          return Bb(a, b);
        },
        removeClass: function removeClass(a, b) {
          a.attr && (a = a[0]);
          return Ab(a, b);
        }
      });
    };
  }

  function Ca(a, b) {
    var d = a && a.$$hashKey;
    if (d) return "function" === typeof d && (d = a.$$hashKey()), d;
    d = _typeof(a);
    return d = "function" == d || "object" == d && null !== a ? a.$$hashKey = d + ":" + (b || Yd)() : d + ":" + a;
  }

  function Ra(a, b) {
    if (b) {
      var d = 0;

      this.nextUid = function () {
        return ++d;
      };
    }

    q(a, this.put, this);
  }

  function Wc(a) {
    a = (Function.prototype.toString.call(a) + " ").replace(Vf, "");
    return a.match(Wf) || a.match(Xf);
  }

  function Yf(a) {
    return (a = Wc(a)) ? "function(" + (a[1] || "").replace(/[\s\r\n]+/, " ") + ")" : "fn";
  }

  function cb(a, b) {
    function d(a) {
      return function (b, c) {
        if (D(b)) q(b, uc(a));else return a(b, c);
      };
    }

    function c(a, b) {
      Qa(a, "service");
      if (z(b) || L(b)) b = p.instantiate(b);
      if (!b.$get) throw Ha("pget", a);
      return n[a + "Provider"] = b;
    }

    function e(a, b) {
      return function () {
        var c = B.invoke(b, this);
        if (y(c)) throw Ha("undef", a);
        return c;
      };
    }

    function f(a, b, d) {
      return c(a, {
        $get: !1 !== d ? e(a, b) : b
      });
    }

    function g(a) {
      sb(y(a) || L(a), "modulesToLoad", "not an array");
      var b = [],
          c;
      q(a, function (a) {
        function d(a) {
          var b, c;
          b = 0;

          for (c = a.length; b < c; b++) {
            var e = a[b],
                f = p.get(e[0]);
            f[e[1]].apply(f, e[2]);
          }
        }

        if (!m.get(a)) {
          m.put(a, !0);

          try {
            G(a) ? (c = Ub(a), b = b.concat(g(c.requires)).concat(c._runBlocks), d(c._invokeQueue), d(c._configBlocks)) : z(a) ? b.push(p.invoke(a)) : L(a) ? b.push(p.invoke(a)) : Pa(a, "module");
          } catch (e) {
            throw L(a) && (a = a[a.length - 1]), e.message && e.stack && -1 == e.stack.indexOf(e.message) && (e = e.message + "\n" + e.stack), Ha("modulerr", a, e.stack || e.message || e);
          }
        }
      });
      return b;
    }

    function h(a, c) {
      function d(b, e) {
        if (a.hasOwnProperty(b)) {
          if (a[b] === k) throw Ha("cdep", b + " <- " + l.join(" <- "));
          return a[b];
        }

        try {
          return l.unshift(b), a[b] = k, a[b] = c(b, e);
        } catch (f) {
          throw a[b] === k && delete a[b], f;
        } finally {
          l.shift();
        }
      }

      function e(a, c, f) {
        var g = [];
        a = cb.$$annotate(a, b, f);

        for (var h = 0, k = a.length; h < k; h++) {
          var l = a[h];
          if ("string" !== typeof l) throw Ha("itkn", l);
          g.push(c && c.hasOwnProperty(l) ? c[l] : d(l, f));
        }

        return g;
      }

      return {
        invoke: function invoke(a, b, c, d) {
          "string" === typeof c && (d = c, c = null);
          c = e(a, c, d);
          L(a) && (a = a[a.length - 1]);
          d = 11 >= Ea ? !1 : "function" === typeof a && /^(?:class\b|constructor\()/.test(Function.prototype.toString.call(a) + " ");
          return d ? (c.unshift(null), new (Function.prototype.bind.apply(a, c))()) : a.apply(b, c);
        },
        instantiate: function instantiate(a, b, c) {
          var d = L(a) ? a[a.length - 1] : a;
          a = e(a, b, c);
          a.unshift(null);
          return new (Function.prototype.bind.apply(d, a))();
        },
        get: d,
        annotate: cb.$$annotate,
        has: function has(b) {
          return n.hasOwnProperty(b + "Provider") || a.hasOwnProperty(b);
        }
      };
    }

    b = !0 === b;
    var k = {},
        l = [],
        m = new Ra([], !0),
        n = {
      $provide: {
        provider: d(c),
        factory: d(f),
        service: d(function (a, b) {
          return f(a, ["$injector", function (a) {
            return a.instantiate(b);
          }]);
        }),
        value: d(function (a, b) {
          return f(a, ha(b), !1);
        }),
        constant: d(function (a, b) {
          Qa(a, "constant");
          n[a] = b;
          u[a] = b;
        }),
        decorator: function decorator(a, b) {
          var c = p.get(a + "Provider"),
              d = c.$get;

          c.$get = function () {
            var a = B.invoke(d, c);
            return B.invoke(b, null, {
              $delegate: a
            });
          };
        }
      }
    },
        p = n.$injector = h(n, function (a, b) {
      ca.isString(b) && l.push(b);
      throw Ha("unpr", l.join(" <- "));
    }),
        u = {},
        R = h(u, function (a, b) {
      var c = p.get(a + "Provider", b);
      return B.invoke(c.$get, c, void 0, a);
    }),
        B = R;
    n.$injectorProvider = {
      $get: ha(R)
    };
    var r = g(a),
        B = R.get("$injector");
    B.strictDi = b;
    q(r, function (a) {
      a && B.invoke(a);
    });
    return B;
  }

  function Xe() {
    var a = !0;

    this.disableAutoScrolling = function () {
      a = !1;
    };

    this.$get = ["$window", "$location", "$rootScope", function (b, d, c) {
      function e(a) {
        var b = null;
        Array.prototype.some.call(a, function (a) {
          if ("a" === wa(a)) return b = a, !0;
        });
        return b;
      }

      function f(a) {
        if (a) {
          a.scrollIntoView();
          var c;
          c = g.yOffset;
          z(c) ? c = c() : Qb(c) ? (c = c[0], c = "fixed" !== b.getComputedStyle(c).position ? 0 : c.getBoundingClientRect().bottom) : T(c) || (c = 0);
          c && (a = a.getBoundingClientRect().top, b.scrollBy(0, a - c));
        } else b.scrollTo(0, 0);
      }

      function g(a) {
        a = G(a) ? a : d.hash();
        var b;
        a ? (b = h.getElementById(a)) ? f(b) : (b = e(h.getElementsByName(a))) ? f(b) : "top" === a && f(null) : f(null);
      }

      var h = b.document;
      a && c.$watch(function () {
        return d.hash();
      }, function (a, b) {
        a === b && "" === a || Qf(function () {
          c.$evalAsync(g);
        });
      });
      return g;
    }];
  }

  function gb(a, b) {
    if (!a && !b) return "";
    if (!a) return b;
    if (!b) return a;
    L(a) && (a = a.join(" "));
    L(b) && (b = b.join(" "));
    return a + " " + b;
  }

  function Zf(a) {
    G(a) && (a = a.split(" "));
    var b = U();
    q(a, function (a) {
      a.length && (b[a] = !0);
    });
    return b;
  }

  function Ia(a) {
    return D(a) ? a : {};
  }

  function $f(a, b, d, c) {
    function e(a) {
      try {
        a.apply(null, va.call(arguments, 1));
      } finally {
        if (R--, 0 === R) for (; B.length;) {
          try {
            B.pop()();
          } catch (b) {
            d.error(b);
          }
        }
      }
    }

    function f() {
      t = null;
      g();
      h();
    }

    function g() {
      r = K();
      r = y(r) ? null : r;
      na(r, E) && (r = E);
      E = r;
    }

    function h() {
      if (v !== k.url() || J !== r) v = k.url(), J = r, q(M, function (a) {
        a(k.url(), r);
      });
    }

    var k = this,
        l = a.location,
        m = a.history,
        n = a.setTimeout,
        p = a.clearTimeout,
        u = {};
    k.isMock = !1;
    var R = 0,
        B = [];
    k.$$completeOutstandingRequest = e;

    k.$$incOutstandingRequestCount = function () {
      R++;
    };

    k.notifyWhenNoOutstandingRequests = function (a) {
      0 === R ? a() : B.push(a);
    };

    var r,
        J,
        v = l.href,
        fa = b.find("base"),
        t = null,
        K = c.history ? function () {
      try {
        return m.state;
      } catch (a) {}
    } : A;
    g();
    J = r;

    k.url = function (b, d, e) {
      y(e) && (e = null);
      l !== a.location && (l = a.location);
      m !== a.history && (m = a.history);

      if (b) {
        var f = J === e;
        if (v === b && (!c.history || f)) return k;
        var h = v && Ja(v) === Ja(b);
        v = b;
        J = e;
        !c.history || h && f ? (h || (t = b), d ? l.replace(b) : h ? (d = l, e = b.indexOf("#"), e = -1 === e ? "" : b.substr(e), d.hash = e) : l.href = b, l.href !== b && (t = b)) : (m[d ? "replaceState" : "pushState"](e, "", b), g(), J = r);
        t && (t = b);
        return k;
      }

      return t || l.href.replace(/%27/g, "'");
    };

    k.state = function () {
      return r;
    };

    var M = [],
        H = !1,
        E = null;

    k.onUrlChange = function (b) {
      if (!H) {
        if (c.history) F(a).on("popstate", f);
        F(a).on("hashchange", f);
        H = !0;
      }

      M.push(b);
      return b;
    };

    k.$$applicationDestroyed = function () {
      F(a).off("hashchange popstate", f);
    };

    k.$$checkUrlChange = h;

    k.baseHref = function () {
      var a = fa.attr("href");
      return a ? a.replace(/^(https?\:)?\/\/[^\/]*/, "") : "";
    };

    k.defer = function (a, b) {
      var c;
      R++;
      c = n(function () {
        delete u[c];
        e(a);
      }, b || 0);
      u[c] = !0;
      return c;
    };

    k.defer.cancel = function (a) {
      return u[a] ? (delete u[a], p(a), e(A), !0) : !1;
    };
  }

  function df() {
    this.$get = ["$window", "$log", "$sniffer", "$document", function (a, b, d, c) {
      return new $f(a, c, b, d);
    }];
  }

  function ef() {
    this.$get = function () {
      function a(a, c) {
        function e(a) {
          a != n && (p ? p == a && (p = a.n) : p = a, f(a.n, a.p), f(a, n), n = a, n.n = null);
        }

        function f(a, b) {
          a != b && (a && (a.p = b), b && (b.n = a));
        }

        if (a in b) throw N("$cacheFactory")("iid", a);
        var g = 0,
            h = S({}, c, {
          id: a
        }),
            k = U(),
            l = c && c.capacity || Number.MAX_VALUE,
            m = U(),
            n = null,
            p = null;
        return b[a] = {
          put: function put(a, b) {
            if (!y(b)) {
              if (l < Number.MAX_VALUE) {
                var c = m[a] || (m[a] = {
                  key: a
                });
                e(c);
              }

              a in k || g++;
              k[a] = b;
              g > l && this.remove(p.key);
              return b;
            }
          },
          get: function get(a) {
            if (l < Number.MAX_VALUE) {
              var b = m[a];
              if (!b) return;
              e(b);
            }

            return k[a];
          },
          remove: function remove(a) {
            if (l < Number.MAX_VALUE) {
              var b = m[a];
              if (!b) return;
              b == n && (n = b.p);
              b == p && (p = b.n);
              f(b.n, b.p);
              delete m[a];
            }

            a in k && (delete k[a], g--);
          },
          removeAll: function removeAll() {
            k = U();
            g = 0;
            m = U();
            n = p = null;
          },
          destroy: function destroy() {
            m = h = k = null;
            delete b[a];
          },
          info: function info() {
            return S({}, h, {
              size: g
            });
          }
        };
      }

      var b = {};

      a.info = function () {
        var a = {};
        q(b, function (b, e) {
          a[e] = b.info();
        });
        return a;
      };

      a.get = function (a) {
        return b[a];
      };

      return a;
    };
  }

  function Bf() {
    this.$get = ["$cacheFactory", function (a) {
      return a("templates");
    }];
  }

  function Fc(a, b) {
    function d(a, b, c) {
      var d = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/,
          e = U();
      q(a, function (a, f) {
        if (a in n) e[f] = n[a];else {
          var g = a.match(d);
          if (!g) throw ga("iscp", b, f, a, c ? "controller bindings definition" : "isolate scope definition");
          e[f] = {
            mode: g[1][0],
            collection: "*" === g[2],
            optional: "?" === g[3],
            attrName: g[4] || f
          };
          g[4] && (n[a] = e[f]);
        }
      });
      return e;
    }

    function c(a) {
      var b = a.charAt(0);
      if (!b || b !== Q(b)) throw ga("baddir", a);
      if (a !== a.trim()) throw ga("baddir", a);
    }

    function e(a) {
      var b = a.require || a.controller && a.name;
      !L(b) && D(b) && q(b, function (a, c) {
        var d = a.match(l);
        a.substring(d[0].length) || (b[c] = d[0] + c);
      });
      return b;
    }

    var f = {},
        g = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
        h = /(([\w\-]+)(?:\:([^;]+))?;?)/,
        k = be("ngSrc,ngSrcset,src,srcset"),
        l = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/,
        m = /^(on[a-z]+|formaction)$/,
        n = U();

    this.directive = function B(b, d) {
      Qa(b, "directive");
      G(b) ? (c(b), sb(d, "directiveFactory"), f.hasOwnProperty(b) || (f[b] = [], a.factory(b + "Directive", ["$injector", "$exceptionHandler", function (a, c) {
        var d = [];
        q(f[b], function (f, g) {
          try {
            var h = a.invoke(f);
            z(h) ? h = {
              compile: ha(h)
            } : !h.compile && h.link && (h.compile = ha(h.link));
            h.priority = h.priority || 0;
            h.index = g;
            h.name = h.name || b;
            h.require = e(h);
            h.restrict = h.restrict || "EA";
            h.$$moduleName = f.$$moduleName;
            d.push(h);
          } catch (k) {
            c(k);
          }
        });
        return d;
      }])), f[b].push(d)) : q(b, uc(B));
      return this;
    };

    this.component = function (a, b) {
      function c(a) {
        function e(b) {
          return z(b) || L(b) ? function (c, d) {
            return a.invoke(b, this, {
              $element: c,
              $attrs: d
            });
          } : b;
        }

        var f = b.template || b.templateUrl ? b.template : "",
            g = {
          controller: d,
          controllerAs: Xc(b.controller) || b.controllerAs || "$ctrl",
          template: e(f),
          templateUrl: e(b.templateUrl),
          transclude: b.transclude,
          scope: {},
          bindToController: b.bindings || {},
          restrict: "E",
          require: b.require
        };
        q(b, function (a, b) {
          "$" === b.charAt(0) && (g[b] = a);
        });
        return g;
      }

      var d = b.controller || function () {};

      q(b, function (a, b) {
        "$" === b.charAt(0) && (c[b] = a, z(d) && (d[b] = a));
      });
      c.$inject = ["$injector"];
      return this.directive(a, c);
    };

    this.aHrefSanitizationWhitelist = function (a) {
      return w(a) ? (b.aHrefSanitizationWhitelist(a), this) : b.aHrefSanitizationWhitelist();
    };

    this.imgSrcSanitizationWhitelist = function (a) {
      return w(a) ? (b.imgSrcSanitizationWhitelist(a), this) : b.imgSrcSanitizationWhitelist();
    };

    var p = !0;

    this.debugInfoEnabled = function (a) {
      return w(a) ? (p = a, this) : p;
    };

    var u = 10;

    this.onChangesTtl = function (a) {
      return arguments.length ? (u = a, this) : u;
    };

    this.$get = ["$injector", "$interpolate", "$exceptionHandler", "$templateRequest", "$parse", "$controller", "$rootScope", "$sce", "$animate", "$$sanitizeUri", function (a, b, c, e, n, t, K, M, H, E) {
      function I() {
        try {
          if (! --qa) throw Y = void 0, ga("infchng", u);
          K.$apply(function () {
            for (var a = [], b = 0, c = Y.length; b < c; ++b) {
              try {
                Y[b]();
              } catch (d) {
                a.push(d);
              }
            }

            Y = void 0;
            if (a.length) throw a;
          });
        } finally {
          qa++;
        }
      }

      function Da(a, b) {
        if (b) {
          var c = Object.keys(b),
              d,
              e,
              f;
          d = 0;

          for (e = c.length; d < e; d++) {
            f = c[d], this[f] = b[f];
          }
        } else this.$attr = {};

        this.$$element = a;
      }

      function P(a, b, c) {
        pa.innerHTML = "<span " + b + ">";
        b = pa.firstChild.attributes;
        var d = b[0];
        b.removeNamedItem(d.name);
        d.value = c;
        a.attributes.setNamedItem(d);
      }

      function x(a, b) {
        try {
          a.addClass(b);
        } catch (c) {}
      }

      function aa(a, b, c, d, e) {
        a instanceof F || (a = F(a));

        for (var f = /\S+/, g = 0, h = a.length; g < h; g++) {
          var k = a[g];
          k.nodeType === Ma && k.nodeValue.match(f) && Pc(k, a[g] = C.document.createElement("span"));
        }

        var l = s(a, b, a, c, d, e);
        aa.$$addScopeClass(a);
        var m = null;
        return function (b, c, d) {
          sb(b, "scope");
          e && e.needsNewScope && (b = b.$parent.$new());
          d = d || {};
          var f = d.parentBoundTranscludeFn,
              g = d.transcludeControllers;
          d = d.futureParentElement;
          f && f.$$boundTransclude && (f = f.$$boundTransclude);
          m || (m = (d = d && d[0]) ? "foreignobject" !== wa(d) && ma.call(d).match(/SVG/) ? "svg" : "html" : "html");
          d = "html" !== m ? F(da(m, F("<div>").append(a).html())) : c ? Oa.clone.call(a) : a;
          if (g) for (var h in g) {
            d.data("$" + h + "Controller", g[h].instance);
          }
          aa.$$addScopeInfo(d, b);
          c && c(d, b);
          l && l(b, d, d, f);
          return d;
        };
      }

      function s(a, b, c, d, e, f) {
        function g(a, c, d, e) {
          var f, k, l, m, p, r, v;
          if (n) for (v = Array(c.length), m = 0; m < h.length; m += 3) {
            f = h[m], v[f] = c[f];
          } else v = c;
          m = 0;

          for (p = h.length; m < p;) {
            k = v[h[m++]], c = h[m++], f = h[m++], c ? (c.scope ? (l = a.$new(), aa.$$addScopeInfo(F(k), l)) : l = a, r = c.transcludeOnThisElement ? za(a, c.transclude, e) : !c.templateOnThisElement && e ? e : !e && b ? za(a, b) : null, c(f, l, k, d, r)) : f && f(a, k.childNodes, void 0, e);
          }
        }

        for (var h = [], k, l, m, p, n, r = 0; r < a.length; r++) {
          k = new Da();
          l = $b(a[r], [], k, 0 === r ? d : void 0, e);
          (f = l.length ? oa(l, a[r], k, b, c, null, [], [], f) : null) && f.scope && aa.$$addScopeClass(k.$$element);
          k = f && f.terminal || !(m = a[r].childNodes) || !m.length ? null : s(m, f ? (f.transcludeOnThisElement || !f.templateOnThisElement) && f.transclude : b);
          if (f || k) h.push(r, f, k), p = !0, n = n || f;
          f = null;
        }

        return p ? g : null;
      }

      function za(a, b, c) {
        function d(e, f, g, h, k) {
          e || (e = a.$new(!1, k), e.$$transcluded = !0);
          return b(e, f, {
            parentBoundTranscludeFn: c,
            transcludeControllers: g,
            futureParentElement: h
          });
        }

        var e = d.$$slots = U(),
            f;

        for (f in b.$$slots) {
          e[f] = b.$$slots[f] ? za(a, b.$$slots[f], c) : null;
        }

        return d;
      }

      function $b(a, b, c, d, e) {
        var f = c.$attr;

        switch (a.nodeType) {
          case 1:
            O(b, Aa(wa(a)), "E", d, e);

            for (var g, k, l, m, p = a.attributes, n = 0, r = p && p.length; n < r; n++) {
              var v = !1,
                  u = !1;
              g = p[n];
              k = g.name;
              l = W(g.value);
              g = Aa(k);
              if (m = Ba.test(g)) k = k.replace(Yc, "").substr(8).replace(/_(.)/g, function (a, b) {
                return b.toUpperCase();
              });
              (g = g.match(Ca)) && V(g[1]) && (v = k, u = k.substr(0, k.length - 5) + "end", k = k.substr(0, k.length - 6));
              g = Aa(k.toLowerCase());
              f[g] = k;
              if (m || !c.hasOwnProperty(g)) c[g] = l, Uc(a, g) && (c[g] = !0);
              ia(a, b, l, g, m);
              O(b, g, "A", d, e, v, u);
            }

            f = a.className;
            D(f) && (f = f.animVal);
            if (G(f) && "" !== f) for (; a = h.exec(f);) {
              g = Aa(a[2]), O(b, g, "C", d, e) && (c[g] = W(a[3])), f = f.substr(a.index + a[0].length);
            }
            break;

          case Ma:
            if (11 === Ea) for (; a.parentNode && a.nextSibling && a.nextSibling.nodeType === Ma;) {
              a.nodeValue += a.nextSibling.nodeValue, a.parentNode.removeChild(a.nextSibling);
            }
            ca(b, a.nodeValue);
            break;

          case 8:
            hb(a, b, c, d, e);
        }

        b.sort(Z);
        return b;
      }

      function hb(a, b, c, d, e) {
        try {
          var f = g.exec(a.nodeValue);

          if (f) {
            var h = Aa(f[1]);
            O(b, h, "M", d, e) && (c[h] = W(f[2]));
          }
        } catch (k) {}
      }

      function N(a, b, c) {
        var d = [],
            e = 0;

        if (b && a.hasAttribute && a.hasAttribute(b)) {
          do {
            if (!a) throw ga("uterdir", b, c);
            1 == a.nodeType && (a.hasAttribute(b) && e++, a.hasAttribute(c) && e--);
            d.push(a);
            a = a.nextSibling;
          } while (0 < e);
        } else d.push(a);

        return F(d);
      }

      function Zc(a, b, c) {
        return function (d, e, f, g, h) {
          e = N(e[0], b, c);
          return a(d, e, f, g, h);
        };
      }

      function ac(a, b, c, d, e, f) {
        var g;
        return a ? aa(b, c, d, e, f) : function () {
          g || (g = aa(b, c, d, e, f), b = c = f = null);
          return g.apply(this, arguments);
        };
      }

      function oa(a, b, d, e, f, g, h, k, l) {
        function m(a, b, c, d) {
          if (a) {
            c && (a = Zc(a, c, d));
            a.require = x.require;
            a.directiveName = I;
            if (u === x || x.$$isolateScope) a = ja(a, {
              isolateScope: !0
            });
            h.push(a);
          }

          if (b) {
            c && (b = Zc(b, c, d));
            b.require = x.require;
            b.directiveName = I;
            if (u === x || x.$$isolateScope) b = ja(b, {
              isolateScope: !0
            });
            k.push(b);
          }
        }

        function p(a, e, f, g, l) {
          function m(a, b, c, d) {
            var e;
            Ya(a) || (d = c, c = b, b = a, a = void 0);
            fa && (e = t);
            c || (c = fa ? I.parent() : I);

            if (d) {
              var f = l.$$slots[d];
              if (f) return f(a, b, e, c, s);
              if (y(f)) throw ga("noslot", d, ya(I));
            } else return l(a, b, e, c, s);
          }

          var n, E, x, M, B, t, P, I;
          b === f ? (g = d, I = d.$$element) : (I = F(f), g = new Da(I, d));
          B = e;
          u ? M = e.$new(!0) : r && (B = e.$parent);
          l && (P = m, P.$$boundTransclude = l, P.isSlotFilled = function (a) {
            return !!l.$$slots[a];
          });
          v && (t = ag(I, g, P, v, M, e, u));
          u && (aa.$$addScopeInfo(I, M, !0, !(H && (H === u || H === u.$$originalDirective))), aa.$$addScopeClass(I, !0), M.$$isolateBindings = u.$$isolateBindings, E = ka(e, g, M, M.$$isolateBindings, u), E.removeWatches && M.$on("$destroy", E.removeWatches));

          for (n in t) {
            E = v[n];
            x = t[n];
            var Zb = E.$$bindings.bindToController;
            x.bindingInfo = x.identifier && Zb ? ka(B, g, x.instance, Zb, E) : {};
            var K = x();
            K !== x.instance && (x.instance = K, I.data("$" + E.name + "Controller", K), x.bindingInfo.removeWatches && x.bindingInfo.removeWatches(), x.bindingInfo = ka(B, g, x.instance, Zb, E));
          }

          q(v, function (a, b) {
            var c = a.require;
            a.bindToController && !L(c) && D(c) && S(t[b].instance, ib(b, c, I, t));
          });
          q(t, function (a) {
            var b = a.instance;
            if (z(b.$onChanges)) try {
              b.$onChanges(a.bindingInfo.initialChanges);
            } catch (d) {
              c(d);
            }
            if (z(b.$onInit)) try {
              b.$onInit();
            } catch (e) {
              c(e);
            }
            z(b.$doCheck) && (B.$watch(function () {
              b.$doCheck();
            }), b.$doCheck());
            z(b.$onDestroy) && B.$on("$destroy", function () {
              b.$onDestroy();
            });
          });
          n = 0;

          for (E = h.length; n < E; n++) {
            x = h[n], la(x, x.isolateScope ? M : e, I, g, x.require && ib(x.directiveName, x.require, I, t), P);
          }

          var s = e;
          u && (u.template || null === u.templateUrl) && (s = M);
          a && a(s, f.childNodes, void 0, l);

          for (n = k.length - 1; 0 <= n; n--) {
            x = k[n], la(x, x.isolateScope ? M : e, I, g, x.require && ib(x.directiveName, x.require, I, t), P);
          }

          q(t, function (a) {
            a = a.instance;
            z(a.$postLink) && a.$postLink();
          });
        }

        l = l || {};

        for (var n = -Number.MAX_VALUE, r = l.newScopeDirective, v = l.controllerDirectives, u = l.newIsolateScopeDirective, H = l.templateDirective, E = l.nonTlbTranscludeDirective, M = !1, B = !1, fa = l.hasElementTranscludeDirective, t = d.$$element = F(b), x, I, P, K = e, s, Fa = !1, za = !1, w, A = 0, C = a.length; A < C; A++) {
          x = a[A];
          var G = x.$$start,
              hb = x.$$end;
          G && (t = N(b, G, hb));
          P = void 0;
          if (n > x.priority) break;
          if (w = x.scope) x.templateUrl || (D(w) ? (X("new/isolated scope", u || r, x, t), u = x) : X("new/isolated scope", u, x, t)), r = r || x;
          I = x.name;

          if (!Fa && (x.replace && (x.templateUrl || x.template) || x.transclude && !x.$$tlb)) {
            for (w = A + 1; Fa = a[w++];) {
              if (Fa.transclude && !Fa.$$tlb || Fa.replace && (Fa.templateUrl || Fa.template)) {
                za = !0;
                break;
              }
            }

            Fa = !0;
          }

          !x.templateUrl && x.controller && (w = x.controller, v = v || U(), X("'" + I + "' controller", v[I], x, t), v[I] = x);
          if (w = x.transclude) if (M = !0, x.$$tlb || (X("transclusion", E, x, t), E = x), "element" == w) fa = !0, n = x.priority, P = t, t = d.$$element = F(aa.$$createComment(I, d[I])), b = t[0], ea(f, va.call(P, 0), b), P[0].$$parentNode = P[0].parentNode, K = ac(za, P, e, n, g && g.name, {
            nonTlbTranscludeDirective: E
          });else {
            var oa = U();
            P = F(Xb(b)).contents();

            if (D(w)) {
              P = [];
              var Q = U(),
                  O = U();
              q(w, function (a, b) {
                var c = "?" === a.charAt(0);
                a = c ? a.substring(1) : a;
                Q[a] = b;
                oa[b] = null;
                O[b] = c;
              });
              q(t.contents(), function (a) {
                var b = Q[Aa(wa(a))];
                b ? (O[b] = !0, oa[b] = oa[b] || [], oa[b].push(a)) : P.push(a);
              });
              q(O, function (a, b) {
                if (!a) throw ga("reqslot", b);
              });

              for (var V in oa) {
                oa[V] && (oa[V] = ac(za, oa[V], e));
              }
            }

            t.empty();
            K = ac(za, P, e, void 0, void 0, {
              needsNewScope: x.$$isolateScope || x.$$newScope
            });
            K.$$slots = oa;
          }
          if (x.template) if (B = !0, X("template", H, x, t), H = x, w = z(x.template) ? x.template(t, d) : x.template, w = xa(w), x.replace) {
            g = x;
            P = Vb.test(w) ? $c(da(x.templateNamespace, W(w))) : [];
            b = P[0];
            if (1 != P.length || 1 !== b.nodeType) throw ga("tplrt", I, "");
            ea(f, t, b);
            C = {
              $attr: {}
            };
            w = $b(b, [], C);
            var Z = a.splice(A + 1, a.length - (A + 1));
            (u || r) && T(w, u, r);
            a = a.concat(w).concat(Z);
            $(d, C);
            C = a.length;
          } else t.html(w);
          if (x.templateUrl) B = !0, X("template", H, x, t), H = x, x.replace && (g = x), p = ba(a.splice(A, a.length - A), t, d, f, M && K, h, k, {
            controllerDirectives: v,
            newScopeDirective: r !== x && r,
            newIsolateScopeDirective: u,
            templateDirective: H,
            nonTlbTranscludeDirective: E
          }), C = a.length;else if (x.compile) try {
            s = x.compile(t, d, K);
            var Y = x.$$originalDirective || x;
            z(s) ? m(null, ab(Y, s), G, hb) : s && m(ab(Y, s.pre), ab(Y, s.post), G, hb);
          } catch (ca) {
            c(ca, ya(t));
          }
          x.terminal && (p.terminal = !0, n = Math.max(n, x.priority));
        }

        p.scope = r && !0 === r.scope;
        p.transcludeOnThisElement = M;
        p.templateOnThisElement = B;
        p.transclude = K;
        l.hasElementTranscludeDirective = fa;
        return p;
      }

      function ib(a, b, c, d) {
        var e;

        if (G(b)) {
          var f = b.match(l);
          b = b.substring(f[0].length);
          var g = f[1] || f[3],
              f = "?" === f[2];
          "^^" === g ? c = c.parent() : e = (e = d && d[b]) && e.instance;

          if (!e) {
            var h = "$" + b + "Controller";
            e = g ? c.inheritedData(h) : c.data(h);
          }

          if (!e && !f) throw ga("ctreq", b, a);
        } else if (L(b)) for (e = [], g = 0, f = b.length; g < f; g++) {
          e[g] = ib(a, b[g], c, d);
        } else D(b) && (e = {}, q(b, function (b, f) {
          e[f] = ib(a, b, c, d);
        }));

        return e || null;
      }

      function ag(a, b, c, d, e, f, g) {
        var h = U(),
            k;

        for (k in d) {
          var l = d[k],
              m = {
            $scope: l === g || l.$$isolateScope ? e : f,
            $element: a,
            $attrs: b,
            $transclude: c
          },
              p = l.controller;
          "@" == p && (p = b[l.name]);
          m = t(p, m, !0, l.controllerAs);
          h[l.name] = m;
          a.data("$" + l.name + "Controller", m.instance);
        }

        return h;
      }

      function T(a, b, c) {
        for (var d = 0, e = a.length; d < e; d++) {
          a[d] = Rb(a[d], {
            $$isolateScope: b,
            $$newScope: c
          });
        }
      }

      function O(b, e, g, h, k, l, m) {
        if (e === k) return null;
        k = null;

        if (f.hasOwnProperty(e)) {
          var p;
          e = a.get(e + "Directive");

          for (var n = 0, r = e.length; n < r; n++) {
            try {
              if (p = e[n], (y(h) || h > p.priority) && -1 != p.restrict.indexOf(g)) {
                l && (p = Rb(p, {
                  $$start: l,
                  $$end: m
                }));

                if (!p.$$bindings) {
                  var u = p,
                      v = p,
                      x = p.name,
                      H = {
                    isolateScope: null,
                    bindToController: null
                  };
                  D(v.scope) && (!0 === v.bindToController ? (H.bindToController = d(v.scope, x, !0), H.isolateScope = {}) : H.isolateScope = d(v.scope, x, !1));
                  D(v.bindToController) && (H.bindToController = d(v.bindToController, x, !0));

                  if (D(H.bindToController)) {
                    var E = v.controller,
                        M = v.controllerAs;
                    if (!E) throw ga("noctrl", x);
                    if (!Xc(E, M)) throw ga("noident", x);
                  }

                  var t = u.$$bindings = H;
                  D(t.isolateScope) && (p.$$isolateBindings = t.isolateScope);
                }

                b.push(p);
                k = p;
              }
            } catch (I) {
              c(I);
            }
          }
        }

        return k;
      }

      function V(b) {
        if (f.hasOwnProperty(b)) for (var c = a.get(b + "Directive"), d = 0, e = c.length; d < e; d++) {
          if (b = c[d], b.multiElement) return !0;
        }
        return !1;
      }

      function $(a, b) {
        var c = b.$attr,
            d = a.$attr;
        q(a, function (d, e) {
          "$" != e.charAt(0) && (b[e] && b[e] !== d && (d += ("style" === e ? ";" : " ") + b[e]), a.$set(e, d, !0, c[e]));
        });
        q(b, function (b, e) {
          a.hasOwnProperty(e) || "$" === e.charAt(0) || (a[e] = b, "class" !== e && "style" !== e && (d[e] = c[e]));
        });
      }

      function ba(a, b, c, d, f, g, h, k) {
        var l = [],
            m,
            p,
            n = b[0],
            r = a.shift(),
            u = Rb(r, {
          templateUrl: null,
          transclude: null,
          replace: null,
          $$originalDirective: r
        }),
            H = z(r.templateUrl) ? r.templateUrl(b, c) : r.templateUrl,
            E = r.templateNamespace;
        b.empty();
        e(H).then(function (e) {
          var v, M;
          e = xa(e);

          if (r.replace) {
            e = Vb.test(e) ? $c(da(E, W(e))) : [];
            v = e[0];
            if (1 != e.length || 1 !== v.nodeType) throw ga("tplrt", r.name, H);
            e = {
              $attr: {}
            };
            ea(d, b, v);
            var B = $b(v, [], e);
            D(r.scope) && T(B, !0);
            a = B.concat(a);
            $(c, e);
          } else v = n, b.html(e);

          a.unshift(u);
          m = oa(a, v, c, f, b, r, g, h, k);
          q(d, function (a, c) {
            a == v && (d[c] = b[0]);
          });

          for (p = s(b[0].childNodes, f); l.length;) {
            e = l.shift();
            M = l.shift();
            var t = l.shift(),
                I = l.shift(),
                B = b[0];

            if (!e.$$destroyed) {
              if (M !== n) {
                var P = M.className;
                k.hasElementTranscludeDirective && r.replace || (B = Xb(v));
                ea(t, F(M), B);
                x(F(B), P);
              }

              M = m.transcludeOnThisElement ? za(e, m.transclude, I) : I;
              m(p, e, B, d, M);
            }
          }

          l = null;
        });
        return function (a, b, c, d, e) {
          a = e;
          b.$$destroyed || (l ? l.push(b, c, d, a) : (m.transcludeOnThisElement && (a = za(b, m.transclude, e)), m(p, b, c, d, a)));
        };
      }

      function Z(a, b) {
        var c = b.priority - a.priority;
        return 0 !== c ? c : a.name !== b.name ? a.name < b.name ? -1 : 1 : a.index - b.index;
      }

      function X(a, b, c, d) {
        function e(a) {
          return a ? " (module: " + a + ")" : "";
        }

        if (b) throw ga("multidir", b.name, e(b.$$moduleName), c.name, e(c.$$moduleName), a, ya(d));
      }

      function ca(a, c) {
        var d = b(c, !0);
        d && a.push({
          priority: 0,
          compile: function compile(a) {
            a = a.parent();
            var b = !!a.length;
            b && aa.$$addBindingClass(a);
            return function (a, c) {
              var e = c.parent();
              b || aa.$$addBindingClass(e);
              aa.$$addBindingInfo(e, d.expressions);
              a.$watch(d, function (a) {
                c[0].nodeValue = a;
              });
            };
          }
        });
      }

      function da(a, b) {
        a = Q(a || "html");

        switch (a) {
          case "svg":
          case "math":
            var c = C.document.createElement("div");
            c.innerHTML = "<" + a + ">" + b + "</" + a + ">";
            return c.childNodes[0].childNodes;

          default:
            return b;
        }
      }

      function ha(a, b) {
        if ("srcdoc" == b) return M.HTML;
        var c = wa(a);
        if ("xlinkHref" == b || "form" == c && "action" == b || "img" != c && ("src" == b || "ngSrc" == b)) return M.RESOURCE_URL;
      }

      function ia(a, c, d, e, f) {
        var g = ha(a, e);
        f = k[e] || f;
        var h = b(d, !0, g, f);

        if (h) {
          if ("multiple" === e && "select" === wa(a)) throw ga("selmulti", ya(a));
          c.push({
            priority: 100,
            compile: function compile() {
              return {
                pre: function pre(a, c, k) {
                  c = k.$$observers || (k.$$observers = U());
                  if (m.test(e)) throw ga("nodomevents");
                  var l = k[e];
                  l !== d && (h = l && b(l, !0, g, f), d = l);
                  h && (k[e] = h(a), (c[e] || (c[e] = [])).$$inter = !0, (k.$$observers && k.$$observers[e].$$scope || a).$watch(h, function (a, b) {
                    "class" === e && a != b ? k.$updateClass(a, b) : k.$set(e, a);
                  }));
                }
              };
            }
          });
        }
      }

      function ea(a, b, c) {
        var d = b[0],
            e = b.length,
            f = d.parentNode,
            g,
            h;
        if (a) for (g = 0, h = a.length; g < h; g++) {
          if (a[g] == d) {
            a[g++] = c;
            h = g + e - 1;

            for (var k = a.length; g < k; g++, h++) {
              h < k ? a[g] = a[h] : delete a[g];
            }

            a.length -= e - 1;
            a.context === d && (a.context = c);
            break;
          }
        }
        f && f.replaceChild(c, d);
        a = C.document.createDocumentFragment();

        for (g = 0; g < e; g++) {
          a.appendChild(b[g]);
        }

        F.hasData(d) && (F.data(c, F.data(d)), F(d).off("$destroy"));
        F.cleanData(a.querySelectorAll("*"));

        for (g = 1; g < e; g++) {
          delete b[g];
        }

        b[0] = c;
        b.length = 1;
      }

      function ja(a, b) {
        return S(function () {
          return a.apply(null, arguments);
        }, a, b);
      }

      function la(a, b, d, e, f, g) {
        try {
          a(b, d, e, f, g);
        } catch (h) {
          c(h, ya(d));
        }
      }

      function ka(a, c, d, e, f) {
        function g(b, c, e) {
          z(d.$onChanges) && c !== e && (Y || (a.$$postDigest(I), Y = []), m || (m = {}, Y.push(h)), m[b] && (e = m[b].previousValue), m[b] = new Fb(e, c));
        }

        function h() {
          d.$onChanges(m);
          m = void 0;
        }

        var k = [],
            l = {},
            m;
        q(e, function (e, h) {
          var m = e.attrName,
              p = e.optional,
              v,
              u,
              x,
              H;

          switch (e.mode) {
            case "@":
              p || ua.call(c, m) || (d[h] = c[m] = void 0);
              c.$observe(m, function (a) {
                if (G(a) || Ga(a)) g(h, a, d[h]), d[h] = a;
              });
              c.$$observers[m].$$scope = a;
              v = c[m];
              G(v) ? d[h] = b(v)(a) : Ga(v) && (d[h] = v);
              l[h] = new Fb(bc, d[h]);
              break;

            case "=":
              if (!ua.call(c, m)) {
                if (p) break;
                c[m] = void 0;
              }

              if (p && !c[m]) break;
              u = n(c[m]);
              H = u.literal ? na : function (a, b) {
                return a === b || a !== a && b !== b;
              };

              x = u.assign || function () {
                v = d[h] = u(a);
                throw ga("nonassign", c[m], m, f.name);
              };

              v = d[h] = u(a);

              p = function p(b) {
                H(b, d[h]) || (H(b, v) ? x(a, b = d[h]) : d[h] = b);
                return v = b;
              };

              p.$stateful = !0;
              p = e.collection ? a.$watchCollection(c[m], p) : a.$watch(n(c[m], p), null, u.literal);
              k.push(p);
              break;

            case "<":
              if (!ua.call(c, m)) {
                if (p) break;
                c[m] = void 0;
              }

              if (p && !c[m]) break;
              u = n(c[m]);
              var E = d[h] = u(a);
              l[h] = new Fb(bc, d[h]);
              p = a.$watch(u, function (a, b) {
                if (b === a) {
                  if (b === E) return;
                  b = E;
                }

                g(h, a, b);
                d[h] = a;
              }, u.literal);
              k.push(p);
              break;

            case "&":
              u = c.hasOwnProperty(m) ? n(c[m]) : A;
              if (u === A && p) break;

              d[h] = function (b) {
                return u(a, b);
              };

          }
        });
        return {
          initialChanges: l,
          removeWatches: k.length && function () {
            for (var a = 0, b = k.length; a < b; ++a) {
              k[a]();
            }
          }
        };
      }

      var ta = /^\w/,
          pa = C.document.createElement("div"),
          qa = u,
          Y;
      Da.prototype = {
        $normalize: Aa,
        $addClass: function $addClass(a) {
          a && 0 < a.length && H.addClass(this.$$element, a);
        },
        $removeClass: function $removeClass(a) {
          a && 0 < a.length && H.removeClass(this.$$element, a);
        },
        $updateClass: function $updateClass(a, b) {
          var c = ad(a, b);
          c && c.length && H.addClass(this.$$element, c);
          (c = ad(b, a)) && c.length && H.removeClass(this.$$element, c);
        },
        $set: function $set(a, b, d, e) {
          var f = Uc(this.$$element[0], a),
              g = bd[a],
              h = a;
          f ? (this.$$element.prop(a, b), e = f) : g && (this[g] = b, h = g);
          this[a] = b;
          e ? this.$attr[a] = e : (e = this.$attr[a]) || (this.$attr[a] = e = Cc(a, "-"));
          f = wa(this.$$element);
          if ("a" === f && ("href" === a || "xlinkHref" === a) || "img" === f && "src" === a) this[a] = b = E(b, "src" === a);else if ("img" === f && "srcset" === a && w(b)) {
            for (var f = "", g = W(b), k = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/, k = /\s/.test(g) ? k : /(,)/, g = g.split(k), k = Math.floor(g.length / 2), l = 0; l < k; l++) {
              var m = 2 * l,
                  f = f + E(W(g[m]), !0),
                  f = f + (" " + W(g[m + 1]));
            }

            g = W(g[2 * l]).split(/\s/);
            f += E(W(g[0]), !0);
            2 === g.length && (f += " " + W(g[1]));
            this[a] = b = f;
          }
          !1 !== d && (null === b || y(b) ? this.$$element.removeAttr(e) : ta.test(e) ? this.$$element.attr(e, b) : P(this.$$element[0], e, b));
          (a = this.$$observers) && q(a[h], function (a) {
            try {
              a(b);
            } catch (d) {
              c(d);
            }
          });
        },
        $observe: function $observe(a, b) {
          var c = this,
              d = c.$$observers || (c.$$observers = U()),
              e = d[a] || (d[a] = []);
          e.push(b);
          K.$evalAsync(function () {
            e.$$inter || !c.hasOwnProperty(a) || y(c[a]) || b(c[a]);
          });
          return function () {
            Za(e, b);
          };
        }
      };
      var ra = b.startSymbol(),
          sa = b.endSymbol(),
          xa = "{{" == ra && "}}" == sa ? Xa : function (a) {
        return a.replace(/\{\{/g, ra).replace(/}}/g, sa);
      },
          Ba = /^ngAttr[A-Z]/,
          Ca = /^(.+)Start$/;
      aa.$$addBindingInfo = p ? function (a, b) {
        var c = a.data("$binding") || [];
        L(b) ? c = c.concat(b) : c.push(b);
        a.data("$binding", c);
      } : A;
      aa.$$addBindingClass = p ? function (a) {
        x(a, "ng-binding");
      } : A;
      aa.$$addScopeInfo = p ? function (a, b, c, d) {
        a.data(c ? d ? "$isolateScopeNoTemplate" : "$isolateScope" : "$scope", b);
      } : A;
      aa.$$addScopeClass = p ? function (a, b) {
        x(a, b ? "ng-isolate-scope" : "ng-scope");
      } : A;

      aa.$$createComment = function (a, b) {
        var c = "";
        p && (c = " " + (a || "") + ": ", b && (c += b + " "));
        return C.document.createComment(c);
      };

      return aa;
    }];
  }

  function Fb(a, b) {
    this.previousValue = a;
    this.currentValue = b;
  }

  function Aa(a) {
    return db(a.replace(Yc, ""));
  }

  function ad(a, b) {
    var d = "",
        c = a.split(/\s+/),
        e = b.split(/\s+/),
        f = 0;

    a: for (; f < c.length; f++) {
      for (var g = c[f], h = 0; h < e.length; h++) {
        if (g == e[h]) continue a;
      }

      d += (0 < d.length ? " " : "") + g;
    }

    return d;
  }

  function $c(a) {
    a = F(a);
    var b = a.length;
    if (1 >= b) return a;

    for (; b--;) {
      8 === a[b].nodeType && bg.call(a, b, 1);
    }

    return a;
  }

  function Xc(a, b) {
    if (b && G(b)) return b;

    if (G(a)) {
      var d = cd.exec(a);
      if (d) return d[3];
    }
  }

  function ff() {
    var a = {},
        b = !1;

    this.has = function (b) {
      return a.hasOwnProperty(b);
    };

    this.register = function (b, c) {
      Qa(b, "controller");
      D(b) ? S(a, b) : a[b] = c;
    };

    this.allowGlobals = function () {
      b = !0;
    };

    this.$get = ["$injector", "$window", function (d, c) {
      function e(a, b, c, d) {
        if (!a || !D(a.$scope)) throw N("$controller")("noscp", d, b);
        a.$scope[b] = c;
      }

      return function (f, g, h, k) {
        var l, m, n;
        h = !0 === h;
        k && G(k) && (n = k);

        if (G(f)) {
          k = f.match(cd);
          if (!k) throw cg("ctrlfmt", f);
          m = k[1];
          n = n || k[3];
          f = a.hasOwnProperty(m) ? a[m] : Ec(g.$scope, m, !0) || (b ? Ec(c, m, !0) : void 0);
          Pa(f, m, !0);
        }

        if (h) return h = (L(f) ? f[f.length - 1] : f).prototype, l = Object.create(h || null), n && e(g, n, l, m || f.name), S(function () {
          var a = d.invoke(f, l, g, m);
          a !== l && (D(a) || z(a)) && (l = a, n && e(g, n, l, m || f.name));
          return l;
        }, {
          instance: l,
          identifier: n
        });
        l = d.instantiate(f, g, m);
        n && e(g, n, l, m || f.name);
        return l;
      };
    }];
  }

  function gf() {
    this.$get = ["$window", function (a) {
      return F(a.document);
    }];
  }

  function hf() {
    this.$get = ["$log", function (a) {
      return function (b, d) {
        a.error.apply(a, arguments);
      };
    }];
  }

  function cc(a) {
    return D(a) ? da(a) ? a.toISOString() : bb(a) : a;
  }

  function nf() {
    this.$get = function () {
      return function (a) {
        if (!a) return "";
        var b = [];
        tc(a, function (a, c) {
          null === a || y(a) || (L(a) ? q(a, function (a) {
            b.push(ea(c) + "=" + ea(cc(a)));
          }) : b.push(ea(c) + "=" + ea(cc(a))));
        });
        return b.join("&");
      };
    };
  }

  function of() {
    this.$get = function () {
      return function (a) {
        function b(a, e, f) {
          null === a || y(a) || (L(a) ? q(a, function (a, c) {
            b(a, e + "[" + (D(a) ? c : "") + "]");
          }) : D(a) && !da(a) ? tc(a, function (a, c) {
            b(a, e + (f ? "" : "[") + c + (f ? "" : "]"));
          }) : d.push(ea(e) + "=" + ea(cc(a))));
        }

        if (!a) return "";
        var d = [];
        b(a, "", !0);
        return d.join("&");
      };
    };
  }

  function dc(a, b) {
    if (G(a)) {
      var d = a.replace(dg, "").trim();

      if (d) {
        var c = b("Content-Type");
        (c = c && 0 === c.indexOf(dd)) || (c = (c = d.match(eg)) && fg[c[0]].test(d));
        c && (a = xc(d));
      }
    }

    return a;
  }

  function ed(a) {
    var b = U(),
        d;
    G(a) ? q(a.split("\n"), function (a) {
      d = a.indexOf(":");
      var e = Q(W(a.substr(0, d)));
      a = W(a.substr(d + 1));
      e && (b[e] = b[e] ? b[e] + ", " + a : a);
    }) : D(a) && q(a, function (a, d) {
      var f = Q(d),
          g = W(a);
      f && (b[f] = b[f] ? b[f] + ", " + g : g);
    });
    return b;
  }

  function fd(a) {
    var b;
    return function (d) {
      b || (b = ed(a));
      return d ? (d = b[Q(d)], void 0 === d && (d = null), d) : b;
    };
  }

  function gd(a, b, d, c) {
    if (z(c)) return c(a, b, d);
    q(c, function (c) {
      a = c(a, b, d);
    });
    return a;
  }

  function mf() {
    var a = this.defaults = {
      transformResponse: [dc],
      transformRequest: [function (a) {
        return D(a) && "[object File]" !== ma.call(a) && "[object Blob]" !== ma.call(a) && "[object FormData]" !== ma.call(a) ? bb(a) : a;
      }],
      headers: {
        common: {
          Accept: "application/json, text/plain, */*"
        },
        post: ia(ec),
        put: ia(ec),
        patch: ia(ec)
      },
      xsrfCookieName: "XSRF-TOKEN",
      xsrfHeaderName: "X-XSRF-TOKEN",
      paramSerializer: "$httpParamSerializer"
    },
        b = !1;

    this.useApplyAsync = function (a) {
      return w(a) ? (b = !!a, this) : b;
    };

    var d = !0;

    this.useLegacyPromiseExtensions = function (a) {
      return w(a) ? (d = !!a, this) : d;
    };

    var c = this.interceptors = [];
    this.$get = ["$httpBackend", "$$cookieReader", "$cacheFactory", "$rootScope", "$q", "$injector", function (e, f, g, h, k, l) {
      function m(b) {
        function c(a, b) {
          for (var d = 0, e = b.length; d < e;) {
            var f = b[d++],
                g = b[d++];
            a = a.then(f, g);
          }

          b.length = 0;
          return a;
        }

        function e(a, b) {
          var c,
              d = {};
          q(a, function (a, e) {
            z(a) ? (c = a(b), null != c && (d[e] = c)) : d[e] = a;
          });
          return d;
        }

        function f(a) {
          var b = S({}, a);
          b.data = gd(a.data, a.headers, a.status, g.transformResponse);
          a = a.status;
          return 200 <= a && 300 > a ? b : k.reject(b);
        }

        if (!D(b)) throw N("$http")("badreq", b);
        if (!G(b.url)) throw N("$http")("badreq", b.url);
        var g = S({
          method: "get",
          transformRequest: a.transformRequest,
          transformResponse: a.transformResponse,
          paramSerializer: a.paramSerializer
        }, b);

        g.headers = function (b) {
          var c = a.headers,
              d = S({}, b.headers),
              f,
              g,
              h,
              c = S({}, c.common, c[Q(b.method)]);

          a: for (f in c) {
            g = Q(f);

            for (h in d) {
              if (Q(h) === g) continue a;
            }

            d[f] = c[f];
          }

          return e(d, ia(b));
        }(b);

        g.method = ub(g.method);
        g.paramSerializer = G(g.paramSerializer) ? l.get(g.paramSerializer) : g.paramSerializer;
        var h = [],
            m = [],
            p = k.when(g);
        q(R, function (a) {
          (a.request || a.requestError) && h.unshift(a.request, a.requestError);
          (a.response || a.responseError) && m.push(a.response, a.responseError);
        });
        p = c(p, h);
        p = p.then(function (b) {
          var c = b.headers,
              d = gd(b.data, fd(c), void 0, b.transformRequest);
          y(d) && q(c, function (a, b) {
            "content-type" === Q(b) && delete c[b];
          });
          y(b.withCredentials) && !y(a.withCredentials) && (b.withCredentials = a.withCredentials);
          return n(b, d).then(f, f);
        });
        p = c(p, m);
        d ? (p.success = function (a) {
          Pa(a, "fn");
          p.then(function (b) {
            a(b.data, b.status, b.headers, g);
          });
          return p;
        }, p.error = function (a) {
          Pa(a, "fn");
          p.then(null, function (b) {
            a(b.data, b.status, b.headers, g);
          });
          return p;
        }) : (p.success = hd("success"), p.error = hd("error"));
        return p;
      }

      function n(c, d) {
        function g(a) {
          if (a) {
            var c = {};
            q(a, function (a, d) {
              c[d] = function (c) {
                function d() {
                  a(c);
                }

                b ? h.$applyAsync(d) : h.$$phase ? d() : h.$apply(d);
              };
            });
            return c;
          }
        }

        function l(a, c, d, e) {
          function f() {
            n(c, a, d, e);
          }

          E && (200 <= a && 300 > a ? E.put(P, [a, c, ed(d), e]) : E.remove(P));
          b ? h.$applyAsync(f) : (f(), h.$$phase || h.$apply());
        }

        function n(a, b, d, e) {
          b = -1 <= b ? b : 0;
          (200 <= b && 300 > b ? M.resolve : M.reject)({
            data: a,
            status: b,
            headers: fd(d),
            config: c,
            statusText: e
          });
        }

        function t(a) {
          n(a.data, a.status, ia(a.headers()), a.statusText);
        }

        function R() {
          var a = m.pendingRequests.indexOf(c);
          -1 !== a && m.pendingRequests.splice(a, 1);
        }

        var M = k.defer(),
            H = M.promise,
            E,
            I,
            Da = c.headers,
            P = p(c.url, c.paramSerializer(c.params));
        m.pendingRequests.push(c);
        H.then(R, R);
        !c.cache && !a.cache || !1 === c.cache || "GET" !== c.method && "JSONP" !== c.method || (E = D(c.cache) ? c.cache : D(a.cache) ? a.cache : u);
        E && (I = E.get(P), w(I) ? I && z(I.then) ? I.then(t, t) : L(I) ? n(I[1], I[0], ia(I[2]), I[3]) : n(I, 200, {}, "OK") : E.put(P, H));
        y(I) && ((I = id(c.url) ? f()[c.xsrfCookieName || a.xsrfCookieName] : void 0) && (Da[c.xsrfHeaderName || a.xsrfHeaderName] = I), e(c.method, P, d, l, Da, c.timeout, c.withCredentials, c.responseType, g(c.eventHandlers), g(c.uploadEventHandlers)));
        return H;
      }

      function p(a, b) {
        0 < b.length && (a += (-1 == a.indexOf("?") ? "?" : "&") + b);
        return a;
      }

      var u = g("$http");
      a.paramSerializer = G(a.paramSerializer) ? l.get(a.paramSerializer) : a.paramSerializer;
      var R = [];
      q(c, function (a) {
        R.unshift(G(a) ? l.get(a) : l.invoke(a));
      });
      m.pendingRequests = [];

      (function (a) {
        q(arguments, function (a) {
          m[a] = function (b, c) {
            return m(S({}, c || {}, {
              method: a,
              url: b
            }));
          };
        });
      })("get", "delete", "head", "jsonp");

      (function (a) {
        q(arguments, function (a) {
          m[a] = function (b, c, d) {
            return m(S({}, d || {}, {
              method: a,
              url: b,
              data: c
            }));
          };
        });
      })("post", "put", "patch");

      m.defaults = a;
      return m;
    }];
  }

  function qf() {
    this.$get = function () {
      return function () {
        return new C.XMLHttpRequest();
      };
    };
  }

  function pf() {
    this.$get = ["$browser", "$jsonpCallbacks", "$document", "$xhrFactory", function (a, b, d, c) {
      return gg(a, c, a.defer, b, d[0]);
    }];
  }

  function gg(a, b, d, c, e) {
    function f(a, b, d) {
      a = a.replace("JSON_CALLBACK", b);
      var f = e.createElement("script"),
          _m = null;
      f.type = "text/javascript";
      f.src = a;
      f.async = !0;

      _m = function m(a) {
        f.removeEventListener("load", _m, !1);
        f.removeEventListener("error", _m, !1);
        e.body.removeChild(f);
        f = null;
        var g = -1,
            u = "unknown";
        a && ("load" !== a.type || c.wasCalled(b) || (a = {
          type: "error"
        }), u = a.type, g = "error" === a.type ? 404 : 200);
        d && d(g, u);
      };

      f.addEventListener("load", _m, !1);
      f.addEventListener("error", _m, !1);
      e.body.appendChild(f);
      return _m;
    }

    return function (e, h, k, l, m, n, p, u, R, B) {
      function r() {
        fa && fa();
        t && t.abort();
      }

      function J(b, c, e, f, g) {
        w(M) && d.cancel(M);
        fa = t = null;
        b(c, e, f, g);
        a.$$completeOutstandingRequest(A);
      }

      a.$$incOutstandingRequestCount();
      h = h || a.url();
      if ("jsonp" === Q(e)) var v = c.createCallback(h),
          fa = f(h, v, function (a, b) {
        var d = 200 === a && c.getResponse(v);
        J(l, a, d, "", b);
        c.removeCallback(v);
      });else {
        var t = b(e, h);
        t.open(e, h, !0);
        q(m, function (a, b) {
          w(a) && t.setRequestHeader(b, a);
        });

        t.onload = function () {
          var a = t.statusText || "",
              b = "response" in t ? t.response : t.responseText,
              c = 1223 === t.status ? 204 : t.status;
          0 === c && (c = b ? 200 : "file" == Y(h).protocol ? 404 : 0);
          J(l, c, b, t.getAllResponseHeaders(), a);
        };

        e = function e() {
          J(l, -1, null, null, "");
        };

        t.onerror = e;
        t.onabort = e;
        q(R, function (a, b) {
          t.addEventListener(b, a);
        });
        q(B, function (a, b) {
          t.upload.addEventListener(b, a);
        });
        p && (t.withCredentials = !0);
        if (u) try {
          t.responseType = u;
        } catch (K) {
          if ("json" !== u) throw K;
        }
        t.send(y(k) ? null : k);
      }
      if (0 < n) var M = d(r, n);else n && z(n.then) && n.then(r);
    };
  }

  function kf() {
    var a = "{{",
        b = "}}";

    this.startSymbol = function (b) {
      return b ? (a = b, this) : a;
    };

    this.endSymbol = function (a) {
      return a ? (b = a, this) : b;
    };

    this.$get = ["$parse", "$exceptionHandler", "$sce", function (d, c, e) {
      function f(a) {
        return "\\\\\\" + a;
      }

      function g(c) {
        return c.replace(n, a).replace(p, b);
      }

      function h(a, b, c, d) {
        var e;
        return e = a.$watch(function (a) {
          e();
          return d(a);
        }, b, c);
      }

      function k(f, k, p, n) {
        function J(a) {
          try {
            var b = a;
            a = p ? e.getTrusted(p, b) : e.valueOf(b);
            var d;
            if (n && !w(a)) d = a;else if (null == a) d = "";else {
              switch (_typeof(a)) {
                case "string":
                  break;

                case "number":
                  a = "" + a;
                  break;

                default:
                  a = bb(a);
              }

              d = a;
            }
            return d;
          } catch (g) {
            c(Ka.interr(f, g));
          }
        }

        if (!f.length || -1 === f.indexOf(a)) {
          var v;
          k || (k = g(f), v = ha(k), v.exp = f, v.expressions = [], v.$$watchDelegate = h);
          return v;
        }

        n = !!n;
        var q,
            t,
            K = 0,
            M = [],
            H = [];
        v = f.length;

        for (var E = [], I = []; K < v;) {
          if (-1 != (q = f.indexOf(a, K)) && -1 != (t = f.indexOf(b, q + l))) K !== q && E.push(g(f.substring(K, q))), K = f.substring(q + l, t), M.push(K), H.push(d(K, J)), K = t + m, I.push(E.length), E.push("");else {
            K !== v && E.push(g(f.substring(K)));
            break;
          }
        }

        p && 1 < E.length && Ka.throwNoconcat(f);

        if (!k || M.length) {
          var Da = function Da(a) {
            for (var b = 0, c = M.length; b < c; b++) {
              if (n && y(a[b])) return;
              E[I[b]] = a[b];
            }

            return E.join("");
          };

          return S(function (a) {
            var b = 0,
                d = M.length,
                e = Array(d);

            try {
              for (; b < d; b++) {
                e[b] = H[b](a);
              }

              return Da(e);
            } catch (g) {
              c(Ka.interr(f, g));
            }
          }, {
            exp: f,
            expressions: M,
            $$watchDelegate: function $$watchDelegate(a, b) {
              var c;
              return a.$watchGroup(H, function (d, e) {
                var f = Da(d);
                z(b) && b.call(this, f, d !== e ? c : f, a);
                c = f;
              });
            }
          });
        }
      }

      var l = a.length,
          m = b.length,
          n = new RegExp(a.replace(/./g, f), "g"),
          p = new RegExp(b.replace(/./g, f), "g");

      k.startSymbol = function () {
        return a;
      };

      k.endSymbol = function () {
        return b;
      };

      return k;
    }];
  }

  function lf() {
    this.$get = ["$rootScope", "$window", "$q", "$$q", "$browser", function (a, b, d, c, e) {
      function f(f, k, l, m) {
        function n() {
          p ? f.apply(null, u) : f(r);
        }

        var p = 4 < arguments.length,
            u = p ? va.call(arguments, 4) : [],
            R = b.setInterval,
            q = b.clearInterval,
            r = 0,
            J = w(m) && !m,
            v = (J ? c : d).defer(),
            fa = v.promise;
        l = w(l) ? l : 0;
        fa.$$intervalId = R(function () {
          J ? e.defer(n) : a.$evalAsync(n);
          v.notify(r++);
          0 < l && r >= l && (v.resolve(r), q(fa.$$intervalId), delete g[fa.$$intervalId]);
          J || a.$apply();
        }, k);
        g[fa.$$intervalId] = v;
        return fa;
      }

      var g = {};

      f.cancel = function (a) {
        return a && a.$$intervalId in g ? (g[a.$$intervalId].reject("canceled"), b.clearInterval(a.$$intervalId), delete g[a.$$intervalId], !0) : !1;
      };

      return f;
    }];
  }

  function fc(a) {
    a = a.split("/");

    for (var b = a.length; b--;) {
      a[b] = qb(a[b]);
    }

    return a.join("/");
  }

  function jd(a, b) {
    var d = Y(a);
    b.$$protocol = d.protocol;
    b.$$host = d.hostname;
    b.$$port = Z(d.port) || hg[d.protocol] || null;
  }

  function kd(a, b) {
    var d = "/" !== a.charAt(0);
    d && (a = "/" + a);
    var c = Y(a);
    b.$$path = decodeURIComponent(d && "/" === c.pathname.charAt(0) ? c.pathname.substring(1) : c.pathname);
    b.$$search = Ac(c.search);
    b.$$hash = decodeURIComponent(c.hash);
    b.$$path && "/" != b.$$path.charAt(0) && (b.$$path = "/" + b.$$path);
  }

  function ka(a, b) {
    if (0 === b.lastIndexOf(a, 0)) return b.substr(a.length);
  }

  function Ja(a) {
    var b = a.indexOf("#");
    return -1 == b ? a : a.substr(0, b);
  }

  function jb(a) {
    return a.replace(/(#.+)|#$/, "$1");
  }

  function gc(a, b, d) {
    this.$$html5 = !0;
    d = d || "";
    jd(a, this);

    this.$$parse = function (a) {
      var d = ka(b, a);
      if (!G(d)) throw Gb("ipthprfx", a, b);
      kd(d, this);
      this.$$path || (this.$$path = "/");
      this.$$compose();
    };

    this.$$compose = function () {
      var a = Tb(this.$$search),
          d = this.$$hash ? "#" + qb(this.$$hash) : "";
      this.$$url = fc(this.$$path) + (a ? "?" + a : "") + d;
      this.$$absUrl = b + this.$$url.substr(1);
    };

    this.$$parseLinkUrl = function (c, e) {
      if (e && "#" === e[0]) return this.hash(e.slice(1)), !0;
      var f, g;
      w(f = ka(a, c)) ? (g = f, g = w(f = ka(d, f)) ? b + (ka("/", f) || f) : a + g) : w(f = ka(b, c)) ? g = b + f : b == c + "/" && (g = b);
      g && this.$$parse(g);
      return !!g;
    };
  }

  function hc(a, b, d) {
    jd(a, this);

    this.$$parse = function (c) {
      var e = ka(a, c) || ka(b, c),
          f;
      y(e) || "#" !== e.charAt(0) ? this.$$html5 ? f = e : (f = "", y(e) && (a = c, this.replace())) : (f = ka(d, e), y(f) && (f = e));
      kd(f, this);
      c = this.$$path;
      var e = a,
          g = /^\/[A-Z]:(\/.*)/;
      0 === f.lastIndexOf(e, 0) && (f = f.replace(e, ""));
      g.exec(f) || (c = (f = g.exec(c)) ? f[1] : c);
      this.$$path = c;
      this.$$compose();
    };

    this.$$compose = function () {
      var b = Tb(this.$$search),
          e = this.$$hash ? "#" + qb(this.$$hash) : "";
      this.$$url = fc(this.$$path) + (b ? "?" + b : "") + e;
      this.$$absUrl = a + (this.$$url ? d + this.$$url : "");
    };

    this.$$parseLinkUrl = function (b, d) {
      return Ja(a) == Ja(b) ? (this.$$parse(b), !0) : !1;
    };
  }

  function ld(a, b, d) {
    this.$$html5 = !0;
    hc.apply(this, arguments);

    this.$$parseLinkUrl = function (c, e) {
      if (e && "#" === e[0]) return this.hash(e.slice(1)), !0;
      var f, g;
      a == Ja(c) ? f = c : (g = ka(b, c)) ? f = a + d + g : b === c + "/" && (f = b);
      f && this.$$parse(f);
      return !!f;
    };

    this.$$compose = function () {
      var b = Tb(this.$$search),
          e = this.$$hash ? "#" + qb(this.$$hash) : "";
      this.$$url = fc(this.$$path) + (b ? "?" + b : "") + e;
      this.$$absUrl = a + d + this.$$url;
    };
  }

  function Hb(a) {
    return function () {
      return this[a];
    };
  }

  function md(a, b) {
    return function (d) {
      if (y(d)) return this[a];
      this[a] = b(d);
      this.$$compose();
      return this;
    };
  }

  function sf() {
    var a = "",
        b = {
      enabled: !1,
      requireBase: !0,
      rewriteLinks: !0
    };

    this.hashPrefix = function (b) {
      return w(b) ? (a = b, this) : a;
    };

    this.html5Mode = function (a) {
      return Ga(a) ? (b.enabled = a, this) : D(a) ? (Ga(a.enabled) && (b.enabled = a.enabled), Ga(a.requireBase) && (b.requireBase = a.requireBase), Ga(a.rewriteLinks) && (b.rewriteLinks = a.rewriteLinks), this) : b;
    };

    this.$get = ["$rootScope", "$browser", "$sniffer", "$rootElement", "$window", function (d, c, e, f, g) {
      function h(a, b, d) {
        var e = l.url(),
            f = l.$$state;

        try {
          c.url(a, b, d), l.$$state = c.state();
        } catch (g) {
          throw l.url(e), l.$$state = f, g;
        }
      }

      function k(a, b) {
        d.$broadcast("$locationChangeSuccess", l.absUrl(), a, l.$$state, b);
      }

      var l, m;
      m = c.baseHref();
      var n = c.url(),
          p;

      if (b.enabled) {
        if (!m && b.requireBase) throw Gb("nobase");
        p = n.substring(0, n.indexOf("/", n.indexOf("//") + 2)) + (m || "/");
        m = e.history ? gc : ld;
      } else p = Ja(n), m = hc;

      var u = p.substr(0, Ja(p).lastIndexOf("/") + 1);
      l = new m(p, u, "#" + a);
      l.$$parseLinkUrl(n, n);
      l.$$state = c.state();
      var R = /^\s*(javascript|mailto):/i;
      f.on("click", function (a) {
        if (b.rewriteLinks && !a.ctrlKey && !a.metaKey && !a.shiftKey && 2 != a.which && 2 != a.button) {
          for (var e = F(a.target); "a" !== wa(e[0]);) {
            if (e[0] === f[0] || !(e = e.parent())[0]) return;
          }

          var h = e.prop("href"),
              k = e.attr("href") || e.attr("xlink:href");
          D(h) && "[object SVGAnimatedString]" === h.toString() && (h = Y(h.animVal).href);
          R.test(h) || !h || e.attr("target") || a.isDefaultPrevented() || !l.$$parseLinkUrl(h, k) || (a.preventDefault(), l.absUrl() != c.url() && (d.$apply(), g.angular["ff-684208-preventDefault"] = !0));
        }
      });
      jb(l.absUrl()) != jb(n) && c.url(l.absUrl(), !0);
      var q = !0;
      c.onUrlChange(function (a, b) {
        y(ka(u, a)) ? g.location.href = a : (d.$evalAsync(function () {
          var c = l.absUrl(),
              e = l.$$state,
              f;
          a = jb(a);
          l.$$parse(a);
          l.$$state = b;
          f = d.$broadcast("$locationChangeStart", a, c, b, e).defaultPrevented;
          l.absUrl() === a && (f ? (l.$$parse(c), l.$$state = e, h(c, !1, e)) : (q = !1, k(c, e)));
        }), d.$$phase || d.$digest());
      });
      d.$watch(function () {
        var a = jb(c.url()),
            b = jb(l.absUrl()),
            f = c.state(),
            g = l.$$replace,
            m = a !== b || l.$$html5 && e.history && f !== l.$$state;
        if (q || m) q = !1, d.$evalAsync(function () {
          var b = l.absUrl(),
              c = d.$broadcast("$locationChangeStart", b, a, l.$$state, f).defaultPrevented;
          l.absUrl() === b && (c ? (l.$$parse(a), l.$$state = f) : (m && h(b, g, f === l.$$state ? null : l.$$state), k(a, f)));
        });
        l.$$replace = !1;
      });
      return l;
    }];
  }

  function tf() {
    var a = !0,
        b = this;

    this.debugEnabled = function (b) {
      return w(b) ? (a = b, this) : a;
    };

    this.$get = ["$window", function (d) {
      function c(a) {
        a instanceof Error && (a.stack ? a = a.message && -1 === a.stack.indexOf(a.message) ? "Error: " + a.message + "\n" + a.stack : a.stack : a.sourceURL && (a = a.message + "\n" + a.sourceURL + ":" + a.line));
        return a;
      }

      function e(a) {
        var b = d.console || {},
            e = b[a] || b.log || A;
        a = !1;

        try {
          a = !!e.apply;
        } catch (k) {}

        return a ? function () {
          var a = [];
          q(arguments, function (b) {
            a.push(c(b));
          });
          return e.apply(b, a);
        } : function (a, b) {
          e(a, null == b ? "" : b);
        };
      }

      return {
        log: e("log"),
        info: e("info"),
        warn: e("warn"),
        error: e("error"),
        debug: function () {
          var c = e("debug");
          return function () {
            a && c.apply(b, arguments);
          };
        }()
      };
    }];
  }

  function Sa(a, b) {
    if ("__defineGetter__" === a || "__defineSetter__" === a || "__lookupGetter__" === a || "__lookupSetter__" === a || "__proto__" === a) throw X("isecfld", b);
    return a;
  }

  function ig(a) {
    return a + "";
  }

  function ra(a, b) {
    if (a) {
      if (a.constructor === a) throw X("isecfn", b);
      if (a.window === a) throw X("isecwindow", b);
      if (a.children && (a.nodeName || a.prop && a.attr && a.find)) throw X("isecdom", b);
      if (a === Object) throw X("isecobj", b);
    }

    return a;
  }

  function nd(a, b) {
    if (a) {
      if (a.constructor === a) throw X("isecfn", b);
      if (a === jg || a === kg || a === lg) throw X("isecff", b);
    }
  }

  function Ib(a, b) {
    if (a && (a === 0 .constructor || a === (!1).constructor || a === "".constructor || a === {}.constructor || a === [].constructor || a === Function.constructor)) throw X("isecaf", b);
  }

  function mg(a, b) {
    return "undefined" !== typeof a ? a : b;
  }

  function od(a, b) {
    return "undefined" === typeof a ? b : "undefined" === typeof b ? a : a + b;
  }

  function V(a, b) {
    var d, c;

    switch (a.type) {
      case s.Program:
        d = !0;
        q(a.body, function (a) {
          V(a.expression, b);
          d = d && a.expression.constant;
        });
        a.constant = d;
        break;

      case s.Literal:
        a.constant = !0;
        a.toWatch = [];
        break;

      case s.UnaryExpression:
        V(a.argument, b);
        a.constant = a.argument.constant;
        a.toWatch = a.argument.toWatch;
        break;

      case s.BinaryExpression:
        V(a.left, b);
        V(a.right, b);
        a.constant = a.left.constant && a.right.constant;
        a.toWatch = a.left.toWatch.concat(a.right.toWatch);
        break;

      case s.LogicalExpression:
        V(a.left, b);
        V(a.right, b);
        a.constant = a.left.constant && a.right.constant;
        a.toWatch = a.constant ? [] : [a];
        break;

      case s.ConditionalExpression:
        V(a.test, b);
        V(a.alternate, b);
        V(a.consequent, b);
        a.constant = a.test.constant && a.alternate.constant && a.consequent.constant;
        a.toWatch = a.constant ? [] : [a];
        break;

      case s.Identifier:
        a.constant = !1;
        a.toWatch = [a];
        break;

      case s.MemberExpression:
        V(a.object, b);
        a.computed && V(a.property, b);
        a.constant = a.object.constant && (!a.computed || a.property.constant);
        a.toWatch = [a];
        break;

      case s.CallExpression:
        d = a.filter ? !b(a.callee.name).$stateful : !1;
        c = [];
        q(a.arguments, function (a) {
          V(a, b);
          d = d && a.constant;
          a.constant || c.push.apply(c, a.toWatch);
        });
        a.constant = d;
        a.toWatch = a.filter && !b(a.callee.name).$stateful ? c : [a];
        break;

      case s.AssignmentExpression:
        V(a.left, b);
        V(a.right, b);
        a.constant = a.left.constant && a.right.constant;
        a.toWatch = [a];
        break;

      case s.ArrayExpression:
        d = !0;
        c = [];
        q(a.elements, function (a) {
          V(a, b);
          d = d && a.constant;
          a.constant || c.push.apply(c, a.toWatch);
        });
        a.constant = d;
        a.toWatch = c;
        break;

      case s.ObjectExpression:
        d = !0;
        c = [];
        q(a.properties, function (a) {
          V(a.value, b);
          d = d && a.value.constant && !a.computed;
          a.value.constant || c.push.apply(c, a.value.toWatch);
        });
        a.constant = d;
        a.toWatch = c;
        break;

      case s.ThisExpression:
        a.constant = !1;
        a.toWatch = [];
        break;

      case s.LocalsExpression:
        a.constant = !1, a.toWatch = [];
    }
  }

  function pd(a) {
    if (1 == a.length) {
      a = a[0].expression;
      var b = a.toWatch;
      return 1 !== b.length ? b : b[0] !== a ? b : void 0;
    }
  }

  function qd(a) {
    return a.type === s.Identifier || a.type === s.MemberExpression;
  }

  function rd(a) {
    if (1 === a.body.length && qd(a.body[0].expression)) return {
      type: s.AssignmentExpression,
      left: a.body[0].expression,
      right: {
        type: s.NGValueParameter
      },
      operator: "="
    };
  }

  function sd(a) {
    return 0 === a.body.length || 1 === a.body.length && (a.body[0].expression.type === s.Literal || a.body[0].expression.type === s.ArrayExpression || a.body[0].expression.type === s.ObjectExpression);
  }

  function td(a, b) {
    this.astBuilder = a;
    this.$filter = b;
  }

  function ud(a, b) {
    this.astBuilder = a;
    this.$filter = b;
  }

  function Jb(a) {
    return "constructor" == a;
  }

  function ic(a) {
    return z(a.valueOf) ? a.valueOf() : ng.call(a);
  }

  function uf() {
    var a = U(),
        b = U(),
        d = {
      "true": !0,
      "false": !1,
      "null": null,
      undefined: void 0
    },
        c,
        e;

    this.addLiteral = function (a, b) {
      d[a] = b;
    };

    this.setIdentifierFns = function (a, b) {
      c = a;
      e = b;
      return this;
    };

    this.$get = ["$filter", function (f) {
      function g(c, d, e) {
        var g, k, H;
        e = e || J;

        switch (_typeof(c)) {
          case "string":
            H = c = c.trim();
            var E = e ? b : a;
            g = E[H];

            if (!g) {
              ":" === c.charAt(0) && ":" === c.charAt(1) && (k = !0, c = c.substring(2));
              g = e ? r : B;
              var q = new jc(g);
              g = new kc(q, f, g).parse(c);
              g.constant ? g.$$watchDelegate = p : k ? g.$$watchDelegate = g.literal ? n : m : g.inputs && (g.$$watchDelegate = l);
              e && (g = h(g));
              E[H] = g;
            }

            return u(g, d);

          case "function":
            return u(c, d);

          default:
            return u(A, d);
        }
      }

      function h(a) {
        function b(c, d, e, f) {
          var g = J;
          J = !0;

          try {
            return a(c, d, e, f);
          } finally {
            J = g;
          }
        }

        if (!a) return a;
        b.$$watchDelegate = a.$$watchDelegate;
        b.assign = h(a.assign);
        b.constant = a.constant;
        b.literal = a.literal;

        for (var c = 0; a.inputs && c < a.inputs.length; ++c) {
          a.inputs[c] = h(a.inputs[c]);
        }

        b.inputs = a.inputs;
        return b;
      }

      function k(a, b) {
        return null == a || null == b ? a === b : "object" === _typeof(a) && (a = ic(a), "object" === _typeof(a)) ? !1 : a === b || a !== a && b !== b;
      }

      function l(a, b, c, d, e) {
        var f = d.inputs,
            g;

        if (1 === f.length) {
          var h = k,
              f = f[0];
          return a.$watch(function (a) {
            var b = f(a);
            k(b, h) || (g = d(a, void 0, void 0, [b]), h = b && ic(b));
            return g;
          }, b, c, e);
        }

        for (var l = [], m = [], p = 0, n = f.length; p < n; p++) {
          l[p] = k, m[p] = null;
        }

        return a.$watch(function (a) {
          for (var b = !1, c = 0, e = f.length; c < e; c++) {
            var h = f[c](a);
            if (b || (b = !k(h, l[c]))) m[c] = h, l[c] = h && ic(h);
          }

          b && (g = d(a, void 0, void 0, m));
          return g;
        }, b, c, e);
      }

      function m(a, b, c, d) {
        var e, f;
        return e = a.$watch(function (a) {
          return d(a);
        }, function (a, c, d) {
          f = a;
          z(b) && b.apply(this, arguments);
          w(a) && d.$$postDigest(function () {
            w(f) && e();
          });
        }, c);
      }

      function n(a, b, c, d) {
        function e(a) {
          var b = !0;
          q(a, function (a) {
            w(a) || (b = !1);
          });
          return b;
        }

        var f, g;
        return f = a.$watch(function (a) {
          return d(a);
        }, function (a, c, d) {
          g = a;
          z(b) && b.call(this, a, c, d);
          e(a) && d.$$postDigest(function () {
            e(g) && f();
          });
        }, c);
      }

      function p(a, b, c, d) {
        var e;
        return e = a.$watch(function (a) {
          e();
          return d(a);
        }, b, c);
      }

      function u(a, b) {
        if (!b) return a;
        var c = a.$$watchDelegate,
            d = !1,
            c = c !== n && c !== m ? function (c, e, f, g) {
          f = d && g ? g[0] : a(c, e, f, g);
          return b(f, c, e);
        } : function (c, d, e, f) {
          e = a(c, d, e, f);
          c = b(e, c, d);
          return w(e) ? c : e;
        };
        a.$$watchDelegate && a.$$watchDelegate !== l ? c.$$watchDelegate = a.$$watchDelegate : b.$stateful || (c.$$watchDelegate = l, d = !a.inputs, c.inputs = a.inputs ? a.inputs : [a]);
        return c;
      }

      var R = Ba().noUnsafeEval,
          B = {
        csp: R,
        expensiveChecks: !1,
        literals: pa(d),
        isIdentifierStart: z(c) && c,
        isIdentifierContinue: z(e) && e
      },
          r = {
        csp: R,
        expensiveChecks: !0,
        literals: pa(d),
        isIdentifierStart: z(c) && c,
        isIdentifierContinue: z(e) && e
      },
          J = !1;

      g.$$runningExpensiveChecks = function () {
        return J;
      };

      return g;
    }];
  }

  function wf() {
    this.$get = ["$rootScope", "$exceptionHandler", function (a, b) {
      return vd(function (b) {
        a.$evalAsync(b);
      }, b);
    }];
  }

  function xf() {
    this.$get = ["$browser", "$exceptionHandler", function (a, b) {
      return vd(function (b) {
        a.defer(b);
      }, b);
    }];
  }

  function vd(a, b) {
    function d() {
      this.$$state = {
        status: 0
      };
    }

    function c(a, b) {
      return function (c) {
        b.call(a, c);
      };
    }

    function e(c) {
      !c.processScheduled && c.pending && (c.processScheduled = !0, a(function () {
        var a, d, e;
        e = c.pending;
        c.processScheduled = !1;
        c.pending = void 0;

        for (var f = 0, g = e.length; f < g; ++f) {
          d = e[f][0];
          a = e[f][c.status];

          try {
            z(a) ? d.resolve(a(c.value)) : 1 === c.status ? d.resolve(c.value) : d.reject(c.value);
          } catch (h) {
            d.reject(h), b(h);
          }
        }
      }));
    }

    function f() {
      this.promise = new d();
    }

    var g = N("$q", TypeError),
        h = function h() {
      var a = new f();
      a.resolve = c(a, a.resolve);
      a.reject = c(a, a.reject);
      a.notify = c(a, a.notify);
      return a;
    };

    S(d.prototype, {
      then: function then(a, b, c) {
        if (y(a) && y(b) && y(c)) return this;
        var d = new f();
        this.$$state.pending = this.$$state.pending || [];
        this.$$state.pending.push([d, a, b, c]);
        0 < this.$$state.status && e(this.$$state);
        return d.promise;
      },
      "catch": function _catch(a) {
        return this.then(null, a);
      },
      "finally": function _finally(a, b) {
        return this.then(function (b) {
          return l(b, !0, a);
        }, function (b) {
          return l(b, !1, a);
        }, b);
      }
    });
    S(f.prototype, {
      resolve: function resolve(a) {
        this.promise.$$state.status || (a === this.promise ? this.$$reject(g("qcycle", a)) : this.$$resolve(a));
      },
      $$resolve: function $$resolve(a) {
        function d(a) {
          k || (k = !0, h.$$resolve(a));
        }

        function f(a) {
          k || (k = !0, h.$$reject(a));
        }

        var g,
            h = this,
            k = !1;

        try {
          if (D(a) || z(a)) g = a && a.then;
          z(g) ? (this.promise.$$state.status = -1, g.call(a, d, f, c(this, this.notify))) : (this.promise.$$state.value = a, this.promise.$$state.status = 1, e(this.promise.$$state));
        } catch (l) {
          f(l), b(l);
        }
      },
      reject: function reject(a) {
        this.promise.$$state.status || this.$$reject(a);
      },
      $$reject: function $$reject(a) {
        this.promise.$$state.value = a;
        this.promise.$$state.status = 2;
        e(this.promise.$$state);
      },
      notify: function notify(c) {
        var d = this.promise.$$state.pending;
        0 >= this.promise.$$state.status && d && d.length && a(function () {
          for (var a, e, f = 0, g = d.length; f < g; f++) {
            e = d[f][0];
            a = d[f][3];

            try {
              e.notify(z(a) ? a(c) : c);
            } catch (h) {
              b(h);
            }
          }
        });
      }
    });

    var k = function k(a, b) {
      var c = new f();
      b ? c.resolve(a) : c.reject(a);
      return c.promise;
    },
        l = function l(a, b, c) {
      var d = null;

      try {
        z(c) && (d = c());
      } catch (e) {
        return k(e, !1);
      }

      return d && z(d.then) ? d.then(function () {
        return k(a, b);
      }, function (a) {
        return k(a, !1);
      }) : k(a, b);
    },
        m = function m(a, b, c, d) {
      var e = new f();
      e.resolve(a);
      return e.promise.then(b, c, d);
    },
        n = function n(a) {
      if (!z(a)) throw g("norslvr", a);
      var b = new f();
      a(function (a) {
        b.resolve(a);
      }, function (a) {
        b.reject(a);
      });
      return b.promise;
    };

    n.prototype = d.prototype;
    n.defer = h;

    n.reject = function (a) {
      var b = new f();
      b.reject(a);
      return b.promise;
    };

    n.when = m;
    n.resolve = m;

    n.all = function (a) {
      var b = new f(),
          c = 0,
          d = L(a) ? [] : {};
      q(a, function (a, e) {
        c++;
        m(a).then(function (a) {
          d.hasOwnProperty(e) || (d[e] = a, --c || b.resolve(d));
        }, function (a) {
          d.hasOwnProperty(e) || b.reject(a);
        });
      });
      0 === c && b.resolve(d);
      return b.promise;
    };

    n.race = function (a) {
      var b = h();
      q(a, function (a) {
        m(a).then(b.resolve, b.reject);
      });
      return b.promise;
    };

    return n;
  }

  function Gf() {
    this.$get = ["$window", "$timeout", function (a, b) {
      var d = a.requestAnimationFrame || a.webkitRequestAnimationFrame,
          c = a.cancelAnimationFrame || a.webkitCancelAnimationFrame || a.webkitCancelRequestAnimationFrame,
          e = !!d,
          f = e ? function (a) {
        var b = d(a);
        return function () {
          c(b);
        };
      } : function (a) {
        var c = b(a, 16.66, !1);
        return function () {
          b.cancel(c);
        };
      };
      f.supported = e;
      return f;
    }];
  }

  function vf() {
    function a(a) {
      function b() {
        this.$$watchers = this.$$nextSibling = this.$$childHead = this.$$childTail = null;
        this.$$listeners = {};
        this.$$listenerCount = {};
        this.$$watchersCount = 0;
        this.$id = ++pb;
        this.$$ChildScope = null;
      }

      b.prototype = a;
      return b;
    }

    var b = 10,
        d = N("$rootScope"),
        c = null,
        e = null;

    this.digestTtl = function (a) {
      arguments.length && (b = a);
      return b;
    };

    this.$get = ["$exceptionHandler", "$parse", "$browser", function (f, g, h) {
      function k(a) {
        a.currentScope.$$destroyed = !0;
      }

      function l(a) {
        9 === Ea && (a.$$childHead && l(a.$$childHead), a.$$nextSibling && l(a.$$nextSibling));
        a.$parent = a.$$nextSibling = a.$$prevSibling = a.$$childHead = a.$$childTail = a.$root = a.$$watchers = null;
      }

      function m() {
        this.$id = ++pb;
        this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null;
        this.$root = this;
        this.$$destroyed = !1;
        this.$$listeners = {};
        this.$$listenerCount = {};
        this.$$watchersCount = 0;
        this.$$isolateBindings = null;
      }

      function n(a) {
        if (J.$$phase) throw d("inprog", J.$$phase);
        J.$$phase = a;
      }

      function p(a, b) {
        do {
          a.$$watchersCount += b;
        } while (a = a.$parent);
      }

      function u(a, b, c) {
        do {
          a.$$listenerCount[c] -= b, 0 === a.$$listenerCount[c] && delete a.$$listenerCount[c];
        } while (a = a.$parent);
      }

      function s() {}

      function B() {
        for (; t.length;) {
          try {
            t.shift()();
          } catch (a) {
            f(a);
          }
        }

        e = null;
      }

      function r() {
        null === e && (e = h.defer(function () {
          J.$apply(B);
        }));
      }

      m.prototype = {
        constructor: m,
        $new: function $new(b, c) {
          var d;
          c = c || this;
          b ? (d = new m(), d.$root = this.$root) : (this.$$ChildScope || (this.$$ChildScope = a(this)), d = new this.$$ChildScope());
          d.$parent = c;
          d.$$prevSibling = c.$$childTail;
          c.$$childHead ? (c.$$childTail.$$nextSibling = d, c.$$childTail = d) : c.$$childHead = c.$$childTail = d;
          (b || c != this) && d.$on("$destroy", k);
          return d;
        },
        $watch: function $watch(a, b, d, e) {
          var f = g(a);
          if (f.$$watchDelegate) return f.$$watchDelegate(this, b, d, f, a);
          var h = this,
              k = h.$$watchers,
              l = {
            fn: b,
            last: s,
            get: f,
            exp: e || a,
            eq: !!d
          };
          c = null;
          z(b) || (l.fn = A);
          k || (k = h.$$watchers = []);
          k.unshift(l);
          p(this, 1);
          return function () {
            0 <= Za(k, l) && p(h, -1);
            c = null;
          };
        },
        $watchGroup: function $watchGroup(a, b) {
          function c() {
            h = !1;
            k ? (k = !1, b(e, e, g)) : b(e, d, g);
          }

          var d = Array(a.length),
              e = Array(a.length),
              f = [],
              g = this,
              h = !1,
              k = !0;

          if (!a.length) {
            var l = !0;
            g.$evalAsync(function () {
              l && b(e, e, g);
            });
            return function () {
              l = !1;
            };
          }

          if (1 === a.length) return this.$watch(a[0], function (a, c, f) {
            e[0] = a;
            d[0] = c;
            b(e, a === c ? e : d, f);
          });
          q(a, function (a, b) {
            var k = g.$watch(a, function (a, f) {
              e[b] = a;
              d[b] = f;
              h || (h = !0, g.$evalAsync(c));
            });
            f.push(k);
          });
          return function () {
            for (; f.length;) {
              f.shift()();
            }
          };
        },
        $watchCollection: function $watchCollection(a, b) {
          function c(a) {
            e = a;
            var b, d, g, h;

            if (!y(e)) {
              if (D(e)) {
                if (ta(e)) for (f !== n && (f = n, u = f.length = 0, l++), a = e.length, u !== a && (l++, f.length = u = a), b = 0; b < a; b++) {
                  h = f[b], g = e[b], d = h !== h && g !== g, d || h === g || (l++, f[b] = g);
                } else {
                  f !== p && (f = p = {}, u = 0, l++);
                  a = 0;

                  for (b in e) {
                    ua.call(e, b) && (a++, g = e[b], h = f[b], b in f ? (d = h !== h && g !== g, d || h === g || (l++, f[b] = g)) : (u++, f[b] = g, l++));
                  }

                  if (u > a) for (b in l++, f) {
                    ua.call(e, b) || (u--, delete f[b]);
                  }
                }
              } else f !== e && (f = e, l++);
              return l;
            }
          }

          c.$stateful = !0;
          var d = this,
              e,
              f,
              h,
              k = 1 < b.length,
              l = 0,
              m = g(a, c),
              n = [],
              p = {},
              r = !0,
              u = 0;
          return this.$watch(m, function () {
            r ? (r = !1, b(e, e, d)) : b(e, h, d);
            if (k) if (D(e)) {
              if (ta(e)) {
                h = Array(e.length);

                for (var a = 0; a < e.length; a++) {
                  h[a] = e[a];
                }
              } else for (a in h = {}, e) {
                ua.call(e, a) && (h[a] = e[a]);
              }
            } else h = e;
          });
        },
        $digest: function $digest() {
          var a,
              g,
              k,
              l,
              m,
              p,
              u,
              r,
              q = b,
              t,
              y = [],
              A,
              C;
          n("$digest");
          h.$$checkUrlChange();
          this === J && null !== e && (h.defer.cancel(e), B());
          c = null;

          do {
            r = !1;
            t = this;

            for (p = 0; p < v.length; p++) {
              try {
                C = v[p], C.scope.$eval(C.expression, C.locals);
              } catch (F) {
                f(F);
              }

              c = null;
            }

            v.length = 0;

            a: do {
              if (p = t.$$watchers) for (u = p.length; u--;) {
                try {
                  if (a = p[u]) if (m = a.get, (g = m(t)) !== (k = a.last) && !(a.eq ? na(g, k) : "number" === typeof g && "number" === typeof k && isNaN(g) && isNaN(k))) r = !0, c = a, a.last = a.eq ? pa(g, null) : g, l = a.fn, l(g, k === s ? g : k, t), 5 > q && (A = 4 - q, y[A] || (y[A] = []), y[A].push({
                    msg: z(a.exp) ? "fn: " + (a.exp.name || a.exp.toString()) : a.exp,
                    newVal: g,
                    oldVal: k
                  }));else if (a === c) {
                    r = !1;
                    break a;
                  }
                } catch (G) {
                  f(G);
                }
              }
              if (!(p = t.$$watchersCount && t.$$childHead || t !== this && t.$$nextSibling)) for (; t !== this && !(p = t.$$nextSibling);) {
                t = t.$parent;
              }
            } while (t = p);

            if ((r || v.length) && !q--) throw J.$$phase = null, d("infdig", b, y);
          } while (r || v.length);

          for (J.$$phase = null; K < w.length;) {
            try {
              w[K++]();
            } catch (D) {
              f(D);
            }
          }

          w.length = K = 0;
        },
        $destroy: function $destroy() {
          if (!this.$$destroyed) {
            var a = this.$parent;
            this.$broadcast("$destroy");
            this.$$destroyed = !0;
            this === J && h.$$applicationDestroyed();
            p(this, -this.$$watchersCount);

            for (var b in this.$$listenerCount) {
              u(this, this.$$listenerCount[b], b);
            }

            a && a.$$childHead == this && (a.$$childHead = this.$$nextSibling);
            a && a.$$childTail == this && (a.$$childTail = this.$$prevSibling);
            this.$$prevSibling && (this.$$prevSibling.$$nextSibling = this.$$nextSibling);
            this.$$nextSibling && (this.$$nextSibling.$$prevSibling = this.$$prevSibling);
            this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = A;

            this.$on = this.$watch = this.$watchGroup = function () {
              return A;
            };

            this.$$listeners = {};
            this.$$nextSibling = null;
            l(this);
          }
        },
        $eval: function $eval(a, b) {
          return g(a)(this, b);
        },
        $evalAsync: function $evalAsync(a, b) {
          J.$$phase || v.length || h.defer(function () {
            v.length && J.$digest();
          });
          v.push({
            scope: this,
            expression: g(a),
            locals: b
          });
        },
        $$postDigest: function $$postDigest(a) {
          w.push(a);
        },
        $apply: function $apply(a) {
          try {
            n("$apply");

            try {
              return this.$eval(a);
            } finally {
              J.$$phase = null;
            }
          } catch (b) {
            f(b);
          } finally {
            try {
              J.$digest();
            } catch (c) {
              throw f(c), c;
            }
          }
        },
        $applyAsync: function $applyAsync(a) {
          function b() {
            c.$eval(a);
          }

          var c = this;
          a && t.push(b);
          a = g(a);
          r();
        },
        $on: function $on(a, b) {
          var c = this.$$listeners[a];
          c || (this.$$listeners[a] = c = []);
          c.push(b);
          var d = this;

          do {
            d.$$listenerCount[a] || (d.$$listenerCount[a] = 0), d.$$listenerCount[a]++;
          } while (d = d.$parent);

          var e = this;
          return function () {
            var d = c.indexOf(b);
            -1 !== d && (c[d] = null, u(e, 1, a));
          };
        },
        $emit: function $emit(a, b) {
          var c = [],
              d,
              e = this,
              g = !1,
              h = {
            name: a,
            targetScope: e,
            stopPropagation: function stopPropagation() {
              g = !0;
            },
            preventDefault: function preventDefault() {
              h.defaultPrevented = !0;
            },
            defaultPrevented: !1
          },
              k = $a([h], arguments, 1),
              l,
              m;

          do {
            d = e.$$listeners[a] || c;
            h.currentScope = e;
            l = 0;

            for (m = d.length; l < m; l++) {
              if (d[l]) try {
                d[l].apply(null, k);
              } catch (n) {
                f(n);
              } else d.splice(l, 1), l--, m--;
            }

            if (g) return h.currentScope = null, h;
            e = e.$parent;
          } while (e);

          h.currentScope = null;
          return h;
        },
        $broadcast: function $broadcast(a, b) {
          var c = this,
              d = this,
              e = {
            name: a,
            targetScope: this,
            preventDefault: function preventDefault() {
              e.defaultPrevented = !0;
            },
            defaultPrevented: !1
          };
          if (!this.$$listenerCount[a]) return e;

          for (var g = $a([e], arguments, 1), h, k; c = d;) {
            e.currentScope = c;
            d = c.$$listeners[a] || [];
            h = 0;

            for (k = d.length; h < k; h++) {
              if (d[h]) try {
                d[h].apply(null, g);
              } catch (l) {
                f(l);
              } else d.splice(h, 1), h--, k--;
            }

            if (!(d = c.$$listenerCount[a] && c.$$childHead || c !== this && c.$$nextSibling)) for (; c !== this && !(d = c.$$nextSibling);) {
              c = c.$parent;
            }
          }

          e.currentScope = null;
          return e;
        }
      };
      var J = new m(),
          v = J.$$asyncQueue = [],
          w = J.$$postDigestQueue = [],
          t = J.$$applyAsyncQueue = [],
          K = 0;
      return J;
    }];
  }

  function ne() {
    var a = /^\s*(https?|ftp|mailto|tel|file):/,
        b = /^\s*((https?|ftp|file|blob):|data:image\/)/;

    this.aHrefSanitizationWhitelist = function (b) {
      return w(b) ? (a = b, this) : a;
    };

    this.imgSrcSanitizationWhitelist = function (a) {
      return w(a) ? (b = a, this) : b;
    };

    this.$get = function () {
      return function (d, c) {
        var e = c ? b : a,
            f;
        f = Y(d).href;
        return "" === f || f.match(e) ? d : "unsafe:" + f;
      };
    };
  }

  function og(a) {
    if ("self" === a) return a;

    if (G(a)) {
      if (-1 < a.indexOf("***")) throw sa("iwcard", a);
      a = wd(a).replace("\\*\\*", ".*").replace("\\*", "[^:/.?&;]*");
      return new RegExp("^" + a + "$");
    }

    if (Wa(a)) return new RegExp("^" + a.source + "$");
    throw sa("imatcher");
  }

  function xd(a) {
    var b = [];
    w(a) && q(a, function (a) {
      b.push(og(a));
    });
    return b;
  }

  function zf() {
    this.SCE_CONTEXTS = la;
    var a = ["self"],
        b = [];

    this.resourceUrlWhitelist = function (b) {
      arguments.length && (a = xd(b));
      return a;
    };

    this.resourceUrlBlacklist = function (a) {
      arguments.length && (b = xd(a));
      return b;
    };

    this.$get = ["$injector", function (d) {
      function c(a, b) {
        return "self" === a ? id(b) : !!a.exec(b.href);
      }

      function e(a) {
        var b = function b(a) {
          this.$$unwrapTrustedValue = function () {
            return a;
          };
        };

        a && (b.prototype = new a());

        b.prototype.valueOf = function () {
          return this.$$unwrapTrustedValue();
        };

        b.prototype.toString = function () {
          return this.$$unwrapTrustedValue().toString();
        };

        return b;
      }

      var f = function f(a) {
        throw sa("unsafe");
      };

      d.has("$sanitize") && (f = d.get("$sanitize"));
      var g = e(),
          h = {};
      h[la.HTML] = e(g);
      h[la.CSS] = e(g);
      h[la.URL] = e(g);
      h[la.JS] = e(g);
      h[la.RESOURCE_URL] = e(h[la.URL]);
      return {
        trustAs: function trustAs(a, b) {
          var c = h.hasOwnProperty(a) ? h[a] : null;
          if (!c) throw sa("icontext", a, b);
          if (null === b || y(b) || "" === b) return b;
          if ("string" !== typeof b) throw sa("itype", a);
          return new c(b);
        },
        getTrusted: function getTrusted(d, e) {
          if (null === e || y(e) || "" === e) return e;
          var g = h.hasOwnProperty(d) ? h[d] : null;
          if (g && e instanceof g) return e.$$unwrapTrustedValue();

          if (d === la.RESOURCE_URL) {
            var g = Y(e.toString()),
                n,
                p,
                u = !1;
            n = 0;

            for (p = a.length; n < p; n++) {
              if (c(a[n], g)) {
                u = !0;
                break;
              }
            }

            if (u) for (n = 0, p = b.length; n < p; n++) {
              if (c(b[n], g)) {
                u = !1;
                break;
              }
            }
            if (u) return e;
            throw sa("insecurl", e.toString());
          }

          if (d === la.HTML) return f(e);
          throw sa("unsafe");
        },
        valueOf: function valueOf(a) {
          return a instanceof g ? a.$$unwrapTrustedValue() : a;
        }
      };
    }];
  }

  function yf() {
    var a = !0;

    this.enabled = function (b) {
      arguments.length && (a = !!b);
      return a;
    };

    this.$get = ["$parse", "$sceDelegate", function (b, d) {
      if (a && 8 > Ea) throw sa("iequirks");
      var c = ia(la);

      c.isEnabled = function () {
        return a;
      };

      c.trustAs = d.trustAs;
      c.getTrusted = d.getTrusted;
      c.valueOf = d.valueOf;
      a || (c.trustAs = c.getTrusted = function (a, b) {
        return b;
      }, c.valueOf = Xa);

      c.parseAs = function (a, d) {
        var e = b(d);
        return e.literal && e.constant ? e : b(d, function (b) {
          return c.getTrusted(a, b);
        });
      };

      var e = c.parseAs,
          f = c.getTrusted,
          g = c.trustAs;
      q(la, function (a, b) {
        var d = Q(b);

        c[db("parse_as_" + d)] = function (b) {
          return e(a, b);
        };

        c[db("get_trusted_" + d)] = function (b) {
          return f(a, b);
        };

        c[db("trust_as_" + d)] = function (b) {
          return g(a, b);
        };
      });
      return c;
    }];
  }

  function Af() {
    this.$get = ["$window", "$document", function (a, b) {
      var d = {},
          c = !(a.chrome && a.chrome.app && a.chrome.app.runtime) && a.history && a.history.pushState,
          e = Z((/android (\d+)/.exec(Q((a.navigator || {}).userAgent)) || [])[1]),
          f = /Boxee/i.test((a.navigator || {}).userAgent),
          g = b[0] || {},
          h,
          k = /^(Moz|webkit|ms)(?=[A-Z])/,
          l = g.body && g.body.style,
          m = !1,
          n = !1;

      if (l) {
        for (var p in l) {
          if (m = k.exec(p)) {
            h = m[0];
            h = h[0].toUpperCase() + h.substr(1);
            break;
          }
        }

        h || (h = "WebkitOpacity" in l && "webkit");
        m = !!("transition" in l || h + "Transition" in l);
        n = !!("animation" in l || h + "Animation" in l);
        !e || m && n || (m = G(l.webkitTransition), n = G(l.webkitAnimation));
      }

      return {
        history: !(!c || 4 > e || f),
        hasEvent: function hasEvent(a) {
          if ("input" === a && 11 >= Ea) return !1;

          if (y(d[a])) {
            var b = g.createElement("div");
            d[a] = "on" + a in b;
          }

          return d[a];
        },
        csp: Ba(),
        vendorPrefix: h,
        transitions: m,
        animations: n,
        android: e
      };
    }];
  }

  function Cf() {
    var a;

    this.httpOptions = function (b) {
      return b ? (a = b, this) : a;
    };

    this.$get = ["$templateCache", "$http", "$q", "$sce", function (b, d, c, e) {
      function f(g, h) {
        f.totalPendingRequests++;
        if (!G(g) || y(b.get(g))) g = e.getTrustedResourceUrl(g);
        var k = d.defaults && d.defaults.transformResponse;
        L(k) ? k = k.filter(function (a) {
          return a !== dc;
        }) : k === dc && (k = null);
        return d.get(g, S({
          cache: b,
          transformResponse: k
        }, a))["finally"](function () {
          f.totalPendingRequests--;
        }).then(function (a) {
          b.put(g, a.data);
          return a.data;
        }, function (a) {
          if (!h) throw pg("tpload", g, a.status, a.statusText);
          return c.reject(a);
        });
      }

      f.totalPendingRequests = 0;
      return f;
    }];
  }

  function Df() {
    this.$get = ["$rootScope", "$browser", "$location", function (a, b, d) {
      return {
        findBindings: function findBindings(a, b, d) {
          a = a.getElementsByClassName("ng-binding");
          var g = [];
          q(a, function (a) {
            var c = ca.element(a).data("$binding");
            c && q(c, function (c) {
              d ? new RegExp("(^|\\s)" + wd(b) + "(\\s|\\||$)").test(c) && g.push(a) : -1 != c.indexOf(b) && g.push(a);
            });
          });
          return g;
        },
        findModels: function findModels(a, b, d) {
          for (var g = ["ng-", "data-ng-", "ng\\:"], h = 0; h < g.length; ++h) {
            var k = a.querySelectorAll("[" + g[h] + "model" + (d ? "=" : "*=") + '"' + b + '"]');
            if (k.length) return k;
          }
        },
        getLocation: function getLocation() {
          return d.url();
        },
        setLocation: function setLocation(b) {
          b !== d.url() && (d.url(b), a.$digest());
        },
        whenStable: function whenStable(a) {
          b.notifyWhenNoOutstandingRequests(a);
        }
      };
    }];
  }

  function Ef() {
    this.$get = ["$rootScope", "$browser", "$q", "$$q", "$exceptionHandler", function (a, b, d, c, e) {
      function f(f, k, l) {
        z(f) || (l = k, k = f, f = A);
        var m = va.call(arguments, 3),
            n = w(l) && !l,
            p = (n ? c : d).defer(),
            u = p.promise,
            q;
        q = b.defer(function () {
          try {
            p.resolve(f.apply(null, m));
          } catch (b) {
            p.reject(b), e(b);
          } finally {
            delete g[u.$$timeoutId];
          }

          n || a.$apply();
        }, k);
        u.$$timeoutId = q;
        g[q] = p;
        return u;
      }

      var g = {};

      f.cancel = function (a) {
        return a && a.$$timeoutId in g ? (g[a.$$timeoutId].reject("canceled"), delete g[a.$$timeoutId], b.defer.cancel(a.$$timeoutId)) : !1;
      };

      return f;
    }];
  }

  function Y(a) {
    Ea && ($.setAttribute("href", a), a = $.href);
    $.setAttribute("href", a);
    return {
      href: $.href,
      protocol: $.protocol ? $.protocol.replace(/:$/, "") : "",
      host: $.host,
      search: $.search ? $.search.replace(/^\?/, "") : "",
      hash: $.hash ? $.hash.replace(/^#/, "") : "",
      hostname: $.hostname,
      port: $.port,
      pathname: "/" === $.pathname.charAt(0) ? $.pathname : "/" + $.pathname
    };
  }

  function id(a) {
    a = G(a) ? Y(a) : a;
    return a.protocol === yd.protocol && a.host === yd.host;
  }

  function Ff() {
    this.$get = ha(C);
  }

  function zd(a) {
    function b(a) {
      try {
        return decodeURIComponent(a);
      } catch (b) {
        return a;
      }
    }

    var d = a[0] || {},
        c = {},
        e = "";
    return function () {
      var a, g, h, k, l;
      a = d.cookie || "";
      if (a !== e) for (e = a, a = e.split("; "), c = {}, h = 0; h < a.length; h++) {
        g = a[h], k = g.indexOf("="), 0 < k && (l = b(g.substring(0, k)), y(c[l]) && (c[l] = b(g.substring(k + 1))));
      }
      return c;
    };
  }

  function Jf() {
    this.$get = zd;
  }

  function Mc(a) {
    function b(d, c) {
      if (D(d)) {
        var e = {};
        q(d, function (a, c) {
          e[c] = b(c, a);
        });
        return e;
      }

      return a.factory(d + "Filter", c);
    }

    this.register = b;
    this.$get = ["$injector", function (a) {
      return function (b) {
        return a.get(b + "Filter");
      };
    }];
    b("currency", Ad);
    b("date", Bd);
    b("filter", qg);
    b("json", rg);
    b("limitTo", sg);
    b("lowercase", tg);
    b("number", Cd);
    b("orderBy", Dd);
    b("uppercase", ug);
  }

  function qg() {
    return function (a, b, d, c) {
      if (!ta(a)) {
        if (null == a) return a;
        throw N("filter")("notarray", a);
      }

      c = c || "$";
      var e;

      switch (lc(b)) {
        case "function":
          break;

        case "boolean":
        case "null":
        case "number":
        case "string":
          e = !0;

        case "object":
          b = vg(b, d, c, e);
          break;

        default:
          return a;
      }

      return Array.prototype.filter.call(a, b);
    };
  }

  function vg(a, b, d, c) {
    var e = D(a) && d in a;
    !0 === b ? b = na : z(b) || (b = function b(a, _b) {
      if (y(a)) return !1;
      if (null === a || null === _b) return a === _b;
      if (D(_b) || D(a) && !vc(a)) return !1;
      a = Q("" + a);
      _b = Q("" + _b);
      return -1 !== a.indexOf(_b);
    });
    return function (f) {
      return e && !D(f) ? La(f, a[d], b, d, !1) : La(f, a, b, d, c);
    };
  }

  function La(a, b, d, c, e, f) {
    var g = lc(a),
        h = lc(b);
    if ("string" === h && "!" === b.charAt(0)) return !La(a, b.substring(1), d, c, e);
    if (L(a)) return a.some(function (a) {
      return La(a, b, d, c, e);
    });

    switch (g) {
      case "object":
        var k;

        if (e) {
          for (k in a) {
            if ("$" !== k.charAt(0) && La(a[k], b, d, c, !0)) return !0;
          }

          return f ? !1 : La(a, b, d, c, !1);
        }

        if ("object" === h) {
          for (k in b) {
            if (f = b[k], !z(f) && !y(f) && (g = k === c, !La(g ? a : a[k], f, d, c, g, g))) return !1;
          }

          return !0;
        }

        return d(a, b);

      case "function":
        return !1;

      default:
        return d(a, b);
    }
  }

  function lc(a) {
    return null === a ? "null" : _typeof(a);
  }

  function Ad(a) {
    var b = a.NUMBER_FORMATS;
    return function (a, c, e) {
      y(c) && (c = b.CURRENCY_SYM);
      y(e) && (e = b.PATTERNS[1].maxFrac);
      return null == a ? a : Ed(a, b.PATTERNS[1], b.GROUP_SEP, b.DECIMAL_SEP, e).replace(/\u00A4/g, c);
    };
  }

  function Cd(a) {
    var b = a.NUMBER_FORMATS;
    return function (a, c) {
      return null == a ? a : Ed(a, b.PATTERNS[0], b.GROUP_SEP, b.DECIMAL_SEP, c);
    };
  }

  function wg(a) {
    var b = 0,
        d,
        c,
        e,
        f,
        g;
    -1 < (c = a.indexOf(Fd)) && (a = a.replace(Fd, ""));
    0 < (e = a.search(/e/i)) ? (0 > c && (c = e), c += +a.slice(e + 1), a = a.substring(0, e)) : 0 > c && (c = a.length);

    for (e = 0; a.charAt(e) == mc; e++) {
      ;
    }

    if (e == (g = a.length)) d = [0], c = 1;else {
      for (g--; a.charAt(g) == mc;) {
        g--;
      }

      c -= e;
      d = [];

      for (f = 0; e <= g; e++, f++) {
        d[f] = +a.charAt(e);
      }
    }
    c > Gd && (d = d.splice(0, Gd - 1), b = c - 1, c = 1);
    return {
      d: d,
      e: b,
      i: c
    };
  }

  function xg(a, b, d, c) {
    var e = a.d,
        f = e.length - a.i;
    b = y(b) ? Math.min(Math.max(d, f), c) : +b;
    d = b + a.i;
    c = e[d];

    if (0 < d) {
      e.splice(Math.max(a.i, d));

      for (var g = d; g < e.length; g++) {
        e[g] = 0;
      }
    } else for (f = Math.max(0, f), a.i = 1, e.length = Math.max(1, d = b + 1), e[0] = 0, g = 1; g < d; g++) {
      e[g] = 0;
    }

    if (5 <= c) if (0 > d - 1) {
      for (c = 0; c > d; c--) {
        e.unshift(0), a.i++;
      }

      e.unshift(1);
      a.i++;
    } else e[d - 1]++;

    for (; f < Math.max(0, b); f++) {
      e.push(0);
    }

    if (b = e.reduceRight(function (a, b, c, d) {
      b += a;
      d[c] = b % 10;
      return Math.floor(b / 10);
    }, 0)) e.unshift(b), a.i++;
  }

  function Ed(a, b, d, c, e) {
    if (!G(a) && !T(a) || isNaN(a)) return "";
    var f = !isFinite(a),
        g = !1,
        h = Math.abs(a) + "",
        k = "";
    if (f) k = "\u221E";else {
      g = wg(h);
      xg(g, e, b.minFrac, b.maxFrac);
      k = g.d;
      h = g.i;
      e = g.e;
      f = [];

      for (g = k.reduce(function (a, b) {
        return a && !b;
      }, !0); 0 > h;) {
        k.unshift(0), h++;
      }

      0 < h ? f = k.splice(h, k.length) : (f = k, k = [0]);
      h = [];

      for (k.length >= b.lgSize && h.unshift(k.splice(-b.lgSize, k.length).join("")); k.length > b.gSize;) {
        h.unshift(k.splice(-b.gSize, k.length).join(""));
      }

      k.length && h.unshift(k.join(""));
      k = h.join(d);
      f.length && (k += c + f.join(""));
      e && (k += "e+" + e);
    }
    return 0 > a && !g ? b.negPre + k + b.negSuf : b.posPre + k + b.posSuf;
  }

  function Kb(a, b, d, c) {
    var e = "";
    if (0 > a || c && 0 >= a) c ? a = -a + 1 : (a = -a, e = "-");

    for (a = "" + a; a.length < b;) {
      a = mc + a;
    }

    d && (a = a.substr(a.length - b));
    return e + a;
  }

  function ba(a, b, d, c, e) {
    d = d || 0;
    return function (f) {
      f = f["get" + a]();
      if (0 < d || f > -d) f += d;
      0 === f && -12 == d && (f = 12);
      return Kb(f, b, c, e);
    };
  }

  function kb(a, b, d) {
    return function (c, e) {
      var f = c["get" + a](),
          g = ub((d ? "STANDALONE" : "") + (b ? "SHORT" : "") + a);
      return e[g][f];
    };
  }

  function Hd(a) {
    var b = new Date(a, 0, 1).getDay();
    return new Date(a, 0, (4 >= b ? 5 : 12) - b);
  }

  function Id(a) {
    return function (b) {
      var d = Hd(b.getFullYear());
      b = +new Date(b.getFullYear(), b.getMonth(), b.getDate() + (4 - b.getDay())) - +d;
      b = 1 + Math.round(b / 6048E5);
      return Kb(b, a);
    };
  }

  function nc(a, b) {
    return 0 >= a.getFullYear() ? b.ERAS[0] : b.ERAS[1];
  }

  function Bd(a) {
    function b(a) {
      var b;

      if (b = a.match(d)) {
        a = new Date(0);
        var f = 0,
            g = 0,
            h = b[8] ? a.setUTCFullYear : a.setFullYear,
            k = b[8] ? a.setUTCHours : a.setHours;
        b[9] && (f = Z(b[9] + b[10]), g = Z(b[9] + b[11]));
        h.call(a, Z(b[1]), Z(b[2]) - 1, Z(b[3]));
        f = Z(b[4] || 0) - f;
        g = Z(b[5] || 0) - g;
        h = Z(b[6] || 0);
        b = Math.round(1E3 * parseFloat("0." + (b[7] || 0)));
        k.call(a, f, g, h, b);
      }

      return a;
    }

    var d = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
    return function (c, d, f) {
      var g = "",
          h = [],
          k,
          l;
      d = d || "mediumDate";
      d = a.DATETIME_FORMATS[d] || d;
      G(c) && (c = yg.test(c) ? Z(c) : b(c));
      T(c) && (c = new Date(c));
      if (!da(c) || !isFinite(c.getTime())) return c;

      for (; d;) {
        (l = zg.exec(d)) ? (h = $a(h, l, 1), d = h.pop()) : (h.push(d), d = null);
      }

      var m = c.getTimezoneOffset();
      f && (m = yc(f, m), c = Sb(c, f, !0));
      q(h, function (b) {
        k = Ag[b];
        g += k ? k(c, a.DATETIME_FORMATS, m) : "''" === b ? "'" : b.replace(/(^'|'$)/g, "").replace(/''/g, "'");
      });
      return g;
    };
  }

  function rg() {
    return function (a, b) {
      y(b) && (b = 2);
      return bb(a, b);
    };
  }

  function sg() {
    return function (a, b, d) {
      b = Infinity === Math.abs(Number(b)) ? Number(b) : Z(b);
      if (isNaN(b)) return a;
      T(a) && (a = a.toString());
      if (!ta(a)) return a;
      d = !d || isNaN(d) ? 0 : Z(d);
      d = 0 > d ? Math.max(0, a.length + d) : d;
      return 0 <= b ? oc(a, d, d + b) : 0 === d ? oc(a, b, a.length) : oc(a, Math.max(0, d + b), d);
    };
  }

  function oc(a, b, d) {
    return G(a) ? a.slice(b, d) : va.call(a, b, d);
  }

  function Dd(a) {
    function b(b) {
      return b.map(function (b) {
        var c = 1,
            d = Xa;
        if (z(b)) d = b;else if (G(b)) {
          if ("+" == b.charAt(0) || "-" == b.charAt(0)) c = "-" == b.charAt(0) ? -1 : 1, b = b.substring(1);
          if ("" !== b && (d = a(b), d.constant)) var e = d(),
              d = function d(a) {
            return a[e];
          };
        }
        return {
          get: d,
          descending: c
        };
      });
    }

    function d(a) {
      switch (_typeof(a)) {
        case "number":
        case "boolean":
        case "string":
          return !0;

        default:
          return !1;
      }
    }

    function c(a, b) {
      var c = 0,
          d = a.type,
          k = b.type;

      if (d === k) {
        var k = a.value,
            l = b.value;
        "string" === d ? (k = k.toLowerCase(), l = l.toLowerCase()) : "object" === d && (D(k) && (k = a.index), D(l) && (l = b.index));
        k !== l && (c = k < l ? -1 : 1);
      } else c = d < k ? -1 : 1;

      return c;
    }

    return function (a, f, g, h) {
      if (null == a) return a;
      if (!ta(a)) throw N("orderBy")("notarray", a);
      L(f) || (f = [f]);
      0 === f.length && (f = ["+"]);
      var k = b(f),
          l = g ? -1 : 1,
          m = z(h) ? h : c;
      a = Array.prototype.map.call(a, function (a, b) {
        return {
          value: a,
          tieBreaker: {
            value: b,
            type: "number",
            index: b
          },
          predicateValues: k.map(function (c) {
            var e = c.get(a);
            c = _typeof(e);
            if (null === e) c = "string", e = "null";else if ("object" === c) a: {
              if (z(e.valueOf) && (e = e.valueOf(), d(e))) break a;
              vc(e) && (e = e.toString(), d(e));
            }
            return {
              value: e,
              type: c,
              index: b
            };
          })
        };
      });
      a.sort(function (a, b) {
        for (var c = 0, d = k.length; c < d; c++) {
          var e = m(a.predicateValues[c], b.predicateValues[c]);
          if (e) return e * k[c].descending * l;
        }

        return m(a.tieBreaker, b.tieBreaker) * l;
      });
      return a = a.map(function (a) {
        return a.value;
      });
    };
  }

  function Ta(a) {
    z(a) && (a = {
      link: a
    });
    a.restrict = a.restrict || "AC";
    return ha(a);
  }

  function Jd(a, b, d, c, e) {
    var f = this,
        g = [];
    f.$error = {};
    f.$$success = {};
    f.$pending = void 0;
    f.$name = e(b.name || b.ngForm || "")(d);
    f.$dirty = !1;
    f.$pristine = !0;
    f.$valid = !0;
    f.$invalid = !1;
    f.$submitted = !1;
    f.$$parentForm = Lb;

    f.$rollbackViewValue = function () {
      q(g, function (a) {
        a.$rollbackViewValue();
      });
    };

    f.$commitViewValue = function () {
      q(g, function (a) {
        a.$commitViewValue();
      });
    };

    f.$addControl = function (a) {
      Qa(a.$name, "input");
      g.push(a);
      a.$name && (f[a.$name] = a);
      a.$$parentForm = f;
    };

    f.$$renameControl = function (a, b) {
      var c = a.$name;
      f[c] === a && delete f[c];
      f[b] = a;
      a.$name = b;
    };

    f.$removeControl = function (a) {
      a.$name && f[a.$name] === a && delete f[a.$name];
      q(f.$pending, function (b, c) {
        f.$setValidity(c, null, a);
      });
      q(f.$error, function (b, c) {
        f.$setValidity(c, null, a);
      });
      q(f.$$success, function (b, c) {
        f.$setValidity(c, null, a);
      });
      Za(g, a);
      a.$$parentForm = Lb;
    };

    Kd({
      ctrl: this,
      $element: a,
      set: function set(a, b, c) {
        var d = a[b];
        d ? -1 === d.indexOf(c) && d.push(c) : a[b] = [c];
      },
      unset: function unset(a, b, c) {
        var d = a[b];
        d && (Za(d, c), 0 === d.length && delete a[b]);
      },
      $animate: c
    });

    f.$setDirty = function () {
      c.removeClass(a, Ua);
      c.addClass(a, Mb);
      f.$dirty = !0;
      f.$pristine = !1;
      f.$$parentForm.$setDirty();
    };

    f.$setPristine = function () {
      c.setClass(a, Ua, Mb + " ng-submitted");
      f.$dirty = !1;
      f.$pristine = !0;
      f.$submitted = !1;
      q(g, function (a) {
        a.$setPristine();
      });
    };

    f.$setUntouched = function () {
      q(g, function (a) {
        a.$setUntouched();
      });
    };

    f.$setSubmitted = function () {
      c.addClass(a, "ng-submitted");
      f.$submitted = !0;
      f.$$parentForm.$setSubmitted();
    };
  }

  function pc(a) {
    a.$formatters.push(function (b) {
      return a.$isEmpty(b) ? b : b.toString();
    });
  }

  function lb(a, b, d, c, e, f) {
    var g = Q(b[0].type);

    if (!e.android) {
      var h = !1;
      b.on("compositionstart", function () {
        h = !0;
      });
      b.on("compositionend", function () {
        h = !1;
        l();
      });
    }

    var k,
        l = function l(a) {
      k && (f.defer.cancel(k), k = null);

      if (!h) {
        var e = b.val();
        a = a && a.type;
        "password" === g || d.ngTrim && "false" === d.ngTrim || (e = W(e));
        (c.$viewValue !== e || "" === e && c.$$hasNativeValidators) && c.$setViewValue(e, a);
      }
    };

    if (e.hasEvent("input")) b.on("input", l);else {
      var m = function m(a, b, c) {
        k || (k = f.defer(function () {
          k = null;
          b && b.value === c || l(a);
        }));
      };

      b.on("keydown", function (a) {
        var b = a.keyCode;
        91 === b || 15 < b && 19 > b || 37 <= b && 40 >= b || m(a, this, this.value);
      });
      if (e.hasEvent("paste")) b.on("paste cut", m);
    }
    b.on("change", l);
    if (Ld[g] && c.$$hasNativeValidators && g === d.type) b.on("keydown wheel mousedown", function (a) {
      if (!k) {
        var b = this.validity,
            c = b.badInput,
            d = b.typeMismatch;
        k = f.defer(function () {
          k = null;
          b.badInput === c && b.typeMismatch === d || l(a);
        });
      }
    });

    c.$render = function () {
      var a = c.$isEmpty(c.$viewValue) ? "" : c.$viewValue;
      b.val() !== a && b.val(a);
    };
  }

  function Nb(a, b) {
    return function (d, c) {
      var e, f;
      if (da(d)) return d;

      if (G(d)) {
        '"' == d.charAt(0) && '"' == d.charAt(d.length - 1) && (d = d.substring(1, d.length - 1));
        if (Bg.test(d)) return new Date(d);
        a.lastIndex = 0;
        if (e = a.exec(d)) return e.shift(), f = c ? {
          yyyy: c.getFullYear(),
          MM: c.getMonth() + 1,
          dd: c.getDate(),
          HH: c.getHours(),
          mm: c.getMinutes(),
          ss: c.getSeconds(),
          sss: c.getMilliseconds() / 1E3
        } : {
          yyyy: 1970,
          MM: 1,
          dd: 1,
          HH: 0,
          mm: 0,
          ss: 0,
          sss: 0
        }, q(e, function (a, c) {
          c < b.length && (f[b[c]] = +a);
        }), new Date(f.yyyy, f.MM - 1, f.dd, f.HH, f.mm, f.ss || 0, 1E3 * f.sss || 0);
      }

      return NaN;
    };
  }

  function mb(a, b, d, c) {
    return function (e, f, g, h, k, l, m) {
      function n(a) {
        return a && !(a.getTime && a.getTime() !== a.getTime());
      }

      function p(a) {
        return w(a) && !da(a) ? d(a) || void 0 : a;
      }

      Md(e, f, g, h);
      lb(e, f, g, h, k, l);
      var u = h && h.$options && h.$options.timezone,
          q;
      h.$$parserName = a;
      h.$parsers.push(function (a) {
        if (h.$isEmpty(a)) return null;
        if (b.test(a)) return a = d(a, q), u && (a = Sb(a, u)), a;
      });
      h.$formatters.push(function (a) {
        if (a && !da(a)) throw nb("datefmt", a);
        if (n(a)) return (q = a) && u && (q = Sb(q, u, !0)), m("date")(a, c, u);
        q = null;
        return "";
      });

      if (w(g.min) || g.ngMin) {
        var s;

        h.$validators.min = function (a) {
          return !n(a) || y(s) || d(a) >= s;
        };

        g.$observe("min", function (a) {
          s = p(a);
          h.$validate();
        });
      }

      if (w(g.max) || g.ngMax) {
        var r;

        h.$validators.max = function (a) {
          return !n(a) || y(r) || d(a) <= r;
        };

        g.$observe("max", function (a) {
          r = p(a);
          h.$validate();
        });
      }
    };
  }

  function Md(a, b, d, c) {
    (c.$$hasNativeValidators = D(b[0].validity)) && c.$parsers.push(function (a) {
      var c = b.prop("validity") || {};
      return c.badInput || c.typeMismatch ? void 0 : a;
    });
  }

  function Nd(a, b, d, c, e) {
    if (w(c)) {
      a = a(c);
      if (!a.constant) throw nb("constexpr", d, c);
      return a(b);
    }

    return e;
  }

  function qc(a, b) {
    a = "ngClass" + a;
    return ["$animate", function (d) {
      function c(a, b) {
        var c = [],
            d = 0;

        a: for (; d < a.length; d++) {
          for (var e = a[d], m = 0; m < b.length; m++) {
            if (e == b[m]) continue a;
          }

          c.push(e);
        }

        return c;
      }

      function e(a) {
        var b = [];
        return L(a) ? (q(a, function (a) {
          b = b.concat(e(a));
        }), b) : G(a) ? a.split(" ") : D(a) ? (q(a, function (a, c) {
          a && (b = b.concat(c.split(" ")));
        }), b) : a;
      }

      return {
        restrict: "AC",
        link: function link(f, g, h) {
          function k(a) {
            a = l(a, 1);
            h.$addClass(a);
          }

          function l(a, b) {
            var c = g.data("$classCounts") || U(),
                d = [];
            q(a, function (a) {
              if (0 < b || c[a]) c[a] = (c[a] || 0) + b, c[a] === +(0 < b) && d.push(a);
            });
            g.data("$classCounts", c);
            return d.join(" ");
          }

          function m(a, b) {
            var e = c(b, a),
                f = c(a, b),
                e = l(e, 1),
                f = l(f, -1);
            e && e.length && d.addClass(g, e);
            f && f.length && d.removeClass(g, f);
          }

          function n(a) {
            if (!0 === b || (f.$index & 1) === b) {
              var c = e(a || []);
              if (!p) k(c);else if (!na(a, p)) {
                var d = e(p);
                m(d, c);
              }
            }

            p = L(a) ? a.map(function (a) {
              return ia(a);
            }) : ia(a);
          }

          var p;
          f.$watch(h[a], n, !0);
          h.$observe("class", function (b) {
            n(f.$eval(h[a]));
          });
          "ngClass" !== a && f.$watch("$index", function (c, d) {
            var g = c & 1;

            if (g !== (d & 1)) {
              var m = e(f.$eval(h[a]));
              g === b ? k(m) : (g = l(m, -1), h.$removeClass(g));
            }
          });
        }
      };
    }];
  }

  function Kd(a) {
    function b(a, b) {
      b && !f[a] ? (k.addClass(e, a), f[a] = !0) : !b && f[a] && (k.removeClass(e, a), f[a] = !1);
    }

    function d(a, c) {
      a = a ? "-" + Cc(a, "-") : "";
      b(ob + a, !0 === c);
      b(Od + a, !1 === c);
    }

    var c = a.ctrl,
        e = a.$element,
        f = {},
        g = a.set,
        h = a.unset,
        k = a.$animate;
    f[Od] = !(f[ob] = e.hasClass(ob));

    c.$setValidity = function (a, e, f) {
      y(e) ? (c.$pending || (c.$pending = {}), g(c.$pending, a, f)) : (c.$pending && h(c.$pending, a, f), Pd(c.$pending) && (c.$pending = void 0));
      Ga(e) ? e ? (h(c.$error, a, f), g(c.$$success, a, f)) : (g(c.$error, a, f), h(c.$$success, a, f)) : (h(c.$error, a, f), h(c.$$success, a, f));
      c.$pending ? (b(Qd, !0), c.$valid = c.$invalid = void 0, d("", null)) : (b(Qd, !1), c.$valid = Pd(c.$error), c.$invalid = !c.$valid, d("", c.$valid));
      e = c.$pending && c.$pending[a] ? void 0 : c.$error[a] ? !1 : c.$$success[a] ? !0 : null;
      d(a, e);
      c.$$parentForm.$setValidity(a, e, c);
    };
  }

  function Pd(a) {
    if (a) for (var b in a) {
      if (a.hasOwnProperty(b)) return !1;
    }
    return !0;
  }

  var Cg = /^\/(.+)\/([a-z]*)$/,
      ua = Object.prototype.hasOwnProperty,
      Q = function Q(a) {
    return G(a) ? a.toLowerCase() : a;
  },
      ub = function ub(a) {
    return G(a) ? a.toUpperCase() : a;
  },
      Ea,
      F,
      qa,
      va = [].slice,
      bg = [].splice,
      Dg = [].push,
      ma = Object.prototype.toString,
      wc = Object.getPrototypeOf,
      xa = N("ng"),
      ca = C.angular || (C.angular = {}),
      Ub,
      pb = 0;

  Ea = C.document.documentMode;
  A.$inject = [];
  Xa.$inject = [];

  var L = Array.isArray,
      ae = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/,
      W = function W(a) {
    return G(a) ? a.trim() : a;
  },
      wd = function wd(a) {
    return a.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08");
  },
      Ba = function Ba() {
    if (!w(Ba.rules)) {
      var a = C.document.querySelector("[ng-csp]") || C.document.querySelector("[data-ng-csp]");

      if (a) {
        var b = a.getAttribute("ng-csp") || a.getAttribute("data-ng-csp");
        Ba.rules = {
          noUnsafeEval: !b || -1 !== b.indexOf("no-unsafe-eval"),
          noInlineStyle: !b || -1 !== b.indexOf("no-inline-style")
        };
      } else {
        a = Ba;

        try {
          new Function(""), b = !1;
        } catch (d) {
          b = !0;
        }

        a.rules = {
          noUnsafeEval: b,
          noInlineStyle: !1
        };
      }
    }

    return Ba.rules;
  },
      rb = function rb() {
    if (w(rb.name_)) return rb.name_;
    var a,
        b,
        d = Na.length,
        c,
        e;

    for (b = 0; b < d; ++b) {
      if (c = Na[b], a = C.document.querySelector("[" + c.replace(":", "\\:") + "jq]")) {
        e = a.getAttribute(c + "jq");
        break;
      }
    }

    return rb.name_ = e;
  },
      de = /:/g,
      Na = ["ng-", "data-ng-", "ng:", "x-ng-"],
      ie = /[A-Z]/g,
      Dc = !1,
      Ma = 3,
      me = {
    full: "1.5.8",
    major: 1,
    minor: 5,
    dot: 8,
    codeName: "arbitrary-fallbacks"
  };

  O.expando = "ng339";
  var fb = O.cache = {},
      Pf = 1;

  O._data = function (a) {
    return this.cache[a[this.expando]] || {};
  };

  var Kf = /([\:\-\_]+(.))/g,
      Lf = /^moz([A-Z])/,
      yb = {
    mouseleave: "mouseout",
    mouseenter: "mouseover"
  },
      Wb = N("jqLite"),
      Of = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,
      Vb = /<|&#?\w+;/,
      Mf = /<([\w:-]+)/,
      Nf = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,
      ja = {
    option: [1, '<select multiple="multiple">', "</select>"],
    thead: [1, "<table>", "</table>"],
    col: [2, "<table><colgroup>", "</colgroup></table>"],
    tr: [2, "<table><tbody>", "</tbody></table>"],
    td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
    _default: [0, "", ""]
  };
  ja.optgroup = ja.option;
  ja.tbody = ja.tfoot = ja.colgroup = ja.caption = ja.thead;
  ja.th = ja.td;

  var Uf = C.Node.prototype.contains || function (a) {
    return !!(this.compareDocumentPosition(a) & 16);
  },
      Oa = O.prototype = {
    ready: function ready(a) {
      function b() {
        d || (d = !0, a());
      }

      var d = !1;
      "complete" === C.document.readyState ? C.setTimeout(b) : (this.on("DOMContentLoaded", b), O(C).on("load", b));
    },
    toString: function toString() {
      var a = [];
      q(this, function (b) {
        a.push("" + b);
      });
      return "[" + a.join(", ") + "]";
    },
    eq: function eq(a) {
      return 0 <= a ? F(this[a]) : F(this[this.length + a]);
    },
    length: 0,
    push: Dg,
    sort: [].sort,
    splice: [].splice
  },
      Eb = {};

  q("multiple selected checked disabled readOnly required open".split(" "), function (a) {
    Eb[Q(a)] = a;
  });
  var Vc = {};
  q("input select option textarea button form details".split(" "), function (a) {
    Vc[a] = !0;
  });
  var bd = {
    ngMinlength: "minlength",
    ngMaxlength: "maxlength",
    ngMin: "min",
    ngMax: "max",
    ngPattern: "pattern"
  };
  q({
    data: Yb,
    removeData: eb,
    hasData: function hasData(a) {
      for (var b in fb[a.ng339]) {
        return !0;
      }

      return !1;
    },
    cleanData: function cleanData(a) {
      for (var b = 0, d = a.length; b < d; b++) {
        eb(a[b]);
      }
    }
  }, function (a, b) {
    O[b] = a;
  });
  q({
    data: Yb,
    inheritedData: Cb,
    scope: function scope(a) {
      return F.data(a, "$scope") || Cb(a.parentNode || a, ["$isolateScope", "$scope"]);
    },
    isolateScope: function isolateScope(a) {
      return F.data(a, "$isolateScope") || F.data(a, "$isolateScopeNoTemplate");
    },
    controller: Sc,
    injector: function injector(a) {
      return Cb(a, "$injector");
    },
    removeAttr: function removeAttr(a, b) {
      a.removeAttribute(b);
    },
    hasClass: zb,
    css: function css(a, b, d) {
      b = db(b);
      if (w(d)) a.style[b] = d;else return a.style[b];
    },
    attr: function attr(a, b, d) {
      var c = a.nodeType;
      if (c !== Ma && 2 !== c && 8 !== c) if (c = Q(b), Eb[c]) {
        if (w(d)) d ? (a[b] = !0, a.setAttribute(b, c)) : (a[b] = !1, a.removeAttribute(c));else return a[b] || (a.attributes.getNamedItem(b) || A).specified ? c : void 0;
      } else if (w(d)) a.setAttribute(b, d);else if (a.getAttribute) return a = a.getAttribute(b, 2), null === a ? void 0 : a;
    },
    prop: function prop(a, b, d) {
      if (w(d)) a[b] = d;else return a[b];
    },
    text: function () {
      function a(a, d) {
        if (y(d)) {
          var c = a.nodeType;
          return 1 === c || c === Ma ? a.textContent : "";
        }

        a.textContent = d;
      }

      a.$dv = "";
      return a;
    }(),
    val: function val(a, b) {
      if (y(b)) {
        if (a.multiple && "select" === wa(a)) {
          var d = [];
          q(a.options, function (a) {
            a.selected && d.push(a.value || a.text);
          });
          return 0 === d.length ? null : d;
        }

        return a.value;
      }

      a.value = b;
    },
    html: function html(a, b) {
      if (y(b)) return a.innerHTML;
      wb(a, !0);
      a.innerHTML = b;
    },
    empty: Tc
  }, function (a, b) {
    O.prototype[b] = function (b, c) {
      var e,
          f,
          g = this.length;

      if (a !== Tc && y(2 == a.length && a !== zb && a !== Sc ? b : c)) {
        if (D(b)) {
          for (e = 0; e < g; e++) {
            if (a === Yb) a(this[e], b);else for (f in b) {
              a(this[e], f, b[f]);
            }
          }

          return this;
        }

        e = a.$dv;
        g = y(e) ? Math.min(g, 1) : g;

        for (f = 0; f < g; f++) {
          var h = a(this[f], b, c);
          e = e ? e + h : h;
        }

        return e;
      }

      for (e = 0; e < g; e++) {
        a(this[e], b, c);
      }

      return this;
    };
  });
  q({
    removeData: eb,
    on: function on(a, b, d, c) {
      if (w(c)) throw Wb("onargs");

      if (Nc(a)) {
        c = xb(a, !0);
        var e = c.events,
            f = c.handle;
        f || (f = c.handle = Rf(a, e));
        c = 0 <= b.indexOf(" ") ? b.split(" ") : [b];

        for (var g = c.length, h = function h(b, c, g) {
          var h = e[b];
          h || (h = e[b] = [], h.specialHandlerWrapper = c, "$destroy" === b || g || a.addEventListener(b, f, !1));
          h.push(d);
        }; g--;) {
          b = c[g], yb[b] ? (h(yb[b], Tf), h(b, void 0, !0)) : h(b);
        }
      }
    },
    off: Rc,
    one: function one(a, b, d) {
      a = F(a);
      a.on(b, function e() {
        a.off(b, d);
        a.off(b, e);
      });
      a.on(b, d);
    },
    replaceWith: function replaceWith(a, b) {
      var d,
          c = a.parentNode;
      wb(a);
      q(new O(b), function (b) {
        d ? c.insertBefore(b, d.nextSibling) : c.replaceChild(b, a);
        d = b;
      });
    },
    children: function children(a) {
      var b = [];
      q(a.childNodes, function (a) {
        1 === a.nodeType && b.push(a);
      });
      return b;
    },
    contents: function contents(a) {
      return a.contentDocument || a.childNodes || [];
    },
    append: function append(a, b) {
      var d = a.nodeType;

      if (1 === d || 11 === d) {
        b = new O(b);

        for (var d = 0, c = b.length; d < c; d++) {
          a.appendChild(b[d]);
        }
      }
    },
    prepend: function prepend(a, b) {
      if (1 === a.nodeType) {
        var d = a.firstChild;
        q(new O(b), function (b) {
          a.insertBefore(b, d);
        });
      }
    },
    wrap: function wrap(a, b) {
      Pc(a, F(b).eq(0).clone()[0]);
    },
    remove: Db,
    detach: function detach(a) {
      Db(a, !0);
    },
    after: function after(a, b) {
      var d = a,
          c = a.parentNode;
      b = new O(b);

      for (var e = 0, f = b.length; e < f; e++) {
        var g = b[e];
        c.insertBefore(g, d.nextSibling);
        d = g;
      }
    },
    addClass: Bb,
    removeClass: Ab,
    toggleClass: function toggleClass(a, b, d) {
      b && q(b.split(" "), function (b) {
        var e = d;
        y(e) && (e = !zb(a, b));
        (e ? Bb : Ab)(a, b);
      });
    },
    parent: function parent(a) {
      return (a = a.parentNode) && 11 !== a.nodeType ? a : null;
    },
    next: function next(a) {
      return a.nextElementSibling;
    },
    find: function find(a, b) {
      return a.getElementsByTagName ? a.getElementsByTagName(b) : [];
    },
    clone: Xb,
    triggerHandler: function triggerHandler(a, b, d) {
      var c,
          e,
          f = b.type || b,
          g = xb(a);
      if (g = (g = g && g.events) && g[f]) c = {
        preventDefault: function preventDefault() {
          this.defaultPrevented = !0;
        },
        isDefaultPrevented: function isDefaultPrevented() {
          return !0 === this.defaultPrevented;
        },
        stopImmediatePropagation: function stopImmediatePropagation() {
          this.immediatePropagationStopped = !0;
        },
        isImmediatePropagationStopped: function isImmediatePropagationStopped() {
          return !0 === this.immediatePropagationStopped;
        },
        stopPropagation: A,
        type: f,
        target: a
      }, b.type && (c = S(c, b)), b = ia(g), e = d ? [c].concat(d) : [c], q(b, function (b) {
        c.isImmediatePropagationStopped() || b.apply(a, e);
      });
    }
  }, function (a, b) {
    O.prototype[b] = function (b, c, e) {
      for (var f, g = 0, h = this.length; g < h; g++) {
        y(f) ? (f = a(this[g], b, c, e), w(f) && (f = F(f))) : Qc(f, a(this[g], b, c, e));
      }

      return w(f) ? f : this;
    };

    O.prototype.bind = O.prototype.on;
    O.prototype.unbind = O.prototype.off;
  });
  Ra.prototype = {
    put: function put(a, b) {
      this[Ca(a, this.nextUid)] = b;
    },
    get: function get(a) {
      return this[Ca(a, this.nextUid)];
    },
    remove: function remove(a) {
      var b = this[a = Ca(a, this.nextUid)];
      delete this[a];
      return b;
    }
  };
  var If = [function () {
    this.$get = [function () {
      return Ra;
    }];
  }],
      Wf = /^([^\(]+?)=>/,
      Xf = /^[^\(]*\(\s*([^\)]*)\)/m,
      Eg = /,/,
      Fg = /^\s*(_?)(\S+?)\1\s*$/,
      Vf = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,
      Ha = N("$injector");

  cb.$$annotate = function (a, b, d) {
    var c;

    if ("function" === typeof a) {
      if (!(c = a.$inject)) {
        c = [];

        if (a.length) {
          if (b) throw G(d) && d || (d = a.name || Yf(a)), Ha("strictdi", d);
          b = Wc(a);
          q(b[1].split(Eg), function (a) {
            a.replace(Fg, function (a, b, d) {
              c.push(d);
            });
          });
        }

        a.$inject = c;
      }
    } else L(a) ? (b = a.length - 1, Pa(a[b], "fn"), c = a.slice(0, b)) : Pa(a, "fn", !0);

    return c;
  };

  var Rd = N("$animate"),
      $e = function $e() {
    this.$get = A;
  },
      af = function af() {
    var a = new Ra(),
        b = [];
    this.$get = ["$$AnimateRunner", "$rootScope", function (d, c) {
      function e(a, b, c) {
        var d = !1;
        b && (b = G(b) ? b.split(" ") : L(b) ? b : [], q(b, function (b) {
          b && (d = !0, a[b] = c);
        }));
        return d;
      }

      function f() {
        q(b, function (b) {
          var c = a.get(b);

          if (c) {
            var d = Zf(b.attr("class")),
                e = "",
                f = "";
            q(c, function (a, b) {
              a !== !!d[b] && (a ? e += (e.length ? " " : "") + b : f += (f.length ? " " : "") + b);
            });
            q(b, function (a) {
              e && Bb(a, e);
              f && Ab(a, f);
            });
            a.remove(b);
          }
        });
        b.length = 0;
      }

      return {
        enabled: A,
        on: A,
        off: A,
        pin: A,
        push: function push(g, h, k, l) {
          l && l();
          k = k || {};
          k.from && g.css(k.from);
          k.to && g.css(k.to);
          if (k.addClass || k.removeClass) if (h = k.addClass, l = k.removeClass, k = a.get(g) || {}, h = e(k, h, !0), l = e(k, l, !1), h || l) a.put(g, k), b.push(g), 1 === b.length && c.$$postDigest(f);
          g = new d();
          g.complete();
          return g;
        }
      };
    }];
  },
      Ye = ["$provide", function (a) {
    var b = this;
    this.$$registeredAnimations = Object.create(null);

    this.register = function (d, c) {
      if (d && "." !== d.charAt(0)) throw Rd("notcsel", d);
      var e = d + "-animation";
      b.$$registeredAnimations[d.substr(1)] = e;
      a.factory(e, c);
    };

    this.classNameFilter = function (a) {
      if (1 === arguments.length && (this.$$classNameFilter = a instanceof RegExp ? a : null) && /(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString())) throw Rd("nongcls", "ng-animate");
      return this.$$classNameFilter;
    };

    this.$get = ["$$animateQueue", function (a) {
      function b(a, c, d) {
        if (d) {
          var h;

          a: {
            for (h = 0; h < d.length; h++) {
              var k = d[h];

              if (1 === k.nodeType) {
                h = k;
                break a;
              }
            }

            h = void 0;
          }

          !h || h.parentNode || h.previousElementSibling || (d = null);
        }

        d ? d.after(a) : c.prepend(a);
      }

      return {
        on: a.on,
        off: a.off,
        pin: a.pin,
        enabled: a.enabled,
        cancel: function cancel(a) {
          a.end && a.end();
        },
        enter: function enter(e, f, g, h) {
          f = f && F(f);
          g = g && F(g);
          f = f || g.parent();
          b(e, f, g);
          return a.push(e, "enter", Ia(h));
        },
        move: function move(e, f, g, h) {
          f = f && F(f);
          g = g && F(g);
          f = f || g.parent();
          b(e, f, g);
          return a.push(e, "move", Ia(h));
        },
        leave: function leave(b, c) {
          return a.push(b, "leave", Ia(c), function () {
            b.remove();
          });
        },
        addClass: function addClass(b, c, g) {
          g = Ia(g);
          g.addClass = gb(g.addclass, c);
          return a.push(b, "addClass", g);
        },
        removeClass: function removeClass(b, c, g) {
          g = Ia(g);
          g.removeClass = gb(g.removeClass, c);
          return a.push(b, "removeClass", g);
        },
        setClass: function setClass(b, c, g, h) {
          h = Ia(h);
          h.addClass = gb(h.addClass, c);
          h.removeClass = gb(h.removeClass, g);
          return a.push(b, "setClass", h);
        },
        animate: function animate(b, c, g, h, k) {
          k = Ia(k);
          k.from = k.from ? S(k.from, c) : c;
          k.to = k.to ? S(k.to, g) : g;
          k.tempClasses = gb(k.tempClasses, h || "ng-inline-animate");
          return a.push(b, "animate", k);
        }
      };
    }];
  }],
      cf = function cf() {
    this.$get = ["$$rAF", function (a) {
      function b(b) {
        d.push(b);
        1 < d.length || a(function () {
          for (var a = 0; a < d.length; a++) {
            d[a]();
          }

          d = [];
        });
      }

      var d = [];
      return function () {
        var a = !1;
        b(function () {
          a = !0;
        });
        return function (d) {
          a ? d() : b(d);
        };
      };
    }];
  },
      bf = function bf() {
    this.$get = ["$q", "$sniffer", "$$animateAsyncRun", "$document", "$timeout", function (a, b, d, c, e) {
      function f(a) {
        this.setHost(a);
        var b = d();
        this._doneCallbacks = [];

        this._tick = function (a) {
          var d = c[0];
          d && d.hidden ? e(a, 0, !1) : b(a);
        };

        this._state = 0;
      }

      f.chain = function (a, b) {
        function c() {
          if (d === a.length) b(!0);else a[d](function (a) {
            !1 === a ? b(!1) : (d++, c());
          });
        }

        var d = 0;
        c();
      };

      f.all = function (a, b) {
        function c(f) {
          e = e && f;
          ++d === a.length && b(e);
        }

        var d = 0,
            e = !0;
        q(a, function (a) {
          a.done(c);
        });
      };

      f.prototype = {
        setHost: function setHost(a) {
          this.host = a || {};
        },
        done: function done(a) {
          2 === this._state ? a() : this._doneCallbacks.push(a);
        },
        progress: A,
        getPromise: function getPromise() {
          if (!this.promise) {
            var b = this;
            this.promise = a(function (a, c) {
              b.done(function (b) {
                !1 === b ? c() : a();
              });
            });
          }

          return this.promise;
        },
        then: function then(a, b) {
          return this.getPromise().then(a, b);
        },
        "catch": function _catch(a) {
          return this.getPromise()["catch"](a);
        },
        "finally": function _finally(a) {
          return this.getPromise()["finally"](a);
        },
        pause: function pause() {
          this.host.pause && this.host.pause();
        },
        resume: function resume() {
          this.host.resume && this.host.resume();
        },
        end: function end() {
          this.host.end && this.host.end();

          this._resolve(!0);
        },
        cancel: function cancel() {
          this.host.cancel && this.host.cancel();

          this._resolve(!1);
        },
        complete: function complete(a) {
          var b = this;
          0 === b._state && (b._state = 1, b._tick(function () {
            b._resolve(a);
          }));
        },
        _resolve: function _resolve(a) {
          2 !== this._state && (q(this._doneCallbacks, function (b) {
            b(a);
          }), this._doneCallbacks.length = 0, this._state = 2);
        }
      };
      return f;
    }];
  },
      Ze = function Ze() {
    this.$get = ["$$rAF", "$q", "$$AnimateRunner", function (a, b, d) {
      return function (b, e) {
        function f() {
          a(function () {
            g.addClass && (b.addClass(g.addClass), g.addClass = null);
            g.removeClass && (b.removeClass(g.removeClass), g.removeClass = null);
            g.to && (b.css(g.to), g.to = null);
            h || k.complete();
            h = !0;
          });
          return k;
        }

        var g = e || {};
        g.$$prepared || (g = pa(g));
        g.cleanupStyles && (g.from = g.to = null);
        g.from && (b.css(g.from), g.from = null);
        var h,
            k = new d();
        return {
          start: f,
          end: f
        };
      };
    }];
  },
      ga = N("$compile"),
      bc = new function () {}();

  Fc.$inject = ["$provide", "$$sanitizeUriProvider"];

  Fb.prototype.isFirstChange = function () {
    return this.previousValue === bc;
  };

  var Yc = /^((?:x|data)[\:\-_])/i,
      cg = N("$controller"),
      cd = /^(\S+)(\s+as\s+([\w$]+))?$/,
      jf = function jf() {
    this.$get = ["$document", function (a) {
      return function (b) {
        b ? !b.nodeType && b instanceof F && (b = b[0]) : b = a[0].body;
        return b.offsetWidth + 1;
      };
    }];
  },
      dd = "application/json",
      ec = {
    "Content-Type": dd + ";charset=utf-8"
  },
      eg = /^\[|^\{(?!\{)/,
      fg = {
    "[": /]$/,
    "{": /}$/
  },
      dg = /^\)\]\}',?\n/,
      Gg = N("$http"),
      hd = function hd(a) {
    return function () {
      throw Gg("legacy", a);
    };
  },
      Ka = ca.$interpolateMinErr = N("$interpolate");

  Ka.throwNoconcat = function (a) {
    throw Ka("noconcat", a);
  };

  Ka.interr = function (a, b) {
    return Ka("interr", a, b.toString());
  };

  var rf = function rf() {
    this.$get = ["$window", function (a) {
      function b(a) {
        var b = function b(a) {
          b.data = a;
          b.called = !0;
        };

        b.id = a;
        return b;
      }

      var d = a.angular.callbacks,
          c = {};
      return {
        createCallback: function createCallback(a) {
          a = "_" + (d.$$counter++).toString(36);
          var f = "angular.callbacks." + a,
              g = b(a);
          c[f] = d[a] = g;
          return f;
        },
        wasCalled: function wasCalled(a) {
          return c[a].called;
        },
        getResponse: function getResponse(a) {
          return c[a].data;
        },
        removeCallback: function removeCallback(a) {
          delete d[c[a].id];
          delete c[a];
        }
      };
    }];
  },
      Hg = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
      hg = {
    http: 80,
    https: 443,
    ftp: 21
  },
      Gb = N("$location"),
      Ig = {
    $$absUrl: "",
    $$html5: !1,
    $$replace: !1,
    absUrl: Hb("$$absUrl"),
    url: function url(a) {
      if (y(a)) return this.$$url;
      var b = Hg.exec(a);
      (b[1] || "" === a) && this.path(decodeURIComponent(b[1]));
      (b[2] || b[1] || "" === a) && this.search(b[3] || "");
      this.hash(b[5] || "");
      return this;
    },
    protocol: Hb("$$protocol"),
    host: Hb("$$host"),
    port: Hb("$$port"),
    path: md("$$path", function (a) {
      a = null !== a ? a.toString() : "";
      return "/" == a.charAt(0) ? a : "/" + a;
    }),
    search: function search(a, b) {
      switch (arguments.length) {
        case 0:
          return this.$$search;

        case 1:
          if (G(a) || T(a)) a = a.toString(), this.$$search = Ac(a);else if (D(a)) a = pa(a, {}), q(a, function (b, c) {
            null == b && delete a[c];
          }), this.$$search = a;else throw Gb("isrcharg");
          break;

        default:
          y(b) || null === b ? delete this.$$search[a] : this.$$search[a] = b;
      }

      this.$$compose();
      return this;
    },
    hash: md("$$hash", function (a) {
      return null !== a ? a.toString() : "";
    }),
    replace: function replace() {
      this.$$replace = !0;
      return this;
    }
  };

  q([ld, hc, gc], function (a) {
    a.prototype = Object.create(Ig);

    a.prototype.state = function (b) {
      if (!arguments.length) return this.$$state;
      if (a !== gc || !this.$$html5) throw Gb("nostate");
      this.$$state = y(b) ? null : b;
      return this;
    };
  });
  var X = N("$parse"),
      jg = Function.prototype.call,
      kg = Function.prototype.apply,
      lg = Function.prototype.bind,
      Ob = U();
  q("+ - * / % === !== == != < > <= >= && || ! = |".split(" "), function (a) {
    Ob[a] = !0;
  });

  var Jg = {
    n: "\n",
    f: "\f",
    r: "\r",
    t: "\t",
    v: "\v",
    "'": "'",
    '"': '"'
  },
      jc = function jc(a) {
    this.options = a;
  };

  jc.prototype = {
    constructor: jc,
    lex: function lex(a) {
      this.text = a;
      this.index = 0;

      for (this.tokens = []; this.index < this.text.length;) {
        if (a = this.text.charAt(this.index), '"' === a || "'" === a) this.readString(a);else if (this.isNumber(a) || "." === a && this.isNumber(this.peek())) this.readNumber();else if (this.isIdentifierStart(this.peekMultichar())) this.readIdent();else if (this.is(a, "(){}[].,;:?")) this.tokens.push({
          index: this.index,
          text: a
        }), this.index++;else if (this.isWhitespace(a)) this.index++;else {
          var b = a + this.peek(),
              d = b + this.peek(2),
              c = Ob[b],
              e = Ob[d];
          Ob[a] || c || e ? (a = e ? d : c ? b : a, this.tokens.push({
            index: this.index,
            text: a,
            operator: !0
          }), this.index += a.length) : this.throwError("Unexpected next character ", this.index, this.index + 1);
        }
      }

      return this.tokens;
    },
    is: function is(a, b) {
      return -1 !== b.indexOf(a);
    },
    peek: function peek(a) {
      a = a || 1;
      return this.index + a < this.text.length ? this.text.charAt(this.index + a) : !1;
    },
    isNumber: function isNumber(a) {
      return "0" <= a && "9" >= a && "string" === typeof a;
    },
    isWhitespace: function isWhitespace(a) {
      return " " === a || "\r" === a || "\t" === a || "\n" === a || "\v" === a || "\xA0" === a;
    },
    isIdentifierStart: function isIdentifierStart(a) {
      return this.options.isIdentifierStart ? this.options.isIdentifierStart(a, this.codePointAt(a)) : this.isValidIdentifierStart(a);
    },
    isValidIdentifierStart: function isValidIdentifierStart(a) {
      return "a" <= a && "z" >= a || "A" <= a && "Z" >= a || "_" === a || "$" === a;
    },
    isIdentifierContinue: function isIdentifierContinue(a) {
      return this.options.isIdentifierContinue ? this.options.isIdentifierContinue(a, this.codePointAt(a)) : this.isValidIdentifierContinue(a);
    },
    isValidIdentifierContinue: function isValidIdentifierContinue(a, b) {
      return this.isValidIdentifierStart(a, b) || this.isNumber(a);
    },
    codePointAt: function codePointAt(a) {
      return 1 === a.length ? a.charCodeAt(0) : (a.charCodeAt(0) << 10) + a.charCodeAt(1) - 56613888;
    },
    peekMultichar: function peekMultichar() {
      var a = this.text.charAt(this.index),
          b = this.peek();
      if (!b) return a;
      var d = a.charCodeAt(0),
          c = b.charCodeAt(0);
      return 55296 <= d && 56319 >= d && 56320 <= c && 57343 >= c ? a + b : a;
    },
    isExpOperator: function isExpOperator(a) {
      return "-" === a || "+" === a || this.isNumber(a);
    },
    throwError: function throwError(a, b, d) {
      d = d || this.index;
      b = w(b) ? "s " + b + "-" + this.index + " [" + this.text.substring(b, d) + "]" : " " + d;
      throw X("lexerr", a, b, this.text);
    },
    readNumber: function readNumber() {
      for (var a = "", b = this.index; this.index < this.text.length;) {
        var d = Q(this.text.charAt(this.index));
        if ("." == d || this.isNumber(d)) a += d;else {
          var c = this.peek();
          if ("e" == d && this.isExpOperator(c)) a += d;else if (this.isExpOperator(d) && c && this.isNumber(c) && "e" == a.charAt(a.length - 1)) a += d;else if (!this.isExpOperator(d) || c && this.isNumber(c) || "e" != a.charAt(a.length - 1)) break;else this.throwError("Invalid exponent");
        }
        this.index++;
      }

      this.tokens.push({
        index: b,
        text: a,
        constant: !0,
        value: Number(a)
      });
    },
    readIdent: function readIdent() {
      var a = this.index;

      for (this.index += this.peekMultichar().length; this.index < this.text.length;) {
        var b = this.peekMultichar();
        if (!this.isIdentifierContinue(b)) break;
        this.index += b.length;
      }

      this.tokens.push({
        index: a,
        text: this.text.slice(a, this.index),
        identifier: !0
      });
    },
    readString: function readString(a) {
      var b = this.index;
      this.index++;

      for (var d = "", c = a, e = !1; this.index < this.text.length;) {
        var f = this.text.charAt(this.index),
            c = c + f;
        if (e) "u" === f ? (e = this.text.substring(this.index + 1, this.index + 5), e.match(/[\da-f]{4}/i) || this.throwError("Invalid unicode escape [\\u" + e + "]"), this.index += 4, d += String.fromCharCode(parseInt(e, 16))) : d += Jg[f] || f, e = !1;else if ("\\" === f) e = !0;else {
          if (f === a) {
            this.index++;
            this.tokens.push({
              index: b,
              text: c,
              constant: !0,
              value: d
            });
            return;
          }

          d += f;
        }
        this.index++;
      }

      this.throwError("Unterminated quote", b);
    }
  };

  var s = function s(a, b) {
    this.lexer = a;
    this.options = b;
  };

  s.Program = "Program";
  s.ExpressionStatement = "ExpressionStatement";
  s.AssignmentExpression = "AssignmentExpression";
  s.ConditionalExpression = "ConditionalExpression";
  s.LogicalExpression = "LogicalExpression";
  s.BinaryExpression = "BinaryExpression";
  s.UnaryExpression = "UnaryExpression";
  s.CallExpression = "CallExpression";
  s.MemberExpression = "MemberExpression";
  s.Identifier = "Identifier";
  s.Literal = "Literal";
  s.ArrayExpression = "ArrayExpression";
  s.Property = "Property";
  s.ObjectExpression = "ObjectExpression";
  s.ThisExpression = "ThisExpression";
  s.LocalsExpression = "LocalsExpression";
  s.NGValueParameter = "NGValueParameter";
  s.prototype = {
    ast: function ast(a) {
      this.text = a;
      this.tokens = this.lexer.lex(a);
      a = this.program();
      0 !== this.tokens.length && this.throwError("is an unexpected token", this.tokens[0]);
      return a;
    },
    program: function program() {
      for (var a = [];;) {
        if (0 < this.tokens.length && !this.peek("}", ")", ";", "]") && a.push(this.expressionStatement()), !this.expect(";")) return {
          type: s.Program,
          body: a
        };
      }
    },
    expressionStatement: function expressionStatement() {
      return {
        type: s.ExpressionStatement,
        expression: this.filterChain()
      };
    },
    filterChain: function filterChain() {
      for (var a = this.expression(); this.expect("|");) {
        a = this.filter(a);
      }

      return a;
    },
    expression: function expression() {
      return this.assignment();
    },
    assignment: function assignment() {
      var a = this.ternary();
      this.expect("=") && (a = {
        type: s.AssignmentExpression,
        left: a,
        right: this.assignment(),
        operator: "="
      });
      return a;
    },
    ternary: function ternary() {
      var a = this.logicalOR(),
          b,
          d;
      return this.expect("?") && (b = this.expression(), this.consume(":")) ? (d = this.expression(), {
        type: s.ConditionalExpression,
        test: a,
        alternate: b,
        consequent: d
      }) : a;
    },
    logicalOR: function logicalOR() {
      for (var a = this.logicalAND(); this.expect("||");) {
        a = {
          type: s.LogicalExpression,
          operator: "||",
          left: a,
          right: this.logicalAND()
        };
      }

      return a;
    },
    logicalAND: function logicalAND() {
      for (var a = this.equality(); this.expect("&&");) {
        a = {
          type: s.LogicalExpression,
          operator: "&&",
          left: a,
          right: this.equality()
        };
      }

      return a;
    },
    equality: function equality() {
      for (var a = this.relational(), b; b = this.expect("==", "!=", "===", "!==");) {
        a = {
          type: s.BinaryExpression,
          operator: b.text,
          left: a,
          right: this.relational()
        };
      }

      return a;
    },
    relational: function relational() {
      for (var a = this.additive(), b; b = this.expect("<", ">", "<=", ">=");) {
        a = {
          type: s.BinaryExpression,
          operator: b.text,
          left: a,
          right: this.additive()
        };
      }

      return a;
    },
    additive: function additive() {
      for (var a = this.multiplicative(), b; b = this.expect("+", "-");) {
        a = {
          type: s.BinaryExpression,
          operator: b.text,
          left: a,
          right: this.multiplicative()
        };
      }

      return a;
    },
    multiplicative: function multiplicative() {
      for (var a = this.unary(), b; b = this.expect("*", "/", "%");) {
        a = {
          type: s.BinaryExpression,
          operator: b.text,
          left: a,
          right: this.unary()
        };
      }

      return a;
    },
    unary: function unary() {
      var a;
      return (a = this.expect("+", "-", "!")) ? {
        type: s.UnaryExpression,
        operator: a.text,
        prefix: !0,
        argument: this.unary()
      } : this.primary();
    },
    primary: function primary() {
      var a;
      this.expect("(") ? (a = this.filterChain(), this.consume(")")) : this.expect("[") ? a = this.arrayDeclaration() : this.expect("{") ? a = this.object() : this.selfReferential.hasOwnProperty(this.peek().text) ? a = pa(this.selfReferential[this.consume().text]) : this.options.literals.hasOwnProperty(this.peek().text) ? a = {
        type: s.Literal,
        value: this.options.literals[this.consume().text]
      } : this.peek().identifier ? a = this.identifier() : this.peek().constant ? a = this.constant() : this.throwError("not a primary expression", this.peek());

      for (var b; b = this.expect("(", "[", ".");) {
        "(" === b.text ? (a = {
          type: s.CallExpression,
          callee: a,
          arguments: this.parseArguments()
        }, this.consume(")")) : "[" === b.text ? (a = {
          type: s.MemberExpression,
          object: a,
          property: this.expression(),
          computed: !0
        }, this.consume("]")) : "." === b.text ? a = {
          type: s.MemberExpression,
          object: a,
          property: this.identifier(),
          computed: !1
        } : this.throwError("IMPOSSIBLE");
      }

      return a;
    },
    filter: function filter(a) {
      a = [a];

      for (var b = {
        type: s.CallExpression,
        callee: this.identifier(),
        arguments: a,
        filter: !0
      }; this.expect(":");) {
        a.push(this.expression());
      }

      return b;
    },
    parseArguments: function parseArguments() {
      var a = [];

      if (")" !== this.peekToken().text) {
        do {
          a.push(this.filterChain());
        } while (this.expect(","));
      }

      return a;
    },
    identifier: function identifier() {
      var a = this.consume();
      a.identifier || this.throwError("is not a valid identifier", a);
      return {
        type: s.Identifier,
        name: a.text
      };
    },
    constant: function constant() {
      return {
        type: s.Literal,
        value: this.consume().value
      };
    },
    arrayDeclaration: function arrayDeclaration() {
      var a = [];

      if ("]" !== this.peekToken().text) {
        do {
          if (this.peek("]")) break;
          a.push(this.expression());
        } while (this.expect(","));
      }

      this.consume("]");
      return {
        type: s.ArrayExpression,
        elements: a
      };
    },
    object: function object() {
      var a = [],
          b;

      if ("}" !== this.peekToken().text) {
        do {
          if (this.peek("}")) break;
          b = {
            type: s.Property,
            kind: "init"
          };
          this.peek().constant ? (b.key = this.constant(), b.computed = !1, this.consume(":"), b.value = this.expression()) : this.peek().identifier ? (b.key = this.identifier(), b.computed = !1, this.peek(":") ? (this.consume(":"), b.value = this.expression()) : b.value = b.key) : this.peek("[") ? (this.consume("["), b.key = this.expression(), this.consume("]"), b.computed = !0, this.consume(":"), b.value = this.expression()) : this.throwError("invalid key", this.peek());
          a.push(b);
        } while (this.expect(","));
      }

      this.consume("}");
      return {
        type: s.ObjectExpression,
        properties: a
      };
    },
    throwError: function throwError(a, b) {
      throw X("syntax", b.text, a, b.index + 1, this.text, this.text.substring(b.index));
    },
    consume: function consume(a) {
      if (0 === this.tokens.length) throw X("ueoe", this.text);
      var b = this.expect(a);
      b || this.throwError("is unexpected, expecting [" + a + "]", this.peek());
      return b;
    },
    peekToken: function peekToken() {
      if (0 === this.tokens.length) throw X("ueoe", this.text);
      return this.tokens[0];
    },
    peek: function peek(a, b, d, c) {
      return this.peekAhead(0, a, b, d, c);
    },
    peekAhead: function peekAhead(a, b, d, c, e) {
      if (this.tokens.length > a) {
        a = this.tokens[a];
        var f = a.text;
        if (f === b || f === d || f === c || f === e || !(b || d || c || e)) return a;
      }

      return !1;
    },
    expect: function expect(a, b, d, c) {
      return (a = this.peek(a, b, d, c)) ? (this.tokens.shift(), a) : !1;
    },
    selfReferential: {
      "this": {
        type: s.ThisExpression
      },
      $locals: {
        type: s.LocalsExpression
      }
    }
  };
  td.prototype = {
    compile: function compile(a, b) {
      var d = this,
          c = this.astBuilder.ast(a);
      this.state = {
        nextId: 0,
        filters: {},
        expensiveChecks: b,
        fn: {
          vars: [],
          body: [],
          own: {}
        },
        assign: {
          vars: [],
          body: [],
          own: {}
        },
        inputs: []
      };
      V(c, d.$filter);
      var e = "",
          f;
      this.stage = "assign";
      if (f = rd(c)) this.state.computing = "assign", e = this.nextId(), this.recurse(f, e), this.return_(e), e = "fn.assign=" + this.generateFunction("assign", "s,v,l");
      f = pd(c.body);
      d.stage = "inputs";
      q(f, function (a, b) {
        var c = "fn" + b;
        d.state[c] = {
          vars: [],
          body: [],
          own: {}
        };
        d.state.computing = c;
        var e = d.nextId();
        d.recurse(a, e);
        d.return_(e);
        d.state.inputs.push(c);
        a.watchId = b;
      });
      this.state.computing = "fn";
      this.stage = "main";
      this.recurse(c);
      e = '"' + this.USE + " " + this.STRICT + '";\n' + this.filterPrefix() + "var fn=" + this.generateFunction("fn", "s,l,a,i") + e + this.watchFns() + "return fn;";
      e = new Function("$filter", "ensureSafeMemberName", "ensureSafeObject", "ensureSafeFunction", "getStringValue", "ensureSafeAssignContext", "ifDefined", "plus", "text", e)(this.$filter, Sa, ra, nd, ig, Ib, mg, od, a);
      this.state = this.stage = void 0;
      e.literal = sd(c);
      e.constant = c.constant;
      return e;
    },
    USE: "use",
    STRICT: "strict",
    watchFns: function watchFns() {
      var a = [],
          b = this.state.inputs,
          d = this;
      q(b, function (b) {
        a.push("var " + b + "=" + d.generateFunction(b, "s"));
      });
      b.length && a.push("fn.inputs=[" + b.join(",") + "];");
      return a.join("");
    },
    generateFunction: function generateFunction(a, b) {
      return "function(" + b + "){" + this.varsPrefix(a) + this.body(a) + "};";
    },
    filterPrefix: function filterPrefix() {
      var a = [],
          b = this;
      q(this.state.filters, function (d, c) {
        a.push(d + "=$filter(" + b.escape(c) + ")");
      });
      return a.length ? "var " + a.join(",") + ";" : "";
    },
    varsPrefix: function varsPrefix(a) {
      return this.state[a].vars.length ? "var " + this.state[a].vars.join(",") + ";" : "";
    },
    body: function body(a) {
      return this.state[a].body.join("");
    },
    recurse: function recurse(a, b, d, c, e, f) {
      var g,
          h,
          k = this,
          l,
          m,
          n;
      c = c || A;
      if (!f && w(a.watchId)) b = b || this.nextId(), this.if_("i", this.lazyAssign(b, this.computedMember("i", a.watchId)), this.lazyRecurse(a, b, d, c, e, !0));else switch (a.type) {
        case s.Program:
          q(a.body, function (b, c) {
            k.recurse(b.expression, void 0, void 0, function (a) {
              h = a;
            });
            c !== a.body.length - 1 ? k.current().body.push(h, ";") : k.return_(h);
          });
          break;

        case s.Literal:
          m = this.escape(a.value);
          this.assign(b, m);
          c(m);
          break;

        case s.UnaryExpression:
          this.recurse(a.argument, void 0, void 0, function (a) {
            h = a;
          });
          m = a.operator + "(" + this.ifDefined(h, 0) + ")";
          this.assign(b, m);
          c(m);
          break;

        case s.BinaryExpression:
          this.recurse(a.left, void 0, void 0, function (a) {
            g = a;
          });
          this.recurse(a.right, void 0, void 0, function (a) {
            h = a;
          });
          m = "+" === a.operator ? this.plus(g, h) : "-" === a.operator ? this.ifDefined(g, 0) + a.operator + this.ifDefined(h, 0) : "(" + g + ")" + a.operator + "(" + h + ")";
          this.assign(b, m);
          c(m);
          break;

        case s.LogicalExpression:
          b = b || this.nextId();
          k.recurse(a.left, b);
          k.if_("&&" === a.operator ? b : k.not(b), k.lazyRecurse(a.right, b));
          c(b);
          break;

        case s.ConditionalExpression:
          b = b || this.nextId();
          k.recurse(a.test, b);
          k.if_(b, k.lazyRecurse(a.alternate, b), k.lazyRecurse(a.consequent, b));
          c(b);
          break;

        case s.Identifier:
          b = b || this.nextId();
          d && (d.context = "inputs" === k.stage ? "s" : this.assign(this.nextId(), this.getHasOwnProperty("l", a.name) + "?l:s"), d.computed = !1, d.name = a.name);
          Sa(a.name);
          k.if_("inputs" === k.stage || k.not(k.getHasOwnProperty("l", a.name)), function () {
            k.if_("inputs" === k.stage || "s", function () {
              e && 1 !== e && k.if_(k.not(k.nonComputedMember("s", a.name)), k.lazyAssign(k.nonComputedMember("s", a.name), "{}"));
              k.assign(b, k.nonComputedMember("s", a.name));
            });
          }, b && k.lazyAssign(b, k.nonComputedMember("l", a.name)));
          (k.state.expensiveChecks || Jb(a.name)) && k.addEnsureSafeObject(b);
          c(b);
          break;

        case s.MemberExpression:
          g = d && (d.context = this.nextId()) || this.nextId();
          b = b || this.nextId();
          k.recurse(a.object, g, void 0, function () {
            k.if_(k.notNull(g), function () {
              e && 1 !== e && k.addEnsureSafeAssignContext(g);
              if (a.computed) h = k.nextId(), k.recurse(a.property, h), k.getStringValue(h), k.addEnsureSafeMemberName(h), e && 1 !== e && k.if_(k.not(k.computedMember(g, h)), k.lazyAssign(k.computedMember(g, h), "{}")), m = k.ensureSafeObject(k.computedMember(g, h)), k.assign(b, m), d && (d.computed = !0, d.name = h);else {
                Sa(a.property.name);
                e && 1 !== e && k.if_(k.not(k.nonComputedMember(g, a.property.name)), k.lazyAssign(k.nonComputedMember(g, a.property.name), "{}"));
                m = k.nonComputedMember(g, a.property.name);
                if (k.state.expensiveChecks || Jb(a.property.name)) m = k.ensureSafeObject(m);
                k.assign(b, m);
                d && (d.computed = !1, d.name = a.property.name);
              }
            }, function () {
              k.assign(b, "undefined");
            });
            c(b);
          }, !!e);
          break;

        case s.CallExpression:
          b = b || this.nextId();
          a.filter ? (h = k.filter(a.callee.name), l = [], q(a.arguments, function (a) {
            var b = k.nextId();
            k.recurse(a, b);
            l.push(b);
          }), m = h + "(" + l.join(",") + ")", k.assign(b, m), c(b)) : (h = k.nextId(), g = {}, l = [], k.recurse(a.callee, h, g, function () {
            k.if_(k.notNull(h), function () {
              k.addEnsureSafeFunction(h);
              q(a.arguments, function (a) {
                k.recurse(a, k.nextId(), void 0, function (a) {
                  l.push(k.ensureSafeObject(a));
                });
              });
              g.name ? (k.state.expensiveChecks || k.addEnsureSafeObject(g.context), m = k.member(g.context, g.name, g.computed) + "(" + l.join(",") + ")") : m = h + "(" + l.join(",") + ")";
              m = k.ensureSafeObject(m);
              k.assign(b, m);
            }, function () {
              k.assign(b, "undefined");
            });
            c(b);
          }));
          break;

        case s.AssignmentExpression:
          h = this.nextId();
          g = {};
          if (!qd(a.left)) throw X("lval");
          this.recurse(a.left, void 0, g, function () {
            k.if_(k.notNull(g.context), function () {
              k.recurse(a.right, h);
              k.addEnsureSafeObject(k.member(g.context, g.name, g.computed));
              k.addEnsureSafeAssignContext(g.context);
              m = k.member(g.context, g.name, g.computed) + a.operator + h;
              k.assign(b, m);
              c(b || m);
            });
          }, 1);
          break;

        case s.ArrayExpression:
          l = [];
          q(a.elements, function (a) {
            k.recurse(a, k.nextId(), void 0, function (a) {
              l.push(a);
            });
          });
          m = "[" + l.join(",") + "]";
          this.assign(b, m);
          c(m);
          break;

        case s.ObjectExpression:
          l = [];
          n = !1;
          q(a.properties, function (a) {
            a.computed && (n = !0);
          });
          n ? (b = b || this.nextId(), this.assign(b, "{}"), q(a.properties, function (a) {
            a.computed ? (g = k.nextId(), k.recurse(a.key, g)) : g = a.key.type === s.Identifier ? a.key.name : "" + a.key.value;
            h = k.nextId();
            k.recurse(a.value, h);
            k.assign(k.member(b, g, a.computed), h);
          })) : (q(a.properties, function (b) {
            k.recurse(b.value, a.constant ? void 0 : k.nextId(), void 0, function (a) {
              l.push(k.escape(b.key.type === s.Identifier ? b.key.name : "" + b.key.value) + ":" + a);
            });
          }), m = "{" + l.join(",") + "}", this.assign(b, m));
          c(b || m);
          break;

        case s.ThisExpression:
          this.assign(b, "s");
          c("s");
          break;

        case s.LocalsExpression:
          this.assign(b, "l");
          c("l");
          break;

        case s.NGValueParameter:
          this.assign(b, "v"), c("v");
      }
    },
    getHasOwnProperty: function getHasOwnProperty(a, b) {
      var d = a + "." + b,
          c = this.current().own;
      c.hasOwnProperty(d) || (c[d] = this.nextId(!1, a + "&&(" + this.escape(b) + " in " + a + ")"));
      return c[d];
    },
    assign: function assign(a, b) {
      if (a) return this.current().body.push(a, "=", b, ";"), a;
    },
    filter: function filter(a) {
      this.state.filters.hasOwnProperty(a) || (this.state.filters[a] = this.nextId(!0));
      return this.state.filters[a];
    },
    ifDefined: function ifDefined(a, b) {
      return "ifDefined(" + a + "," + this.escape(b) + ")";
    },
    plus: function plus(a, b) {
      return "plus(" + a + "," + b + ")";
    },
    return_: function return_(a) {
      this.current().body.push("return ", a, ";");
    },
    if_: function if_(a, b, d) {
      if (!0 === a) b();else {
        var c = this.current().body;
        c.push("if(", a, "){");
        b();
        c.push("}");
        d && (c.push("else{"), d(), c.push("}"));
      }
    },
    not: function not(a) {
      return "!(" + a + ")";
    },
    notNull: function notNull(a) {
      return a + "!=null";
    },
    nonComputedMember: function nonComputedMember(a, b) {
      var d = /[^$_a-zA-Z0-9]/g;
      return /[$_a-zA-Z][$_a-zA-Z0-9]*/.test(b) ? a + "." + b : a + '["' + b.replace(d, this.stringEscapeFn) + '"]';
    },
    computedMember: function computedMember(a, b) {
      return a + "[" + b + "]";
    },
    member: function member(a, b, d) {
      return d ? this.computedMember(a, b) : this.nonComputedMember(a, b);
    },
    addEnsureSafeObject: function addEnsureSafeObject(a) {
      this.current().body.push(this.ensureSafeObject(a), ";");
    },
    addEnsureSafeMemberName: function addEnsureSafeMemberName(a) {
      this.current().body.push(this.ensureSafeMemberName(a), ";");
    },
    addEnsureSafeFunction: function addEnsureSafeFunction(a) {
      this.current().body.push(this.ensureSafeFunction(a), ";");
    },
    addEnsureSafeAssignContext: function addEnsureSafeAssignContext(a) {
      this.current().body.push(this.ensureSafeAssignContext(a), ";");
    },
    ensureSafeObject: function ensureSafeObject(a) {
      return "ensureSafeObject(" + a + ",text)";
    },
    ensureSafeMemberName: function ensureSafeMemberName(a) {
      return "ensureSafeMemberName(" + a + ",text)";
    },
    ensureSafeFunction: function ensureSafeFunction(a) {
      return "ensureSafeFunction(" + a + ",text)";
    },
    getStringValue: function getStringValue(a) {
      this.assign(a, "getStringValue(" + a + ")");
    },
    ensureSafeAssignContext: function ensureSafeAssignContext(a) {
      return "ensureSafeAssignContext(" + a + ",text)";
    },
    lazyRecurse: function lazyRecurse(a, b, d, c, e, f) {
      var g = this;
      return function () {
        g.recurse(a, b, d, c, e, f);
      };
    },
    lazyAssign: function lazyAssign(a, b) {
      var d = this;
      return function () {
        d.assign(a, b);
      };
    },
    stringEscapeRegex: /[^ a-zA-Z0-9]/g,
    stringEscapeFn: function stringEscapeFn(a) {
      return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
    },
    escape: function escape(a) {
      if (G(a)) return "'" + a.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
      if (T(a)) return a.toString();
      if (!0 === a) return "true";
      if (!1 === a) return "false";
      if (null === a) return "null";
      if ("undefined" === typeof a) return "undefined";
      throw X("esc");
    },
    nextId: function nextId(a, b) {
      var d = "v" + this.state.nextId++;
      a || this.current().vars.push(d + (b ? "=" + b : ""));
      return d;
    },
    current: function current() {
      return this.state[this.state.computing];
    }
  };
  ud.prototype = {
    compile: function compile(a, b) {
      var d = this,
          c = this.astBuilder.ast(a);
      this.expression = a;
      this.expensiveChecks = b;
      V(c, d.$filter);
      var e, f;
      if (e = rd(c)) f = this.recurse(e);
      e = pd(c.body);
      var g;
      e && (g = [], q(e, function (a, b) {
        var c = d.recurse(a);
        a.input = c;
        g.push(c);
        a.watchId = b;
      }));
      var h = [];
      q(c.body, function (a) {
        h.push(d.recurse(a.expression));
      });
      e = 0 === c.body.length ? A : 1 === c.body.length ? h[0] : function (a, b) {
        var c;
        q(h, function (d) {
          c = d(a, b);
        });
        return c;
      };
      f && (e.assign = function (a, b, c) {
        return f(a, c, b);
      });
      g && (e.inputs = g);
      e.literal = sd(c);
      e.constant = c.constant;
      return e;
    },
    recurse: function recurse(a, b, d) {
      var c,
          e,
          f = this,
          g;
      if (a.input) return this.inputs(a.input, a.watchId);

      switch (a.type) {
        case s.Literal:
          return this.value(a.value, b);

        case s.UnaryExpression:
          return e = this.recurse(a.argument), this["unary" + a.operator](e, b);

        case s.BinaryExpression:
          return c = this.recurse(a.left), e = this.recurse(a.right), this["binary" + a.operator](c, e, b);

        case s.LogicalExpression:
          return c = this.recurse(a.left), e = this.recurse(a.right), this["binary" + a.operator](c, e, b);

        case s.ConditionalExpression:
          return this["ternary?:"](this.recurse(a.test), this.recurse(a.alternate), this.recurse(a.consequent), b);

        case s.Identifier:
          return Sa(a.name, f.expression), f.identifier(a.name, f.expensiveChecks || Jb(a.name), b, d, f.expression);

        case s.MemberExpression:
          return c = this.recurse(a.object, !1, !!d), a.computed || (Sa(a.property.name, f.expression), e = a.property.name), a.computed && (e = this.recurse(a.property)), a.computed ? this.computedMember(c, e, b, d, f.expression) : this.nonComputedMember(c, e, f.expensiveChecks, b, d, f.expression);

        case s.CallExpression:
          return g = [], q(a.arguments, function (a) {
            g.push(f.recurse(a));
          }), a.filter && (e = this.$filter(a.callee.name)), a.filter || (e = this.recurse(a.callee, !0)), a.filter ? function (a, c, d, f) {
            for (var n = [], p = 0; p < g.length; ++p) {
              n.push(g[p](a, c, d, f));
            }

            a = e.apply(void 0, n, f);
            return b ? {
              context: void 0,
              name: void 0,
              value: a
            } : a;
          } : function (a, c, d, m) {
            var n = e(a, c, d, m),
                p;

            if (null != n.value) {
              ra(n.context, f.expression);
              nd(n.value, f.expression);
              p = [];

              for (var q = 0; q < g.length; ++q) {
                p.push(ra(g[q](a, c, d, m), f.expression));
              }

              p = ra(n.value.apply(n.context, p), f.expression);
            }

            return b ? {
              value: p
            } : p;
          };

        case s.AssignmentExpression:
          return c = this.recurse(a.left, !0, 1), e = this.recurse(a.right), function (a, d, g, m) {
            var n = c(a, d, g, m);
            a = e(a, d, g, m);
            ra(n.value, f.expression);
            Ib(n.context);
            n.context[n.name] = a;
            return b ? {
              value: a
            } : a;
          };

        case s.ArrayExpression:
          return g = [], q(a.elements, function (a) {
            g.push(f.recurse(a));
          }), function (a, c, d, e) {
            for (var f = [], p = 0; p < g.length; ++p) {
              f.push(g[p](a, c, d, e));
            }

            return b ? {
              value: f
            } : f;
          };

        case s.ObjectExpression:
          return g = [], q(a.properties, function (a) {
            a.computed ? g.push({
              key: f.recurse(a.key),
              computed: !0,
              value: f.recurse(a.value)
            }) : g.push({
              key: a.key.type === s.Identifier ? a.key.name : "" + a.key.value,
              computed: !1,
              value: f.recurse(a.value)
            });
          }), function (a, c, d, e) {
            for (var f = {}, p = 0; p < g.length; ++p) {
              g[p].computed ? f[g[p].key(a, c, d, e)] = g[p].value(a, c, d, e) : f[g[p].key] = g[p].value(a, c, d, e);
            }

            return b ? {
              value: f
            } : f;
          };

        case s.ThisExpression:
          return function (a) {
            return b ? {
              value: a
            } : a;
          };

        case s.LocalsExpression:
          return function (a, c) {
            return b ? {
              value: c
            } : c;
          };

        case s.NGValueParameter:
          return function (a, c, d) {
            return b ? {
              value: d
            } : d;
          };
      }
    },
    "unary+": function unary(a, b) {
      return function (d, c, e, f) {
        d = a(d, c, e, f);
        d = w(d) ? +d : 0;
        return b ? {
          value: d
        } : d;
      };
    },
    "unary-": function unary(a, b) {
      return function (d, c, e, f) {
        d = a(d, c, e, f);
        d = w(d) ? -d : 0;
        return b ? {
          value: d
        } : d;
      };
    },
    "unary!": function unary(a, b) {
      return function (d, c, e, f) {
        d = !a(d, c, e, f);
        return b ? {
          value: d
        } : d;
      };
    },
    "binary+": function binary(a, b, d) {
      return function (c, e, f, g) {
        var h = a(c, e, f, g);
        c = b(c, e, f, g);
        h = od(h, c);
        return d ? {
          value: h
        } : h;
      };
    },
    "binary-": function binary(a, b, d) {
      return function (c, e, f, g) {
        var h = a(c, e, f, g);
        c = b(c, e, f, g);
        h = (w(h) ? h : 0) - (w(c) ? c : 0);
        return d ? {
          value: h
        } : h;
      };
    },
    "binary*": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) * b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary/": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) / b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary%": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) % b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary===": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) === b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary!==": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) !== b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary==": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) == b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary!=": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) != b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary<": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) < b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary>": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) > b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary<=": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) <= b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary>=": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) >= b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary&&": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) && b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "binary||": function binary(a, b, d) {
      return function (c, e, f, g) {
        c = a(c, e, f, g) || b(c, e, f, g);
        return d ? {
          value: c
        } : c;
      };
    },
    "ternary?:": function ternary(a, b, d, c) {
      return function (e, f, g, h) {
        e = a(e, f, g, h) ? b(e, f, g, h) : d(e, f, g, h);
        return c ? {
          value: e
        } : e;
      };
    },
    value: function value(a, b) {
      return function () {
        return b ? {
          context: void 0,
          name: void 0,
          value: a
        } : a;
      };
    },
    identifier: function identifier(a, b, d, c, e) {
      return function (f, g, h, k) {
        f = g && a in g ? g : f;
        c && 1 !== c && f && !f[a] && (f[a] = {});
        g = f ? f[a] : void 0;
        b && ra(g, e);
        return d ? {
          context: f,
          name: a,
          value: g
        } : g;
      };
    },
    computedMember: function computedMember(a, b, d, c, e) {
      return function (f, g, h, k) {
        var l = a(f, g, h, k),
            m,
            n;
        null != l && (m = b(f, g, h, k), m += "", Sa(m, e), c && 1 !== c && (Ib(l), l && !l[m] && (l[m] = {})), n = l[m], ra(n, e));
        return d ? {
          context: l,
          name: m,
          value: n
        } : n;
      };
    },
    nonComputedMember: function nonComputedMember(a, b, d, c, e, f) {
      return function (g, h, k, l) {
        g = a(g, h, k, l);
        e && 1 !== e && (Ib(g), g && !g[b] && (g[b] = {}));
        h = null != g ? g[b] : void 0;
        (d || Jb(b)) && ra(h, f);
        return c ? {
          context: g,
          name: b,
          value: h
        } : h;
      };
    },
    inputs: function inputs(a, b) {
      return function (d, c, e, f) {
        return f ? f[b] : a(d, c, e);
      };
    }
  };

  var kc = function kc(a, b, d) {
    this.lexer = a;
    this.$filter = b;
    this.options = d;
    this.ast = new s(a, d);
    this.astCompiler = d.csp ? new ud(this.ast, b) : new td(this.ast, b);
  };

  kc.prototype = {
    constructor: kc,
    parse: function parse(a) {
      return this.astCompiler.compile(a, this.options.expensiveChecks);
    }
  };
  var ng = Object.prototype.valueOf,
      sa = N("$sce"),
      la = {
    HTML: "html",
    CSS: "css",
    URL: "url",
    RESOURCE_URL: "resourceUrl",
    JS: "js"
  },
      pg = N("$compile"),
      $ = C.document.createElement("a"),
      yd = Y(C.location.href);
  zd.$inject = ["$document"];
  Mc.$inject = ["$provide"];
  var Gd = 22,
      Fd = ".",
      mc = "0";
  Ad.$inject = ["$locale"];
  Cd.$inject = ["$locale"];
  var Ag = {
    yyyy: ba("FullYear", 4, 0, !1, !0),
    yy: ba("FullYear", 2, 0, !0, !0),
    y: ba("FullYear", 1, 0, !1, !0),
    MMMM: kb("Month"),
    MMM: kb("Month", !0),
    MM: ba("Month", 2, 1),
    M: ba("Month", 1, 1),
    LLLL: kb("Month", !1, !0),
    dd: ba("Date", 2),
    d: ba("Date", 1),
    HH: ba("Hours", 2),
    H: ba("Hours", 1),
    hh: ba("Hours", 2, -12),
    h: ba("Hours", 1, -12),
    mm: ba("Minutes", 2),
    m: ba("Minutes", 1),
    ss: ba("Seconds", 2),
    s: ba("Seconds", 1),
    sss: ba("Milliseconds", 3),
    EEEE: kb("Day"),
    EEE: kb("Day", !0),
    a: function a(_a, b) {
      return 12 > _a.getHours() ? b.AMPMS[0] : b.AMPMS[1];
    },
    Z: function Z(a, b, d) {
      a = -1 * d;
      return a = (0 <= a ? "+" : "") + (Kb(Math[0 < a ? "floor" : "ceil"](a / 60), 2) + Kb(Math.abs(a % 60), 2));
    },
    ww: Id(2),
    w: Id(1),
    G: nc,
    GG: nc,
    GGG: nc,
    GGGG: function GGGG(a, b) {
      return 0 >= a.getFullYear() ? b.ERANAMES[0] : b.ERANAMES[1];
    }
  },
      zg = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
      yg = /^\-?\d+$/;
  Bd.$inject = ["$locale"];
  var tg = ha(Q),
      ug = ha(ub);
  Dd.$inject = ["$parse"];
  var oe = ha({
    restrict: "E",
    compile: function compile(a, b) {
      if (!b.href && !b.xlinkHref) return function (a, b) {
        if ("a" === b[0].nodeName.toLowerCase()) {
          var e = "[object SVGAnimatedString]" === ma.call(b.prop("href")) ? "xlink:href" : "href";
          b.on("click", function (a) {
            b.attr(e) || a.preventDefault();
          });
        }
      };
    }
  }),
      vb = {};
  q(Eb, function (a, b) {
    function d(a, d, e) {
      a.$watch(e[c], function (a) {
        e.$set(b, !!a);
      });
    }

    if ("multiple" != a) {
      var c = Aa("ng-" + b),
          e = d;
      "checked" === a && (e = function e(a, b, _e) {
        _e.ngModel !== _e[c] && d(a, b, _e);
      });

      vb[c] = function () {
        return {
          restrict: "A",
          priority: 100,
          link: e
        };
      };
    }
  });
  q(bd, function (a, b) {
    vb[b] = function () {
      return {
        priority: 100,
        link: function link(a, c, e) {
          if ("ngPattern" === b && "/" == e.ngPattern.charAt(0) && (c = e.ngPattern.match(Cg))) {
            e.$set("ngPattern", new RegExp(c[1], c[2]));
            return;
          }

          a.$watch(e[b], function (a) {
            e.$set(b, a);
          });
        }
      };
    };
  });
  q(["src", "srcset", "href"], function (a) {
    var b = Aa("ng-" + a);

    vb[b] = function () {
      return {
        priority: 99,
        link: function link(d, c, e) {
          var f = a,
              g = a;
          "href" === a && "[object SVGAnimatedString]" === ma.call(c.prop("href")) && (g = "xlinkHref", e.$attr[g] = "xlink:href", f = null);
          e.$observe(b, function (b) {
            b ? (e.$set(g, b), Ea && f && c.prop(f, e[g])) : "href" === a && e.$set(g, null);
          });
        }
      };
    };
  });
  var Lb = {
    $addControl: A,
    $$renameControl: function $$renameControl(a, b) {
      a.$name = b;
    },
    $removeControl: A,
    $setValidity: A,
    $setDirty: A,
    $setPristine: A,
    $setSubmitted: A
  };
  Jd.$inject = ["$element", "$attrs", "$scope", "$animate", "$interpolate"];

  var Sd = function Sd(a) {
    return ["$timeout", "$parse", function (b, d) {
      function c(a) {
        return "" === a ? d('this[""]').assign : d(a).assign || A;
      }

      return {
        name: "form",
        restrict: a ? "EAC" : "E",
        require: ["form", "^^?form"],
        controller: Jd,
        compile: function compile(d, f) {
          d.addClass(Ua).addClass(ob);
          var g = f.name ? "name" : a && f.ngForm ? "ngForm" : !1;
          return {
            pre: function pre(a, d, e, f) {
              var n = f[0];

              if (!("action" in e)) {
                var p = function p(b) {
                  a.$apply(function () {
                    n.$commitViewValue();
                    n.$setSubmitted();
                  });
                  b.preventDefault();
                };

                d[0].addEventListener("submit", p, !1);
                d.on("$destroy", function () {
                  b(function () {
                    d[0].removeEventListener("submit", p, !1);
                  }, 0, !1);
                });
              }

              (f[1] || n.$$parentForm).$addControl(n);
              var q = g ? c(n.$name) : A;
              g && (q(a, n), e.$observe(g, function (b) {
                n.$name !== b && (q(a, void 0), n.$$parentForm.$$renameControl(n, b), q = c(n.$name), q(a, n));
              }));
              d.on("$destroy", function () {
                n.$$parentForm.$removeControl(n);
                q(a, void 0);
                S(n, Lb);
              });
            }
          };
        }
      };
    }];
  },
      pe = Sd(),
      Ce = Sd(!0),
      Bg = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,
      Kg = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,
      Lg = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,
      Mg = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,
      Td = /^(\d{4,})-(\d{2})-(\d{2})$/,
      Ud = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,
      rc = /^(\d{4,})-W(\d\d)$/,
      Vd = /^(\d{4,})-(\d\d)$/,
      Wd = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,
      Ld = U();

  q(["date", "datetime-local", "month", "time", "week"], function (a) {
    Ld[a] = !0;
  });

  var Xd = {
    text: function text(a, b, d, c, e, f) {
      lb(a, b, d, c, e, f);
      pc(c);
    },
    date: mb("date", Td, Nb(Td, ["yyyy", "MM", "dd"]), "yyyy-MM-dd"),
    "datetime-local": mb("datetimelocal", Ud, Nb(Ud, "yyyy MM dd HH mm ss sss".split(" ")), "yyyy-MM-ddTHH:mm:ss.sss"),
    time: mb("time", Wd, Nb(Wd, ["HH", "mm", "ss", "sss"]), "HH:mm:ss.sss"),
    week: mb("week", rc, function (a, b) {
      if (da(a)) return a;

      if (G(a)) {
        rc.lastIndex = 0;
        var d = rc.exec(a);

        if (d) {
          var c = +d[1],
              e = +d[2],
              f = d = 0,
              g = 0,
              h = 0,
              k = Hd(c),
              e = 7 * (e - 1);
          b && (d = b.getHours(), f = b.getMinutes(), g = b.getSeconds(), h = b.getMilliseconds());
          return new Date(c, 0, k.getDate() + e, d, f, g, h);
        }
      }

      return NaN;
    }, "yyyy-Www"),
    month: mb("month", Vd, Nb(Vd, ["yyyy", "MM"]), "yyyy-MM"),
    number: function number(a, b, d, c, e, f) {
      Md(a, b, d, c);
      lb(a, b, d, c, e, f);
      c.$$parserName = "number";
      c.$parsers.push(function (a) {
        if (c.$isEmpty(a)) return null;
        if (Mg.test(a)) return parseFloat(a);
      });
      c.$formatters.push(function (a) {
        if (!c.$isEmpty(a)) {
          if (!T(a)) throw nb("numfmt", a);
          a = a.toString();
        }

        return a;
      });

      if (w(d.min) || d.ngMin) {
        var g;

        c.$validators.min = function (a) {
          return c.$isEmpty(a) || y(g) || a >= g;
        };

        d.$observe("min", function (a) {
          w(a) && !T(a) && (a = parseFloat(a));
          g = T(a) && !isNaN(a) ? a : void 0;
          c.$validate();
        });
      }

      if (w(d.max) || d.ngMax) {
        var h;

        c.$validators.max = function (a) {
          return c.$isEmpty(a) || y(h) || a <= h;
        };

        d.$observe("max", function (a) {
          w(a) && !T(a) && (a = parseFloat(a));
          h = T(a) && !isNaN(a) ? a : void 0;
          c.$validate();
        });
      }
    },
    url: function url(a, b, d, c, e, f) {
      lb(a, b, d, c, e, f);
      pc(c);
      c.$$parserName = "url";

      c.$validators.url = function (a, b) {
        var d = a || b;
        return c.$isEmpty(d) || Kg.test(d);
      };
    },
    email: function email(a, b, d, c, e, f) {
      lb(a, b, d, c, e, f);
      pc(c);
      c.$$parserName = "email";

      c.$validators.email = function (a, b) {
        var d = a || b;
        return c.$isEmpty(d) || Lg.test(d);
      };
    },
    radio: function radio(a, b, d, c) {
      y(d.name) && b.attr("name", ++pb);
      b.on("click", function (a) {
        b[0].checked && c.$setViewValue(d.value, a && a.type);
      });

      c.$render = function () {
        b[0].checked = d.value == c.$viewValue;
      };

      d.$observe("value", c.$render);
    },
    checkbox: function checkbox(a, b, d, c, e, f, g, h) {
      var k = Nd(h, a, "ngTrueValue", d.ngTrueValue, !0),
          l = Nd(h, a, "ngFalseValue", d.ngFalseValue, !1);
      b.on("click", function (a) {
        c.$setViewValue(b[0].checked, a && a.type);
      });

      c.$render = function () {
        b[0].checked = c.$viewValue;
      };

      c.$isEmpty = function (a) {
        return !1 === a;
      };

      c.$formatters.push(function (a) {
        return na(a, k);
      });
      c.$parsers.push(function (a) {
        return a ? k : l;
      });
    },
    hidden: A,
    button: A,
    submit: A,
    reset: A,
    file: A
  },
      Gc = ["$browser", "$sniffer", "$filter", "$parse", function (a, b, d, c) {
    return {
      restrict: "E",
      require: ["?ngModel"],
      link: {
        pre: function pre(e, f, g, h) {
          h[0] && (Xd[Q(g.type)] || Xd.text)(e, f, g, h[0], b, a, d, c);
        }
      }
    };
  }],
      Ng = /^(true|false|\d+)$/,
      Ue = function Ue() {
    return {
      restrict: "A",
      priority: 100,
      compile: function compile(a, b) {
        return Ng.test(b.ngValue) ? function (a, b, e) {
          e.$set("value", a.$eval(e.ngValue));
        } : function (a, b, e) {
          a.$watch(e.ngValue, function (a) {
            e.$set("value", a);
          });
        };
      }
    };
  },
      ue = ["$compile", function (a) {
    return {
      restrict: "AC",
      compile: function compile(b) {
        a.$$addBindingClass(b);
        return function (b, c, e) {
          a.$$addBindingInfo(c, e.ngBind);
          c = c[0];
          b.$watch(e.ngBind, function (a) {
            c.textContent = y(a) ? "" : a;
          });
        };
      }
    };
  }],
      we = ["$interpolate", "$compile", function (a, b) {
    return {
      compile: function compile(d) {
        b.$$addBindingClass(d);
        return function (c, d, f) {
          c = a(d.attr(f.$attr.ngBindTemplate));
          b.$$addBindingInfo(d, c.expressions);
          d = d[0];
          f.$observe("ngBindTemplate", function (a) {
            d.textContent = y(a) ? "" : a;
          });
        };
      }
    };
  }],
      ve = ["$sce", "$parse", "$compile", function (a, b, d) {
    return {
      restrict: "A",
      compile: function compile(c, e) {
        var f = b(e.ngBindHtml),
            g = b(e.ngBindHtml, function (b) {
          return a.valueOf(b);
        });
        d.$$addBindingClass(c);
        return function (b, c, e) {
          d.$$addBindingInfo(c, e.ngBindHtml);
          b.$watch(g, function () {
            var d = f(b);
            c.html(a.getTrustedHtml(d) || "");
          });
        };
      }
    };
  }],
      Te = ha({
    restrict: "A",
    require: "ngModel",
    link: function link(a, b, d, c) {
      c.$viewChangeListeners.push(function () {
        a.$eval(d.ngChange);
      });
    }
  }),
      xe = qc("", !0),
      ze = qc("Odd", 0),
      ye = qc("Even", 1),
      Ae = Ta({
    compile: function compile(a, b) {
      b.$set("ngCloak", void 0);
      a.removeClass("ng-cloak");
    }
  }),
      Be = [function () {
    return {
      restrict: "A",
      scope: !0,
      controller: "@",
      priority: 500
    };
  }],
      Lc = {},
      Og = {
    blur: !0,
    focus: !0
  };

  q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "), function (a) {
    var b = Aa("ng-" + a);
    Lc[b] = ["$parse", "$rootScope", function (d, c) {
      return {
        restrict: "A",
        compile: function compile(e, f) {
          var g = d(f[b], null, !0);
          return function (b, d) {
            d.on(a, function (d) {
              var e = function e() {
                g(b, {
                  $event: d
                });
              };

              Og[a] && c.$$phase ? b.$evalAsync(e) : b.$apply(e);
            });
          };
        }
      };
    }];
  });

  var Ee = ["$animate", "$compile", function (a, b) {
    return {
      multiElement: !0,
      transclude: "element",
      priority: 600,
      terminal: !0,
      restrict: "A",
      $$tlb: !0,
      link: function link(d, c, e, f, g) {
        var h, k, l;
        d.$watch(e.ngIf, function (d) {
          d ? k || g(function (d, f) {
            k = f;
            d[d.length++] = b.$$createComment("end ngIf", e.ngIf);
            h = {
              clone: d
            };
            a.enter(d, c.parent(), c);
          }) : (l && (l.remove(), l = null), k && (k.$destroy(), k = null), h && (l = tb(h.clone), a.leave(l).then(function () {
            l = null;
          }), h = null));
        });
      }
    };
  }],
      Fe = ["$templateRequest", "$anchorScroll", "$animate", function (a, b, d) {
    return {
      restrict: "ECA",
      priority: 400,
      terminal: !0,
      transclude: "element",
      controller: ca.noop,
      compile: function compile(c, e) {
        var f = e.ngInclude || e.src,
            g = e.onload || "",
            h = e.autoscroll;
        return function (c, e, m, n, p) {
          var q = 0,
              s,
              B,
              r,
              y = function y() {
            B && (B.remove(), B = null);
            s && (s.$destroy(), s = null);
            r && (d.leave(r).then(function () {
              B = null;
            }), B = r, r = null);
          };

          c.$watch(f, function (f) {
            var m = function m() {
              !w(h) || h && !c.$eval(h) || b();
            },
                t = ++q;

            f ? (a(f, !0).then(function (a) {
              if (!c.$$destroyed && t === q) {
                var b = c.$new();
                n.template = a;
                a = p(b, function (a) {
                  y();
                  d.enter(a, null, e).then(m);
                });
                s = b;
                r = a;
                s.$emit("$includeContentLoaded", f);
                c.$eval(g);
              }
            }, function () {
              c.$$destroyed || t !== q || (y(), c.$emit("$includeContentError", f));
            }), c.$emit("$includeContentRequested", f)) : (y(), n.template = null);
          });
        };
      }
    };
  }],
      We = ["$compile", function (a) {
    return {
      restrict: "ECA",
      priority: -400,
      require: "ngInclude",
      link: function link(b, d, c, e) {
        ma.call(d[0]).match(/SVG/) ? (d.empty(), a(Oc(e.template, C.document).childNodes)(b, function (a) {
          d.append(a);
        }, {
          futureParentElement: d
        })) : (d.html(e.template), a(d.contents())(b));
      }
    };
  }],
      Ge = Ta({
    priority: 450,
    compile: function compile() {
      return {
        pre: function pre(a, b, d) {
          a.$eval(d.ngInit);
        }
      };
    }
  }),
      Se = function Se() {
    return {
      restrict: "A",
      priority: 100,
      require: "ngModel",
      link: function link(a, b, d, c) {
        var e = b.attr(d.$attr.ngList) || ", ",
            f = "false" !== d.ngTrim,
            g = f ? W(e) : e;
        c.$parsers.push(function (a) {
          if (!y(a)) {
            var b = [];
            a && q(a.split(g), function (a) {
              a && b.push(f ? W(a) : a);
            });
            return b;
          }
        });
        c.$formatters.push(function (a) {
          if (L(a)) return a.join(e);
        });

        c.$isEmpty = function (a) {
          return !a || !a.length;
        };
      }
    };
  },
      ob = "ng-valid",
      Od = "ng-invalid",
      Ua = "ng-pristine",
      Mb = "ng-dirty",
      Qd = "ng-pending",
      nb = N("ngModel"),
      Pg = ["$scope", "$exceptionHandler", "$attrs", "$element", "$parse", "$animate", "$timeout", "$rootScope", "$q", "$interpolate", function (a, b, d, c, e, f, g, h, k, l) {
    this.$modelValue = this.$viewValue = Number.NaN;
    this.$$rawModelValue = void 0;
    this.$validators = {};
    this.$asyncValidators = {};
    this.$parsers = [];
    this.$formatters = [];
    this.$viewChangeListeners = [];
    this.$untouched = !0;
    this.$touched = !1;
    this.$pristine = !0;
    this.$dirty = !1;
    this.$valid = !0;
    this.$invalid = !1;
    this.$error = {};
    this.$$success = {};
    this.$pending = void 0;
    this.$name = l(d.name || "", !1)(a);
    this.$$parentForm = Lb;
    var m = e(d.ngModel),
        n = m.assign,
        p = m,
        u = n,
        s = null,
        B,
        r = this;

    this.$$setOptions = function (a) {
      if ((r.$options = a) && a.getterSetter) {
        var b = e(d.ngModel + "()"),
            f = e(d.ngModel + "($$$p)");

        p = function p(a) {
          var c = m(a);
          z(c) && (c = b(a));
          return c;
        };

        u = function u(a, b) {
          z(m(a)) ? f(a, {
            $$$p: b
          }) : n(a, b);
        };
      } else if (!m.assign) throw nb("nonassign", d.ngModel, ya(c));
    };

    this.$render = A;

    this.$isEmpty = function (a) {
      return y(a) || "" === a || null === a || a !== a;
    };

    this.$$updateEmptyClasses = function (a) {
      r.$isEmpty(a) ? (f.removeClass(c, "ng-not-empty"), f.addClass(c, "ng-empty")) : (f.removeClass(c, "ng-empty"), f.addClass(c, "ng-not-empty"));
    };

    var J = 0;
    Kd({
      ctrl: this,
      $element: c,
      set: function set(a, b) {
        a[b] = !0;
      },
      unset: function unset(a, b) {
        delete a[b];
      },
      $animate: f
    });

    this.$setPristine = function () {
      r.$dirty = !1;
      r.$pristine = !0;
      f.removeClass(c, Mb);
      f.addClass(c, Ua);
    };

    this.$setDirty = function () {
      r.$dirty = !0;
      r.$pristine = !1;
      f.removeClass(c, Ua);
      f.addClass(c, Mb);
      r.$$parentForm.$setDirty();
    };

    this.$setUntouched = function () {
      r.$touched = !1;
      r.$untouched = !0;
      f.setClass(c, "ng-untouched", "ng-touched");
    };

    this.$setTouched = function () {
      r.$touched = !0;
      r.$untouched = !1;
      f.setClass(c, "ng-touched", "ng-untouched");
    };

    this.$rollbackViewValue = function () {
      g.cancel(s);
      r.$viewValue = r.$$lastCommittedViewValue;
      r.$render();
    };

    this.$validate = function () {
      if (!T(r.$modelValue) || !isNaN(r.$modelValue)) {
        var a = r.$$rawModelValue,
            b = r.$valid,
            c = r.$modelValue,
            d = r.$options && r.$options.allowInvalid;
        r.$$runValidators(a, r.$$lastCommittedViewValue, function (e) {
          d || b === e || (r.$modelValue = e ? a : void 0, r.$modelValue !== c && r.$$writeModelToScope());
        });
      }
    };

    this.$$runValidators = function (a, b, c) {
      function d() {
        var c = !0;
        q(r.$validators, function (d, e) {
          var g = d(a, b);
          c = c && g;
          f(e, g);
        });
        return c ? !0 : (q(r.$asyncValidators, function (a, b) {
          f(b, null);
        }), !1);
      }

      function e() {
        var c = [],
            d = !0;
        q(r.$asyncValidators, function (e, g) {
          var h = e(a, b);
          if (!h || !z(h.then)) throw nb("nopromise", h);
          f(g, void 0);
          c.push(h.then(function () {
            f(g, !0);
          }, function () {
            d = !1;
            f(g, !1);
          }));
        });
        c.length ? k.all(c).then(function () {
          g(d);
        }, A) : g(!0);
      }

      function f(a, b) {
        h === J && r.$setValidity(a, b);
      }

      function g(a) {
        h === J && c(a);
      }

      J++;
      var h = J;
      (function () {
        var a = r.$$parserName || "parse";
        if (y(B)) f(a, null);else return B || (q(r.$validators, function (a, b) {
          f(b, null);
        }), q(r.$asyncValidators, function (a, b) {
          f(b, null);
        })), f(a, B), B;
        return !0;
      })() ? d() ? e() : g(!1) : g(!1);
    };

    this.$commitViewValue = function () {
      var a = r.$viewValue;
      g.cancel(s);
      if (r.$$lastCommittedViewValue !== a || "" === a && r.$$hasNativeValidators) r.$$updateEmptyClasses(a), r.$$lastCommittedViewValue = a, r.$pristine && this.$setDirty(), this.$$parseAndValidate();
    };

    this.$$parseAndValidate = function () {
      var b = r.$$lastCommittedViewValue;
      if (B = y(b) ? void 0 : !0) for (var c = 0; c < r.$parsers.length; c++) {
        if (b = r.$parsers[c](b), y(b)) {
          B = !1;
          break;
        }
      }
      T(r.$modelValue) && isNaN(r.$modelValue) && (r.$modelValue = p(a));
      var d = r.$modelValue,
          e = r.$options && r.$options.allowInvalid;
      r.$$rawModelValue = b;
      e && (r.$modelValue = b, r.$modelValue !== d && r.$$writeModelToScope());
      r.$$runValidators(b, r.$$lastCommittedViewValue, function (a) {
        e || (r.$modelValue = a ? b : void 0, r.$modelValue !== d && r.$$writeModelToScope());
      });
    };

    this.$$writeModelToScope = function () {
      u(a, r.$modelValue);
      q(r.$viewChangeListeners, function (a) {
        try {
          a();
        } catch (c) {
          b(c);
        }
      });
    };

    this.$setViewValue = function (a, b) {
      r.$viewValue = a;
      r.$options && !r.$options.updateOnDefault || r.$$debounceViewValueCommit(b);
    };

    this.$$debounceViewValueCommit = function (b) {
      var c = 0,
          d = r.$options;
      d && w(d.debounce) && (d = d.debounce, T(d) ? c = d : T(d[b]) ? c = d[b] : T(d["default"]) && (c = d["default"]));
      g.cancel(s);
      c ? s = g(function () {
        r.$commitViewValue();
      }, c) : h.$$phase ? r.$commitViewValue() : a.$apply(function () {
        r.$commitViewValue();
      });
    };

    a.$watch(function () {
      var b = p(a);

      if (b !== r.$modelValue && (r.$modelValue === r.$modelValue || b === b)) {
        r.$modelValue = r.$$rawModelValue = b;
        B = void 0;

        for (var c = r.$formatters, d = c.length, e = b; d--;) {
          e = c[d](e);
        }

        r.$viewValue !== e && (r.$$updateEmptyClasses(e), r.$viewValue = r.$$lastCommittedViewValue = e, r.$render(), r.$$runValidators(b, e, A));
      }

      return b;
    });
  }],
      Re = ["$rootScope", function (a) {
    return {
      restrict: "A",
      require: ["ngModel", "^?form", "^?ngModelOptions"],
      controller: Pg,
      priority: 1,
      compile: function compile(b) {
        b.addClass(Ua).addClass("ng-untouched").addClass(ob);
        return {
          pre: function pre(a, b, e, f) {
            var g = f[0];
            b = f[1] || g.$$parentForm;
            g.$$setOptions(f[2] && f[2].$options);
            b.$addControl(g);
            e.$observe("name", function (a) {
              g.$name !== a && g.$$parentForm.$$renameControl(g, a);
            });
            a.$on("$destroy", function () {
              g.$$parentForm.$removeControl(g);
            });
          },
          post: function post(b, c, e, f) {
            var g = f[0];
            if (g.$options && g.$options.updateOn) c.on(g.$options.updateOn, function (a) {
              g.$$debounceViewValueCommit(a && a.type);
            });
            c.on("blur", function () {
              g.$touched || (a.$$phase ? b.$evalAsync(g.$setTouched) : b.$apply(g.$setTouched));
            });
          }
        };
      }
    };
  }],
      Qg = /(\s+|^)default(\s+|$)/,
      Ve = function Ve() {
    return {
      restrict: "A",
      controller: ["$scope", "$attrs", function (a, b) {
        var d = this;
        this.$options = pa(a.$eval(b.ngModelOptions));
        w(this.$options.updateOn) ? (this.$options.updateOnDefault = !1, this.$options.updateOn = W(this.$options.updateOn.replace(Qg, function () {
          d.$options.updateOnDefault = !0;
          return " ";
        }))) : this.$options.updateOnDefault = !0;
      }]
    };
  },
      He = Ta({
    terminal: !0,
    priority: 1E3
  }),
      Rg = N("ngOptions"),
      Sg = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
      Pe = ["$compile", "$document", "$parse", function (a, b, d) {
    function c(a, b, c) {
      function e(a, b, c, d, f) {
        this.selectValue = a;
        this.viewValue = b;
        this.label = c;
        this.group = d;
        this.disabled = f;
      }

      function f(a) {
        var b;
        if (!q && ta(a)) b = a;else {
          b = [];

          for (var c in a) {
            a.hasOwnProperty(c) && "$" !== c.charAt(0) && b.push(c);
          }
        }
        return b;
      }

      var n = a.match(Sg);
      if (!n) throw Rg("iexp", a, ya(b));
      var p = n[5] || n[7],
          q = n[6];
      a = / as /.test(n[0]) && n[1];
      var s = n[9];
      b = d(n[2] ? n[1] : p);

      var w = a && d(a) || b,
          r = s && d(s),
          y = s ? function (a, b) {
        return r(c, b);
      } : function (a) {
        return Ca(a);
      },
          v = function v(a, b) {
        return y(a, E(a, b));
      },
          A = d(n[2] || n[1]),
          t = d(n[3] || ""),
          K = d(n[4] || ""),
          z = d(n[8]),
          H = {},
          E = q ? function (a, b) {
        H[q] = b;
        H[p] = a;
        return H;
      } : function (a) {
        H[p] = a;
        return H;
      };

      return {
        trackBy: s,
        getTrackByValue: v,
        getWatchables: d(z, function (a) {
          var b = [];
          a = a || [];

          for (var d = f(a), e = d.length, g = 0; g < e; g++) {
            var h = a === d ? g : d[g],
                l = a[h],
                h = E(l, h),
                l = y(l, h);
            b.push(l);
            if (n[2] || n[1]) l = A(c, h), b.push(l);
            n[4] && (h = K(c, h), b.push(h));
          }

          return b;
        }),
        getOptions: function getOptions() {
          for (var a = [], b = {}, d = z(c) || [], g = f(d), h = g.length, n = 0; n < h; n++) {
            var p = d === g ? n : g[n],
                q = E(d[p], p),
                r = w(c, q),
                p = y(r, q),
                u = A(c, q),
                H = t(c, q),
                q = K(c, q),
                r = new e(p, r, u, H, q);
            a.push(r);
            b[p] = r;
          }

          return {
            items: a,
            selectValueMap: b,
            getOptionFromViewValue: function getOptionFromViewValue(a) {
              return b[v(a)];
            },
            getViewValueFromOption: function getViewValueFromOption(a) {
              return s ? ca.copy(a.viewValue) : a.viewValue;
            }
          };
        }
      };
    }

    var e = C.document.createElement("option"),
        f = C.document.createElement("optgroup");
    return {
      restrict: "A",
      terminal: !0,
      require: ["select", "ngModel"],
      link: {
        pre: function pre(a, b, c, d) {
          d[0].registerOption = A;
        },
        post: function post(d, h, k, l) {
          function m(a, b) {
            a.element = b;
            b.disabled = a.disabled;
            a.label !== b.label && (b.label = a.label, b.textContent = a.label);
            a.value !== b.value && (b.value = a.selectValue);
          }

          function n() {
            var a = t && p.readValue();
            if (t) for (var b = t.items.length - 1; 0 <= b; b--) {
              var c = t.items[b];
              w(c.group) ? Db(c.element.parentNode) : Db(c.element);
            }
            t = K.getOptions();
            var d = {};
            v && h.prepend(B);
            t.items.forEach(function (a) {
              var b;

              if (w(a.group)) {
                b = d[a.group];
                b || (b = f.cloneNode(!1), C.appendChild(b), b.label = null === a.group ? "null" : a.group, d[a.group] = b);
                var c = e.cloneNode(!1);
              } else b = C, c = e.cloneNode(!1);

              b.appendChild(c);
              m(a, c);
            });
            h[0].appendChild(C);
            s.$render();
            s.$isEmpty(a) || (b = p.readValue(), (K.trackBy || y ? na(a, b) : a === b) || (s.$setViewValue(b), s.$render()));
          }

          var p = l[0],
              s = l[1],
              y = k.multiple,
              B;
          l = 0;

          for (var r = h.children(), A = r.length; l < A; l++) {
            if ("" === r[l].value) {
              B = r.eq(l);
              break;
            }
          }

          var v = !!B,
              z = F(e.cloneNode(!1));
          z.val("?");
          var t,
              K = c(k.ngOptions, h, d),
              C = b[0].createDocumentFragment();
          y ? (s.$isEmpty = function (a) {
            return !a || 0 === a.length;
          }, p.writeValue = function (a) {
            t.items.forEach(function (a) {
              a.element.selected = !1;
            });
            a && a.forEach(function (a) {
              if (a = t.getOptionFromViewValue(a)) a.element.selected = !0;
            });
          }, p.readValue = function () {
            var a = h.val() || [],
                b = [];
            q(a, function (a) {
              (a = t.selectValueMap[a]) && !a.disabled && b.push(t.getViewValueFromOption(a));
            });
            return b;
          }, K.trackBy && d.$watchCollection(function () {
            if (L(s.$viewValue)) return s.$viewValue.map(function (a) {
              return K.getTrackByValue(a);
            });
          }, function () {
            s.$render();
          })) : (p.writeValue = function (a) {
            var b = t.getOptionFromViewValue(a);
            b ? (h[0].value !== b.selectValue && (z.remove(), v || B.remove(), h[0].value = b.selectValue, b.element.selected = !0), b.element.setAttribute("selected", "selected")) : null === a || v ? (z.remove(), v || h.prepend(B), h.val(""), B.prop("selected", !0), B.attr("selected", !0)) : (v || B.remove(), h.prepend(z), h.val("?"), z.prop("selected", !0), z.attr("selected", !0));
          }, p.readValue = function () {
            var a = t.selectValueMap[h.val()];
            return a && !a.disabled ? (v || B.remove(), z.remove(), t.getViewValueFromOption(a)) : null;
          }, K.trackBy && d.$watch(function () {
            return K.getTrackByValue(s.$viewValue);
          }, function () {
            s.$render();
          }));
          v ? (B.remove(), a(B)(d), B.removeClass("ng-scope")) : B = F(e.cloneNode(!1));
          h.empty();
          n();
          d.$watchCollection(K.getWatchables, n);
        }
      }
    };
  }],
      Ie = ["$locale", "$interpolate", "$log", function (a, b, d) {
    var c = /{}/g,
        e = /^when(Minus)?(.+)$/;
    return {
      link: function link(f, g, h) {
        function k(a) {
          g.text(a || "");
        }

        var l = h.count,
            m = h.$attr.when && g.attr(h.$attr.when),
            n = h.offset || 0,
            p = f.$eval(m) || {},
            s = {},
            w = b.startSymbol(),
            B = b.endSymbol(),
            r = w + l + "-" + n + B,
            z = ca.noop,
            v;
        q(h, function (a, b) {
          var c = e.exec(b);
          c && (c = (c[1] ? "-" : "") + Q(c[2]), p[c] = g.attr(h.$attr[b]));
        });
        q(p, function (a, d) {
          s[d] = b(a.replace(c, r));
        });
        f.$watch(l, function (b) {
          var c = parseFloat(b),
              e = isNaN(c);
          e || c in p || (c = a.pluralCat(c - n));
          c === v || e && T(v) && isNaN(v) || (z(), e = s[c], y(e) ? (null != b && d.debug("ngPluralize: no rule defined for '" + c + "' in " + m), z = A, k()) : z = f.$watch(e, k), v = c);
        });
      }
    };
  }],
      Je = ["$parse", "$animate", "$compile", function (a, b, d) {
    var c = N("ngRepeat"),
        e = function e(a, b, c, d, _e2, m, n) {
      a[c] = d;
      _e2 && (a[_e2] = m);
      a.$index = b;
      a.$first = 0 === b;
      a.$last = b === n - 1;
      a.$middle = !(a.$first || a.$last);
      a.$odd = !(a.$even = 0 === (b & 1));
    };

    return {
      restrict: "A",
      multiElement: !0,
      transclude: "element",
      priority: 1E3,
      terminal: !0,
      $$tlb: !0,
      compile: function compile(f, g) {
        var h = g.ngRepeat,
            k = d.$$createComment("end ngRepeat", h),
            l = h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
        if (!l) throw c("iexp", h);
        var m = l[1],
            n = l[2],
            p = l[3],
            s = l[4],
            l = m.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
        if (!l) throw c("iidexp", m);
        var w = l[3] || l[1],
            y = l[2];
        if (p && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(p) || /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(p))) throw c("badident", p);
        var r,
            z,
            v,
            A,
            t = {
          $id: Ca
        };
        s ? r = a(s) : (v = function v(a, b) {
          return Ca(b);
        }, A = function A(a) {
          return a;
        });
        return function (a, d, f, g, l) {
          r && (z = function z(b, c, d) {
            y && (t[y] = b);
            t[w] = c;
            t.$index = d;
            return r(a, t);
          });
          var m = U();
          a.$watchCollection(n, function (f) {
            var g,
                n,
                r = d[0],
                s,
                u = U(),
                t,
                C,
                F,
                E,
                G,
                D,
                H;
            p && (a[p] = f);
            if (ta(f)) G = f, n = z || v;else for (H in n = z || A, G = [], f) {
              ua.call(f, H) && "$" !== H.charAt(0) && G.push(H);
            }
            t = G.length;
            H = Array(t);

            for (g = 0; g < t; g++) {
              if (C = f === G ? g : G[g], F = f[C], E = n(C, F, g), m[E]) D = m[E], delete m[E], u[E] = D, H[g] = D;else {
                if (u[E]) throw q(H, function (a) {
                  a && a.scope && (m[a.id] = a);
                }), c("dupes", h, E, F);
                H[g] = {
                  id: E,
                  scope: void 0,
                  clone: void 0
                };
                u[E] = !0;
              }
            }

            for (s in m) {
              D = m[s];
              E = tb(D.clone);
              b.leave(E);
              if (E[0].parentNode) for (g = 0, n = E.length; g < n; g++) {
                E[g].$$NG_REMOVED = !0;
              }
              D.scope.$destroy();
            }

            for (g = 0; g < t; g++) {
              if (C = f === G ? g : G[g], F = f[C], D = H[g], D.scope) {
                s = r;

                do {
                  s = s.nextSibling;
                } while (s && s.$$NG_REMOVED);

                D.clone[0] != s && b.move(tb(D.clone), null, r);
                r = D.clone[D.clone.length - 1];
                e(D.scope, g, w, F, y, C, t);
              } else l(function (a, c) {
                D.scope = c;
                var d = k.cloneNode(!1);
                a[a.length++] = d;
                b.enter(a, null, r);
                r = d;
                D.clone = a;
                u[D.id] = D;
                e(D.scope, g, w, F, y, C, t);
              });
            }

            m = u;
          });
        };
      }
    };
  }],
      Ke = ["$animate", function (a) {
    return {
      restrict: "A",
      multiElement: !0,
      link: function link(b, d, c) {
        b.$watch(c.ngShow, function (b) {
          a[b ? "removeClass" : "addClass"](d, "ng-hide", {
            tempClasses: "ng-hide-animate"
          });
        });
      }
    };
  }],
      De = ["$animate", function (a) {
    return {
      restrict: "A",
      multiElement: !0,
      link: function link(b, d, c) {
        b.$watch(c.ngHide, function (b) {
          a[b ? "addClass" : "removeClass"](d, "ng-hide", {
            tempClasses: "ng-hide-animate"
          });
        });
      }
    };
  }],
      Le = Ta(function (a, b, d) {
    a.$watch(d.ngStyle, function (a, d) {
      d && a !== d && q(d, function (a, c) {
        b.css(c, "");
      });
      a && b.css(a);
    }, !0);
  }),
      Me = ["$animate", "$compile", function (a, b) {
    return {
      require: "ngSwitch",
      controller: ["$scope", function () {
        this.cases = {};
      }],
      link: function link(d, c, e, f) {
        var g = [],
            h = [],
            k = [],
            l = [],
            m = function m(a, b) {
          return function () {
            a.splice(b, 1);
          };
        };

        d.$watch(e.ngSwitch || e.on, function (c) {
          var d, e;
          d = 0;

          for (e = k.length; d < e; ++d) {
            a.cancel(k[d]);
          }

          d = k.length = 0;

          for (e = l.length; d < e; ++d) {
            var s = tb(h[d].clone);
            l[d].$destroy();
            (k[d] = a.leave(s)).then(m(k, d));
          }

          h.length = 0;
          l.length = 0;
          (g = f.cases["!" + c] || f.cases["?"]) && q(g, function (c) {
            c.transclude(function (d, e) {
              l.push(e);
              var f = c.element;
              d[d.length++] = b.$$createComment("end ngSwitchWhen");
              h.push({
                clone: d
              });
              a.enter(d, f.parent(), f);
            });
          });
        });
      }
    };
  }],
      Ne = Ta({
    transclude: "element",
    priority: 1200,
    require: "^ngSwitch",
    multiElement: !0,
    link: function link(a, b, d, c, e) {
      c.cases["!" + d.ngSwitchWhen] = c.cases["!" + d.ngSwitchWhen] || [];
      c.cases["!" + d.ngSwitchWhen].push({
        transclude: e,
        element: b
      });
    }
  }),
      Oe = Ta({
    transclude: "element",
    priority: 1200,
    require: "^ngSwitch",
    multiElement: !0,
    link: function link(a, b, d, c, e) {
      c.cases["?"] = c.cases["?"] || [];
      c.cases["?"].push({
        transclude: e,
        element: b
      });
    }
  }),
      Tg = N("ngTransclude"),
      Qe = ["$compile", function (a) {
    return {
      restrict: "EAC",
      terminal: !0,
      compile: function compile(b) {
        var d = a(b.contents());
        b.empty();
        return function (a, b, f, g, h) {
          function k() {
            d(a, function (a) {
              b.append(a);
            });
          }

          if (!h) throw Tg("orphan", ya(b));
          f.ngTransclude === f.$attr.ngTransclude && (f.ngTransclude = "");
          f = f.ngTransclude || f.ngTranscludeSlot;
          h(function (a, c) {
            a.length ? b.append(a) : (k(), c.$destroy());
          }, null, f);
          f && !h.isSlotFilled(f) && k();
        };
      }
    };
  }],
      qe = ["$templateCache", function (a) {
    return {
      restrict: "E",
      terminal: !0,
      compile: function compile(b, d) {
        "text/ng-template" == d.type && a.put(d.id, b[0].text);
      }
    };
  }],
      Ug = {
    $setViewValue: A,
    $render: A
  },
      Vg = ["$element", "$scope", function (a, b) {
    var d = this,
        c = new Ra();
    d.ngModelCtrl = Ug;
    d.unknownOption = F(C.document.createElement("option"));

    d.renderUnknownOption = function (b) {
      b = "? " + Ca(b) + " ?";
      d.unknownOption.val(b);
      a.prepend(d.unknownOption);
      a.val(b);
    };

    b.$on("$destroy", function () {
      d.renderUnknownOption = A;
    });

    d.removeUnknownOption = function () {
      d.unknownOption.parent() && d.unknownOption.remove();
    };

    d.readValue = function () {
      d.removeUnknownOption();
      return a.val();
    };

    d.writeValue = function (b) {
      d.hasOption(b) ? (d.removeUnknownOption(), a.val(b), "" === b && d.emptyOption.prop("selected", !0)) : null == b && d.emptyOption ? (d.removeUnknownOption(), a.val("")) : d.renderUnknownOption(b);
    };

    d.addOption = function (a, b) {
      if (8 !== b[0].nodeType) {
        Qa(a, '"option value"');
        "" === a && (d.emptyOption = b);
        var g = c.get(a) || 0;
        c.put(a, g + 1);
        d.ngModelCtrl.$render();
        b[0].hasAttribute("selected") && (b[0].selected = !0);
      }
    };

    d.removeOption = function (a) {
      var b = c.get(a);
      b && (1 === b ? (c.remove(a), "" === a && (d.emptyOption = void 0)) : c.put(a, b - 1));
    };

    d.hasOption = function (a) {
      return !!c.get(a);
    };

    d.registerOption = function (a, b, c, h, k) {
      if (h) {
        var l;
        c.$observe("value", function (a) {
          w(l) && d.removeOption(l);
          l = a;
          d.addOption(a, b);
        });
      } else k ? a.$watch(k, function (a, e) {
        c.$set("value", a);
        e !== a && d.removeOption(e);
        d.addOption(a, b);
      }) : d.addOption(c.value, b);

      b.on("$destroy", function () {
        d.removeOption(c.value);
        d.ngModelCtrl.$render();
      });
    };
  }],
      re = function re() {
    return {
      restrict: "E",
      require: ["select", "?ngModel"],
      controller: Vg,
      priority: 1,
      link: {
        pre: function pre(a, b, d, c) {
          var e = c[1];

          if (e) {
            var f = c[0];
            f.ngModelCtrl = e;
            b.on("change", function () {
              a.$apply(function () {
                e.$setViewValue(f.readValue());
              });
            });

            if (d.multiple) {
              f.readValue = function () {
                var a = [];
                q(b.find("option"), function (b) {
                  b.selected && a.push(b.value);
                });
                return a;
              };

              f.writeValue = function (a) {
                var c = new Ra(a);
                q(b.find("option"), function (a) {
                  a.selected = w(c.get(a.value));
                });
              };

              var g,
                  h = NaN;
              a.$watch(function () {
                h !== e.$viewValue || na(g, e.$viewValue) || (g = ia(e.$viewValue), e.$render());
                h = e.$viewValue;
              });

              e.$isEmpty = function (a) {
                return !a || 0 === a.length;
              };
            }
          }
        },
        post: function post(a, b, d, c) {
          var e = c[1];

          if (e) {
            var f = c[0];

            e.$render = function () {
              f.writeValue(e.$viewValue);
            };
          }
        }
      }
    };
  },
      te = ["$interpolate", function (a) {
    return {
      restrict: "E",
      priority: 100,
      compile: function compile(b, d) {
        if (w(d.value)) var c = a(d.value, !0);else {
          var e = a(b.text(), !0);
          e || d.$set("value", b.text());
        }
        return function (a, b, d) {
          var k = b.parent();
          (k = k.data("$selectController") || k.parent().data("$selectController")) && k.registerOption(a, b, d, c, e);
        };
      }
    };
  }],
      se = ha({
    restrict: "E",
    terminal: !1
  }),
      Ic = function Ic() {
    return {
      restrict: "A",
      require: "?ngModel",
      link: function link(a, b, d, c) {
        c && (d.required = !0, c.$validators.required = function (a, b) {
          return !d.required || !c.$isEmpty(b);
        }, d.$observe("required", function () {
          c.$validate();
        }));
      }
    };
  },
      Hc = function Hc() {
    return {
      restrict: "A",
      require: "?ngModel",
      link: function link(a, b, d, c) {
        if (c) {
          var e,
              f = d.ngPattern || d.pattern;
          d.$observe("pattern", function (a) {
            G(a) && 0 < a.length && (a = new RegExp("^" + a + "$"));
            if (a && !a.test) throw N("ngPattern")("noregexp", f, a, ya(b));
            e = a || void 0;
            c.$validate();
          });

          c.$validators.pattern = function (a, b) {
            return c.$isEmpty(b) || y(e) || e.test(b);
          };
        }
      }
    };
  },
      Kc = function Kc() {
    return {
      restrict: "A",
      require: "?ngModel",
      link: function link(a, b, d, c) {
        if (c) {
          var e = -1;
          d.$observe("maxlength", function (a) {
            a = Z(a);
            e = isNaN(a) ? -1 : a;
            c.$validate();
          });

          c.$validators.maxlength = function (a, b) {
            return 0 > e || c.$isEmpty(b) || b.length <= e;
          };
        }
      }
    };
  },
      Jc = function Jc() {
    return {
      restrict: "A",
      require: "?ngModel",
      link: function link(a, b, d, c) {
        if (c) {
          var e = 0;
          d.$observe("minlength", function (a) {
            e = Z(a) || 0;
            c.$validate();
          });

          c.$validators.minlength = function (a, b) {
            return c.$isEmpty(b) || b.length >= e;
          };
        }
      }
    };
  };

  C.angular.bootstrap ? C.console && console.log("WARNING: Tried to load angular more than once.") : (je(), le(ca), ca.module("ngLocale", [], ["$provide", function (a) {
    function b(a) {
      a += "";
      var b = a.indexOf(".");
      return -1 == b ? 0 : a.length - b - 1;
    }

    a.value("$locale", {
      DATETIME_FORMATS: {
        AMPMS: ["AM", "PM"],
        DAY: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
        ERANAMES: ["Before Christ", "Anno Domini"],
        ERAS: ["BC", "AD"],
        FIRSTDAYOFWEEK: 6,
        MONTH: "January February March April May June July August September October November December".split(" "),
        SHORTDAY: "Sun Mon Tue Wed Thu Fri Sat".split(" "),
        SHORTMONTH: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
        STANDALONEMONTH: "January February March April May June July August September October November December".split(" "),
        WEEKENDRANGE: [5, 6],
        fullDate: "EEEE, MMMM d, y",
        longDate: "MMMM d, y",
        medium: "MMM d, y h:mm:ss a",
        mediumDate: "MMM d, y",
        mediumTime: "h:mm:ss a",
        "short": "M/d/yy h:mm a",
        shortDate: "M/d/yy",
        shortTime: "h:mm a"
      },
      NUMBER_FORMATS: {
        CURRENCY_SYM: "$",
        DECIMAL_SEP: ".",
        GROUP_SEP: ",",
        PATTERNS: [{
          gSize: 3,
          lgSize: 3,
          maxFrac: 3,
          minFrac: 0,
          minInt: 1,
          negPre: "-",
          negSuf: "",
          posPre: "",
          posSuf: ""
        }, {
          gSize: 3,
          lgSize: 3,
          maxFrac: 2,
          minFrac: 2,
          minInt: 1,
          negPre: "-\xA4",
          negSuf: "",
          posPre: "\xA4",
          posSuf: ""
        }]
      },
      id: "en-us",
      localeID: "en_US",
      pluralCat: function pluralCat(a, c) {
        var e = a | 0,
            f = c;
        void 0 === f && (f = Math.min(b(a), 3));
        Math.pow(10, f);
        return 1 == e && 0 == f ? "one" : "other";
      }
    });
  }]), F(C.document).ready(function () {
    fe(C.document, Bc);
  }));
})(window);

!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
/**
 * @license AngularJS v1.5.8
 * (c) 2010-2016 Google, Inc. http://angularjs.org
 * License: MIT
 */

(function (window, angular) {
  'use strict';
  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
   *     Any commits to this file should be reviewed with security in mind.  *
   *   Changes to this file can potentially create security vulnerabilities. *
   *          An approval from 2 Core members with history of modifying      *
   *                         this file is required.                          *
   *                                                                         *
   *  Does the change somehow allow for arbitrary javascript to be executed? *
   *    Or allows for someone to change the prototype of built-in objects?   *
   *     Or gives undesired access to variables likes document or window?    *
   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

  var $sanitizeMinErr = angular.$$minErr('$sanitize');
  var bind;
  var extend;
  var forEach;
  var isDefined;
  var lowercase;
  var noop;
  var htmlParser;
  var htmlSanitizeWriter;
  /**
   * @ngdoc module
   * @name ngSanitize
   * @description
   *
   * # ngSanitize
   *
   * The `ngSanitize` module provides functionality to sanitize HTML.
   *
   *
   * <div doc-module-components="ngSanitize"></div>
   *
   * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
   */

  /**
   * @ngdoc service
   * @name $sanitize
   * @kind function
   *
   * @description
   *   Sanitizes an html string by stripping all potentially dangerous tokens.
   *
   *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
   *   then serialized back to properly escaped html string. This means that no unsafe input can make
   *   it into the returned string.
   *
   *   The whitelist for URL sanitization of attribute values is configured using the functions
   *   `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
  *   `$compileProvider`}.
   *
   *   The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
   *
   * @param {string} html HTML input.
   * @returns {string} Sanitized HTML.
   *
   * @example
   <example module="sanitizeExample" deps="angular-sanitize.js">
   <file name="index.html">
   <script>
   angular.module('sanitizeExample', ['ngSanitize'])
   .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
           $scope.snippet =
             '<p style="color:blue">an html\n' +
             '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
             'snippet</p>';
           $scope.deliberatelyTrustDangerousSnippet = function() {
             return $sce.trustAsHtml($scope.snippet);
           };
         }]);
   </script>
   <div ng-controller="ExampleController">
   Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
   <table>
   <tr>
   <td>Directive</td>
   <td>How</td>
   <td>Source</td>
   <td>Rendered</td>
   </tr>
   <tr id="bind-html-with-sanitize">
   <td>ng-bind-html</td>
   <td>Automatically uses $sanitize</td>
   <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
   <td><div ng-bind-html="snippet"></div></td>
   </tr>
   <tr id="bind-html-with-trust">
   <td>ng-bind-html</td>
   <td>Bypass $sanitize by explicitly trusting the dangerous value</td>
   <td>
   <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
   &lt;/div&gt;</pre>
   </td>
   <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
   </tr>
   <tr id="bind-default">
   <td>ng-bind</td>
   <td>Automatically escapes</td>
   <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
   <td><div ng-bind="snippet"></div></td>
   </tr>
   </table>
   </div>
   </file>
   <file name="protractor.js" type="protractor">
   it('should sanitize the html snippet by default', function() {
     expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
       toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
   });
    it('should inline raw snippet if bound to a trusted value', function() {
     expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
       toBe("<p style=\"color:blue\">an html\n" +
            "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
            "snippet</p>");
   });
    it('should escape snippet without any filter', function() {
     expect(element(by.css('#bind-default div')).getInnerHtml()).
       toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
            "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
            "snippet&lt;/p&gt;");
   });
    it('should update', function() {
     element(by.model('snippet')).clear();
     element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
     expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
       toBe('new <b>text</b>');
     expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
       'new <b onclick="alert(1)">text</b>');
     expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
       "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
   });
   </file>
   </example>
   */

  /**
   * @ngdoc provider
   * @name $sanitizeProvider
   *
   * @description
   * Creates and configures {@link $sanitize} instance.
   */

  function $SanitizeProvider() {
    var svgEnabled = false;
    this.$get = ['$$sanitizeUri', function ($$sanitizeUri) {
      if (svgEnabled) {
        extend(validElements, svgElements);
      }

      return function (html) {
        var buf = [];
        htmlParser(html, htmlSanitizeWriter(buf, function (uri, isImage) {
          return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
        }));
        return buf.join('');
      };
    }];
    /**
     * @ngdoc method
     * @name $sanitizeProvider#enableSvg
     * @kind function
     *
     * @description
     * Enables a subset of svg to be supported by the sanitizer.
     *
     * <div class="alert alert-warning">
     *   <p>By enabling this setting without taking other precautions, you might expose your
     *   application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
     *   outside of the containing element and be rendered over other elements on the page (e.g. a login
     *   link). Such behavior can then result in phishing incidents.</p>
     *
     *   <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
     *   tags within the sanitized content:</p>
     *
     *   <br>
     *
     *   <pre><code>
     *   .rootOfTheIncludedContent svg {
    *     overflow: hidden !important;
    *   }
     *   </code></pre>
     * </div>
     *
     * @param {boolean=} flag Enable or disable SVG support in the sanitizer.
     * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
     *    without an argument or self for chaining otherwise.
     */

    this.enableSvg = function (enableSvg) {
      if (isDefined(enableSvg)) {
        svgEnabled = enableSvg;
        return this;
      } else {
        return svgEnabled;
      }
    }; //////////////////////////////////////////////////////////////////////////////////////////////////
    // Private stuff
    //////////////////////////////////////////////////////////////////////////////////////////////////


    bind = angular.bind;
    extend = angular.extend;
    forEach = angular.forEach;
    isDefined = angular.isDefined;
    lowercase = angular.lowercase;
    noop = angular.noop;
    htmlParser = htmlParserImpl;
    htmlSanitizeWriter = htmlSanitizeWriterImpl; // Regular Expressions for parsing tags and attributes

    var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
        // Match everything outside of normal chars and " (quote character)
    NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; // Good source of info about elements and attributes
    // http://dev.w3.org/html5/spec/Overview.html#semantics
    // http://simon.html5.org/html-elements
    // Safe Void Elements - HTML5
    // http://dev.w3.org/html5/spec/Overview.html#void-elements

    var voidElements = toMap("area,br,col,hr,img,wbr"); // Elements that you can, intentionally, leave open (and which close themselves)
    // http://dev.w3.org/html5/spec/Overview.html#optional-tags

    var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
        optionalEndTagInlineElements = toMap("rp,rt"),
        optionalEndTagElements = extend({}, optionalEndTagInlineElements, optionalEndTagBlockElements); // Safe Block Elements - HTML5

    var blockElements = extend({}, optionalEndTagBlockElements, toMap("address,article," + "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," + "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")); // Inline Elements - HTML5

    var inlineElements = extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," + "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," + "samp,small,span,strike,strong,sub,sup,time,tt,u,var")); // SVG Elements
    // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
    // Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
    // They can potentially allow for arbitrary javascript to be executed. See #11290

    var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," + "hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," + "radialGradient,rect,stop,svg,switch,text,title,tspan"); // Blocked Elements (will be stripped)

    var blockedElements = toMap("script,style");
    var validElements = extend({}, voidElements, blockElements, inlineElements, optionalEndTagElements); //Attributes that have href and hence need to be sanitized

    var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
    var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' + 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' + 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' + 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' + 'valign,value,vspace,width'); // SVG attributes (without "id" and "name" attributes)
    // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes

    var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' + 'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' + 'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' + 'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' + 'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' + 'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' + 'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' + 'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' + 'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' + 'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' + 'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' + 'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' + 'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' + 'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' + 'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
    var validAttrs = extend({}, uriAttrs, svgAttrs, htmlAttrs);

    function toMap(str, lowercaseKeys) {
      var obj = {},
          items = str.split(','),
          i;

      for (i = 0; i < items.length; i++) {
        obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
      }

      return obj;
    }

    var inertBodyElement;

    (function (window) {
      var doc;

      if (window.document && window.document.implementation) {
        doc = window.document.implementation.createHTMLDocument("inert");
      } else {
        throw $sanitizeMinErr('noinert', "Can't create an inert html document");
      }

      var docElement = doc.documentElement || doc.getDocumentElement();
      var bodyElements = docElement.getElementsByTagName('body'); // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one

      if (bodyElements.length === 1) {
        inertBodyElement = bodyElements[0];
      } else {
        var html = doc.createElement('html');
        inertBodyElement = doc.createElement('body');
        html.appendChild(inertBodyElement);
        doc.appendChild(html);
      }
    })(window);
    /**
     * @example
     * htmlParser(htmlString, {
    *     start: function(tag, attrs) {},
    *     end: function(tag) {},
    *     chars: function(text) {},
    *     comment: function(text) {}
    * });
     *
     * @param {string} html string
     * @param {object} handler
     */


    function htmlParserImpl(html, handler) {
      if (html === null || html === undefined) {
        html = '';
      } else if (typeof html !== 'string') {
        html = '' + html;
      }

      inertBodyElement.innerHTML = html; //mXSS protection

      var mXSSAttempts = 5;

      do {
        if (mXSSAttempts === 0) {
          throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
        }

        mXSSAttempts--; // strip custom-namespaced attributes on IE<=11

        if (window.document.documentMode) {
          stripCustomNsAttrs(inertBodyElement);
        }

        html = inertBodyElement.innerHTML; //trigger mXSS

        inertBodyElement.innerHTML = html;
      } while (html !== inertBodyElement.innerHTML);

      var node = inertBodyElement.firstChild;

      while (node) {
        switch (node.nodeType) {
          case 1:
            // ELEMENT_NODE
            handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
            break;

          case 3:
            // TEXT NODE
            handler.chars(node.textContent);
            break;
        }

        var nextNode;

        if (!(nextNode = node.firstChild)) {
          if (node.nodeType == 1) {
            handler.end(node.nodeName.toLowerCase());
          }

          nextNode = node.nextSibling;

          if (!nextNode) {
            while (nextNode == null) {
              node = node.parentNode;
              if (node === inertBodyElement) break;
              nextNode = node.nextSibling;

              if (node.nodeType == 1) {
                handler.end(node.nodeName.toLowerCase());
              }
            }
          }
        }

        node = nextNode;
      }

      while (node = inertBodyElement.firstChild) {
        inertBodyElement.removeChild(node);
      }
    }

    function attrToMap(attrs) {
      var map = {};

      for (var i = 0, ii = attrs.length; i < ii; i++) {
        var attr = attrs[i];
        map[attr.name] = attr.value;
      }

      return map;
    }
    /**
     * Escapes all potentially dangerous characters, so that the
     * resulting string can be safely inserted into attribute or
     * element text.
     * @param value
     * @returns {string} escaped text
     */


    function encodeEntities(value) {
      return value.replace(/&/g, '&amp;').replace(SURROGATE_PAIR_REGEXP, function (value) {
        var hi = value.charCodeAt(0);
        var low = value.charCodeAt(1);
        return '&#' + ((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000) + ';';
      }).replace(NON_ALPHANUMERIC_REGEXP, function (value) {
        return '&#' + value.charCodeAt(0) + ';';
      }).replace(/</g, '&lt;').replace(/>/g, '&gt;');
    }
    /**
     * create an HTML/XML writer which writes to buffer
     * @param {Array} buf use buf.join('') to get out sanitized html string
     * @returns {object} in the form of {
    *     start: function(tag, attrs) {},
    *     end: function(tag) {},
    *     chars: function(text) {},
    *     comment: function(text) {}
    * }
     */


    function htmlSanitizeWriterImpl(buf, uriValidator) {
      var ignoreCurrentElement = false;
      var out = bind(buf, buf.push);
      return {
        start: function start(tag, attrs) {
          tag = lowercase(tag);

          if (!ignoreCurrentElement && blockedElements[tag]) {
            ignoreCurrentElement = tag;
          }

          if (!ignoreCurrentElement && validElements[tag] === true) {
            out('<');
            out(tag);
            forEach(attrs, function (value, key) {
              var lkey = lowercase(key);
              var isImage = tag === 'img' && lkey === 'src' || lkey === 'background';

              if (validAttrs[lkey] === true && (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
                out(' ');
                out(key);
                out('="');
                out(encodeEntities(value));
                out('"');
              }
            });
            out('>');
          }
        },
        end: function end(tag) {
          tag = lowercase(tag);

          if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
            out('</');
            out(tag);
            out('>');
          }

          if (tag == ignoreCurrentElement) {
            ignoreCurrentElement = false;
          }
        },
        chars: function chars(_chars) {
          if (!ignoreCurrentElement) {
            out(encodeEntities(_chars));
          }
        }
      };
    }
    /**
     * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
     * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
     * to allow any of these custom attributes. This method strips them all.
     *
     * @param node Root element to process
     */


    function stripCustomNsAttrs(node) {
      if (node.nodeType === window.Node.ELEMENT_NODE) {
        var attrs = node.attributes;

        for (var i = 0, l = attrs.length; i < l; i++) {
          var attrNode = attrs[i];
          var attrName = attrNode.name.toLowerCase();

          if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
            node.removeAttributeNode(attrNode);
            i--;
            l--;
          }
        }
      }

      var nextNode = node.firstChild;

      if (nextNode) {
        stripCustomNsAttrs(nextNode);
      }

      nextNode = node.nextSibling;

      if (nextNode) {
        stripCustomNsAttrs(nextNode);
      }
    }
  }

  function sanitizeText(chars) {
    var buf = [];
    var writer = htmlSanitizeWriter(buf, noop);
    writer.chars(chars);
    return buf.join('');
  } // define ngSanitize module and register $sanitize service


  angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
  /**
   * @ngdoc filter
   * @name linky
   * @kind function
   *
   * @description
   * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
   * plain email address links.
   *
   * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
   *
   * @param {string} text Input text.
   * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
   * @param {object|function(url)} [attributes] Add custom attributes to the link element.
   *
   *    Can be one of:
   *
   *    - `object`: A map of attributes
   *    - `function`: Takes the url as a parameter and returns a map of attributes
   *
   *    If the map of attributes contains a value for `target`, it overrides the value of
   *    the target parameter.
   *
   *
   * @returns {string} Html-linkified and {@link $sanitize sanitized} text.
   *
   * @usage
   <span ng-bind-html="linky_expression | linky"></span>
   *
   * @example
   <example module="linkyExample" deps="angular-sanitize.js">
   <file name="index.html">
   <div ng-controller="ExampleController">
   Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
   <table>
   <tr>
   <th>Filter</th>
   <th>Source</th>
   <th>Rendered</th>
   </tr>
   <tr id="linky-filter">
   <td>linky filter</td>
   <td>
   <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre>
   </td>
   <td>
   <div ng-bind-html="snippet | linky"></div>
   </td>
   </tr>
   <tr id="linky-target">
   <td>linky target</td>
   <td>
   <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre>
   </td>
   <td>
   <div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
   </td>
   </tr>
   <tr id="linky-custom-attributes">
   <td>linky custom attributes</td>
   <td>
   <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"&gt;<br>&lt;/div&gt;</pre>
   </td>
   <td>
   <div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
   </td>
   </tr>
   <tr id="escaped-html">
   <td>no filter</td>
   <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td>
   <td><div ng-bind="snippet"></div></td>
   </tr>
   </table>
   </file>
   <file name="script.js">
   angular.module('linkyExample', ['ngSanitize'])
   .controller('ExampleController', ['$scope', function($scope) {
         $scope.snippet =
           'Pretty text with some links:\n'+
           'http://angularjs.org/,\n'+
           'mailto:us@somewhere.org,\n'+
           'another@somewhere.org,\n'+
           'and one more: ftp://127.0.0.1/.';
         $scope.snippetWithSingleURL = 'http://angularjs.org/';
       }]);
   </file>
   <file name="protractor.js" type="protractor">
   it('should linkify the snippet with urls', function() {
       expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
           toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
                'another@somewhere.org, and one more: ftp://127.0.0.1/.');
       expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
     });
    it('should not linkify snippet without the linky filter', function() {
       expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
           toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
                'another@somewhere.org, and one more: ftp://127.0.0.1/.');
       expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
     });
    it('should update', function() {
       element(by.model('snippet')).clear();
       element(by.model('snippet')).sendKeys('new http://link.');
       expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
           toBe('new http://link.');
       expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
       expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
           .toBe('new http://link.');
     });
    it('should work with the target property', function() {
      expect(element(by.id('linky-target')).
          element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
          toBe('http://angularjs.org/');
      expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
     });
    it('should optionally add custom attributes', function() {
      expect(element(by.id('linky-custom-attributes')).
          element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
          toBe('http://angularjs.org/');
      expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
     });
   </file>
   </example>
   */

  angular.module('ngSanitize').filter('linky', ['$sanitize', function ($sanitize) {
    var LINKY_URL_REGEXP = /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
        MAILTO_REGEXP = /^mailto:/i;
    var linkyMinErr = angular.$$minErr('linky');
    var isDefined = angular.isDefined;
    var isFunction = angular.isFunction;
    var isObject = angular.isObject;
    var isString = angular.isString;
    return function (text, target, attributes) {
      if (text == null || text === '') return text;
      if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
      var attributesFn = isFunction(attributes) ? attributes : isObject(attributes) ? function getAttributesObject() {
        return attributes;
      } : function getEmptyAttributesObject() {
        return {};
      };
      var match;
      var raw = text;
      var html = [];
      var url;
      var i;

      while (match = raw.match(LINKY_URL_REGEXP)) {
        // We can not end in these as they are sometimes found at the end of the sentence
        url = match[0]; // if we did not match ftp/http/www/mailto then assume mailto

        if (!match[2] && !match[4]) {
          url = (match[3] ? 'http://' : 'mailto:') + url;
        }

        i = match.index;
        addText(raw.substr(0, i));
        addLink(url, match[0].replace(MAILTO_REGEXP, ''));
        raw = raw.substring(i + match[0].length);
      }

      addText(raw);
      return $sanitize(html.join(''));

      function addText(text) {
        if (!text) {
          return;
        }

        html.push(sanitizeText(text));
      }

      function addLink(url, text) {
        var key,
            linkAttributes = attributesFn(url);
        html.push('<a ');

        for (key in linkAttributes) {
          html.push(key + '="' + linkAttributes[key] + '" ');
        }

        if (isDefined(target) && !('target' in linkAttributes)) {
          html.push('target="', target, '" ');
        }

        html.push('href="', url.replace(/"/g, '&quot;'), '">');
        addText(text);
        html.push('</a>');
      }
    };
  }]);
})(window, window.angular);
/*! 12.0.4 */


!function () {
  function a(a, b) {
    window.XMLHttpRequest.prototype[a] = b(window.XMLHttpRequest.prototype[a]);
  }

  function b(a, b, c) {
    try {
      Object.defineProperty(a, b, {
        get: c
      });
    } catch (d) {}
  }

  if (window.FileAPI || (window.FileAPI = {}), !window.XMLHttpRequest) throw "AJAX is not supported. XMLHttpRequest is not defined.";

  if (FileAPI.shouldLoad = !window.FormData || FileAPI.forceLoad, FileAPI.shouldLoad) {
    var c = function c(a) {
      if (!a.__listeners) {
        a.upload || (a.upload = {}), a.__listeners = [];
        var b = a.upload.addEventListener;

        a.upload.addEventListener = function (c, d) {
          a.__listeners[c] = d, b && b.apply(this, arguments);
        };
      }
    };

    a("open", function (a) {
      return function (b, d, e) {
        c(this), this.__url = d;

        try {
          a.apply(this, [b, d, e]);
        } catch (f) {
          f.message.indexOf("Access is denied") > -1 && (this.__origError = f, a.apply(this, [b, "_fix_for_ie_crossdomain__", e]));
        }
      };
    }), a("getResponseHeader", function (a) {
      return function (b) {
        return this.__fileApiXHR && this.__fileApiXHR.getResponseHeader ? this.__fileApiXHR.getResponseHeader(b) : null == a ? null : a.apply(this, [b]);
      };
    }), a("getAllResponseHeaders", function (a) {
      return function () {
        return this.__fileApiXHR && this.__fileApiXHR.getAllResponseHeaders ? this.__fileApiXHR.getAllResponseHeaders() : null == a ? null : a.apply(this);
      };
    }), a("abort", function (a) {
      return function () {
        return this.__fileApiXHR && this.__fileApiXHR.abort ? this.__fileApiXHR.abort() : null == a ? null : a.apply(this);
      };
    }), a("setRequestHeader", function (a) {
      return function (b, d) {
        if ("__setXHR_" === b) {
          c(this);
          var e = d(this);
          e instanceof Function && e(this);
        } else this.__requestHeaders = this.__requestHeaders || {}, this.__requestHeaders[b] = d, a.apply(this, arguments);
      };
    }), a("send", function (a) {
      return function () {
        var c = this;

        if (arguments[0] && arguments[0].__isFileAPIShim) {
          var d = arguments[0],
              e = {
            url: c.__url,
            jsonp: !1,
            cache: !0,
            complete: function complete(a, d) {
              a && angular.isString(a) && -1 !== a.indexOf("#2174") && (a = null), c.__completed = !0, !a && c.__listeners.load && c.__listeners.load({
                type: "load",
                loaded: c.__loaded,
                total: c.__total,
                target: c,
                lengthComputable: !0
              }), !a && c.__listeners.loadend && c.__listeners.loadend({
                type: "loadend",
                loaded: c.__loaded,
                total: c.__total,
                target: c,
                lengthComputable: !0
              }), "abort" === a && c.__listeners.abort && c.__listeners.abort({
                type: "abort",
                loaded: c.__loaded,
                total: c.__total,
                target: c,
                lengthComputable: !0
              }), void 0 !== d.status && b(c, "status", function () {
                return 0 === d.status && a && "abort" !== a ? 500 : d.status;
              }), void 0 !== d.statusText && b(c, "statusText", function () {
                return d.statusText;
              }), b(c, "readyState", function () {
                return 4;
              }), void 0 !== d.response && b(c, "response", function () {
                return d.response;
              });
              var e = d.responseText || (a && 0 === d.status && "abort" !== a ? a : void 0);
              b(c, "responseText", function () {
                return e;
              }), b(c, "response", function () {
                return e;
              }), a && b(c, "err", function () {
                return a;
              }), c.__fileApiXHR = d, c.onreadystatechange && c.onreadystatechange(), c.onload && c.onload();
            },
            progress: function progress(a) {
              if (a.target = c, c.__listeners.progress && c.__listeners.progress(a), c.__total = a.total, c.__loaded = a.loaded, a.total === a.loaded) {
                var b = this;
                setTimeout(function () {
                  c.__completed || (c.getAllResponseHeaders = function () {}, b.complete(null, {
                    status: 204,
                    statusText: "No Content"
                  }));
                }, FileAPI.noContentTimeout || 1e4);
              }
            },
            headers: c.__requestHeaders
          };
          e.data = {}, e.files = {};

          for (var f = 0; f < d.data.length; f++) {
            var g = d.data[f];
            null != g.val && null != g.val.name && null != g.val.size && null != g.val.type ? e.files[g.key] = g.val : e.data[g.key] = g.val;
          }

          setTimeout(function () {
            if (!FileAPI.hasFlash) throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';
            c.__fileApiXHR = FileAPI.upload(e);
          }, 1);
        } else {
          if (this.__origError) throw this.__origError;
          a.apply(c, arguments);
        }
      };
    }), window.XMLHttpRequest.__isFileAPIShim = !0, window.FormData = FormData = function FormData() {
      return {
        append: function append(a, b, c) {
          b.__isFileAPIBlobShim && (b = b.data[0]), this.data.push({
            key: a,
            val: b,
            name: c
          });
        },
        data: [],
        __isFileAPIShim: !0
      };
    }, window.Blob = Blob = function Blob(a) {
      return {
        data: a,
        __isFileAPIBlobShim: !0
      };
    };
  }
}(), function () {
  function a(a) {
    return "input" === a[0].tagName.toLowerCase() && a.attr("type") && "file" === a.attr("type").toLowerCase();
  }

  function b() {
    try {
      var a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
      if (a) return !0;
    } catch (b) {
      if (void 0 !== navigator.mimeTypes["application/x-shockwave-flash"]) return !0;
    }

    return !1;
  }

  function c(a) {
    var b = 0,
        c = 0;
    if (window.jQuery) return jQuery(a).offset();
    if (a.offsetParent) do {
      b += a.offsetLeft - a.scrollLeft, c += a.offsetTop - a.scrollTop, a = a.offsetParent;
    } while (a);
    return {
      left: b,
      top: c
    };
  }

  if (FileAPI.shouldLoad) {
    if (FileAPI.hasFlash = b(), FileAPI.forceLoad && (FileAPI.html5 = !1), !FileAPI.upload) {
      var d,
          e,
          f,
          g,
          h,
          i = document.createElement("script"),
          j = document.getElementsByTagName("script");
      if (window.FileAPI.jsUrl) d = window.FileAPI.jsUrl;else if (window.FileAPI.jsPath) e = window.FileAPI.jsPath;else for (f = 0; f < j.length; f++) {
        if (h = j[f].src, g = h.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/), g > -1) {
          e = h.substring(0, g + 1);
          break;
        }
      }
      null == FileAPI.staticPath && (FileAPI.staticPath = e), i.setAttribute("src", d || e + "FileAPI.min.js"), document.getElementsByTagName("head")[0].appendChild(i);
    }

    FileAPI.ngfFixIE = function (d, e, f) {
      if (!b()) throw 'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';

      var g = function g() {
        var b = e.parent();
        d.attr("disabled") ? b && b.removeClass("js-fileapi-wrapper") : (e.attr("__ngf_flash_") || (e.unbind("change"), e.unbind("click"), e.bind("change", function (a) {
          h.apply(this, [a]), f.apply(this, [a]);
        }), e.attr("__ngf_flash_", "true")), b.addClass("js-fileapi-wrapper"), a(d) || (b.css("position", "absolute").css("top", c(d[0]).top + "px").css("left", c(d[0]).left + "px").css("width", d[0].offsetWidth + "px").css("height", d[0].offsetHeight + "px").css("filter", "alpha(opacity=0)").css("display", d.css("display")).css("overflow", "hidden").css("z-index", "900000").css("visibility", "visible"), e.css("width", d[0].offsetWidth + "px").css("height", d[0].offsetHeight + "px").css("position", "absolute").css("top", "0px").css("left", "0px")));
      };

      d.bind("mouseenter", g);

      var h = function h(a) {
        for (var b = FileAPI.getFiles(a), c = 0; c < b.length; c++) {
          void 0 === b[c].size && (b[c].size = 0), void 0 === b[c].name && (b[c].name = "file"), void 0 === b[c].type && (b[c].type = "undefined");
        }

        a.target || (a.target = {}), a.target.files = b, a.target.files !== b && (a.__files_ = b), (a.__files_ || a.target.files).item = function (b) {
          return (a.__files_ || a.target.files)[b] || null;
        };
      };
    }, FileAPI.disableFileInput = function (a, b) {
      b ? a.removeClass("js-fileapi-wrapper") : a.addClass("js-fileapi-wrapper");
    };
  }
}(), window.FileReader || (window.FileReader = function () {
  var a = this,
      b = !1;
  this.listeners = {}, this.addEventListener = function (b, c) {
    a.listeners[b] = a.listeners[b] || [], a.listeners[b].push(c);
  }, this.removeEventListener = function (b, c) {
    a.listeners[b] && a.listeners[b].splice(a.listeners[b].indexOf(c), 1);
  }, this.dispatchEvent = function (b) {
    var c = a.listeners[b.type];
    if (c) for (var d = 0; d < c.length; d++) {
      c[d].call(a, b);
    }
  }, this.onabort = this.onerror = this.onload = this.onloadstart = this.onloadend = this.onprogress = null;

  var c = function c(b, _c) {
    var d = {
      type: b,
      target: a,
      loaded: _c.loaded,
      total: _c.total,
      error: _c.error
    };
    return null != _c.result && (d.target.result = _c.result), d;
  },
      d = function d(_d2) {
    b || (b = !0, a.onloadstart && a.onloadstart(c("loadstart", _d2)));
    var e;
    "load" === _d2.type ? (a.onloadend && a.onloadend(c("loadend", _d2)), e = c("load", _d2), a.onload && a.onload(e), a.dispatchEvent(e)) : "progress" === _d2.type ? (e = c("progress", _d2), a.onprogress && a.onprogress(e), a.dispatchEvent(e)) : (e = c("error", _d2), a.onerror && a.onerror(e), a.dispatchEvent(e));
  };

  this.readAsDataURL = function (a) {
    FileAPI.readAsDataURL(a, d);
  }, this.readAsText = function (a) {
    FileAPI.readAsText(a, d);
  };
}), !window.XMLHttpRequest || window.FileAPI && FileAPI.shouldLoad || (window.XMLHttpRequest.prototype.setRequestHeader = function (a) {
  return function (b, c) {
    if ("__setXHR_" === b) {
      var d = c(this);
      d instanceof Function && d(this);
    } else a.apply(this, arguments);
  };
}(window.XMLHttpRequest.prototype.setRequestHeader));
var ngFileUpload = angular.module("ngFileUpload", []);
ngFileUpload.version = "12.0.4", ngFileUpload.service("UploadBase", ["$http", "$q", "$timeout", function (a, b, c) {
  function d(d) {
    function e(a) {
      j.notify && j.notify(a), k.progressFunc && c(function () {
        k.progressFunc(a);
      });
    }

    function h(a) {
      return null != d._start && g ? {
        loaded: a.loaded + d._start,
        total: d._file && d._file.size || a.total,
        type: a.type,
        config: d,
        lengthComputable: !0,
        target: a.target
      } : a;
    }

    function i() {
      a(d).then(function (a) {
        g && d._chunkSize && !d._finished && d._file ? (e({
          loaded: d._end,
          total: d._file && d._file.size,
          config: d,
          type: "progress"
        }), f.upload(d, !0)) : (d._finished && delete d._finished, j.resolve(a));
      }, function (a) {
        j.reject(a);
      }, function (a) {
        j.notify(a);
      });
    }

    d.method = d.method || "POST", d.headers = d.headers || {};
    var j = d._deferred = d._deferred || b.defer(),
        k = j.promise;
    return d.disableProgress || (d.headers.__setXHR_ = function () {
      return function (a) {
        a && a.upload && a.upload.addEventListener && (d.__XHR = a, d.xhrFn && d.xhrFn(a), a.upload.addEventListener("progress", function (a) {
          a.config = d, e(h(a));
        }, !1), a.upload.addEventListener("load", function (a) {
          a.lengthComputable && (a.config = d, e(h(a)));
        }, !1));
      };
    }), g ? d._chunkSize && d._end && !d._finished ? (d._start = d._end, d._end += d._chunkSize, i()) : d.resumeSizeUrl ? a.get(d.resumeSizeUrl).then(function (a) {
      d._start = d.resumeSizeResponseReader ? d.resumeSizeResponseReader(a.data) : parseInt((null == a.data.size ? a.data : a.data.size).toString()), d._chunkSize && (d._end = d._start + d._chunkSize), i();
    }, function (a) {
      throw a;
    }) : d.resumeSize ? d.resumeSize().then(function (a) {
      d._start = a, i();
    }, function (a) {
      throw a;
    }) : (d._chunkSize && (d._start = 0, d._end = d._start + d._chunkSize), i()) : i(), k.success = function (a) {
      return k.then(function (b) {
        a(b.data, b.status, b.headers, d);
      }), k;
    }, k.error = function (a) {
      return k.then(null, function (b) {
        a(b.data, b.status, b.headers, d);
      }), k;
    }, k.progress = function (a) {
      return k.progressFunc = a, k.then(null, null, function (b) {
        a(b);
      }), k;
    }, k.abort = k.pause = function () {
      return d.__XHR && c(function () {
        d.__XHR.abort();
      }), k;
    }, k.xhr = function (a) {
      return d.xhrFn = function (b) {
        return function () {
          b && b.apply(k, arguments), a.apply(k, arguments);
        };
      }(d.xhrFn), k;
    }, f.promisesCount++, k["finally"](function () {
      f.promisesCount--;
    }), k;
  }

  function e(a) {
    var b = {};

    for (var c in a) {
      a.hasOwnProperty(c) && (b[c] = a[c]);
    }

    return b;
  }

  var f = this;
  f.promisesCount = 0, this.isResumeSupported = function () {
    return window.Blob && window.Blob.prototype.slice;
  };
  var g = this.isResumeSupported();
  this.isUploadInProgress = function () {
    return f.promisesCount > 0;
  }, this.rename = function (a, b) {
    return a.ngfName = b, a;
  }, this.jsonBlob = function (a) {
    null == a || angular.isString(a) || (a = JSON.stringify(a));
    var b = new window.Blob([a], {
      type: "application/json"
    });
    return b._ngfBlob = !0, b;
  }, this.json = function (a) {
    return angular.toJson(a);
  }, this.isFile = function (a) {
    return null != a && (a instanceof window.Blob || a.flashId && a.name && a.size);
  }, this.upload = function (a, b) {
    function c(b, c) {
      if (b._ngfBlob) return b;

      if (a._file = a._file || b, null != a._start && g) {
        a._end && a._end >= b.size && (a._finished = !0, a._end = b.size);
        var d = b.slice(a._start, a._end || b.size);
        return d.name = b.name, d.ngfName = b.ngfName, a._chunkSize && (c.append("_chunkSize", a._chunkSize), c.append("_currentChunkSize", a._end - a._start), c.append("_chunkNumber", Math.floor(a._start / a._chunkSize)), c.append("_totalSize", a._file.size)), d;
      }

      return b;
    }

    function h(b, d, e) {
      if (void 0 !== d) if (angular.isDate(d) && (d = d.toISOString()), angular.isString(d)) b.append(e, d);else if (f.isFile(d)) {
        var g = c(d, b),
            i = e.split(",");
        i[1] && (g.ngfName = i[1].replace(/^\s+|\s+$/g, ""), e = i[0]), a._fileKey = a._fileKey || e, b.append(e, g, g.ngfName || g.name);
      } else if (angular.isObject(d)) {
        if (d.$$ngfCircularDetection) throw "ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: " + e;
        d.$$ngfCircularDetection = !0;

        try {
          for (var j in d) {
            if (d.hasOwnProperty(j) && "$$ngfCircularDetection" !== j) {
              var k = null == a.objectKey ? "[i]" : a.objectKey;
              d.length && parseInt(j) > -1 && (k = null == a.arrayKey ? k : a.arrayKey), h(b, d[j], e + k.replace(/[ik]/g, j));
            }
          }
        } finally {
          delete d.$$ngfCircularDetection;
        }
      } else b.append(e, d);
    }

    function i() {
      a._chunkSize = f.translateScalars(a.resumeChunkSize), a._chunkSize = a._chunkSize ? parseInt(a._chunkSize.toString()) : null, a.headers = a.headers || {}, a.headers["Content-Type"] = void 0, a.transformRequest = a.transformRequest ? angular.isArray(a.transformRequest) ? a.transformRequest : [a.transformRequest] : [], a.transformRequest.push(function (b) {
        var c,
            d = new window.FormData();
        b = b || a.fields || {}, a.file && (b.file = a.file);

        for (c in b) {
          if (b.hasOwnProperty(c)) {
            var e = b[c];
            a.formDataAppender ? a.formDataAppender(d, c, e) : h(d, e, c);
          }
        }

        return d;
      });
    }

    return b || (a = e(a)), a._isDigested || (a._isDigested = !0, i()), d(a);
  }, this.http = function (b) {
    return b = e(b), b.transformRequest = b.transformRequest || function (b) {
      return window.ArrayBuffer && b instanceof window.ArrayBuffer || b instanceof window.Blob ? b : a.defaults.transformRequest[0].apply(this, arguments);
    }, b._chunkSize = f.translateScalars(b.resumeChunkSize), b._chunkSize = b._chunkSize ? parseInt(b._chunkSize.toString()) : null, d(b);
  }, this.translateScalars = function (a) {
    if (angular.isString(a)) {
      if (a.search(/kb/i) === a.length - 2) return parseFloat(1024 * a.substring(0, a.length - 2));
      if (a.search(/mb/i) === a.length - 2) return parseFloat(1048576 * a.substring(0, a.length - 2));
      if (a.search(/gb/i) === a.length - 2) return parseFloat(1073741824 * a.substring(0, a.length - 2));
      if (a.search(/b/i) === a.length - 1) return parseFloat(a.substring(0, a.length - 1));
      if (a.search(/s/i) === a.length - 1) return parseFloat(a.substring(0, a.length - 1));
      if (a.search(/m/i) === a.length - 1) return parseFloat(60 * a.substring(0, a.length - 1));
      if (a.search(/h/i) === a.length - 1) return parseFloat(3600 * a.substring(0, a.length - 1));
    }

    return a;
  }, this.urlToBlob = function (c) {
    var d = b.defer();
    return a({
      url: c,
      method: "get",
      responseType: "arraybuffer"
    }).then(function (a) {
      var b = new Uint8Array(a.data),
          c = a.headers("content-type") || "image/WebP",
          e = new window.Blob([b], {
        type: c
      });
      d.resolve(e);
    }, function (a) {
      d.reject(a);
    }), d.promise;
  }, this.setDefaults = function (a) {
    this.defaults = a || {};
  }, this.defaults = {}, this.version = ngFileUpload.version;
}]), ngFileUpload.service("Upload", ["$parse", "$timeout", "$compile", "$q", "UploadExif", function (a, b, c, d, e) {
  function f(a, b, c) {
    var e = [i.emptyPromise()];
    return angular.forEach(a, function (d, f) {
      0 === d.type.indexOf("image/jpeg") && i.attrGetter("ngfFixOrientation", b, c, {
        $file: d
      }) && e.push(i.happyPromise(i.applyExifRotation(d), d).then(function (b) {
        a.splice(f, 1, b);
      }));
    }), d.all(e);
  }

  function g(a, b, c) {
    var e = i.attrGetter("ngfResize", b, c);
    if (!e || !i.isResizeSupported() || !a.length) return i.emptyPromise();
    if (!(e instanceof Function)) return h(e, a, b, c);
    var f = d.defer();
    e(a).then(function (d) {
      h(d, a, b, c).then(function (a) {
        f.resolve(a);
      }, function (a) {
        f.reject(a);
      });
    }, function (a) {
      f.reject(a);
    });
  }

  function h(a, b, c, e) {
    function f(d, f) {
      if (0 === d.type.indexOf("image")) {
        if (a.pattern && !i.validatePattern(d, a.pattern)) return;
        var h = i.resize(d, a.width, a.height, a.quality, a.type, a.ratio, a.centerCrop, function (a, b) {
          return i.attrGetter("ngfResizeIf", c, e, {
            $width: a,
            $height: b,
            $file: d
          });
        }, a.restoreExif !== !1);
        g.push(h), h.then(function (a) {
          b.splice(f, 1, a);
        }, function (a) {
          d.$error = "resize", d.$errorParam = (a ? (a.message ? a.message : a) + ": " : "") + (d && d.name);
        });
      }
    }

    for (var g = [i.emptyPromise()], h = 0; h < b.length; h++) {
      f(b[h], h);
    }

    return d.all(g);
  }

  var i = e;
  return i.getAttrWithDefaults = function (a, b) {
    if (null != a[b]) return a[b];
    var c = i.defaults[b];
    return null == c ? c : angular.isString(c) ? c : JSON.stringify(c);
  }, i.attrGetter = function (b, c, d, e) {
    var f = this.getAttrWithDefaults(c, b);
    if (!d) return f;

    try {
      return e ? a(f)(d, e) : a(f)(d);
    } catch (g) {
      if (b.search(/min|max|pattern/i)) return f;
      throw g;
    }
  }, i.shouldUpdateOn = function (a, b, c) {
    var d = i.attrGetter("ngModelOptions", b, c);
    return d && d.updateOn ? d.updateOn.split(" ").indexOf(a) > -1 : !0;
  }, i.emptyPromise = function () {
    var a = d.defer(),
        c = arguments;
    return b(function () {
      a.resolve.apply(a, c);
    }), a.promise;
  }, i.rejectPromise = function () {
    var a = d.defer(),
        c = arguments;
    return b(function () {
      a.reject.apply(a, c);
    }), a.promise;
  }, i.happyPromise = function (a, c) {
    var e = d.defer();
    return a.then(function (a) {
      e.resolve(a);
    }, function (a) {
      b(function () {
        throw a;
      }), e.resolve(c);
    }), e.promise;
  }, i.updateModel = function (c, d, e, h, j, k, l) {
    function m(f, g, j, l, m) {
      d.$$ngfPrevValidFiles = f, d.$$ngfPrevInvalidFiles = g;
      var n = f && f.length ? f[0] : null,
          o = g && g.length ? g[0] : null;
      c && (i.applyModelValidation(c, f), c.$setViewValue(m ? n : f)), h && a(h)(e, {
        $files: f,
        $file: n,
        $newFiles: j,
        $duplicateFiles: l,
        $invalidFiles: g,
        $invalidFile: o,
        $event: k
      });
      var p = i.attrGetter("ngfModelInvalid", d);
      p && b(function () {
        a(p).assign(e, m ? o : g);
      }), b(function () {});
    }

    function n() {
      function a(a, b) {
        return a.name === b.name && (a.$ngfOrigSize || a.size) === (b.$ngfOrigSize || b.size) && a.type === b.type;
      }

      function b(b) {
        var c;

        for (c = 0; c < s.length; c++) {
          if (a(b, s[c])) return !0;
        }

        for (c = 0; c < t.length; c++) {
          if (a(b, t[c])) return !0;
        }

        return !1;
      }

      if (j) {
        r = [], u = [];

        for (var c = 0; c < j.length; c++) {
          b(j[c]) ? u.push(j[c]) : r.push(j[c]);
        }
      }
    }

    function o(a) {
      return angular.isArray(a) ? a : [a];
    }

    function p() {
      w = [], v = [], angular.forEach(r, function (a) {
        a.$error ? v.push(a) : w.push(a);
      });
    }

    function q() {
      function a() {
        b(function () {
          m(x ? s.concat(w) : w, x ? t.concat(v) : v, j, u, y);
        }, A && A.debounce ? A.debounce.change || A.debounce : 0);
      }

      g(z ? r : w, d, e).then(function () {
        z ? i.validate(r, s.length, c, d, e).then(function () {
          p(), a();
        }) : a();
      }, function (a) {
        throw "Could not resize files " + a;
      });
    }

    var r,
        s,
        t,
        u = [],
        v = [],
        w = [];
    s = d.$$ngfPrevValidFiles || [], t = d.$$ngfPrevInvalidFiles || [], c && c.$modelValue && (s = o(c.$modelValue));
    var x = i.attrGetter("ngfKeep", d, e);
    r = (j || []).slice(0), ("distinct" === x || i.attrGetter("ngfKeepDistinct", d, e) === !0) && n(d, e);
    var y = !x && !i.attrGetter("ngfMultiple", d, e) && !i.attrGetter("multiple", d);

    if (!x || r.length) {
      i.attrGetter("ngfBeforeModelChange", d, e, {
        $files: j,
        $file: j && j.length ? j[0] : null,
        $newFiles: r,
        $duplicateFiles: u,
        $event: k
      });
      var z = i.attrGetter("ngfValidateAfterResize", d, e),
          A = i.attrGetter("ngModelOptions", d, e);
      i.validate(r, s.length, c, d, e).then(function () {
        l ? m(r, [], j, u, y) : (A && A.allowInvalid || z ? w = r : p(), i.attrGetter("ngfFixOrientation", d, e) && i.isExifSupported() ? f(w, d, e).then(function () {
          q();
        }) : q());
      });
    }
  }, i;
}]), ngFileUpload.directive("ngfSelect", ["$parse", "$timeout", "$compile", "Upload", function (a, b, c, d) {
  function e(a) {
    var b = a.match(/Android[^\d]*(\d+)\.(\d+)/);

    if (b && b.length > 2) {
      var c = d.defaults.androidFixMinorVersion || 4;
      return parseInt(b[1]) < 4 || parseInt(b[1]) === c && parseInt(b[2]) < c;
    }

    return -1 === a.indexOf("Chrome") && /.*Windows.*Safari.*/.test(a);
  }

  function f(a, b, c, d, f, h, i, j) {
    function k() {
      return "input" === b[0].tagName.toLowerCase() && c.type && "file" === c.type.toLowerCase();
    }

    function l() {
      return t("ngfChange") || t("ngfSelect");
    }

    function m(b) {
      if (j.shouldUpdateOn("change", c, a)) {
        for (var e = b.__files_ || b.target && b.target.files, f = [], g = 0; g < e.length; g++) {
          f.push(e[g]);
        }

        j.updateModel(d, c, a, l(), f.length ? f : null, b);
      }
    }

    function n(a) {
      if (b !== a) for (var c = 0; c < b[0].attributes.length; c++) {
        var d = b[0].attributes[c];
        "type" !== d.name && "class" !== d.name && "style" !== d.name && ((null == d.value || "" === d.value) && ("required" === d.name && (d.value = "required"), "multiple" === d.name && (d.value = "multiple")), a.attr(d.name, "id" === d.name ? "ngf-" + d.value : d.value));
      }
    }

    function o() {
      if (k()) return b;
      var a = angular.element('<input type="file">');
      n(a);
      var c = angular.element("<label>upload</label>");
      return c.css("visibility", "hidden").css("position", "absolute").css("overflow", "hidden").css("width", "0px").css("height", "0px").css("border", "none").css("margin", "0px").css("padding", "0px").attr("tabindex", "-1"), g.push({
        el: b,
        ref: c
      }), document.body.appendChild(c.append(a)[0]), a;
    }

    function p(c) {
      if (b.attr("disabled")) return !1;

      if (!t("ngfSelectDisabled", a)) {
        var d = q(c);
        if (null != d) return d;
        r(c);

        try {
          k() || document.body.contains(w[0]) || (g.push({
            el: b,
            ref: w.parent()
          }), document.body.appendChild(w.parent()[0]), w.bind("change", m));
        } catch (f) {}

        return e(navigator.userAgent) ? setTimeout(function () {
          w[0].click();
        }, 0) : w[0].click(), !1;
      }
    }

    function q(a) {
      var b = a.changedTouches || a.originalEvent && a.originalEvent.changedTouches;
      if ("touchstart" === a.type) return v = b ? b[0].clientY : 0, !0;

      if (a.stopPropagation(), a.preventDefault(), "touchend" === a.type) {
        var c = b ? b[0].clientY : 0;
        if (Math.abs(c - v) > 20) return !1;
      }
    }

    function r(b) {
      j.shouldUpdateOn("click", c, a) && w.val() && (w.val(null), j.updateModel(d, c, a, l(), null, b, !0));
    }

    function s(a) {
      if (w && !w.attr("__ngf_ie10_Fix_")) {
        if (!w[0].parentNode) return void (w = null);
        a.preventDefault(), a.stopPropagation(), w.unbind("click");
        var b = w.clone();
        return w.replaceWith(b), w = b, w.attr("__ngf_ie10_Fix_", "true"), w.bind("change", m), w.bind("click", s), w[0].click(), !1;
      }

      w.removeAttr("__ngf_ie10_Fix_");
    }

    var t = function t(a, b) {
      return j.attrGetter(a, c, b);
    };

    j.registerModelChangeValidator(d, c, a);
    var u = [];
    u.push(a.$watch(t("ngfMultiple"), function () {
      w.attr("multiple", t("ngfMultiple", a));
    })), u.push(a.$watch(t("ngfCapture"), function () {
      w.attr("capture", t("ngfCapture", a));
    })), u.push(a.$watch(t("ngfAccept"), function () {
      w.attr("accept", t("ngfAccept", a));
    })), c.$observe("accept", function () {
      w.attr("accept", t("accept"));
    }), u.push(function () {
      c.$$observers && delete c.$$observers.accept;
    });
    var v = 0,
        w = b;
    k() || (w = o()), w.bind("change", m), k() ? b.bind("click", r) : b.bind("click touchstart touchend", p), -1 !== navigator.appVersion.indexOf("MSIE 10") && w.bind("click", s), d && d.$formatters.push(function (a) {
      return (null == a || 0 === a.length) && w.val() && w.val(null), a;
    }), a.$on("$destroy", function () {
      k() || w.parent().remove(), angular.forEach(u, function (a) {
        a();
      });
    }), h(function () {
      for (var a = 0; a < g.length; a++) {
        var b = g[a];
        document.body.contains(b.el[0]) || (g.splice(a, 1), b.ref.remove());
      }
    }), window.FileAPI && window.FileAPI.ngfFixIE && window.FileAPI.ngfFixIE(b, w, m);
  }

  var g = [];
  return {
    restrict: "AEC",
    require: "?ngModel",
    link: function link(e, g, h, i) {
      f(e, g, h, i, a, b, c, d);
    }
  };
}]), function () {
  function a(a) {
    return "img" === a.tagName.toLowerCase() ? "image" : "audio" === a.tagName.toLowerCase() ? "audio" : "video" === a.tagName.toLowerCase() ? "video" : /./;
  }

  function b(b, c, d, e, f, g, h, i) {
    function j(a) {
      var g = b.attrGetter("ngfNoObjectUrl", f, d);
      b.dataUrl(a, g)["finally"](function () {
        c(function () {
          var b = (g ? a.$ngfDataUrl : a.$ngfBlobUrl) || a.$ngfDataUrl;
          i ? e.css("background-image", "url('" + (b || "") + "')") : e.attr("src", b), b ? e.removeClass("ng-hide") : e.addClass("ng-hide");
        });
      });
    }

    c(function () {
      var c = d.$watch(f[g], function (c) {
        var d = h;

        if ("ngfThumbnail" === g && (d || (d = {
          width: e[0].clientWidth,
          height: e[0].clientHeight
        }), 0 === d.width && window.getComputedStyle)) {
          var f = getComputedStyle(e[0]);
          d = {
            width: parseInt(f.width.slice(0, -2)),
            height: parseInt(f.height.slice(0, -2))
          };
        }

        return angular.isString(c) ? (e.removeClass("ng-hide"), i ? e.css("background-image", "url('" + c + "')") : e.attr("src", c)) : void (!c || !c.type || 0 !== c.type.search(a(e[0])) || i && 0 !== c.type.indexOf("image") ? e.addClass("ng-hide") : d && b.isResizeSupported() ? b.resize(c, d.width, d.height, d.quality).then(function (a) {
          j(a);
        }, function (a) {
          throw a;
        }) : j(c));
      });
      d.$on("$destroy", function () {
        c();
      });
    });
  }

  ngFileUpload.service("UploadDataUrl", ["UploadBase", "$timeout", "$q", function (a, b, c) {
    var d = a;
    return d.base64DataUrl = function (a) {
      if (angular.isArray(a)) {
        var b = c.defer(),
            e = 0;
        return angular.forEach(a, function (c) {
          d.dataUrl(c, !0)["finally"](function () {
            if (e++, e === a.length) {
              var c = [];
              angular.forEach(a, function (a) {
                c.push(a.$ngfDataUrl);
              }), b.resolve(c, a);
            }
          });
        }), b.promise;
      }

      return d.dataUrl(a, !0);
    }, d.dataUrl = function (a, e) {
      if (!a) return d.emptyPromise(a, a);
      if (e && null != a.$ngfDataUrl || !e && null != a.$ngfBlobUrl) return d.emptyPromise(e ? a.$ngfDataUrl : a.$ngfBlobUrl, a);
      var f = e ? a.$$ngfDataUrlPromise : a.$$ngfBlobUrlPromise;
      if (f) return f;
      var g = c.defer();
      return b(function () {
        if (window.FileReader && a && (!window.FileAPI || -1 === navigator.userAgent.indexOf("MSIE 8") || a.size < 2e4) && (!window.FileAPI || -1 === navigator.userAgent.indexOf("MSIE 9") || a.size < 4e6)) {
          var c = window.URL || window.webkitURL;

          if (c && c.createObjectURL && !e) {
            var f;

            try {
              f = c.createObjectURL(a);
            } catch (h) {
              return void b(function () {
                a.$ngfBlobUrl = "", g.reject();
              });
            }

            b(function () {
              if (a.$ngfBlobUrl = f, f) {
                g.resolve(f, a), d.blobUrls = d.blobUrls || [], d.blobUrlsTotalSize = d.blobUrlsTotalSize || 0, d.blobUrls.push({
                  url: f,
                  size: a.size
                }), d.blobUrlsTotalSize += a.size || 0;

                for (var b = d.defaults.blobUrlsMaxMemory || 268435456, e = d.defaults.blobUrlsMaxQueueSize || 200; (d.blobUrlsTotalSize > b || d.blobUrls.length > e) && d.blobUrls.length > 1;) {
                  var h = d.blobUrls.splice(0, 1)[0];
                  c.revokeObjectURL(h.url), d.blobUrlsTotalSize -= h.size;
                }
              }
            });
          } else {
            var i = new FileReader();
            i.onload = function (c) {
              b(function () {
                a.$ngfDataUrl = c.target.result, g.resolve(c.target.result, a), b(function () {
                  delete a.$ngfDataUrl;
                }, 1e3);
              });
            }, i.onerror = function () {
              b(function () {
                a.$ngfDataUrl = "", g.reject();
              });
            }, i.readAsDataURL(a);
          }
        } else b(function () {
          a[e ? "$ngfDataUrl" : "$ngfBlobUrl"] = "", g.reject();
        });
      }), f = e ? a.$$ngfDataUrlPromise = g.promise : a.$$ngfBlobUrlPromise = g.promise, f["finally"](function () {
        delete a[e ? "$$ngfDataUrlPromise" : "$$ngfBlobUrlPromise"];
      }), f;
    }, d;
  }]), ngFileUpload.directive("ngfSrc", ["Upload", "$timeout", function (a, c) {
    return {
      restrict: "AE",
      link: function link(d, e, f) {
        b(a, c, d, e, f, "ngfSrc", a.attrGetter("ngfResize", f, d), !1);
      }
    };
  }]), ngFileUpload.directive("ngfBackground", ["Upload", "$timeout", function (a, c) {
    return {
      restrict: "AE",
      link: function link(d, e, f) {
        b(a, c, d, e, f, "ngfBackground", a.attrGetter("ngfResize", f, d), !0);
      }
    };
  }]), ngFileUpload.directive("ngfThumbnail", ["Upload", "$timeout", function (a, c) {
    return {
      restrict: "AE",
      link: function link(d, e, f) {
        var g = a.attrGetter("ngfSize", f, d);
        b(a, c, d, e, f, "ngfThumbnail", g, a.attrGetter("ngfAsBackground", f, d));
      }
    };
  }]), ngFileUpload.config(["$compileProvider", function (a) {
    a.imgSrcSanitizationWhitelist && a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/), a.aHrefSanitizationWhitelist && a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|local|file|data|blob):/);
  }]), ngFileUpload.filter("ngfDataUrl", ["UploadDataUrl", "$sce", function (a, b) {
    return function (c, d, e) {
      if (angular.isString(c)) return b.trustAsResourceUrl(c);
      var f = c && ((d ? c.$ngfDataUrl : c.$ngfBlobUrl) || c.$ngfDataUrl);
      return c && !f ? (!c.$ngfDataUrlFilterInProgress && angular.isObject(c) && (c.$ngfDataUrlFilterInProgress = !0, a.dataUrl(c, d)), "") : (c && delete c.$ngfDataUrlFilterInProgress, (c && f ? e ? b.trustAsResourceUrl(f) : f : c) || "");
    };
  }]);
}(), ngFileUpload.service("UploadValidate", ["UploadDataUrl", "$q", "$timeout", function (a, b, c) {
  function d(a) {
    var b = "",
        c = [];
    if (a.length > 2 && "/" === a[0] && "/" === a[a.length - 1]) b = a.substring(1, a.length - 1);else {
      var e = a.split(",");
      if (e.length > 1) for (var f = 0; f < e.length; f++) {
        var g = d(e[f]);
        g.regexp ? (b += "(" + g.regexp + ")", f < e.length - 1 && (b += "|")) : c = c.concat(g.excludes);
      } else 0 === a.indexOf("!") ? c.push("^((?!" + d(a.substring(1)).regexp + ").)*$") : (0 === a.indexOf(".") && (a = "*" + a), b = "^" + a.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]", "g"), "\\$&") + "$", b = b.replace(/\\\*/g, ".*").replace(/\\\?/g, "."));
    }
    return {
      regexp: b,
      excludes: c
    };
  }

  function e(a, b) {
    null == b || a.$dirty || (a.$setDirty ? a.$setDirty() : a.$dirty = !0);
  }

  var f = a;
  return f.validatePattern = function (a, b) {
    if (!b) return !0;
    var c = d(b),
        e = !0;

    if (c.regexp && c.regexp.length) {
      var f = new RegExp(c.regexp, "i");
      e = null != a.type && f.test(a.type) || null != a.name && f.test(a.name);
    }

    for (var g = c.excludes.length; g--;) {
      var h = new RegExp(c.excludes[g], "i");
      e = e && (null == a.type || h.test(a.type)) && (null == a.name || h.test(a.name));
    }

    return e;
  }, f.ratioToFloat = function (a) {
    var b = a.toString(),
        c = b.search(/[x:]/i);
    return b = c > -1 ? parseFloat(b.substring(0, c)) / parseFloat(b.substring(c + 1)) : parseFloat(b);
  }, f.registerModelChangeValidator = function (a, b, c) {
    a && a.$formatters.push(function (d) {
      a.$dirty && (d && !angular.isArray(d) && (d = [d]), f.validate(d, 0, a, b, c).then(function () {
        f.applyModelValidation(a, d);
      }));
    });
  }, f.applyModelValidation = function (a, b) {
    e(a, b), angular.forEach(a.$ngfValidations, function (b) {
      a.$setValidity(b.name, b.valid);
    });
  }, f.getValidationAttr = function (a, b, c, d, e) {
    var g = "ngf" + c[0].toUpperCase() + c.substr(1),
        h = f.attrGetter(g, a, b, {
      $file: e
    });

    if (null == h && (h = f.attrGetter("ngfValidate", a, b, {
      $file: e
    }))) {
      var i = (d || c).split(".");
      h = h[i[0]], i.length > 1 && (h = h && h[i[1]]);
    }

    return h;
  }, f.validate = function (a, c, d, e, g) {
    function h(b, c, h) {
      if (a) {
        for (var i = a.length, j = null; i--;) {
          var k = a[i];

          if (k) {
            var l = f.getValidationAttr(e, g, b, c, k);
            null != l && (h(k, l, i) || (k.$error = b, (k.$errorMessages = k.$errorMessages || {})[b] = !0, k.$errorParam = l, a.splice(i, 1), j = !1));
          }
        }

        null !== j && d.$ngfValidations.push({
          name: b,
          valid: j
        });
      }
    }

    function i(c, h, i, k, l) {
      function m(a, b, d) {
        null != d ? k(b, d).then(function (e) {
          l(e, d) ? a.resolve() : (b.$error = c, (b.$errorMessages = b.$errorMessages || {})[c] = !0, b.$errorParam = d, a.reject());
        }, function () {
          j("ngfValidateForce", {
            $file: b
          }) ? (b.$error = c, (b.$errorMessages = b.$errorMessages || {})[c] = !0, b.$errorParam = d, a.reject()) : a.resolve();
        }) : a.resolve();
      }

      var n = [f.emptyPromise()];
      return a ? (a = void 0 === a.length ? [a] : a, angular.forEach(a, function (a) {
        var d = b.defer();
        return n.push(d.promise), !i || null != a.type && 0 === a.type.search(i) ? void ("dimensions" === c && null != f.attrGetter("ngfDimensions", e) ? f.imageDimensions(a).then(function (b) {
          m(d, a, j("ngfDimensions", {
            $file: a,
            $width: b.width,
            $height: b.height
          }));
        }, function () {
          d.reject();
        }) : "duration" === c && null != f.attrGetter("ngfDuration", e) ? f.mediaDuration(a).then(function (b) {
          m(d, a, j("ngfDuration", {
            $file: a,
            $duration: b
          }));
        }, function () {
          d.reject();
        }) : m(d, a, f.getValidationAttr(e, g, c, h, a))) : void d.resolve();
      }), b.all(n).then(function () {
        d.$ngfValidations.push({
          name: c,
          valid: !0
        });
      }, function () {
        d.$ngfValidations.push({
          name: c,
          valid: !1
        });
      })) : void 0;
    }

    d = d || {}, d.$ngfValidations = d.$ngfValidations || [], angular.forEach(d.$ngfValidations, function (a) {
      a.valid = !0;
    });

    var j = function j(a, b) {
      return f.attrGetter(a, e, g, b);
    };

    if (null == a || 0 === a.length) return f.emptyPromise(d);
    a = void 0 === a.length ? [a] : a.slice(0), h("maxFiles", null, function (a, b, d) {
      return b > c + d;
    }), h("pattern", null, f.validatePattern), h("minSize", "size.min", function (a, b) {
      return a.size + .1 >= f.translateScalars(b);
    }), h("maxSize", "size.max", function (a, b) {
      return a.size - .1 <= f.translateScalars(b);
    });
    var k = 0;
    if (h("maxTotalSize", null, function (b, c) {
      return k += b.size, k > f.translateScalars(c) ? (a.splice(0, a.length), !1) : !0;
    }), h("validateFn", null, function (a, b) {
      return b === !0 || null === b || "" === b;
    }), !a.length) return f.emptyPromise(d, d.$ngfValidations);
    var l = b.defer(),
        m = [];
    return m.push(f.happyPromise(i("maxHeight", "height.max", /image/, this.imageDimensions, function (a, b) {
      return a.height <= b;
    }))), m.push(f.happyPromise(i("minHeight", "height.min", /image/, this.imageDimensions, function (a, b) {
      return a.height >= b;
    }))), m.push(f.happyPromise(i("maxWidth", "width.max", /image/, this.imageDimensions, function (a, b) {
      return a.width <= b;
    }))), m.push(f.happyPromise(i("minWidth", "width.min", /image/, this.imageDimensions, function (a, b) {
      return a.width >= b;
    }))), m.push(f.happyPromise(i("dimensions", null, /image/, function (a, b) {
      return f.emptyPromise(b);
    }, function (a) {
      return a;
    }))), m.push(f.happyPromise(i("ratio", null, /image/, this.imageDimensions, function (a, b) {
      for (var c = b.toString().split(","), d = !1, e = 0; e < c.length; e++) {
        Math.abs(a.width / a.height - f.ratioToFloat(c[e])) < 1e-4 && (d = !0);
      }

      return d;
    }))), m.push(f.happyPromise(i("maxRatio", "ratio.max", /image/, this.imageDimensions, function (a, b) {
      return a.width / a.height - f.ratioToFloat(b) < 1e-4;
    }))), m.push(f.happyPromise(i("minRatio", "ratio.min", /image/, this.imageDimensions, function (a, b) {
      return a.width / a.height - f.ratioToFloat(b) > -1e-4;
    }))), m.push(f.happyPromise(i("maxDuration", "duration.max", /audio|video/, this.mediaDuration, function (a, b) {
      return a <= f.translateScalars(b);
    }))), m.push(f.happyPromise(i("minDuration", "duration.min", /audio|video/, this.mediaDuration, function (a, b) {
      return a >= f.translateScalars(b);
    }))), m.push(f.happyPromise(i("duration", null, /audio|video/, function (a, b) {
      return f.emptyPromise(b);
    }, function (a) {
      return a;
    }))), m.push(f.happyPromise(i("validateAsyncFn", null, null, function (a, b) {
      return b;
    }, function (a) {
      return a === !0 || null === a || "" === a;
    }))), b.all(m).then(function () {
      l.resolve(d, d.$ngfValidations);
    });
  }, f.imageDimensions = function (a) {
    if (a.$ngfWidth && a.$ngfHeight) {
      var d = b.defer();
      return c(function () {
        d.resolve({
          width: a.$ngfWidth,
          height: a.$ngfHeight
        });
      }), d.promise;
    }

    if (a.$ngfDimensionPromise) return a.$ngfDimensionPromise;
    var e = b.defer();
    return c(function () {
      return 0 !== a.type.indexOf("image") ? void e.reject("not image") : void f.dataUrl(a).then(function (b) {
        function d() {
          var b = h[0].clientWidth,
              c = h[0].clientHeight;
          h.remove(), a.$ngfWidth = b, a.$ngfHeight = c, e.resolve({
            width: b,
            height: c
          });
        }

        function f() {
          h.remove(), e.reject("load error");
        }

        function g() {
          c(function () {
            h[0].parentNode && (h[0].clientWidth ? d() : i > 10 ? f() : g());
          }, 1e3);
        }

        var h = angular.element("<img>").attr("src", b).css("visibility", "hidden").css("position", "fixed").css("max-width", "none !important").css("max-height", "none !important");
        h.on("load", d), h.on("error", f);
        var i = 0;
        g(), angular.element(document.getElementsByTagName("body")[0]).append(h);
      }, function () {
        e.reject("load error");
      });
    }), a.$ngfDimensionPromise = e.promise, a.$ngfDimensionPromise["finally"](function () {
      delete a.$ngfDimensionPromise;
    }), a.$ngfDimensionPromise;
  }, f.mediaDuration = function (a) {
    if (a.$ngfDuration) {
      var d = b.defer();
      return c(function () {
        d.resolve(a.$ngfDuration);
      }), d.promise;
    }

    if (a.$ngfDurationPromise) return a.$ngfDurationPromise;
    var e = b.defer();
    return c(function () {
      return 0 !== a.type.indexOf("audio") && 0 !== a.type.indexOf("video") ? void e.reject("not media") : void f.dataUrl(a).then(function (b) {
        function d() {
          var b = h[0].duration;
          a.$ngfDuration = b, h.remove(), e.resolve(b);
        }

        function f() {
          h.remove(), e.reject("load error");
        }

        function g() {
          c(function () {
            h[0].parentNode && (h[0].duration ? d() : i > 10 ? f() : g());
          }, 1e3);
        }

        var h = angular.element(0 === a.type.indexOf("audio") ? "<audio>" : "<video>").attr("src", b).css("visibility", "none").css("position", "fixed");
        h.on("loadedmetadata", d), h.on("error", f);
        var i = 0;
        g(), angular.element(document.body).append(h);
      }, function () {
        e.reject("load error");
      });
    }), a.$ngfDurationPromise = e.promise, a.$ngfDurationPromise["finally"](function () {
      delete a.$ngfDurationPromise;
    }), a.$ngfDurationPromise;
  }, f;
}]), ngFileUpload.service("UploadResize", ["UploadValidate", "$q", function (a, b) {
  var c = a,
      d = function d(a, b, c, _d3, e) {
    var f = e ? Math.max(c / a, _d3 / b) : Math.min(c / a, _d3 / b);
    return {
      width: a * f,
      height: b * f,
      marginX: a * f - c,
      marginY: b * f - _d3
    };
  },
      e = function e(a, _e3, f, g, h, i, j, k) {
    var l = b.defer(),
        m = document.createElement("canvas"),
        n = document.createElement("img");
    return n.onload = function () {
      if (null != k && k(n.width, n.height) === !1) return void l.reject("resizeIf");

      try {
        if (i) {
          var a = c.ratioToFloat(i),
              b = n.width / n.height;
          a > b ? (_e3 = n.width, f = _e3 / a) : (f = n.height, _e3 = f * a);
        }

        _e3 || (_e3 = n.width), f || (f = n.height);
        var o = d(n.width, n.height, _e3, f, j);
        m.width = Math.min(o.width, _e3), m.height = Math.min(o.height, f);
        var p = m.getContext("2d");
        p.drawImage(n, Math.min(0, -o.marginX / 2), Math.min(0, -o.marginY / 2), o.width, o.height), l.resolve(m.toDataURL(h || "image/WebP", g || .934));
      } catch (q) {
        l.reject(q);
      }
    }, n.onerror = function () {
      l.reject();
    }, n.src = a, l.promise;
  };

  return c.dataUrltoBlob = function (a, b, c) {
    for (var d = a.split(","), e = d[0].match(/:(.*?);/)[1], f = atob(d[1]), g = f.length, h = new Uint8Array(g); g--;) {
      h[g] = f.charCodeAt(g);
    }

    var i = new window.Blob([h], {
      type: e
    });
    return i.name = b, i.$ngfOrigSize = c, i;
  }, c.isResizeSupported = function () {
    var a = document.createElement("canvas");
    return window.atob && a.getContext && a.getContext("2d") && window.Blob;
  }, c.isResizeSupported() && Object.defineProperty(window.Blob.prototype, "name", {
    get: function get() {
      return this.$ngfName;
    },
    set: function set(a) {
      this.$ngfName = a;
    },
    configurable: !0
  }), c.resize = function (a, d, f, g, h, i, j, k, l) {
    if (0 !== a.type.indexOf("image")) return c.emptyPromise(a);
    var m = b.defer();
    return c.dataUrl(a, !0).then(function (b) {
      e(b, d, f, g, h || a.type, i, j, k).then(function (d) {
        if ("image/jpeg" === a.type && l) try {
          d = c.restoreExif(b, d);
        } catch (e) {
          setTimeout(function () {
            throw e;
          }, 1);
        }

        try {
          var f = c.dataUrltoBlob(d, a.name, a.size);
          m.resolve(f);
        } catch (e) {
          m.reject(e);
        }
      }, function (b) {
        "resizeIf" === b && m.resolve(a), m.reject(b);
      });
    }, function (a) {
      m.reject(a);
    }), m.promise;
  }, c;
}]), function () {
  function a(a, c, d, e, f, g, h, i, j, k) {
    function l() {
      return c.attr("disabled") || r("ngfDropDisabled", a);
    }

    function m(b, c) {
      i.updateModel(e, d, a, r("ngfChange") || r("ngfDrop"), b, c);
    }

    function n(b, c) {
      if (!i.shouldUpdateOn(b, d, a) || !c) return i.rejectPromise([]);
      var e = [];
      c.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi, function (a, b, c) {
        e.push(c);
      });
      var f = [],
          g = [];

      if (e.length) {
        angular.forEach(e, function (a) {
          f.push(i.urlToBlob(a).then(function (a) {
            g.push(a);
          }));
        });
        var h = k.defer();
        return k.all(f).then(function () {
          h.resolve(g);
        }, function (a) {
          h.reject(a);
        }), h.promise;
      }

      return i.emptyPromise();
    }

    function o(a, b, c, d) {
      var e = r("ngfDragOverClass", a, {
        $event: c
      }),
          f = "dragover";
      if (angular.isString(e)) f = e;else if (e && (e.delay && (v = e.delay), e.accept || e.reject)) {
        var g = c.dataTransfer.items;
        if (null != g && g.length) for (var h = e.pattern || r("ngfPattern", a, {
          $event: c
        }), j = g.length; j--;) {
          if (!i.validatePattern(g[j], h)) {
            f = e.reject;
            break;
          }

          f = e.accept;
        } else f = e.accept;
      }
      d(f);
    }

    function p(b, c, e, f) {
      function g(a, b) {
        var c = k.defer();
        if (null != a) if (a.isDirectory) {
          var d = [i.emptyPromise()];

          if (m) {
            var e = {
              type: "directory"
            };
            e.name = e.path = (b || "") + a.name + a.name, n.push(e);
          }

          var f = a.createReader(),
              h = [],
              p = function p() {
            f.readEntries(function (e) {
              try {
                e.length ? (h = h.concat(Array.prototype.slice.call(e || [], 0)), p()) : (angular.forEach(h.slice(0), function (c) {
                  n.length <= j && l >= o && d.push(g(c, (b ? b : "") + a.name + "/"));
                }), k.all(d).then(function () {
                  c.resolve();
                }, function (a) {
                  c.reject(a);
                }));
              } catch (f) {
                c.reject(f);
              }
            }, function (a) {
              c.reject(a);
            });
          };

          p();
        } else a.file(function (a) {
          try {
            a.path = (b ? b : "") + a.name, m && (a = i.rename(a, a.path)), n.push(a), o += a.size, c.resolve();
          } catch (d) {
            c.reject(d);
          }
        }, function (a) {
          c.reject(a);
        });
        return c.promise;
      }

      var j = i.getValidationAttr(d, a, "maxFiles") || Number.MAX_VALUE,
          l = i.getValidationAttr(d, a, "maxTotalSize") || Number.MAX_VALUE,
          m = r("ngfIncludeDir", a),
          n = [],
          o = 0,
          p = [i.emptyPromise()];
      if (b && b.length > 0 && "file" !== h.protocol()) for (var q = 0; q < b.length; q++) {
        if (b[q].webkitGetAsEntry && b[q].webkitGetAsEntry() && b[q].webkitGetAsEntry().isDirectory) {
          var s = b[q].webkitGetAsEntry();
          if (s.isDirectory && !e) continue;
          null != s && p.push(g(s));
        } else {
          var t = b[q].getAsFile();
          null != t && (n.push(t), o += t.size);
        }

        if (n.length > j || o > l || !f && n.length > 0) break;
      } else if (null != c) for (var u = 0; u < c.length; u++) {
        var v = c.item(u);
        if ((v.type || v.size > 0) && (n.push(v), o += v.size), n.length > j || o > l || !f && n.length > 0) break;
      }
      var w = k.defer();
      return k.all(p).then(function () {
        if (f || m || !n.length) w.resolve(n);else {
          for (var a = 0; n[a] && "directory" === n[a].type;) {
            a++;
          }

          w.resolve([n[a]]);
        }
      }, function (a) {
        w.reject(a);
      }), w.promise;
    }

    var q = b(),
        r = function r(a, b, c) {
      return i.attrGetter(a, d, b, c);
    };

    if (r("dropAvailable") && g(function () {
      a[r("dropAvailable")] ? a[r("dropAvailable")].value = q : a[r("dropAvailable")] = q;
    }), !q) return void (r("ngfHideOnDropNotAvailable", a) === !0 && c.css("display", "none"));
    null == r("ngfSelect") && i.registerModelChangeValidator(e, d, a);
    var s,
        t = null,
        u = f(r("ngfStopPropagation")),
        v = 1;
    c[0].addEventListener("dragover", function (b) {
      if (!l() && i.shouldUpdateOn("drop", d, a)) {
        if (b.preventDefault(), u(a) && b.stopPropagation(), navigator.userAgent.indexOf("Chrome") > -1) {
          var e = b.dataTransfer.effectAllowed;
          b.dataTransfer.dropEffect = "move" === e || "linkMove" === e ? "move" : "copy";
        }

        g.cancel(t), s || (s = "C", o(a, d, b, function (d) {
          s = d, c.addClass(s), r("ngfDrag", a, {
            $isDragging: !0,
            $class: s,
            $event: b
          });
        }));
      }
    }, !1), c[0].addEventListener("dragenter", function (b) {
      !l() && i.shouldUpdateOn("drop", d, a) && (b.preventDefault(), u(a) && b.stopPropagation());
    }, !1), c[0].addEventListener("dragleave", function (b) {
      !l() && i.shouldUpdateOn("drop", d, a) && (b.preventDefault(), u(a) && b.stopPropagation(), t = g(function () {
        s && c.removeClass(s), s = null, r("ngfDrag", a, {
          $isDragging: !1,
          $event: b
        });
      }, v || 100));
    }, !1), c[0].addEventListener("drop", function (b) {
      if (!l() && i.shouldUpdateOn("drop", d, a)) {
        b.preventDefault(), u(a) && b.stopPropagation(), s && c.removeClass(s), s = null;
        var e,
            f = b.dataTransfer.items;

        try {
          e = b.dataTransfer && b.dataTransfer.getData && b.dataTransfer.getData("text/html");
        } catch (g) {}

        p(f, b.dataTransfer.files, r("ngfAllowDir", a) !== !1, r("multiple") || r("ngfMultiple", a)).then(function (a) {
          a.length ? m(a, b) : n("dropUrl", e).then(function (a) {
            m(a, b);
          });
        });
      }
    }, !1), c[0].addEventListener("paste", function (b) {
      if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1 && r("ngfEnableFirefoxPaste", a) && b.preventDefault(), !l() && i.shouldUpdateOn("paste", d, a)) {
        var c = [],
            e = b.clipboardData || b.originalEvent.clipboardData;
        if (e && e.items) for (var f = 0; f < e.items.length; f++) {
          -1 !== e.items[f].type.indexOf("image") && c.push(e.items[f].getAsFile());
        }
        c.length ? m(c, b) : n("pasteUrl", e).then(function (a) {
          m(a, b);
        });
      }
    }, !1), navigator.userAgent.toLowerCase().indexOf("firefox") > -1 && r("ngfEnableFirefoxPaste", a) && (c.attr("contenteditable", !0), c.on("keypress", function (a) {
      a.metaKey || a.ctrlKey || a.preventDefault();
    }));
  }

  function b() {
    var a = document.createElement("div");
    return "draggable" in a && "ondrop" in a && !/Edge\/12./i.test(navigator.userAgent);
  }

  ngFileUpload.directive("ngfDrop", ["$parse", "$timeout", "$location", "Upload", "$http", "$q", function (b, c, d, e, f, g) {
    return {
      restrict: "AEC",
      require: "?ngModel",
      link: function link(h, i, j, k) {
        a(h, i, j, k, b, c, d, e, f, g);
      }
    };
  }]), ngFileUpload.directive("ngfNoFileDrop", function () {
    return function (a, c) {
      b() && c.css("display", "none");
    };
  }), ngFileUpload.directive("ngfDropAvailable", ["$parse", "$timeout", "Upload", function (a, c, d) {
    return function (e, f, g) {
      if (b()) {
        var h = a(d.attrGetter("ngfDropAvailable", g));
        c(function () {
          h(e), h.assign && h.assign(e, !0);
        });
      }
    };
  }]);
}(), ngFileUpload.service("UploadExif", ["UploadResize", "$q", function (a, b) {
  function c(a, b, c, d) {
    switch (b) {
      case 2:
        return a.transform(-1, 0, 0, 1, c, 0);

      case 3:
        return a.transform(-1, 0, 0, -1, c, d);

      case 4:
        return a.transform(1, 0, 0, -1, 0, d);

      case 5:
        return a.transform(0, 1, 1, 0, 0, 0);

      case 6:
        return a.transform(0, 1, -1, 0, d, 0);

      case 7:
        return a.transform(0, -1, -1, 0, d, c);

      case 8:
        return a.transform(0, -1, 1, 0, 0, c);
    }
  }

  function d(a) {
    for (var b = "", c = new Uint8Array(a), d = c.byteLength, e = 0; d > e; e++) {
      b += String.fromCharCode(c[e]);
    }

    return window.btoa(b);
  }

  var e = a;
  return e.isExifSupported = function () {
    return window.FileReader && new FileReader().readAsArrayBuffer && e.isResizeSupported();
  }, e.readOrientation = function (a) {
    var c = b.defer(),
        d = new FileReader(),
        e = a.slice ? a.slice(0, 65536) : a;
    return d.readAsArrayBuffer(e), d.onerror = function (a) {
      return c.reject(a);
    }, d.onload = function (a) {
      var b = {
        orientation: 1
      },
          d = new DataView(this.result);
      if (65496 !== d.getUint16(0, !1)) return c.resolve(b);

      for (var e = d.byteLength, f = 2; e > f;) {
        var g = d.getUint16(f, !1);

        if (f += 2, 65505 === g) {
          if (1165519206 !== d.getUint32(f += 2, !1)) return c.resolve(b);
          var h = 18761 === d.getUint16(f += 6, !1);
          f += d.getUint32(f + 4, h);
          var i = d.getUint16(f, h);
          f += 2;

          for (var j = 0; i > j; j++) {
            if (274 === d.getUint16(f + 12 * j, h)) {
              var k = d.getUint16(f + 12 * j + 8, h);
              return k >= 2 && 8 >= k && (d.setUint16(f + 12 * j + 8, 1, h), b.fixedArrayBuffer = a.target.result), b.orientation = k, c.resolve(b);
            }
          }
        } else {
          if (65280 !== (65280 & g)) break;
          f += d.getUint16(f, !1);
        }
      }

      return c.resolve(b);
    }, c.promise;
  }, e.applyExifRotation = function (a) {
    if (0 !== a.type.indexOf("image/jpeg")) return e.emptyPromise(a);
    var f = b.defer();
    return e.readOrientation(a).then(function (b) {
      return b.orientation < 2 || b.orientation > 8 ? f.resolve(a) : void e.dataUrl(a, !0).then(function (g) {
        var h = document.createElement("canvas"),
            i = document.createElement("img");
        i.onload = function () {
          try {
            h.width = b.orientation > 4 ? i.height : i.width, h.height = b.orientation > 4 ? i.width : i.height;
            var g = h.getContext("2d");
            c(g, b.orientation, i.width, i.height), g.drawImage(i, 0, 0);
            var j = h.toDataURL(a.type || "image/WebP", .934);
            j = e.restoreExif(d(b.fixedArrayBuffer), j);
            var k = e.dataUrltoBlob(j, a.name);
            f.resolve(k);
          } catch (l) {
            return f.reject(l);
          }
        }, i.onerror = function () {
          f.reject();
        }, i.src = g;
      }, function (a) {
        f.reject(a);
      });
    }, function (a) {
      f.reject(a);
    }), f.promise;
  }, e.restoreExif = function (a, b) {
    var c = {};
    return c.KEY_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", c.encode64 = function (a) {
      var b,
          c,
          d,
          e,
          f,
          g = "",
          h = "",
          i = "",
          j = 0;

      do {
        b = a[j++], c = a[j++], h = a[j++], d = b >> 2, e = (3 & b) << 4 | c >> 4, f = (15 & c) << 2 | h >> 6, i = 63 & h, isNaN(c) ? f = i = 64 : isNaN(h) && (i = 64), g = g + this.KEY_STR.charAt(d) + this.KEY_STR.charAt(e) + this.KEY_STR.charAt(f) + this.KEY_STR.charAt(i), b = c = h = "", d = e = f = i = "";
      } while (j < a.length);

      return g;
    }, c.restore = function (a, b) {
      a.match("data:image/jpeg;base64,") && (a = a.replace("data:image/jpeg;base64,", ""));
      var c = this.decode64(a),
          d = this.slice2Segments(c),
          e = this.exifManipulation(b, d);
      return "data:image/jpeg;base64," + this.encode64(e);
    }, c.exifManipulation = function (a, b) {
      var c = this.getExifArray(b),
          d = this.insertExif(a, c);
      return new Uint8Array(d);
    }, c.getExifArray = function (a) {
      for (var b, c = 0; c < a.length; c++) {
        if (b = a[c], 255 === b[0] & 225 === b[1]) return b;
      }

      return [];
    }, c.insertExif = function (a, b) {
      var c = a.replace("data:image/jpeg;base64,", ""),
          d = this.decode64(c),
          e = d.indexOf(255, 3),
          f = d.slice(0, e),
          g = d.slice(e),
          h = f;
      return h = h.concat(b), h = h.concat(g);
    }, c.slice2Segments = function (a) {
      for (var b = 0, c = [];;) {
        if (255 === a[b] & 218 === a[b + 1]) break;
        if (255 === a[b] & 216 === a[b + 1]) b += 2;else {
          var d = 256 * a[b + 2] + a[b + 3],
              e = b + d + 2,
              f = a.slice(b, e);
          c.push(f), b = e;
        }
        if (b > a.length) break;
      }

      return c;
    }, c.decode64 = function (a) {
      var b,
          c,
          d,
          e,
          f,
          g = "",
          h = "",
          i = 0,
          j = [],
          k = /[^A-Za-z0-9\+\/\=]/g;
      k.exec(a) && console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding."), a = a.replace(/[^A-Za-z0-9\+\/\=]/g, "");

      do {
        d = this.KEY_STR.indexOf(a.charAt(i++)), e = this.KEY_STR.indexOf(a.charAt(i++)), f = this.KEY_STR.indexOf(a.charAt(i++)), h = this.KEY_STR.indexOf(a.charAt(i++)), b = d << 2 | e >> 4, c = (15 & e) << 4 | f >> 2, g = (3 & f) << 6 | h, j.push(b), 64 !== f && j.push(c), 64 !== h && j.push(g), b = c = g = "", d = e = f = h = "";
      } while (i < a.length);

      return j;
    }, c.restore(a, b);
  }, e;
}]);
'use strict'; //inject directives and services.


var app = angular.module('fileUpload', ['ngFileUpload']);
app.controller('fileUploadController', ['$scope', 'Upload', '$timeout', function ($scope, Upload, $timeout) {
  console.log('fileuploadcontroller loading'); //The files list
  //Todo, extend with the files form the database

  $scope.files = []; //These are the fileIds, used for saving

  $scope.dynamic = false;
  $scope.uploadSizes = '';
  $scope.maxImages;
  $scope.errorMsg = {};
  $scope.subFolder = false;
  $scope.attributeKey = '';
  $scope.forModel;
  $scope.forModelId;
  $scope.canUploadNewImage;
  /**
   * This function uploads the new files
   * @param files
   * @param errFiles
   * @param maximages
   * @param blockId
   * @param tabId optional
   */

  $scope.uploadFiles = function (files, errFiles, maximages, blockId, tabId) {
    console.log("upload for block with blockId: " + blockId + " and tabKey: " + tabId);
    console.log("uploadedFiles files:");
    console.log(files); //Get the model and the id where we are uploading images for. Should flow via a service but due to bad design and an upcoming newer angular version does not. todo: improve me

    var htmlElement = document.querySelector("[ng-controller=KmsAttributeDynamicController]");
    $scope.forModel = htmlElement.dataset.forModel;
    $scope.forModelId = htmlElement.dataset.forModelId;
    console.log("fileUploadController uploading files For model: " + $scope.forModel + " with id: " + $scope.forModelId + " and blockId: " + blockId);
    if (typeof $scope.files == 'undefined') $scope.files = [];

    if ($scope.files.length >= maximages) {
      console.log("File upload not allowed. " + $scope.files.length + "/" + maximages + " uploaded");
      return false;
    } //Set the files


    $scope.errFiles = errFiles; //Foreach each file

    angular.forEach(files, function (file) {
      //Push to true adds image at the back, false at the front
      var push = true; //Add the placeholder

      var loadingImage = {
        loading: true,
        thumb_image_url: '/images/kms/loading.gif'
      };

      if (push == true) {
        $scope.files.push(loadingImage);
        var imageKey = $scope.files.length - 1;
      } else {
        //Add at the front
        $scope.files.unshift(loadingImage);
        var imageKey = 0;
      } //Upload to the server


      file.upload = Upload.upload({
        url: '/kms/upload',
        data: {
          //Sent the data and the options
          file: file,
          uploadSizes: $scope.uploadSizes,
          dynamic: $scope.dynamic,
          subFolder: $scope.subFolder,
          attribute_key: $scope.attributeKey,
          forModelName: $scope.forModel,
          forModelId: $scope.forModelId,
          forBlockId: blockId,
          forTabId: tabId
        }
      }); //After uploading

      file.upload.then(function (response) {
        $timeout(function () {
          // delete $scope.files.loading
          console.log(response); //Set the response data
          // file.result = response.data;
          // file.result = response.data.uploaded[0];
          // console.log("Thumb: "+response.data.uploaded.[0].thumb);

          console.log("Image Id: " + response.data.uploaded[0].id); //Add the file to the current files

          $scope.files[imageKey] = response.data.uploaded[0];
          console.log("$scope.files[" + imageKey + "] =");
          console.log($scope.files[imageKey]); //Reverse push
          //Add the file to the current files
          // $scope.files.unshift(file.result);
          // $scope.setFileIds()
          //Update fileids

          var forBlockId = response.data.uploaded[0].forBlockId;
          var blocksDataObject = $scope.getBlocksData(); //Defined in the KmsAttributeDynamicController

          for (var key in blocksDataObject) {
            console.log("Looping over blocks to find a block with id: " + forBlockId + ". Current block id: " + blocksDataObject[key].blockId); // console.log(blocksDataObject[key]);

            if (blocksDataObject.hasOwnProperty(key) === false || blocksDataObject[key].hasOwnProperty("blockId") === false) {
              console.warn("Detected block data without a block id. Because of this, it is not possible to upload a file for that block. This does not mean that the uploaded image can be linked to the block your uploading currently for");
              continue;
            }

            if (blocksDataObject[key].blockId == forBlockId) {
              console.log("found block with id: " + forBlockId);
              var data = [];

              if (response.data.uploaded[0].forTabId) {
                console.log("Uploaded an image for tab: " + response.data.uploaded[0].forTabId);
                data = response.data.uploaded[0].id + "#" + response.data.uploaded[0].forTabId; //imageid#multipleimagesslot
              } else {
                console.log("Uploaded an image without tab: " + response.data.uploaded[0].id);
                data = response.data.uploaded[0].id;
              }

              var fileIds = [];

              if (blocksDataObject[key].hasOwnProperty('fileIds')) {
                var length = blocksDataObject[key]['fileIds'].length; //Determine if it is a single image or multiple images.

                blocksDataObject[key]['fileIds'][length] = data;
                console.log("Updating fileIds with image id: " + data);
              } else {
                console.log("Setting fileIds to a new array with image id: " + data);
                blocksDataObject[key].fileIds = [data];
              }

              console.log("files.length = " + blocksDataObject[key].fileIds.length + " maxImages = " + $scope.maxImages);
              $scope.canUploadNewImage = blocksDataObject[key].fileIds.length < $scope.maxImages;
            }

            $scope.setBlocksData(blocksDataObject);
          }
        });
      }, function (response) {
        if (response.status > 0) $scope.errorMsg = response.status + ': ' + response.data;
        console.error("Error: " + $scope.errorMsg);
      }, function (evt) {
        file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
      });
    });
  };

  $scope.deleteImage = function (index, blockId, tab_key) {
    var idToDelete = $scope.files[index].id;
    console.log("idToDelete: " + idToDelete + " from blockId: " + blockId); //Delete the image

    $scope.files.splice(index, 1);
    console.log("Current image amount: " + $scope.files.length); //Delete the image id
    // $scope.setFileIds()

    var blocksDataObject = $scope.getBlocksData(); //Defined in the KmsAttributeDynamicController

    for (var blockIndex in blocksDataObject) {
      if (blocksDataObject.hasOwnProperty(blockIndex) === false || blocksDataObject[blockIndex].hasOwnProperty("blockId") === false) {
        console.warn("Detected block data without a block id. Because of this, it is not possible to upload a file for that block. This does not mean that the uploaded image can be linked to the block your uploading currently for");
        continue;
      }

      if (blocksDataObject[blockIndex].blockId == blockId) {
        console.log("found block with id: " + blockId);
        if (blocksDataObject[blockIndex].hasOwnProperty('fileIdsToDelete') === false) blocksDataObject[blockIndex].fileIdsToDelete = [];
        console.log("Current files to delete: " + blocksDataObject[blockIndex].fileIdsToDelete);
        idToDelete = typeof tab_key !== 'undefined' ? idToDelete + "#" + tab_key : idToDelete;

        for (var index in blocksDataObject[blockIndex].fileIds) {
          var currentId = blocksDataObject[blockIndex].fileIds[index];

          if (typeof tab_key !== 'undefined') {
            console.log("Looping over the file ids to find an image with id: " + idToDelete + " for tab: " + tab_key + " (" + currentId + ")");
          } else {
            console.log("Looping over the file ids to find an image with id: " + idToDelete);
          }

          if (currentId == idToDelete) {
            console.log("Image marked to delete on save: " + idToDelete);
            blocksDataObject[blockIndex].fileIdsToDelete[blocksDataObject[blockIndex].fileIdsToDelete.length] = idToDelete;
            blocksDataObject[blockIndex].fileIds.splice(index, 1);

            if (typeof tab_key === 'undefined') {
              $scope.canUploadNewImage = blocksDataObject[blockIndex].fileIds.length < $scope.maxImages;
            } else {
              var count = 0;

              for (var index in blocksDataObject[blockIndex].fileIds) {
                if (blocksDataObject[blockIndex].fileIds[index].split("#")[1] == tab_key) {
                  count++;
                }
              }

              $scope.canUploadNewImage = count < $scope.maxImages;
            }

            break;
          }
        }
      }
    }

    $scope.setBlocksData(blocksDataObject);
    delete $scope.errorMsg.toMany;
  }; // $scope.moveImage = function (index, direction) {
  //     var currentFile = $scope.files[index]
  //     var currentFileId = $scope.fileIds[index]
  //
  //     if (direction == 'left') {
  //         $scope.files[index] = $scope.files[index - 1];
  //         $scope.files[index - 1] = currentFile;
  //     } else {
  //         $scope.files[index] = $scope.files[index + 1];
  //         $scope.files[index + 1] = currentFile;
  //     }
  //     $scope.setFileIds()
  // };


  $scope.initFiles = function (files, maxImages, tab_key) {
    console.log("fileupload:initFiles: " + files + " maxImages: " + maxImages);

    if (files) {
      // //Strip out the image ids that do not belong to the tab we are processing for
      var filesToUse = [];

      if (typeof tab_key !== 'undefined') {
        for (var index in files) {
          var split = files[index].split("#");
          if (split.length !== 2) continue; //The imageId did not contain a #

          if (split[1] != tab_key) {
            console.log("fileupload:initFiles: Ignoring image with id: " + split[0] + " because it belongs to tab " + split[1] + " and we are processing images for tab " + tab_key);
          } else {
            filesToUse[filesToUse.length] = files[index];
          }
        }
      } else {
        filesToUse = files;
      }

      if (filesToUse.length > 0) {
        $.ajax({
          type: "POST",
          url: "/kms/getimagedata",
          data: {
            fileIds: filesToUse
          },
          success: function success(response) {
            console.log("Retrieved files: ");
            console.log(response); // files must look like this files[index].id files[index].sizes

            $scope.files = response; // $scope.setFileIds();

            if (typeof maxImages != 'undefined') {
              $scope.maxImages = maxImages;
            }

            console.log("files.length < $scope.maxImages: " + filesToUse.length < $scope.maxImages);
            $scope.canUploadNewImage = filesToUse.length < $scope.maxImages;
            $scope.$apply();
          },
          error: function error() {
            console.log("An error occured while retrieving image(s)");
          },
          headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          },
          dataType: 'json'
        });
      } else {
        $scope.maxImages = maxImages;
        $scope.canUploadNewImage = true;
        $scope.files = [];
      }
    } else {
      $scope.maxImages = maxImages;
      $scope.canUploadNewImage = true;
      $scope.files = [];
    }
  };

  $scope.updateFiles = function (files) {
    console.log("Updated files");
    $scope.files = files;
  }; // $scope.setFileIds = function () {
  //     var local_fileIds = [];
  //
  //     angular.forEach($scope.files, function (file) {
  //         local_fileIds.push(file.id);
  //     });
  //
  //     console.log("set file ids ($scope.fileIds):");
  //     console.log(local_fileIds);
  //     $scope.fileIds = local_fileIds
  // };
  // $scope.getFileCount = function () {
  //     return $scope.fileIds.length;
  // };


  $scope.sortableOptions = {
    update: function update(e, ui) {
      ui.item.sortable.cancel();
      var originalIndex = ui.item.sortable.index;
      var newIndex = ui.item.sortable.dropindex;
      var oldImage = $scope.files[originalIndex];
      $scope.files[originalIndex] = $scope.files[newIndex];
      $scope.files[newIndex] = oldImage;
      $scope.setFileIds();
    }
  };
  console.log('fileuploadcontroller initialized');
}]);
'use strict';

angular.element(document).ready(function () {// angular.element(document.querySelector('[ng-controller]')).scope().debug();
  // //console.log('page loading completed');
});
angular.module('kms.dynamic-attribute', []).controller('KmsAttributeDynamicController', function ($scope, $element, $compile, $timeout) {
  //console.log('KmsAttributeDynamicController initializing');
  // var htmlElement = document.querySelector("[ng-controller=KmsAttributeDynamicController]");
  //console.log("Controller element");
  //console.log($($element)[0]);
  var htmlElement = $($element)[0]; //For which model and id of the model the dynamic attribute works

  $scope.forModel = htmlElement.dataset.forModel;
  $scope.forModelId = htmlElement.dataset.forModelId; //console.log("KmsAttributeDynamicController further initializing For model: "+$scope.forModel+" with id: "+$scope.forModelId);

  $scope.key = htmlElement.dataset.key; //console.log("Controller key: "+$scope.key);

  var removeBlocks = function removeBlocks() {
    // Remove the block list for re-render
    angular.element('#' + $scope.key + '_blocks .inner').remove();
  }; // Check if any blocks exists to prevent JSON.parse error
  // Default is an empty array


  $scope.blocks = [];
  var html = $('#' + $scope.key + '_data', $element).html(); //console.log("JSON to parse (in element: #"+$scope.key+"_data): "+html);

  if (html != '' && html != '""' && html != undefined) {
    $scope.blocks = JSON.parse(html);
  } else {} //console.log("Element called: " + "#" + $scope.key + "_data does not have json data set");
  //console.log('scope blocks');
  //console.log($scope.blocks);


  $scope.blockSettings = {};
  var blockSettingsElement = document.getElementById('blockSettings');

  if (blockSettingsElement) {
    var block_settings = blockSettingsElement.value;

    if (block_settings != '' && block_settings != '""') {
      $scope.blockSettings = JSON.parse(block_settings);
    }
  } else {} //console.log("No blocksettings element");
  //console.log("blocksettings");
  //console.log($scope.blockSettings);


  $scope.blockTypes = getBlockTypes($scope.blockSettings);

  $scope.addBlock = function (blockType) {
    if (!angular.isUndefined(blockType)) {
      $scope.blocks.push(angular.copy(blockType));
    }
  };

  $scope.removeBlock = function (block) {
    startToMove();
    var index = $scope.blocks.indexOf(block);
    $scope.blocks.splice(index, 1);
    stopToMove();
  };

  $scope.upBlock = function (block) {
    //load index from the block
    var index = $scope.blocks.indexOf(block); //if the index is 0 return

    if (index < 1) return; //Remove the editor

    startToMove(); //Set the block index-1 to current index

    $scope.blocks[index] = $scope.blocks[index - 1]; //set the triggerd block to index-1

    $scope.blocks[index - 1] = block; //enable the editor

    stopToMove();
  };

  $scope.downBlock = function (block) {
    //load the index from the block
    var index = $scope.blocks.indexOf(block); //If the block is the last return false

    if (index >= $scope.blocks.length - 1) return; //Remove the editor

    startToMove(); //set the block +1 to the current index

    $scope.blocks[index] = $scope.blocks[index + 1]; //set the triggerd block to index +1

    $scope.blocks[index + 1] = block; //enable the editor

    stopToMove();
  };

  $scope.deleteImage = function (direction, block_key, image_key, tab_key) {
    if (tab_key == null) {
      $scope.blocks[block_key].images.splice(image_key, 1);
    } else {
      $scope.blocks[block_key].tab[tab_key].images.splice(image_key, 1);
    }
  };

  $scope.deleteFile = function (block_key) {
    delete $scope.blocks[block_key].file;
  };

  $scope.changeOrder = function (direction, block_key, image_key, tab_key) {
    //load the index from the block
    var index = image_key;

    if (tab_key == null) {
      var temp_image = $scope.blocks[block_key].images[image_key];

      switch (direction) {
        case 'left':
          if (index == 0) return;
          $scope.blocks[block_key].images[image_key] = $scope.blocks[block_key].images[image_key - 1];
          $scope.blocks[block_key].images[image_key - 1] = temp_image;
          break;

        case 'right':
          if (index + 1 == $scope.blocks[block_key].images.length) return;
          $scope.blocks[block_key].images[image_key] = $scope.blocks[block_key].images[image_key + 1];
          $scope.blocks[block_key].images[image_key + 1] = temp_image;
          break;
      }
    } else {
      var temp_image = $scope.blocks[block_key].tab[tab_key].images[image_key];

      switch (direction) {
        case 'left':
          if (index == 0) return;
          $scope.blocks[block_key].tab[tab_key].images[image_key] = $scope.blocks[block_key].tab[tab_key].images[image_key - 1];
          $scope.blocks[block_key].tab[tab_key].images[image_key - 1] = temp_image;
          break;

        case 'right':
          if (index + 1 == $scope.blocks[block_key].tab[tab_key].images.length) return;
          $scope.blocks[block_key].tab[tab_key].images[image_key] = $scope.blocks[block_key].tab[tab_key].images[image_key + 1];
          $scope.blocks[block_key].tab[tab_key].images[image_key + 1] = temp_image;
          break;
      }
    }
  };
  /**
   * Add new image tab
   * @param block_index
   */


  $scope.addImageTab = function (block_index) {
    $scope.blocks[block_index].tab.push({
      title: ''
    });
    var new_index = $scope.blocks[block_index].tab.length; //set the new tab as active (-1) arrays start at 0

    $scope.setActiveTab(block_index, new_index - 1);
  };
  /**
   * Remove image tab
   * @param block_index
   */


  $scope.removeImageTab = function (block_index, tab_index) {
    $scope.blocks[block_index].tab.splice(tab_index, 1); //set the active tab to 0

    $scope.setActiveTab(block_index, 0);
  };

  $scope.setActiveTab = function (index, tab) {
    $scope.blocks[index].active_tab = tab;
  };

  $scope.moveTab = function (direction, index, tab_index) {
    var temptab = $scope.blocks[index].tab[tab_index];

    switch (direction) {
      case 'left':
        if (tab_index == 0) return;
        $scope.blocks[index].tab[tab_index] = $scope.blocks[index].tab[tab_index - 1];
        $scope.blocks[index].tab[tab_index - 1] = temptab;
        break;

      case 'right':
        if (tab_index + 1 == $scope.blocks[index].tab.length) return;
        $scope.blocks[index].tab[tab_index] = $scope.blocks[index].tab[tab_index + 1];
        $scope.blocks[index].tab[tab_index + 1] = temptab;
        break;
    }
  };

  $scope.setUniqueId = function (block_index) {
    if (typeof $scope.blocks[block_index].blockId == 'undefined') {
      var stamp = new Date().valueOf();
      $scope.blocks[block_index].blockId = Math.round(stamp + Math.random() * 1000);
    }
  };

  $scope.debug = function () {//console.log('key: ' + $scope.key);
  }; //console.log('KmsAttributeDynamicController initialized');

}).directive('block', function ($compile) {
  return {
    restrict: 'E',
    template: '<div class="header">' + '<div class="start">' + '<div class="block-title">{{block.typeName}}</div>' + '<div class="buttons">' + '<div class="position-button up" ng-click="upBlock(block)"></div>' + '<div class="position-button down" ng-click="downBlock(block)"></div>' + '</div></div>' + '<div class="end">' + '<div class="btn btn-danger btn-trash" ng-click="removeBlock(block)">&nbsp</div>' + '</div></div>',
    link: function link(scope, element, attr) {
      switch (scope.block.typeSlug) {
        case 'content-block':
          // //console.log('rendering a content block with this data: '+scope.block);
          scope.imageBoxId = scope.key + '-image-box-' + scope.$index;
          scope.textBoxId = scope.key + '-text-box-' + scope.$index; //console.log("Rendering content-block (afbeelding en tekst)");
          //console.log(scope.block);

          element.append($compile("<content-block></content-block>")(scope));
          break;

        case 'view-block':
          element.append($compile("<view-block></view-block>")(scope));
          break;

        case 'page-link-block':
          element.append($compile("<page-link-block></page-link-block>")(scope));
          break;

        case 'image-slider-block':
          element.append($compile("<image-slider-block></image-slider-block>")(scope));
          break;

        case 'video-block':
          element.append($compile("<video-block></video-block>")(scope));
          break;

        case 'file-block':
          element.append($compile("<file-block></file-block>")(scope));
          break;

        case 'two-column-block':
          scope.textBoxIds = [];
          scope.textBoxIds.left = scope.key + '-text-box-' + scope.$index + '-left';
          scope.textBoxIds.right = scope.key + '-text-box-' + scope.$index + '-right';
          element.append($compile("<two-column-block></two-column-block>")(scope));
          break;

        case 'three-column-block':
          scope.textBoxIds = [];
          scope.textBoxIds.left = scope.key + '-text-box-' + scope.$index + '-left';
          scope.textBoxIds.middle = scope.key + '-text-box-' + scope.$index + '-middle';
          scope.textBoxIds.right = scope.key + '-text-box-' + scope.$index + '-right';
          element.append($compile("<three-column-block></three-column-block>")(scope));
          break;

        case 'full-text-block':
          scope.textBoxId = scope.key + '-text-box-' + scope.$index;
          element.append($compile("<full-text-block></full-text-block>")(scope));
          break;

        case 'full-image-block':
          element.append($compile("<full-image-block></full-image-block>")(scope));
          break;

        case 'multiple-images-block':
          element.append($compile("<multiple-images-block></multiple-images-block>")(scope));
          break;
      } // //console.log("block data element: "+attr.dataElement);


      scope.dataElement = document.querySelector(attr.dataElement);

      scope.getBlocksData = function () {
        return JSON.parse(scope.dataElement.getAttribute("value"));
      };

      scope.setBlocksData = function (data) {
        scope.dataElement.setAttribute("value", JSON.stringify(data));
      };
    }
  };
}).directive('contentBlock', function ($timeout) {
  var count = 0;
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-page-content-block',
    link: function link(scope, element, attrs) {
      scope.image = 'imageHolder';
      scope.loopCount = count;
      count++;
      scope.loopCount = scope.key; // //console.log("getting content block data");
      // //console.log(scope.getBlocksData();
      //initiate the tinyMce editor

      initiateTinyMceWithDelay(scope, $timeout, 100);

      scope.openBox = function (imageBoxId) {
        $.colorbox({
          href: '/kms/elfinder/standalonepopup/' + imageBoxId,
          fastIframe: true,
          iframe: true,
          width: '70%',
          height: '520px'
        });
      };
    }
  };
}).directive('viewBlock', function ($timeout) {
  var count = 0;
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-view',
    link: function link(scope) {}
  };
}).directive('twoColumnBlock', function ($timeout) {
  var count = 0;
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/two-column-block',
    link: function link(scope, element, attrs) {
      scope.image = 'imageHolder', scope.loopCount = count;
      count++;
      scope.loopCount = scope.key; //initiate the tinyMce editor

      initiateTinyMceWithDelay(scope, $timeout, 100);

      scope.openBox = function (imageBoxId) {
        $.colorbox({
          href: '/kms/elfinder/standalonepopup/' + imageBoxId,
          fastIframe: true,
          iframe: true,
          width: '70%',
          height: '520px'
        });
      };
    }
  };
}).directive('threeColumnBlock', function ($timeout) {
  var count = 0;
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/three-column-block',
    link: function link(scope, element, attrs) {
      scope.image = 'imageHolder', scope.loopCount = count;
      count++;
      scope.loopCount = scope.key; //initiate the tinyMce editor

      initiateTinyMceWithDelay(scope, $timeout, 100);

      scope.openBox = function (imageBoxId) {
        $.colorbox({
          href: '/kms/elfinder/standalonepopup/' + imageBoxId,
          fastIframe: true,
          iframe: true,
          width: '70%',
          height: '520px'
        });
      };
    }
  };
}).directive('imageSliderBlock', function () {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-image-slider-block',
    link: function link(node) {////console.log(node);
    }
  };
}).directive('fullImageBlock', function () {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-full-image-block',
    link: function link(node) {////console.log(node);
    }
  };
}).directive('fullTextBlock', function ($timeout) {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-full-text-block',
    link: function link(scope) {
      //initiate the tinyMce editor
      initiateTinyMceWithDelay(scope, $timeout, 100);
    }
  };
}).directive('multipleImagesBlock', function () {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-multiple-images-block',
    link: function link(node) {////console.log(node);
    }
  };
}).directive('pageLinkBlock', function ($http) {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-page-link-block',
    link: function link(scope, element, attr) {
      scope.pages = [];
      $http.get('/kms/api/pages').then(function (response) {
        // Adopt data
        var pages = [];

        var getChildren = function getChildren(node) {
          for (var child in node) {
            if (node[child].title) {
              pages.push({
                value: node[child].id,
                label: node[child].title
              });
            }

            getChildren(node[child].children);
          }
        };

        getChildren(response.data); // Set the data

        scope.pages = pages;
      });
    }
  };
}).directive('videoBlock', function () {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-video-block',
    link: function link(node) {////console.log(node);
    }
  };
}).directive('fileBlock', function () {
  return {
    restrict: 'E',
    templateUrl: '/kms/api/template/dynamic-file-block',
    link: function link(node) {////console.log(node);
    }
  };
});
/**
 * Callback function for ElFinder (hard to implement in angular?)
 *
 * @param filePath
 * @param requestingElementId
 */

function processSelectedFile(filePath, requestingElementId) {
  // Get the scope of the the element that is passed into ElFinder
  var elementScope = $('#' + requestingElementId).parent().parent().scope();
  elementScope.block.image = filePath;
  elementScope.$apply();
}
/**
 * This function will initiate the tinyMce editor on an block
 * It the initiation will be delayed because of the angular
 *
 * @param $scope
 * @param $timeout
 */


function initiateTinyMceWithDelay($scope, $timeout, delay) {
  //if (tinymce) tinymce.remove();
  $timeout(function () {
    initiateTinyMce($scope, $scope.textBoxId);

    if (typeof $scope.textBoxIds !== 'undefined') {
      if ($scope.textBoxIds.left != null) initiateTinyMce($scope, $scope.textBoxIds.left, 'description', 'left');
      if ($scope.textBoxIds.right != null) initiateTinyMce($scope, $scope.textBoxIds.right, 'description', 'right');
    }
  }, delay);
}

function initiateTinyMce($scope, field, blockElement, blockSubElement) {
  if (typeof field === 'undefined') {
    field = $scope.textboxId;
  }

  if (typeof blockElement === 'undefined') {
    blockElement = 'description';
  } //textboxIds[] =


  tinymce.init({
    elements: field,
    mode: 'exact',
    skin: 'kms',
    menubar: false,
    statusbar: false,
    plugins: ['code', 'paste', 'link', 'table'],
    toolbar: 'styleselect | bold italic underline | bullist numlist | link | code',
    height: '200',
    default_link_target: "_blank",
    paste_as_text: true,
    style_formats: [{
      title: 'Titel 1',
      block: 'h1'
    }, {
      title: 'Titel 2',
      block: 'h2'
    }, {
      title: 'Titel 3',
      block: 'h3'
    }, {
      title: 'Titel 4',
      block: 'h4'
    }],
    convert_urls: false,
    // link_list: "/kms/file-list?key=komma_kms",
    setup: function setup(editor) {
      editor.on('change', function (e) {
        editor.save();

        if (typeof blockSubElement === 'undefined') {
          $scope.block[blockElement] = editor.getContent();
        } else {
          $scope.block[blockElement][blockSubElement] = editor.getContent();
        }

        if (!$scope.$$phase) {
          $scope.$apply();
        }
      }); // Update model on keypress

      editor.on('KeyUp', function (e) {
        editor.save();

        if (typeof blockSubElement === 'undefined') {
          $scope.block[blockElement] = editor.getContent();
        } else {
          $scope.block[blockElement][blockSubElement] = editor.getContent();
        }

        if (!$scope.$$phase) {
          $scope.$apply();
        }
      });
    }
  });
}

function startToMove() {
  $(document).find('textarea').each(function () {
    tinyMCE.execCommand('mceFocus', false, $(this).attr('id'));
    tinyMCE.execCommand('mceRemoveEditor', false, $(this).attr('id'));
  });
}

function stopToMove() {
  //todo: Reanbling ONLY works after a timeout.
  setTimeout(function () {
    $(document).find('textarea').each(function () {
      tinymce.execCommand('mceAddEditor', true, $(this).attr('id'));
    });
  }, 100);
}

function getBlockTypes(blockSettings) {
  var blocks = {
    two_column_block: {
      typeSlug: 'two-column-block',
      code_name: '',
      view: '',
      typeName: 'Twee tekstkolommen',
      status: true,
      description: {
        left: '',
        right: ''
      },
      textWidth: '50'
    },
    three_column_block: {
      typeSlug: 'three-column-block',
      code_name: '',
      view: '',
      typeName: 'Drie tekstkolommen',
      status: true,
      description: {
        left: '',
        middle: '',
        right: ''
      },
      textWidth: '33'
    },
    content_block: {
      typeSlug: 'content-block',
      code_name: '',
      view: '',
      typeName: 'Afbeelding en tekst',
      status: true,
      location: 'left',
      textWidth: '66',
      description: '',
      subFolder: 'dynamic',
      image: null,
      link: '',
      link_text: 'Lees meer'
    },
    view_block: {
      typeSlug: 'view-block',
      code_name: '',
      view: '',
      typeName: 'View',
      status: true
    },
    full_image_block: {
      typeSlug: 'full-image-block',
      code_name: '',
      view: '',
      typeName: '100% Afbeelding',
      subFolder: 'dynamic',
      max_images: 1,
      status: true,
      image: null
    },
    full_text_block: {
      typeSlug: 'full-text-block',
      code_name: '',
      view: '',
      typeName: 'Een tekstkolom',
      description: '',
      status: true,
      link: '',
      link_text: 'Lees meer'
    },
    multiple_images_block: {
      typeSlug: 'multiple-images-block',
      code_name: '',
      view: '',
      typeName: 'Meerdere afbeeldingen',
      tab: [{
        title: 'Afbeelding 1',
        max_images: 1
      }, {
        title: 'Afbeelding 2a',
        max_images: 2
      }, {
        title: 'Afbeelding 2b (optioneel)',
        max_images: 1
      }],
      status: true,
      location: 'left',
      subFolder: 'dynamic',
      textWidth: '66'
    },
    page_link_block: {
      typeSlug: 'page-link-block',
      code_name: '',
      view: '',
      typeName: 'Page-link block',
      link_text: 'Lees meer',
      special: 0,
      status: true,
      pageId: null
    },
    image_slider_block: {
      typeSlug: 'image-slider-block',
      code_name: '',
      view: '',
      typeName: 'Image gallery',
      tab: [{
        title: ''
      }],
      subFolder: 'dynamic',
      status: true,
      pageId: null
    },
    video_block: {
      typeSlug: 'video-block',
      code_name: '',
      view: '',
      typeName: 'Video',
      youtube: '',
      status: true,
      pageId: null
    },
    file_block: {
      typeSlug: 'file-block',
      code_name: '',
      view: '',
      typeName: 'Bestand block',
      title: '',
      special: 0,
      download_text: 'Download',
      file: '',
      status: true,
      pageId: null
    }
  };
  var blockTypes = {};
  angular.forEach(blockSettings, function (block, blockName) {
    blockTypes[blockName] = angular.merge(blocks[blockName], block);
  });
  return blockTypes;
}