"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PasswordInput = void 0;
var react_1 = __importStar(require("react"));
var TextInput_1 = require("../TextInput/TextInput");
var material_1 = require("@mui/material");
var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
var VisibilityOff_1 = __importDefault(require("@mui/icons-material/VisibilityOff"));
var IconButton_1 = __importDefault(require("@mui/material/IconButton"));
var PasswordInput = function (_a) {
    var _b = _a.newPassword, newPassword = _b === void 0 ? false : _b, _c = _a.placeholder, placeholder = _c === void 0 ? "Enter your password" : _c, showPasswordDefault = _a.showPasswordDefault, variant = _a.variant, props = __rest(_a, ["newPassword", "placeholder", "showPasswordDefault", "variant"]);
    var autocomplete = newPassword ? "current-password" : "new-password";
    var _d = react_1.useState(showPasswordDefault || false), show = _d[0], setShow = _d[1];
    var toggleShow = function () { return setShow(function (v) { return !v; }); };
    return (react_1.default.createElement(TextInput_1.TextInput, __assign({ variant: variant || "outlined" }, props, { autoComplete: autocomplete, type: show ? "text" : "password", placeholder: placeholder, InputProps: {
            endAdornment: (react_1.default.createElement(material_1.InputAdornment, { position: "end" },
                react_1.default.createElement(IconButton_1.default, { "aria-label": "toggle password visibility", onClick: toggleShow, onMouseDown: toggleShow, style: { padding: 4, marginLeft: 4 }, size: "large" }, show ? react_1.default.createElement(Visibility_1.default, null) : react_1.default.createElement(VisibilityOff_1.default, null)))),
        } })));
};
exports.PasswordInput = PasswordInput;
//# sourceMappingURL=PasswordInput.js.map