"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _lodash = _interopRequireDefault(require("lodash"));

var AlphaCrypt = /*#__PURE__*/function () {
  /**
   *
   * @param {Object} config
   * @param {String} config.secretKey
   */
  function AlphaCrypt(config) {
    (0, _classCallCheck2["default"])(this, AlphaCrypt);
    this.config = _lodash["default"].extend({
      secretKey: "Cyberhack2010"
    }, config);
  }
  /**
   *
   * @param {String} text
   */


  (0, _createClass2["default"])(AlphaCrypt, [{
    key: "encode",
    value: function encode(text) {
      //#######################################################################################

      /** Change Text To Hex Variable **/
      var firstFase = Buffer.from(text).toString("hex"); //#######################################################################################

      /** Replacing Variable To Algortm Symbol * */

      var twoStep = firstFase.replaceAll("a", "@").replaceAll("b", "?").replaceAll("c", "-").replaceAll("d", "!").replaceAll("e", "^").replaceAll("f", "&").replaceAll("g", "(").replaceAll("h", ".").replaceAll("i", ";").replaceAll("j", ":").replaceAll("k", "]").replaceAll("l", "#").replaceAll("m", "%").replaceAll("n", ",").replaceAll("o", "{").replaceAll("p", "|").replaceAll("q", "+").replaceAll("r", "'").replaceAll("s", "=").replaceAll("t", '"').replaceAll("u", "/").replaceAll("v", "*").replaceAll("w", ")").replaceAll("x", "[").replaceAll("y", "}").replaceAll("z", ">").replaceAll(" ", "~"); //#######################################################################################

      /** Convert Variable Replacing To Base 64 String **/

      var treeStep = Buffer.from(twoStep).toString("hex"); //#######################################################################################

      var fourStep = treeStep.replaceAll(1, "a").replaceAll(2, "?").replaceAll(3, "-").replaceAll(4, "!").replaceAll(5, "^").replaceAll(6, "&").replaceAll(7, "(").replaceAll(8, ".").replaceAll(9, ";").replaceAll(0, ":"); //#######################################################################################

      /** Replacing Variable To Algortm Symbol */

      return fourStep;
    }
  }, {
    key: "decode",
    value: function decode(text) {
      var firstStep = text.replaceAll("a", 1).replaceAll("?", 2).replaceAll("-", 3).replaceAll("!", 4).replaceAll("^", 5).replaceAll("&", 6).replaceAll("(", 7).replaceAll(".", 8).replaceAll(";", 9).replaceAll(":", 0);
      var twoStep = Buffer.from(firstStep, "hex").toString("utf-8");
      var treeStep = twoStep.replaceAll("@", "a").replaceAll("?", "b").replaceAll("-", "c").replaceAll("!", "d").replaceAll("^", "e").replaceAll("&", "f").replaceAll("(", "g").replaceAll(".", "h").replaceAll(";", "i").replaceAll(":", "j").replaceAll("]", "k").replaceAll("#", "l").replaceAll("%", "m").replaceAll(",", "n").replaceAll("{", "o").replaceAll("|", "p").replaceAll("+", "q").replaceAll("'", "r").replaceAll("=", "s").replaceAll('"', "t").replaceAll("/", "u").replaceAll("*", "v").replaceAll(")", "w").replaceAll("[", "x").replaceAll("}", "y").replaceAll(">", "z").replaceAll("~", " ");
      /** Convert to Replacing 2 Step Hex **/

      var fourStep = Buffer.from(treeStep, "hex").toString("utf-8");
      return fourStep;
    }
  }]);
  return AlphaCrypt;
}();

var _default = AlphaCrypt;
exports["default"] = _default;
//# sourceMappingURL=index.js.map