(function ($) {
  "use strict";

  $(function () {
    var $passwordGroup = $("#show_hide_password");

    if (!$passwordGroup.length) {
      return;
    }

    $passwordGroup.find("a").on("click", function (event) {
      event.preventDefault();

      var $input = $passwordGroup.find("input");
      var $icon = $passwordGroup.find("i");
      var isPassword = $input.attr("type") === "password";

      $input.attr("type", isPassword ? "text" : "password");
      $icon.toggleClass("bi-eye-fill", isPassword);
      $icon.toggleClass("bi-eye-slash-fill", !isPassword);
    });
  });
})(jQuery);
