;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "9b9b5b2a-d524-4aab-804a-4c18f2e228ba", e._sentryDebugIdIdentifier = "sentry-dbid-9b9b5b2a-d524-4aab-804a-4c18f2e228ba");
  } catch (e) {
  }
}
;
import { b as useApiContext, u as useTranslation, a as addResourceBundles, _ as __variableDynamicImportRuntimeHelper } from "./StoreProvider-CqQrndhS.js";
import { jsx } from "preact/jsx-runtime";
import { a as useTermsOfServiceAcceptanceInfos, u as useTermsOfServiceStatus } from "./useTermsOfServiceStatus-BV9TFHKl.js";
import { E as EmbeddedStatus } from "./EmbeddedStatus-DOl241T2.js";
function ManageTermsOfServiceComponent({
  legalEntityId,
  onClick
}) {
  const { rootLegalEntityId: currentLegalEntityId } = useApiContext();
  currentLegalEntityId.value = legalEntityId;
  const { i18n, t } = useTranslation(["ui", "contract"]);
  const { isLoading: isLoadingSigned, data: signedData } = useTermsOfServiceAcceptanceInfos();
  const { isLoading: isLoadingUnsigned, data: unsignedData } = useTermsOfServiceStatus();
  addResourceBundles(i18n, [
    { ns: "ui", importFn: (lang) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../ui/language/bg-BG.json": () => import("./bg-BG-zZhDshGi.js"), "../../ui/language/cs-CZ.json": () => import("./cs-CZ-Ck22NTT9.js"), "../../ui/language/da-DK.json": () => import("./da-DK-DQ4ZYSea.js"), "../../ui/language/de-DE.json": () => import("./de-DE-CkbOZ6S_.js"), "../../ui/language/el-GR.json": () => import("./el-GR-DudORw4U.js"), "../../ui/language/en-US.json": () => import("./en-US-CjjPhkB5.js"), "../../ui/language/es-ES.json": () => import("./es-ES-BAolMrZ0.js"), "../../ui/language/et-EE.json": () => import("./et-EE-BOIrYrz9.js"), "../../ui/language/fi-FI.json": () => import("./fi-FI-D8WrLxxq.js"), "../../ui/language/fr-FR.json": () => import("./fr-FR-Beljeilc.js"), "../../ui/language/hr-HR.json": () => import("./hr-HR-lIHN6Yl2.js"), "../../ui/language/hu-HU.json": () => import("./hu-HU-CWdwNCev.js"), "../../ui/language/it-IT.json": () => import("./it-IT-5a7NHVFo.js"), "../../ui/language/ja-JP.json": () => import("./ja-JP-DSvZhFNY.js"), "../../ui/language/lt-LT.json": () => import("./lt-LT-CgalYpUh.js"), "../../ui/language/lv-LV.json": () => import("./lv-LV-aAd9SEqx.js"), "../../ui/language/nl-NL.json": () => import("./nl-NL-CmURERx_.js"), "../../ui/language/no-NO.json": () => import("./no-NO-qyqWODMp.js"), "../../ui/language/pl-PL.json": () => import("./pl-PL-q9azN24o.js"), "../../ui/language/pt-BR.json": () => import("./pt-BR-BxoOF8jB.js"), "../../ui/language/pt-PT.json": () => import("./pt-PT-pIChDwiI.js"), "../../ui/language/ro-RO.json": () => import("./ro-RO-DRsaNX9j.js"), "../../ui/language/sk-SK.json": () => import("./sk-SK-7-enbO1N.js"), "../../ui/language/sl-SI.json": () => import("./sl-SI-DTvJT7fC.js"), "../../ui/language/sv-SE.json": () => import("./sv-SE-N-Hqwcjq.js") }), `../../ui/language/${lang}.json`, 5) },
    { ns: "contract", importFn: (lang) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../Contract/language/bg-BG.json": () => import("./bg-BG-K7feXvEc.js"), "../../Contract/language/cs-CZ.json": () => import("./cs-CZ-CYQO0o5V.js"), "../../Contract/language/da-DK.json": () => import("./da-DK-CGWvmdkq.js"), "../../Contract/language/de-DE.json": () => import("./de-DE-DHDJhahG.js"), "../../Contract/language/el-GR.json": () => import("./el-GR-DHNlnOwf.js"), "../../Contract/language/en-US.json": () => import("./en-US-DoiQhi0j.js"), "../../Contract/language/es-ES.json": () => import("./es-ES-CxnsKEh4.js"), "../../Contract/language/et-EE.json": () => import("./et-EE-BQixWUEV.js"), "../../Contract/language/fi-FI.json": () => import("./fi-FI-57-xkioo.js"), "../../Contract/language/fr-FR.json": () => import("./fr-FR-BxiX8Zfi.js"), "../../Contract/language/hr-HR.json": () => import("./hr-HR-BynZTNSB.js"), "../../Contract/language/hu-HU.json": () => import("./hu-HU-BtRIDozk.js"), "../../Contract/language/it-IT.json": () => import("./it-IT-masgjk9F.js"), "../../Contract/language/ja-JP.json": () => import("./ja-JP-vv3-YsHU.js"), "../../Contract/language/lt-LT.json": () => import("./lt-LT-2BMif2Bk.js"), "../../Contract/language/lv-LV.json": () => import("./lv-LV-CHdEDRVO.js"), "../../Contract/language/nl-NL.json": () => import("./nl-NL-D1b5RUJ0.js"), "../../Contract/language/no-NO.json": () => import("./no-NO-Dkh4SWbB.js"), "../../Contract/language/pl-PL.json": () => import("./pl-PL-BkGihn5Q.js"), "../../Contract/language/pt-BR.json": () => import("./pt-BR-BRdIEO2O.js"), "../../Contract/language/pt-PT.json": () => import("./pt-PT-BfL7qUzo.js"), "../../Contract/language/ro-RO.json": () => import("./ro-RO-C2yBVFht.js"), "../../Contract/language/sk-SK.json": () => import("./sk-SK-C74EF23u.js"), "../../Contract/language/sl-SI.json": () => import("./sl-SI-CvUzNn9Z.js"), "../../Contract/language/sv-SE.json": () => import("./sv-SE-BsLkPEzn.js") }), `../../Contract/language/${lang}.json`, 5) }
  ]);
  const signed = signedData?.data?.map((d) => d.type);
  const unsigned = unsignedData?.termsOfServiceTypes;
  const hasSignedAll = signed?.length !== 0 && unsigned?.length === 0;
  const isLoading = isLoadingSigned && isLoadingUnsigned;
  const title = t(($) => $["serviceAgreements"], { ns: "contract" });
  return hasSignedAll ? /* @__PURE__ */ jsx(
    EmbeddedStatus,
    {
      onClick,
      title,
      tag: { text: t(($) => $["complete"]), variant: "green" },
      loading: isLoading
    }
  ) : /* @__PURE__ */ jsx(
    EmbeddedStatus,
    {
      onClick,
      actionIndicator: { text: t(($) => $["accept"], { ns: "contract" }) },
      title,
      loading: isLoading
    }
  );
}
export {
  ManageTermsOfServiceComponent as M
};
