var App;
(window.jQuery = window.$ = jQuery),
  (App = {
    init: function () {
      $(".slick-banner").slick({
        autoplay: !0,
        autoplaySpeed: 4e3,
        dots: !0,
        responsive: [{ breakpoint: 1440, settings: { arrows: !1 } }],
      }),
        $("#banner-cover").slick({
          dots: !1,
          arrows: !0,
          slidesToShow: 3,
          slidesPerRow: 1,
          variableWidth: !0,
          infinite: !1,
        }),
        $(".set-slick-1").slick({
          dots: !1,
          arrows: !0,
          slidesPerRow: 1,
          infinite: !1,
          responsive: [{ breakpoint: 768, settings: { dots: !0, arrows: !1 } }],
        }),
        $(".set-slick-2").slick({
          dots: !1,
          arrows: !0,
          slidesToShow: 4,
          slidesToScroll: 4,
          autoplay: !0,
          autoplaySpeed: 4e3,
          infinite: !0,
          responsive: [
            {
              breakpoint: 768,
              settings: {
                dots: !1,
                arrows: !0,
                slidesToShow: 2,
                slidesToScroll: 2,
                autoplaySpeed: 2e3,
              },
            },
            {
              breakpoint: 520,
              settings: {
                dots: !1,
                arrows: !0,
                slidesToShow: 1,
                slidesToScroll: 1,
                autoplaySpeed: 2e3,
              },
            },
          ],
        }),
        $(".set-slick-3").slick({
          dots: !1,
          arrows: !0,
          slidesToShow: 6,
          slidesToScroll: 6,
          infinite: !1,
          responsive: [
            {
              breakpoint: 1e3,
              settings: {
                dots: !0,
                arrows: !1,
                slidesToShow: 4,
                slidesToScroll: 4,
              },
            },
            {
              breakpoint: 748,
              settings: {
                dots: !0,
                arrows: !1,
                slidesToShow: 3,
                slidesToScroll: 3,
              },
            },
            {
              breakpoint: 500,
              settings: {
                dots: !0,
                arrows: !1,
                slidesToShow: 2,
                slidesToScroll: 2,
              },
            },
          ],
        }),
        $(".zoom-image").elevateZoom({
          tint: !0,
          tintColour: "#F90",
          tintOpacity: 0.5,
          zoomWindowHeight: 200,
          zoomWindowWidth: 200,
          zoomWindowPosition: 1,
        }),
        $(document).on("click", ".btn", function (e) {
          $(this).toggleClass("active");
        }),
        $(document).on("click", ".btn-green", function (e) {
          $(this).closest(".form-group").next().fadeToggle();
        }),
        $(document).on("click", ".navbar-toggle", function (e) {
          $("#navbar").slideToggle(250), $(this).toggleClass("active");
        }),
        $(document).on("click _mouseenter", ".caret-plus", function (e) {
          $(".search-adv-container", "#search-adv").slideToggle(
            250,
            function () {
              $("#search-adv").toggleClass("opened");
            }
          );
        }),
        $(document).on("click touchend", ".speaker", function () {}),
        $("#player").on("ended", function () {
          $(".speaker").removeClass("speaker-play");
        }),
        $(document).on("click", ".load-more", function (e) {
          var o = $(this).parents(".sec-album"),
            n = o.find(".timeline");
          $.ajax({
            url: "album.json.php",
            data: {},
            dataType: "json",
            jsonp: "$callback",
            beforeSend: function () {
              App.blockUI(o);
            },
            success: function (e) {
              $("#tmpl-artista-list").tmpl(e.album).appendTo(n),
                $(".hidden").fadeIn(500);
            },
            complete: function () {
              App.unblockUI(o);
            },
            cache: !1,
          });
        });
    },
    blockUI: function (e) {
      (e = e || $("body")),
        $(e).block({
          message: '<div class="blockLoader"><i class="spinner"><i></div>',
          css: { border: "none", backgroundColor: "none" },
          overlayCSS: { backgroundColor: "#FFF", opacity: 0.5, cursor: "wait" },
        });
    },
    unblockUI: function (e) {
      (e = e || $("body")), $(e), $(e).unblock();
    },
  }),
  $(App.init),
  (function (o, n) {
    "function" == typeof define && define.amd
      ? define(["jquery"], function (e) {
          return n(o, e);
        })
      : "object" == typeof exports
      ? n(o, require("jquery"))
      : n(o, o.jQuery || o.Zepto);
  })(this, function (e, s) {
    "use strict";
    function r(e) {
      if (
        y &&
        "none" === e.css("animation-name") &&
        "none" === e.css("-webkit-animation-name") &&
        "none" === e.css("-moz-animation-name") &&
        "none" === e.css("-o-animation-name") &&
        "none" === e.css("-ms-animation-name")
      )
        return 0;
      for (
        var o,
          n =
            e.css("animation-duration") ||
            e.css("-webkit-animation-duration") ||
            e.css("-moz-animation-duration") ||
            e.css("-o-animation-duration") ||
            e.css("-ms-animation-duration") ||
            "0s",
          a =
            e.css("animation-delay") ||
            e.css("-webkit-animation-delay") ||
            e.css("-moz-animation-delay") ||
            e.css("-o-animation-delay") ||
            e.css("-ms-animation-delay") ||
            "0s",
          t =
            e.css("animation-iteration-count") ||
            e.css("-webkit-animation-iteration-count") ||
            e.css("-moz-animation-iteration-count") ||
            e.css("-o-animation-iteration-count") ||
            e.css("-ms-animation-iteration-count") ||
            "1",
          n = n.split(", "),
          a = a.split(", "),
          t = t.split(", "),
          i = 0,
          s = n.length,
          r = Number.NEGATIVE_INFINITY;
        i < s;
        i++
      )
        r < (o = parseFloat(n[i]) * parseInt(t[i], 10) + parseFloat(a[i])) &&
          (r = o);
      return o;
    }
    function c() {
      if (s(document.body).height() <= s(window).height()) return 0;
      var e,
        o,
        n = document.createElement("div"),
        a = document.createElement("div");
      return (
        (n.style.visibility = "hidden"),
        (n.style.width = "100px"),
        document.body.appendChild(n),
        (e = n.offsetWidth),
        (n.style.overflow = "scroll"),
        (a.style.width = "100%"),
        n.appendChild(a),
        (o = a.offsetWidth),
        n.parentNode.removeChild(n),
        e - o
      );
    }
    function a() {
      var e, o, n, a;
      C ||
        ((n = s("html")),
        (a = p("is-locked")),
        n.hasClass(a) &&
          ((o = s(document.body)),
          (e = parseInt(o.css("padding-right"), 10) - c()),
          o.css("padding-right", e + "px"),
          n.removeClass(a)));
    }
    function l(e, o, n, a) {
      var t = p("is", o),
        i = [
          p("is", k.CLOSING),
          p("is", k.OPENING),
          p("is", k.CLOSED),
          p("is", k.OPENED),
        ].join(" ");
      e.$bg.removeClass(i).addClass(t),
        e.$overlay.removeClass(i).addClass(t),
        e.$wrapper.removeClass(i).addClass(t),
        e.$modal.removeClass(i).addClass(t),
        (e.state = o),
        n || e.$modal.trigger({ type: o, reason: a }, [{ reason: a }]);
    }
    function d(e, o, n) {
      function a(e) {
        e.target === this && i++;
      }
      function t(e) {
        e.target === this &&
          0 == --i &&
          (s.each(["$bg", "$overlay", "$wrapper", "$modal"], function (e, o) {
            n[o].off(g + " " + v);
          }),
          o());
      }
      var i = 0;
      s.each(["$bg", "$overlay", "$wrapper", "$modal"], function (e, o) {
        n[o].on(g, a).on(v, t);
      }),
        e(),
        0 === r(n.$bg) &&
          0 === r(n.$overlay) &&
          0 === r(n.$wrapper) &&
          0 === r(n.$modal) &&
          (s.each(["$bg", "$overlay", "$wrapper", "$modal"], function (e, o) {
            n[o].off(g + " " + v);
          }),
          o());
    }
    function u(n) {
      n.state !== k.CLOSED &&
        (s.each(["$bg", "$overlay", "$wrapper", "$modal"], function (e, o) {
          n[o].off(g + " " + v);
        }),
        n.$bg.removeClass(n.settings.modifier),
        n.$overlay.removeClass(n.settings.modifier).hide(),
        n.$wrapper.hide(),
        a(),
        l(n, k.CLOSED, !0));
    }
    function p() {
      for (var e = t, o = 0; o < arguments.length; ++o) e += "-" + arguments[o];
      return e;
    }
    function o() {
      var e,
        o,
        n = location.hash.replace("#", "");
      if (n) {
        try {
          o = s(
            "[data-" + f + "-id=" + n.replace(new RegExp("/", "g"), "\\/") + "]"
          );
        } catch (e) {}
        o &&
          o.length &&
          (e = s[f].lookup[o.data(f)]) &&
          e.settings.hashTracking &&
          e.open();
      } else m && m.state === k.OPENED && m.settings.hashTracking && m.close();
    }
    function i(e, o) {
      var n = s(document.body),
        a = this;
      (a.settings = s.extend({}, $, o)),
        (a.index = s[f].lookup.push(a) - 1),
        (a.state = k.CLOSED),
        (a.$overlay = s("." + p("overlay"))),
        a.$overlay.length ||
          ((a.$overlay = s("<div>")
            .addClass(p("overlay") + " " + p("is", k.CLOSED))
            .hide()),
          n.append(a.$overlay)),
        (a.$bg = s("." + p("bg")).addClass(p("is", k.CLOSED))),
        (a.$modal = e
          .addClass(
            t +
              " " +
              p("is-initialized") +
              " " +
              a.settings.modifier +
              " " +
              p("is", k.CLOSED)
          )
          .attr("tabindex", "-1")),
        (a.$wrapper = s("<div>")
          .addClass(
            p("wrapper") + " " + a.settings.modifier + " " + p("is", k.CLOSED)
          )
          .hide()
          .append(a.$modal)),
        n.append(a.$wrapper),
        a.$wrapper.on(
          "click." + t,
          "[data-" + f + '-action="/close"]',
          function (e) {
            e.preventDefault(), a.close();
          }
        ),
        a.$wrapper.on(
          "click." + t,
          "[data-" + f + '-action="/cancel"]',
          function (e) {
            e.preventDefault(),
              a.$modal.trigger(w),
              a.settings.closeOnCancel && a.close(w);
          }
        ),
        a.$wrapper.on(
          "click." + t,
          "[data-" + f + '-action="/confirm"]',
          function (e) {
            e.preventDefault(),
              a.$modal.trigger(b),
              a.settings.closeOnConfirm && a.close(b);
          }
        ),
        a.$wrapper.on("click." + t, function (e) {
          s(e.target).hasClass(p("wrapper")) &&
            a.settings.closeOnOutsideClick &&
            a.close();
        });
    }
    var m,
      h,
      n,
      f = "remodal",
      t = (e.REMODAL_GLOBALS && e.REMODAL_GLOBALS.NAMESPACE) || f,
      g = s
        .map(
          [
            "animationstart",
            "webkitAnimationStart",
            "MSAnimationStart",
            "oAnimationStart",
          ],
          function (e) {
            return e + "." + t;
          }
        )
        .join(" "),
      v = s
        .map(
          [
            "animationend",
            "webkitAnimationEnd",
            "MSAnimationEnd",
            "oAnimationEnd",
          ],
          function (e) {
            return e + "." + t;
          }
        )
        .join(" "),
      $ = s.extend(
        {
          hashTracking: !0,
          closeOnConfirm: !0,
          closeOnCancel: !0,
          closeOnEscape: !0,
          closeOnOutsideClick: !0,
          modifier: "",
        },
        e.REMODAL_GLOBALS && e.REMODAL_GLOBALS.DEFAULTS
      ),
      k = {
        CLOSING: "closing",
        CLOSED: "closed",
        OPENING: "opening",
        OPENED: "opened",
      },
      b = "confirmation",
      w = "cancellation",
      y =
        void 0 !== (n = document.createElement("div").style).animationName ||
        void 0 !== n.WebkitAnimationName ||
        void 0 !== n.MozAnimationName ||
        void 0 !== n.msAnimationName ||
        void 0 !== n.OAnimationName,
      C = /iPad|iPhone|iPod/.test(navigator.platform);
    (i.prototype.open = function () {
      var e,
        o,
        n,
        a,
        t,
        i = this;
      i.state !== k.OPENING &&
        i.state !== k.CLOSING &&
        ((e = i.$modal.attr("data-" + f + "-id")) &&
          i.settings.hashTracking &&
          ((h = s(window).scrollTop()), (location.hash = e)),
        m && m !== i && u(m),
        (m = i),
        C ||
          ((a = s("html")),
          (t = p("is-locked")),
          a.hasClass(t) ||
            ((n = s(document.body)),
            (o = parseInt(n.css("padding-right"), 10) + c()),
            n.css("padding-right", o + "px"),
            a.addClass(t))),
        i.$bg.addClass(i.settings.modifier),
        i.$overlay.addClass(i.settings.modifier).show(),
        i.$wrapper.show().scrollTop(0),
        i.$modal.focus(),
        d(
          function () {
            l(i, k.OPENING);
          },
          function () {
            l(i, k.OPENED);
          },
          i
        ));
    }),
      (i.prototype.close = function (e) {
        var o = this;
        o.state !== k.OPENING &&
          o.state !== k.CLOSING &&
          (o.settings.hashTracking &&
            o.$modal.attr("data-" + f + "-id") === location.hash.substr(1) &&
            ((location.hash = ""), s(window).scrollTop(h)),
          d(
            function () {
              l(o, k.CLOSING, !1, e);
            },
            function () {
              o.$bg.removeClass(o.settings.modifier),
                o.$overlay.removeClass(o.settings.modifier).hide(),
                o.$wrapper.hide(),
                a(),
                l(o, k.CLOSED, !1, e);
            },
            o
          ));
      }),
      (i.prototype.getState = function () {
        return this.state;
      }),
      (i.prototype.destroy = function () {
        var e = s[f].lookup;
        u(this),
          this.$wrapper.remove(),
          delete e[this.index],
          0 ===
            s.grep(e, function (e) {
              return !!e;
            }).length &&
            (this.$overlay.remove(),
            this.$bg.removeClass(
              p("is", k.CLOSING) +
                " " +
                p("is", k.OPENING) +
                " " +
                p("is", k.CLOSED) +
                " " +
                p("is", k.OPENED)
            ));
      }),
      (s[f] = { lookup: [] }),
      (s.fn[f] = function (n) {
        var a, t;
        return (
          this.each(function (e, o) {
            null == (t = s(o)).data(f)
              ? ((a = new i(t, n)),
                t.data(f, a.index),
                a.settings.hashTracking &&
                  t.attr("data-" + f + "-id") === location.hash.substr(1) &&
                  a.open())
              : (a = s[f].lookup[t.data(f)]);
          }),
          a
        );
      }),
      s(document).ready(function () {
        s(document).on("click", "[data-" + f + "-target]", function (e) {
          e.preventDefault();
          var o = e.currentTarget.getAttribute("data-" + f + "-target"),
            n = s("[data-" + f + "-id=" + o + "]");
          s[f].lookup[n.data(f)].open();
        }),
          s(document)
            .find("." + t)
            .each(function (e, o) {
              var n = s(o),
                a = n.data(f + "-options");
              a
                ? ("string" == typeof a || a instanceof String) &&
                  (a = (function (e) {
                    for (
                      var o,
                        n,
                        a = {},
                        t = 0,
                        i = (o = (e = e
                          .replace(/\s*:\s*/g, ":")
                          .replace(/\s*,\s*/g, ",")).split(",")).length;
                      t < i;
                      t++
                    )
                      (o[t] = o[t].split(":")),
                        ("string" == typeof (n = o[t][1]) ||
                          n instanceof String) &&
                          (n = "true" === n || ("false" !== n && n)),
                        ("string" == typeof n || n instanceof String) &&
                          (n = isNaN(n) ? n : +n),
                        (a[o[t][0]] = n);
                    return a;
                  })(a))
                : (a = {}),
                n[f](a);
            }),
          s(document).on("keydown." + t, function (e) {
            m &&
              m.settings.closeOnEscape &&
              m.state === k.OPENED &&
              27 === e.keyCode &&
              m.close();
          }),
          s(window).on("hashchange." + t, o);
      });
  });
var funcoes = {
    init: function () {
      this.selectAllCheckbox(),
        this.previewPhoto(),
        this.previewImagens(),
        this.changeImgUpload(),
        this.removeItenUpload(),
        this.clearInputFile(),
        this.removeAvatar(),
        this.showHideMenuUser(),
        this.desmarcarNotificacao(),
        this.modalLogin(),
        this.lightbox(),
        this.mascarasDeFormularios(),
        this.changeColorSelectSearch();
    },
    mascarasDeFormularios: function () {
      $(".vdate").mask("00/00/0000"),
        $(".vcep").mask("00000-000", { reverse: !0 }),
        $(".vtel").mask("(00) 0000-00000"),
        $(".vcpf").mask("000.000.000-00", { reverse: !0 }),
        $(".vcnpj").mask("00.000.000/0000-00", { reverse: !0 }),
        $(".vrg").mask("00.000.000-0", { reverse: !0 }),
        $(".vmoney").mask("000.000.000.000.000,00", { reverse: !0 }),
        $(".vnota").mask("00.0", { reverse: !0 });
    },
    selectAllCheckbox: function () {
      $("body").on("change", "#select-all", function () {
        console.log("teste"),
          $(".table-notification input:checkbox").prop(
            "checked",
            $(this).prop("checked")
          ),
          $(".table .chk-area").hasClass("chk-unchecked")
            ? $(".table .chk-area")
                .removeClass("chk-unchecked")
                .addClass("chk-checked")
            : $(".table .chk-area")
                .addClass("chk-unchecked")
                .removeClass("chk-checked");
      });
    },
    previewPhoto: function () {
      $("#input-preview-album").on("change", function () {
        var o, e;
        "undefined" != typeof FileReader
          ? ((o = $(".image-holder")).empty(),
            ((e = new FileReader()).onload = function (e) {
              $("<img />", {
                src: e.target.result,
                class: "thumb-image",
              }).appendTo(o);
            }),
            o.show(),
            e.readAsDataURL($(this)[0].files[0]))
          : alert("Este navegador nao suporta FileReader.");
      });
    },
    previewImagens: function () {
      $(".sys-input-preview-album").on("change", function () {
        var o, e;
        "undefined" != typeof FileReader
          ? ((o = $(this).parent().find(".image-holder")).empty(),
            ((e = new FileReader()).onload = function (e) {
              $("<img />", {
                src: e.target.result,
                class: "thumb-image",
              }).appendTo(o);
            }),
            o.show(),
            e.readAsDataURL($(this)[0].files[0]))
          : alert("Este navegador nao suporta FileReader.");
      });
    },
    changeImgUpload: function () {
      $("#files").on("change", funcoes.handleFileSelect);
    },
    handleFileSelect: function (e) {
      var o = e.target.files;
      funcoes.removeItenUpload(o);
      for (var n, a = [], t = 0; (n = o[t]); t++)
        a.push("<li ><strong>" + escape(n.name) + "</strong></li>");
      $(".anexos").html(a.join(""));
    },
    removeItenUpload: function (e) {
      var o, n;
      null != e &&
        ((o = []).push(e),
        (n = jQuery.makeArray(o[0])),
        $(".anexos").on("click", ".icon-trash", function (e) {
          var o = $(this).parent().index();
          $(this).parent().remove(),
            console.log(o),
            n.splice(o, 1),
            console.log(n);
        }));
    },
    clearInputFile: function () {
      $(".clear-anexos").on("click", function () {
        $("#files").val(""), $("ul.anexos li").remove();
      });
    },
    removeAvatar: function () {
      $(".excluir-avatar").on("click", function () {
        $("#input-preview-album").val(""), $(".image-holder img").remove();
      });
    },
    showHideMenuUser: function () {
      $(".hamburguer").on("click", function () {
        $(".menu-users").toggleClass("show-menu");
      });
    },
    desmarcarNotificacao: function () {
      $(".table-notification tr").on("click", function () {
        $(this).removeClass("mgs-nao-lida"), $(this).find(".tag-new").remove();
      });
    },
    modalLogin: function () {
      $("[data-remodal-id=login]").remodal({ modifier: "with-red-theme" });
    },
    lightbox: function () {
      $(".lightbox").fancybox();
    },
    changeColorSelectSearch: function () {
      $(".form-search select").on("change", function () {
        $(this).css({ color: "#6D6D6D" }),
          "" == this.value &&
            (console.log("default"), $(this).css({ color: "#bdbcbc" }));
      });
    },
  },
  busca = {
    getGravadoras: function () {
      // var n,
      //   a = $("[name=gravadora]");
      // 0 < a.length &&
      //   ((n = '<option value="">Gravadoras</option>'),
      //   $.ajax({ url: base_url + "Ajax/gravadoras", dataType: "JSON" }).done(
      //     function (e) {
      //       var o = busca.getParameterByName("gravadora");
      //       e.itens.forEach(function (e) {
      //         n =
      //           o == e.id
      //             ? n +
      //               '<option value="' +
      //               e.id +
      //               '" selected="selected">' +
      //               e.SNOME +
      //               "</option>"
      //             : n + '<option value="' + e.id + '">' + e.SNOME + "</option>";
      //       }),
      //         a.html(n);
      //     }
      //   ));
    },
    getParameterByName: function (e, o) {
      (o = o || window.location.href), (e = e.replace(/[\[\]]/g, "\\$&"));
      var n = new RegExp("[?&]" + e + "(=([^&#]*)|&|#|$)").exec(o);
      return n
        ? n[2]
          ? decodeURIComponent(n[2].replace(/\+/g, " "))
          : ""
        : null;
    },
  };
$(function () {
  $(".lazy").Lazy({
    onError: function (e) {
      var o = e.attr("src");
      o && e.attr("src", o), console.log("onErrorLazyLoad");
    },
  }),
    funcoes.init(),
    busca.getGravadoras();
});
