/**
 * @package Theme Bee
 */

jQuery(document).ready(function ($) {
  $("#dashboard-changelog-button").click(function (e) {
    e.stopPropagation();
    $("#bee-corp-dashboard-offcanvas").addClass("open");
    $(".wrap").addClass("overlay");
  });

  $("#dialog-close").click(function (e) {
    e.stopPropagation();
    $("#bee-corp-dashboard-offcanvas").removeClass("open");
    $(".wrap").removeClass("overlay");
  });

  $(document).on("click", function (e) {
    if (
      !$("#bee-corp-dashboard-offcanvas").is(e.target) &&
      $("#bee-corp-dashboard-offcanvas").has(e.target).length === 0
    ) {
      $("#bee-corp-dashboard-offcanvas").removeClass("open");
      $(".wrap").removeClass("overlay");
    }
  });
});

jQuery(document).ready(function ($) {
  var bee_corp_adminUrl = beecorpRedirectDemoPage.admin_url;

  var bee_corp_targetUrl = bee_corp_adminUrl + "themes.php?page=bee-corp";

  var bee_corp_currentPage = window.location.href;

  $(".dashboard-header-nav ul li").each(function () {
    var pageURL = $(this).find("a").attr("href");
    $;
    if (bee_corp_currentPage === pageURL) {
      $(this).addClass("active");
    }
  });

  if (bee_corp_currentPage === bee_corp_targetUrl) {
    $(".dashboard-header-nav ul li:first").addClass("active");
  }
});