/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./dev/admin/addons.js":
/*!*****************************!*\
  !*** ./dev/admin/addons.js ***!
  \*****************************/
/***/ (() => {

eval("(function ($) {\n  // Install WP Adminify Plugin\n  // $('body').on('click', '.wp-adminify-addons-download', function (e) {\n  //     e.preventDefault();\n  //     if (!$(this).hasClass(\"updating-message\")) {\n  //         let plugin = $(this).attr(\"data-plugin\");\n  //         installAdminifyPlugin($(this), plugin);\n  //     }\n  // });\n\n  function installAdminifyPlugin(element, plugin) {\n    element.addClass(\"updating-message\");\n    element.text(\"Installing...\");\n    jQuery.ajax({\n      url: WP_ADMINIFYCORE.admin_ajax,\n      type: \"POST\",\n      data: {\n        action: \"jltwp_adminify_addons_install_active\",\n        type: \"install\",\n        plugin: plugin,\n        nonce: WP_ADMINIFYCORE.addons_nonce\n      },\n      success: function success(response) {\n        setTimeout(function () {\n          element.removeClass(\"updating-message\");\n          element.text(\"Activated\");\n        }, 1000);\n      }\n    });\n  }\n\n  // Recommended Plugins\n  // Install\n  $(\"body\").on(\"click\", \".wp-adminify-addons-wrapper .plugin-action-buttons .install-now\", function (e) {\n    e.preventDefault();\n    if (!$(this).hasClass(\"updating-message\")) {\n      var plugin = $(this).attr(\"data-install-url\");\n      installPlugin($(this), plugin);\n    }\n  });\n\n  // Active\n  $(\"body\").on(\"click\", \".wp-adminify-addons-wrapper .plugin-action-buttons .activate-now\", function () {\n    var file = $(this).attr(\"data-plugin-file\");\n    activatePlugin($(this), file);\n  });\n\n  // Update\n  $(\"body\").on(\"click\", \".wp-adminify-addons-wrapper .plugin-action-buttons .update-now\", function () {\n    if (!$(this).hasClass(\"updating-message\")) {\n      var plugin = $(this).attr(\"data-plugin\");\n      updatePlugin($(this), plugin);\n    }\n  });\n\n  // Tab\n  $(\".filter-links\").on(\"click\", \"a\", function (e) {\n    e.preventDefault();\n    var cls = $(this).data(\"type\");\n    $(this).addClass(\"current\").parent().siblings().find(\"a\").removeClass(\"current\");\n    $(\"#the-list .plugin-card\").each(function (i, el) {\n      if (cls == \"all\") {\n        $(this).removeClass(\"hide\");\n      } else {\n        if ($(this).hasClass(cls)) {\n          $(this).removeClass(\"hide\");\n        } else {\n          $(this).addClass(\"hide\");\n        }\n      }\n    });\n  });\n\n  // Search\n  $(\".wp-adminify-search-plugins #search-plugins\").on(\"keyup\", function () {\n    var value = $(this).val();\n    var srch = new RegExp(value, \"i\");\n    $(\"#the-list .plugin-card\").each(function () {\n      var $this = $(this);\n      if (!($this.find(\".name h3 a, .desc p\").text().search(srch) >= 0)) {\n        $this.addClass(\"hide\");\n      }\n      if ($this.find(\".name h3 a, .desc p\").text().search(srch) >= 0) {\n        $this.removeClass(\"hide\");\n      }\n    });\n  });\n})(jQuery);\nfunction activatePlugin(element, plugin) {\n  element.addClass(\"button-disabled\");\n  element.attr(\"disabled\", \"disabled\");\n  element.text(\"Processing...\");\n  jQuery.ajax({\n    url: WP_ADMINIFYCORE.admin_ajax,\n    type: \"POST\",\n    data: {\n      action: \"jltwp_adminify_addons_activate_plugin\",\n      plugin: plugin,\n      nonce: WP_ADMINIFYCORE.addons_nonce\n    },\n    success: function success(response) {\n      if (response.success === true) {\n        var pluginStatus = jQuery(\".plugin-status .plugin-status-inactive[data-plugin-file='\" + plugin + \"']\");\n        pluginStatus.text(\"Active\");\n        pluginStatus.addClass(\"plugin-status-active\");\n        pluginStatus.removeClass(\"plugin-status-inactive\");\n        element.removeClass(\"active-now\");\n        element.text(\"Activated\");\n      } else {\n        element.removeClass(\"button-disabled\");\n        element.prop(\"disabled\", false);\n        element.text(\"Activated\");\n      }\n    }\n  });\n}\nfunction installPlugin(element, plugin) {\n  element.removeClass(\"button-primary\");\n  element.addClass(\"updating-message\");\n  element.text(\"Installing...\");\n  jQuery.ajax({\n    url: WP_ADMINIFYCORE.admin_ajax,\n    type: \"POST\",\n    data: {\n      action: \"jltwp_adminify_addons_upgrade_plugin\",\n      type: \"install\",\n      plugin: plugin,\n      nonce: WP_ADMINIFYCORE.addons_nonce\n    },\n    success: function success(response) {\n      if (response.success === true) {\n        element.removeClass(\"updating-message\");\n        element.addClass(\"updated-message installed button-disabled\");\n        element.attr(\"disabled\", \"disabled\");\n        element.removeAttr(\"data-install-url\");\n        element.text(\"Installed!\");\n        setTimeout(function () {\n          var pluginStatus = jQuery(\".plugin-status .plugin-status-not-install[data-plugin-url='\" + plugin + \"']\");\n          pluginStatus.text(\"Active\");\n          pluginStatus.addClass(\"plugin-status-active\");\n          pluginStatus.removeClass(\"plugin-status-not-install\");\n          pluginStatus.removeAttr(\"data-install-url\");\n          element.removeClass(\"install-now updated-message installed\");\n          element.text(\"Activated\");\n          element.removeAttr(\"aria-label\");\n        }, 500);\n      } else {\n        element.removeClass(\"updating-message\");\n        element.addClass(\"button-primary\");\n        element.text(\"Install Now\");\n      }\n    }\n  });\n}\nfunction updatePlugin(element, plugin) {\n  element.addClass(\"updating-message\");\n  element.text(\"Updating...\");\n  jQuery.ajax({\n    url: WP_ADMINIFYCORE.admin_ajax,\n    type: \"POST\",\n    data: {\n      action: WP_ADMINIFYCORE.plugin_key + \"_addons_upgrade_plugin\",\n      type: \"update\",\n      plugin: plugin,\n      nonce: WP_ADMINIFYCORE.addons_nonce\n    },\n    success: function success(response) {\n      if (response.success === true) {\n        element.removeClass(\"updating-message\");\n        element.addClass(\"updated-message button-disabled\");\n        element.attr(\"disabled\", \"disabled\");\n        element.text(\"Updated!\");\n        if (response.data.active === false) {\n          var pluginStatus = jQuery(\".plugin-status .plugin-status-inactive[data-plugin-file='\" + plugin + \"']\");\n          pluginStatus.text(\"Active\");\n          pluginStatus.addClass(\"plugin-status-active\");\n          pluginStatus.removeClass(\"plugin-status-inactive\");\n          pluginStatus.removeAttr(\"data-plugin-file\");\n        }\n      } else {\n        element.removeClass(\"updating-message\");\n        element.text(\"Update Now\");\n      }\n    }\n  });\n}\n\n//# sourceURL=webpack://adminify/./dev/admin/addons.js?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = {};
/******/ 	__webpack_modules__["./dev/admin/addons.js"]();
/******/ 	
/******/ })()
;