import { jsx as a, jsxs as r, Fragment as F } from "react/jsx-runtime";
import { useState as A, useEffect as G, useCallback as R } from "react";
import { useTranslation as Y } from "react-i18next";
import { useSearchParams as W } from "react-router-dom";
import { L as Z, M as _, O as z, Q, b as X } from "./index-Dh9kUeDn.js";
import { Loader2 as V, AlertTriangle as T, ShieldCheck as q, Key as H, Zap as J, Users as B, Building as ee, Calendar as ae, Server as te, Monitor as re, Layers as se, Shield as ne, CheckCircle as I, Infinity as ie, Clock as le, X as j, Unlock as ce, Lock as oe } from "lucide-react";
const de = {
  blue: "bg-[var(--info-bg)] text-[var(--info-text)] border-[var(--info-border)]",
  green: "bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]",
  yellow: "bg-[var(--warning-bg)] text-[var(--warning-text)] border-[var(--warning-border)]",
  red: "bg-[var(--error-bg)] text-[var(--error-text)] border-[var(--error-border)]",
  neutral: "bg-[var(--bg-secondary)] text-[var(--text-primary)] border-[var(--border-color)]"
};
function me(e) {
  return e.status === "NoLicense" || e.isReadOnlyMode ? "red" : e.isInGracePeriod || e.isInTrial && e.trialDaysRemaining <= 7 || e.status === "Active" && e.daysUntilExpiration <= 30 ? "yellow" : e.status === "Active" ? "green" : "red";
}
function ue(e) {
  if (e.isPerpetual) return "green";
  const t = e.isInTrial ? e.trialDaysRemaining : e.daysUntilExpiration;
  return t <= 15 ? "red" : t <= 30 ? "yellow" : "green";
}
function U(e) {
  return e ? new Date(e).toLocaleDateString(void 0, {
    year: "numeric",
    month: "long",
    day: "numeric"
  }) : "-";
}
function xe(e, t) {
  const s = me(e), n = e.isInTrial ? e.trialDaysRemaining : e.daysUntilExpiration, i = ue(e);
  return [
    {
      label: t("license.info.edition", "Edition"),
      value: t(`license.edition.${e.edition.toLowerCase()}`, e.edition),
      icon: ne,
      color: "blue"
    },
    {
      label: t("license.info.status", "Status"),
      value: e.isInGracePeriod ? t("license.page.gracePeriod", "Grace Period") : t(`license.status.${e.status.toLowerCase()}`, e.status),
      icon: e.isReadOnlyMode ? T : I,
      color: s
    },
    {
      label: t("license.page.daysRemaining", "Days remaining"),
      value: e.isPerpetual ? "∞" : n.toString(),
      icon: e.isPerpetual ? ie : le,
      color: i
    },
    {
      label: t("license.page.maxUsers", "Max Users"),
      value: e.limits.users > 0 ? e.limits.users.toString() : t("license.page.unlimited", "Unlimited"),
      icon: B,
      color: "blue"
    }
  ];
}
function ge({
  showTrialSuccess: e,
  isInGracePeriod: t,
  validationResult: s,
  gracePeriodDays: n,
  onTrialSuccessClose: i,
  onValidationResultClear: l,
  t: d
}) {
  return /* @__PURE__ */ r(F, { children: [
    e && /* @__PURE__ */ r("div", { className: "flex items-center gap-3 p-4 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg animate-in fade-in slide-in-from-top", children: [
      /* @__PURE__ */ a(I, { className: "w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0" }),
      /* @__PURE__ */ a("div", { className: "flex-1", children: /* @__PURE__ */ a("p", { className: "text-sm font-medium text-green-900 dark:text-green-300", children: d("license.trial.successBanner", "Your 30-day trial is activated!") }) }),
      /* @__PURE__ */ a(
        "button",
        {
          onClick: i,
          className: "text-green-600 dark:text-green-400 hover:text-green-700 dark:hover:text-green-300",
          children: /* @__PURE__ */ a(j, { className: "w-4 h-4" })
        }
      )
    ] }),
    t && /* @__PURE__ */ r("div", { className: "flex items-center gap-3 p-4 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg", children: [
      /* @__PURE__ */ a(T, { className: "w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0" }),
      /* @__PURE__ */ a("div", { className: "flex-1", children: /* @__PURE__ */ a("p", { className: "text-sm font-medium text-amber-900 dark:text-amber-300", children: d("license.page.gracePeriodBanner", "Your license has expired. You are in a {{days}}-day grace period. Renew to avoid service interruption.", { days: n }) }) })
    ] }),
    s && /* @__PURE__ */ r("div", { className: `flex items-center gap-3 p-4 rounded-lg border ${s.type === "success" ? "bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800" : s.type === "revoked" ? "bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800" : "bg-amber-50 dark:bg-amber-900/20 border-amber-200 dark:border-amber-800"}`, children: [
      s.type === "success" ? /* @__PURE__ */ a(I, { className: "w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0" }) : /* @__PURE__ */ a(T, { className: `w-5 h-5 flex-shrink-0 ${s.type === "revoked" ? "text-red-600 dark:text-red-400" : "text-amber-600 dark:text-amber-400"}` }),
      /* @__PURE__ */ a("p", { className: `text-sm font-medium flex-1 ${s.type === "success" ? "text-green-900 dark:text-green-300" : s.type === "revoked" ? "text-red-900 dark:text-red-300" : "text-amber-900 dark:text-amber-300"}`, children: s.message }),
      /* @__PURE__ */ a(
        "button",
        {
          onClick: l,
          className: s.type === "success" ? "text-green-600 dark:text-green-400 hover:text-green-700 dark:hover:text-green-300" : s.type === "revoked" ? "text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300" : "text-amber-600 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-400",
          children: /* @__PURE__ */ a(j, { className: "w-4 h-4" })
        }
      )
    ] })
  ] });
}
function be({ hasAllFeatures: e, enabledFeatures: t, availableFeatures: s, t: n }) {
  return !s || s.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[var(--text-secondary)] text-sm italic", children: n("license.page.noFeatures", "No features enabled") }) : /* @__PURE__ */ r(F, { children: [
    e && /* @__PURE__ */ r("div", { className: "flex items-center gap-2 p-3 mb-4 bg-[var(--success-bg)] text-[var(--success-text)] rounded-lg border border-[var(--success-border)]", children: [
      /* @__PURE__ */ a(I, { className: "w-5 h-5" }),
      /* @__PURE__ */ a("span", { className: "font-medium", children: n("license.page.allFeatures", "All features enabled") })
    ] }),
    /* @__PURE__ */ a("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: s.map(({ group: i, features: l }) => /* @__PURE__ */ r("div", { children: [
      /* @__PURE__ */ a("h3", { className: "text-sm font-semibold text-[var(--text-secondary)] uppercase tracking-wider mb-3", children: n(`license.group.${i}`, i) }),
      /* @__PURE__ */ a("div", { className: "space-y-2", children: l.map((d) => {
        const u = e || t.some(
          (c) => c.toLowerCase() === d.toLowerCase()
        );
        return /* @__PURE__ */ r(
          "div",
          {
            className: `flex items-center gap-2 px-3 py-2 rounded-lg border ${u ? "bg-[var(--success-bg)] text-[var(--success-text)] border-[var(--success-border)]" : "bg-[var(--bg-secondary)] text-[var(--text-secondary)] border-[var(--border-color)] opacity-60"}`,
            children: [
              u ? /* @__PURE__ */ a(ce, { className: "w-4 h-4 flex-shrink-0" }) : /* @__PURE__ */ a(oe, { className: "w-4 h-4 flex-shrink-0" }),
              /* @__PURE__ */ a("span", { className: "text-sm font-medium", children: n(`license.module.${d}`, d) })
            ]
          },
          d
        );
      }) })
    ] }, i)) }),
    !e && t.length === 0 && /* @__PURE__ */ a("p", { className: "text-[var(--text-secondary)] text-sm italic mt-3", children: n("license.page.noFeatures", "No features enabled") })
  ] });
}
function pe(e, t) {
  const [s, n] = A(!1), [i, l] = A(null), d = R(async () => {
    n(!0), l(null);
    try {
      const c = await X.post(
        "/api/administration/license/validate-server"
      );
      c.revoked ? (l({ type: "revoked", message: t("license.validationRevoked", "The license has been revoked by the server.") }), await e()) : c.valid ? (l({ type: "success", message: t("license.validationSuccess", "License is valid") }), await e()) : l({ type: "error", message: c.error || t("license.validationError", "Unable to validate the license with the server.") });
    } catch {
      l({ type: "error", message: t("license.validationError", "Unable to validate the license with the server.") });
    } finally {
      n(!1), setTimeout(() => l(null), 5e3);
    }
  }, [t, e]), u = R(() => l(null), []);
  return { isValidating: s, validationResult: i, handleValidate: d, clearValidationResult: u };
}
function Ce() {
  const { t: e } = Y("admin"), { license: t, usage: s, isLoading: n, error: i, refreshLicense: l } = Z(), [d, u] = A(!1), [c, m] = W(), [b, x] = A(!1), { isValidating: p, validationResult: k, handleValidate: h, clearValidationResult: M } = pe(l, e);
  if (G(() => {
    l();
  }, [l]), G(() => {
    if (c.get("trial") === "success") {
      x(!0);
      const o = setTimeout(() => {
        x(!1), c.delete("trial"), m(c, { replace: !0 });
      }, 5e3);
      return () => clearTimeout(o);
    }
  }, [c, m]), n)
    return /* @__PURE__ */ a("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ a(V, { className: "w-8 h-8 animate-spin text-[var(--text-secondary)]" }) });
  if (i || !t)
    return /* @__PURE__ */ a("div", { className: "p-6", children: /* @__PURE__ */ r("div", { className: "card p-6 text-center", children: [
      /* @__PURE__ */ a(T, { className: "w-12 h-12 mx-auto mb-4 text-[var(--warning-text)]" }),
      /* @__PURE__ */ a("h2", { className: "text-lg font-semibold mb-2", children: e("license.page.errorTitle", "Unable to load license") }),
      /* @__PURE__ */ a("p", { className: "text-[var(--text-secondary)] mb-4", children: i || e("license.page.errorDesc", "License information is not available.") }),
      /* @__PURE__ */ a(
        "button",
        {
          onClick: () => l(),
          className: "btn-primary px-4 py-2",
          children: e("common.retry", "Retry")
        }
      )
    ] }) });
  const $ = _(t.enabledFeatures), w = xe(t, e);
  return /* @__PURE__ */ r("div", { className: "p-6 space-y-6", children: [
    /* @__PURE__ */ a(
      ge,
      {
        showTrialSuccess: b,
        isInGracePeriod: t.isInGracePeriod,
        validationResult: k,
        gracePeriodDays: t.gracePeriodDays,
        onTrialSuccessClose: () => x(!1),
        onValidationResultClear: M,
        t: e
      }
    ),
    /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
      /* @__PURE__ */ r("div", { children: [
        /* @__PURE__ */ a("h1", { className: "text-2xl font-bold text-[var(--text-primary)]", children: e("license.page.title", "License Management") }),
        /* @__PURE__ */ a("p", { className: "text-[var(--text-secondary)] mt-1", children: e("license.page.subtitle", "View and manage your platform license") })
      ] }),
      /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
        /* @__PURE__ */ a(z, { showDetails: !0 }),
        /* @__PURE__ */ r(
          "button",
          {
            onClick: h,
            disabled: p,
            className: "btn-secondary px-4 py-2 flex items-center gap-2",
            children: [
              p ? /* @__PURE__ */ a(V, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ a(q, { className: "w-4 h-4" }),
              p ? e("license.validating", "Validating...") : e("license.validate", "Validate")
            ]
          }
        ),
        /* @__PURE__ */ r(
          "button",
          {
            onClick: () => u(!0),
            className: "btn-primary px-4 py-2 flex items-center gap-2",
            children: [
              /* @__PURE__ */ a(H, { className: "w-4 h-4" }),
              e("license.activate", "Activate")
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ a("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-4", children: w.map((o) => /* @__PURE__ */ r("div", { className: `card p-4 border ${de[o.color]}`, children: [
      /* @__PURE__ */ r("div", { className: "flex items-center gap-2 mb-2", children: [
        /* @__PURE__ */ a(o.icon, { className: "w-5 h-5 opacity-80" }),
        /* @__PURE__ */ a("span", { className: "text-sm opacity-80", children: o.label })
      ] }),
      /* @__PURE__ */ a("div", { className: "text-2xl font-bold", children: o.value })
    ] }, o.label)) }),
    /* @__PURE__ */ r("div", { className: "card p-6", children: [
      /* @__PURE__ */ r("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
        /* @__PURE__ */ a(J, { className: "w-5 h-5" }),
        e("license.info.limits", "Limits")
      ] }),
      /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
        /* @__PURE__ */ a(
          E,
          {
            icon: B,
            label: e("license.page.usersLimit", "Users"),
            max: t.limits.users,
            current: s?.activeUsers ?? 0,
            margin: 10,
            t: e
          }
        ),
        /* @__PURE__ */ a(
          E,
          {
            icon: ee,
            label: e("license.page.tenantsLimit", "Tenants (B2B)"),
            max: t.limits.tenants,
            current: s?.activeTenants ?? 0,
            margin: 2,
            t: e
          }
        )
      ] }),
      (() => {
        const o = ["users", "tenants", "max_instances", "max_users"], L = Object.entries(t.limits.custom ?? {}).filter(
          ([C]) => !o.includes(C)
        );
        return L.length === 0 ? null : /* @__PURE__ */ r("div", { className: "mt-4 pt-4 border-t border-[var(--border-color)]", children: [
          /* @__PURE__ */ a("h3", { className: "text-sm font-medium text-[var(--text-secondary)] mb-3", children: e("license.page.customLimits", "Custom Limits") }),
          /* @__PURE__ */ a("div", { className: "grid grid-cols-2 md:grid-cols-4 gap-3", children: L.map(([C, P]) => /* @__PURE__ */ r("div", { className: "flex justify-between items-center py-1.5 px-3 bg-[var(--bg-secondary)] rounded-lg", children: [
            /* @__PURE__ */ a("span", { className: "text-sm text-[var(--text-secondary)]", children: C }),
            /* @__PURE__ */ a("span", { className: "text-sm font-medium", children: P })
          ] }, C)) })
        ] });
      })()
    ] }),
    /* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-3 gap-6", children: [
      /* @__PURE__ */ r("div", { className: "card p-6", children: [
        /* @__PURE__ */ r("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
          /* @__PURE__ */ a(ae, { className: "w-5 h-5" }),
          e("license.page.details", "License Details")
        ] }),
        /* @__PURE__ */ r("div", { className: "space-y-3", children: [
          /* @__PURE__ */ a(g, { label: e("license.info.productId", "Product"), value: t.productId }),
          /* @__PURE__ */ a(g, { label: e("license.info.company", "Company"), value: t.companyName || "-" }),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.info.edition", "Edition"),
              value: e(`license.edition.${t.edition.toLowerCase()}`, t.edition)
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.info.status", "Status"),
              value: e(`license.status.${t.status.toLowerCase()}`, t.status)
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.info.activatedAt", "Activated At"),
              value: U(t.activatedAt)
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.info.expiresAt", "Expires At"),
              value: t.isPerpetual ? e("license.page.never", "Never (Perpetual)") : U(t.expiresAt)
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "card p-6", children: [
        /* @__PURE__ */ r("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
          /* @__PURE__ */ a(te, { className: "w-5 h-5" }),
          e("license.page.subscription", "Subscription")
        ] }),
        /* @__PURE__ */ r("div", { className: "space-y-3", children: [
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.licenseType", "License Type"),
              value: t.isPerpetual ? e("license.page.perpetual", "Perpetual") : t.isInTrial ? e("license.edition.trial", "Trial") : e("license.page.subscription", "Subscription")
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.maxUsers", "Max Users"),
              value: t.limits.users > 0 ? t.limits.users.toString() : e("license.page.unlimited", "Unlimited")
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.gracePeriodDays", "Grace Period"),
              value: t.gracePeriodDays > 0 ? e("license.page.gracePeriodValue", "{{days}} days", { days: t.gracePeriodDays }) : e("license.page.noGracePeriod", "None")
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.renewalDate", "Renewal Date"),
              value: U(t.renewalDate)
            }
          ),
          /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.mode", "Mode"),
              value: t.isReadOnlyMode ? e("license.page.readOnly", "Read-only") : t.isInTrial ? e("license.edition.trial", "Trial") : e("license.page.licensed", "Licensed")
            }
          ),
          t.isInGracePeriod && /* @__PURE__ */ a(
            g,
            {
              label: e("license.page.gracePeriodStatus", "Grace Period Status"),
              value: e("license.page.inGracePeriod", "Active"),
              highlight: "yellow"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ r("div", { className: "card p-6", children: [
        /* @__PURE__ */ r("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
          /* @__PURE__ */ a(re, { className: "w-5 h-5" }),
          e("license.page.machineInfo", "Machine")
        ] }),
        /* @__PURE__ */ r("div", { className: "space-y-3", children: [
          /* @__PURE__ */ r("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
            /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ a("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.machineName", "Machine Name") }) }),
            /* @__PURE__ */ a("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: t.machineName || "-" })
          ] }),
          /* @__PURE__ */ r("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
            /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ a("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.instanceId", "Instance ID") }) }),
            /* @__PURE__ */ a("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: t.instanceId || "-" })
          ] }),
          /* @__PURE__ */ r("div", { className: "py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
            /* @__PURE__ */ a("div", { className: "flex justify-between items-center mb-1", children: /* @__PURE__ */ a("span", { className: "text-sm text-[var(--text-secondary)]", children: e("license.page.licenseId", "License ID") }) }),
            /* @__PURE__ */ a("span", { className: "text-xs font-mono text-[var(--text-primary)] break-all", children: t.licenseServerId || "-" })
          ] })
        ] })
      ] })
    ] }),
    /* @__PURE__ */ r("div", { className: "card p-6", children: [
      /* @__PURE__ */ r("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
        /* @__PURE__ */ a(se, { className: "w-5 h-5" }),
        e("license.info.features", "Features")
      ] }),
      /* @__PURE__ */ a(
        be,
        {
          hasAllFeatures: $,
          enabledFeatures: t.enabledFeatures,
          availableFeatures: t.availableFeatures,
          t: e
        }
      )
    ] }),
    /* @__PURE__ */ a(Q, { open: d, onOpenChange: u })
  ] });
}
function g({ label: e, value: t, highlight: s }) {
  return /* @__PURE__ */ r("div", { className: "flex justify-between items-center py-2 border-b border-[var(--border-color)] last:border-b-0", children: [
    /* @__PURE__ */ a("span", { className: "text-sm text-[var(--text-secondary)]", children: e }),
    /* @__PURE__ */ a("span", { className: `text-sm font-medium ${s === "yellow" ? "text-amber-600 dark:text-amber-400 font-semibold" : s === "red" ? "text-red-600 dark:text-red-400 font-semibold" : s === "green" ? "text-green-600 dark:text-green-400 font-semibold" : "text-[var(--text-primary)]"}`, children: t })
  ] });
}
function he(e, t) {
  return e ? "text-red-500" : t ? "text-amber-500" : "text-blue-500";
}
function ve(e, t) {
  return e ? "text-red-500" : t ? "text-amber-500" : "text-[var(--text-primary)]";
}
function E({ icon: e, label: t, max: s, current: n, margin: i = 0, t: l }) {
  const d = s <= 0, u = s - i, c = s, m = 140, b = 12, x = (m - b) / 2, p = m / 2, k = 135, h = 270, M = c > 0 ? Math.min(1, n / c) : 0, $ = c > 0 ? u / c : 1, w = i > 0 && n > u && n <= c, o = n > c;
  let L = "#3b82f6";
  o ? L = "#ef4444" : w && (L = "#f59e0b");
  const C = "rgba(245, 158, 11, 0.25)", P = (f) => {
    const y = f * Math.PI / 180;
    return {
      x: p + x * Math.cos(y),
      y: p + x * Math.sin(y)
    };
  }, S = (f) => {
    if (f <= 0) return "";
    const y = k + f, N = P(k), v = P(y), D = f > 180 ? 1 : 0;
    return `M ${N.x} ${N.y} A ${x} ${x} 0 ${D} 1 ${v.x} ${v.y}`;
  }, O = c > 0 ? Math.round(n / u * 100) : 0;
  return d ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3 py-4", children: [
    /* @__PURE__ */ r("div", { className: "relative", style: { width: m, height: m }, children: [
      /* @__PURE__ */ r("svg", { width: m, height: m, children: [
        /* @__PURE__ */ a(
          "path",
          {
            d: S(h),
            fill: "none",
            stroke: "var(--bg-tertiary)",
            strokeWidth: b,
            strokeLinecap: "round"
          }
        ),
        /* @__PURE__ */ a(
          "path",
          {
            d: S(h),
            fill: "none",
            stroke: "#22c55e",
            strokeWidth: b,
            strokeLinecap: "round",
            opacity: 0.5
          }
        )
      ] }),
      /* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
        /* @__PURE__ */ a(e, { className: "w-6 h-6 text-green-500 mb-1" }),
        /* @__PURE__ */ a("span", { className: "text-lg font-bold text-green-500", children: "∞" })
      ] })
    ] }),
    /* @__PURE__ */ a("span", { className: "text-sm font-medium text-[var(--text-primary)]", children: t }),
    /* @__PURE__ */ a("span", { className: "text-xs text-[var(--text-secondary)]", children: l("license.page.unlimited", "Unlimited") })
  ] }) : /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3 py-4", children: [
    /* @__PURE__ */ r("div", { className: "relative", style: { width: m, height: m }, children: [
      /* @__PURE__ */ r("svg", { width: m, height: m, children: [
        /* @__PURE__ */ a(
          "path",
          {
            d: S(h),
            fill: "none",
            stroke: "var(--bg-tertiary)",
            strokeWidth: b,
            strokeLinecap: "round"
          }
        ),
        i > 0 && (() => {
          const f = h * (1 - $), y = k + h * $, N = P(y), v = P(k + h), D = f > 180 ? 1 : 0, K = `M ${N.x} ${N.y} A ${x} ${x} 0 ${D} 1 ${v.x} ${v.y}`;
          return /* @__PURE__ */ a(
            "path",
            {
              d: K,
              fill: "none",
              stroke: C,
              strokeWidth: b,
              strokeLinecap: "round"
            }
          );
        })(),
        /* @__PURE__ */ a(
          "path",
          {
            d: S(h * M),
            fill: "none",
            stroke: L,
            strokeWidth: b,
            strokeLinecap: "round",
            style: { transition: "stroke 0.3s, d 0.3s" }
          }
        ),
        i > 0 && (() => {
          const f = k + h * $, y = x - b / 2 - 2, N = x + b / 2 + 2, v = f * Math.PI / 180;
          return /* @__PURE__ */ a(
            "line",
            {
              x1: p + y * Math.cos(v),
              y1: p + y * Math.sin(v),
              x2: p + N * Math.cos(v),
              y2: p + N * Math.sin(v),
              stroke: "var(--text-secondary)",
              strokeWidth: 2,
              strokeLinecap: "round"
            }
          );
        })()
      ] }),
      /* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
        /* @__PURE__ */ a(e, { className: `w-5 h-5 mb-0.5 ${he(o, w)}` }),
        /* @__PURE__ */ r("span", { className: `text-2xl font-bold ${ve(o, w)}`, children: [
          O,
          "%"
        ] }),
        /* @__PURE__ */ r("span", { className: "text-xs text-[var(--text-secondary)]", children: [
          n,
          " / ",
          u
        ] })
      ] })
    ] }),
    /* @__PURE__ */ a("span", { className: "text-sm font-medium text-[var(--text-primary)]", children: t }),
    i > 0 && /* @__PURE__ */ r("span", { className: `text-xs ${w || o ? "text-amber-600 dark:text-amber-400" : "text-[var(--text-secondary)]"}`, children: [
      "+",
      i,
      " ",
      l("license.page.tolerance", "tolerance")
    ] })
  ] });
}
export {
  Ce as LicenseManagementPage
};
//# sourceMappingURL=index-7yGylaty.js.map
