import { E as compilerRuntimeExports, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-DYNCg6N5.js";
import { aW as useLdapSettingsSyncMutation, m as universalNotification, c as useAppSelector, aT as SettingsEnum } from "./index-DfebxkL9.js";
import { u as useSaveSettings } from "./useSaveSettings-GkZlPEM1.js";
import { g as getValidateErrors } from "./validation-Ds00Zghx.js";
import { u as useStyles } from "./styles-rKP3r-bS.js";
import { k as zte, m as Dze } from "./vendor-icons-xWhXK_Ui.js";
import { u as useTranslation } from "./vendor-i18n-wisIXUFi.js";
import { n as numberType, o as objectType, s as stringType, l as literalType, b as booleanType, u as unionType } from "./types-espwwxTQ.js";
import { z as useForm, W as useMediaQuery, R as Radio, ah as Grid, E as TextInput, ad as NumberInput, a0 as SimpleGrid, ai as Textarea, J as PasswordInput, d as Checkbox, T as Text, F as Flex, k as Tooltip, b as Box, K as Divider, B as Button } from "./vendor-mantine-h0WlM2Mj.js";
import "./styles-3NoIlzov.js";
const useLdapSettingsSync = () => {
  const $ = compilerRuntimeExports.c(6);
  const {
    t
  } = useTranslation();
  const [ldapSync, t0] = useLdapSettingsSyncMutation();
  const {
    isLoading: isLdapSync
  } = t0;
  let t1;
  if ($[0] !== ldapSync || $[1] !== t) {
    t1 = async (id) => {
      try {
        const res = await ldapSync({
          id
        });
        if ("error" in res) {
          universalNotification({
            error: res.error,
            isError: true,
            isSuccess: false
          });
        } else {
          universalNotification({
            isSuccess: true,
            error: null,
            isError: false,
            successTitle: t("filials.authorization.syncStarted")
          });
        }
      } catch (t22) {
        const err = t22;
        console.warn(t("filials.errors.syncError"), err);
      }
    };
    $[0] = ldapSync;
    $[1] = t;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  const SyncSettingsLdap = t1;
  let t2;
  if ($[3] !== SyncSettingsLdap || $[4] !== isLdapSync) {
    t2 = {
      SyncSettingsLdap,
      isLdapSync
    };
    $[3] = SyncSettingsLdap;
    $[4] = isLdapSync;
    $[5] = t2;
  } else {
    t2 = $[5];
  }
  return t2;
};
const useGetLdapSchemes = () => {
  const $ = compilerRuntimeExports.c(4);
  const {
    t
  } = useTranslation();
  let t0;
  if ($[0] !== t) {
    const portSchema = numberType({
      required_error: t("filials.authorization.addPort"),
      invalid_type_error: t("filials.authorization.numberPort")
    }).positive({
      message: t("errors.positive")
    }).lt(65536, {
      message: t("errors.maxValue")
    });
    const noAuthSchema = objectType({
      useLDAP: literalType("false"),
      server: stringType(),
      login: stringType(),
      password: stringType(),
      mapping: objectType({}),
      GroupMapping: objectType({})
    });
    const authSchema = objectType({
      useLDAP: literalType("true"),
      server: stringType().min(1, {
        message: t("errors.enterServer")
      }),
      login: stringType().min(1, {
        message: t("servers.addLogin")
      }),
      password: stringType().min(1, {
        message: t("errors.enterPassword")
      }),
      UseSsl: booleanType().optional(),
      Port: portSchema,
      DN: stringType().min(1, {
        message: t("filials.authorization.dn")
      }),
      Domain: stringType().min(1, {
        message: t("errors.enterDomain")
      }),
      UserFilter: stringType().min(1, {
        message: t("errors.enterFilter")
      }),
      mapping: objectType({
        principal_name: stringType().min(1, {
          message: t("errors.enterGeneralName")
        }),
        login: stringType().min(1, {
          message: t("servers.addLogin")
        }),
        first_name: stringType().min(1, {
          message: t("errors.enterName")
        }),
        second_name: stringType().min(1, {
          message: t("errors.enterLastName")
        }),
        email: stringType().or(literalType("")).optional().nullable(),
        phone: stringType().or(literalType("")).optional().nullable(),
        position: stringType().or(literalType("")).optional().nullable(),
        organization: stringType().or(literalType("")).optional().nullable(),
        city: stringType().or(literalType("")).optional().nullable(),
        isDeleted: stringType().or(literalType("")).optional().nullable(),
        teamNumber: stringType().or(literalType("")).optional().nullable(),
        linkEmail: stringType().or(literalType("")).optional().nullable()
      }),
      GroupEnabled: literalType("false"),
      GroupDn: stringType().optional().nullable(),
      GroupFilter: stringType().optional().nullable(),
      GroupMapping: objectType({})
    });
    const enabledGroupExportSchema = authSchema.extend({
      useLDAP: literalType("true"),
      GroupEnabled: literalType("true"),
      GroupDn: stringType().min(1, {
        message: t("errors.enterDn")
      }),
      GroupFilter: stringType().min(1, {
        message: t("errors.enterGroupFilter")
      }),
      GroupMapping: objectType({
        Description: stringType().optional().nullable(),
        Name: stringType().min(1, {
          message: t("errors.enterName")
        }),
        Uid: stringType().min(1, {
          message: t("errors.enterId")
        }),
        Member: stringType().min(1, {
          message: t("errors.enterUserId")
        })
      })
    });
    t0 = unionType([noAuthSchema, authSchema, enabledGroupExportSchema]);
    $[0] = t;
    $[1] = t0;
  } else {
    t0 = $[1];
  }
  const validateScheme = t0;
  let t1;
  if ($[2] !== validateScheme) {
    t1 = {
      validateScheme
    };
    $[2] = validateScheme;
    $[3] = t1;
  } else {
    t1 = $[3];
  }
  return t1;
};
const initialLDapFormValues = {
  useLDAP: "false",
  server: "",
  login: "",
  password: "",
  Port: 0,
  DN: "",
  Domain: "",
  UserFilter: "",
  UseSsl: false,
  mapping: {
    principal_name: "",
    login: "",
    first_name: "",
    second_name: "",
    middle_name: "",
    email: "",
    phone: "",
    birthdate: "",
    position: "",
    organization: "",
    city: "",
    isDeleted: ""
  },
  GroupEnabled: "false",
  GroupDn: "",
  GroupFilter: "",
  GroupMapping: {
    Description: "",
    Name: "",
    Uid: "",
    Member: ""
  },
  ReferralFollowing: "false"
};
const LDAPPage = () => {
  var _a, _b, _c;
  const $ = compilerRuntimeExports.c(76);
  const {
    classes,
    theme
  } = useStyles();
  const {
    t
  } = useTranslation();
  const {
    filial
  } = useAppSelector(_temp);
  const {
    validateScheme
  } = useGetLdapSchemes();
  const saveSettings = useSaveSettings();
  const {
    SyncSettingsLdap,
    isLdapSync
  } = useLdapSettingsSync();
  let t0;
  if ($[0] !== validateScheme) {
    t0 = {
      initialValues: initialLDapFormValues,
      validateInputOnChange: true,
      validate: (values) => getValidateErrors(validateScheme, values)
    };
    $[0] = validateScheme;
    $[1] = t0;
  } else {
    t0 = $[1];
  }
  const form = useForm(t0);
  let t1;
  if ($[2] !== (filial == null ? void 0 : filial.Settings) || $[3] !== form) {
    t1 = () => {
      const {
        Ldap
      } = (filial == null ? void 0 : filial.Settings) || {};
      if (!Ldap) {
        return;
      }
      const Mapping = (Ldap == null ? void 0 : Ldap.Mapping) || {};
      const GroupMapping = (Ldap == null ? void 0 : Ldap.GroupMapping) || {};
      const formData = {
        useLDAP: `${Ldap.Enabled}`,
        server: Ldap.Server || "",
        login: Ldap.Login || "",
        password: Ldap.Password || "",
        Port: (Ldap == null ? void 0 : Ldap.Port) || 0,
        Domain: (Ldap == null ? void 0 : Ldap.Domain) || "",
        DN: (Ldap == null ? void 0 : Ldap.DN) || "",
        UserFilter: (Ldap == null ? void 0 : Ldap.UserFilter) || "",
        UseSsl: (Ldap == null ? void 0 : Ldap.UseSsl) || false,
        mapping: {
          principal_name: (Mapping == null ? void 0 : Mapping.PrincipalName) || "",
          login: (Mapping == null ? void 0 : Mapping.Login) || "",
          first_name: (Mapping == null ? void 0 : Mapping.FirstName) || "",
          second_name: (Mapping == null ? void 0 : Mapping.SecondName) || "",
          middle_name: (Mapping == null ? void 0 : Mapping.MiddleName) || "",
          email: (Mapping == null ? void 0 : Mapping.Email) || "",
          phone: (Mapping == null ? void 0 : Mapping.Phone) || "",
          birthdate: (Mapping == null ? void 0 : Mapping.BirthDate) || "",
          position: (Mapping == null ? void 0 : Mapping.Position) || "",
          organization: (Mapping == null ? void 0 : Mapping.Organization) || "",
          city: (Mapping == null ? void 0 : Mapping.City) || "",
          teamNumber: (Mapping == null ? void 0 : Mapping.TeamNumber) || "",
          linkEmail: (Mapping == null ? void 0 : Mapping.LinkEmail) || "",
          isDeleted: (Mapping == null ? void 0 : Mapping.IsDeleted) || ""
        },
        GroupEnabled: `${Ldap.GroupEnabled}`,
        GroupDn: Ldap.GroupDn || "",
        GroupFilter: Ldap.GroupFilter || "",
        GroupMapping: {
          Description: (GroupMapping == null ? void 0 : GroupMapping.Description) || "",
          Name: GroupMapping.Name || "",
          Uid: GroupMapping.Uid || "",
          Member: GroupMapping.Member || ""
        },
        ReferralFollowing: `${Ldap.ReferralFollowing}`
      };
      form.setValues(formData);
      form.resetDirty(formData);
    };
    $[2] = filial == null ? void 0 : filial.Settings;
    $[3] = form;
    $[4] = t1;
  } else {
    t1 = $[4];
  }
  let t2;
  if ($[5] !== filial) {
    t2 = [filial];
    $[5] = filial;
    $[6] = t2;
  } else {
    t2 = $[6];
  }
  reactExports.useEffect(t1, t2);
  let t3;
  if ($[7] !== filial || $[8] !== saveSettings) {
    t3 = (formValues) => {
      var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
      if (!filial) {
        return;
      }
      const enabled = formValues.useLDAP === "true";
      const GroupExport = formValues.GroupEnabled === "true";
      const RefferalEnabled = formValues.ReferralFollowing === "true";
      saveSettings(filial.Id, SettingsEnum.Ldap, {
        Ldap: {
          Enabled: enabled,
          Server: enabled ? formValues.server : null,
          Login: enabled ? formValues.login : null,
          Password: enabled ? formValues.password : null,
          Port: enabled ? formValues.Port : null,
          Domain: enabled ? formValues.Domain : null,
          UseSsl: enabled ? formValues.UseSsl : false,
          DN: enabled ? formValues.DN : null,
          UserFilter: enabled ? formValues.UserFilter : null,
          Mapping: {
            PrincipalName: enabled ? (_a2 = formValues.mapping) == null ? void 0 : _a2.principal_name : null,
            Login: enabled ? (_b2 = formValues.mapping) == null ? void 0 : _b2.login : null,
            FirstName: enabled ? (_c2 = formValues.mapping) == null ? void 0 : _c2.first_name : null,
            SecondName: enabled ? (_d = formValues.mapping) == null ? void 0 : _d.second_name : null,
            MiddleName: enabled ? (_e = formValues.mapping) == null ? void 0 : _e.middle_name : null,
            Email: enabled ? (_f = formValues.mapping) == null ? void 0 : _f.email : null,
            Phone: enabled ? (_g = formValues.mapping) == null ? void 0 : _g.phone : null,
            BirthDate: enabled ? (_h = formValues.mapping) == null ? void 0 : _h.birthdate : null,
            Position: enabled ? (_i = formValues.mapping) == null ? void 0 : _i.position : null,
            Organization: enabled ? (_j = formValues.mapping) == null ? void 0 : _j.organization : null,
            City: enabled ? (_k = formValues.mapping) == null ? void 0 : _k.city : null,
            LinkEmail: enabled ? (_l = formValues.mapping) == null ? void 0 : _l.linkEmail : null,
            TeamNumber: enabled ? (_m = formValues.mapping) == null ? void 0 : _m.teamNumber : null,
            IsDeleted: enabled ? (_n = formValues.mapping) == null ? void 0 : _n.isDeleted : null
          },
          GroupEnabled: enabled && GroupExport ? Boolean(GroupExport) : false,
          GroupDn: enabled && GroupExport ? formValues.GroupDn : null,
          GroupFilter: enabled && GroupExport ? formValues.GroupFilter : null,
          GroupMapping: {
            Uid: enabled && GroupExport ? (_o = formValues.GroupMapping) == null ? void 0 : _o.Uid : null,
            Name: enabled && GroupExport ? (_p = formValues.GroupMapping) == null ? void 0 : _p.Name : null,
            Description: enabled && GroupExport ? (_q = formValues.GroupMapping) == null ? void 0 : _q.Description : null,
            Member: enabled && GroupExport ? (_r = formValues.GroupMapping) == null ? void 0 : _r.Member : null
          },
          ReferralFollowing: enabled && RefferalEnabled ? Boolean(RefferalEnabled) : false
        }
      });
    };
    $[7] = filial;
    $[8] = saveSettings;
    $[9] = t3;
  } else {
    t3 = $[9];
  }
  const handleSubmit = t3;
  let t4;
  if ($[10] !== SyncSettingsLdap || $[11] !== filial) {
    t4 = async () => {
      if (filial) {
        await SyncSettingsLdap(filial == null ? void 0 : filial.Id);
      }
    };
    $[10] = SyncSettingsLdap;
    $[11] = filial;
    $[12] = t4;
  } else {
    t4 = $[12];
  }
  const handleRefresh = t4;
  const isMobile = useMediaQuery("(max-width: 576px)");
  const t5 = classes.container;
  let t6;
  if ($[13] !== form || $[14] !== handleSubmit) {
    t6 = form.onSubmit(handleSubmit);
    $[13] = form;
    $[14] = handleSubmit;
    $[15] = t6;
  } else {
    t6 = $[15];
  }
  const t7 = classes.section;
  const t8 = classes.title;
  let t9;
  if ($[16] !== t) {
    t9 = t("filials.authorization.method");
    $[16] = t;
    $[17] = t9;
  } else {
    t9 = $[17];
  }
  let t10;
  if ($[18] !== classes.title || $[19] !== t9) {
    t10 = /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: t8, children: t9 });
    $[18] = classes.title;
    $[19] = t9;
    $[20] = t10;
  } else {
    t10 = $[20];
  }
  let t11;
  if ($[21] !== form) {
    t11 = form.getInputProps("useLDAP");
    $[21] = form;
    $[22] = t11;
  } else {
    t11 = $[22];
  }
  const t12 = classes.radio;
  let t13;
  if ($[23] !== t) {
    t13 = t("filials.authorization.local");
    $[23] = t;
    $[24] = t13;
  } else {
    t13 = $[24];
  }
  let t14;
  if ($[25] !== classes.radio || $[26] !== t13) {
    t14 = /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: t12, size: "xs", label: t13, value: "false" });
    $[25] = classes.radio;
    $[26] = t13;
    $[27] = t14;
  } else {
    t14 = $[27];
  }
  let t15;
  if ($[28] !== classes.radio) {
    t15 = /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: classes.radio, size: "xs", label: "LDAP", value: "true" });
    $[28] = classes.radio;
    $[29] = t15;
  } else {
    t15 = $[29];
  }
  let t16;
  if ($[30] !== t11 || $[31] !== t14 || $[32] !== t15) {
    t16 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Radio.Group, { ...t11, children: [
      t14,
      t15
    ] });
    $[30] = t11;
    $[31] = t14;
    $[32] = t15;
    $[33] = t16;
  } else {
    t16 = $[33];
  }
  let t17;
  if ($[34] !== classes.description || $[35] !== classes.groupGrid || $[36] !== classes.label || $[37] !== classes.labelWithTooltip || $[38] !== classes.radio || $[39] !== classes.red || $[40] !== classes.textFieldInput || $[41] !== classes.title || $[42] !== form || $[43] !== isMobile || $[44] !== t || $[45] !== theme) {
    t17 = form.getTransformedValues().useLDAP === "true" && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { columns: isMobile ? 1 : 2, style: {
        alignSelf: "stretch"
      }, mt: "md", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("servers.server"), withAsterisk: true, ...form.getInputProps("server") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("domains.domain"), withAsterisk: true, ...form.getInputProps("Domain") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("filials.authorization.dn"), withAsterisk: true, ...form.getInputProps("DN") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NumberInput, { className: classes.textFieldInput, placeholder: t("servers.port"), label: t("servers.port"), autoComplete: "off", withAsterisk: true, hideControls: true, ...form.getInputProps("Port") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(SimpleGrid, { mt: "md", cols: 1, w: "100%", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("UserFilter"), label: t("filials.authorization.filter") }) }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("profile.login"), withAsterisk: true, ...form.getInputProps("login") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PasswordInput, { className: classes.textFieldInput, label: t("login.password"), withAsterisk: true, ...form.getInputProps("password") }) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(SimpleGrid, { mt: "md", cols: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { sx: {
        "& input": {
          cursor: "pointer"
        }
      }, size: "sm", ...form.getInputProps("UseSsl", {
        type: "checkbox"
      }), label: t("filials.authorization.ssl") }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, mb: 10, mt: 32, children: t("filials.authorization.attributes") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, mb: 16, mt: 0, children: t("filials.authorization.description") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { columns: 2, children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          t("filials.authorization.identifier"),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.principal_name") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          t("profile.login"),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.login") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          t("name"),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.first_name") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          t("profile.surName"),
          " ",
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.second_name") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("profile.middleName") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.middle_name") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          " ",
          t("filials.authorization.mail")
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.email") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
          " ",
          t("profile.phone")
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.phone") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("filials.authorization.birthdate") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.birthdate") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("profile.position") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.position") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("filials.authorization.organization") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.organization") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("filials.authorization.address") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.city") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.label, children: t("filials.authorization.blocked") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.isDeleted") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { className: classes.labelWithTooltip, children: [
          t("filials.authorization.teamNumber"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { w: "200px", multiline: true, label: t("filials.authorization.teamNumberDescription"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { h: 16, children: /* @__PURE__ */ jsxRuntimeExports.jsx(zte, { size: 16, stroke: "2", color: theme.colors.brandGray[0] }) }) })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.teamNumber") }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { className: classes.labelWithTooltip, children: [
          t("filials.authorization.linkEmail"),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { label: t("filials.authorization.linkEmailDescription"), w: "200px", multiline: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { h: 16, children: /* @__PURE__ */ jsxRuntimeExports.jsx(zte, { size: 16, stroke: "2", color: theme.colors.brandGray[0] }) }) })
        ] }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("mapping.linkEmail") }) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { style: {
        width: "100%",
        marginTop: "32px",
        marginBottom: "16px",
        color: "#D0D5DD"
      } }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, children: t("filials.authorization.exportGroup") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, mb: 16, mt: 0, children: t("filials.authorization.exportModel") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Radio.Group, { ...form.getInputProps("GroupEnabled"), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: classes.radio, size: "xs", label: t("disable"), value: "false" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: classes.radio, size: "xs", label: t("enable"), value: "true" })
      ] }),
      form.getTransformedValues().GroupEnabled === "true" && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { columns: isMobile ? 1 : 2, style: {
          alignSelf: "stretch"
        }, mt: "md", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("filials.authorization.dnGroup"), withAsterisk: true, ...form.getInputProps("GroupDn") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, label: t("filials.authorization.filterGroup"), withAsterisk: true, ...form.getInputProps("GroupFilter") }) })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, mb: 10, mt: 32, children: t("filials.authorization.groupAttributes") }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, mb: 16, mt: 0, children: t("filials.authorization.groupDescription") }),
        /* @__PURE__ */ jsxRuntimeExports.jsxs(Grid, { columns: 2, className: classes.groupGrid, mt: "md", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
            t("filials.authorization.id"),
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("GroupMapping.Uid") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
            t("profile.firstName"),
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("GroupMapping.Name") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
            t("filials.authorization.userId"),
            " ",
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: classes.red, children: "*" })
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("GroupMapping.Member") }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, pt: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text, { className: classes.label, children: [
            " ",
            t("filials.authorization.details")
          ] }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx(Grid.Col, { span: 1, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TextInput, { className: classes.textFieldInput, withAsterisk: true, ...form.getInputProps("GroupMapping.Description") }) })
        ] })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { style: {
        width: "100%",
        marginTop: "32px",
        marginBottom: "16px",
        color: "#D0D5DD"
      } }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.title, children: t("filials.authorization.refferalTitle") }),
      /* @__PURE__ */ jsxRuntimeExports.jsx(Text, { className: classes.description, mb: 16, mt: 0, children: t("filials.authorization.refferalDescription") }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs(Radio.Group, { ...form.getInputProps("ReferralFollowing"), children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: classes.radio, size: "xs", label: t("disable"), value: "false" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(Radio, { className: classes.radio, size: "xs", label: t("enable"), value: "true" })
      ] })
    ] });
    $[34] = classes.description;
    $[35] = classes.groupGrid;
    $[36] = classes.label;
    $[37] = classes.labelWithTooltip;
    $[38] = classes.radio;
    $[39] = classes.red;
    $[40] = classes.textFieldInput;
    $[41] = classes.title;
    $[42] = form;
    $[43] = isMobile;
    $[44] = t;
    $[45] = theme;
    $[46] = t17;
  } else {
    t17 = $[46];
  }
  let t18;
  if ($[47] !== form) {
    t18 = !form.isValid() || !form.isDirty();
    $[47] = form;
    $[48] = t18;
  } else {
    t18 = $[48];
  }
  let t19;
  if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
    t19 = {
      padding: "0 20px"
    };
    $[49] = t19;
  } else {
    t19 = $[49];
  }
  let t20;
  if ($[50] !== t) {
    t20 = t("save");
    $[50] = t;
    $[51] = t20;
  } else {
    t20 = $[51];
  }
  let t21;
  if ($[52] !== t18 || $[53] !== t20) {
    t21 = /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", size: "sm", radius: 8, disabled: t18, mt: "md", mr: "md", style: t19, children: t20 });
    $[52] = t18;
    $[53] = t20;
    $[54] = t21;
  } else {
    t21 = $[54];
  }
  let t22;
  if ($[55] !== classes.rotate || $[56] !== ((_a = filial == null ? void 0 : filial.Settings) == null ? void 0 : _a.Ldap.Enabled) || $[57] !== handleRefresh || $[58] !== isLdapSync || $[59] !== t) {
    t22 = ((_b = filial == null ? void 0 : filial.Settings) == null ? void 0 : _b.Ldap.Enabled) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", radius: 8, color: "green", mt: "md", rightSection: /* @__PURE__ */ jsxRuntimeExports.jsx(Dze, { size: 24, className: isLdapSync ? classes.rotate : "" }), onClick: () => handleRefresh(), disabled: isLdapSync, children: t("sync") }) : null;
    $[55] = classes.rotate;
    $[56] = (_c = filial == null ? void 0 : filial.Settings) == null ? void 0 : _c.Ldap.Enabled;
    $[57] = handleRefresh;
    $[58] = isLdapSync;
    $[59] = t;
    $[60] = t22;
  } else {
    t22 = $[60];
  }
  let t23;
  if ($[61] !== t21 || $[62] !== t22) {
    t23 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { w: "100%", children: [
      t21,
      t22
    ] });
    $[61] = t21;
    $[62] = t22;
    $[63] = t23;
  } else {
    t23 = $[63];
  }
  let t24;
  if ($[64] !== classes.section || $[65] !== t10 || $[66] !== t16 || $[67] !== t17 || $[68] !== t23) {
    t24 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { className: t7, align: "flex-start", direction: "column", children: [
      t10,
      t16,
      t17,
      t23
    ] });
    $[64] = classes.section;
    $[65] = t10;
    $[66] = t16;
    $[67] = t17;
    $[68] = t23;
    $[69] = t24;
  } else {
    t24 = $[69];
  }
  let t25;
  if ($[70] !== t24 || $[71] !== t6) {
    t25 = /* @__PURE__ */ jsxRuntimeExports.jsx("form", { onSubmit: t6, children: t24 });
    $[70] = t24;
    $[71] = t6;
    $[72] = t25;
  } else {
    t25 = $[72];
  }
  let t26;
  if ($[73] !== classes.container || $[74] !== t25) {
    t26 = /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: t5, children: t25 });
    $[73] = classes.container;
    $[74] = t25;
    $[75] = t26;
  } else {
    t26 = $[75];
  }
  return t26;
};
function _temp(state) {
  return state.filials;
}
export {
  LDAPPage as default
};
//# sourceMappingURL=index-BLmUkvkI.js.map
