/**
 * @package Bee Real Estate
 */

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

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

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

jQuery(document).ready(function ($) {
  var bee_real_estate_adminUrl = beerealestateRedirectDemoPage.admin_url;

  var bee_real_estate_targetUrl = bee_real_estate_adminUrl + "themes.php?page=bee-real-estate";

  var bee_real_estate_currentPage = window.location.href;

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

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