import useEngineContext from "../../../../hooks/useEngineContext.js";
import { getDefaultAuthMethods } from "./constants.js";
import locales_default from "./locales.js";
import React from "react";
import { Button } from "antd";
import { locales } from "@pisell/utils";
import classNames from "classnames";
import "./SettingList.less";
//#region src/components/authentication/admin/AuthMethods/SettingList.tsx
const SettingList = ({ className, style, methods: initialMethods, onToggle, onSettings, onConfigClick, enableSetting = true, renderTitle }) => {
	var _context$engine;
	const context = useEngineContext();
	locales.init(locales_default, (context === null || context === void 0 || (_context$engine = context.engine) === null || _context$engine === void 0 || (_context$engine = _context$engine.props) === null || _context$engine === void 0 ? void 0 : _context$engine.locale) || "en");
	const methods = initialMethods || getDefaultAuthMethods();
	const handleSettings = (method) => {
		onSettings === null || onSettings === void 0 || onSettings(method);
	};
	const shouldShowSettings = (method) => {
		if (!enableSetting) return false;
		return true;
	};
	return /* @__PURE__ */ React.createElement("div", {
		className: classNames("setting-list", className),
		style
	}, methods.map((method) => /* @__PURE__ */ React.createElement("div", {
		key: method.id,
		className: "setting-list-item"
	}, /* @__PURE__ */ React.createElement("div", { className: "setting-list-item-icon" }, method.icon), /* @__PURE__ */ React.createElement("div", { className: "setting-list-item-content" }, /* @__PURE__ */ React.createElement("div", { className: "setting-list-item-title" }, renderTitle ? renderTitle(method) : method.title), /* @__PURE__ */ React.createElement("div", { className: "setting-list-item-description" }, method.description)), /* @__PURE__ */ React.createElement("div", { className: "setting-list-item-actions" }, shouldShowSettings(method) && /* @__PURE__ */ React.createElement(Button, {
		type: "default",
		onClick: () => handleSettings(method)
	}, locales.getText("auth.button.settings"))))));
};
//#endregion
export { SettingList as default };
