import { jsx as e, jsxs as r, Fragment as D } from "react/jsx-runtime";
import { useState as j, useCallback as K, useEffect as H } from "react";
import { useTranslation as E } from "react-i18next";
import { useNavigate as O, useLocation as q, Outlet as U, useOutletContext as L } from "react-router-dom";
import { v as W, P as Y } from "./index-CeEMms9z.js";
import { U as G } from "./UnderlinedTabs-BEbz4Kre.js";
import { Loader2 as J, Info as R, Server as Q, Shield as X, FileText as P, Mail as F, Cloud as V, Database as z, HardDrive as B, CheckCircle2 as S, CircleSlash as w, Key as Z, Clock as _, Monitor as ee, BarChart3 as T, Send as te, RefreshCw as re } from "lucide-react";
const M = [
  { id: "infrastructure", labelKey: "appsettings.tabs.infrastructure", icon: Q, route: "/administration/configuration/appsettings/infrastructure" },
  { id: "authentication", labelKey: "appsettings.tabs.authentication", icon: X, route: "/administration/configuration/appsettings/authentication" },
  { id: "logging", labelKey: "appsettings.tabs.logging", icon: P, route: "/administration/configuration/appsettings/logging" },
  { id: "email", labelKey: "appsettings.tabs.email", icon: F, route: "/administration/configuration/appsettings/email" },
  { id: "entra", labelKey: "appsettings.tabs.entra", icon: V, route: "/administration/configuration/appsettings/entra" }
];
function me() {
  const { t } = E("admin"), f = O(), o = q(), [v, b] = j([]), [h, x] = j(!0), y = K(async () => {
    try {
      x(!0);
      const l = (await W.settings.getAll()).filter(
        (d) => d.source === "AppSettings" || d.source === "Environment" || d.source === "Computed"
      );
      b(l);
    } catch (a) {
      console.error("Failed to load settings:", a);
    } finally {
      x(!1);
    }
  }, []);
  H(() => {
    y();
  }, [y]);
  const c = () => {
    const a = o.pathname;
    return M.find((d) => a.includes(d.id))?.id || "infrastructure";
  }, n = (a) => {
    const l = M.find((d) => d.id === a);
    l && f(l.route);
  };
  return h ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ e(J, { className: "w-8 h-8 animate-spin text-[var(--color-accent-600)]" }) }) : /* @__PURE__ */ e(
    Y,
    {
      title: t("appsettings.title"),
      subtitle: t("appsettings.subtitle"),
      breadcrumbs: [
        { label: t("header.title"), href: "/administration" },
        { label: t("appsettings.title") }
      ],
      children: /* @__PURE__ */ r("div", { className: "space-y-6", children: [
        /* @__PURE__ */ e("div", { className: "bg-[var(--info-bg)] border border-[var(--info-border)] rounded-[var(--radius-card)] p-4", children: /* @__PURE__ */ r("div", { className: "flex items-start gap-3", children: [
          /* @__PURE__ */ e(R, { className: "w-5 h-5 text-[var(--info-text)] flex-shrink-0 mt-0.5" }),
          /* @__PURE__ */ r("div", { children: [
            /* @__PURE__ */ e("h4", { className: "font-medium text-[var(--info-text)]", children: t("appsettings.readonlyBannerTitle") }),
            /* @__PURE__ */ e("p", { className: "text-sm text-[var(--info-text)] opacity-90 mt-1", children: t("appsettings.readonlyBannerDescription") })
          ] })
        ] }) }),
        /* @__PURE__ */ e(
          G,
          {
            tabs: M.map((a) => ({
              id: a.id,
              label: t(a.labelKey),
              icon: /* @__PURE__ */ e(a.icon, { className: "w-4 h-4" })
            })),
            activeTab: c(),
            onTabChange: n,
            ariaLabel: t("appsettings.tabs.label", "Onglets des paramètres applicatifs")
          }
        ),
        /* @__PURE__ */ e(U, { context: { settings: v, refreshSettings: y } })
      ] })
    }
  );
}
function pe() {
  const { t } = E("admin"), { settings: f } = L(), o = f.filter((s) => s.category === "Database"), v = f.filter((s) => s.category === "Storage"), b = v.filter((s) => s.key.startsWith("Local") || s.key === "Provider"), h = v.filter((s) => s.key.startsWith("Azure")), x = v.find((s) => s.key === "Provider")?.value, y = o.find((s) => s.key === "Server")?.value, c = o.find((s) => s.key === "DatabaseName")?.value, n = x === "Azure", a = x === "Local" || x === "FileSystem", l = (s) => {
    const i = `${s.category}.${s.key}`, p = () => {
      if (s.isSensitive) return "********";
      const m = s.displayValue || s.value;
      return s.valueType === "Bool" ? t(m === "true" || m === "Yes" ? "common.yes" : "common.no") : m;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.${s.category}.${s.key}`, s.key) }),
            s.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.${s.category}.${s.key}`, s.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${s.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: p() }) })
        ]
      },
      i
    );
  }, d = (s, i, p, m, g, u, N = "neutral", k) => {
    const $ = m;
    if (p.length === 0) return null;
    const A = N === "inactive", I = N === "active";
    let C = "border-[var(--border-color)]";
    return I ? C = "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : A && (C = "border-[var(--border-color)]"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${C} bg-[var(--bg-card)] overflow-hidden shadow-sm ${A ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${g} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${u}`, children: /* @__PURE__ */ e($, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: s }),
            I && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.active", "Actif")
            ] }),
            A && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
              /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
              t("appsettings.notUsed", "Non utilisé")
            ] }),
            k && /* @__PURE__ */ r("span", { className: "text-xs text-[var(--text-secondary)] ml-1", children: [
              "(",
              k,
              ")"
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: i })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: p.map(l) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.sections.database", "Database") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(z, { className: "w-5 h-5 text-[var(--info-text)]" }),
          c || "N/A"
        ] }),
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] mt-1", children: y })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Storage.Provider", "Storage Provider") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          n ? /* @__PURE__ */ e(V, { className: "w-5 h-5 text-[var(--info-text)]" }) : /* @__PURE__ */ e(B, { className: "w-5 h-5 text-[var(--info-text)]" }),
          x || "N/A"
        ] })
      ] })
    ] }),
    d(
      t("appsettings.sections.database", "Database"),
      t("appsettings.sections.databaseDescription", "SQL Server database configuration"),
      o,
      z,
      "from-[var(--info-bg)] to-[var(--info-dot)]/5",
      "bg-[var(--info-bg)] text-[var(--info-text)]",
      "active"
    ),
    d(
      t("appsettings.sections.localStorage", "Local Storage"),
      t("appsettings.sections.localStorageDescription", "File system storage configuration"),
      b.filter((s) => s.key !== "Provider"),
      B,
      a ? "from-[var(--success-bg)] to-[var(--success-dot)]/5" : "from-[var(--bg-secondary)] to-[var(--border-color)]",
      a ? "bg-[var(--success-bg)] text-[var(--success-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-secondary)]",
      a ? "active" : "inactive",
      a ? x : void 0
    ),
    d(
      t("appsettings.sections.azureStorage", "Azure Blob Storage"),
      t("appsettings.sections.azureStorageDescription", "Cloud storage configuration"),
      h,
      V,
      n ? "from-[var(--success-bg)] to-[var(--success-dot)]/5" : "from-[var(--bg-secondary)] to-[var(--border-color)]",
      n ? "bg-[var(--success-bg)] text-[var(--success-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-secondary)]",
      n ? "active" : "inactive",
      n ? "Azure" : void 0
    ),
    o.length === 0 && v.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
const ae = () => /* @__PURE__ */ e("svg", { className: "w-5 h-5", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M11.4 24H0V12.6h11.4V24zM24 24H12.6V12.6H24V24zM11.4 11.4H0V0h11.4v11.4zm12.6 0H12.6V0H24v11.4z" }) }), se = () => /* @__PURE__ */ r("svg", { className: "w-5 h-5", viewBox: "0 0 24 24", fill: "currentColor", children: [
  /* @__PURE__ */ e("path", { d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" }),
  /* @__PURE__ */ e("path", { d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" }),
  /* @__PURE__ */ e("path", { d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" }),
  /* @__PURE__ */ e("path", { d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" })
] });
function ge() {
  const { t } = E("admin"), { settings: f } = L(), o = f.filter((a) => a.category === "Authentication"), v = f.filter((a) => a.category === "Session"), b = o.filter(
    (a) => a.key.startsWith("Jwt") || a.key.includes("Token")
  ), h = o.find((a) => a.key === "MicrosoftOAuth")?.value === "true", x = o.find((a) => a.key === "GoogleOAuth")?.value === "true", y = (a) => {
    const l = `${a.category}.${a.key}`, d = () => {
      if (a.isSensitive) return "********";
      const s = a.displayValue || a.value;
      return a.valueType === "Bool" ? t(s === "true" || s === "Yes" ? "common.yes" : "common.no") : s;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Authentication.${a.key}`, { defaultValue: a.key }) }),
            a.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Authentication.${a.key}`, { defaultValue: a.description }) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${a.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: d() }) })
        ]
      },
      l
    );
  }, c = (a, l, d, s, i, p, m = "neutral", g) => {
    const u = s;
    if (d.length === 0) return null;
    const N = m === "inactive", k = m === "active";
    let $ = "border-[var(--border-color)]";
    return k ? $ = "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : N && ($ = "border-[var(--border-color)]"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${$} bg-[var(--bg-card)] overflow-hidden shadow-sm ${N ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${i} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${p}`, children: /* @__PURE__ */ e(u, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: a }),
            k && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.configured", "Configuré")
            ] }),
            N && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
              /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
              t("appsettings.notConfigured", "Non configuré")
            ] }),
            g
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: l })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: d.map(y) })
    ] });
  }, n = (a, l, d, s) => /* @__PURE__ */ e("div", { className: `rounded-lg border ${l ? "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : "border-[var(--border-color)] opacity-50"} bg-[var(--bg-card)] p-4`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
    /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${s}`, children: /* @__PURE__ */ e(d, {}) }),
    /* @__PURE__ */ r("div", { className: "flex-1", children: [
      /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ e("span", { className: "font-semibold text-[var(--text-primary)]", children: a }),
        l ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
          /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
          t("appsettings.configured", "Configuré")
        ] }) : /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
          /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
          t("appsettings.notConfigured", "Non configuré")
        ] })
      ] }),
      /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: l ? t("appsettings.oauthConfiguredDesc", "OAuth authentication is enabled") : t("appsettings.oauthNotConfiguredDesc", "ClientId not configured in appsettings.json") })
    ] })
  ] }) });
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)] mb-4", children: t("appsettings.sections.oauthProviders", "OAuth Providers") }),
      /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
        n("Microsoft", h, ae, "bg-[var(--info-bg)] text-[var(--info-text)]"),
        n("Google", x, se, "bg-[var(--error-bg)] text-[var(--error-text)]")
      ] })
    ] }),
    c(
      t("appsettings.sections.jwt", "JWT Configuration"),
      t("appsettings.sections.jwtDescription", "JSON Web Token settings for authentication"),
      b,
      Z,
      "from-[var(--info-500)]/10 to-[var(--info-600)]/5",
      "bg-[var(--info-bg)] text-[var(--info-text)]",
      "active"
    ),
    c(
      t("appsettings.sections.session", "Session"),
      t("appsettings.sections.sessionDescription", "User session timeout and validation settings"),
      v,
      _,
      "from-[var(--warning-500)]/10 to-[var(--warning-600)]/5",
      "bg-[var(--warning-bg)] text-[var(--warning-text)]",
      "active"
    ),
    o.length === 0 && v.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function xe() {
  const { t } = E("admin"), { settings: f } = L(), o = f.filter((i) => i.category === "Logging"), v = o.filter(
    (i) => i.key.includes("File") || i.key.includes("Rolling") || i.key.includes("Retention")
  ), b = o.filter((i) => i.key.includes("Seq")), h = o.filter((i) => i.key.includes("AppInsights")), x = o.filter((i) => i.key.includes("Level") || i.key.includes("Minimum")), y = o.find((i) => i.key === "ConsoleEnabled")?.value === "true", c = o.find((i) => i.key === "FileEnabled")?.value === "true", n = o.find((i) => i.key === "SeqEnabled")?.value === "true", a = o.find((i) => i.key === "AppInsightsEnabled")?.value === "true", l = (i) => {
    const p = `${i.category}.${i.key}`, m = () => {
      if (i.isSensitive) return "********";
      const g = i.displayValue || i.value;
      return i.valueType === "Bool" ? t(g === "true" || g === "Yes" ? "common.yes" : "common.no") : g;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Logging.${i.key}`, i.key) }),
            i.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Logging.${i.key}`, i.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${i.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: m() }) })
        ]
      },
      p
    );
  }, d = (i, p, m, g, u, N, k = "neutral") => {
    const $ = g;
    if (m.length === 0) return null;
    const A = k === "inactive", I = k === "active";
    let C = "border-[var(--border-color)]";
    return I ? C = "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : A && (C = "border-[var(--border-color)]"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${C} bg-[var(--bg-card)] overflow-hidden shadow-sm ${A ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${u} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${N}`, children: /* @__PURE__ */ e($, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: i }),
            I && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            A && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
              /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: p })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: m.map(l) })
    ] });
  }, s = (i, p, m, g) => {
    const u = m;
    return /* @__PURE__ */ e("div", { className: `rounded-lg border ${p ? "border-[var(--success-border)]" : "border-[var(--border-color)] opacity-50"} bg-[var(--bg-card)] p-4`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
      /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${g}`, children: /* @__PURE__ */ e(u, { className: "w-5 h-5" }) }),
      /* @__PURE__ */ r("div", { className: "flex-1", children: [
        /* @__PURE__ */ e("span", { className: "font-semibold text-[var(--text-primary)]", children: i }),
        p ? /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)]", children: [
          /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
          t("appsettings.enabled", "Activé")
        ] }) : /* @__PURE__ */ r("span", { className: "ml-2 inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)]", children: [
          /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
          t("appsettings.disabled", "Désactivé")
        ] })
      ] })
    ] }) });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)] mb-4", children: t("appsettings.sections.loggingSinks", "Logging Sinks") }),
      /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
        s("Console", y, ee, "bg-[var(--bg-secondary)] text-[var(--text-secondary)]"),
        s("File", c, P, "bg-[var(--info-bg)] text-[var(--info-text)]"),
        s("Seq", n, z, "bg-[var(--info-bg)] text-[var(--info-text)]"),
        s("App Insights", a, T, "bg-[var(--info-bg)] text-[var(--info-text)]")
      ] })
    ] }),
    d(
      t("appsettings.sections.logLevels", "Log Levels"),
      t("appsettings.sections.logLevelsDescription", "Minimum log level configuration"),
      x,
      T,
      "from-[var(--success-500)]/10 to-[var(--success-600)]/5",
      "bg-[var(--success-bg)] text-[var(--success-text)]",
      "neutral"
    ),
    d(
      t("appsettings.sections.fileLogging", "File Logging"),
      t("appsettings.sections.fileLoggingDescription", "File-based log output configuration"),
      v,
      P,
      c ? "from-[var(--info-500)]/10 to-[var(--info-600)]/5" : "from-[var(--text-muted)]/10 to-[var(--text-muted)]/5",
      c ? "bg-[var(--info-bg)] text-[var(--info-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-muted)]",
      c ? "active" : "inactive"
    ),
    b.length > 0 && d(
      t("appsettings.sections.seqLogging", "Seq"),
      t("appsettings.sections.seqLoggingDescription", "Seq structured logging server"),
      b,
      z,
      n ? "from-[var(--info-500)]/10 to-[var(--info-600)]/5" : "from-[var(--text-muted)]/10 to-[var(--text-muted)]/5",
      n ? "bg-[var(--info-bg)] text-[var(--info-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-muted)]",
      n ? "active" : "inactive"
    ),
    h.length > 0 && d(
      t("appsettings.sections.appInsights", "Application Insights"),
      t("appsettings.sections.appInsightsDescription", "Azure Application Insights telemetry"),
      h,
      T,
      a ? "from-[var(--info-500)]/10 to-[var(--info-600)]/5" : "from-[var(--text-muted)]/10 to-[var(--text-muted)]/5",
      a ? "bg-[var(--info-bg)] text-[var(--info-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-muted)]",
      a ? "active" : "inactive"
    ),
    o.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function be() {
  const { t } = E("admin"), { settings: f } = L(), o = f.filter((c) => c.category === "Email"), v = o.find((c) => c.key === "Enabled")?.value === "true", b = o.find((c) => c.key === "Provider")?.value, h = o.find((c) => c.key === "FromEmail")?.value, x = (c) => {
    const n = `${c.category}.${c.key}`, a = () => {
      if (c.isSensitive) return "********";
      const l = c.displayValue || c.value;
      return c.valueType === "Bool" ? t(l === "true" || l === "Yes" ? "common.yes" : "common.no") : l;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Email.${c.key}`, c.key) }),
            c.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Email.${c.key}`, c.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${c.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: a() }) })
        ]
      },
      n
    );
  }, y = (c, n, a, l, d, s, i = "neutral") => {
    const p = l;
    if (a.length === 0) return null;
    const m = i === "inactive", g = i === "active";
    let u = "border-[var(--border-color)]";
    return g ? u = "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : m && (u = "border-[var(--border-color)]"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${u} bg-[var(--bg-card)] overflow-hidden shadow-sm ${m ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${d} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${s}`, children: /* @__PURE__ */ e(p, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: c }),
            g && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            m && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
              /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: n })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: a.map(x) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${v ? "border-[var(--success-border)]" : "border-[var(--border-color)] opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.status", "Status") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: v ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-[var(--success-text)]" }),
          t("appsettings.enabled", "Activé")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(w, { className: "w-5 h-5 text-[var(--text-tertiary)]" }),
          t("appsettings.disabled", "Désactivé")
        ] }) })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Email.Provider", "Provider") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(te, { className: "w-5 h-5 text-[var(--warning-text)]" }),
          b || "N/A"
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Email.FromEmail", "From Email") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(F, { className: "w-5 h-5 text-[var(--warning-text)]" }),
          /* @__PURE__ */ e("span", { className: "truncate", children: h || "N/A" })
        ] })
      ] })
    ] }),
    y(
      t("appsettings.sections.emailConfiguration", "Email Configuration"),
      t("appsettings.sections.emailConfigurationDescription", "SMTP and email provider settings"),
      o,
      F,
      v ? "from-[var(--warning-bg)] to-[var(--warning-dot)]/5" : "from-[var(--bg-secondary)] to-[var(--border-color)]",
      v ? "bg-[var(--warning-bg)] text-[var(--warning-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-secondary)]",
      v ? "active" : "inactive"
    ),
    o.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
function ue() {
  const { t } = E("admin"), { settings: f } = L(), o = f.filter((n) => n.category === "Entra"), v = o.find((n) => n.key === "SyncEnabled")?.value === "true", b = o.find((n) => n.key === "Configured")?.value === "true", h = o.find((n) => n.key === "SyncIntervalMinutes")?.value, x = o.find((n) => n.key === "UseDeltaSync")?.value === "true", y = (n) => {
    const a = `${n.category}.${n.key}`, l = () => {
      if (n.isSensitive) return "********";
      const d = n.displayValue || n.value;
      return n.valueType === "Bool" ? t(d === "true" || d === "Yes" ? "common.yes" : "common.no") : d;
    };
    return /* @__PURE__ */ r(
      "div",
      {
        className: "flex items-center justify-between py-3 border-b border-[var(--border-color)] last:border-0",
        children: [
          /* @__PURE__ */ r("div", { className: "flex-1 min-w-0 pr-4", children: [
            /* @__PURE__ */ e("span", { className: "font-medium text-[var(--text-primary)]", children: t(`appsettings.keys.Entra.${n.key}`, n.key) }),
            n.description && /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)] mt-1", children: t(`appsettings.descriptions.Entra.${n.key}`, n.description) })
          ] }),
          /* @__PURE__ */ e("div", { className: "text-right max-w-[50%]", children: /* @__PURE__ */ e("span", { className: `font-mono text-sm break-all ${n.isSensitive ? "text-[var(--text-tertiary)]" : "text-[var(--text-primary)]"}`, children: l() }) })
        ]
      },
      a
    );
  }, c = (n, a, l, d, s, i, p = "neutral") => {
    const m = d;
    if (l.length === 0) return null;
    const g = p === "inactive", u = p === "active";
    let N = "border-[var(--border-color)]";
    return u ? N = "border-[var(--success-border)] ring-1 ring-[var(--success-dot)]/20" : g && (N = "border-[var(--border-color)]"), /* @__PURE__ */ r("div", { className: `rounded-[var(--radius-card)] border ${N} bg-[var(--bg-card)] overflow-hidden shadow-sm ${g ? "opacity-50" : ""}`, children: [
      /* @__PURE__ */ e("div", { className: `px-6 py-4 bg-gradient-to-r ${s} border-b border-[var(--border-color)]`, children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ e("div", { className: `p-2 rounded-lg ${i}`, children: /* @__PURE__ */ e(m, { className: "w-5 h-5" }) }),
        /* @__PURE__ */ r("div", { className: "flex-1", children: [
          /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ e("h3", { className: "text-lg font-semibold text-[var(--text-primary)]", children: n }),
            u && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--success-bg)] text-[var(--success-text)] border border-[var(--success-border)]", children: [
              /* @__PURE__ */ e(S, { className: "w-3 h-3" }),
              t("appsettings.enabled", "Activé")
            ] }),
            g && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full bg-[var(--bg-secondary)] text-[var(--text-secondary)] border border-[var(--border-color)]", children: [
              /* @__PURE__ */ e(w, { className: "w-3 h-3" }),
              t("appsettings.disabled", "Désactivé")
            ] })
          ] }),
          /* @__PURE__ */ e("p", { className: "text-sm text-[var(--text-secondary)]", children: a })
        ] })
      ] }) }),
      /* @__PURE__ */ e("div", { className: "px-6 py-2", children: l.map(y) })
    ] });
  };
  return /* @__PURE__ */ r("div", { className: "space-y-6", children: [
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-4 gap-4", children: [
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${b ? "border-[var(--success-border)]" : "border-[var(--border-color)] opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.configuration", "Configuration") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: b ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-[var(--success-text)]" }),
          t("appsettings.configured", "Configuré")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(w, { className: "w-5 h-5 text-[var(--text-muted)]" }),
          t("appsettings.notConfigured", "Non configuré")
        ] }) })
      ] }),
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${v ? "border-[var(--success-border)]" : "border-[var(--border-color)] opacity-50"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.SyncEnabled", "Sync Status") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(re, { className: `w-5 h-5 ${v ? "text-[var(--success-text)]" : "text-[var(--text-muted)]"}` }),
          v ? t("appsettings.enabled", "Activé") : t("appsettings.disabled", "Désactivé")
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "rounded-lg border border-[var(--border-color)] bg-[var(--bg-card)] p-4", children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.SyncIntervalMinutes", "Sync Interval") }),
        /* @__PURE__ */ r("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: [
          /* @__PURE__ */ e(V, { className: "w-5 h-5 text-[var(--info-text)]" }),
          h ? `${h} min` : "N/A"
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: `rounded-lg border ${x ? "border-[var(--success-border)]" : "border-[var(--border-color)]"} bg-[var(--bg-card)] p-4`, children: [
        /* @__PURE__ */ e("div", { className: "text-xs text-[var(--text-secondary)] uppercase tracking-wider mb-1", children: t("appsettings.keys.Entra.UseDeltaSync", "Delta Sync") }),
        /* @__PURE__ */ e("div", { className: "text-lg font-semibold text-[var(--text-primary)] flex items-center gap-2", children: x ? /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(S, { className: "w-5 h-5 text-[var(--success-text)]" }),
          t("common.yes", "Oui")
        ] }) : /* @__PURE__ */ r(D, { children: [
          /* @__PURE__ */ e(w, { className: "w-5 h-5 text-[var(--text-muted)]" }),
          t("common.no", "Non")
        ] }) })
      ] })
    ] }),
    c(
      t("appsettings.sections.entraConfiguration", "Microsoft Entra ID"),
      t("appsettings.sections.entraConfigurationDescription", "Azure AD synchronization settings"),
      o,
      V,
      b ? "from-[var(--info-500)]/10 to-[var(--info-600)]/5" : "from-[var(--text-muted)]/10 to-[var(--text-muted)]/5",
      b ? "bg-[var(--info-bg)] text-[var(--info-text)]" : "bg-[var(--bg-secondary)] text-[var(--text-muted)]",
      b ? "active" : "inactive"
    ),
    o.length === 0 && /* @__PURE__ */ e("div", { className: "text-center py-12 text-[var(--text-secondary)]", children: t("appsettings.noSettings") })
  ] });
}
export {
  me as AppSettingsPage,
  ge as AuthenticationSection,
  be as EmailSection,
  ue as EntraSection,
  pe as InfrastructureSection,
  xe as LoggingSection
};
//# sourceMappingURL=index-Ch2gAGqP.js.map
